@blotoutio/providers-dataflywheel-sdk 1.63.3 → 1.64.0

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/index.cjs.js CHANGED
@@ -17,6 +17,21 @@ const isEnabledFlag = (value, defaultValue = true) => {
17
17
  return value !== '0' && value.toLowerCase() !== 'false';
18
18
  };
19
19
  const shouldBootstrap = (now, expiresAt) => expiresAt == null || now >= expiresAt;
20
+ const browserOrigin = () => {
21
+ var _a, _b;
22
+ try {
23
+ if (typeof window === 'undefined')
24
+ return null;
25
+ return typeof window.origin === 'string'
26
+ ? window.origin
27
+ : (_b = (_a = window.location) === null || _a === void 0 ? void 0 : _a.origin) !== null && _b !== void 0 ? _b : null;
28
+ }
29
+ catch {
30
+ // If a sandbox prevents origin inspection, fail closed before issuing a
31
+ // credentialed request that the DFW Worker cannot safely authorize.
32
+ return 'null';
33
+ }
34
+ };
20
35
  const stateKey = (merchantId) => `${sessionStateKeyPrefix}:${merchantId}`;
21
36
  const browserStorage = () => {
22
37
  var _a;
@@ -138,6 +153,13 @@ function ensureSession(input) {
138
153
  if (!shouldBootstrap(now, expiresAtMs(existing))) {
139
154
  return Promise.resolve(existing);
140
155
  }
156
+ // Opaque origins (sandboxed iframes like Shopify pixels) serialize to the
157
+ // string 'null' per the HTML spec — that is what window.origin returns and
158
+ // what the fail-closed browserOrigin() catch emits. JS null means no window
159
+ // at all (non-browser host), which is not an opaque-origin sandbox.
160
+ if ((input.origin === undefined ? browserOrigin() : input.origin) === 'null') {
161
+ return Promise.resolve(null);
162
+ }
141
163
  const key = stateKey(merchantId);
142
164
  const existingBootstrap = inFlight.get(key);
143
165
  if (existingBootstrap)
package/index.js CHANGED
@@ -18,6 +18,21 @@ var ProvidersDataflywheelSdk = (function () {
18
18
  return value !== '0' && value.toLowerCase() !== 'false';
19
19
  };
20
20
  const shouldBootstrap = (now, expiresAt) => expiresAt == null || now >= expiresAt;
21
+ const browserOrigin = () => {
22
+ var _a, _b;
23
+ try {
24
+ if (typeof window === 'undefined')
25
+ return null;
26
+ return typeof window.origin === 'string'
27
+ ? window.origin
28
+ : (_b = (_a = window.location) === null || _a === void 0 ? void 0 : _a.origin) !== null && _b !== void 0 ? _b : null;
29
+ }
30
+ catch {
31
+ // If a sandbox prevents origin inspection, fail closed before issuing a
32
+ // credentialed request that the DFW Worker cannot safely authorize.
33
+ return 'null';
34
+ }
35
+ };
21
36
  const stateKey = (merchantId) => `${sessionStateKeyPrefix}:${merchantId}`;
22
37
  const browserStorage = () => {
23
38
  var _a;
@@ -139,6 +154,13 @@ var ProvidersDataflywheelSdk = (function () {
139
154
  if (!shouldBootstrap(now, expiresAtMs(existing))) {
140
155
  return Promise.resolve(existing);
141
156
  }
157
+ // Opaque origins (sandboxed iframes like Shopify pixels) serialize to the
158
+ // string 'null' per the HTML spec — that is what window.origin returns and
159
+ // what the fail-closed browserOrigin() catch emits. JS null means no window
160
+ // at all (non-browser host), which is not an opaque-origin sandbox.
161
+ if ((input.origin === undefined ? browserOrigin() : input.origin) === 'null') {
162
+ return Promise.resolve(null);
163
+ }
142
164
  const key = stateKey(merchantId);
143
165
  const existingBootstrap = inFlight.get(key);
144
166
  if (existingBootstrap)
package/index.mjs CHANGED
@@ -15,6 +15,21 @@ const isEnabledFlag = (value, defaultValue = true) => {
15
15
  return value !== '0' && value.toLowerCase() !== 'false';
16
16
  };
17
17
  const shouldBootstrap = (now, expiresAt) => expiresAt == null || now >= expiresAt;
18
+ const browserOrigin = () => {
19
+ var _a, _b;
20
+ try {
21
+ if (typeof window === 'undefined')
22
+ return null;
23
+ return typeof window.origin === 'string'
24
+ ? window.origin
25
+ : (_b = (_a = window.location) === null || _a === void 0 ? void 0 : _a.origin) !== null && _b !== void 0 ? _b : null;
26
+ }
27
+ catch {
28
+ // If a sandbox prevents origin inspection, fail closed before issuing a
29
+ // credentialed request that the DFW Worker cannot safely authorize.
30
+ return 'null';
31
+ }
32
+ };
18
33
  const stateKey = (merchantId) => `${sessionStateKeyPrefix}:${merchantId}`;
19
34
  const browserStorage = () => {
20
35
  var _a;
@@ -136,6 +151,13 @@ function ensureSession(input) {
136
151
  if (!shouldBootstrap(now, expiresAtMs(existing))) {
137
152
  return Promise.resolve(existing);
138
153
  }
154
+ // Opaque origins (sandboxed iframes like Shopify pixels) serialize to the
155
+ // string 'null' per the HTML spec — that is what window.origin returns and
156
+ // what the fail-closed browserOrigin() catch emits. JS null means no window
157
+ // at all (non-browser host), which is not an opaque-origin sandbox.
158
+ if ((input.origin === undefined ? browserOrigin() : input.origin) === 'null') {
159
+ return Promise.resolve(null);
160
+ }
139
161
  const key = stateKey(merchantId);
140
162
  const existingBootstrap = inFlight.get(key);
141
163
  if (existingBootstrap)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-dataflywheel-sdk",
3
- "version": "1.63.3",
3
+ "version": "1.64.0",
4
4
  "description": "DataFlywheel browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",