@optable/web-sdk 0.26.3 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -4
- package/browser/dist/sdk.js +1 -1
- package/lib/dist/build.json +1 -1
- package/lib/dist/config.d.ts +17 -2
- package/lib/dist/config.js +9 -3
- package/lib/dist/core/network.js +7 -1
- package/lib/dist/core/resolvers/resolveMultiTargeting.d.ts +14 -0
- package/lib/dist/core/resolvers/resolveMultiTargeting.js +107 -0
- package/lib/dist/core/storage.d.ts +5 -2
- package/lib/dist/core/storage.js +35 -34
- package/lib/dist/edge/targeting.d.ts +2 -0
- package/lib/dist/edge/tokenize.js +5 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -92,9 +92,45 @@ const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site", cookies:
|
|
|
92
92
|
|
|
93
93
|
Note that the default is `cookies: true` and will be inferred if you do not specify the `cookies` parameter at all.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
# Using (npm module)
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
## Initialization Configuration (`InitConfig`)
|
|
98
|
+
|
|
99
|
+
When creating an instance of `OptableSDK`, you can pass an `InitConfig` object to customize its behavior. Below are the available configuration keys and their descriptions:
|
|
100
|
+
|
|
101
|
+
### Required Keys
|
|
102
|
+
|
|
103
|
+
- **`site` (string)**
|
|
104
|
+
The identifier (slug) of Javascript SDK source. This must match a configured site in the [Optable](https://optable.co/) DCN. Must have properly configure `Allowed HTTP Origins`.
|
|
105
|
+
|
|
106
|
+
- **`host` (string)**
|
|
107
|
+
The hostname of the Optable DCN to which the SDK will connect. All API requests will be directed here.
|
|
108
|
+
|
|
109
|
+
### Optional Keys
|
|
110
|
+
|
|
111
|
+
- **`node` (string)**
|
|
112
|
+
If supported by the DCN host, specify the API node for SDK requests. Used in multi-node environments.
|
|
113
|
+
|
|
114
|
+
- **`cookies` (boolean, default: `true`)**
|
|
115
|
+
If `true`, enables the use of browser cookies for storage.
|
|
116
|
+
|
|
117
|
+
- **`legacyHostCache` (string)**
|
|
118
|
+
Used when migrating from one DCN host to another. If specified, it retains the previous cache state when switching hosts.
|
|
119
|
+
|
|
120
|
+
- **`initPassport` (boolean, default: `true`)**
|
|
121
|
+
If `true`, initializes the user passport (identity mechanism) upon SDK load.
|
|
122
|
+
|
|
123
|
+
- **`consent` (`InitConsent`)**
|
|
124
|
+
Defines the consent settings for data collection and processing.
|
|
125
|
+
|
|
126
|
+
- **`readOnly` (boolean, default: `false`)**
|
|
127
|
+
When set to `true`, puts the SDK in a read-only mode, preventing any data modifications while still allowing API queries.
|
|
128
|
+
|
|
129
|
+
These configurations allow fine-tuned control over how the `OptableSDK` interacts with the Optable DCN, ensuring compatibility with different environments and privacy settings.
|
|
130
|
+
|
|
131
|
+
## Usage Example
|
|
132
|
+
|
|
133
|
+
To configure an instance of `OptableSDK` integrating with an Optable DCN running at hostname `dcn.customer.com`, from a configured web site origin identified by slug `my-site`, you simply create an instance of the `OptableSDK` class exported by the `@optable/web-sdk` module:
|
|
98
134
|
|
|
99
135
|
```js
|
|
100
136
|
import OptableSDK from "@optable/web-sdk";
|
|
@@ -102,9 +138,12 @@ import OptableSDK from "@optable/web-sdk";
|
|
|
102
138
|
const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site" });
|
|
103
139
|
```
|
|
104
140
|
|
|
105
|
-
You can then call various SDK APIs on the instance as shown in the examples below. It
|
|
141
|
+
You can then call various SDK APIs on the instance as shown in the examples below. It is also possible to configure multiple instances of `OptableSDK` in order to connect to different DCNs or reference multiple site slugs.
|
|
142
|
+
|
|
143
|
+
### Security & Privacy
|
|
106
144
|
|
|
107
|
-
|
|
145
|
+
- All SDK communication with Optable DCNs is done over TLS to ensure data security.
|
|
146
|
+
- The `consent` option allows compliance with privacy regulations by defining explicit data collection settings.
|
|
108
147
|
|
|
109
148
|
### Identify API
|
|
110
149
|
|
|
@@ -674,3 +713,71 @@ $ docker-compose up
|
|
|
674
713
|
Then head to [https://localhost:8180/](localhost:8180) to see the demo pages. You can modify the code in each demo, then run `make build` and finally refresh the demo pages to see your changes take effect. If you want to test the demos with your own DCN, make sure to update the configuration (hostname and site slug) given to the OptableSDK (see `webpack.config.js` for the react example).
|
|
675
714
|
|
|
676
715
|
Note that using HTTP first-party cookies with a local instance of the demos pages pointing to an Optable DCN will not work because [https://localhost:8180/](localhost:8180) does not share the same top-level domain name `.optable.co`. We recommend using [LocalStorage](https://github.com/Optable/optable-web-sdk#localstorage) instead.
|
|
716
|
+
|
|
717
|
+
## Multi-Node Targeting Resolver
|
|
718
|
+
|
|
719
|
+
Resolves multiple **Node Targeting Rules** based on **priority** or **aggregation**.
|
|
720
|
+
This function is available under `window.optable.utils` as part of a collection of helper methods extending the SDK.
|
|
721
|
+
|
|
722
|
+
### **Usage**
|
|
723
|
+
|
|
724
|
+
Define targeting rules:
|
|
725
|
+
|
|
726
|
+
```typescript
|
|
727
|
+
const rules: NodeTargetingRule[] = [
|
|
728
|
+
{
|
|
729
|
+
targetingFn: async () => window.optable.node_sdk_instance_one.targeting(),
|
|
730
|
+
matcher: "your_domain",
|
|
731
|
+
mm: 3, // Authenticated
|
|
732
|
+
priority: 1, // Highest Priority (Optional)
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
targetingFn: async () => window.optable.node_sdk_instance_two.targeting("__ip__"),
|
|
736
|
+
matcher: "third_party_vendor"
|
|
737
|
+
mm: 5, // inference
|
|
738
|
+
priority: 2, // Lower Priority (Optional)
|
|
739
|
+
},
|
|
740
|
+
];
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
Call the resolver:
|
|
744
|
+
|
|
745
|
+
```typescript
|
|
746
|
+
const result = await window.optable.utils.resolveMultiNodeTargeting(rules);
|
|
747
|
+
console.log(result);
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
### **Rules**
|
|
751
|
+
|
|
752
|
+
- If **any rule has a `priority`**, the function will return the response with the highest priority (1 being the highest). Lower priorities (2, 3, etc.) are considered progressively less important. Any rules with priority values of 0 or below are ignored.
|
|
753
|
+
- If **multiple nodes share the highest priority**, merges their `eids`.
|
|
754
|
+
- If **no priority is set**, aggregates all responses.
|
|
755
|
+
|
|
756
|
+
### **Return Value**
|
|
757
|
+
|
|
758
|
+
```typescript
|
|
759
|
+
type MultiNodeTargetingResponse = {
|
|
760
|
+
// All sources that resolved the response
|
|
761
|
+
eidSources: Set<string>;
|
|
762
|
+
// IAB OpenRTB 2.6 Ortb2 User Object (Partial)
|
|
763
|
+
ortb2: { user: { eids: EID[]; data: Data[] } };
|
|
764
|
+
};
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
### **Input Type**
|
|
768
|
+
|
|
769
|
+
```typescript
|
|
770
|
+
type NodeTargetingRule = {
|
|
771
|
+
// Targeting function to resolve. e.g. window.optable.node_sdk_instance.targeting('__ip__')
|
|
772
|
+
targetingFn: () => Optable.TargetingFn(targetingArg: string);
|
|
773
|
+
// Technology provider domain
|
|
774
|
+
matcher: string;
|
|
775
|
+
// Match method (mm) based on IAB v26 standards.
|
|
776
|
+
// Determines how the ID was matched. Possible values:
|
|
777
|
+
// 0 = unknown, 1 = no_match, 2 = cookie_sync, 3 = authenticated, 4 = observed, 5 = inference.
|
|
778
|
+
mm: IDMatchMethod;
|
|
779
|
+
// (Optional) If provided we will only pick one resolved Ortb2Response from the most prioritize matcher.
|
|
780
|
+
// Any values below 1 will be threated as ignore
|
|
781
|
+
priority?: number;
|
|
782
|
+
};
|
|
783
|
+
```
|
package/browser/dist/sdk.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see sdk.js.LICENSE.txt */
|
|
2
|
-
(()=>{var t={396:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},312:(t,e,r)=>{var i;!function(){"use strict";var e="input is invalid type",n="object"==typeof window,s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self,a=!s.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;a?s=r.g:o&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&t.exports,u=r.amdO,h=!s.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,p="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],g=[24,16,8,0],l=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=["hex","array","digest","arrayBuffer"],m=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!h||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new b(e,!0).update(r)[t]()}},w=function(t){var e=y("hex",t);a&&(e=A(e,t)),e.create=function(){return new b(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r<f.length;++r){var i=f[r];e[i]=y(i,t)}return e},A=function(t,i){var n,o=r(394),a=r(903).Buffer,c=i?"sha224":"sha256";return n=a.from&&!s.JS_SHA256_NO_BUFFER_FROM?a.from:function(t){return new a(t)},function(r){if("string"==typeof r)return o.createHash(c).update(r,"utf8").digest("hex");if(null==r)throw new Error(e);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===a?o.createHash(c).update(n(r)).digest("hex"):t(r)}},v=function(t,e){return function(r,i){return new I(r,e,!0).update(i)[t]()}},S=function(t){var e=v("hex",t);e.create=function(e){return new I(e,t)},e.update=function(t,r){return e.create(t).update(r)};for(var r=0;r<f.length;++r){var i=f[r];e[i]=v(i,t)}return e};function b(t,e){e?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}function I(t,r,i){var n,s=typeof t;if("string"===s){var o,a=[],c=t.length,u=0;for(n=0;n<c;++n)(o=t.charCodeAt(n))<128?a[u++]=o:o<2048?(a[u++]=192|o>>>6,a[u++]=128|63&o):o<55296||o>=57344?(a[u++]=224|o>>>12,a[u++]=128|o>>>6&63,a[u++]=128|63&o):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++n)),a[u++]=240|o>>>18,a[u++]=128|o>>>12&63,a[u++]=128|o>>>6&63,a[u++]=128|63&o);t=a}else{if("object"!==s)throw new Error(e);if(null===t)throw new Error(e);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(e)}t.length>64&&(t=new b(r,!0).update(t).array());var p=[],d=[];for(n=0;n<64;++n){var g=t[n]||0;p[n]=92^g,d[n]=54^g}b.call(this,r,i),this.update(d),this.oKeyPad=p,this.inner=!0,this.sharedMemory=i}b.prototype.update=function(t){if(!this.finalized){var r,i=typeof t;if("string"!==i){if("object"!==i)throw new Error(e);if(null===t)throw new Error(e);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var n,s,o=0,a=t.length,c=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,this.block=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),r)for(s=this.start;o<a&&s<64;++o)c[s>>>2]|=t[o]<<g[3&s++];else for(s=this.start;o<a&&s<64;++o)(n=t.charCodeAt(o))<128?c[s>>>2]|=n<<g[3&s++]:n<2048?(c[s>>>2]|=(192|n>>>6)<<g[3&s++],c[s>>>2]|=(128|63&n)<<g[3&s++]):n<55296||n>=57344?(c[s>>>2]|=(224|n>>>12)<<g[3&s++],c[s>>>2]|=(128|n>>>6&63)<<g[3&s++],c[s>>>2]|=(128|63&n)<<g[3&s++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),c[s>>>2]|=(240|n>>>18)<<g[3&s++],c[s>>>2]|=(128|n>>>12&63)<<g[3&s++],c[s>>>2]|=(128|n>>>6&63)<<g[3&s++],c[s>>>2]|=(128|63&n)<<g[3&s++]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=c[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},b.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=d[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},b.prototype.hash=function(){var t,e,r,i,n,s,o,a,c,u=this.h0,h=this.h1,p=this.h2,d=this.h3,g=this.h4,f=this.h5,m=this.h6,y=this.h7,w=this.blocks;for(t=16;t<64;++t)e=((n=w[t-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,r=((n=w[t-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,w[t]=w[t-16]+e+w[t-7]+r|0;for(c=h&p,t=0;t<64;t+=4)this.first?(this.is224?(s=300032,y=(n=w[0]-1413257819)-150054599|0,d=n+24177077|0):(s=704751109,y=(n=w[0]-210244248)-1521486534|0,d=n+143694565|0),this.first=!1):(e=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(s=u&h)^u&p^c,y=d+(n=y+(r=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&f^~g&m)+l[t]+w[t])|0,d=n+(e+i)|0),e=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),i=(o=d&u)^d&h^s,m=p+(n=m+(r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&g^~y&f)+l[t+1]+w[t+1])|0,e=((p=n+(e+i)|0)>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),i=(a=p&d)^p&u^o,f=h+(n=f+(r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&y^~m&g)+l[t+2]+w[t+2])|0,e=((h=n+(e+i)|0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(c=h&p)^h&d^a,g=u+(n=g+(r=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&y)+l[t+3]+w[t+3])|0,u=n+(e+i)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+u|0,this.h1=this.h1+h|0,this.h2=this.h2+p|0,this.h3=this.h3+d|0,this.h4=this.h4+g|0,this.h5=this.h5+f|0,this.h6=this.h6+m|0,this.h7=this.h7+y|0},b.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,o=this.h6,a=this.h7,c=p[t>>>28&15]+p[t>>>24&15]+p[t>>>20&15]+p[t>>>16&15]+p[t>>>12&15]+p[t>>>8&15]+p[t>>>4&15]+p[15&t]+p[e>>>28&15]+p[e>>>24&15]+p[e>>>20&15]+p[e>>>16&15]+p[e>>>12&15]+p[e>>>8&15]+p[e>>>4&15]+p[15&e]+p[r>>>28&15]+p[r>>>24&15]+p[r>>>20&15]+p[r>>>16&15]+p[r>>>12&15]+p[r>>>8&15]+p[r>>>4&15]+p[15&r]+p[i>>>28&15]+p[i>>>24&15]+p[i>>>20&15]+p[i>>>16&15]+p[i>>>12&15]+p[i>>>8&15]+p[i>>>4&15]+p[15&i]+p[n>>>28&15]+p[n>>>24&15]+p[n>>>20&15]+p[n>>>16&15]+p[n>>>12&15]+p[n>>>8&15]+p[n>>>4&15]+p[15&n]+p[s>>>28&15]+p[s>>>24&15]+p[s>>>20&15]+p[s>>>16&15]+p[s>>>12&15]+p[s>>>8&15]+p[s>>>4&15]+p[15&s]+p[o>>>28&15]+p[o>>>24&15]+p[o>>>20&15]+p[o>>>16&15]+p[o>>>12&15]+p[o>>>8&15]+p[o>>>4&15]+p[15&o];return this.is224||(c+=p[a>>>28&15]+p[a>>>24&15]+p[a>>>20&15]+p[a>>>16&15]+p[a>>>12&15]+p[a>>>8&15]+p[a>>>4&15]+p[15&a]),c},b.prototype.toString=b.prototype.hex,b.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,o=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,255&a),c},b.prototype.array=b.prototype.digest,b.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},I.prototype=new b,I.prototype.finalize=function(){if(b.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();b.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),b.prototype.finalize.call(this)}};var P=w();P.sha256=P,P.sha224=w(!0),P.sha256.hmac=S(),P.sha224.hmac=S(!0),c?t.exports=P:(s.sha256=P.sha256,s.sha224=P.sha224,u&&(void 0===(i=function(){return P}.call(P,r,P,t))||(t.exports=i)))}()},903:()=>{},394:()=>{}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.amdO={},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=r(396),e=r.n(t);const i={r:"v0.26.3"},n={"Europe/Vienna":"gdpr","Europe/Brussels":"gdpr","Europe/Sofia":"gdpr","Europe/Zagreb":"gdpr","Asia/Nicosia":"gdpr","Europe/Nicosia":"gdpr","Europe/Prague":"gdpr","Europe/Copenhagen":"gdpr","Europe/Tallinn":"gdpr","Europe/Helsinki":"gdpr","Europe/Paris":"gdpr","Europe/Berlin":"gdpr","Europe/Athens":"gdpr","Europe/Budapest":"gdpr","Atlantic/Reykjavik":"gdpr","Europe/Dublin":"gdpr","Europe/Rome":"gdpr","Europe/Riga":"gdpr","Europe/Vaduz":"gdpr","Europe/Vilnius":"gdpr","Europe/Luxembourg":"gdpr","Europe/Malta":"gdpr","Europe/Oslo":"gdpr","Europe/Warsaw":"gdpr","Europe/Lisbon":"gdpr","Europe/Bucharest":"gdpr","Europe/Bratislava":"gdpr","Europe/Ljubljana":"gdpr","Europe/Madrid":"gdpr","Europe/Stockholm":"gdpr","Europe/Amsterdam":"gdpr","Atlantic/Azores":"gdpr","Atlantic/Canary":"gdpr","America/Cayenne":"gdpr","America/Guadeloupe":"gdpr","Atlantic/Madeira":"gdpr","America/Martinique":"gdpr","Indian/Mayotte":"gdpr","Indian/Reunion":"gdpr","America/Marigot":"gdpr","Europe/Zurich":"gdpr","Europe/London":"gdpr","America/Toronto":"can","America/Adak":"us","America/Anchorage":"us","America/Atka":"us","America/Boise":"us","America/Chicago":"us","America/Denver":"us","America/Detroit":"us","America/Indiana/Indianapolis":"us","America/Indiana/Knox":"us","America/Indiana/Marengo":"us","America/Indiana/Petersburg":"us","America/Indiana/Tell_City":"us","America/Indiana/Vevay":"us","America/Indiana/Vincennes":"us","America/Indiana/Winamac":"us","America/Indianapolis":"us","America/Juneau":"us","America/Kentucky/Louisville":"us","America/Kentucky/Monticello":"us","America/Knox_IN":"us","America/Los_Angeles":"us","America/Louisville":"us","America/Menominee":"us","America/Metlakatla":"us","America/New_York":"us","America/Nome":"us","America/North_Dakota/Beulah":"us","America/North_Dakota/Center":"us","America/North_Dakota/New_Salem":"us","America/Phoenix":"us","America/Shiprock":"us","America/Sitka":"us","America/Yakutat":"us","Pacific/Honolulu":"us"},s="tcfcav1",o="tcfeuv2",a=[2],c=[5],u=[7,8,10,12,17,13,18,14,19,20,21,15,22,16,11,9];function h(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=function(t,e){const{gdprApplies:r,gppSectionIDs:i,gdprData:n}=e;if(void 0!==r)return r?"gdpr":"gdpr"===t?null:t;if(void 0!==n&&"gdpr"===t)return"gdpr";if(void 0===i||1===i.length&&0===i[0])return t;if(1===i.length&&-1===i[0])return null;if(i.some((t=>a.includes(t))))return"gdpr";if(i.some((t=>c.includes(t))))return"can";if(i.some((t=>u.includes(t))))return"us";switch(t){case"gdpr":if(!i.some((t=>a.includes(t))))return null;break;case"can":if(!i.some((t=>c.includes(t))))return null;break;case"us":if(!i.some((t=>u.includes(t))))return null}return t}(t,e),n={reg:i,gpp:e.gppString,gppSectionIDs:e.gppSectionIDs,gdpr:e.gdprString,gdprApplies:e.gdprApplies,deviceAccess:!1,createProfilesForAdvertising:!1,useProfilesForAdvertising:!1,measureAdvertisingPerformance:!1};switch(i){case"gdpr":e.gdprData?(n.deviceAccess=d(e.gdprData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=d(e.gdprData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=d(e.gdprData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=d(e.gdprData,7,r.tcfeuVendorID)):e.gppData&&(n.deviceAccess=l(e.gppData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=l(e.gppData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=l(e.gppData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=l(e.gppData,7,r.tcfeuVendorID));break;case"can":n.deviceAccess=!0,e.gppData&&(n.createProfilesForAdvertising=g(e.gppData,3,r.tcfcaVendorID),n.useProfilesForAdvertising=g(e.gppData,4,r.tcfcaVendorID),n.measureAdvertisingPerformance=g(e.gppData,7,r.tcfcaVendorID));break;default:n.deviceAccess=!0,n.createProfilesForAdvertising=!0,n.useProfilesForAdvertising=!0,n.measureAdvertisingPerformance=!0}return n}function p(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},i=h(t,r,e);return"function"==typeof window.__tcfapi&&window.__tcfapi?.("addEventListener",2,((n,s)=>{s&&("tcloaded"===n.eventStatus||"useractioncomplete"===n.eventStatus)&&(n=>{r.gdprString=n.tcString,r.gdprApplies=n.gdprApplies,r.gdprData=n,Object.assign(i,h(t,r,e))})(n)})),"function"==typeof window.__gpp&&window.__gpp?.("addEventListener",((n,s)=>{s&&"signalStatus"===n.eventName&&"ready"===n.data&&(n=>{r.gppString=n.gppString,r.gppSectionIDs=n.applicableSections,r.gppData=n,Object.assign(i,h(t,r,e))})(n.pingData)})),i}function d(t,e,r){return r?!!t.purpose?.consents?.[e]&&!!t.vendor?.consents?.[r]:!!t.publisher?.consents?.[e]}function g(t,e,r){const i=e>1,n=t.parsedSections?.[s]||[];if("number"==typeof r){const t=n.find((t=>"Version"in t));if(!t)return!1;let s=t.PurposesExpressConsent.includes(e)&&t.VendorExpressConsent.includes(r);return i&&(s||=t.PurposesImpliedConsent.includes(e)&&t.VendorImpliedConsent.includes(r)),s}const o=n.find((t=>"SubsectionType"in t&&3===t.SubsectionType));if(!o)return!1;let a=o.PubPurposesExpressConsent.includes(e);return i&&(a||=o.PubPurposesImpliedConsent.includes(e)),a}function l(t,e,r){const i=e>1,n=t.parsedSections?.[o]||[];if("number"==typeof r){const t=n.find((t=>"Version"in t));if(!t)return!1;let s=t.PurposeConsent.includes(e)&&t.VendorConsent.includes(r);return i&&(s||=t.PurposesLITransparency.includes(e)&&t.VendorLegitimateInterest.includes(r)),s}const s=n.find((t=>"SegmentType"in t&&3===t.SegmentType));if(!s)return!1;let a=s.PubPurposesConsent.includes(e);return i&&(a||=s.PubPurposesLITransparency.includes(e)),a}const f={cookies:!0,initPassport:!0,consent:{reg:null,deviceAccess:!0,createProfilesForAdvertising:!0,useProfilesForAdvertising:!0,measureAdvertisingPerformance:!0}};async function m(t){const e=await A("/config",t,{method:"GET",headers:{Accept:"application/json"}});return new w(t).setSite(e),e}class y{constructor(t){e()(this,"consent",void 0),this.consent=t}getItem(t){return this.consent.deviceAccess?window.localStorage.getItem(t):null}setItem(t,e){this.consent.deviceAccess&&window.localStorage.setItem(t,e)}removeItem(t){this.consent.deviceAccess&&window.localStorage.removeItem(t)}}class w{constructor(t){this.config=t,e()(this,"passportKey",void 0),e()(this,"targetingV1Key",void 0),e()(this,"targetingKey",void 0),e()(this,"siteKey",void 0),e()(this,"storage",void 0);const r=btoa(function(t){const e=new Uint16Array(t.length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return String.fromCharCode(...new Uint8Array(e.buffer))}(`${this.config.host}/${this.config.site}`));this.targetingV1Key="OPTABLE_TGT_"+r,this.passportKey="OPTABLE_PASS_"+r,this.targetingKey="OPTABLE_V2_TGT_"+r,this.siteKey="OPTABLE_SITE_"+r,this.storage=new y(this.config.consent)}getPassport(){return this.storage.getItem(this.passportKey)}getV1Targeting(){const t=this.storage.getItem(this.targetingV1Key),e=t?JSON.parse(t):null;return e?{user:[],audience:Object.entries(e).map((t=>{let[e,r]=t;return{provider:"optable.co",keyspace:e,rtb_segtax:5001,ids:[].concat(r).map((t=>({id:String(t)})))}}))}:null}getTargeting(){const t=this.storage.getItem(this.targetingKey);return(t?JSON.parse(t):null)||this.getV1Targeting()}setPassport(t){t&&t.length>0&&this.storage.setItem(this.passportKey,t)}setTargeting(t){t&&this.storage.setItem(this.targetingKey,JSON.stringify(t))}setSite(t){t&&this.storage.setItem(this.siteKey,JSON.stringify(t))}getSite(){const t=this.storage.getItem(this.siteKey);return t?JSON.parse(t):null}clearPassport(){this.storage.removeItem(this.passportKey)}clearTargeting(){this.storage.removeItem(this.targetingKey)}clearSite(){this.storage.removeItem(this.siteKey)}}async function A(t,e,r){const n=await globalThis.fetch(function(t,e,r){const{site:n,host:s,cookies:o}=e,a=new URL(`${n}${t}`,`https://${s}`);if(a.searchParams.set("osdk",`web-${i.r}`),void 0!==e.consent.gpp&&a.searchParams.set("gpp",e.consent.gpp),void 0!==e.consent.gppSectionIDs&&a.searchParams.set("gpp_sid",e.consent.gppSectionIDs.join(",")),void 0!==e.consent.gdpr&&a.searchParams.set("gdpr_consent",e.consent.gdpr),void 0!==e.consent.gdprApplies&&a.searchParams.set("gdpr",Number(e.consent.gdprApplies).toString()),o)a.searchParams.set("cookies","yes");else{const t=new w(e).getPassport();a.searchParams.set("cookies","no"),a.searchParams.set("passport",t||"")}const c={...r};return c.credentials="include",new Request(a.toString(),c)}(t,e,r)),s=n.headers.get("Content-Type"),o=s?.startsWith("application/json")?await n.json():await n.text();if(!n.ok)throw new Error(o.error);return o.passport&&(new w(e).setPassport(o.passport),delete o.passport),o}var v;function S(t){return{user:{data:(t?.audience??[]).map((t=>({name:t.provider,segment:t.ids,ext:{segtax:t.rtb_segtax}}))),ext:{eids:(t?.user??[]).map((t=>({source:t.provider,uids:t.ids.map((t=>{let{id:e}=t;return{id:e,atype:v.PersonID}}))})))}}}}function b(t){const e={};if(!t)return e;for(const r of t.audience??[])r.keyspace&&(r.keyspace in e||(e[r.keyspace]=[]),e[r.keyspace].push(...r.ids.map((t=>t.id))));return e}!function(t){t[t.DeviceID=1]="DeviceID",t[t.InAppImpression=2]="InAppImpression",t[t.PersonID=3]="PersonID"}(v||(v={}));var I=r(312);class P{constructor(t){e()(this,"dcn",void 0),e()(this,"init",void 0),this.dcn=function(t){const e={host:t.host,site:t.site,cookies:t.cookies??f.cookies,initPassport:t.initPassport??f.initPassport,consent:f.consent};return t.consent?.static?e.consent=t.consent.static:t.consent?.cmpapi&&(e.consent=p(function(){const t=Intl.DateTimeFormat().resolvedOptions().timeZone,e=n[t];return"can"===e?["fr","fr-CA"].some((t=>navigator.languages.includes(t)))?"can":null:e??null}(),t.consent.cmpapi)),e}(t);const r=()=>{};this.init=this.dcn.initPassport?m(this.dcn).then(r).catch(r):Promise.resolve()}async identify(){await this.init;for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t,e){return A("/identify",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}(this.dcn,e.filter((t=>t)))}async uid2Token(t){return await this.init,function(t,e){return A("/uid2/token",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}(this.dcn,t)}async targeting(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"__passport__";return await this.init,async function(t,e){const r="/v2/targeting?"+new URLSearchParams({id:e}).toString(),i=await A(r,t,{method:"GET",headers:{Accept:"application/json"}});return i&&new w(t).setTargeting(i),i}(this.dcn,t)}targetingFromCache(){return t=this.dcn,new w(t).getTargeting();var t}async site(){return m(this.dcn)}siteFromCache(){return t=this.dcn,new w(t).getSite();var t}targetingClearCache(){var t;t=this.dcn,new w(t).clearTargeting()}async prebidORTB2(){return S(await this.targeting())}prebidORTB2FromCache(){return S(this.targetingFromCache())}async targetingKeyValues(){return b(await this.targeting())}targetingKeyValuesFromCache(){return b(this.targetingFromCache())}async witness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await this.init,function(t,e,r){const i={event:e,properties:r};return A("/witness",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}(this.dcn,t,e)}async profile(t){return await this.init,function(t,e){const r={traits:e};return A("/profile",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(this.dcn,t)}async tokenize(t){return await this.init,function(t,e){let r={id:e};return A("/v1/tokenize",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(this.dcn,t)}async resolve(t){return await this.init,async function(t,e){const r=new URLSearchParams;"string"==typeof e&&r.append("id",e);const i="/v1/resolve?"+r.toString();return function(t){const e={clusters:[],lmpid:""};if("object"!=typeof t||null===t)return e;if("lmpid"in t&&"string"==typeof t?.lmpid&&(e.lmpid=t.lmpid),!("clusters"in t)||!Array.isArray(t?.clusters))return e;for(const r of t.clusters){const t={ids:[],traits:[]};if(Array.isArray(r?.ids))for(const e of r.ids)"string"==typeof e&&t.ids.push(e);if(Array.isArray(r?.traits))for(const e of r.traits)"string"==typeof e?.key&&"string"==typeof e?.value&&t.traits.push({key:e.key,value:e.value});(t.ids.length>0||t.traits.length>0)&&e.clusters.push(t)}return e}(await A(i,t,{method:"GET",headers:{Accept:"application/json"}}))}(this.dcn,t)}static eid(t){return t?"e:"+I.sha256.hex(t.toLowerCase().trim()):""}static sha256(t){return t?I.sha256.hex(t):""}static cid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="c:";if("string"!=typeof t)throw new Error("Invalid ppid");if("number"!=typeof e||isNaN(e)||e<0||e>9)throw new Error("Invalid variant");return e>0&&(r=`c${e}:`),t?r+t.trim():""}static TargetingKeyValues(t){return b(t)}static PrebidORTB2(t){return S(t)}}e()(P,"version",i.r);const E=P;function _(t){return{advertiserId:t.advertiserId?.toString(),campaignId:t.campaignId?.toString(),creativeId:t.creativeId?.toString(),isEmpty:t.isEmpty?.toString(),lineItemId:t.lineItemId?.toString(),serviceName:t.serviceName?.toString(),size:t.size?.toString(),slotElementId:t.slot?.getSlotElementId(),sourceAgnosticCreativeId:t.sourceAgnosticCreativeId?.toString(),sourceAgnosticLineItemId:t.sourceAgnosticLineItemId?.toString()}}E.prototype.installGPTEventListeners=function(){const t=this;t.installGPTEventListeners=function(){},window.googletag=window.googletag||{cmd:[]};const e=window.googletag;e.cmd.push((function(){e.pubads().addEventListener("slotRenderEnded",(function(e){t.witness("googletag.events.slotRenderEnded",_(e))})),e.pubads().addEventListener("impressionViewable",(function(e){t.witness("googletag.events.impressionViewable",_(e))}))}))},E.prototype.installGPTSecureSignals=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];window.googletag=window.googletag||{cmd:[]};const i=window.googletag;e&&e.length>0&&i.cmd.push((()=>{e.forEach((t=>{let{provider:e,id:r}=t;i.secureSignalProviders.push({id:e,collectorFunction:()=>Promise.resolve(r)})}))}))};const C=/^[a-f0-9]{64}$/i;E.prototype.tryIdentifyFromParams=function(t,e){const r=new RegExp(`^${t||"oeid"}$`,"i"),i=new URLSearchParams(window.location.search);let n="";for(const[t,e]of i)if(r.test(t)){n=e;break}""!=n&&(e||function(t){return C.test(t)}(n))&&this.identify((e||"e")+":"+n.toLowerCase())},E.prototype.auctionConfigFromCache=function(){const t=this.siteFromCache();return t?t.auctionConfig??null:null},E.prototype.installGPTAuctionConfigs=function(t){const e=this;e.installGPTAuctionConfigs=function(){},window.googletag=window.googletag||{cmd:[]};const r=window.googletag;r.cmd.push((function(){let i=r.pubads().getSlots();t&&(i=i.filter(t));const n=e.auctionConfigFromCache();if(n)for(const t of i){const e=t.getSizes(),r=[];for(const t of e)"fluid"!==t&&r.push({configKey:n.seller+"-"+t.getWidth()+"x"+t.getHeight(),auctionConfig:{...n,requestedSize:{width:t.getWidth()+"px",height:t.getHeight()+"px"}}});t.setConfig({componentAuction:r})}}))},E.prototype.runAdAuction=async function(t,e){if(!("runAdAuction"in navigator))throw"run-ad-auction not supported";const r=document.getElementById(t);if(!r)throw"spot not found";const i=function(t){const e=window.getComputedStyle(t,null);return{width:e.getPropertyValue("width"),height:e.getPropertyValue("height")}}(r),n=this.auctionConfigFromCache();if(!n)return!1;const s={...n,requestedSize:i,resolveToConfig:!0},o=e?.iframe??!1;o&&(s.resolveToConfig=!1);const a=await navigator.runAdAuction(s);if(!a)return r.replaceChildren(),!1;if(o){const t=document.createElement("iframe");t.src=a,t.style.border="none",t.style.width=i.width,t.style.height=i.height,r.replaceChildren(t)}else{const t=document.createElement("fencedframe");t.config=a,t.style.border="none",r.replaceChildren(t)}return!0},E.prototype.joinAdInterestGroups=async function(){if(!("joinAdInterestGroup"in navigator))throw"join-ad-interest-group not supported";if(!(this.dcn.consent.deviceAccess&&this.dcn.consent.createProfilesForAdvertising&&this.dcn.consent.measureAdvertisingPerformance))throw"consent not granted for joining interest groups";const t=await this.site();if(!t.interestGroupPixel)throw"origin not enabled for protected audience apis";const e=new URL(t.interestGroupPixel),r=document.createElement("iframe");r.src=e.toString(),r.allow="join-ad-interest-group "+e.origin,r.style.display="none";const i=new Promise(((t,e)=>{window.addEventListener("message",(i=>{i.source===r.contentWindow&&("success"!==i.data.result?e():t())}))}));return document.body.appendChild(r),i},E.prototype.getTopics=async function(){if(!("browsingTopics"in document))throw"browsing-topics not supported";if(!this.dcn.consent.deviceAccess)throw"consent not granted for reading browsing topics";const t=await this.site();if(!t.getTopicsURL)throw"origin not enabled for topics api";const e=new URL(t.getTopicsURL),r=document.createElement("iframe");r.src=e.toString(),r.allow="browsing-topics "+e.origin,r.style.display="none";const i=new Promise(((t,e)=>{window.addEventListener("message",(i=>{i.source===r.contentWindow&&(i.data.error?e(new Error(i.data.error.toString())):t(i.data.result))}))}));return document.body.appendChild(r),i},E.prototype.ingestTopics=function(){this.getTopics().then((t=>{if(!t.length)return;const e=t.reduce(((t,e)=>{const r=`topics_v${e.taxonomyVersion}`;return t[r]?t[r]+=",":t[r]="",t[r]+=String(e.topic),t}),{});this.profile(e)})).catch((()=>{}))},window.optable=window.optable||{},window.optable.SDK=E,window.optable.cmd=new class{constructor(t){if(this.cmds=t,Array.isArray(this.cmds))for(const t of this.cmds)"function"==typeof t&&t()}push(t){t()}}(window.optable.cmd||[])})()})();
|
|
2
|
+
(()=>{var t={396:t=>{t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},312:(t,e,r)=>{var i;!function(){"use strict";var e="input is invalid type",n="object"==typeof window,s=n?window:{};s.JS_SHA256_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self,a=!s.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;a?s=r.g:o&&(s=self);var c=!s.JS_SHA256_NO_COMMON_JS&&t.exports,u=r.amdO,d=!s.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),p=[-2147483648,8388608,32768,128],g=[24,16,8,0],l=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=["hex","array","digest","arrayBuffer"],m=[];!s.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!d||!s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new b(e,!0).update(r)[t]()}},w=function(t){var e=y("hex",t);a&&(e=A(e,t)),e.create=function(){return new b(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r<f.length;++r){var i=f[r];e[i]=y(i,t)}return e},A=function(t,i){var n,o=r(394),a=r(903).Buffer,c=i?"sha224":"sha256";return n=a.from&&!s.JS_SHA256_NO_BUFFER_FROM?a.from:function(t){return new a(t)},function(r){if("string"==typeof r)return o.createHash(c).update(r,"utf8").digest("hex");if(null==r)throw new Error(e);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===a?o.createHash(c).update(n(r)).digest("hex"):t(r)}},v=function(t,e){return function(r,i){return new P(r,e,!0).update(i)[t]()}},S=function(t){var e=v("hex",t);e.create=function(e){return new P(e,t)},e.update=function(t,r){return e.create(t).update(r)};for(var r=0;r<f.length;++r){var i=f[r];e[i]=v(i,t)}return e};function b(t,e){e?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}function P(t,r,i){var n,s=typeof t;if("string"===s){var o,a=[],c=t.length,u=0;for(n=0;n<c;++n)(o=t.charCodeAt(n))<128?a[u++]=o:o<2048?(a[u++]=192|o>>>6,a[u++]=128|63&o):o<55296||o>=57344?(a[u++]=224|o>>>12,a[u++]=128|o>>>6&63,a[u++]=128|63&o):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++n)),a[u++]=240|o>>>18,a[u++]=128|o>>>12&63,a[u++]=128|o>>>6&63,a[u++]=128|63&o);t=a}else{if("object"!==s)throw new Error(e);if(null===t)throw new Error(e);if(d&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||d&&ArrayBuffer.isView(t)))throw new Error(e)}t.length>64&&(t=new b(r,!0).update(t).array());var h=[],p=[];for(n=0;n<64;++n){var g=t[n]||0;h[n]=92^g,p[n]=54^g}b.call(this,r,i),this.update(p),this.oKeyPad=h,this.inner=!0,this.sharedMemory=i}b.prototype.update=function(t){if(!this.finalized){var r,i=typeof t;if("string"!==i){if("object"!==i)throw new Error(e);if(null===t)throw new Error(e);if(d&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||d&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var n,s,o=0,a=t.length,c=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,this.block=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),r)for(s=this.start;o<a&&s<64;++o)c[s>>>2]|=t[o]<<g[3&s++];else for(s=this.start;o<a&&s<64;++o)(n=t.charCodeAt(o))<128?c[s>>>2]|=n<<g[3&s++]:n<2048?(c[s>>>2]|=(192|n>>>6)<<g[3&s++],c[s>>>2]|=(128|63&n)<<g[3&s++]):n<55296||n>=57344?(c[s>>>2]|=(224|n>>>12)<<g[3&s++],c[s>>>2]|=(128|n>>>6&63)<<g[3&s++],c[s>>>2]|=(128|63&n)<<g[3&s++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++o)),c[s>>>2]|=(240|n>>>18)<<g[3&s++],c[s>>>2]|=(128|n>>>12&63)<<g[3&s++],c[s>>>2]|=(128|n>>>6&63)<<g[3&s++],c[s>>>2]|=(128|63&n)<<g[3&s++]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=c[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},b.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=p[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},b.prototype.hash=function(){var t,e,r,i,n,s,o,a,c,u=this.h0,d=this.h1,h=this.h2,p=this.h3,g=this.h4,f=this.h5,m=this.h6,y=this.h7,w=this.blocks;for(t=16;t<64;++t)e=((n=w[t-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,r=((n=w[t-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,w[t]=w[t-16]+e+w[t-7]+r|0;for(c=d&h,t=0;t<64;t+=4)this.first?(this.is224?(s=300032,y=(n=w[0]-1413257819)-150054599|0,p=n+24177077|0):(s=704751109,y=(n=w[0]-210244248)-1521486534|0,p=n+143694565|0),this.first=!1):(e=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(s=u&d)^u&h^c,y=p+(n=y+(r=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&f^~g&m)+l[t]+w[t])|0,p=n+(e+i)|0),e=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),i=(o=p&u)^p&d^s,m=h+(n=m+(r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&g^~y&f)+l[t+1]+w[t+1])|0,e=((h=n+(e+i)|0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(a=h&p)^h&u^o,f=d+(n=f+(r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&y^~m&g)+l[t+2]+w[t+2])|0,e=((d=n+(e+i)|0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),i=(c=d&h)^d&p^a,g=u+(n=g+(r=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&y)+l[t+3]+w[t+3])|0,u=n+(e+i)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+u|0,this.h1=this.h1+d|0,this.h2=this.h2+h|0,this.h3=this.h3+p|0,this.h4=this.h4+g|0,this.h5=this.h5+f|0,this.h6=this.h6+m|0,this.h7=this.h7+y|0},b.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,o=this.h6,a=this.h7,c=h[t>>>28&15]+h[t>>>24&15]+h[t>>>20&15]+h[t>>>16&15]+h[t>>>12&15]+h[t>>>8&15]+h[t>>>4&15]+h[15&t]+h[e>>>28&15]+h[e>>>24&15]+h[e>>>20&15]+h[e>>>16&15]+h[e>>>12&15]+h[e>>>8&15]+h[e>>>4&15]+h[15&e]+h[r>>>28&15]+h[r>>>24&15]+h[r>>>20&15]+h[r>>>16&15]+h[r>>>12&15]+h[r>>>8&15]+h[r>>>4&15]+h[15&r]+h[i>>>28&15]+h[i>>>24&15]+h[i>>>20&15]+h[i>>>16&15]+h[i>>>12&15]+h[i>>>8&15]+h[i>>>4&15]+h[15&i]+h[n>>>28&15]+h[n>>>24&15]+h[n>>>20&15]+h[n>>>16&15]+h[n>>>12&15]+h[n>>>8&15]+h[n>>>4&15]+h[15&n]+h[s>>>28&15]+h[s>>>24&15]+h[s>>>20&15]+h[s>>>16&15]+h[s>>>12&15]+h[s>>>8&15]+h[s>>>4&15]+h[15&s]+h[o>>>28&15]+h[o>>>24&15]+h[o>>>20&15]+h[o>>>16&15]+h[o>>>12&15]+h[o>>>8&15]+h[o>>>4&15]+h[15&o];return this.is224||(c+=h[a>>>28&15]+h[a>>>24&15]+h[a>>>20&15]+h[a>>>16&15]+h[a>>>12&15]+h[a>>>8&15]+h[a>>>4&15]+h[15&a]),c},b.prototype.toString=b.prototype.hex,b.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,o=this.h6,a=this.h7,c=[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o];return this.is224||c.push(a>>>24&255,a>>>16&255,a>>>8&255,255&a),c},b.prototype.array=b.prototype.digest,b.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},P.prototype=new b,P.prototype.finalize=function(){if(b.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();b.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),b.prototype.finalize.call(this)}};var I=w();I.sha256=I,I.sha224=w(!0),I.sha256.hmac=S(),I.sha224.hmac=S(!0),c?t.exports=I:(s.sha256=I.sha256,s.sha224=I.sha224,u&&(void 0===(i=function(){return I}.call(I,r,I,t))||(t.exports=i)))}()},903:()=>{},394:()=>{}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.amdO={},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";const t={r:"v0.28.1"};var e=r(396),i=r.n(e);async function n(t){const e=await A("/config",t,{method:"GET",headers:{Accept:"application/json"}});return new w(t).setSite(e),e}const s={"Europe/Vienna":"gdpr","Europe/Brussels":"gdpr","Europe/Sofia":"gdpr","Europe/Zagreb":"gdpr","Asia/Nicosia":"gdpr","Europe/Nicosia":"gdpr","Europe/Prague":"gdpr","Europe/Copenhagen":"gdpr","Europe/Tallinn":"gdpr","Europe/Helsinki":"gdpr","Europe/Paris":"gdpr","Europe/Berlin":"gdpr","Europe/Athens":"gdpr","Europe/Budapest":"gdpr","Atlantic/Reykjavik":"gdpr","Europe/Dublin":"gdpr","Europe/Rome":"gdpr","Europe/Riga":"gdpr","Europe/Vaduz":"gdpr","Europe/Vilnius":"gdpr","Europe/Luxembourg":"gdpr","Europe/Malta":"gdpr","Europe/Oslo":"gdpr","Europe/Warsaw":"gdpr","Europe/Lisbon":"gdpr","Europe/Bucharest":"gdpr","Europe/Bratislava":"gdpr","Europe/Ljubljana":"gdpr","Europe/Madrid":"gdpr","Europe/Stockholm":"gdpr","Europe/Amsterdam":"gdpr","Atlantic/Azores":"gdpr","Atlantic/Canary":"gdpr","America/Cayenne":"gdpr","America/Guadeloupe":"gdpr","Atlantic/Madeira":"gdpr","America/Martinique":"gdpr","Indian/Mayotte":"gdpr","Indian/Reunion":"gdpr","America/Marigot":"gdpr","Europe/Zurich":"gdpr","Europe/London":"gdpr","America/Toronto":"can","America/Adak":"us","America/Anchorage":"us","America/Atka":"us","America/Boise":"us","America/Chicago":"us","America/Denver":"us","America/Detroit":"us","America/Indiana/Indianapolis":"us","America/Indiana/Knox":"us","America/Indiana/Marengo":"us","America/Indiana/Petersburg":"us","America/Indiana/Tell_City":"us","America/Indiana/Vevay":"us","America/Indiana/Vincennes":"us","America/Indiana/Winamac":"us","America/Indianapolis":"us","America/Juneau":"us","America/Kentucky/Louisville":"us","America/Kentucky/Monticello":"us","America/Knox_IN":"us","America/Los_Angeles":"us","America/Louisville":"us","America/Menominee":"us","America/Metlakatla":"us","America/New_York":"us","America/Nome":"us","America/North_Dakota/Beulah":"us","America/North_Dakota/Center":"us","America/North_Dakota/New_Salem":"us","America/Phoenix":"us","America/Shiprock":"us","America/Sitka":"us","America/Yakutat":"us","Pacific/Honolulu":"us"},o="tcfcav1",a="tcfeuv2",c=[2],u=[5],d=[7,8,10,12,17,13,18,14,19,20,21,15,22,16,11,9];function h(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=function(t,e){const{gdprApplies:r,gppSectionIDs:i,gdprData:n}=e;if(void 0!==r)return r?"gdpr":"gdpr"===t?null:t;if(void 0!==n&&"gdpr"===t)return"gdpr";if(void 0===i||1===i.length&&0===i[0])return t;if(1===i.length&&-1===i[0])return null;if(i.some((t=>c.includes(t))))return"gdpr";if(i.some((t=>u.includes(t))))return"can";if(i.some((t=>d.includes(t))))return"us";switch(t){case"gdpr":if(!i.some((t=>c.includes(t))))return null;break;case"can":if(!i.some((t=>u.includes(t))))return null;break;case"us":if(!i.some((t=>d.includes(t))))return null}return t}(t,e),n={reg:i,gpp:e.gppString,gppSectionIDs:e.gppSectionIDs,gdpr:e.gdprString,gdprApplies:e.gdprApplies,deviceAccess:!1,createProfilesForAdvertising:!1,useProfilesForAdvertising:!1,measureAdvertisingPerformance:!1};switch(i){case"gdpr":e.gdprData?(n.deviceAccess=g(e.gdprData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=g(e.gdprData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=g(e.gdprData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=g(e.gdprData,7,r.tcfeuVendorID)):e.gppData&&(n.deviceAccess=f(e.gppData,1,r.tcfeuVendorID),n.createProfilesForAdvertising=f(e.gppData,3,r.tcfeuVendorID),n.useProfilesForAdvertising=f(e.gppData,4,r.tcfeuVendorID),n.measureAdvertisingPerformance=f(e.gppData,7,r.tcfeuVendorID));break;case"can":n.deviceAccess=!0,e.gppData&&(n.createProfilesForAdvertising=l(e.gppData,3,r.tcfcaVendorID),n.useProfilesForAdvertising=l(e.gppData,4,r.tcfcaVendorID),n.measureAdvertisingPerformance=l(e.gppData,7,r.tcfcaVendorID));break;default:n.deviceAccess=!0,n.createProfilesForAdvertising=!0,n.useProfilesForAdvertising=!0,n.measureAdvertisingPerformance=!0}return n}function p(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},i=h(t,r,e);return"function"==typeof window.__tcfapi&&window.__tcfapi?.("addEventListener",2,((n,s)=>{s&&("tcloaded"===n.eventStatus||"useractioncomplete"===n.eventStatus)&&(n=>{r.gdprString=n.tcString,r.gdprApplies=n.gdprApplies,r.gdprData=n,Object.assign(i,h(t,r,e))})(n)})),"function"==typeof window.__gpp&&window.__gpp?.("addEventListener",((n,s)=>{s&&"signalStatus"===n.eventName&&"ready"===n.data&&(n=>{r.gppString=n.gppString,r.gppSectionIDs=n.applicableSections,r.gppData=n,Object.assign(i,h(t,r,e))})(n.pingData)})),i}function g(t,e,r){return r?!!t.purpose?.consents?.[e]&&!!t.vendor?.consents?.[r]:!!t.publisher?.consents?.[e]}function l(t,e,r){const i=e>1,n=t.parsedSections?.[o]||[];if("number"==typeof r){const t=n.find((t=>"Version"in t));if(!t)return!1;let s=t.PurposesExpressConsent.includes(e)&&t.VendorExpressConsent.includes(r);return i&&(s||=t.PurposesImpliedConsent.includes(e)&&t.VendorImpliedConsent.includes(r)),s}const s=n.find((t=>"SubsectionType"in t&&3===t.SubsectionType));if(!s)return!1;let a=s.PubPurposesExpressConsent.includes(e);return i&&(a||=s.PubPurposesImpliedConsent.includes(e)),a}function f(t,e,r){const i=e>1,n=t.parsedSections?.[a]||[];if("number"==typeof r){const t=n.find((t=>"Version"in t));if(!t)return!1;let s=t.PurposeConsent.includes(e)&&t.VendorConsent.includes(r);return i&&(s||=t.PurposesLITransparency.includes(e)&&t.VendorLegitimateInterest.includes(r)),s}const s=n.find((t=>"SegmentType"in t&&3===t.SegmentType));if(!s)return!1;let o=s.PubPurposesConsent.includes(e);return i&&(o||=s.PubPurposesLITransparency.includes(e)),o}class m{constructor(t){i()(this,"consent",void 0),this.consent=t}getItem(t){return this.consent.deviceAccess?window.localStorage.getItem(t):null}setItem(t,e){this.consent.deviceAccess&&window.localStorage.setItem(t,e)}removeItem(t){this.consent.deviceAccess&&window.localStorage.removeItem(t)}}function y(t){const e=new Uint16Array(t.length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return btoa(String.fromCharCode(...new Uint8Array(e.buffer)))}class w{constructor(t){this.config=t,i()(this,"deprecatedPassportKey",void 0),i()(this,"passportKey",void 0),i()(this,"targetingKey",void 0),i()(this,"siteKey",void 0),i()(this,"storage",void 0);const e=function(t){return t.legacyHostCache?y(`${t.legacyHostCache}/${t.site}`):y(`${t.host}/${t.site}`)}(t),r=function(t){return t.node?y(`${t.host}/${t.node}`):y(t.host)}(t);this.deprecatedPassportKey="OPTABLE_PASS_"+e,this.passportKey="OPTABLE_PASSPORT_"+r,this.targetingKey="OPTABLE_TARGETING_"+r,this.siteKey="OPTABLE_SITE_"+r,this.storage=new m(this.config.consent)}getPassport(){return this.getFirstExistingItem(this.passportKey,this.deprecatedPassportKey)}getTargeting(){const t=this.storage.getItem(this.targetingKey);return t?JSON.parse(t):null}setPassport(t){t&&t.length>0&&this.storage.setItem(this.passportKey,t)}setTargeting(t){t&&this.storage.setItem(this.targetingKey,JSON.stringify(t))}setSite(t){t&&this.storage.setItem(this.siteKey,JSON.stringify(t))}getSite(){const t=this.storage.getItem(this.siteKey);return t?JSON.parse(t):null}getFirstExistingItem(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(const t of e){const e=this.storage.getItem(t);if(e)return e}return null}clearPassport(){this.storage.removeItem(this.passportKey),this.storage.removeItem(this.deprecatedPassportKey)}clearTargeting(){this.storage.removeItem(this.targetingKey)}clearSite(){this.storage.removeItem(this.siteKey)}}async function A(e,r,i){const n=await globalThis.fetch(function(e,r,i){const{site:n,host:s,cookies:o}=r,a=new URL(`${n}${e}`,`https://${s}`);if(a.searchParams.set("osdk",`web-${t.r}`),r.node&&a.searchParams.set("t",r.node),void 0!==r.consent.gpp&&a.searchParams.set("gpp",r.consent.gpp),void 0!==r.consent.gppSectionIDs&&a.searchParams.set("gpp_sid",r.consent.gppSectionIDs.join(",")),void 0!==r.consent.gdpr&&a.searchParams.set("gdpr_consent",r.consent.gdpr),void 0!==r.consent.gdprApplies&&a.searchParams.set("gdpr",Number(r.consent.gdprApplies).toString()),r.readOnly&&a.searchParams.set("ro","true"),o)a.searchParams.set("cookies","yes");else{const t=new w(r).getPassport();a.searchParams.set("cookies","no"),a.searchParams.set("passport",t||"")}const c={...i};return c.credentials=r.consent.deviceAccess?"include":"omit",new Request(a.toString(),c)}(e,r,i)),s=n.headers.get("Content-Type"),o=s?.startsWith("application/json")?await n.json():await n.text();if(!n.ok)throw new Error(o.error);return o.passport&&(new w(r).setPassport(o.passport),delete o.passport),o}var v;function S(t){return{user:{data:(t?.audience??[]).map((t=>({name:t.provider,segment:t.ids,ext:{segtax:t.rtb_segtax}}))),ext:{eids:(t?.user??[]).map((t=>({source:t.provider,uids:t.ids.map((t=>{let{id:e}=t;return{id:e,atype:v.PersonID}}))})))}}}}function b(t){const e={};if(!t)return e;for(const r of t.audience??[])r.keyspace&&(r.keyspace in e||(e[r.keyspace]=[]),e[r.keyspace].push(...r.ids.map((t=>t.id))));return e}!function(t){t[t.DeviceID=1]="DeviceID",t[t.InAppImpression=2]="InAppImpression",t[t.PersonID=3]="PersonID"}(v||(v={}));const P={cookies:!0,initPassport:!0,readOnly:!1,experiments:[],consent:{reg:null,deviceAccess:!0,createProfilesForAdvertising:!0,useProfilesForAdvertising:!0,measureAdvertisingPerformance:!0}};var I=r(312);class E{constructor(t){i()(this,"dcn",void 0),i()(this,"init",void 0),this.dcn=function(t){const e={host:t.host,site:t.site,cookies:t.cookies??P.cookies,initPassport:t.initPassport??P.initPassport,consent:P.consent,readOnly:t.readOnly??P.readOnly,node:t.node,legacyHostCache:t.legacyHostCache,experiments:t.experiments??P.experiments};return t.consent?.static?e.consent=t.consent.static:t.consent?.cmpapi&&(e.consent=p(function(){const t=Intl.DateTimeFormat().resolvedOptions().timeZone,e=s[t];return"can"===e?["fr","fr-CA"].some((t=>navigator.languages.includes(t)))?"can":null:e??null}(),t.consent.cmpapi)),e}(t);const e=()=>{};this.init=this.dcn.initPassport?n(this.dcn).then(e).catch(e):Promise.resolve()}async identify(){await this.init;for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t,e){return A("/identify",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}(this.dcn,e.filter((t=>t)))}async uid2Token(t){return await this.init,function(t,e){return A("/uid2/token",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}(this.dcn,t)}async targeting(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"__passport__";return await this.init,async function(t,e){const r="/v2/targeting?"+new URLSearchParams({id:e}).toString(),i=await A(r,t,{method:"GET",headers:{Accept:"application/json"}});return i&&new w(t).setTargeting(i),i}(this.dcn,t)}targetingFromCache(){return t=this.dcn,new w(t).getTargeting();var t}async site(){return n(this.dcn)}siteFromCache(){return t=this.dcn,new w(t).getSite();var t}targetingClearCache(){var t;t=this.dcn,new w(t).clearTargeting()}async prebidORTB2(){return S(await this.targeting())}prebidORTB2FromCache(){return S(this.targetingFromCache())}async targetingKeyValues(){return b(await this.targeting())}targetingKeyValuesFromCache(){return b(this.targetingFromCache())}async witness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return await this.init,function(t,e,r){const i={event:e,properties:r};return A("/witness",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}(this.dcn,t,e)}async profile(t){return await this.init,function(t,e){const r={traits:e};return A("/profile",t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}(this.dcn,t)}async tokenize(t){return await this.init,function(t,e){let r="/v1/tokenize";t.experiments.includes("tokenize-v2")&&(r="/v2/tokenize");let i={id:e};return A(r,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}(this.dcn,t)}async resolve(t){return await this.init,async function(t,e){const r=new URLSearchParams;"string"==typeof e&&r.append("id",e);const i="/v1/resolve?"+r.toString();return function(t){const e={clusters:[],lmpid:""};if("object"!=typeof t||null===t)return e;if("lmpid"in t&&"string"==typeof t?.lmpid&&(e.lmpid=t.lmpid),!("clusters"in t)||!Array.isArray(t?.clusters))return e;for(const r of t.clusters){const t={ids:[],traits:[]};if(Array.isArray(r?.ids))for(const e of r.ids)"string"==typeof e&&t.ids.push(e);if(Array.isArray(r?.traits))for(const e of r.traits)"string"==typeof e?.key&&"string"==typeof e?.value&&t.traits.push({key:e.key,value:e.value});(t.ids.length>0||t.traits.length>0)&&e.clusters.push(t)}return e}(await A(i,t,{method:"GET",headers:{Accept:"application/json"}}))}(this.dcn,t)}static eid(t){return t?"e:"+I.sha256.hex(t.toLowerCase().trim()):""}static sha256(t){return t?I.sha256.hex(t):""}static cid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="c:";if("string"!=typeof t)throw new Error("Invalid ppid");if("number"!=typeof e||isNaN(e)||e<0||e>9)throw new Error("Invalid variant");return e>0&&(r=`c${e}:`),t?r+t.trim():""}static TargetingKeyValues(t){return b(t)}static PrebidORTB2(t){return S(t)}}i()(E,"version",t.r);const C=E;function _(t){return{advertiserId:t.advertiserId?.toString(),campaignId:t.campaignId?.toString(),creativeId:t.creativeId?.toString(),isEmpty:t.isEmpty?.toString(),lineItemId:t.lineItemId?.toString(),serviceName:t.serviceName?.toString(),size:t.size?.toString(),slotElementId:t.slot?.getSlotElementId(),sourceAgnosticCreativeId:t.sourceAgnosticCreativeId?.toString(),sourceAgnosticLineItemId:t.sourceAgnosticLineItemId?.toString()}}C.prototype.installGPTEventListeners=function(){const t=this;t.installGPTEventListeners=function(){},window.googletag=window.googletag||{cmd:[]};const e=window.googletag;e.cmd.push((function(){e.pubads().addEventListener("slotRenderEnded",(function(e){t.witness("googletag.events.slotRenderEnded",_(e))})),e.pubads().addEventListener("impressionViewable",(function(e){t.witness("googletag.events.impressionViewable",_(e))}))}))},C.prototype.installGPTSecureSignals=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];window.googletag=window.googletag||{cmd:[]};const i=window.googletag;e&&e.length>0&&i.cmd.push((()=>{e.forEach((t=>{let{provider:e,id:r}=t;i.secureSignalProviders.push({id:e,collectorFunction:()=>Promise.resolve(r)})}))}))};const T=/^[a-f0-9]{64}$/i;C.prototype.tryIdentifyFromParams=function(t,e){const r=new RegExp(`^${t||"oeid"}$`,"i"),i=new URLSearchParams(window.location.search);let n="";for(const[t,e]of i)if(r.test(t)){n=e;break}""!=n&&(e||function(t){return T.test(t)}(n))&&this.identify((e||"e")+":"+n.toLowerCase())},C.prototype.auctionConfigFromCache=function(){const t=this.siteFromCache();return t?t.auctionConfig??null:null},C.prototype.installGPTAuctionConfigs=function(t){const e=this;e.installGPTAuctionConfigs=function(){},window.googletag=window.googletag||{cmd:[]};const r=window.googletag;r.cmd.push((function(){let i=r.pubads().getSlots();t&&(i=i.filter(t));const n=e.auctionConfigFromCache();if(n)for(const t of i){const e=t.getSizes(),r=[];for(const t of e)"fluid"!==t&&r.push({configKey:n.seller+"-"+t.getWidth()+"x"+t.getHeight(),auctionConfig:{...n,requestedSize:{width:t.getWidth()+"px",height:t.getHeight()+"px"}}});t.setConfig({componentAuction:r})}}))},C.prototype.runAdAuction=async function(t,e){if(!("runAdAuction"in navigator))throw"run-ad-auction not supported";const r=document.getElementById(t);if(!r)throw"spot not found";const i=function(t){const e=window.getComputedStyle(t,null);return{width:e.getPropertyValue("width"),height:e.getPropertyValue("height")}}(r),n=this.auctionConfigFromCache();if(!n)return!1;const s={...n,requestedSize:i,resolveToConfig:!0},o=e?.iframe??!1;o&&(s.resolveToConfig=!1);const a=await navigator.runAdAuction(s);if(!a)return r.replaceChildren(),!1;if(o){const t=document.createElement("iframe");t.src=a,t.style.border="none",t.style.width=i.width,t.style.height=i.height,r.replaceChildren(t)}else{const t=document.createElement("fencedframe");t.config=a,t.style.border="none",r.replaceChildren(t)}return!0},C.prototype.joinAdInterestGroups=async function(){if(!("joinAdInterestGroup"in navigator))throw"join-ad-interest-group not supported";if(!(this.dcn.consent.deviceAccess&&this.dcn.consent.createProfilesForAdvertising&&this.dcn.consent.measureAdvertisingPerformance))throw"consent not granted for joining interest groups";const t=await this.site();if(!t.interestGroupPixel)throw"origin not enabled for protected audience apis";const e=new URL(t.interestGroupPixel),r=document.createElement("iframe");r.src=e.toString(),r.allow="join-ad-interest-group "+e.origin,r.style.display="none";const i=new Promise(((t,e)=>{window.addEventListener("message",(i=>{i.source===r.contentWindow&&("success"!==i.data.result?e():t())}))}));return document.body.appendChild(r),i},C.prototype.getTopics=async function(){if(!("browsingTopics"in document))throw"browsing-topics not supported";if(!this.dcn.consent.deviceAccess)throw"consent not granted for reading browsing topics";const t=await this.site();if(!t.getTopicsURL)throw"origin not enabled for topics api";const e=new URL(t.getTopicsURL),r=document.createElement("iframe");r.src=e.toString(),r.allow="browsing-topics "+e.origin,r.style.display="none";const i=new Promise(((t,e)=>{window.addEventListener("message",(i=>{i.source===r.contentWindow&&(i.data.error?e(new Error(i.data.error.toString())):t(i.data.result))}))}));return document.body.appendChild(r),i},C.prototype.ingestTopics=function(){this.getTopics().then((t=>{if(!t.length)return;const e=t.reduce(((t,e)=>{const r=`topics_v${e.taxonomyVersion}`;return t[r]?t[r]+=",":t[r]="",t[r]+=String(e.topic),t}),{});this.profile(e)})).catch((()=>{}))},window.optable=window.optable||{},window.optable.SDK=C,window.optable.cmd=new class{constructor(t){if(this.cmds=t,Array.isArray(this.cmds))for(const t of this.cmds)"function"==typeof t&&t()}push(t){t()}}(window.optable.cmd||[]),window.optable.utils={resolveMultiNodeTargeting:async function(t){return t?t.some((t=>t.priority))?async function(t){const e=new Set,r={user:{data:[],eids:[]}},i=new Map,n=new Map;const s=t.map((t=>{let{targetingFn:e,matcher:s,mm:o,priority:a}=t;return e().then((t=>function(t,e,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const a=Math.max(0,o),{data:c=[],eids:u=[]}=t.ortb2?.user??{};r.user.data.push(...c),u.filter((t=>t.uids.length)).forEach((t=>{let{ext:r,...o}=t;const c=i.get(a)??[];i.set(a,[...c,e]);const u=n.get(a)??[];n.set(a,[...u,{...o,matcher:e,mm:s}])}))}(t,s,o,a)))}));await Promise.allSettled(s);const o=Array.from(n.keys()).sort(((t,e)=>t-e)).filter((t=>n.get(t)?.length)).shift();if(o){const t=i.get(o)||[];r.user.eids.push(...n.get(o)||[]),t.forEach((t=>e.add(t)))}return{ortb2:r,eidSources:e}}(t):async function(t){const e=new Set,r={user:{data:[],eids:[]}};const i=t.map((t=>{let{targetingFn:i,matcher:n,mm:s}=t;return i().then((t=>function(t,i,n){const{data:s=[],eids:o=[]}=t.ortb2?.user??{};r.user.data.push(...s),o.filter((t=>t.uids.length)).forEach((t=>{let{ext:s,...o}=t;e.add(i),r.user.eids.push({...o,mm:n,matcher:i})}))}(t,n,s)))}));return await Promise.allSettled(i),{ortb2:r,eidSources:e}}(t):Promise.reject("No targeting rules provided")}}})()})();
|
package/lib/dist/build.json
CHANGED
package/lib/dist/config.d.ts
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
import type { CMPApiConfig, Consent } from "./core/regs/consent";
|
|
2
|
+
type Experiment = "tokenize-v2";
|
|
2
3
|
type InitConsent = {
|
|
3
4
|
cmpapi?: CMPApiConfig;
|
|
4
5
|
static?: Consent;
|
|
5
6
|
};
|
|
6
7
|
type InitConfig = {
|
|
7
|
-
host: string;
|
|
8
8
|
site: string;
|
|
9
|
+
host: string;
|
|
10
|
+
node?: string;
|
|
9
11
|
cookies?: boolean;
|
|
12
|
+
legacyHostCache?: string;
|
|
10
13
|
initPassport?: boolean;
|
|
11
14
|
consent?: InitConsent;
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
experiments?: Experiment[];
|
|
12
17
|
};
|
|
13
|
-
type ResolvedConfig =
|
|
18
|
+
type ResolvedConfig = {
|
|
19
|
+
site: string;
|
|
20
|
+
host: string;
|
|
14
21
|
consent: Consent;
|
|
22
|
+
node?: string;
|
|
23
|
+
cookies: boolean;
|
|
24
|
+
initPassport: boolean;
|
|
25
|
+
readOnly: boolean;
|
|
26
|
+
legacyHostCache?: string;
|
|
27
|
+
experiments: Experiment[];
|
|
15
28
|
};
|
|
16
29
|
declare const DCN_DEFAULTS: {
|
|
17
30
|
cookies: boolean;
|
|
18
31
|
initPassport: boolean;
|
|
32
|
+
readOnly: boolean;
|
|
33
|
+
experiments: never[];
|
|
19
34
|
consent: {
|
|
20
35
|
reg: null;
|
|
21
36
|
deviceAccess: boolean;
|
package/lib/dist/config.js
CHANGED
|
@@ -2,6 +2,8 @@ import { getConsent, inferRegulation } from "./core/regs/consent";
|
|
|
2
2
|
const DCN_DEFAULTS = {
|
|
3
3
|
cookies: true,
|
|
4
4
|
initPassport: true,
|
|
5
|
+
readOnly: false,
|
|
6
|
+
experiments: [],
|
|
5
7
|
consent: {
|
|
6
8
|
reg: null,
|
|
7
9
|
deviceAccess: true,
|
|
@@ -11,18 +13,22 @@ const DCN_DEFAULTS = {
|
|
|
11
13
|
},
|
|
12
14
|
};
|
|
13
15
|
function getConfig(init) {
|
|
14
|
-
var _a, _b, _c, _d;
|
|
16
|
+
var _a, _b, _c, _d, _e, _f;
|
|
15
17
|
const config = {
|
|
16
18
|
host: init.host,
|
|
17
19
|
site: init.site,
|
|
18
20
|
cookies: (_a = init.cookies) !== null && _a !== void 0 ? _a : DCN_DEFAULTS.cookies,
|
|
19
21
|
initPassport: (_b = init.initPassport) !== null && _b !== void 0 ? _b : DCN_DEFAULTS.initPassport,
|
|
20
22
|
consent: DCN_DEFAULTS.consent,
|
|
23
|
+
readOnly: (_c = init.readOnly) !== null && _c !== void 0 ? _c : DCN_DEFAULTS.readOnly,
|
|
24
|
+
node: init.node,
|
|
25
|
+
legacyHostCache: init.legacyHostCache,
|
|
26
|
+
experiments: (_d = init.experiments) !== null && _d !== void 0 ? _d : DCN_DEFAULTS.experiments,
|
|
21
27
|
};
|
|
22
|
-
if ((
|
|
28
|
+
if ((_e = init.consent) === null || _e === void 0 ? void 0 : _e.static) {
|
|
23
29
|
config.consent = init.consent.static;
|
|
24
30
|
}
|
|
25
|
-
else if ((
|
|
31
|
+
else if ((_f = init.consent) === null || _f === void 0 ? void 0 : _f.cmpapi) {
|
|
26
32
|
config.consent = getConsent(inferRegulation(), init.consent.cmpapi);
|
|
27
33
|
}
|
|
28
34
|
return config;
|
package/lib/dist/core/network.js
CHANGED
|
@@ -13,6 +13,9 @@ function buildRequest(path, config, init) {
|
|
|
13
13
|
const { site, host, cookies } = config;
|
|
14
14
|
const url = new URL(`${site}${path}`, `https://${host}`);
|
|
15
15
|
url.searchParams.set("osdk", `web-${buildInfo.version}`);
|
|
16
|
+
if (config.node) {
|
|
17
|
+
url.searchParams.set("t", config.node);
|
|
18
|
+
}
|
|
16
19
|
if (typeof config.consent.gpp !== "undefined") {
|
|
17
20
|
url.searchParams.set("gpp", config.consent.gpp);
|
|
18
21
|
}
|
|
@@ -25,6 +28,9 @@ function buildRequest(path, config, init) {
|
|
|
25
28
|
if (typeof config.consent.gdprApplies !== "undefined") {
|
|
26
29
|
url.searchParams.set("gdpr", Number(config.consent.gdprApplies).toString());
|
|
27
30
|
}
|
|
31
|
+
if (config.readOnly) {
|
|
32
|
+
url.searchParams.set("ro", "true");
|
|
33
|
+
}
|
|
28
34
|
if (cookies) {
|
|
29
35
|
url.searchParams.set("cookies", "yes");
|
|
30
36
|
}
|
|
@@ -35,7 +41,7 @@ function buildRequest(path, config, init) {
|
|
|
35
41
|
url.searchParams.set("passport", pass ? pass : "");
|
|
36
42
|
}
|
|
37
43
|
const requestInit = Object.assign({}, init);
|
|
38
|
-
requestInit.credentials = "include";
|
|
44
|
+
requestInit.credentials = config.consent.deviceAccess ? "include" : "omit";
|
|
39
45
|
const request = new Request(url.toString(), requestInit);
|
|
40
46
|
return request;
|
|
41
47
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IDMatchMethod } from "iab-adcom";
|
|
2
|
+
import { TargetingResponse } from "../../edge/targeting";
|
|
3
|
+
type MultiNodeTargetingResponse = TargetingResponse & {
|
|
4
|
+
eidSources: Set<string>;
|
|
5
|
+
};
|
|
6
|
+
type NodeTargetingRule = {
|
|
7
|
+
targetingFn: () => Promise<TargetingResponse>;
|
|
8
|
+
matcher: string;
|
|
9
|
+
mm: IDMatchMethod;
|
|
10
|
+
priority?: number;
|
|
11
|
+
};
|
|
12
|
+
declare function resolveMultiNodeTargeting(rules: NodeTargetingRule[]): Promise<MultiNodeTargetingResponse>;
|
|
13
|
+
export { resolveMultiNodeTargeting };
|
|
14
|
+
export type { MultiNodeTargetingResponse, TargetingResponse, NodeTargetingRule };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
// Resolve multiple targeting nodes
|
|
22
|
+
// If any of the targeting nodes have the 'priority' attribute, we will resolve the most prioritize node
|
|
23
|
+
// Otherwise, we will aggregate all resolved targeting data
|
|
24
|
+
// If multiple nodes have the same priority, we will append the eids
|
|
25
|
+
// Returns the resolved Ortb2Response and the list of eid sources that were resolved
|
|
26
|
+
function resolveMultiNodeTargeting(rules) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
if (!rules) {
|
|
29
|
+
return Promise.reject("No targeting rules provided");
|
|
30
|
+
}
|
|
31
|
+
return rules.some((x) => x.priority) ? resolvePriorityTargeting(rules) : resolveAggregateTargeting(rules);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// Aggregate all resolved targeting data
|
|
35
|
+
function resolveAggregateTargeting(rules) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const eidSources = new Set();
|
|
38
|
+
const ortb2 = {
|
|
39
|
+
user: {
|
|
40
|
+
data: [],
|
|
41
|
+
eids: [],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
function processTokens(response, matcher, mm) {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
const { data = [], eids = [] } = (_b = (_a = response.ortb2) === null || _a === void 0 ? void 0 : _a.user) !== null && _b !== void 0 ? _b : {};
|
|
47
|
+
ortb2.user.data.push(...data);
|
|
48
|
+
eids
|
|
49
|
+
.filter((x) => x.uids.length)
|
|
50
|
+
.forEach((_a) => {
|
|
51
|
+
var { ext } = _a, eid = __rest(_a, ["ext"]);
|
|
52
|
+
eidSources.add(matcher);
|
|
53
|
+
ortb2.user.eids.push(Object.assign(Object.assign({}, eid), { mm, matcher }));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const targetingFnPromises = rules.map(({ targetingFn, matcher, mm }) => targetingFn().then((res) => processTokens(res, matcher, mm)));
|
|
57
|
+
yield Promise.allSettled(targetingFnPromises);
|
|
58
|
+
return { ortb2, eidSources };
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Resolve the most prioritize targeting node
|
|
62
|
+
// If multiple nodes have the same priority, we will append the eids
|
|
63
|
+
function resolvePriorityTargeting(rules) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const eidSources = new Set();
|
|
66
|
+
const ortb2 = {
|
|
67
|
+
user: {
|
|
68
|
+
data: [],
|
|
69
|
+
eids: [],
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
const sourcesByPriority = new Map();
|
|
73
|
+
const eidsByPriority = new Map();
|
|
74
|
+
function processTokens(response, matcher, mm, priority = 0) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const adjustedPriority = Math.max(0, priority);
|
|
77
|
+
const { data = [], eids = [] } = (_b = (_a = response.ortb2) === null || _a === void 0 ? void 0 : _a.user) !== null && _b !== void 0 ? _b : {};
|
|
78
|
+
ortb2.user.data.push(...data);
|
|
79
|
+
eids
|
|
80
|
+
.filter((x) => x.uids.length)
|
|
81
|
+
.forEach((_a) => {
|
|
82
|
+
var _b, _c;
|
|
83
|
+
var { ext } = _a, eid = __rest(_a, ["ext"]);
|
|
84
|
+
const currentSources = (_b = sourcesByPriority.get(adjustedPriority)) !== null && _b !== void 0 ? _b : [];
|
|
85
|
+
sourcesByPriority.set(adjustedPriority, [...currentSources, matcher]);
|
|
86
|
+
const currentEids = (_c = eidsByPriority.get(adjustedPriority)) !== null && _c !== void 0 ? _c : [];
|
|
87
|
+
eidsByPriority.set(adjustedPriority, [...currentEids, Object.assign(Object.assign({}, eid), { matcher, mm })]);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const targetingFnPromises = rules.map(({ targetingFn, matcher, mm, priority }) => targetingFn().then((res) => processTokens(res, matcher, mm, priority)));
|
|
91
|
+
yield Promise.allSettled(targetingFnPromises);
|
|
92
|
+
const priority = Array.from(eidsByPriority.keys())
|
|
93
|
+
.sort((a, b) => a - b)
|
|
94
|
+
.filter((x) => { var _a; return (_a = eidsByPriority.get(x)) === null || _a === void 0 ? void 0 : _a.length; })
|
|
95
|
+
.shift();
|
|
96
|
+
if (priority) {
|
|
97
|
+
const sources = sourcesByPriority.get(priority) || [];
|
|
98
|
+
ortb2.user.eids.push(...(eidsByPriority.get(priority) || []));
|
|
99
|
+
sources.forEach((source) => eidSources.add(source));
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
ortb2,
|
|
103
|
+
eidSources,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export { resolveMultiNodeTargeting };
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { SiteResponse } from "../edge/site";
|
|
2
2
|
import type { ResolvedConfig } from "../config";
|
|
3
3
|
import type { TargetingResponse } from "../edge/targeting";
|
|
4
|
+
export declare function encodeBase64(str: string): string;
|
|
5
|
+
export declare function deprecatedGenerateCacheKey(config: ResolvedConfig): string;
|
|
6
|
+
export declare function generateCacheKey(config: ResolvedConfig): string;
|
|
4
7
|
declare class LocalStorage {
|
|
5
8
|
private config;
|
|
9
|
+
private deprecatedPassportKey;
|
|
6
10
|
private passportKey;
|
|
7
|
-
private targetingV1Key;
|
|
8
11
|
private targetingKey;
|
|
9
12
|
private siteKey;
|
|
10
13
|
private storage;
|
|
11
14
|
constructor(config: ResolvedConfig);
|
|
12
15
|
getPassport(): string | null;
|
|
13
|
-
getV1Targeting(): TargetingResponse | null;
|
|
14
16
|
getTargeting(): TargetingResponse | null;
|
|
15
17
|
setPassport(passport: string): void;
|
|
16
18
|
setTargeting(targeting?: TargetingResponse | null): void;
|
|
17
19
|
setSite(site?: SiteResponse | null): void;
|
|
18
20
|
getSite(): SiteResponse | null;
|
|
21
|
+
getFirstExistingItem(...keys: string[]): string | null;
|
|
19
22
|
clearPassport(): void;
|
|
20
23
|
clearTargeting(): void;
|
|
21
24
|
clearSite(): void;
|
package/lib/dist/core/storage.js
CHANGED
|
@@ -1,52 +1,43 @@
|
|
|
1
1
|
import { LocalStorageProxy } from "./regs/storage";
|
|
2
|
-
function
|
|
2
|
+
export function encodeBase64(str) {
|
|
3
3
|
const codeUnits = new Uint16Array(str.length);
|
|
4
4
|
for (let i = 0; i < codeUnits.length; i++) {
|
|
5
5
|
codeUnits[i] = str.charCodeAt(i);
|
|
6
6
|
}
|
|
7
|
-
return String.fromCharCode(...new Uint8Array(codeUnits.buffer));
|
|
7
|
+
return btoa(String.fromCharCode(...new Uint8Array(codeUnits.buffer)));
|
|
8
|
+
}
|
|
9
|
+
// Used to create an old keygen for getItem only
|
|
10
|
+
export function deprecatedGenerateCacheKey(config) {
|
|
11
|
+
if (config.legacyHostCache) {
|
|
12
|
+
return encodeBase64(`${config.legacyHostCache}/${config.site}`);
|
|
13
|
+
}
|
|
14
|
+
return encodeBase64(`${config.host}/${config.site}`);
|
|
15
|
+
}
|
|
16
|
+
// Used as keygen for setting and getting from localstorage
|
|
17
|
+
export function generateCacheKey(config) {
|
|
18
|
+
if (config.node) {
|
|
19
|
+
return encodeBase64(`${config.host}/${config.node}`);
|
|
20
|
+
}
|
|
21
|
+
return encodeBase64(config.host);
|
|
8
22
|
}
|
|
9
23
|
class LocalStorage {
|
|
10
24
|
constructor(config) {
|
|
11
25
|
this.config = config;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
26
|
+
// This is a deprecated keygen, keeping for backwards compatibility
|
|
27
|
+
const deprecatedBase64ConfigKey = deprecatedGenerateCacheKey(config);
|
|
28
|
+
const base64ConfigKey = generateCacheKey(config);
|
|
29
|
+
this.deprecatedPassportKey = "OPTABLE_PASS_" + deprecatedBase64ConfigKey;
|
|
30
|
+
this.passportKey = "OPTABLE_PASSPORT_" + base64ConfigKey;
|
|
31
|
+
this.targetingKey = "OPTABLE_TARGETING_" + base64ConfigKey;
|
|
32
|
+
this.siteKey = "OPTABLE_SITE_" + base64ConfigKey;
|
|
18
33
|
this.storage = new LocalStorageProxy(this.config.consent);
|
|
19
34
|
}
|
|
20
35
|
getPassport() {
|
|
21
|
-
return this.
|
|
22
|
-
}
|
|
23
|
-
getV1Targeting() {
|
|
24
|
-
const raw = this.storage.getItem(this.targetingV1Key);
|
|
25
|
-
const parsed = raw ? JSON.parse(raw) : null;
|
|
26
|
-
if (!parsed) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const audiences = Object.entries(parsed).map(([keyspace, values]) => {
|
|
30
|
-
return {
|
|
31
|
-
provider: "optable.co",
|
|
32
|
-
keyspace,
|
|
33
|
-
// 5001 is Optable Private Member Defined Audiences
|
|
34
|
-
// See: https://github.com/InteractiveAdvertisingBureau/openrtb/pull/81
|
|
35
|
-
//
|
|
36
|
-
// Starting v2 this is returned in the targeting payload directly
|
|
37
|
-
rtb_segtax: 5001,
|
|
38
|
-
ids: [].concat(...[values]).map((id) => ({ id: String(id) })),
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
return {
|
|
42
|
-
user: [],
|
|
43
|
-
audience: audiences,
|
|
44
|
-
};
|
|
36
|
+
return this.getFirstExistingItem(this.passportKey, this.deprecatedPassportKey);
|
|
45
37
|
}
|
|
46
38
|
getTargeting() {
|
|
47
39
|
const raw = this.storage.getItem(this.targetingKey);
|
|
48
|
-
|
|
49
|
-
return parsed ? parsed : this.getV1Targeting();
|
|
40
|
+
return raw ? JSON.parse(raw) : null;
|
|
50
41
|
}
|
|
51
42
|
setPassport(passport) {
|
|
52
43
|
if (passport && passport.length > 0) {
|
|
@@ -70,8 +61,18 @@ class LocalStorage {
|
|
|
70
61
|
const parsed = raw ? JSON.parse(raw) : null;
|
|
71
62
|
return parsed;
|
|
72
63
|
}
|
|
64
|
+
getFirstExistingItem(...keys) {
|
|
65
|
+
for (const key of keys) {
|
|
66
|
+
const value = this.storage.getItem(key);
|
|
67
|
+
if (value) {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
73
|
clearPassport() {
|
|
74
74
|
this.storage.removeItem(this.passportKey);
|
|
75
|
+
this.storage.removeItem(this.deprecatedPassportKey);
|
|
75
76
|
}
|
|
76
77
|
clearTargeting() {
|
|
77
78
|
this.storage.removeItem(this.targetingKey);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BidRequest } from "iab-openrtb/v26";
|
|
1
2
|
import type { ResolvedConfig } from "../config";
|
|
2
3
|
import { User as RTB2User } from "./rtb2";
|
|
3
4
|
type Identifier = {
|
|
@@ -16,6 +17,7 @@ type UserIdentifiers = {
|
|
|
16
17
|
type TargetingResponse = {
|
|
17
18
|
audience?: AudienceIdentifiers[];
|
|
18
19
|
user?: UserIdentifiers[];
|
|
20
|
+
ortb2: Partial<BidRequest>;
|
|
19
21
|
};
|
|
20
22
|
declare function Targeting(config: ResolvedConfig, id: string): Promise<TargetingResponse>;
|
|
21
23
|
declare function TargetingFromCache(config: ResolvedConfig): TargetingResponse | null;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { fetch } from "../core/network";
|
|
2
2
|
function Tokenize(config, id) {
|
|
3
|
+
let endpoint = "/v1/tokenize";
|
|
4
|
+
if (config.experiments.includes("tokenize-v2")) {
|
|
5
|
+
endpoint = "/v2/tokenize";
|
|
6
|
+
}
|
|
3
7
|
let request = {
|
|
4
8
|
id: id,
|
|
5
9
|
};
|
|
6
|
-
return fetch(
|
|
10
|
+
return fetch(endpoint, config, {
|
|
7
11
|
method: "POST",
|
|
8
12
|
headers: {
|
|
9
13
|
"Content-Type": "application/json",
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://optable.co",
|
|
11
11
|
"license": "SEE LICENSE IN LICENSE",
|
|
12
|
-
"version": "v0.
|
|
12
|
+
"version": "v0.28.1",
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@babel/core": "^7.12.3",
|
|
15
15
|
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.12.5",
|
|
37
|
+
"iab-openrtb": "^1.0.1",
|
|
37
38
|
"js-sha256": "^0.11.0",
|
|
38
39
|
"regenerator-runtime": "^0.13.7"
|
|
39
40
|
},
|