@blotoutio/providers-blotout-wallet-sdk 1.5.0 → 1.6.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/core.cjs.js CHANGED
@@ -303,7 +303,70 @@ const isoCountries = new Map([
303
303
  ['ZM', 'Zambia'],
304
304
  ['ZW', 'Zimbabwe'],
305
305
  ]);
306
- new Set(isoCountries.keys());
306
+ /**
307
+ * ISO-3166 US state ISO codes
308
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
309
+ * */
310
+ const usStates = new Map([
311
+ ['US-AL', 'Alabama'],
312
+ ['US-AK', 'Alaska'],
313
+ ['US-AZ', 'Arizona'],
314
+ ['US-AR', 'Arkansas'],
315
+ ['US-CA', 'California'],
316
+ ['US-CO', 'Colorado'],
317
+ ['US-CT', 'Connecticut'],
318
+ ['US-DE', 'Delaware'],
319
+ ['US-FL', 'Florida'],
320
+ ['US-GA', 'Georgia'],
321
+ ['US-HI', 'Hawaii'],
322
+ ['US-ID', 'Idaho'],
323
+ ['US-IL', 'Illinois'],
324
+ ['US-IN', 'Indiana'],
325
+ ['US-IA', 'Iowa'],
326
+ ['US-KS', 'Kansas'],
327
+ ['US-KY', 'Kentucky'],
328
+ ['US-LA', 'Louisiana'],
329
+ ['US-ME', 'Maine'],
330
+ ['US-MD', 'Maryland'],
331
+ ['US-MA', 'Massachusetts'],
332
+ ['US-MI', 'Michigan'],
333
+ ['US-MN', 'Minnesota'],
334
+ ['US-MS', 'Mississippi'],
335
+ ['US-MO', 'Missouri'],
336
+ ['US-MT', 'Montana'],
337
+ ['US-NE', 'Nebraska'],
338
+ ['US-NV', 'Nevada'],
339
+ ['US-NH', 'New Hampshire'],
340
+ ['US-NJ', 'New Jersey'],
341
+ ['US-NM', 'New Mexico'],
342
+ ['US-NY', 'New York'],
343
+ ['US-NC', 'North Carolina'],
344
+ ['US-ND', 'North Dakota'],
345
+ ['US-OH', 'Ohio'],
346
+ ['US-OK', 'Oklahoma'],
347
+ ['US-OR', 'Oregon'],
348
+ ['US-PA', 'Pennsylvania'],
349
+ ['US-RI', 'Rhode Island'],
350
+ ['US-SC', 'South Carolina'],
351
+ ['US-SD', 'South Dakota'],
352
+ ['US-TN', 'Tennessee'],
353
+ ['US-TX', 'Texas'],
354
+ ['US-UT', 'Utah'],
355
+ ['US-VT', 'Vermont'],
356
+ ['US-VA', 'Virginia'],
357
+ ['US-WA', 'Washington'],
358
+ ['US-WV', 'West Virginia'],
359
+ ['US-WI', 'Wisconsin'],
360
+ ['US-WY', 'Wyoming'],
361
+ ['US-DC', 'District of Columbia'],
362
+ ['US-AS', 'American Samoa'],
363
+ ['US-GU', 'Guam'],
364
+ ['US-MP', 'Northern Mariana Islands'],
365
+ ['US-PR', 'Puerto Rico'],
366
+ ['US-UM', 'United States Minor Outlying Islands'],
367
+ ['US-VI', 'Virgin Islands, U.S.'],
368
+ ]);
369
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
307
370
 
