Skip to content

Commit

Permalink
Revert "Utiq ID submodule: Update submodule name and parameters (preb…
Browse files Browse the repository at this point in the history
…id#10587)" (prebid#10606)

This reverts commit 86736ac.
  • Loading branch information
patmmccann authored Oct 13, 2023
1 parent e1f446c commit 2b3426d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"tapadIdSystem",
"teadsIdSystem",
"tncIdSystem",
"utiqIdSystem",
"utiqSystem",
"uid2IdSystem",
"euidIdSystem",
"unifiedIdSystem",
Expand Down
8 changes: 4 additions & 4 deletions modules/utiqIdSystem.js → modules/utiqSystem.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* This module adds Utiq provided by Utiq SA/NV to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/utiqIdSystem
* @module modules/utiqSystem
* @requires module:modules/userId
*/
import { logInfo } from '../src/utils.js';
import { submodule } from '../src/hook.js';
import { getStorageManager } from '../src/storageManager.js';
import { MODULE_TYPE_UID } from '../src/activities/modules.js';

const MODULE_NAME = 'utiqId';
const MODULE_NAME = 'utiq';
const LOG_PREFIX = 'Utiq module';

export const storage = getStorageManager({
Expand Down Expand Up @@ -56,7 +56,7 @@ function getUtiqFromStorage() {
}

/** @type {Submodule} */
export const utiqIdSubmodule = {
export const utiqSubmodule = {
/**
* Used to link submodule with config
* @type {string}
Expand Down Expand Up @@ -135,4 +135,4 @@ export const utiqIdSubmodule = {
}
};

submodule('userId', utiqIdSubmodule);
submodule('userId', utiqSubmodule);
7 changes: 6 additions & 1 deletion modules/utiqIdSystem.md → modules/utiqSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Utiq ID Module.
First, make sure to add the utiq submodule to your Prebid.js package with:

```
gulp build --modules=userId,adfBidAdapter,ixBidAdapter,prebidServerBidAdapter,utiqIdSystem
gulp build --modules=userId,adfBidAdapter,ixBidAdapter,prebidServerBidAdapter,utiqSystem
```

## Parameter Descriptions
Expand All @@ -15,3 +15,8 @@ gulp build --modules=userId,adfBidAdapter,ixBidAdapter,prebidServerBidAdapter,ut
| name | String | The name of the module | `"utiq"` |
| params | Object | Object with configuration parameters for utiq User Id submodule | - |
| params.maxDelayTime | Integer | Max amount of time (in seconds) before looking into storage for data | 2500 |
| bidders | Array of Strings | An array of bidder codes to which this user ID may be sent. Currently required and supporting AdformOpenRTB | [`"adf"`, `"adformPBS"`, `"ix"`] |
| storage | Object | Local storage configuration object | - |
| storage.type | String | Type of the storage that would be used to store user ID. Must be `"html5"` to utilise HTML5 local storage. | `"html5"` |
| storage.name | String | The name of the key in local storage where the user ID will be stored. | `"utiq"` |
| storage.expires | Integer | How long (in days) the user ID information will be stored. For safety reasons, this information is required. | `1` |
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai';
import { utiqIdSubmodule } from 'modules/utiqIdSystem.js';
import { storage } from 'modules/utiqIdSystem.js';
import { utiqSubmodule } from 'modules/utiqSystem.js';
import { storage } from 'modules/utiqSystem.js';

describe('utiqIdSystem', () => {
describe('utiqSystem', () => {
const utiqPassKey = 'utiqPass';

const getStorageData = (idGraph) => {
Expand All @@ -17,7 +17,7 @@ describe('utiqIdSystem', () => {
};

it('should have the correct module name declared', () => {
expect(utiqIdSubmodule.name).to.equal('utiqId');
expect(utiqSubmodule.name).to.equal('utiq');
});

describe('utiq getId()', () => {
Expand All @@ -26,13 +26,13 @@ describe('utiqIdSystem', () => {
});

it('it should return object with key callback', () => {
expect(utiqIdSubmodule.getId()).to.have.property('callback');
expect(utiqSubmodule.getId()).to.have.property('callback');
});

it('should return object with key callback with value type - function', () => {
storage.setDataInLocalStorage(utiqPassKey, JSON.stringify(getStorageData()));
expect(utiqIdSubmodule.getId()).to.have.property('callback');
expect(typeof utiqIdSubmodule.getId().callback).to.be.equal('function');
expect(utiqSubmodule.getId()).to.have.property('callback');
expect(typeof utiqSubmodule.getId().callback).to.be.equal('function');
});

it('tests if localstorage & JSON works properly ', () => {
Expand All @@ -50,7 +50,7 @@ describe('utiqIdSystem', () => {
'atid': 'atidValue',
};
storage.setDataInLocalStorage(utiqPassKey, JSON.stringify(getStorageData(idGraph)));
const response = utiqIdSubmodule.getId();
const response = utiqSubmodule.getId();
expect(response).to.have.property('id');
expect(response.id).to.have.property('utiq');
expect(response.id.utiq).to.be.equal('atidValue');
Expand All @@ -61,7 +61,7 @@ describe('utiqIdSystem', () => {
'domain': 'test.domain',
'atid': 'atidValue',
};
const response = utiqIdSubmodule.getId();
const response = utiqSubmodule.getId();
expect(response).to.have.property('callback');
expect(response.callback.toString()).contain('result(callback)');

Expand All @@ -82,7 +82,7 @@ describe('utiqIdSystem', () => {
'atid': 'atidValue',
};

const response = utiqIdSubmodule.getId();
const response = utiqSubmodule.getId();
expect(response).to.have.property('callback');
expect(response.callback.toString()).contain('result(callback)');

Expand All @@ -105,7 +105,7 @@ describe('utiqIdSystem', () => {
'atid': 'atidValue',
};

const response = utiqIdSubmodule.getId({params: {maxDelayTime: 200}});
const response = utiqSubmodule.getId({params: {maxDelayTime: 200}});
expect(response).to.have.property('callback');
expect(response.callback.toString()).contain('result(callback)');

Expand Down Expand Up @@ -138,15 +138,15 @@ describe('utiqIdSystem', () => {
];
VALID_API_RESPONSES.forEach(responseData => {
it('should return a newly constructed object with the utiq for a payload with {utiq: value}', () => {
expect(utiqIdSubmodule.decode(responseData.payload)).to.deep.equal(
expect(utiqSubmodule.decode(responseData.payload)).to.deep.equal(
{utiq: responseData.expected}
);
});
});

[{}, '', {foo: 'bar'}].forEach((response) => {
it(`should return null for an invalid response "${JSON.stringify(response)}"`, () => {
expect(utiqIdSubmodule.decode(response)).to.be.null;
expect(utiqSubmodule.decode(response)).to.be.null;
});
});
});
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('utiqIdSystem', () => {

window.dispatchEvent(new MessageEvent('message', eventData));

const response = utiqIdSubmodule.getId();
const response = utiqSubmodule.getId();
expect(response).to.have.property('id');
expect(response.id).to.have.property('utiq');
expect(response.id.utiq).to.be.equal('atidValue');
Expand Down

0 comments on commit 2b3426d

Please sign in to comment.