Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uid2 decouple cstg #2

Merged
merged 14 commits into from
Oct 10, 2023
3 changes: 2 additions & 1 deletion features.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"NATIVE",
"VIDEO"
"VIDEO",
"UID2_CSTG"
]
2 changes: 1 addition & 1 deletion integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</script>
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>

<script>
function getHashedEmail() { }
Expand Down
17 changes: 9 additions & 8 deletions modules/uid2IdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { logInfo, logWarn } from '../src/utils.js';
import {submodule} from '../src/hook.js';
import { submodule } from '../src/hook.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

Expand Down Expand Up @@ -83,21 +83,22 @@ export const uid2IdSubmodule = {
return;
}

let mappedCstgConfig = {
serverPublicKey: config?.params?.serverPublicKey,
subscriptionId: config?.params?.subscriptionId,
...extractIdentityFromParams(config?.params ?? {})
}

const mappedConfig = {
apiBaseUrl: config?.params?.uid2ApiBase ?? UID2_BASE_URL,
paramToken: config?.params?.uid2Token,
serverCookieName: config?.params?.uid2Cookie ?? config?.params?.uid2ServerCookie,
storage: config?.params?.storage ?? 'localStorage',
cstg: mappedCstgConfig,
clientId: UID2_CLIENT_ID,
internalStorage: ADVERTISING_COOKIE
}

if (FEATURES.UID2_CSTG) {
mappedConfig.cstg = {
serverPublicKey: config?.params?.serverPublicKey,
subscriptionId: config?.params?.subscriptionId,
...extractIdentityFromParams(config?.params ?? {})
}
}
_logInfo(`UID2 configuration loaded and mapped.`, mappedConfig);
const result = Uid2GetId(mappedConfig, storage, _logInfo, _logWarn);
_logInfo(`UID2 getId returned`, result);
Expand Down
Loading