308
371
  const createEnabled = () => ({
309
372
  name: 'enabled',
@@ -437,6 +500,19 @@ const clearStoredData = (destination) => {
437
500
  }
438
501
  };
439
502
 
503
+ const isOnAllowedSubdomain = (url, rootDomain, disallowedSubdomains) => {
504
+ if (window.top !== window) {
505
+ return false;
506
+ }
507
+ try {
508
+ const hostname = new URL(url).hostname;
509
+ return !disallowedSubdomains.some((subdomain) => hostname == `${subdomain}.${rootDomain}`);
510
+ }
511
+ catch (err) {
512
+ return true;
513
+ }
514
+ };
515
+
440
516
  const eventsToUpdateLastSeen = new Set([
441
517
  'AddToCart',
442
518
  'RemoveFromCart',
@@ -444,11 +520,13 @@ const eventsToUpdateLastSeen = new Set([
444
520
  ]);
445
521
  const tag = ({ destination, manifestVariables, eventName, }) => {
446
522
  var _a;
523
+ const allowed = isOnAllowedSubdomain(window.location.href, manifestVariables.siteDomain, manifestVariables.disallowedSubdomains);
447
524
  const result = {
448
525
  cartToken: '',
449
526
  previewKey: '',
450
527
  lastSeenToken: '',
451
528
  hasCachedData: false,
529
+ isOnAllowedSubdomain: allowed,
452
530
  };
453
531
  if (typeof window == 'undefined') {
454
532
  return result;
@@ -632,7 +710,7 @@ const walletLogger = {
632
710
  };
633
711
 
634
712
  const init = (params) => {
635
- var _a, _b, _c, _d, _e, _f, _g, _h;
713
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
636
714
  if (typeof window == 'undefined' || typeof document == 'undefined') {
637
715
  // if loaded in non-browser SDKs, return early
638
716
  return;
@@ -650,7 +728,11 @@ const init = (params) => {
650
728
  // exit if not in top window
651
729
  return;
652
730
  }
653
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
731
+ if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_d = (_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c.disallowedSubdomains) !== null && _d !== void 0 ? _d : [])) {
732
+ walletLogger.error('Disabling cart recovery when not running on root domain');
733
+ return;
734
+ }
735
+ const { enabled, previewKey, mode = 'disabled', } = (_e = params.manifest.variables) !== null && _e !== void 0 ? _e : {};
654
736
  const experiment = createExperiment({
655
737
  name: mode,
656
738
  userId: params.userId,
@@ -677,11 +759,11 @@ const init = (params) => {
677
759
  userId: params.userId,
678
760
  });
679
761
  uiImplementation.init({
680
- theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
681
- afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
762
+ theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
763
+ afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
682
764
  action: 'none',
683
765
  },
684
- silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
766
+ silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
685
767
  walletAPI,
686
768
  storeAPI,
687
769
  });
package/core.js CHANGED
@@ -304,7 +304,70 @@ var ProvidersBlotoutWalletSdk = (function () {
304
304
  ['ZM', 'Zambia'],
305
305
  ['ZW', 'Zimbabwe'],
306
306
  ]);
307
- new Set(isoCountries.keys());
307
+ /**
308
+ * ISO-3166 US state ISO codes
309
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
310
+ * */
311
+ const usStates = new Map([
312
+ ['US-AL', 'Alabama'],
313
+ ['US-AK', 'Alaska'],
314
+ ['US-AZ', 'Arizona'],
315
+ ['US-AR', 'Arkansas'],
316
+ ['US-CA', 'California'],
317
+ ['US-CO', 'Colorado'],
318
+ ['US-CT', 'Connecticut'],
319
+ ['US-DE', 'Delaware'],
320
+ ['US-FL', 'Florida'],
321
+ ['US-GA', 'Georgia'],
322
+ ['US-HI', 'Hawaii'],
323
+ ['US-ID', 'Idaho'],
324
+ ['US-IL', 'Illinois'],
325
+ ['US-IN', 'Indiana'],
326
+ ['US-IA', 'Iowa'],
327
+ ['US-KS', 'Kansas'],
328
+ ['US-KY', 'Kentucky'],
329
+ ['US-LA', 'Louisiana'],
330
+ ['US-ME', 'Maine'],
331
+ ['US-MD', 'Maryland'],
332
+ ['US-MA', 'Massachusetts'],
333
+ ['US-MI', 'Michigan'],
334
+ ['US-MN', 'Minnesota'],
335
+ ['US-MS', 'Mississippi'],
336
+ ['US-MO', 'Missouri'],
337
+ ['US-MT', 'Montana'],
338
+ ['US-NE', 'Nebraska'],
339
+ ['US-NV', 'Nevada'],
340
+ ['US-NH', 'New Hampshire'],
341
+ ['US-NJ', 'New Jersey'],
342
+ ['US-NM', 'New Mexico'],
343
+ ['US-NY', 'New York'],
344
+ ['US-NC', 'North Carolina'],
345
+ ['US-ND', 'North Dakota'],
346
+ ['US-OH', 'Ohio'],
347
+ ['US-OK', 'Oklahoma'],
348
+ ['US-OR', 'Oregon'],
349
+ ['US-PA', 'Pennsylvania'],
350
+ ['US-RI', 'Rhode Island'],
351
+ ['US-SC', 'South Carolina'],
352
+ ['US-SD', 'South Dakota'],
353
+ ['US-TN', 'Tennessee'],
354
+ ['US-TX', 'Texas'],
355
+ ['US-UT', 'Utah'],
356
+ ['US-VT', 'Vermont'],
357
+ ['US-VA', 'Virginia'],
358
+ ['US-WA', 'Washington'],
359
+ ['US-WV', 'West Virginia'],
360
+ ['US-WI', 'Wisconsin'],
361
+ ['US-WY', 'Wyoming'],
362
+ ['US-DC', 'District of Columbia'],
363
+ ['US-AS', 'American Samoa'],
364
+ ['US-GU', 'Guam'],
365
+ ['US-MP', 'Northern Mariana Islands'],
366
+ ['US-PR', 'Puerto Rico'],
367
+ ['US-UM', 'United States Minor Outlying Islands'],
368
+ ['US-VI', 'Virgin Islands, U.S.'],
369
+ ]);
370
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
308
371
 
309
372
  const createEnabled = () => ({
310
373
  name: 'enabled',
@@ -438,6 +501,19 @@ var ProvidersBlotoutWalletSdk = (function () {
438
501
  }
439
502
  };
440
503
 
504
+ const isOnAllowedSubdomain = (url, rootDomain, disallowedSubdomains) => {
505
+ if (window.top !== window) {
506
+ return false;
507
+ }
508
+ try {
509
+ const hostname = new URL(url).hostname;
510
+ return !disallowedSubdomains.some((subdomain) => hostname == `${subdomain}.${rootDomain}`);
511
+ }
512
+ catch (err) {
513
+ return true;
514
+ }
515
+ };
516
+
441
517
  const eventsToUpdateLastSeen = new Set([
442
518
  'AddToCart',
443
519
  'RemoveFromCart',
@@ -445,11 +521,13 @@ var ProvidersBlotoutWalletSdk = (function () {
445
521
  ]);
446
522
  const tag = ({ destination, manifestVariables, eventName, }) => {
447
523
  var _a;
524
+ const allowed = isOnAllowedSubdomain(window.location.href, manifestVariables.siteDomain, manifestVariables.disallowedSubdomains);
448
525
  const result = {
449
526
  cartToken: '',
450
527
  previewKey: '',
451
528
  lastSeenToken: '',
452
529
  hasCachedData: false,
530
+ isOnAllowedSubdomain: allowed,
453
531
  };
454
532
  if (typeof window == 'undefined') {
455
533
  return result;
@@ -633,7 +711,7 @@ var ProvidersBlotoutWalletSdk = (function () {
633
711
  };
634
712
 
635
713
  const init = (params) => {
636
- var _a, _b, _c, _d, _e, _f, _g, _h;
714
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
637
715
  if (typeof window == 'undefined' || typeof document == 'undefined') {
638
716
  // if loaded in non-browser SDKs, return early
639
717
  return;
@@ -651,7 +729,11 @@ var ProvidersBlotoutWalletSdk = (function () {
651
729
  // exit if not in top window
652
730
  return;
653
731
  }
654
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
732
+ if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_d = (_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c.disallowedSubdomains) !== null && _d !== void 0 ? _d : [])) {
733
+ walletLogger.error('Disabling cart recovery when not running on root domain');
734
+ return;
735
+ }
736
+ const { enabled, previewKey, mode = 'disabled', } = (_e = params.manifest.variables) !== null && _e !== void 0 ? _e : {};
655
737
  const experiment = createExperiment({
656
738
  name: mode,
657
739
  userId: params.userId,
@@ -678,11 +760,11 @@ var ProvidersBlotoutWalletSdk = (function () {
678
760
  userId: params.userId,
679
761
  });
680
762
  uiImplementation.init({
681
- theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
682
- afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
763
+ theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
764
+ afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
683
765
  action: 'none',
684
766
  },
685
- silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
767
+ silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
686
768
  walletAPI,
687
769
  storeAPI,
688
770
  });
package/core.mjs CHANGED
@@ -301,7 +301,70 @@ const isoCountries = new Map([
301
301
  ['ZM', 'Zambia'],
302
302
  ['ZW', 'Zimbabwe'],
303
303
  ]);
304
- new Set(isoCountries.keys());
304
+ /**
305
+ * ISO-3166 US state ISO codes
306
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
307
+ * */
308
+ const usStates = new Map([
309
+ ['US-AL', 'Alabama'],
310
+ ['US-AK', 'Alaska'],
311
+ ['US-AZ', 'Arizona'],
312
+ ['US-AR', 'Arkansas'],
313
+ ['US-CA', 'California'],
314
+ ['US-CO', 'Colorado'],
315
+ ['US-CT', 'Connecticut'],
316
+ ['US-DE', 'Delaware'],
317
+ ['US-FL', 'Florida'],
318
+ ['US-GA', 'Georgia'],
319
+ ['US-HI', 'Hawaii'],
320
+ ['US-ID', 'Idaho'],
321
+ ['US-IL', 'Illinois'],
322
+ ['US-IN', 'Indiana'],
323
+ ['US-IA', 'Iowa'],
324
+ ['US-KS', 'Kansas'],
325
+ ['US-KY', 'Kentucky'],
326
+ ['US-LA', 'Louisiana'],
327
+ ['US-ME', 'Maine'],
328
+ ['US-MD', 'Maryland'],
329
+ ['US-MA', 'Massachusetts'],
330
+ ['US-MI', 'Michigan'],
331
+ ['US-MN', 'Minnesota'],
332
+ ['US-MS', 'Mississippi'],
333
+ ['US-MO', 'Missouri'],
334
+ ['US-MT', 'Montana'],
335
+ ['US-NE', 'Nebraska'],
336
+ ['US-NV', 'Nevada'],
337
+ ['US-NH', 'New Hampshire'],
338
+ ['US-NJ', 'New Jersey'],
339
+ ['US-NM', 'New Mexico'],
340
+ ['US-NY', 'New York'],
341
+ ['US-NC', 'North Carolina'],
342
+ ['US-ND', 'North Dakota'],
343
+ ['US-OH', 'Ohio'],
344
+ ['US-OK', 'Oklahoma'],
345
+ ['US-OR', 'Oregon'],
346
+ ['US-PA', 'Pennsylvania'],
347
+ ['US-RI', 'Rhode Island'],
348
+ ['US-SC', 'South Carolina'],
349
+ ['US-SD', 'South Dakota'],
350
+ ['US-TN', 'Tennessee'],
351
+ ['US-TX', 'Texas'],
352
+ ['US-UT', 'Utah'],
353
+ ['US-VT', 'Vermont'],
354
+ ['US-VA', 'Virginia'],
355
+ ['US-WA', 'Washington'],
356
+ ['US-WV', 'West Virginia'],
357
+ ['US-WI', 'Wisconsin'],
358
+ ['US-WY', 'Wyoming'],
359
+ ['US-DC', 'District of Columbia'],
360
+ ['US-AS', 'American Samoa'],
361
+ ['US-GU', 'Guam'],
362
+ ['US-MP', 'Northern Mariana Islands'],
363
+ ['US-PR', 'Puerto Rico'],
364
+ ['US-UM', 'United States Minor Outlying Islands'],
365
+ ['US-VI', 'Virgin Islands, U.S.'],
366
+ ]);
367
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
305
368
 
306
369
  const createEnabled = () => ({
307
370
  name: 'enabled',
@@ -435,6 +498,19 @@ const clearStoredData = (destination) => {
435
498
  }
436
499
  };
437
500
 
501
+ const isOnAllowedSubdomain = (url, rootDomain, disallowedSubdomains) => {
502
+ if (window.top !== window) {
503
+ return false;
504
+ }
505
+ try {
506
+ const hostname = new URL(url).hostname;
507
+ return !disallowedSubdomains.some((subdomain) => hostname == `${subdomain}.${rootDomain}`);
508
+ }
509
+ catch (err) {
510
+ return true;
511
+ }
512
+ };
513
+
438
514
  const eventsToUpdateLastSeen = new Set([
439
515
  'AddToCart',
440
516
  'RemoveFromCart',
@@ -442,11 +518,13 @@ const eventsToUpdateLastSeen = new Set([
442
518
  ]);
443
519
  const tag = ({ destination, manifestVariables, eventName, }) => {
444
520
  var _a;
521
+ const allowed = isOnAllowedSubdomain(window.location.href, manifestVariables.siteDomain, manifestVariables.disallowedSubdomains);
445
522
  const result = {
446
523
  cartToken: '',
447
524
  previewKey: '',
448
525
  lastSeenToken: '',
449
526
  hasCachedData: false,
527
+ isOnAllowedSubdomain: allowed,
450
528
  };
451
529
  if (typeof window == 'undefined') {
452
530
  return result;
@@ -630,7 +708,7 @@ const walletLogger = {
630
708
  };
631
709
 
632
710
  const init = (params) => {
633
- var _a, _b, _c, _d, _e, _f, _g, _h;
711
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
634
712
  if (typeof window == 'undefined' || typeof document == 'undefined') {
635
713
  // if loaded in non-browser SDKs, return early
636
714
  return;
@@ -648,7 +726,11 @@ const init = (params) => {
648
726
  // exit if not in top window
649
727
  return;
650
728
  }
651
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
729
+ if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_d = (_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c.disallowedSubdomains) !== null && _d !== void 0 ? _d : [])) {
730
+ walletLogger.error('Disabling cart recovery when not running on root domain');
731
+ return;
732
+ }
733
+ const { enabled, previewKey, mode = 'disabled', } = (_e = params.manifest.variables) !== null && _e !== void 0 ? _e : {};
652
734
  const experiment = createExperiment({
653
735
  name: mode,
654
736
  userId: params.userId,
@@ -675,11 +757,11 @@ const init = (params) => {
675
757
  userId: params.userId,
676
758
  });
677
759
  uiImplementation.init({
678
- theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
679
- afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
760
+ theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
761
+ afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
680
762
  action: 'none',
681
763
  },
682
- silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
764
+ silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
683
765
  walletAPI,
684
766
  storeAPI,
685
767
  });
package/index.cjs.js CHANGED
@@ -305,7 +305,70 @@ const isoCountries = new Map([
305
305
  ['ZM', 'Zambia'],
306
306
  ['ZW', 'Zimbabwe'],
307
307
  ]);
308
- new Set(isoCountries.keys());
308
+ /**
309
+ * ISO-3166 US state ISO codes
310
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
311
+ * */
312
+ const usStates = new Map([
313
+ ['US-AL', 'Alabama'],
314
+ ['US-AK', 'Alaska'],
315
+ ['US-AZ', 'Arizona'],
316
+ ['US-AR', 'Arkansas'],
317
+ ['US-CA', 'California'],
318
+ ['US-CO', 'Colorado'],
319
+ ['US-CT', 'Connecticut'],
320
+ ['US-DE', 'Delaware'],
321
+ ['US-FL', 'Florida'],
322
+ ['US-GA', 'Georgia'],
323
+ ['US-HI', 'Hawaii'],
324
+ ['US-ID', 'Idaho'],
325
+ ['US-IL', 'Illinois'],
326
+ ['US-IN', 'Indiana'],
327
+ ['US-IA', 'Iowa'],
328
+ ['US-KS', 'Kansas'],
329
+ ['US-KY', 'Kentucky'],
330
+ ['US-LA', 'Louisiana'],
331
+ ['US-ME', 'Maine'],
332
+ ['US-MD', 'Maryland'],
333
+ ['US-MA', 'Massachusetts'],
334
+ ['US-MI', 'Michigan'],
335
+ ['US-MN', 'Minnesota'],
336
+ ['US-MS', 'Mississippi'],
337
+ ['US-MO', 'Missouri'],
338
+ ['US-MT', 'Montana'],
339
+ ['US-NE', 'Nebraska'],
340
+ ['US-NV', 'Nevada'],
341
+ ['US-NH', 'New Hampshire'],
342
+ ['US-NJ', 'New Jersey'],
343
+ ['US-NM', 'New Mexico'],
344
+ ['US-NY', 'New York'],
345
+ ['US-NC', 'North Carolina'],
346
+ ['US-ND', 'North Dakota'],
347
+ ['US-OH', 'Ohio'],
348
+ ['US-OK', 'Oklahoma'],
349
+ ['US-OR', 'Oregon'],
350
+ ['US-PA', 'Pennsylvania'],
351
+ ['US-RI', 'Rhode Island'],
352
+ ['US-SC', 'South Carolina'],
353
+ ['US-SD', 'South Dakota'],
354
+ ['US-TN', 'Tennessee'],
355
+ ['US-TX', 'Texas'],
356
+ ['US-UT', 'Utah'],
357
+ ['US-VT', 'Vermont'],
358
+ ['US-VA', 'Virginia'],
359
+ ['US-WA', 'Washington'],
360
+ ['US-WV', 'West Virginia'],
361
+ ['US-WI', 'Wisconsin'],
362
+ ['US-WY', 'Wyoming'],
363
+ ['US-DC', 'District of Columbia'],
364
+ ['US-AS', 'American Samoa'],
365
+ ['US-GU', 'Guam'],
366
+ ['US-MP', 'Northern Mariana Islands'],
367
+ ['US-PR', 'Puerto Rico'],
368
+ ['US-UM', 'United States Minor Outlying Islands'],
369
+ ['US-VI', 'Virgin Islands, U.S.'],
370
+ ]);
371
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
309
372
 
310
373
  const createEnabled = () => ({
311
374
  name: 'enabled',
@@ -530,6 +593,19 @@ const clearStoredData = (destination) => {
530
593
  }
531
594
  };
532
595
 
596
+ const isOnAllowedSubdomain = (url, rootDomain, disallowedSubdomains) => {
597
+ if (window.top !== window) {
598
+ return false;
599
+ }
600
+ try {
601
+ const hostname = new URL(url).hostname;
602
+ return !disallowedSubdomains.some((subdomain) => hostname == `${subdomain}.${rootDomain}`);
603
+ }
604
+ catch (err) {
605
+ return true;
606
+ }
607
+ };
608
+
533
609
  const eventsToUpdateLastSeen = new Set([
534
610
  'AddToCart',
535
611
  'RemoveFromCart',
@@ -537,11 +613,13 @@ const eventsToUpdateLastSeen = new Set([
537
613
  ]);
538
614
  const tag = ({ destination, manifestVariables, eventName, }) => {
539
615
  var _a;
616
+ const allowed = isOnAllowedSubdomain(window.location.href, manifestVariables.siteDomain, manifestVariables.disallowedSubdomains);
540
617
  const result = {
541
618
  cartToken: '',
542
619
  previewKey: '',
543
620
  lastSeenToken: '',
544
621
  hasCachedData: false,
622
+ isOnAllowedSubdomain: allowed,
545
623
  };
546
624
  if (typeof window == 'undefined') {
547
625
  return result;
@@ -757,7 +835,7 @@ const walletLogger = {
757
835
  };
758
836
 
759
837
  const init = (params) => {
760
- var _a, _b, _c, _d, _e, _f, _g, _h;
838
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
761
839
  if (typeof window == 'undefined' || typeof document == 'undefined') {
762
840
  // if loaded in non-browser SDKs, return early
763
841
  return;
@@ -775,7 +853,11 @@ const init = (params) => {
775
853
  // exit if not in top window
776
854
  return;
777
855
  }
778
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
856
+ if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_d = (_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c.disallowedSubdomains) !== null && _d !== void 0 ? _d : [])) {
857
+ walletLogger.error('Disabling cart recovery when not running on root domain');
858
+ return;
859
+ }
860
+ const { enabled, previewKey, mode = 'disabled', } = (_e = params.manifest.variables) !== null && _e !== void 0 ? _e : {};
779
861
  const experiment = createExperiment({
780
862
  name: mode,
781
863
  userId: params.userId,
@@ -802,11 +884,11 @@ const init = (params) => {
802
884
  userId: params.userId,
803
885
  });
804
886
  uiImplementation.init({
805
- theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
806
- afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
887
+ theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
888
+ afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
807
889
  action: 'none',
808
890
  },
809
- silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
891
+ silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
810
892
  walletAPI,
811
893
  storeAPI,
812
894
  });
package/index.js CHANGED
@@ -306,7 +306,70 @@ var ProvidersBlotoutWalletSdk = (function () {
306
306
  ['ZM', 'Zambia'],
307
307
  ['ZW', 'Zimbabwe'],
308
308
  ]);
309
- new Set(isoCountries.keys());
309
+ /**
310
+ * ISO-3166 US state ISO codes
311
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
312
+ * */
313
+ const usStates = new Map([
314
+ ['US-AL', 'Alabama'],
315
+ ['US-AK', 'Alaska'],
316
+ ['US-AZ', 'Arizona'],
317
+ ['US-AR', 'Arkansas'],
318
+ ['US-CA', 'California'],
319
+ ['US-CO', 'Colorado'],
320
+ ['US-CT', 'Connecticut'],
321
+ ['US-DE', 'Delaware'],
322
+ ['US-FL', 'Florida'],
323
+ ['US-GA', 'Georgia'],
324
+ ['US-HI', 'Hawaii'],
325
+ ['US-ID', 'Idaho'],
326
+ ['US-IL', 'Illinois'],
327
+ ['US-IN', 'Indiana'],
328
+ ['US-IA', 'Iowa'],
329
+ ['US-KS', 'Kansas'],
330
+ ['US-KY', 'Kentucky'],
331
+ ['US-LA', 'Louisiana'],
332
+ ['US-ME', 'Maine'],
333
+ ['US-MD', 'Maryland'],
334
+ ['US-MA', 'Massachusetts'],
335
+ ['US-MI', 'Michigan'],
336
+ ['US-MN', 'Minnesota'],
337
+ ['US-MS', 'Mississippi'],
338
+ ['US-MO', 'Missouri'],
339
+ ['US-MT', 'Montana'],
340
+ ['US-NE', 'Nebraska'],
341
+ ['US-NV', 'Nevada'],
342
+ ['US-NH', 'New Hampshire'],
343
+ ['US-NJ', 'New Jersey'],
344
+ ['US-NM', 'New Mexico'],
345
+ ['US-NY', 'New York'],
346
+ ['US-NC', 'North Carolina'],
347
+ ['US-ND', 'North Dakota'],
348
+ ['US-OH', 'Ohio'],
349
+ ['US-OK', 'Oklahoma'],
350
+ ['US-OR', 'Oregon'],
351
+ ['US-PA', 'Pennsylvania'],
352
+ ['US-RI', 'Rhode Island'],
353
+ ['US-SC', 'South Carolina'],
354
+ ['US-SD', 'South Dakota'],
355
+ ['US-TN', 'Tennessee'],
356
+ ['US-TX', 'Texas'],
357
+ ['US-UT', 'Utah'],
358
+ ['US-VT', 'Vermont'],
359
+ ['US-VA', 'Virginia'],
360
+ ['US-WA', 'Washington'],
361
+ ['US-WV', 'West Virginia'],
362
+ ['US-WI', 'Wisconsin'],
363
+ ['US-WY', 'Wyoming'],
364
+ ['US-DC', 'District of Columbia'],
365
+ ['US-AS', 'American Samoa'],
366
+ ['US-GU', 'Guam'],
367
+ ['US-MP', 'Northern Mariana Islands'],
368
+ ['US-PR', 'Puerto Rico'],
369
+ ['US-UM', 'United States Minor Outlying Islands'],
370
+ ['US-VI', 'Virgin Islands, U.S.'],
371
+ ]);
372
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
310
373
 
311
374
  const createEnabled = () => ({
312
375
  name: 'enabled',
@@ -531,6 +594,19 @@ var ProvidersBlotoutWalletSdk = (function () {
531
594
  }
532
595
  };
533
596
 
597
+ const isOnAllowedSubdomain = (url, rootDomain, disallowedSubdomains) => {
598
+ if (window.top !== window) {
599
+ return false;
600
+ }
601
+ try {
602
+ const hostname = new URL(url).hostname;
603
+ return !disallowedSubdomains.some((subdomain) => hostname == `${subdomain}.${rootDomain}`);
604
+ }
605
+ catch (err) {
606
+ return true;
607
+ }
608
+ };
609
+
534
610
  const eventsToUpdateLastSeen = new Set([
535
611
  'AddToCart',
536
612
  'RemoveFromCart',
@@ -538,11 +614,13 @@ var ProvidersBlotoutWalletSdk = (function () {
538
614
  ]);
539
615
  const tag = ({ destination, manifestVariables, eventName, }) => {
540
616
  var _a;
617
+ const allowed = isOnAllowedSubdomain(window.location.href, manifestVariables.siteDomain, manifestVariables.disallowedSubdomains);
541
618
  const result = {
542
619
  cartToken: '',
543
620
  previewKey: '',
544
621
  lastSeenToken: '',
545
622
  hasCachedData: false,
623
+ isOnAllowedSubdomain: allowed,
546
624
  };
547
625
  if (typeof window == 'undefined') {
548
626
  return result;
@@ -758,7 +836,7 @@ var ProvidersBlotoutWalletSdk = (function () {
758
836
  };
759
837
 
760
838
  const init = (params) => {
761
- var _a, _b, _c, _d, _e, _f, _g, _h;
839
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
762
840
  if (typeof window == 'undefined' || typeof document == 'undefined') {
763
841
  // if loaded in non-browser SDKs, return early
764
842
  return;
@@ -776,7 +854,11 @@ var ProvidersBlotoutWalletSdk = (function () {
776
854
  // exit if not in top window
777
855
  return;
778
856
  }
779
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
857
+ if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_d = (_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c.disallowedSubdomains) !== null && _d !== void 0 ? _d : [])) {
858
+ walletLogger.error('Disabling cart recovery when not running on root domain');
859
+ return;
860
+ }
861
+ const { enabled, previewKey, mode = 'disabled', } = (_e = params.manifest.variables) !== null && _e !== void 0 ? _e : {};
780
862
  const experiment = createExperiment({
781
863
  name: mode,
782
864
  userId: params.userId,
@@ -803,11 +885,11 @@ var ProvidersBlotoutWalletSdk = (function () {
803
885
  userId: params.userId,
804
886
  });
805
887
  uiImplementation.init({
806
- theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
807
- afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
888
+ theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
889
+ afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
808
890
  action: 'none',
809
891
  },
810
- silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
892
+ silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
811
893
  walletAPI,
812
894
  storeAPI,
813
895
  });
package/index.mjs CHANGED
@@ -303,7 +303,70 @@ const isoCountries = new Map([
303
303
  ['ZM', 'Zambia'],
304
304
  ['ZW', 'Zimbabwe'],
305
305
  ]);
306
- new Set(isoCountries.keys());
306
+ /**
307
+ * ISO-3166 US state ISO codes
308
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
309
+ * */
310
+ const usStates = new Map([
311
+ ['US-AL', 'Alabama'],
312
+ ['US-AK', 'Alaska'],
313
+ ['US-AZ', 'Arizona'],
314
+ ['US-AR', 'Arkansas'],
315
+ ['US-CA', 'California'],
316
+ ['US-CO', 'Colorado'],
317
+ ['US-CT', 'Connecticut'],
318
+ ['US-DE', 'Delaware'],
319
+ ['US-FL', 'Florida'],
320
+ ['US-GA', 'Georgia'],
321
+ ['US-HI', 'Hawaii'],
322
+ ['US-ID', 'Idaho'],
323
+ ['US-IL', 'Illinois'],
324
+ ['US-IN', 'Indiana'],
325
+ ['US-IA', 'Iowa'],
326
+ ['US-KS', 'Kansas'],
327
+ ['US-KY', 'Kentucky'],
328
+ ['US-LA', 'Louisiana'],
329
+ ['US-ME', 'Maine'],
330
+ ['US-MD', 'Maryland'],
331
+ ['US-MA', 'Massachusetts'],
332
+ ['US-MI', 'Michigan'],
333
+ ['US-MN', 'Minnesota'],
334
+ ['US-MS', 'Mississippi'],
335
+ ['US-MO', 'Missouri'],
336
+ ['US-MT', 'Montana'],
337
+ ['US-NE', 'Nebraska'],
338
+ ['US-NV', 'Nevada'],
339
+ ['US-NH', 'New Hampshire'],
340
+ ['US-NJ', 'New Jersey'],
341
+ ['US-NM', 'New Mexico'],
342
+ ['US-NY', 'New York'],
343
+ ['US-NC', 'North Carolina'],
344
+ ['US-ND', 'North Dakota'],
345
+ ['US-OH', 'Ohio'],
346
+ ['US-OK', 'Oklahoma'],
347
+ ['US-OR', 'Oregon'],
348
+ ['US-PA', 'Pennsylvania'],
349
+ ['US-RI', 'Rhode Island'],
350
+ ['US-SC', 'South Carolina'],
351
+ ['US-SD', 'South Dakota'],
352
+ ['US-TN', 'Tennessee'],
353
+ ['US-TX', 'Texas'],
354
+ ['US-UT', 'Utah'],
355
+ ['US-VT', 'Vermont'],
356
+ ['US-VA', 'Virginia'],
357
+ ['US-WA', 'Washington'],
358
+ ['US-WV', 'West Virginia'],
359
+ ['US-WI', 'Wisconsin'],
360
+ ['US-WY', 'Wyoming'],
361
+ ['US-DC', 'District of Columbia'],
362
+ ['US-AS', 'American Samoa'],
363
+ ['US-GU', 'Guam'],
364
+ ['US-MP', 'Northern Mariana Islands'],
365
+ ['US-PR', 'Puerto Rico'],
366
+ ['US-UM', 'United States Minor Outlying Islands'],
367
+ ['US-VI', 'Virgin Islands, U.S.'],
368
+ ]);
369
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
307
370
 
308
371
  const createEnabled = () => ({
309
372
  name: 'enabled',
@@ -528,6 +591,19 @@ const clearStoredData = (destination) => {
528
591
  }
529
592
  };
530
593
 
594
+ const isOnAllowedSubdomain = (url, rootDomain, disallowedSubdomains) => {
595
+ if (window.top !== window) {
596
+ return false;
597
+ }
598
+ try {
599
+ const hostname = new URL(url).hostname;
600
+ return !disallowedSubdomains.some((subdomain) => hostname == `${subdomain}.${rootDomain}`);
601
+ }
602
+ catch (err) {
603
+ return true;
604
+ }
605
+ };
606
+
531
607
  const eventsToUpdateLastSeen = new Set([
532
608
  'AddToCart',
533
609
  'RemoveFromCart',
@@ -535,11 +611,13 @@ const eventsToUpdateLastSeen = new Set([
535
611
  ]);
536
612
  const tag = ({ destination, manifestVariables, eventName, }) => {
537
613
  var _a;
614
+ const allowed = isOnAllowedSubdomain(window.location.href, manifestVariables.siteDomain, manifestVariables.disallowedSubdomains);
538
615
  const result = {
539
616
  cartToken: '',
540
617
  previewKey: '',
541
618
  lastSeenToken: '',
542
619
  hasCachedData: false,
620
+ isOnAllowedSubdomain: allowed,
543
621
  };
544
622
  if (typeof window == 'undefined') {
545
623
  return result;
@@ -755,7 +833,7 @@ const walletLogger = {
755
833
  };
756
834
 
757
835
  const init = (params) => {
758
- var _a, _b, _c, _d, _e, _f, _g, _h;
836
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
759
837
  if (typeof window == 'undefined' || typeof document == 'undefined') {
760
838
  // if loaded in non-browser SDKs, return early
761
839
  return;
@@ -773,7 +851,11 @@ const init = (params) => {
773
851
  // exit if not in top window
774
852
  return;
775
853
  }
776
- const { enabled, previewKey, mode = 'disabled', } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
854
+ if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_d = (_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c.disallowedSubdomains) !== null && _d !== void 0 ? _d : [])) {
855
+ walletLogger.error('Disabling cart recovery when not running on root domain');
856
+ return;
857
+ }
858
+ const { enabled, previewKey, mode = 'disabled', } = (_e = params.manifest.variables) !== null && _e !== void 0 ? _e : {};
777
859
  const experiment = createExperiment({
778
860
  name: mode,
779
861
  userId: params.userId,
@@ -800,11 +882,11 @@ const init = (params) => {
800
882
  userId: params.userId,
801
883
  });
802
884
  uiImplementation.init({
803
- theme: (_e = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d.theme) !== null && _e !== void 0 ? _e : {},
804
- afterRestore: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.afterRestore) !== null && _g !== void 0 ? _g : {
885
+ theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
886
+ afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
805
887
  action: 'none',
806
888
  },
807
- silentRestore: !!((_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.silentRestore),
889
+ silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
808
890
  walletAPI,
809
891
  storeAPI,
810
892
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-blotout-wallet-sdk",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Blotout Wallet SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",
@@ -293,7 +293,70 @@ const isoCountries = new Map([
293
293
  ['ZM', 'Zambia'],
294
294
  ['ZW', 'Zimbabwe'],
295
295
  ]);
296
- new Set(isoCountries.keys());
296
+ /**
297
+ * ISO-3166 US state ISO codes
298
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
299
+ * */
300
+ const usStates = new Map([
301
+ ['US-AL', 'Alabama'],
302
+ ['US-AK', 'Alaska'],
303
+ ['US-AZ', 'Arizona'],
304
+ ['US-AR', 'Arkansas'],
305
+ ['US-CA', 'California'],
306
+ ['US-CO', 'Colorado'],
307
+ ['US-CT', 'Connecticut'],
308
+ ['US-DE', 'Delaware'],
309
+ ['US-FL', 'Florida'],
310
+ ['US-GA', 'Georgia'],
311
+ ['US-HI', 'Hawaii'],
312
+ ['US-ID', 'Idaho'],
313
+ ['US-IL', 'Illinois'],
314
+ ['US-IN', 'Indiana'],
315
+ ['US-IA', 'Iowa'],
316
+ ['US-KS', 'Kansas'],
317
+ ['US-KY', 'Kentucky'],
318
+ ['US-LA', 'Louisiana'],
319
+ ['US-ME', 'Maine'],
320
+ ['US-MD', 'Maryland'],
321
+ ['US-MA', 'Massachusetts'],
322
+ ['US-MI', 'Michigan'],
323
+ ['US-MN', 'Minnesota'],
324
+ ['US-MS', 'Mississippi'],
325
+ ['US-MO', 'Missouri'],
326
+ ['US-MT', 'Montana'],
327
+ ['US-NE', 'Nebraska'],
328
+ ['US-NV', 'Nevada'],
329
+ ['US-NH', 'New Hampshire'],
330
+ ['US-NJ', 'New Jersey'],
331
+ ['US-NM', 'New Mexico'],
332
+ ['US-NY', 'New York'],
333
+ ['US-NC', 'North Carolina'],
334
+ ['US-ND', 'North Dakota'],
335
+ ['US-OH', 'Ohio'],
336
+ ['US-OK', 'Oklahoma'],
337
+ ['US-OR', 'Oregon'],
338
+ ['US-PA', 'Pennsylvania'],
339
+ ['US-RI', 'Rhode Island'],
340
+ ['US-SC', 'South Carolina'],
341
+ ['US-SD', 'South Dakota'],
342
+ ['US-TN', 'Tennessee'],
343
+ ['US-TX', 'Texas'],
344
+ ['US-UT', 'Utah'],
345
+ ['US-VT', 'Vermont'],
346
+ ['US-VA', 'Virginia'],
347
+ ['US-WA', 'Washington'],
348
+ ['US-WV', 'West Virginia'],
349
+ ['US-WI', 'Wisconsin'],
350
+ ['US-WY', 'Wyoming'],
351
+ ['US-DC', 'District of Columbia'],
352
+ ['US-AS', 'American Samoa'],
353
+ ['US-GU', 'Guam'],
354
+ ['US-MP', 'Northern Mariana Islands'],
355
+ ['US-PR', 'Puerto Rico'],
356
+ ['US-UM', 'United States Minor Outlying Islands'],
357
+ ['US-VI', 'Virgin Islands, U.S.'],
358
+ ]);
359
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
297
360
 
298
361
  const cartTokenCookie = 'cart';
299
362
  const cartTokenTwoCookie = 'cart2';
@@ -294,7 +294,70 @@
294
294
  ['ZM', 'Zambia'],
295
295
  ['ZW', 'Zimbabwe'],
296
296
  ]);
297
- new Set(isoCountries.keys());
297
+ /**
298
+ * ISO-3166 US state ISO codes
299
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
300
+ * */
301
+ const usStates = new Map([
302
+ ['US-AL', 'Alabama'],
303
+ ['US-AK', 'Alaska'],
304
+ ['US-AZ', 'Arizona'],
305
+ ['US-AR', 'Arkansas'],
306
+ ['US-CA', 'California'],
307
+ ['US-CO', 'Colorado'],
308
+ ['US-CT', 'Connecticut'],
309
+ ['US-DE', 'Delaware'],
310
+ ['US-FL', 'Florida'],
311
+ ['US-GA', 'Georgia'],
312
+ ['US-HI', 'Hawaii'],
313
+ ['US-ID', 'Idaho'],
314
+ ['US-IL', 'Illinois'],
315
+ ['US-IN', 'Indiana'],
316
+ ['US-IA', 'Iowa'],
317
+ ['US-KS', 'Kansas'],
318
+ ['US-KY', 'Kentucky'],
319
+ ['US-LA', 'Louisiana'],
320
+ ['US-ME', 'Maine'],
321
+ ['US-MD', 'Maryland'],
322
+ ['US-MA', 'Massachusetts'],
323
+ ['US-MI', 'Michigan'],
324
+ ['US-MN', 'Minnesota'],
325
+ ['US-MS', 'Mississippi'],
326
+ ['US-MO', 'Missouri'],
327
+ ['US-MT', 'Montana'],
328
+ ['US-NE', 'Nebraska'],
329
+ ['US-NV', 'Nevada'],
330
+ ['US-NH', 'New Hampshire'],
331
+ ['US-NJ', 'New Jersey'],
332
+ ['US-NM', 'New Mexico'],
333
+ ['US-NY', 'New York'],
334
+ ['US-NC', 'North Carolina'],
335
+ ['US-ND', 'North Dakota'],
336
+ ['US-OH', 'Ohio'],
337
+ ['US-OK', 'Oklahoma'],
338
+ ['US-OR', 'Oregon'],
339
+ ['US-PA', 'Pennsylvania'],
340
+ ['US-RI', 'Rhode Island'],
341
+ ['US-SC', 'South Carolina'],
342
+ ['US-SD', 'South Dakota'],
343
+ ['US-TN', 'Tennessee'],
344
+ ['US-TX', 'Texas'],
345
+ ['US-UT', 'Utah'],
346
+ ['US-VT', 'Vermont'],
347
+ ['US-VA', 'Virginia'],
348
+ ['US-WA', 'Washington'],
349
+ ['US-WV', 'West Virginia'],
350
+ ['US-WI', 'Wisconsin'],
351
+ ['US-WY', 'Wyoming'],
352
+ ['US-DC', 'District of Columbia'],
353
+ ['US-AS', 'American Samoa'],
354
+ ['US-GU', 'Guam'],
355
+ ['US-MP', 'Northern Mariana Islands'],
356
+ ['US-PR', 'Puerto Rico'],
357
+ ['US-UM', 'United States Minor Outlying Islands'],
358
+ ['US-VI', 'Virgin Islands, U.S.'],
359
+ ]);
360
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
298
361
 
299
362
  const cartTokenCookie = 'cart';
300
363
  const cartTokenTwoCookie = 'cart2';
@@ -291,7 +291,70 @@ const isoCountries = new Map([
291
291
  ['ZM', 'Zambia'],
292
292
  ['ZW', 'Zimbabwe'],
293
293
  ]);
294
- new Set(isoCountries.keys());
294
+ /**
295
+ * ISO-3166 US state ISO codes
296
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
297
+ * */
298
+ const usStates = new Map([
299
+ ['US-AL', 'Alabama'],
300
+ ['US-AK', 'Alaska'],
301
+ ['US-AZ', 'Arizona'],
302
+ ['US-AR', 'Arkansas'],
303
+ ['US-CA', 'California'],
304
+ ['US-CO', 'Colorado'],
305
+ ['US-CT', 'Connecticut'],
306
+ ['US-DE', 'Delaware'],
307
+ ['US-FL', 'Florida'],
308
+ ['US-GA', 'Georgia'],
309
+ ['US-HI', 'Hawaii'],
310
+ ['US-ID', 'Idaho'],
311
+ ['US-IL', 'Illinois'],
312
+ ['US-IN', 'Indiana'],
313
+ ['US-IA', 'Iowa'],
314
+ ['US-KS', 'Kansas'],
315
+ ['US-KY', 'Kentucky'],
316
+ ['US-LA', 'Louisiana'],
317
+ ['US-ME', 'Maine'],
318
+ ['US-MD', 'Maryland'],
319
+ ['US-MA', 'Massachusetts'],
320
+ ['US-MI', 'Michigan'],
321
+ ['US-MN', 'Minnesota'],
322
+ ['US-MS', 'Mississippi'],
323
+ ['US-MO', 'Missouri'],
324
+ ['US-MT', 'Montana'],
325
+ ['US-NE', 'Nebraska'],
326
+ ['US-NV', 'Nevada'],
327
+ ['US-NH', 'New Hampshire'],
328
+ ['US-NJ', 'New Jersey'],
329
+ ['US-NM', 'New Mexico'],
330
+ ['US-NY', 'New York'],
331
+ ['US-NC', 'North Carolina'],
332
+ ['US-ND', 'North Dakota'],
333
+ ['US-OH', 'Ohio'],
334
+ ['US-OK', 'Oklahoma'],
335
+ ['US-OR', 'Oregon'],
336
+ ['US-PA', 'Pennsylvania'],
337
+ ['US-RI', 'Rhode Island'],
338
+ ['US-SC', 'South Carolina'],
339
+ ['US-SD', 'South Dakota'],
340
+ ['US-TN', 'Tennessee'],
341
+ ['US-TX', 'Texas'],
342
+ ['US-UT', 'Utah'],
343
+ ['US-VT', 'Vermont'],
344
+ ['US-VA', 'Virginia'],
345
+ ['US-WA', 'Washington'],
346
+ ['US-WV', 'West Virginia'],
347
+ ['US-WI', 'Wisconsin'],
348
+ ['US-WY', 'Wyoming'],
349
+ ['US-DC', 'District of Columbia'],
350
+ ['US-AS', 'American Samoa'],
351
+ ['US-GU', 'Guam'],
352
+ ['US-MP', 'Northern Mariana Islands'],
353
+ ['US-PR', 'Puerto Rico'],
354
+ ['US-UM', 'United States Minor Outlying Islands'],
355
+ ['US-VI', 'Virgin Islands, U.S.'],
356
+ ]);
357
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
295
358
 
296
359
  const cartTokenCookie = 'cart';
297
360
  const cartTokenTwoCookie = 'cart2';
package/ui.cjs.js CHANGED
@@ -413,7 +413,70 @@ const isoCountries = new Map([
413
413
  ['ZM', 'Zambia'],
414
414
  ['ZW', 'Zimbabwe'],
415
415
  ]);
416
- new Set(isoCountries.keys());
416
+ /**
417
+ * ISO-3166 US state ISO codes
418
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
419
+ * */
420
+ const usStates = new Map([
421
+ ['US-AL', 'Alabama'],
422
+ ['US-AK', 'Alaska'],
423
+ ['US-AZ', 'Arizona'],
424
+ ['US-AR', 'Arkansas'],
425
+ ['US-CA', 'California'],
426
+ ['US-CO', 'Colorado'],
427
+ ['US-CT', 'Connecticut'],
428
+ ['US-DE', 'Delaware'],
429
+ ['US-FL', 'Florida'],
430
+ ['US-GA', 'Georgia'],
431
+ ['US-HI', 'Hawaii'],
432
+ ['US-ID', 'Idaho'],
433
+ ['US-IL', 'Illinois'],
434
+ ['US-IN', 'Indiana'],
435
+ ['US-IA', 'Iowa'],
436
+ ['US-KS', 'Kansas'],
437
+ ['US-KY', 'Kentucky'],
438
+ ['US-LA', 'Louisiana'],
439
+ ['US-ME', 'Maine'],
440
+ ['US-MD', 'Maryland'],
441
+ ['US-MA', 'Massachusetts'],
442
+ ['US-MI', 'Michigan'],
443
+ ['US-MN', 'Minnesota'],
444
+ ['US-MS', 'Mississippi'],
445
+ ['US-MO', 'Missouri'],
446
+ ['US-MT', 'Montana'],
447
+ ['US-NE', 'Nebraska'],
448
+ ['US-NV', 'Nevada'],
449
+ ['US-NH', 'New Hampshire'],
450
+ ['US-NJ', 'New Jersey'],
451
+ ['US-NM', 'New Mexico'],
452
+ ['US-NY', 'New York'],
453
+ ['US-NC', 'North Carolina'],
454
+ ['US-ND', 'North Dakota'],
455
+ ['US-OH', 'Ohio'],
456
+ ['US-OK', 'Oklahoma'],
457
+ ['US-OR', 'Oregon'],
458
+ ['US-PA', 'Pennsylvania'],
459
+ ['US-RI', 'Rhode Island'],
460
+ ['US-SC', 'South Carolina'],
461
+ ['US-SD', 'South Dakota'],
462
+ ['US-TN', 'Tennessee'],
463
+ ['US-TX', 'Texas'],
464
+ ['US-UT', 'Utah'],
465
+ ['US-VT', 'Vermont'],
466
+ ['US-VA', 'Virginia'],
467
+ ['US-WA', 'Washington'],
468
+ ['US-WV', 'West Virginia'],
469
+ ['US-WI', 'Wisconsin'],
470
+ ['US-WY', 'Wyoming'],
471
+ ['US-DC', 'District of Columbia'],
472
+ ['US-AS', 'American Samoa'],
473
+ ['US-GU', 'Guam'],
474
+ ['US-MP', 'Northern Mariana Islands'],
475
+ ['US-PR', 'Puerto Rico'],
476
+ ['US-UM', 'United States Minor Outlying Islands'],
477
+ ['US-VI', 'Virgin Islands, U.S.'],
478
+ ]);
479
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
417
480
 
418
481
  const customAttributes = {
419
482
  '--bw-primary': { type: 'color', defaultValue: '#000000' },
package/ui.js CHANGED
@@ -414,7 +414,70 @@
414
414
  ['ZM', 'Zambia'],
415
415
  ['ZW', 'Zimbabwe'],
416
416
  ]);
417
- new Set(isoCountries.keys());
417
+ /**
418
+ * ISO-3166 US state ISO codes
419
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
420
+ * */
421
+ const usStates = new Map([
422
+ ['US-AL', 'Alabama'],
423
+ ['US-AK', 'Alaska'],
424
+ ['US-AZ', 'Arizona'],
425
+ ['US-AR', 'Arkansas'],
426
+ ['US-CA', 'California'],
427
+ ['US-CO', 'Colorado'],
428
+ ['US-CT', 'Connecticut'],
429
+ ['US-DE', 'Delaware'],
430
+ ['US-FL', 'Florida'],
431
+ ['US-GA', 'Georgia'],
432
+ ['US-HI', 'Hawaii'],
433
+ ['US-ID', 'Idaho'],
434
+ ['US-IL', 'Illinois'],
435
+ ['US-IN', 'Indiana'],
436
+ ['US-IA', 'Iowa'],
437
+ ['US-KS', 'Kansas'],
438
+ ['US-KY', 'Kentucky'],
439
+ ['US-LA', 'Louisiana'],
440
+ ['US-ME', 'Maine'],
441
+ ['US-MD', 'Maryland'],
442
+ ['US-MA', 'Massachusetts'],
443
+ ['US-MI', 'Michigan'],
444
+ ['US-MN', 'Minnesota'],
445
+ ['US-MS', 'Mississippi'],
446
+ ['US-MO', 'Missouri'],
447
+ ['US-MT', 'Montana'],
448
+ ['US-NE', 'Nebraska'],
449
+ ['US-NV', 'Nevada'],
450
+ ['US-NH', 'New Hampshire'],
451
+ ['US-NJ', 'New Jersey'],
452
+ ['US-NM', 'New Mexico'],
453
+ ['US-NY', 'New York'],
454
+ ['US-NC', 'North Carolina'],
455
+ ['US-ND', 'North Dakota'],
456
+ ['US-OH', 'Ohio'],
457
+ ['US-OK', 'Oklahoma'],
458
+ ['US-OR', 'Oregon'],
459
+ ['US-PA', 'Pennsylvania'],
460
+ ['US-RI', 'Rhode Island'],
461
+ ['US-SC', 'South Carolina'],
462
+ ['US-SD', 'South Dakota'],
463
+ ['US-TN', 'Tennessee'],
464
+ ['US-TX', 'Texas'],
465
+ ['US-UT', 'Utah'],
466
+ ['US-VT', 'Vermont'],
467
+ ['US-VA', 'Virginia'],
468
+ ['US-WA', 'Washington'],
469
+ ['US-WV', 'West Virginia'],
470
+ ['US-WI', 'Wisconsin'],
471
+ ['US-WY', 'Wyoming'],
472
+ ['US-DC', 'District of Columbia'],
473
+ ['US-AS', 'American Samoa'],
474
+ ['US-GU', 'Guam'],
475
+ ['US-MP', 'Northern Mariana Islands'],
476
+ ['US-PR', 'Puerto Rico'],
477
+ ['US-UM', 'United States Minor Outlying Islands'],
478
+ ['US-VI', 'Virgin Islands, U.S.'],
479
+ ]);
480
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
418
481
 
419
482
  const customAttributes = {
420
483
  '--bw-primary': { type: 'color', defaultValue: '#000000' },
package/ui.mjs CHANGED
@@ -411,7 +411,70 @@ const isoCountries = new Map([
411
411
  ['ZM', 'Zambia'],
412
412
  ['ZW', 'Zimbabwe'],
413
413
  ]);
414
- new Set(isoCountries.keys());
414
+ /**
415
+ * ISO-3166 US state ISO codes
416
+ * @see https://en.wikipedia.org/wiki/ISO_3166-2:US
417
+ * */
418
+ const usStates = new Map([
419
+ ['US-AL', 'Alabama'],
420
+ ['US-AK', 'Alaska'],
421
+ ['US-AZ', 'Arizona'],
422
+ ['US-AR', 'Arkansas'],
423
+ ['US-CA', 'California'],
424
+ ['US-CO', 'Colorado'],
425
+ ['US-CT', 'Connecticut'],
426
+ ['US-DE', 'Delaware'],
427
+ ['US-FL', 'Florida'],
428
+ ['US-GA', 'Georgia'],
429
+ ['US-HI', 'Hawaii'],
430
+ ['US-ID', 'Idaho'],
431
+ ['US-IL', 'Illinois'],
432
+ ['US-IN', 'Indiana'],
433
+ ['US-IA', 'Iowa'],
434
+ ['US-KS', 'Kansas'],
435
+ ['US-KY', 'Kentucky'],
436
+ ['US-LA', 'Louisiana'],
437
+ ['US-ME', 'Maine'],
438
+ ['US-MD', 'Maryland'],
439
+ ['US-MA', 'Massachusetts'],
440
+ ['US-MI', 'Michigan'],
441
+ ['US-MN', 'Minnesota'],
442
+ ['US-MS', 'Mississippi'],
443
+ ['US-MO', 'Missouri'],
444
+ ['US-MT', 'Montana'],
445
+ ['US-NE', 'Nebraska'],
446
+ ['US-NV', 'Nevada'],
447
+ ['US-NH', 'New Hampshire'],
448
+ ['US-NJ', 'New Jersey'],
449
+ ['US-NM', 'New Mexico'],
450
+ ['US-NY', 'New York'],
451
+ ['US-NC', 'North Carolina'],
452
+ ['US-ND', 'North Dakota'],
453
+ ['US-OH', 'Ohio'],
454
+ ['US-OK', 'Oklahoma'],
455
+ ['US-OR', 'Oregon'],
456
+ ['US-PA', 'Pennsylvania'],
457
+ ['US-RI', 'Rhode Island'],
458
+ ['US-SC', 'South Carolina'],
459
+ ['US-SD', 'South Dakota'],
460
+ ['US-TN', 'Tennessee'],
461
+ ['US-TX', 'Texas'],
462
+ ['US-UT', 'Utah'],
463
+ ['US-VT', 'Vermont'],
464
+ ['US-VA', 'Virginia'],
465
+ ['US-WA', 'Washington'],
466
+ ['US-WV', 'West Virginia'],
467
+ ['US-WI', 'Wisconsin'],
468
+ ['US-WY', 'Wyoming'],
469
+ ['US-DC', 'District of Columbia'],
470
+ ['US-AS', 'American Samoa'],
471
+ ['US-GU', 'Guam'],
472
+ ['US-MP', 'Northern Mariana Islands'],
473
+ ['US-PR', 'Puerto Rico'],
474
+ ['US-UM', 'United States Minor Outlying Islands'],
475
+ ['US-VI', 'Virgin Islands, U.S.'],
476
+ ]);
477
+ new Set([...isoCountries.keys(), ...usStates.keys()]);
415
478
 
416
479
  const customAttributes = {
417
480
  '--bw-primary': { type: 'color', defaultValue: '#000000' },