@goodgamestudios/cxf-webshop 7.1.0-qa.1 → 7.1.0-qa.3

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.
@@ -33,7 +33,7 @@
33
33
  var define_process_default;
34
34
  var init_define_process = __esm({
35
35
  "<define:process>"() {
36
- define_process_default = { env: { BASE_URL: "http://localhost:1101", CANVAS_AGENT_URL: "https://app-dev.canvas.stillfront.com/agent.js", CANVAS_APP_ID_BY_GAME: { "12": "dae760ab-b773-4c1a-ae99-7633f12ec7d5", "15": "d57bb239-6e02-4e17-8148-0a10c4dd75f6", "16": "18f5521d-7df2-4bb3-88a3-c162ba072d73" }, CUSTOMIZATION_URL_TEMPLATE: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@{1}/dist/goodgamestudios-{0}.json", CUSTOMIZATION_URL: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@qa/dist/goodgamestudios-{0}.json" } };
36
+ define_process_default = { env: { BASE_URL: { "12": "https://ef-canvas-test.public.ggs-ep.com", "15": "https://canvas-test.goodgamestudios.com", "16": "https://ef-canvas-test.public.ggs-ep.com", default: "https://canvas-test.goodgamestudios.com" }, CANVAS_AGENT_URL: "https://app-test.canvas.stillfront.com/agent.js", CANVAS_APP_ID_BY_GAME: { "12": "81199abb-592e-465c-b926-8656628a64c7", "15": { google: "25facd0c-e850-4ebf-b6c4-8c60240e4cf8", stillpay: "bec451f9-8db4-4ca1-8a5a-54494429ff5e" }, "16": "18f5521d-7df2-4bb3-88a3-c162ba072d73" }, CUSTOMIZATION_URL_TEMPLATE: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@{1}/dist/goodgamestudios-{0}.json", CUSTOMIZATION_URL: "https://cdn.jsdelivr.net/npm/@lemonstand.org/config-goodgamestudios@qa/dist/goodgamestudios-{0}.json" } };
37
37
  }
38
38
  });
39
39
 
@@ -622,52 +622,89 @@
622
622
  // src/fetch.ts
623
623
  init_define_process();
624
624
 
625
- // src/helpers.ts
625
+ // src/store.ts
626
626
  init_define_process();
627
+ function initializeStore(cxf) {
628
+ return {
629
+ isCanvas: false,
630
+ playerId: cxf.playerId,
631
+ instanceId: cxf.instanceId,
632
+ networkId: cxf.networkId,
633
+ gameId: cxf.gameId,
634
+ gameApi: cxf.gameApi,
635
+ language: cxf.language,
636
+ token: cxf.token,
637
+ zoneId: cxf.zoneId,
638
+ gameEvents: [],
639
+ xp: 0,
640
+ level: 0,
641
+ legendLevel: void 0,
642
+ countryCode: "",
643
+ lastPurchaseTab: "",
644
+ subscriptionDisabled: false,
645
+ isTempServer: false,
646
+ customizationSuffix: "",
647
+ resolvedCustomizationUrl: "",
648
+ sourceId: "unknown",
649
+ unreadOfferNotifsCountUrl: ""
650
+ };
651
+ }
652
+ function criteriaSelector({ legendLevel, level }) {
653
+ return {
654
+ legendLevel,
655
+ level
656
+ };
657
+ }
627
658
 
628
- // node_modules/@lukeed/uuid/dist/index.mjs
659
+ // src/utils/index.ts
629
660
  init_define_process();
630
- var IDX = 256;
631
- var HEX = [];
632
- var BUFFER;
633
- while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
634
- function v4() {
635
- var i = 0, num, out = "";
636
- if (!BUFFER || IDX + 16 > 256) {
637
- BUFFER = Array(i = 256);
638
- while (i--) BUFFER[i] = 256 * Math.random() | 0;
639
- i = IDX = 0;
661
+
662
+ // src/utils/domain.ts
663
+ init_define_process();
664
+ var parentDomain = (referrer) => {
665
+ const matches = referrer.match(/^https?:\/\/([^#/?]+)(?:[#/?]|$)/i);
666
+ if (!matches || !matches[1]) {
667
+ return;
640
668
  }
641
- for (; i < 16; i++) {
642
- num = BUFFER[IDX + i];
643
- if (i == 6) out += HEX[num & 15 | 64];
644
- else if (i == 8) out += HEX[num & 63 | 128];
645
- else out += HEX[num];
646
- if (i & 1 && i > 1 && i < 11) out += "-";
669
+ const result = matches[1].match(/[^.]+\.[^.]+$/);
670
+ if (!result) {
671
+ return;
647
672
  }
648
- IDX++;
649
- return out;
650
- }
673
+ return result[0];
674
+ };
675
+ var getDomain = (referrer) => {
676
+ return parentDomain(referrer);
677
+ };
651
678
 
652
- // src/helpers.ts
653
- var import_debug = __toESM(require_browser());
679
+ // src/utils/error-handling.ts
680
+ init_define_process();
654
681
 
655
- // src/ArgumentNullError.ts
682
+ // src/utils/logging.ts
656
683
  init_define_process();
657
- var ArgumentNullError = class extends Error {
658
- constructor(parameterName, parameterValue) {
659
- super(`${parameterName} has null value: ${parameterValue}`);
660
- this.name = "ArgumentNullError";
684
+ var import_debug = __toESM(require_browser());
685
+ var logger = (0, import_debug.default)("CXF-WEBSHOP");
686
+ var log = (argument0, ...rest) => logger(argument0, ...rest);
687
+ var logError = (...arguments_) => (
688
+ // tslint:disable-next-line:no-console
689
+ console.error("%c CXF-WEBSHOP ->", "background: #ff0000; color: #fff", ...arguments_)
690
+ );
691
+
692
+ // src/utils/error-handling.ts
693
+ var tryCatch = (fn) => (...args) => {
694
+ try {
695
+ return fn(...args);
696
+ } catch (error) {
697
+ logError(error);
698
+ throwCxfError(error);
661
699
  }
662
700
  };
701
+ var throwCxfError = (e) => {
702
+ const config = globalState.getConfig();
703
+ const cxf = globalState.getCxf();
704
+ cxf.emit(config.CXF_ERROR, e);
705
+ };
663
706
 
664
- // src/types/models.ts
665
- init_define_process();
666
- function encodeGnip({ gameId, networkId, instanceId, playerId }) {
667
- return [gameId, networkId, instanceId, playerId].join("-");
668
- }
669
-
670
- // src/utils.ts
707
+ // src/utils/loaders.ts
671
708
  init_define_process();
672
709
  var startTimer = (function_, time) => {
673
710
  const id = setTimeout(function_, time);
@@ -684,62 +721,6 @@
684
721
  }).catch(reject);
685
722
  });
686
723
  };
687
- var validateForNull = (properties) => {
688
- for (const key of Object.keys(properties)) {
689
- const value = properties[key];
690
- if (value === void 0 || value === null || Number.isNaN(value)) {
691
- throw new ArgumentNullError(key, value);
692
- }
693
- }
694
- };
695
- function msToSec(value) {
696
- return Math.floor(value / 1e3);
697
- }
698
- var parentDomain = (referrer) => {
699
- const matches = referrer.match(/^https?:\/\/([^#/?]+)(?:[#/?]|$)/i);
700
- if (!matches || !matches[1]) {
701
- return;
702
- }
703
- const result = matches[1].match(/[^.]+\.[^.]+$/);
704
- if (!result) {
705
- return;
706
- }
707
- return result[0];
708
- };
709
-
710
- // src/helpers.ts
711
- var detectPlatform = (defaultPlatform = "stillpay") => {
712
- const nativePlatform = navigator.userAgent.match(
713
- /(itunes)|(googleplay)|(Android)|(amazonmobile)|(facebook)|(samsung)|(huawei)/g
714
- );
715
- if (!nativePlatform) return defaultPlatform;
716
- const activePlatform = nativePlatform[0];
717
- const distribPlatforms = {
718
- itunes: "apple",
719
- Android: "google",
720
- googleplay: "google",
721
- amazonmobile: "amazon",
722
- facebook: "facebook",
723
- samsung: "samsung",
724
- huawei: "huawei"
725
- };
726
- return Object.prototype.hasOwnProperty.call(distribPlatforms, activePlatform) ? distribPlatforms[activePlatform] : defaultPlatform;
727
- };
728
- function formatQueryString(object) {
729
- return Object.entries(object).filter(([key, value]) => value !== null && value !== void 0).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join("&");
730
- }
731
- var getTokenAndLanguage = (store) => {
732
- const { playerId, token, zoneId, language } = store;
733
- if (!playerId) {
734
- throw new ArgumentNullError("playerId", playerId);
735
- }
736
- return {
737
- token,
738
- zoneId,
739
- locale: language,
740
- ping: encodeGnip({ ...store, playerId })
741
- };
742
- };
743
724
  var loadScript = (src) => new Promise((resolve, reject) => {
744
725
  const script = document.createElement("script");
745
726
  script.type = "text/javascript";
@@ -750,36 +731,10 @@
750
731
  script.addEventListener("error", reject);
751
732
  document.body.append(script);
752
733
  });
753
- var tryCatch = (fn) => (...args) => {
754
- try {
755
- return fn(...args);
756
- } catch (error) {
757
- logError(error);
758
- throwCxfError(error);
759
- }
760
- };
761
- var throwCxfError = (e) => {
762
- const config = globalState.getConfig();
763
- const cxf = globalState.getCxf();
764
- cxf.emit(config.CXF_ERROR, e);
765
- };
766
734
  var loadCxf = timeout(() => require_dist(), 1e4);
767
- var logger = (0, import_debug.default)("CXF-WEBSHOP");
768
- var log = (argument0, ...rest) => logger(argument0, ...rest);
769
- var logError = (...arguments_) => (
770
- // tslint:disable-next-line:no-console
771
- console.error("%c CXF-WEBSHOP ->", "background: #ff0000; color: #fff", ...arguments_)
772
- );
773
- var createSessionId = () => v4();
774
- var getDomain = (referrer) => {
775
- return parentDomain(referrer);
776
- };
777
- var ggsGetQueryParams = () => {
778
- return ggsGetQueryParameters();
779
- };
780
- var ggsGetReferrerValue = () => {
781
- return ggsGetReferrer();
782
- };
735
+
736
+ // src/utils/payment.ts
737
+ init_define_process();
783
738
  var transformPaymentContractIdsToNativePriceEvent = (ids) => (
784
739
  // eslint-disable-next-line unicorn/no-array-reduce
785
740
  ids.reduce(
@@ -802,93 +757,205 @@
802
757
  )
803
758
  );
804
759
 
805
- // src/store.ts
760
+ // src/utils/platform.ts
806
761
  init_define_process();
807
- function initializeStore(cxf) {
762
+ var userAgentToDistribPlatformMatrix = {
763
+ itunes: "apple",
764
+ Android: "google",
765
+ googleplay: "google",
766
+ amazonmobile: "amazon",
767
+ facebook: "facebook",
768
+ samsung: "samsung",
769
+ huawei: "huawei"
770
+ };
771
+ var detectPlatform = (defaultPlatform = "stillpay") => {
772
+ const nativePlatform = navigator.userAgent.match(
773
+ /(itunes)|(googleplay)|(Android)|(amazonmobile)|(facebook)|(samsung)|(huawei)/g
774
+ );
775
+ if (!nativePlatform) return defaultPlatform;
776
+ const activePlatform = nativePlatform[0];
777
+ return Object.prototype.hasOwnProperty.call(userAgentToDistribPlatformMatrix, activePlatform) ? userAgentToDistribPlatformMatrix[activePlatform] : defaultPlatform;
778
+ };
779
+ var distribPlatformToProviderMatrix = {
780
+ apple: "itunes",
781
+ google: "googleplay",
782
+ amazon: "amazonmobile",
783
+ facebook: "facebook",
784
+ samsung: "samsung",
785
+ huawei: "huawei"
786
+ };
787
+ var createProductIdsForPlatform = (platform, id) => {
788
+ if (!Object.prototype.hasOwnProperty.call(distribPlatformToProviderMatrix, platform))
789
+ throw new Error(`Platform ${platform} is not supported`);
790
+ const res = /* @__PURE__ */ Object.create(null);
791
+ res[distribPlatformToProviderMatrix[platform]] = id;
792
+ return res;
793
+ };
794
+
795
+ // src/utils/query-params.ts
796
+ init_define_process();
797
+ function formatQueryString(object) {
798
+ return Object.entries(object).filter(([key, value]) => value !== null && value !== void 0).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join("&");
799
+ }
800
+ var ggsGetQueryParams = () => {
801
+ return ggsGetQueryParameters();
802
+ };
803
+ var ggsGetReferrerValue = () => {
804
+ return ggsGetReferrer();
805
+ };
806
+
807
+ // src/utils/session.ts
808
+ init_define_process();
809
+
810
+ // node_modules/@lukeed/uuid/dist/index.mjs
811
+ init_define_process();
812
+ var IDX = 256;
813
+ var HEX = [];
814
+ var BUFFER;
815
+ while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
816
+ function v4() {
817
+ var i = 0, num, out = "";
818
+ if (!BUFFER || IDX + 16 > 256) {
819
+ BUFFER = Array(i = 256);
820
+ while (i--) BUFFER[i] = 256 * Math.random() | 0;
821
+ i = IDX = 0;
822
+ }
823
+ for (; i < 16; i++) {
824
+ num = BUFFER[IDX + i];
825
+ if (i == 6) out += HEX[num & 15 | 64];
826
+ else if (i == 8) out += HEX[num & 63 | 128];
827
+ else out += HEX[num];
828
+ if (i & 1 && i > 1 && i < 11) out += "-";
829
+ }
830
+ IDX++;
831
+ return out;
832
+ }
833
+
834
+ // src/ArgumentNullError.ts
835
+ init_define_process();
836
+ var ArgumentNullError = class extends Error {
837
+ constructor(parameterName, parameterValue) {
838
+ super(`${parameterName} has null value: ${parameterValue}`);
839
+ this.name = "ArgumentNullError";
840
+ }
841
+ };
842
+
843
+ // src/types/models.ts
844
+ init_define_process();
845
+ function encodeGnip({ gameId, networkId, instanceId, playerId }) {
846
+ return [gameId, networkId, instanceId, playerId].join("-");
847
+ }
848
+
849
+ // src/utils/session.ts
850
+ var createSessionId = () => v4();
851
+ var getTokenAndLanguage = (store) => {
852
+ const { playerId, token, zoneId, language } = store;
853
+ if (!playerId) {
854
+ throw new ArgumentNullError("playerId", playerId);
855
+ }
808
856
  return {
809
- isCanvas: false,
810
- playerId: cxf.playerId,
811
- instanceId: cxf.instanceId,
812
- networkId: cxf.networkId,
813
- gameId: cxf.gameId,
814
- gameApi: cxf.gameApi,
815
- language: cxf.language,
816
- token: cxf.token,
817
- zoneId: cxf.zoneId,
818
- gameEvents: [],
819
- xp: 0,
820
- level: 0,
821
- legendLevel: void 0,
822
- countryCode: "",
823
- lastPurchaseTab: "",
824
- subscriptionDisabled: false,
825
- isTempServer: false,
826
- customizationSuffix: "",
827
- resolvedCustomizationUrl: "",
828
- sourceId: "unknown",
829
- unreadOfferNotifsCountUrl: ""
857
+ token,
858
+ zoneId,
859
+ locale: language,
860
+ ping: encodeGnip({ ...store, playerId })
830
861
  };
862
+ };
863
+
864
+ // src/utils/time.ts
865
+ init_define_process();
866
+ function msToSec(value) {
867
+ return Math.floor(value / 1e3);
831
868
  }
832
- function criteriaSelector({ legendLevel, level }) {
869
+
870
+ // src/utils/url.ts
871
+ init_define_process();
872
+ var import_game_alias = __toESM(require_dist2());
873
+
874
+ // src/config.ts
875
+ init_define_process();
876
+ var import_cxf_events = __toESM(require_typings());
877
+
878
+ // src/types/index.ts
879
+ init_define_process();
880
+
881
+ // src/types/config.ts
882
+ init_define_process();
883
+
884
+ // src/types/store.ts
885
+ init_define_process();
886
+ var entityProvider = (initial) => {
887
+ let element = initial;
833
888
  return {
834
- legendLevel,
835
- level
889
+ get: () => element,
890
+ set: (value) => {
891
+ element = value;
892
+ }
836
893
  };
837
- }
894
+ };
838
895
 
839
- // src/fetch.ts
840
- var fetchUnreadOfferNotificationsCount = async () => {
841
- const config = globalState.getConfig();
842
- const store = globalState.getStore();
843
- if (config.LEGEND_LEVEL_IS_USED && store.legendLevel === void 0) {
844
- log("Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined");
845
- return;
846
- }
847
- if (!store.isCanvas && store.token && store.unreadOfferNotifsCountUrl) {
848
- log("fetchUnreadOfferNotificationsCount");
849
- let unreadCount = 0;
850
- const headers = {
851
- Authorization: `Bearer ${store.token}`
852
- };
853
- const url = store.unreadOfferNotifsCountUrl.replace("{locale}", store.language || "").replace("{zoneId}", store.zoneId || "").replace("{criteria}", encodeURIComponent(JSON.stringify(criteriaSelector(store))));
896
+ // src/config.ts
897
+ var parseBaseUrl = (value) => {
898
+ if (typeof value === "string") {
854
899
  try {
855
- log("fetch", url);
856
- const resp = await fetch(url, {
857
- headers
858
- });
859
- if (resp.ok) {
860
- const data = await resp.json();
861
- unreadCount = Number(data?.notifCount);
862
- }
863
- } catch (error) {
864
- logError(`cannot fetch ${url}`, error);
900
+ return JSON.parse(value);
901
+ } catch {
902
+ return { default: value };
865
903
  }
866
- log("setUnseenOffersCounter", unreadCount);
867
- store.gameApi.invokeFn("setUnseenOffersCounter", unreadCount).catch((error) => {
868
- logError("setUnseenOffersCounter error:", error);
869
- });
870
904
  }
905
+ return value || { default: "" };
906
+ };
907
+ var COMMON_CONFIG = {
908
+ CANVAS_AGENT_URL: define_process_default.env.CANVAS_AGENT_URL,
909
+ CANVAS_APP_ID_BY_GAME: define_process_default.env.CANVAS_APP_ID_BY_GAME,
910
+ CUSTOMIZATION_URL: define_process_default.env.CUSTOMIZATION_URL,
911
+ CUSTOMIZATION_URL_TEMPLATE: define_process_default.env.CUSTOMIZATION_URL_TEMPLATE,
912
+ BASE_URL: parseBaseUrl(define_process_default.env.BASE_URL),
913
+ CXF_DIALOG_OPEN: "cxf.dialog.open",
914
+ CXF_DIALOG_CLOSE: "cxf.dialog.close",
915
+ CXF_TRACK_MSG: "cxf.tracking.message",
916
+ CXF_BTN_CLICK_MSG: import_cxf_events.CxfEvents.OpenIGS,
917
+ CXF_OPEN_SALES_MSG: "cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */,
918
+ WEB_SHOP_CALL_TRACK_ID: 1181,
919
+ CXF_ERROR: "cxf.error",
920
+ CXF_PUSH: "cxf.push",
921
+ CXF_AD_STATUS: "cxf.adBanner.status"
922
+ };
923
+ var GAME_SPECIFIC_CONFIG = {
924
+ 12: {
925
+ LEGEND_LEVEL_IS_USED: true
926
+ },
927
+ 15: {
928
+ LEGEND_LEVEL_IS_USED: false
929
+ },
930
+ 16: {
931
+ LEGEND_LEVEL_IS_USED: true
932
+ }
933
+ };
934
+ var createConfig = (gameId) => {
935
+ return {
936
+ ...COMMON_CONFIG,
937
+ ...GAME_SPECIFIC_CONFIG[gameId]
938
+ };
939
+ };
940
+ var getBaseUrlForGame = (gameId) => {
941
+ const baseUrl = COMMON_CONFIG.BASE_URL;
942
+ const gameIdKey = String(gameId);
943
+ return baseUrl[gameIdKey] || baseUrl.default || "";
871
944
  };
872
945
 
873
- // src/messages/ShopMessageBus.ts
946
+ // src/utils/validation.ts
874
947
  init_define_process();
875
- var ShopMessageBus = class {
876
- post(message) {
877
- const element = document.querySelector("#dialog");
878
- if (element && element.tagName.toLocaleLowerCase() === "iframe") {
879
- element.contentWindow?.postMessage(message, "*");
948
+ var validateForNull = (properties) => {
949
+ for (const key of Object.keys(properties)) {
950
+ const value = properties[key];
951
+ if (value === void 0 || value === null || Number.isNaN(value)) {
952
+ throw new ArgumentNullError(key, value);
880
953
  }
881
954
  }
882
955
  };
883
956
 
884
- // src/preFetch.ts
885
- init_define_process();
886
-
887
- // src/url.ts
888
- init_define_process();
889
- var import_game_alias = __toESM(require_dist2());
957
+ // src/utils/url.ts
890
958
  var createIframeUrl = ({ page, route, sid, config: igsConfig = {} }) => {
891
- const config = globalState.getConfig();
892
959
  const store = globalState.getStore();
893
960
  const { token, zoneId, locale } = getTokenAndLanguage(store);
894
961
  const parameters = {
@@ -917,7 +984,8 @@
917
984
  if (store.adStatus?.areBannersAvailable) {
918
985
  queryParameters.ads = true;
919
986
  }
920
- return `${config.BASE_URL}/?${formatQueryString(queryParameters)}${page ? `#${page}` : ""}${route ? `--${route}--${Date.now()}` : ""}`;
987
+ const baseUrl = getBaseUrlForGame(store.gameId);
988
+ return `${baseUrl}/?${formatQueryString(queryParameters)}${page ? `#${page}` : ""}${route ? `--${route}--${Date.now()}` : ""}`;
921
989
  };
922
990
  var createCustomizationUrl = () => {
923
991
  const config = globalState.getConfig();
@@ -935,7 +1003,53 @@
935
1003
  return config.CUSTOMIZATION_URL.replace("{0}", configBranch);
936
1004
  };
937
1005
 
1006
+ // src/fetch.ts
1007
+ var fetchUnreadOfferNotificationsCount = async () => {
1008
+ const config = globalState.getConfig();
1009
+ const store = globalState.getStore();
1010
+ if (config.LEGEND_LEVEL_IS_USED && store.legendLevel === void 0) {
1011
+ log("Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined");
1012
+ return;
1013
+ }
1014
+ if (!store.isCanvas && store.token && store.unreadOfferNotifsCountUrl) {
1015
+ log("fetchUnreadOfferNotificationsCount");
1016
+ let unreadCount = 0;
1017
+ const headers = {
1018
+ Authorization: `Bearer ${store.token}`
1019
+ };
1020
+ const url = store.unreadOfferNotifsCountUrl.replace("{locale}", store.language || "").replace("{zoneId}", store.zoneId || "").replace("{criteria}", encodeURIComponent(JSON.stringify(criteriaSelector(store))));
1021
+ try {
1022
+ log("fetch", url);
1023
+ const resp = await fetch(url, {
1024
+ headers
1025
+ });
1026
+ if (resp.ok) {
1027
+ const data = await resp.json();
1028
+ unreadCount = Number(data?.notifCount);
1029
+ }
1030
+ } catch (error) {
1031
+ logError(`cannot fetch ${url}`, error);
1032
+ }
1033
+ log("setUnseenOffersCounter", unreadCount);
1034
+ store.gameApi.invokeFn("setUnseenOffersCounter", unreadCount).catch((error) => {
1035
+ logError("setUnseenOffersCounter error:", error);
1036
+ });
1037
+ }
1038
+ };
1039
+
1040
+ // src/messages/ShopMessageBus.ts
1041
+ init_define_process();
1042
+ var ShopMessageBus = class {
1043
+ post(message) {
1044
+ const element = document.querySelector("#dialog");
1045
+ if (element && element.tagName.toLocaleLowerCase() === "iframe") {
1046
+ element.contentWindow?.postMessage(message, "*");
1047
+ }
1048
+ }
1049
+ };
1050
+
938
1051
  // src/preFetch.ts
1052
+ init_define_process();
939
1053
  var preResolveConfig = () => {
940
1054
  if (typeof fetch !== "function") {
941
1055
  return;
@@ -961,18 +1075,6 @@
961
1075
  });
962
1076
  };
963
1077
 
964
- // src/types/store.ts
965
- init_define_process();
966
- var entityProvider = (initial) => {
967
- let element = initial;
968
- return {
969
- get: () => element,
970
- set: (value) => {
971
- element = value;
972
- }
973
- };
974
- };
975
-
976
1078
  // src/globalState.ts
977
1079
  var GlobalState = class {
978
1080
  constructor() {
@@ -1025,7 +1127,7 @@
1025
1127
 
1026
1128
  // src/handlers/cxfEventHandlers.ts
1027
1129
  init_define_process();
1028
- var import_cxf_events = __toESM(require_typings());
1130
+ var import_cxf_events2 = __toESM(require_typings());
1029
1131
 
1030
1132
  // src/dialog.ts
1031
1133
  init_define_process();
@@ -1064,27 +1166,9 @@
1064
1166
  cxf.emit(config.CXF_TRACK_MSG, payload);
1065
1167
  };
1066
1168
 
1067
- // src/types/index.ts
1068
- init_define_process();
1069
-
1070
- // src/types/config.ts
1071
- init_define_process();
1072
-
1073
1169
  // src/whitelist.ts
1074
1170
  init_define_process();
1075
- var whitelistedZones = /* @__PURE__ */ new Set([
1076
- // 264, Poland
1077
- 316,
1078
- 318,
1079
- 460,
1080
- 461,
1081
- 767,
1082
- 768,
1083
- 802,
1084
- 814,
1085
- 830,
1086
- 877
1087
- ]);
1171
+ var whitelistedZones = /* @__PURE__ */ new Set([218, 316, 318, 460, 461, 768, 802, 814, 830, 877]);
1088
1172
 
1089
1173
  // src/handlers/pushHandlers.ts
1090
1174
  init_define_process();
@@ -1167,7 +1251,7 @@
1167
1251
  break;
1168
1252
  }
1169
1253
  case "native_checkout_request" /* NATIVE_CHECKOUT_REQUEST */: {
1170
- const { paymentContract, sessionId, collectionAlias, offerId } = event;
1254
+ const { paymentContract, sessionId, offerId, distributionPlatform } = event;
1171
1255
  const { zoneId } = globalState.getStore();
1172
1256
  window.postMessage(
1173
1257
  {
@@ -1177,16 +1261,16 @@
1177
1261
  pkg: {
1178
1262
  price: paymentContract?.price?.amount,
1179
1263
  productIdMS: "",
1180
- productIds: { googleplay: paymentContract?.id },
1264
+ productIds: createProductIdsForPlatform(distributionPlatform, paymentContract?.id),
1181
1265
  tier: Number(paymentContract?.id?.split("_")?.at(-1))
1182
1266
  },
1183
- // !sid || !type || !zoneId || !offerId || !successUrl || !criteria
1184
1267
  meta: {
1185
- criteria: JSON.stringify({}),
1268
+ criteria: window.CanvasAgent?.instance?.getState()?.appConfig?.canvasAppId,
1186
1269
  lemonstand: true,
1187
1270
  offerId,
1188
1271
  sid: sessionId,
1189
- type: collectionAlias,
1272
+ type: "canvas",
1273
+ // IMPORTANT: type must be 'canvas'
1190
1274
  zoneId,
1191
1275
  successUrl: window.location.href
1192
1276
  }
@@ -1203,7 +1287,7 @@
1203
1287
  }
1204
1288
  };
1205
1289
  var onOpen = (payload = {}) => {
1206
- log(import_cxf_events.CxfEvents.OpenIGS, "payload:", payload);
1290
+ log(import_cxf_events2.CxfEvents.OpenIGS, "payload:", payload);
1207
1291
  if (payload.sourceId) {
1208
1292
  globalState.updateStore({
1209
1293
  sourceId: payload.sourceId
@@ -1231,18 +1315,18 @@
1231
1315
  };
1232
1316
  var subscribeToCommonCxfEvents = (cxf) => {
1233
1317
  const pushHandlers = createPushHandlers();
1234
- cxf.on(import_cxf_events.CxfEvents.OpenIGS, tryCatch(onOpen));
1318
+ cxf.on(import_cxf_events2.CxfEvents.OpenIGS, tryCatch(onOpen));
1235
1319
  cxf.on(
1236
- import_cxf_events.CxfEvents.Push,
1320
+ import_cxf_events2.CxfEvents.Push,
1237
1321
  tryCatch(({ id, payload }) => {
1238
- log(import_cxf_events.CxfEvents.Push, id, payload);
1322
+ log(import_cxf_events2.CxfEvents.Push, id, payload);
1239
1323
  const handler = pushHandlers[id];
1240
1324
  handler && handler(payload);
1241
1325
  })
1242
1326
  );
1243
1327
  };
1244
1328
  var subscribeToGameEvents = (cxf) => {
1245
- cxf.on(import_cxf_events.CxfEvents.Login, (e) => {
1329
+ cxf.on(import_cxf_events2.CxfEvents.Login, (e) => {
1246
1330
  const { gameEvents: eventsInLogin, language, token, zoneId } = e;
1247
1331
  if (whitelistedZones.has(Number(zoneId)) && (Number(zoneId) > 300 || localStorage.getItem("cxf_canvas") === "enabled")) {
1248
1332
  globalState.updateStore({
@@ -1255,7 +1339,7 @@
1255
1339
  ...e,
1256
1340
  gameEvents: [...gameEvents.filter(eventNotExistPredicateGenerator(eventsInLogin)), ...eventsInLogin]
1257
1341
  });
1258
- log(import_cxf_events.CxfEvents.Login, globalState.getStore());
1342
+ log(import_cxf_events2.CxfEvents.Login, globalState.getStore());
1259
1343
  if (!isCanvas) {
1260
1344
  globalState.fetchUnreadOfferNotificationsCount();
1261
1345
  return;
@@ -1264,7 +1348,11 @@
1264
1348
  const { CANVAS_APP_ID_BY_GAME } = globalState.getConfig();
1265
1349
  const platform = detectPlatform();
1266
1350
  const canvasApps = CANVAS_APP_ID_BY_GAME[cxf.gameId];
1267
- const canvasAppId = typeof canvasApps === "string" ? canvasApps : canvasApps?.[platform];
1351
+ const canvasAppId = typeof canvasApps === "string" ? canvasApps : canvasApps[platform];
1352
+ if (!canvasAppId) {
1353
+ logError("Canvas app id not found for platform", { platform, canvasApps });
1354
+ return;
1355
+ }
1268
1356
  window.CanvasAgent.create({
1269
1357
  authClientId: "lemonstand",
1270
1358
  canvasAppId,
@@ -1273,14 +1361,14 @@
1273
1361
  token
1274
1362
  }).then((res) => {
1275
1363
  window.CanvasAgent.instance = res;
1276
- log(import_cxf_events.CxfEvents.Login, "Canvas created");
1364
+ log(import_cxf_events2.CxfEvents.Login, "Canvas created");
1277
1365
  }).catch((error) => {
1278
1366
  logError("Cannot create instance of Canvas", error);
1279
1367
  });
1280
1368
  }
1281
1369
  });
1282
- cxf.on(import_cxf_events.CxfEvents.GameEventUpdate, (e) => {
1283
- log(import_cxf_events.CxfEvents.GameEventUpdate, e);
1370
+ cxf.on(import_cxf_events2.CxfEvents.GameEventUpdate, (e) => {
1371
+ log(import_cxf_events2.CxfEvents.GameEventUpdate, e);
1284
1372
  const { gameEvents, isCanvas } = globalState.getStore();
1285
1373
  const updatedEventTypes = new Set(e.map((event) => event.type));
1286
1374
  globalState.updateStore({
@@ -1289,10 +1377,10 @@
1289
1377
  if (isCanvas) {
1290
1378
  window.CanvasAgent?.instance?.refresh();
1291
1379
  }
1292
- log(import_cxf_events.CxfEvents.GameEventUpdate, "reducer", globalState.getStore());
1380
+ log(import_cxf_events2.CxfEvents.GameEventUpdate, "reducer", globalState.getStore());
1293
1381
  });
1294
- cxf.on(import_cxf_events.CxfEvents.GameEventAdd, (e) => {
1295
- log(import_cxf_events.CxfEvents.GameEventAdd, e);
1382
+ cxf.on(import_cxf_events2.CxfEvents.GameEventAdd, (e) => {
1383
+ log(import_cxf_events2.CxfEvents.GameEventAdd, e);
1296
1384
  const { gameEvents, isCanvas } = globalState.getStore();
1297
1385
  globalState.updateStore({
1298
1386
  gameEvents: [...gameEvents, e]
@@ -1300,10 +1388,10 @@
1300
1388
  if (isCanvas) {
1301
1389
  window.CanvasAgent?.instance?.refresh();
1302
1390
  }
1303
- log(import_cxf_events.CxfEvents.GameEventAdd, "reducer", globalState.getStore());
1391
+ log(import_cxf_events2.CxfEvents.GameEventAdd, "reducer", globalState.getStore());
1304
1392
  });
1305
- cxf.on(import_cxf_events.CxfEvents.GameEventRemove, (e) => {
1306
- log(import_cxf_events.CxfEvents.GameEventRemove, e);
1393
+ cxf.on(import_cxf_events2.CxfEvents.GameEventRemove, (e) => {
1394
+ log(import_cxf_events2.CxfEvents.GameEventRemove, e);
1307
1395
  const { gameEvents, isCanvas } = globalState.getStore();
1308
1396
  globalState.updateStore({
1309
1397
  gameEvents: gameEvents.filter(({ type }) => type !== e)
@@ -1311,28 +1399,28 @@
1311
1399
  if (isCanvas) {
1312
1400
  window.CanvasAgent?.instance?.refresh();
1313
1401
  }
1314
- log(import_cxf_events.CxfEvents.GameEventRemove, "reducer", globalState.getStore());
1402
+ log(import_cxf_events2.CxfEvents.GameEventRemove, "reducer", globalState.getStore());
1315
1403
  });
1316
- cxf.on(import_cxf_events.CxfEvents.LevelChanged, (level) => {
1317
- log(import_cxf_events.CxfEvents.LevelChanged, level);
1404
+ cxf.on(import_cxf_events2.CxfEvents.LevelChanged, (level) => {
1405
+ log(import_cxf_events2.CxfEvents.LevelChanged, level);
1318
1406
  const { isCanvas } = globalState.getStore();
1319
1407
  globalState.updateStore({
1320
1408
  level
1321
1409
  });
1322
- log(import_cxf_events.CxfEvents.LevelChanged, "reducer", globalState.getStore());
1410
+ log(import_cxf_events2.CxfEvents.LevelChanged, "reducer", globalState.getStore());
1323
1411
  if (isCanvas) {
1324
1412
  window.CanvasAgent?.instance?.refresh();
1325
1413
  } else {
1326
1414
  globalState.fetchUnreadOfferNotificationsCount();
1327
1415
  }
1328
1416
  });
1329
- cxf.on(import_cxf_events.CxfEvents.LegendLevelChanged, (legendLevel) => {
1330
- log(import_cxf_events.CxfEvents.LegendLevelChanged, `legendLevel: ${legendLevel}`);
1417
+ cxf.on(import_cxf_events2.CxfEvents.LegendLevelChanged, (legendLevel) => {
1418
+ log(import_cxf_events2.CxfEvents.LegendLevelChanged, `legendLevel: ${legendLevel}`);
1331
1419
  globalState.updateStore({
1332
1420
  legendLevel
1333
1421
  });
1334
1422
  const store = globalState.getStore();
1335
- log(import_cxf_events.CxfEvents.LegendLevelChanged, "reducer", store);
1423
+ log(import_cxf_events2.CxfEvents.LegendLevelChanged, "reducer", store);
1336
1424
  globalState.fetchUnreadOfferNotificationsCount();
1337
1425
  });
1338
1426
  };
@@ -1444,43 +1532,6 @@
1444
1532
  log("App has started");
1445
1533
  };
1446
1534
 
1447
- // src/config.ts
1448
- init_define_process();
1449
- var import_cxf_events2 = __toESM(require_typings());
1450
- var COMMON_CONFIG = {
1451
- CANVAS_AGENT_URL: define_process_default.env.CANVAS_AGENT_URL,
1452
- CANVAS_APP_ID_BY_GAME: define_process_default.env.CANVAS_APP_ID_BY_GAME,
1453
- CUSTOMIZATION_URL: define_process_default.env.CUSTOMIZATION_URL,
1454
- CUSTOMIZATION_URL_TEMPLATE: define_process_default.env.CUSTOMIZATION_URL_TEMPLATE,
1455
- BASE_URL: define_process_default.env.BASE_URL,
1456
- CXF_DIALOG_OPEN: "cxf.dialog.open",
1457
- CXF_DIALOG_CLOSE: "cxf.dialog.close",
1458
- CXF_TRACK_MSG: "cxf.tracking.message",
1459
- CXF_BTN_CLICK_MSG: import_cxf_events2.CxfEvents.OpenIGS,
1460
- CXF_OPEN_SALES_MSG: "cxf.webshop.sales.open" /* CXF_OPEN_SALES_MSG */,
1461
- WEB_SHOP_CALL_TRACK_ID: 1181,
1462
- CXF_ERROR: "cxf.error",
1463
- CXF_PUSH: "cxf.push",
1464
- CXF_AD_STATUS: "cxf.adBanner.status"
1465
- };
1466
- var GAME_SPECIFIC_CONFIG = {
1467
- 12: {
1468
- LEGEND_LEVEL_IS_USED: true
1469
- },
1470
- 15: {
1471
- LEGEND_LEVEL_IS_USED: false
1472
- },
1473
- 16: {
1474
- LEGEND_LEVEL_IS_USED: true
1475
- }
1476
- };
1477
- var createConfig = (gameId) => {
1478
- return {
1479
- ...COMMON_CONFIG,
1480
- ...GAME_SPECIFIC_CONFIG[gameId]
1481
- };
1482
- };
1483
-
1484
1535
  // src/index.ts
1485
1536
  require_dist().then((cxf) => {
1486
1537
  const config = createConfig(cxf.gameId);
@@ -1328,7 +1328,7 @@
1328
1328
  var subscribeToGameEvents = (cxf) => {
1329
1329
  cxf.on(import_cxf_events2.CxfEvents.Login, (e) => {
1330
1330
  const { gameEvents: eventsInLogin, language, token, zoneId } = e;
1331
- if (whitelistedZones.has(Number(zoneId)) && (Number(zoneId) > 300 || localStorage.getItem("cxf_canvas") === "enabled")) {
1331
+ if (whitelistedZones.has(Number(zoneId)) && (Number(zoneId) > 316 || localStorage.getItem("cxf_canvas") === "enabled")) {
1332
1332
  globalState.updateStore({
1333
1333
  isCanvas: true
1334
1334
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["<define:process>", "../node_modules/debug/node_modules/ms/index.js", "../node_modules/debug/src/common.js", "../node_modules/debug/src/browser.js", "../node_modules/@goodgamestudios/cxf-ready/dist/index.js", "../node_modules/@goodgamestudios/game-alias/dist/index.js", "../node_modules/@goodgamestudios/cxf-events/dist/typings.js", "../src/index.ts", "../src/app.ts", "../src/globalState.ts", "../src/fetch.ts", "../src/store.ts", "../src/utils/index.ts", "../src/utils/domain.ts", "../src/utils/error-handling.ts", "../src/utils/logging.ts", "../src/utils/loaders.ts", "../src/utils/payment.ts", "../src/utils/platform.ts", "../src/utils/query-params.ts", "../src/utils/session.ts", "../node_modules/@lukeed/uuid/dist/index.mjs", "../src/ArgumentNullError.ts", "../src/types/models.ts", "../src/utils/time.ts", "../src/utils/url.ts", "../src/config.ts", "../src/types/index.ts", "../src/types/config.ts", "../src/types/store.ts", "../src/utils/validation.ts", "../src/messages/ShopMessageBus.ts", "../src/preFetch.ts", "../src/handlers/cxfEventHandlers.ts", "../src/dialog.ts", "../src/track.ts", "../src/whitelist.ts", "../src/handlers/pushHandlers.ts", "../src/handlers/postMessageHandlers.ts"],
4
- "sourcesContent": ["", "/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n", "/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n", "\"use strict\";\n\n/**\n * A Promise that resolves when CXF has been initialized\n *\n * Usage:\n * const cxf = await require('cxf-ready')\n *\n */\nvar cxf = window && window.CXF;\nmodule.exports = new Promise(function (resolve, reject) {\n if (!window) {\n reject();\n }\n\n if (cxf) {\n return resolve(cxf);\n }\n\n window.addEventListener('cxf.initialized', function (event) {\n cxf = event.cxf;\n resolve(cxf);\n }, {\n capture: true,\n once: true,\n passive: true\n });\n});", "(function () {var b={};function f(r,$){return h(r)||g(r,$)||e()}function e(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance\")}function g(r,$){var a=[],o=!0,e=!1,n=void 0;try{for(var c,i=r[Symbol.iterator]();!(o=(c=i.next()).done)&&(a.push(c.value),!$||a.length!==$);o=!0);}catch(m){e=!0,n=m}finally{try{o||null==i.return||i.return()}finally{if(e)throw n}}return a}function h(r){if(Array.isArray(r))return r}var i=0,j=1,k=2,c={1:[\"poker\",\"poker2\",\"poker\"],12:[\"empire\",\"castle\",\"em\"],15:[\"bigfarm\",\"ranch\",\"bf\"],16:[\"empirefourkingdoms\",\"fourkingdoms\",\"e4k\"],23:[\"legendsofhonor\",void 0,\"loh\"],41:[\"empiremillenniumwars\",void 0,\"emmw\"]},d=Object.entries(c).reduce(function(r,$){var a=f($,2),o=a[0],e=a[1];return o=parseInt(o,10),r[o]=o,e.forEach(function($){r[$]=o}),r},{}),l=function(r){r=r.toString().toLowerCase();var $=d[r];return $&&0|$},a=function(r,$){return($=d[$])&&c[$][r]},m=a.bind(null,i),n=a.bind(null,j),o=a.bind(null,k);b={id:l,name:m,codename:n,acronym:o};if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=b}else if(typeof define===\"function\"&&define.amd){define(function(){return b})}})();", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CxfEvents = void 0;\nvar CxfEvents;\n(function (CxfEvents) {\n CxfEvents[\"Token\"] = \"cxf.token\";\n CxfEvents[\"Login\"] = \"cxf.login\";\n CxfEvents[\"Signup\"] = \"cxf.signup\";\n CxfEvents[\"GameEventUpdate\"] = \"cxf.gameEvent.update\";\n CxfEvents[\"GameEventAdd\"] = \"cxf.gameEvent.add\";\n CxfEvents[\"GameEventRemove\"] = \"cxf.gameEvent.remove\";\n CxfEvents[\"XpChanged\"] = \"cxf.xp.changed\";\n CxfEvents[\"LevelChanged\"] = \"cxf.level.changed\";\n CxfEvents[\"LegendLevelChanged\"] = \"cxf.legendLevel.changed\";\n CxfEvents[\"Push\"] = \"cxf.push\";\n CxfEvents[\"OpenIGS\"] = \"cxf.igs.open\";\n CxfEvents[\"JoinTempServer\"] = \"cxf.join.temp.server\";\n CxfEvents[\"Subscription\"] = \"cxf.subscription\";\n CxfEvents[\"RewardedAdStart\"] = \"cxf.rewardedad.start\";\n CxfEvents[\"RewardedAdDone\"] = \"cxf.rewardedad.done\";\n})(CxfEvents = exports.CxfEvents || (exports.CxfEvents = {}));\n", "import { app } from './app'\nimport { createConfig } from './config'\nimport { globalState } from './globalState'\nimport { initializeStore } from './store'\nimport { ICXF } from './types/cxf'\nimport { loadScript, log, logError } from './utils'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires, unicorn/prefer-top-level-await\nrequire('@goodgamestudios/cxf-ready').then((cxf: ICXF) => {\n // Initialize global state\n const config = createConfig(cxf.gameId)\n globalState.setConfig(config)\n globalState.setCxf(cxf)\n\n const store = initializeStore(cxf)\n globalState.setStore(store)\n\n // Canvas agent.js load\n loadScript(config.CANVAS_AGENT_URL as string)\n .then(() => {\n log(`Canvas agent loaded: ${config.CANVAS_AGENT_URL}`)\n })\n .catch((error: Error) => {\n logError('Canvas agent load error', error)\n })\n\n // Start the app\n app(cxf)\n})\n", "import { globalState } from './globalState'\nimport { createCxfEventHandlers } from './handlers/cxfEventHandlers'\nimport { createPostMessageHandlers } from './handlers/postMessageHandlers'\nimport { ICXF } from './types/cxf'\nimport { log, tryCatch } from './utils'\n\nexport const app = (cxf: ICXF): void => {\n const postMessageHandlers = createPostMessageHandlers()\n const subscribeCxf = createCxfEventHandlers()\n\n window.addEventListener(\n 'message',\n tryCatch(({ data }: MessageEvent) => {\n if (data) {\n const handler = postMessageHandlers[data.name]\n if (handler) {\n log('POST MESSAGE', data)\n handler(data.payload)\n }\n }\n })\n )\n\n // Subscribe to all CXF events\n for (const handler of subscribeCxf) {\n handler(cxf)\n }\n\n globalState.preResolveConfig()\n log('App has started')\n}\n", "import { Config } from './config'\nimport { fetchUnreadOfferNotificationsCount as defaultFetchUnreadOfferNotificationsCount } from './fetch'\nimport { ShopMessageBus } from './messages/ShopMessageBus'\nimport { preResolveConfig as defaultPreResolveConfig } from './preFetch'\nimport { ICXF } from './types/cxf'\nimport { IShopMessageBus } from './types/models'\nimport { entityProvider, IProvider, IStore } from './types/store'\n\nclass GlobalState {\n public config: Config | undefined = undefined\n public cxfProvider: IProvider<ICXF> = entityProvider()\n public dialogProvider: IProvider<HTMLElement> = entityProvider()\n public storeProvider: IProvider<IStore> = entityProvider()\n public shopMessageBus: IShopMessageBus = new ShopMessageBus()\n public fetchUnreadOfferNotificationsCount: () => Promise<void> | void = defaultFetchUnreadOfferNotificationsCount\n public preResolveConfig: () => void = defaultPreResolveConfig\n\n public setConfig(config: Config): void {\n this.config = config\n }\n\n public getConfig(): Config {\n if (this.config === undefined) {\n throw new Error('Config is not initialized')\n }\n return this.config\n }\n\n public setCxf(cxf: ICXF): void {\n this.cxfProvider.set(cxf)\n }\n\n public getCxf(): ICXF {\n const cxf = this.cxfProvider.get()\n if (!cxf) {\n throw new Error('CXF is not loaded')\n }\n return cxf\n }\n\n public setStore(store: IStore): void {\n this.storeProvider.set(store)\n }\n\n public getStore(): IStore {\n const store = this.storeProvider.get()\n if (!store) {\n throw new Error('Store is not initialized')\n }\n return store\n }\n\n public updateStore(data: Partial<IStore>): void {\n const currentStore = this.getStore()\n this.setStore({\n ...currentStore,\n ...data,\n })\n }\n}\n\nexport const globalState = new GlobalState()\n", "import { globalState } from './globalState'\nimport { criteriaSelector } from './store'\nimport { log, logError } from './utils'\n\nexport const fetchUnreadOfferNotificationsCount = async (): Promise<void> => {\n const config = globalState.getConfig()\n const store = globalState.getStore()\n\n if (config.LEGEND_LEVEL_IS_USED && store.legendLevel === undefined) {\n log('Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined')\n return\n }\n\n if (!store.isCanvas && store.token && store.unreadOfferNotifsCountUrl) {\n log('fetchUnreadOfferNotificationsCount')\n let unreadCount = 0\n const headers = {\n Authorization: `Bearer ${store.token}`,\n }\n const url = store.unreadOfferNotifsCountUrl\n .replace('{locale}', store.language || '')\n .replace('{zoneId}', store.zoneId || '')\n .replace('{criteria}', encodeURIComponent(JSON.stringify(criteriaSelector(store))))\n try {\n log('fetch', url)\n const resp = await fetch(url, {\n headers,\n })\n if (resp.ok) {\n const data = await resp.json()\n unreadCount = Number(data?.notifCount)\n }\n } catch (error) {\n logError(`cannot fetch ${url}`, error)\n }\n log('setUnseenOffersCounter', unreadCount)\n store.gameApi.invokeFn('setUnseenOffersCounter', unreadCount).catch((error) => {\n logError('setUnseenOffersCounter error:', error)\n })\n }\n}\n", "import { IDictionary } from './types/common'\nimport { ICXF } from './types/cxf'\nimport { IStore } from './types/store'\n\nexport function initializeStore(cxf: ICXF): IStore {\n return {\n isCanvas: false,\n playerId: cxf.playerId,\n instanceId: cxf.instanceId,\n networkId: cxf.networkId,\n gameId: cxf.gameId,\n gameApi: cxf.gameApi,\n language: cxf.language,\n token: cxf.token,\n zoneId: cxf.zoneId,\n gameEvents: [],\n xp: 0,\n level: 0,\n legendLevel: undefined,\n countryCode: '',\n lastPurchaseTab: '',\n subscriptionDisabled: false,\n isTempServer: false,\n customizationSuffix: '',\n resolvedCustomizationUrl: '',\n sourceId: 'unknown',\n unreadOfferNotifsCountUrl: '',\n }\n}\n\nexport function criteriaSelector({ legendLevel, level }: IStore): IDictionary<any> {\n return {\n legendLevel,\n level,\n }\n}\n", "// Barrel export file for all utility modules\nexport * from './domain'\nexport * from './error-handling'\nexport * from './loaders'\nexport * from './logging'\nexport * from './payment'\nexport * from './platform'\nexport * from './query-params'\nexport * from './session'\nexport * from './time'\nexport * from './url'\nexport * from './validation'\n", "export const parentDomain = (referrer: string) => {\n const matches = referrer.match(/^https?:\\/\\/([^#/?]+)(?:[#/?]|$)/i)\n if (!matches || !matches[1]) {\n return\n }\n\n const result = matches[1].match(/[^.]+\\.[^.]+$/)\n if (!result) {\n return\n }\n\n return result[0]\n}\n\nexport const getDomain = (referrer: string): string | undefined => {\n return parentDomain(referrer)\n}\n", "import { ArgumentNullError } from '../ArgumentNullError'\nimport { globalState } from '../globalState'\nimport { logError } from './logging'\n\nexport const tryCatch = <T extends (...args: any[]) => any>(fn: T): T =>\n ((...args: any[]) => {\n try {\n return fn(...args)\n } catch (error) {\n logError(error)\n throwCxfError(error as Error)\n }\n }) as T\n\nexport const throwCxfError = (e: Error): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_ERROR, e)\n}\n\nexport const isArgumentNullError = (e: Error): e is ArgumentNullError => e.name === 'ArgumentNullError'\n", "import debug from 'debug'\n\n/*\n * To show CXF-WEBSHOP debug messages just run in a browser console\n * localStorage.debug = 'CXF-WEBSHOP:*'\n */\nconst logger = debug('CXF-WEBSHOP')\nexport const log = (argument0: any, ...rest: any[]): void => logger(argument0, ...rest)\n\nexport const logError = (...arguments_: any[]): void =>\n // tslint:disable-next-line:no-console\n console.error('%c CXF-WEBSHOP ->', 'background: #ff0000; color: #fff', ...arguments_)\n", "import { AnyVoidFn as AnyVoidFunction, PromiseFn as PromiseFunction } from '../types/common'\nimport { ICXF } from '../types/cxf'\n\nconst startTimer = (function_: AnyVoidFunction, time: number) => {\n const id = setTimeout(function_, time)\n return () => clearTimeout(id)\n}\n\nconst timeout =\n <A, B>(function_: PromiseFunction<A, B>, time: number): PromiseFunction<A, B> =>\n (a) => {\n return new Promise((resolve, reject) => {\n const stopTimer = startTimer(() => {\n reject(new Error(`Timeout has exceeded ${time}`))\n }, time)\n\n function_(a)\n .then((value) => {\n resolve(value)\n stopTimer()\n })\n .catch(reject)\n })\n }\n\nexport const loadScript = (src: string) =>\n new Promise((resolve, reject) => {\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.type = 'module'\n script.async = true\n script.src = src\n script.addEventListener('load', resolve)\n // script.onerror = reject\n script.addEventListener('error', reject)\n document.body.append(script)\n })\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nexport const loadCxf = timeout(() => require('@goodgamestudios/cxf-ready') as Promise<ICXF>, 10_000)\n", "type Offer = {\n id: string\n tier: number\n productIds: { googleplay?: string }\n}\n\nexport const transformPaymentContractIdsToNativePriceEvent = (\n ids: string[]\n): {\n category: string\n offers: Offer[]\n eventName: string\n eventType: string\n} =>\n // eslint-disable-next-line unicorn/no-array-reduce\n ids.reduce(\n (prev, cur, idx) => {\n prev.offers.push({\n id: cur,\n tier: 0,\n productIds: {\n googleplay: cur,\n },\n })\n return prev\n },\n {\n category: 'all',\n offers: [] as Offer[],\n eventName: 'lemonstand.nativePrice',\n eventType: 'bubble',\n }\n )\n", "const userAgentToDistribPlatformMatrix = {\n itunes: 'apple',\n Android: 'google',\n googleplay: 'google',\n amazonmobile: 'amazon',\n facebook: 'facebook',\n samsung: 'samsung',\n huawei: 'huawei',\n}\n\nexport const detectPlatform = (defaultPlatform = 'stillpay'): string => {\n const nativePlatform = navigator.userAgent.match(\n /(itunes)|(googleplay)|(Android)|(amazonmobile)|(facebook)|(samsung)|(huawei)/g\n )\n if (!nativePlatform) return defaultPlatform\n const activePlatform = nativePlatform[0]\n\n return Object.prototype.hasOwnProperty.call(userAgentToDistribPlatformMatrix, activePlatform)\n ? userAgentToDistribPlatformMatrix[activePlatform as keyof typeof userAgentToDistribPlatformMatrix]\n : defaultPlatform\n}\n\nconst distribPlatformToProviderMatrix = {\n apple: 'itunes',\n google: 'googleplay',\n amazon: 'amazonmobile',\n facebook: 'facebook',\n samsung: 'samsung',\n huawei: 'huawei',\n}\n\nexport const createProductIdsForPlatform = (platform: keyof typeof distribPlatformToProviderMatrix, id: string) => {\n if (!Object.prototype.hasOwnProperty.call(distribPlatformToProviderMatrix, platform))\n throw new Error(`Platform ${platform} is not supported`)\n\n const res = Object.create(null)\n res[distribPlatformToProviderMatrix[platform]] = id\n return res\n}\n", "import { IDictionary } from '../types/common'\n\nexport function formatQueryString(object: IDictionary<string | number | undefined | null>) {\n return Object.entries(object)\n .filter(([key, value]) => value !== null && value !== undefined)\n .map(([key, value]) => `${key}=${encodeURIComponent(value as string)}`)\n .join('&')\n}\n\nexport const ggsGetQueryParams = (): string => {\n return ggsGetQueryParameters()\n}\n\nexport const ggsGetReferrerValue = (): string => {\n return ggsGetReferrer()\n}\n", "import { v4 as uuidv4 } from '@lukeed/uuid'\nimport { ArgumentNullError } from '../ArgumentNullError'\nimport { globalState } from '../globalState'\nimport { encodeGnip } from '../types/models'\nimport { IStore } from '../types/store'\n\nexport const createSessionId = () => uuidv4()\n\nexport const getTokenAndLanguage = (store: IStore) => {\n const { playerId, token, zoneId, language } = store\n if (!playerId) {\n throw new ArgumentNullError('playerId', playerId)\n }\n return {\n token,\n zoneId,\n locale: language,\n ping: encodeGnip({ ...store, playerId }),\n }\n}\n\nexport const getPing = (): string => {\n const store = globalState.getStore()\n const { playerId } = store\n if (!playerId) {\n throw new ArgumentNullError('playerId', playerId)\n }\n return encodeGnip({ ...store, playerId })\n}\n", "var IDX=256, HEX=[], BUFFER;\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function v4() {\n\tvar i=0, num, out='';\n\n\tif (!BUFFER || ((IDX + 16) > 256)) {\n\t\tBUFFER = Array(i=256);\n\t\twhile (i--) BUFFER[i] = 256 * Math.random() | 0;\n\t\ti = IDX = 0;\n\t}\n\n\tfor (; i < 16; i++) {\n\t\tnum = BUFFER[IDX + i];\n\t\tif (i==6) out += HEX[num & 15 | 64];\n\t\telse if (i==8) out += HEX[num & 63 | 128];\n\t\telse out += HEX[num];\n\n\t\tif (i & 1 && i > 1 && i < 11) out += '-';\n\t}\n\n\tIDX++;\n\treturn out;\n}\n", "export class ArgumentNullError extends Error {\n constructor(parameterName: string, parameterValue: any) {\n super(`${parameterName} has null value: ${parameterValue}`)\n this.name = 'ArgumentNullError'\n }\n}\n", "export interface GNIP {\n gameId: string\n networkId: string\n instanceId: string\n playerId: string\n}\n\nexport function decodeGnip(value: string): GNIP {\n const [gameId, networkId, instanceId, playerId] = value.split('-')\n return { gameId, networkId, instanceId, playerId }\n}\n\nexport function encodeGnip({ gameId, networkId, instanceId, playerId }: GNIP): string {\n return [gameId, networkId, instanceId, playerId].join('-')\n}\n\nexport interface IShopMessageBus {\n post(message: any): void\n}\n", "export function msToSec(value: number): number {\n return Math.floor(value / 1000)\n}\n\nexport function diffHours(d1: Date, d2: Date): number {\n const diff = (d1.getTime() - d2.getTime()) / 1000\n return Math.abs(Math.round(diff / (60 * 60)))\n}\n\nexport function timestampToHours(value: number): number {\n return Math.abs(Math.round(value / 1000 / (60 * 60)))\n}\n", "import { acronym } from '@goodgamestudios/game-alias'\nimport { globalState } from '../globalState'\nimport { criteriaSelector } from '../store'\nimport { ICreateCatalogUrlProperties } from '../types'\nimport { getBaseUrlForGame } from '../config'\nimport { getDomain } from './domain'\nimport { formatQueryString, ggsGetQueryParams, ggsGetReferrerValue } from './query-params'\nimport { createSessionId, getTokenAndLanguage } from './session'\nimport { validateForNull } from './validation'\n\nexport const createIframeUrl = ({ page, route, sid, config: igsConfig = {} }: ICreateCatalogUrlProperties): string => {\n const store = globalState.getStore()\n\n const { token, zoneId, locale } = getTokenAndLanguage(store)\n const parameters = {\n token,\n zoneId,\n locale,\n sid: sid || createSessionId(),\n }\n\n if (Object.keys(igsConfig).length > 0) {\n // @ts-ignore\n parameters.config = JSON.stringify(igsConfig)\n }\n\n validateForNull(parameters)\n\n const urlParameters = new URLSearchParams(ggsGetQueryParams())\n const queryParameters = {\n ...parameters,\n 'lemonstand.customization.url': store.resolvedCustomizationUrl || createCustomizationUrl(),\n domain: getDomain(ggsGetReferrerValue()),\n websiteId: urlParameters.get('w'),\n criteria: JSON.stringify(criteriaSelector(store)),\n level: store.level,\n }\n // <editor-fold desc=\"SPIL integration\">\n /* In case of SPIL integration the game can be launched\n with additional params 'network=xx&usekeybaselogin=false'\n in this case it needs to pass the network parameter to iframe url */\n const network = urlParameters.get('network')\n if (urlParameters.get('usekeybaselogin') === 'false' && Number(network) > 0) {\n // @ts-ignore\n queryParameters.network = network\n }\n\n if (store.adStatus?.areBannersAvailable) {\n // @ts-ignore\n queryParameters.ads = true\n }\n // </editor-fold>\n\n const baseUrl = getBaseUrlForGame(store.gameId)\n return `${baseUrl}/?${formatQueryString(queryParameters)}${page ? `#${page}` : ''}${\n route ? `--${route}--${Date.now()}` : ''\n }`\n}\n\nexport const createCustomizationUrl = (): string => {\n const config = globalState.getConfig()\n const store = globalState.getStore()\n const cxf = globalState.getCxf()\n\n const configBase = acronym(store.gameId)\n const configVariance = store.customizationSuffix ? `-${store.customizationSuffix}` : ''\n const configBranch = `${configBase}${configVariance}`\n\n if (cxf.env === 'test') {\n const configVersion = new URLSearchParams(window.location.search).get('configGGS')\n if (configVersion !== null) {\n return config.CUSTOMIZATION_URL_TEMPLATE.replace('{0}', configBranch).replace('{1}', configVersion)\n }\n }\n return config.CUSTOMIZATION_URL.replace('{0}', configBranch)\n}\n", "import { CxfEvents } from '@goodgamestudios/cxf-events'\nimport { WebshopEvents } from './types'\nimport { IDictionary } from './types/common'\nimport { GameSpecificConfig } from './types/config'\n\n// Helper to parse BASE_URL - handles both esbuild define (object) and jest (JSON string)\nconst parseBaseUrl = (value: string | Record<string, string> | undefined): Record<string, string> => {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value) as Record<string, string>\n } catch {\n return { default: value }\n }\n }\n return (value as Record<string, string>) || { default: '' }\n}\n\nconst COMMON_CONFIG = {\n CANVAS_AGENT_URL: process.env.CANVAS_AGENT_URL as string,\n CANVAS_APP_ID_BY_GAME: process.env.CANVAS_APP_ID_BY_GAME as string | Record<string, string>,\n CUSTOMIZATION_URL: process.env.CUSTOMIZATION_URL as string,\n CUSTOMIZATION_URL_TEMPLATE: process.env.CUSTOMIZATION_URL_TEMPLATE as string,\n BASE_URL: parseBaseUrl(process.env.BASE_URL),\n CXF_DIALOG_OPEN: 'cxf.dialog.open',\n CXF_DIALOG_CLOSE: 'cxf.dialog.close',\n CXF_TRACK_MSG: 'cxf.tracking.message',\n CXF_BTN_CLICK_MSG: CxfEvents.OpenIGS,\n CXF_OPEN_SALES_MSG: WebshopEvents.CXF_OPEN_SALES_MSG,\n WEB_SHOP_CALL_TRACK_ID: 1181,\n CXF_ERROR: 'cxf.error',\n CXF_PUSH: 'cxf.push',\n CXF_AD_STATUS: 'cxf.adBanner.status',\n}\n\nexport type Config = typeof COMMON_CONFIG & GameSpecificConfig\n\nconst GAME_SPECIFIC_CONFIG: IDictionary<GameSpecificConfig> = {\n 12: {\n LEGEND_LEVEL_IS_USED: true,\n },\n 15: {\n LEGEND_LEVEL_IS_USED: false,\n },\n 16: {\n LEGEND_LEVEL_IS_USED: true,\n },\n}\n\nexport const createConfig = (gameId: string): Config => {\n return {\n ...COMMON_CONFIG,\n ...GAME_SPECIFIC_CONFIG[gameId],\n }\n}\n\n/**\n * Get the BASE_URL for a specific game ID\n * @param gameId - The game ID (12, 15, 16, etc.)\n * @returns The BASE_URL string for the game, or default if not found\n */\nexport const getBaseUrlForGame = (gameId: string | number): string => {\n const baseUrl = COMMON_CONFIG.BASE_URL\n const gameIdKey = String(gameId)\n return baseUrl[gameIdKey] || baseUrl.default || ''\n}\n", "import { IDictionary } from './common'\n\n// ============================================================================\n// Handler Types\n// ============================================================================\n\n/**\n * Generic handler function type\n */\nexport type Handler = (...arguments_: any[]) => void\n\n/**\n * Dictionary of handler functions\n */\nexport type Handlers = IDictionary<Handler>\n\n/**\n * Push notification handler function type\n */\nexport type PushHandler = (...arguments_: any[]) => void\n\n/**\n * Dictionary of push handlers\n */\nexport type PushHandlers = IDictionary<PushHandler>\n\n/**\n * CXF event handler/subscribers\n */\nexport type CxfEventHandlers = Handler[]\n\n// ============================================================================\n// Event Payload Types\n// ============================================================================\n\n/**\n * Payload for opening IGS (In-Game Shop)\n */\nexport interface OpenIGSPayload {\n page?: string\n route?: string\n sourceId?: string\n config?: Record<string, any>\n}\n\n/**\n * Payload for reward events\n */\nexport interface OnRewardProperties {\n successUrl: string\n offerId: string\n sid: string\n page: string\n config?: Record<string, any>\n}\n\n/**\n * Payload for Lemonstand category update events\n */\nexport interface OnLemonstandCategoryUpdateProperties {\n target: string\n action: string\n data: any\n}\n\n/**\n * Payload for Lemonstand notification creation events\n */\nexport interface OnLemonstandNotificationsCreatedProperties {\n notifCount: number\n}\n\n// ============================================================================\n// Tracking Types\n// ============================================================================\n\n/**\n * Generic tracking payload\n */\nexport interface ITrackPayload extends IDictionary<string | number> {\n eventId: number\n}\n\n/**\n * Properties for Ranch webshop call tracking\n */\nexport interface IRanchWebShopCallProperties extends ITrackPayload {\n gameId: number\n playerId: number\n instanceId: number\n zoneId: number\n networkId: number\n sessionId: string\n date: number\n unixtimeMS: number\n sourceId: string\n}\n\n// ============================================================================\n// URL Types\n// ============================================================================\n\n/**\n * Properties for creating catalog/iframe URLs\n */\nexport interface ICreateCatalogUrlProperties {\n sid?: string\n page?: string\n route?: string\n config?: Record<string, any>\n}\n\n// ============================================================================\n// Webshop Events Enum\n// ============================================================================\n\n/**\n * Webshop event names\n */\nexport enum WebshopEvents {\n CXF_DIALOG_CLOSE = 'cxf.dialog.close',\n CXF_NATIVE_SUBSCRIPTION_ENABLE = 'cxf.native.subscription.enable',\n CXF_OPEN_SALES_MSG = 'cxf.webshop.sales.open',\n CXF_SET_CUSTOMIZATION_SUFFIX = 'cxf.set.customization.surfix',\n CXF_JOIN_TEMP_SERVER = 'cxf.join.temp.server',\n LEMONSTAND_CATEGORY_UPDATE = 'lemonstand.category.update',\n LEMONSTAND_NOTIFICATIONS_CREATED = 'lemonstand.notifs.created',\n}\n\n// CANVAS Agent\n//\n// Agent Props workaround; don't want to make Agent as a package\nexport enum CanvasAppEvent {\n CHECKOUT = 'checkout',\n CLOSE = 'close',\n COLLECT = 'collect',\n ERROR = 'error',\n EXPIRED = 'expired',\n INIT = 'init',\n NATIVE_CATALOG_REQUEST = 'native_catalog_request',\n NATIVE_CHECKOUT_REQUEST = 'native_checkout_request',\n NAVIGATE = 'navigate',\n READY = 'ready',\n RESIZE = 'resize',\n}\n\nexport type CanvasEventPostMessage = {\n eventType: CanvasAppEvent\n [key: string]: any\n}\n\nexport type AgentProps = {\n canvasAppId: string\n eventListener?: (event: CanvasEventPostMessage) => void\n frameParent?: HTMLElement\n fullScreen?: boolean\n locale?: string\n sessionId?: string\n token: string\n customContext?: Record<string, any>\n authClientId?: any\n debug?: boolean\n}\n\nexport * from './config'\nexport * from './models'\nexport * from './store'\n", "export type GameSpecificConfig = {\n LEGEND_LEVEL_IS_USED: boolean\n}\n", "import { CountryCode, IGameEvent } from '@goodgamestudios/cxf-events'\nimport { IDictionary } from './common'\nimport { IGameApi } from './cxf'\n\nexport interface IStore {\n adStatus?: Record<string, any>\n countryCode: CountryCode\n customizationSuffix: string\n gameApi: IGameApi\n gameEvents: IGameEvent[]\n gameId: string\n instanceId: string\n isTempServer: boolean\n isCanvas: boolean\n language?: string\n lastPurchaseTab: string\n legendLevel?: number\n level: number\n networkId: string\n playerId?: string\n resolvedCustomizationUrl?: string\n sourceId: string\n subscriptionDisabled: boolean\n token?: string\n unreadOfferNotifsCountUrl: string\n xp: number\n zoneId?: string\n}\n\nexport interface IStorageData {\n // gameId: string\n // networkId: string\n // instanceId: string\n zoneId?: number\n growthFund: {\n lastPopup: IDictionary<number>\n }\n}\n\nexport interface IProvider<T> {\n get: () => T | undefined\n set: (value: T) => void\n}\n\nexport const entityProvider = <T>(initial?: T): IProvider<T> => {\n let element = initial\n return {\n get: () => element,\n set: (value) => {\n element = value\n },\n }\n}\n", "import { ArgumentNullError } from '../ArgumentNullError'\nimport { IDictionary } from '../types/common'\n\nexport const validateForNull = (properties: IDictionary<any>) => {\n for (const key of Object.keys(properties)) {\n const value = properties[key]\n if (value === undefined || value === null || Number.isNaN(value)) {\n throw new ArgumentNullError(key, value)\n }\n }\n}\n", "import { IShopMessageBus } from '../types/models'\n\nexport class ShopMessageBus implements IShopMessageBus {\n public post(message: any) {\n const element = document.querySelector('#dialog') as HTMLIFrameElement\n if (element && element.tagName.toLocaleLowerCase() === 'iframe') {\n element.contentWindow?.postMessage(message, '*')\n }\n }\n}\n", "import { globalState } from './globalState'\nimport { log } from './utils'\nimport { createCustomizationUrl } from './utils/url'\n\ntype LemonstandConfig = {\n css: string\n js: string\n unreadOfferNotifsCountUrl: string\n}\n\nexport const preResolveConfig = (): void => {\n if (typeof fetch !== 'function') {\n return\n }\n const originalCustomUrl = createCustomizationUrl()\n let resolvedUrl = ''\n fetch(originalCustomUrl)\n .then((resp) => {\n const currentCustomUrl = createCustomizationUrl()\n if (currentCustomUrl === originalCustomUrl) {\n // this is the latest, we keep it\n resolvedUrl = resp.url\n log('parsed customization url is ' + resolvedUrl)\n globalState.updateStore({\n resolvedCustomizationUrl: resolvedUrl,\n })\n return resp.json()\n }\n })\n .then((config: LemonstandConfig | undefined) => {\n if (config) {\n globalState.updateStore({\n unreadOfferNotifsCountUrl: config.unreadOfferNotifsCountUrl || '',\n })\n }\n })\n}\n", "import { CxfEvents, IGameEvent, ILoginData } from '@goodgamestudios/cxf-events'\nimport { createDialog } from '../dialog'\nimport { globalState } from '../globalState'\nimport { trackOpenAction } from '../track'\nimport { CanvasAppEvent, CanvasEventPostMessage, CxfEventHandlers, OpenIGSPayload, WebshopEvents } from '../types'\nimport { IPushMessageData } from '../types/common'\nimport { ICXF } from '../types/cxf'\nimport {\n createProductIdsForPlatform,\n createSessionId,\n detectPlatform,\n log,\n logError,\n transformPaymentContractIdsToNativePriceEvent,\n tryCatch,\n} from '../utils'\nimport { createIframeUrl } from '../utils/url'\nimport { whitelistedZones } from '../whitelist'\nimport { createPushHandlers } from './pushHandlers'\n\nlet isWindowMessageListenerAttached = false\n\nconst eventListener = (event: CanvasEventPostMessage) => {\n log(`Canvas event \"${event.eventType}\" received:`, event)\n\n switch (event.eventType) {\n case CanvasAppEvent.NATIVE_CATALOG_REQUEST: {\n if (event?.paymentContractIds?.length > 0) {\n if (!isWindowMessageListenerAttached) {\n window.addEventListener('message', ({ data }: MessageEvent) => {\n if (\n data?.eventName === WebshopEvents.LEMONSTAND_CATEGORY_UPDATE &&\n data?.data?.action === 'nativePriceUpdate'\n ) {\n // Native client provided back to us native prices for payment contracts\n log(`${WebshopEvents.LEMONSTAND_CATEGORY_UPDATE} event`, data.data)\n if (!data.data.data) return\n const nativeCatalog: Record<string, { amount: number; currency: string }> = {}\n for (const key in data.data.data) {\n const { priceString, ...rest } = data.data.data[key]\n nativeCatalog[key] = rest\n }\n log('nativeCatalog:', nativeCatalog)\n window.CanvasAgent?.instance?.setNativeCatalog(nativeCatalog)\n }\n })\n isWindowMessageListenerAttached = true\n }\n // Send payment contract IDs to native client\n const msg = transformPaymentContractIdsToNativePriceEvent(event.paymentContractIds)\n window.postMessage(msg, '*')\n log('Event `lemonstand.nativePrice` sent')\n }\n break\n }\n case CanvasAppEvent.NATIVE_CHECKOUT_REQUEST: {\n const { paymentContract, sessionId, offerId, distributionPlatform } = event\n const { zoneId } = globalState.getStore()\n window.postMessage(\n {\n eventName: 'lemonstand.nativePay',\n eventType: 'bubble',\n nativePayInfo: {\n pkg: {\n price: paymentContract?.price?.amount,\n productIdMS: '',\n productIds: createProductIdsForPlatform(distributionPlatform, paymentContract?.id),\n tier: Number(paymentContract?.id?.split('_')?.at(-1)),\n },\n meta: {\n criteria: window.CanvasAgent?.instance?.getState()?.appConfig?.canvasAppId,\n lemonstand: true,\n offerId,\n sid: sessionId,\n type: 'canvas', // IMPORTANT: type must be 'canvas'\n zoneId,\n successUrl: window.location.href,\n },\n },\n },\n '*'\n )\n log('Event `lemonstand.nativePay` sent')\n break\n }\n default: {\n break\n }\n }\n}\n\nconst onOpen = (payload: OpenIGSPayload = {}): void => {\n log(CxfEvents.OpenIGS, 'payload:', payload)\n\n if (payload.sourceId) {\n globalState.updateStore({\n sourceId: payload.sourceId,\n })\n }\n\n const { isCanvas, lastPurchaseTab, gameApi } = globalState.getStore()\n if (isCanvas) {\n if (payload.page) {\n window.CanvasAgent?.instance?.navigate(payload.page)\n }\n window.CanvasAgent?.instance?.show()\n return\n }\n const sid = createSessionId()\n trackOpenAction(sid)\n const url = createIframeUrl({\n sid,\n page: lastPurchaseTab,\n ...payload,\n })\n createDialog(url)\n\n setTimeout(() => {\n // remove unread offer notifications counter on the IGS button while opening the IGS\n // small delay makes UX a bit better due to it happens after IGS initialization is started\n gameApi.invokeFn('setUnseenOffersCounter', 0)\n }, 1000)\n}\n\nexport const subscribeToCommonCxfEvents = (cxf: ICXF): void => {\n const pushHandlers = createPushHandlers()\n\n cxf.on(CxfEvents.OpenIGS, tryCatch(onOpen))\n cxf.on(\n CxfEvents.Push,\n tryCatch(({ id, payload }: IPushMessageData) => {\n log(CxfEvents.Push, id, payload)\n const handler = pushHandlers[id]\n handler && handler(payload)\n })\n )\n}\n\nexport const subscribeToGameEvents = (cxf: ICXF): void => {\n cxf.on(CxfEvents.Login, (e: ILoginData) => {\n const { gameEvents: eventsInLogin, language, token, zoneId } = e\n if (\n whitelistedZones.has(Number(zoneId)) &&\n (Number(zoneId) > 300 || localStorage.getItem('cxf_canvas') === 'enabled')\n ) {\n globalState.updateStore({\n isCanvas: true,\n })\n }\n const { gameEvents, isCanvas } = globalState.getStore()\n // eslint-disable-next-line unicorn/consistent-function-scoping\n const eventNotExistPredicateGenerator = (existingEvents: IGameEvent[]) => (event: IGameEvent) =>\n !existingEvents.map((event_) => event_.type).includes(event.type)\n globalState.updateStore({\n ...e,\n gameEvents: [...gameEvents.filter(eventNotExistPredicateGenerator(eventsInLogin)), ...eventsInLogin],\n })\n log(CxfEvents.Login, globalState.getStore())\n if (!isCanvas) {\n globalState.fetchUnreadOfferNotificationsCount()\n return\n }\n // Logic for Canvas\n if (typeof window.CanvasAgent?.create === 'function') {\n const { CANVAS_APP_ID_BY_GAME } = globalState.getConfig()\n const platform = detectPlatform()\n const canvasApps = (CANVAS_APP_ID_BY_GAME as Record<string, string | Record<string, string>>)[cxf.gameId]\n const canvasAppId =\n typeof canvasApps === 'string' ? canvasApps : (canvasApps as Record<string, string>)[platform]\n\n if (!canvasAppId) {\n logError('Canvas app id not found for platform', { platform, canvasApps })\n return\n }\n\n window.CanvasAgent.create({\n authClientId: 'lemonstand',\n canvasAppId,\n eventListener,\n locale: language,\n token,\n })\n .then((res) => {\n window.CanvasAgent.instance = res\n log(CxfEvents.Login, 'Canvas created')\n })\n .catch((error) => {\n logError('Cannot create instance of Canvas', error)\n })\n }\n })\n\n cxf.on(CxfEvents.GameEventUpdate, (e: IGameEvent[]) => {\n log(CxfEvents.GameEventUpdate, e)\n const { gameEvents, isCanvas } = globalState.getStore()\n const updatedEventTypes = new Set(e.map((event) => event.type))\n globalState.updateStore({\n gameEvents: [...gameEvents.filter((event) => !updatedEventTypes.has(event.type)), ...e],\n })\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n }\n log(CxfEvents.GameEventUpdate, 'reducer', globalState.getStore())\n })\n\n cxf.on(CxfEvents.GameEventAdd, (e: IGameEvent) => {\n log(CxfEvents.GameEventAdd, e)\n const { gameEvents, isCanvas } = globalState.getStore()\n globalState.updateStore({\n gameEvents: [...gameEvents, e],\n })\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n }\n log(CxfEvents.GameEventAdd, 'reducer', globalState.getStore())\n })\n\n cxf.on(CxfEvents.GameEventRemove, (e: number) => {\n log(CxfEvents.GameEventRemove, e)\n const { gameEvents, isCanvas } = globalState.getStore()\n globalState.updateStore({\n gameEvents: gameEvents.filter(({ type }) => type !== e),\n })\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n }\n log(CxfEvents.GameEventRemove, 'reducer', globalState.getStore())\n })\n\n cxf.on(CxfEvents.LevelChanged, (level: number) => {\n log(CxfEvents.LevelChanged, level)\n const { isCanvas } = globalState.getStore()\n globalState.updateStore({\n level,\n })\n log(CxfEvents.LevelChanged, 'reducer', globalState.getStore())\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n } else {\n globalState.fetchUnreadOfferNotificationsCount()\n }\n })\n\n cxf.on(CxfEvents.LegendLevelChanged, (legendLevel: number) => {\n log(CxfEvents.LegendLevelChanged, `legendLevel: ${legendLevel}`)\n globalState.updateStore({\n legendLevel,\n })\n const store = globalState.getStore()\n log(CxfEvents.LegendLevelChanged, 'reducer', store)\n globalState.fetchUnreadOfferNotificationsCount()\n })\n}\n\n/*\n In E4K this event is used to control the subscriptions tab\n This is deprecated, as specific config values/tab visibility can be controlled using Lemonstands `config` query param\n*/\nexport const subscribeToNativeSubscriptionEnable = (cxf: ICXF): void => {\n cxf.on(WebshopEvents.CXF_NATIVE_SUBSCRIPTION_ENABLE, (enabled: 0 | 1) => {\n globalState.updateStore({\n subscriptionDisabled: enabled === 0,\n customizationSuffix: enabled === 0 ? 'no-subscription' : '',\n })\n globalState.preResolveConfig()\n })\n}\n\n/*\n The config file suffix (e.g. \"em.json\" + \"mobile\" -> \"em-mobile.json\") can be set through an event\n Used by MS and BFW integration pages\n*/\nexport const subscribeToCustomizationSuffix = (cxf: ICXF): void => {\n cxf.on(WebshopEvents.CXF_SET_CUSTOMIZATION_SUFFIX, (suffix: string) => {\n const { customizationSuffix } = globalState.getStore()\n if (suffix === customizationSuffix) {\n return\n }\n globalState.updateStore({\n customizationSuffix: suffix || '',\n })\n globalState.preResolveConfig()\n })\n}\n\n/*\n Information about whether ads are enabled or not is retrieved externally from `cxf-ad-banners`\n and stored to be passed to IGS\n*/\nexport const subscribeToAdStatus = (cxf: ICXF): void => {\n const config = globalState.getConfig()\n cxf.on(config.CXF_AD_STATUS, ({ areBannersAvailable, bannersDetails }: Record<string, any>) => {\n globalState.updateStore({\n adStatus: {\n areBannersAvailable,\n bannersDetails,\n },\n })\n })\n}\n\n/*\n Use a dedicated config variant on temp servers\n*/\nexport const subscribeToTempServerContext = (cxf: ICXF): void => {\n cxf.on(WebshopEvents.CXF_JOIN_TEMP_SERVER, (isTemp: 0 | 1) => {\n const store = globalState.getStore()\n globalState.updateStore({\n isTempServer: Boolean(isTemp),\n })\n\n // ensure suffix is not already set by the environment, e.g. BFW or MS integration\n // TODO: fully migrate client detection into `cxf-webshop`\n if (store.customizationSuffix === '' || store.customizationSuffix === 'temp') {\n globalState.updateStore({\n customizationSuffix: isTemp ? 'temp' : '',\n })\n globalState.preResolveConfig()\n }\n })\n}\n\nexport const createCxfEventHandlers = (): CxfEventHandlers => {\n return [\n subscribeToCommonCxfEvents,\n subscribeToGameEvents,\n subscribeToAdStatus,\n subscribeToTempServerContext,\n subscribeToNativeSubscriptionEnable,\n subscribeToCustomizationSuffix,\n ]\n}\n", "import { globalState } from './globalState'\n\nexport const removeDialog = (): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_DIALOG_CLOSE)\n}\n\nexport const createDialog = (url: string): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_DIALOG_OPEN, url)\n}\n", "import { globalState } from './globalState'\nimport { IRanchWebShopCallProperties, ITrackPayload } from './types'\nimport { getTokenAndLanguage, msToSec } from './utils'\n\nexport const trackOpenAction = (sid: string): void => {\n const config = globalState.getConfig()\n const store = globalState.getStore()\n const now = Date.now()\n const parameters = getTokenAndLanguage(store)\n const { zoneId } = parameters\n const sessionId = sid\n const { playerId, gameId, networkId, instanceId, sourceId } = store\n trackAction({\n eventId: config.WEB_SHOP_CALL_TRACK_ID,\n date: msToSec(now),\n unixtimeMS: now,\n sessionId,\n zoneId: zoneId ? Number.parseInt(zoneId, 10) : undefined,\n playerId: Number.parseInt(playerId as string, 10),\n gameId: Number.parseInt(gameId, 10),\n networkId: Number.parseInt(networkId, 10),\n instanceId: Number.parseInt(instanceId, 10),\n sourceId,\n } as IRanchWebShopCallProperties)\n}\n\nexport const trackAction = (payload: ITrackPayload): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_TRACK_MSG, payload)\n}\n", "export const whitelistedZones = new Set([218, 316, 318, 460, 461, 768, 802, 814, 830, 877])\n", "import { createDialog } from '../dialog'\nimport { fetchUnreadOfferNotificationsCount } from '../fetch'\nimport { globalState } from '../globalState'\nimport { trackOpenAction } from '../track'\nimport {\n OnLemonstandCategoryUpdateProperties,\n OnLemonstandNotificationsCreatedProperties,\n OnRewardProperties,\n PushHandlers,\n WebshopEvents,\n} from '../types'\nimport { log, logError } from '../utils'\nimport { createIframeUrl } from '../utils/url'\n\nexport const onReward = (payload: OnRewardProperties): void => {\n log('OnReward: payload', payload)\n const { isCanvas } = globalState.getStore()\n if (isCanvas) {\n window.CanvasAgent?.instance?.hide()\n window.CanvasAgent?.instance?.navigate()\n return\n }\n const url = createIframeUrl({\n route: encodeURIComponent(payload.successUrl),\n ...payload,\n })\n globalState.updateStore({\n lastPurchaseTab: payload.page,\n sourceId: 'successfulPayoutReward',\n })\n trackOpenAction(payload.sid)\n\n createDialog(url)\n}\n\nexport const onLemonstandCategoryUpdate = ({ target, action, data }: OnLemonstandCategoryUpdateProperties): void => {\n globalState.shopMessageBus.post({\n eventName: WebshopEvents.LEMONSTAND_CATEGORY_UPDATE,\n target,\n data: { action, data },\n })\n}\n\n/**\n * this handler works in case of offer notification activation and deactivation\n */\nexport const onLemonstandNotificationsCreated = ({ notifCount }: OnLemonstandNotificationsCreatedProperties): void => {\n log('onLemonstandNotificationsCreated -> notifCount:', notifCount)\n const store = globalState.getStore()\n if (notifCount > 0) {\n // random delay in range 1-120 sec on LIVE, and 1-15 sec on TEST\n const randomDelayMs = Math.floor(Math.random() * (Number(store.networkId) < 250 ? 120_000 : 15_000))\n setTimeout(() => {\n fetchUnreadOfferNotificationsCount()\n }, randomDelayMs)\n } else {\n store.gameApi.invokeFn('setUnseenOffersCounter', 0).catch((error) => {\n logError('setUnseenOffersCounter error:', error)\n })\n }\n}\n\nexport const createPushHandlers = (): PushHandlers => {\n return {\n reward: onReward,\n reward_received: onReward,\n [WebshopEvents.LEMONSTAND_CATEGORY_UPDATE]: onLemonstandCategoryUpdate,\n [WebshopEvents.LEMONSTAND_NOTIFICATIONS_CREATED]: onLemonstandNotificationsCreated,\n }\n}\n", "import { createDialog } from '../dialog'\nimport { fetchUnreadOfferNotificationsCount } from '../fetch'\nimport { globalState } from '../globalState'\nimport { Handlers, WebshopEvents } from '../types'\nimport { createSessionId, log } from '../utils'\nimport { createIframeUrl } from '../utils/url'\n\nexport const onSalesPageOpen = (): void => {\n log('OnOpenSalesOffersPage')\n const { isCanvas } = globalState.getStore()\n if (isCanvas) {\n window.CanvasAgent?.instance?.navigate('supersale')\n return\n }\n\n const sid = createSessionId()\n const url = createIframeUrl({\n page: 'sale-offers',\n sid,\n })\n createDialog(url)\n}\n\nexport const onLemonstandClose = (): void => {\n const store = globalState.getStore()\n log('onLemonstandClose', store)\n fetchUnreadOfferNotificationsCount()\n}\n\nexport const createPostMessageHandlers = (): Handlers => {\n return {\n [WebshopEvents.CXF_OPEN_SALES_MSG]: onSalesPageOpen,\n [WebshopEvents.CXF_DIALOG_CLOSE]: onLemonstandClose,\n }\n}\n"],
4
+ "sourcesContent": ["", "/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n", "/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n", "\"use strict\";\n\n/**\n * A Promise that resolves when CXF has been initialized\n *\n * Usage:\n * const cxf = await require('cxf-ready')\n *\n */\nvar cxf = window && window.CXF;\nmodule.exports = new Promise(function (resolve, reject) {\n if (!window) {\n reject();\n }\n\n if (cxf) {\n return resolve(cxf);\n }\n\n window.addEventListener('cxf.initialized', function (event) {\n cxf = event.cxf;\n resolve(cxf);\n }, {\n capture: true,\n once: true,\n passive: true\n });\n});", "(function () {var b={};function f(r,$){return h(r)||g(r,$)||e()}function e(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance\")}function g(r,$){var a=[],o=!0,e=!1,n=void 0;try{for(var c,i=r[Symbol.iterator]();!(o=(c=i.next()).done)&&(a.push(c.value),!$||a.length!==$);o=!0);}catch(m){e=!0,n=m}finally{try{o||null==i.return||i.return()}finally{if(e)throw n}}return a}function h(r){if(Array.isArray(r))return r}var i=0,j=1,k=2,c={1:[\"poker\",\"poker2\",\"poker\"],12:[\"empire\",\"castle\",\"em\"],15:[\"bigfarm\",\"ranch\",\"bf\"],16:[\"empirefourkingdoms\",\"fourkingdoms\",\"e4k\"],23:[\"legendsofhonor\",void 0,\"loh\"],41:[\"empiremillenniumwars\",void 0,\"emmw\"]},d=Object.entries(c).reduce(function(r,$){var a=f($,2),o=a[0],e=a[1];return o=parseInt(o,10),r[o]=o,e.forEach(function($){r[$]=o}),r},{}),l=function(r){r=r.toString().toLowerCase();var $=d[r];return $&&0|$},a=function(r,$){return($=d[$])&&c[$][r]},m=a.bind(null,i),n=a.bind(null,j),o=a.bind(null,k);b={id:l,name:m,codename:n,acronym:o};if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=b}else if(typeof define===\"function\"&&define.amd){define(function(){return b})}})();", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CxfEvents = void 0;\nvar CxfEvents;\n(function (CxfEvents) {\n CxfEvents[\"Token\"] = \"cxf.token\";\n CxfEvents[\"Login\"] = \"cxf.login\";\n CxfEvents[\"Signup\"] = \"cxf.signup\";\n CxfEvents[\"GameEventUpdate\"] = \"cxf.gameEvent.update\";\n CxfEvents[\"GameEventAdd\"] = \"cxf.gameEvent.add\";\n CxfEvents[\"GameEventRemove\"] = \"cxf.gameEvent.remove\";\n CxfEvents[\"XpChanged\"] = \"cxf.xp.changed\";\n CxfEvents[\"LevelChanged\"] = \"cxf.level.changed\";\n CxfEvents[\"LegendLevelChanged\"] = \"cxf.legendLevel.changed\";\n CxfEvents[\"Push\"] = \"cxf.push\";\n CxfEvents[\"OpenIGS\"] = \"cxf.igs.open\";\n CxfEvents[\"JoinTempServer\"] = \"cxf.join.temp.server\";\n CxfEvents[\"Subscription\"] = \"cxf.subscription\";\n CxfEvents[\"RewardedAdStart\"] = \"cxf.rewardedad.start\";\n CxfEvents[\"RewardedAdDone\"] = \"cxf.rewardedad.done\";\n})(CxfEvents = exports.CxfEvents || (exports.CxfEvents = {}));\n", "import { app } from './app'\nimport { createConfig } from './config'\nimport { globalState } from './globalState'\nimport { initializeStore } from './store'\nimport { ICXF } from './types/cxf'\nimport { loadScript, log, logError } from './utils'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires, unicorn/prefer-top-level-await\nrequire('@goodgamestudios/cxf-ready').then((cxf: ICXF) => {\n // Initialize global state\n const config = createConfig(cxf.gameId)\n globalState.setConfig(config)\n globalState.setCxf(cxf)\n\n const store = initializeStore(cxf)\n globalState.setStore(store)\n\n // Canvas agent.js load\n loadScript(config.CANVAS_AGENT_URL as string)\n .then(() => {\n log(`Canvas agent loaded: ${config.CANVAS_AGENT_URL}`)\n })\n .catch((error: Error) => {\n logError('Canvas agent load error', error)\n })\n\n // Start the app\n app(cxf)\n})\n", "import { globalState } from './globalState'\nimport { createCxfEventHandlers } from './handlers/cxfEventHandlers'\nimport { createPostMessageHandlers } from './handlers/postMessageHandlers'\nimport { ICXF } from './types/cxf'\nimport { log, tryCatch } from './utils'\n\nexport const app = (cxf: ICXF): void => {\n const postMessageHandlers = createPostMessageHandlers()\n const subscribeCxf = createCxfEventHandlers()\n\n window.addEventListener(\n 'message',\n tryCatch(({ data }: MessageEvent) => {\n if (data) {\n const handler = postMessageHandlers[data.name]\n if (handler) {\n log('POST MESSAGE', data)\n handler(data.payload)\n }\n }\n })\n )\n\n // Subscribe to all CXF events\n for (const handler of subscribeCxf) {\n handler(cxf)\n }\n\n globalState.preResolveConfig()\n log('App has started')\n}\n", "import { Config } from './config'\nimport { fetchUnreadOfferNotificationsCount as defaultFetchUnreadOfferNotificationsCount } from './fetch'\nimport { ShopMessageBus } from './messages/ShopMessageBus'\nimport { preResolveConfig as defaultPreResolveConfig } from './preFetch'\nimport { ICXF } from './types/cxf'\nimport { IShopMessageBus } from './types/models'\nimport { entityProvider, IProvider, IStore } from './types/store'\n\nclass GlobalState {\n public config: Config | undefined = undefined\n public cxfProvider: IProvider<ICXF> = entityProvider()\n public dialogProvider: IProvider<HTMLElement> = entityProvider()\n public storeProvider: IProvider<IStore> = entityProvider()\n public shopMessageBus: IShopMessageBus = new ShopMessageBus()\n public fetchUnreadOfferNotificationsCount: () => Promise<void> | void = defaultFetchUnreadOfferNotificationsCount\n public preResolveConfig: () => void = defaultPreResolveConfig\n\n public setConfig(config: Config): void {\n this.config = config\n }\n\n public getConfig(): Config {\n if (this.config === undefined) {\n throw new Error('Config is not initialized')\n }\n return this.config\n }\n\n public setCxf(cxf: ICXF): void {\n this.cxfProvider.set(cxf)\n }\n\n public getCxf(): ICXF {\n const cxf = this.cxfProvider.get()\n if (!cxf) {\n throw new Error('CXF is not loaded')\n }\n return cxf\n }\n\n public setStore(store: IStore): void {\n this.storeProvider.set(store)\n }\n\n public getStore(): IStore {\n const store = this.storeProvider.get()\n if (!store) {\n throw new Error('Store is not initialized')\n }\n return store\n }\n\n public updateStore(data: Partial<IStore>): void {\n const currentStore = this.getStore()\n this.setStore({\n ...currentStore,\n ...data,\n })\n }\n}\n\nexport const globalState = new GlobalState()\n", "import { globalState } from './globalState'\nimport { criteriaSelector } from './store'\nimport { log, logError } from './utils'\n\nexport const fetchUnreadOfferNotificationsCount = async (): Promise<void> => {\n const config = globalState.getConfig()\n const store = globalState.getStore()\n\n if (config.LEGEND_LEVEL_IS_USED && store.legendLevel === undefined) {\n log('Skip fetchUnreadOfferNotificationsCount due to legendLevel is undefined')\n return\n }\n\n if (!store.isCanvas && store.token && store.unreadOfferNotifsCountUrl) {\n log('fetchUnreadOfferNotificationsCount')\n let unreadCount = 0\n const headers = {\n Authorization: `Bearer ${store.token}`,\n }\n const url = store.unreadOfferNotifsCountUrl\n .replace('{locale}', store.language || '')\n .replace('{zoneId}', store.zoneId || '')\n .replace('{criteria}', encodeURIComponent(JSON.stringify(criteriaSelector(store))))\n try {\n log('fetch', url)\n const resp = await fetch(url, {\n headers,\n })\n if (resp.ok) {\n const data = await resp.json()\n unreadCount = Number(data?.notifCount)\n }\n } catch (error) {\n logError(`cannot fetch ${url}`, error)\n }\n log('setUnseenOffersCounter', unreadCount)\n store.gameApi.invokeFn('setUnseenOffersCounter', unreadCount).catch((error) => {\n logError('setUnseenOffersCounter error:', error)\n })\n }\n}\n", "import { IDictionary } from './types/common'\nimport { ICXF } from './types/cxf'\nimport { IStore } from './types/store'\n\nexport function initializeStore(cxf: ICXF): IStore {\n return {\n isCanvas: false,\n playerId: cxf.playerId,\n instanceId: cxf.instanceId,\n networkId: cxf.networkId,\n gameId: cxf.gameId,\n gameApi: cxf.gameApi,\n language: cxf.language,\n token: cxf.token,\n zoneId: cxf.zoneId,\n gameEvents: [],\n xp: 0,\n level: 0,\n legendLevel: undefined,\n countryCode: '',\n lastPurchaseTab: '',\n subscriptionDisabled: false,\n isTempServer: false,\n customizationSuffix: '',\n resolvedCustomizationUrl: '',\n sourceId: 'unknown',\n unreadOfferNotifsCountUrl: '',\n }\n}\n\nexport function criteriaSelector({ legendLevel, level }: IStore): IDictionary<any> {\n return {\n legendLevel,\n level,\n }\n}\n", "// Barrel export file for all utility modules\nexport * from './domain'\nexport * from './error-handling'\nexport * from './loaders'\nexport * from './logging'\nexport * from './payment'\nexport * from './platform'\nexport * from './query-params'\nexport * from './session'\nexport * from './time'\nexport * from './url'\nexport * from './validation'\n", "export const parentDomain = (referrer: string) => {\n const matches = referrer.match(/^https?:\\/\\/([^#/?]+)(?:[#/?]|$)/i)\n if (!matches || !matches[1]) {\n return\n }\n\n const result = matches[1].match(/[^.]+\\.[^.]+$/)\n if (!result) {\n return\n }\n\n return result[0]\n}\n\nexport const getDomain = (referrer: string): string | undefined => {\n return parentDomain(referrer)\n}\n", "import { ArgumentNullError } from '../ArgumentNullError'\nimport { globalState } from '../globalState'\nimport { logError } from './logging'\n\nexport const tryCatch = <T extends (...args: any[]) => any>(fn: T): T =>\n ((...args: any[]) => {\n try {\n return fn(...args)\n } catch (error) {\n logError(error)\n throwCxfError(error as Error)\n }\n }) as T\n\nexport const throwCxfError = (e: Error): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_ERROR, e)\n}\n\nexport const isArgumentNullError = (e: Error): e is ArgumentNullError => e.name === 'ArgumentNullError'\n", "import debug from 'debug'\n\n/*\n * To show CXF-WEBSHOP debug messages just run in a browser console\n * localStorage.debug = 'CXF-WEBSHOP:*'\n */\nconst logger = debug('CXF-WEBSHOP')\nexport const log = (argument0: any, ...rest: any[]): void => logger(argument0, ...rest)\n\nexport const logError = (...arguments_: any[]): void =>\n // tslint:disable-next-line:no-console\n console.error('%c CXF-WEBSHOP ->', 'background: #ff0000; color: #fff', ...arguments_)\n", "import { AnyVoidFn as AnyVoidFunction, PromiseFn as PromiseFunction } from '../types/common'\nimport { ICXF } from '../types/cxf'\n\nconst startTimer = (function_: AnyVoidFunction, time: number) => {\n const id = setTimeout(function_, time)\n return () => clearTimeout(id)\n}\n\nconst timeout =\n <A, B>(function_: PromiseFunction<A, B>, time: number): PromiseFunction<A, B> =>\n (a) => {\n return new Promise((resolve, reject) => {\n const stopTimer = startTimer(() => {\n reject(new Error(`Timeout has exceeded ${time}`))\n }, time)\n\n function_(a)\n .then((value) => {\n resolve(value)\n stopTimer()\n })\n .catch(reject)\n })\n }\n\nexport const loadScript = (src: string) =>\n new Promise((resolve, reject) => {\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.type = 'module'\n script.async = true\n script.src = src\n script.addEventListener('load', resolve)\n // script.onerror = reject\n script.addEventListener('error', reject)\n document.body.append(script)\n })\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nexport const loadCxf = timeout(() => require('@goodgamestudios/cxf-ready') as Promise<ICXF>, 10_000)\n", "type Offer = {\n id: string\n tier: number\n productIds: { googleplay?: string }\n}\n\nexport const transformPaymentContractIdsToNativePriceEvent = (\n ids: string[]\n): {\n category: string\n offers: Offer[]\n eventName: string\n eventType: string\n} =>\n // eslint-disable-next-line unicorn/no-array-reduce\n ids.reduce(\n (prev, cur, idx) => {\n prev.offers.push({\n id: cur,\n tier: 0,\n productIds: {\n googleplay: cur,\n },\n })\n return prev\n },\n {\n category: 'all',\n offers: [] as Offer[],\n eventName: 'lemonstand.nativePrice',\n eventType: 'bubble',\n }\n )\n", "const userAgentToDistribPlatformMatrix = {\n itunes: 'apple',\n Android: 'google',\n googleplay: 'google',\n amazonmobile: 'amazon',\n facebook: 'facebook',\n samsung: 'samsung',\n huawei: 'huawei',\n}\n\nexport const detectPlatform = (defaultPlatform = 'stillpay'): string => {\n const nativePlatform = navigator.userAgent.match(\n /(itunes)|(googleplay)|(Android)|(amazonmobile)|(facebook)|(samsung)|(huawei)/g\n )\n if (!nativePlatform) return defaultPlatform\n const activePlatform = nativePlatform[0]\n\n return Object.prototype.hasOwnProperty.call(userAgentToDistribPlatformMatrix, activePlatform)\n ? userAgentToDistribPlatformMatrix[activePlatform as keyof typeof userAgentToDistribPlatformMatrix]\n : defaultPlatform\n}\n\nconst distribPlatformToProviderMatrix = {\n apple: 'itunes',\n google: 'googleplay',\n amazon: 'amazonmobile',\n facebook: 'facebook',\n samsung: 'samsung',\n huawei: 'huawei',\n}\n\nexport const createProductIdsForPlatform = (platform: keyof typeof distribPlatformToProviderMatrix, id: string) => {\n if (!Object.prototype.hasOwnProperty.call(distribPlatformToProviderMatrix, platform))\n throw new Error(`Platform ${platform} is not supported`)\n\n const res = Object.create(null)\n res[distribPlatformToProviderMatrix[platform]] = id\n return res\n}\n", "import { IDictionary } from '../types/common'\n\nexport function formatQueryString(object: IDictionary<string | number | undefined | null>) {\n return Object.entries(object)\n .filter(([key, value]) => value !== null && value !== undefined)\n .map(([key, value]) => `${key}=${encodeURIComponent(value as string)}`)\n .join('&')\n}\n\nexport const ggsGetQueryParams = (): string => {\n return ggsGetQueryParameters()\n}\n\nexport const ggsGetReferrerValue = (): string => {\n return ggsGetReferrer()\n}\n", "import { v4 as uuidv4 } from '@lukeed/uuid'\nimport { ArgumentNullError } from '../ArgumentNullError'\nimport { globalState } from '../globalState'\nimport { encodeGnip } from '../types/models'\nimport { IStore } from '../types/store'\n\nexport const createSessionId = () => uuidv4()\n\nexport const getTokenAndLanguage = (store: IStore) => {\n const { playerId, token, zoneId, language } = store\n if (!playerId) {\n throw new ArgumentNullError('playerId', playerId)\n }\n return {\n token,\n zoneId,\n locale: language,\n ping: encodeGnip({ ...store, playerId }),\n }\n}\n\nexport const getPing = (): string => {\n const store = globalState.getStore()\n const { playerId } = store\n if (!playerId) {\n throw new ArgumentNullError('playerId', playerId)\n }\n return encodeGnip({ ...store, playerId })\n}\n", "var IDX=256, HEX=[], BUFFER;\nwhile (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);\n\nexport function v4() {\n\tvar i=0, num, out='';\n\n\tif (!BUFFER || ((IDX + 16) > 256)) {\n\t\tBUFFER = Array(i=256);\n\t\twhile (i--) BUFFER[i] = 256 * Math.random() | 0;\n\t\ti = IDX = 0;\n\t}\n\n\tfor (; i < 16; i++) {\n\t\tnum = BUFFER[IDX + i];\n\t\tif (i==6) out += HEX[num & 15 | 64];\n\t\telse if (i==8) out += HEX[num & 63 | 128];\n\t\telse out += HEX[num];\n\n\t\tif (i & 1 && i > 1 && i < 11) out += '-';\n\t}\n\n\tIDX++;\n\treturn out;\n}\n", "export class ArgumentNullError extends Error {\n constructor(parameterName: string, parameterValue: any) {\n super(`${parameterName} has null value: ${parameterValue}`)\n this.name = 'ArgumentNullError'\n }\n}\n", "export interface GNIP {\n gameId: string\n networkId: string\n instanceId: string\n playerId: string\n}\n\nexport function decodeGnip(value: string): GNIP {\n const [gameId, networkId, instanceId, playerId] = value.split('-')\n return { gameId, networkId, instanceId, playerId }\n}\n\nexport function encodeGnip({ gameId, networkId, instanceId, playerId }: GNIP): string {\n return [gameId, networkId, instanceId, playerId].join('-')\n}\n\nexport interface IShopMessageBus {\n post(message: any): void\n}\n", "export function msToSec(value: number): number {\n return Math.floor(value / 1000)\n}\n\nexport function diffHours(d1: Date, d2: Date): number {\n const diff = (d1.getTime() - d2.getTime()) / 1000\n return Math.abs(Math.round(diff / (60 * 60)))\n}\n\nexport function timestampToHours(value: number): number {\n return Math.abs(Math.round(value / 1000 / (60 * 60)))\n}\n", "import { acronym } from '@goodgamestudios/game-alias'\nimport { globalState } from '../globalState'\nimport { criteriaSelector } from '../store'\nimport { ICreateCatalogUrlProperties } from '../types'\nimport { getBaseUrlForGame } from '../config'\nimport { getDomain } from './domain'\nimport { formatQueryString, ggsGetQueryParams, ggsGetReferrerValue } from './query-params'\nimport { createSessionId, getTokenAndLanguage } from './session'\nimport { validateForNull } from './validation'\n\nexport const createIframeUrl = ({ page, route, sid, config: igsConfig = {} }: ICreateCatalogUrlProperties): string => {\n const store = globalState.getStore()\n\n const { token, zoneId, locale } = getTokenAndLanguage(store)\n const parameters = {\n token,\n zoneId,\n locale,\n sid: sid || createSessionId(),\n }\n\n if (Object.keys(igsConfig).length > 0) {\n // @ts-ignore\n parameters.config = JSON.stringify(igsConfig)\n }\n\n validateForNull(parameters)\n\n const urlParameters = new URLSearchParams(ggsGetQueryParams())\n const queryParameters = {\n ...parameters,\n 'lemonstand.customization.url': store.resolvedCustomizationUrl || createCustomizationUrl(),\n domain: getDomain(ggsGetReferrerValue()),\n websiteId: urlParameters.get('w'),\n criteria: JSON.stringify(criteriaSelector(store)),\n level: store.level,\n }\n // <editor-fold desc=\"SPIL integration\">\n /* In case of SPIL integration the game can be launched\n with additional params 'network=xx&usekeybaselogin=false'\n in this case it needs to pass the network parameter to iframe url */\n const network = urlParameters.get('network')\n if (urlParameters.get('usekeybaselogin') === 'false' && Number(network) > 0) {\n // @ts-ignore\n queryParameters.network = network\n }\n\n if (store.adStatus?.areBannersAvailable) {\n // @ts-ignore\n queryParameters.ads = true\n }\n // </editor-fold>\n\n const baseUrl = getBaseUrlForGame(store.gameId)\n return `${baseUrl}/?${formatQueryString(queryParameters)}${page ? `#${page}` : ''}${\n route ? `--${route}--${Date.now()}` : ''\n }`\n}\n\nexport const createCustomizationUrl = (): string => {\n const config = globalState.getConfig()\n const store = globalState.getStore()\n const cxf = globalState.getCxf()\n\n const configBase = acronym(store.gameId)\n const configVariance = store.customizationSuffix ? `-${store.customizationSuffix}` : ''\n const configBranch = `${configBase}${configVariance}`\n\n if (cxf.env === 'test') {\n const configVersion = new URLSearchParams(window.location.search).get('configGGS')\n if (configVersion !== null) {\n return config.CUSTOMIZATION_URL_TEMPLATE.replace('{0}', configBranch).replace('{1}', configVersion)\n }\n }\n return config.CUSTOMIZATION_URL.replace('{0}', configBranch)\n}\n", "import { CxfEvents } from '@goodgamestudios/cxf-events'\nimport { WebshopEvents } from './types'\nimport { IDictionary } from './types/common'\nimport { GameSpecificConfig } from './types/config'\n\n// Helper to parse BASE_URL - handles both esbuild define (object) and jest (JSON string)\nconst parseBaseUrl = (value: string | Record<string, string> | undefined): Record<string, string> => {\n if (typeof value === 'string') {\n try {\n return JSON.parse(value) as Record<string, string>\n } catch {\n return { default: value }\n }\n }\n return (value as Record<string, string>) || { default: '' }\n}\n\nconst COMMON_CONFIG = {\n CANVAS_AGENT_URL: process.env.CANVAS_AGENT_URL as string,\n CANVAS_APP_ID_BY_GAME: process.env.CANVAS_APP_ID_BY_GAME as string | Record<string, string>,\n CUSTOMIZATION_URL: process.env.CUSTOMIZATION_URL as string,\n CUSTOMIZATION_URL_TEMPLATE: process.env.CUSTOMIZATION_URL_TEMPLATE as string,\n BASE_URL: parseBaseUrl(process.env.BASE_URL),\n CXF_DIALOG_OPEN: 'cxf.dialog.open',\n CXF_DIALOG_CLOSE: 'cxf.dialog.close',\n CXF_TRACK_MSG: 'cxf.tracking.message',\n CXF_BTN_CLICK_MSG: CxfEvents.OpenIGS,\n CXF_OPEN_SALES_MSG: WebshopEvents.CXF_OPEN_SALES_MSG,\n WEB_SHOP_CALL_TRACK_ID: 1181,\n CXF_ERROR: 'cxf.error',\n CXF_PUSH: 'cxf.push',\n CXF_AD_STATUS: 'cxf.adBanner.status',\n}\n\nexport type Config = typeof COMMON_CONFIG & GameSpecificConfig\n\nconst GAME_SPECIFIC_CONFIG: IDictionary<GameSpecificConfig> = {\n 12: {\n LEGEND_LEVEL_IS_USED: true,\n },\n 15: {\n LEGEND_LEVEL_IS_USED: false,\n },\n 16: {\n LEGEND_LEVEL_IS_USED: true,\n },\n}\n\nexport const createConfig = (gameId: string): Config => {\n return {\n ...COMMON_CONFIG,\n ...GAME_SPECIFIC_CONFIG[gameId],\n }\n}\n\n/**\n * Get the BASE_URL for a specific game ID\n * @param gameId - The game ID (12, 15, 16, etc.)\n * @returns The BASE_URL string for the game, or default if not found\n */\nexport const getBaseUrlForGame = (gameId: string | number): string => {\n const baseUrl = COMMON_CONFIG.BASE_URL\n const gameIdKey = String(gameId)\n return baseUrl[gameIdKey] || baseUrl.default || ''\n}\n", "import { IDictionary } from './common'\n\n// ============================================================================\n// Handler Types\n// ============================================================================\n\n/**\n * Generic handler function type\n */\nexport type Handler = (...arguments_: any[]) => void\n\n/**\n * Dictionary of handler functions\n */\nexport type Handlers = IDictionary<Handler>\n\n/**\n * Push notification handler function type\n */\nexport type PushHandler = (...arguments_: any[]) => void\n\n/**\n * Dictionary of push handlers\n */\nexport type PushHandlers = IDictionary<PushHandler>\n\n/**\n * CXF event handler/subscribers\n */\nexport type CxfEventHandlers = Handler[]\n\n// ============================================================================\n// Event Payload Types\n// ============================================================================\n\n/**\n * Payload for opening IGS (In-Game Shop)\n */\nexport interface OpenIGSPayload {\n page?: string\n route?: string\n sourceId?: string\n config?: Record<string, any>\n}\n\n/**\n * Payload for reward events\n */\nexport interface OnRewardProperties {\n successUrl: string\n offerId: string\n sid: string\n page: string\n config?: Record<string, any>\n}\n\n/**\n * Payload for Lemonstand category update events\n */\nexport interface OnLemonstandCategoryUpdateProperties {\n target: string\n action: string\n data: any\n}\n\n/**\n * Payload for Lemonstand notification creation events\n */\nexport interface OnLemonstandNotificationsCreatedProperties {\n notifCount: number\n}\n\n// ============================================================================\n// Tracking Types\n// ============================================================================\n\n/**\n * Generic tracking payload\n */\nexport interface ITrackPayload extends IDictionary<string | number> {\n eventId: number\n}\n\n/**\n * Properties for Ranch webshop call tracking\n */\nexport interface IRanchWebShopCallProperties extends ITrackPayload {\n gameId: number\n playerId: number\n instanceId: number\n zoneId: number\n networkId: number\n sessionId: string\n date: number\n unixtimeMS: number\n sourceId: string\n}\n\n// ============================================================================\n// URL Types\n// ============================================================================\n\n/**\n * Properties for creating catalog/iframe URLs\n */\nexport interface ICreateCatalogUrlProperties {\n sid?: string\n page?: string\n route?: string\n config?: Record<string, any>\n}\n\n// ============================================================================\n// Webshop Events Enum\n// ============================================================================\n\n/**\n * Webshop event names\n */\nexport enum WebshopEvents {\n CXF_DIALOG_CLOSE = 'cxf.dialog.close',\n CXF_NATIVE_SUBSCRIPTION_ENABLE = 'cxf.native.subscription.enable',\n CXF_OPEN_SALES_MSG = 'cxf.webshop.sales.open',\n CXF_SET_CUSTOMIZATION_SUFFIX = 'cxf.set.customization.surfix',\n CXF_JOIN_TEMP_SERVER = 'cxf.join.temp.server',\n LEMONSTAND_CATEGORY_UPDATE = 'lemonstand.category.update',\n LEMONSTAND_NOTIFICATIONS_CREATED = 'lemonstand.notifs.created',\n}\n\n// CANVAS Agent\n//\n// Agent Props workaround; don't want to make Agent as a package\nexport enum CanvasAppEvent {\n CHECKOUT = 'checkout',\n CLOSE = 'close',\n COLLECT = 'collect',\n ERROR = 'error',\n EXPIRED = 'expired',\n INIT = 'init',\n NATIVE_CATALOG_REQUEST = 'native_catalog_request',\n NATIVE_CHECKOUT_REQUEST = 'native_checkout_request',\n NAVIGATE = 'navigate',\n READY = 'ready',\n RESIZE = 'resize',\n}\n\nexport type CanvasEventPostMessage = {\n eventType: CanvasAppEvent\n [key: string]: any\n}\n\nexport type AgentProps = {\n canvasAppId: string\n eventListener?: (event: CanvasEventPostMessage) => void\n frameParent?: HTMLElement\n fullScreen?: boolean\n locale?: string\n sessionId?: string\n token: string\n customContext?: Record<string, any>\n authClientId?: any\n debug?: boolean\n}\n\nexport * from './config'\nexport * from './models'\nexport * from './store'\n", "export type GameSpecificConfig = {\n LEGEND_LEVEL_IS_USED: boolean\n}\n", "import { CountryCode, IGameEvent } from '@goodgamestudios/cxf-events'\nimport { IDictionary } from './common'\nimport { IGameApi } from './cxf'\n\nexport interface IStore {\n adStatus?: Record<string, any>\n countryCode: CountryCode\n customizationSuffix: string\n gameApi: IGameApi\n gameEvents: IGameEvent[]\n gameId: string\n instanceId: string\n isTempServer: boolean\n isCanvas: boolean\n language?: string\n lastPurchaseTab: string\n legendLevel?: number\n level: number\n networkId: string\n playerId?: string\n resolvedCustomizationUrl?: string\n sourceId: string\n subscriptionDisabled: boolean\n token?: string\n unreadOfferNotifsCountUrl: string\n xp: number\n zoneId?: string\n}\n\nexport interface IStorageData {\n // gameId: string\n // networkId: string\n // instanceId: string\n zoneId?: number\n growthFund: {\n lastPopup: IDictionary<number>\n }\n}\n\nexport interface IProvider<T> {\n get: () => T | undefined\n set: (value: T) => void\n}\n\nexport const entityProvider = <T>(initial?: T): IProvider<T> => {\n let element = initial\n return {\n get: () => element,\n set: (value) => {\n element = value\n },\n }\n}\n", "import { ArgumentNullError } from '../ArgumentNullError'\nimport { IDictionary } from '../types/common'\n\nexport const validateForNull = (properties: IDictionary<any>) => {\n for (const key of Object.keys(properties)) {\n const value = properties[key]\n if (value === undefined || value === null || Number.isNaN(value)) {\n throw new ArgumentNullError(key, value)\n }\n }\n}\n", "import { IShopMessageBus } from '../types/models'\n\nexport class ShopMessageBus implements IShopMessageBus {\n public post(message: any) {\n const element = document.querySelector('#dialog') as HTMLIFrameElement\n if (element && element.tagName.toLocaleLowerCase() === 'iframe') {\n element.contentWindow?.postMessage(message, '*')\n }\n }\n}\n", "import { globalState } from './globalState'\nimport { log } from './utils'\nimport { createCustomizationUrl } from './utils/url'\n\ntype LemonstandConfig = {\n css: string\n js: string\n unreadOfferNotifsCountUrl: string\n}\n\nexport const preResolveConfig = (): void => {\n if (typeof fetch !== 'function') {\n return\n }\n const originalCustomUrl = createCustomizationUrl()\n let resolvedUrl = ''\n fetch(originalCustomUrl)\n .then((resp) => {\n const currentCustomUrl = createCustomizationUrl()\n if (currentCustomUrl === originalCustomUrl) {\n // this is the latest, we keep it\n resolvedUrl = resp.url\n log('parsed customization url is ' + resolvedUrl)\n globalState.updateStore({\n resolvedCustomizationUrl: resolvedUrl,\n })\n return resp.json()\n }\n })\n .then((config: LemonstandConfig | undefined) => {\n if (config) {\n globalState.updateStore({\n unreadOfferNotifsCountUrl: config.unreadOfferNotifsCountUrl || '',\n })\n }\n })\n}\n", "import { CxfEvents, IGameEvent, ILoginData } from '@goodgamestudios/cxf-events'\nimport { createDialog } from '../dialog'\nimport { globalState } from '../globalState'\nimport { trackOpenAction } from '../track'\nimport { CanvasAppEvent, CanvasEventPostMessage, CxfEventHandlers, OpenIGSPayload, WebshopEvents } from '../types'\nimport { IPushMessageData } from '../types/common'\nimport { ICXF } from '../types/cxf'\nimport {\n createProductIdsForPlatform,\n createSessionId,\n detectPlatform,\n log,\n logError,\n transformPaymentContractIdsToNativePriceEvent,\n tryCatch,\n} from '../utils'\nimport { createIframeUrl } from '../utils/url'\nimport { whitelistedZones } from '../whitelist'\nimport { createPushHandlers } from './pushHandlers'\n\nlet isWindowMessageListenerAttached = false\n\nconst eventListener = (event: CanvasEventPostMessage) => {\n log(`Canvas event \"${event.eventType}\" received:`, event)\n\n switch (event.eventType) {\n case CanvasAppEvent.NATIVE_CATALOG_REQUEST: {\n if (event?.paymentContractIds?.length > 0) {\n if (!isWindowMessageListenerAttached) {\n window.addEventListener('message', ({ data }: MessageEvent) => {\n if (\n data?.eventName === WebshopEvents.LEMONSTAND_CATEGORY_UPDATE &&\n data?.data?.action === 'nativePriceUpdate'\n ) {\n // Native client provided back to us native prices for payment contracts\n log(`${WebshopEvents.LEMONSTAND_CATEGORY_UPDATE} event`, data.data)\n if (!data.data.data) return\n const nativeCatalog: Record<string, { amount: number; currency: string }> = {}\n for (const key in data.data.data) {\n const { priceString, ...rest } = data.data.data[key]\n nativeCatalog[key] = rest\n }\n log('nativeCatalog:', nativeCatalog)\n window.CanvasAgent?.instance?.setNativeCatalog(nativeCatalog)\n }\n })\n isWindowMessageListenerAttached = true\n }\n // Send payment contract IDs to native client\n const msg = transformPaymentContractIdsToNativePriceEvent(event.paymentContractIds)\n window.postMessage(msg, '*')\n log('Event `lemonstand.nativePrice` sent')\n }\n break\n }\n case CanvasAppEvent.NATIVE_CHECKOUT_REQUEST: {\n const { paymentContract, sessionId, offerId, distributionPlatform } = event\n const { zoneId } = globalState.getStore()\n window.postMessage(\n {\n eventName: 'lemonstand.nativePay',\n eventType: 'bubble',\n nativePayInfo: {\n pkg: {\n price: paymentContract?.price?.amount,\n productIdMS: '',\n productIds: createProductIdsForPlatform(distributionPlatform, paymentContract?.id),\n tier: Number(paymentContract?.id?.split('_')?.at(-1)),\n },\n meta: {\n criteria: window.CanvasAgent?.instance?.getState()?.appConfig?.canvasAppId,\n lemonstand: true,\n offerId,\n sid: sessionId,\n type: 'canvas', // IMPORTANT: type must be 'canvas'\n zoneId,\n successUrl: window.location.href,\n },\n },\n },\n '*'\n )\n log('Event `lemonstand.nativePay` sent')\n break\n }\n default: {\n break\n }\n }\n}\n\nconst onOpen = (payload: OpenIGSPayload = {}): void => {\n log(CxfEvents.OpenIGS, 'payload:', payload)\n\n if (payload.sourceId) {\n globalState.updateStore({\n sourceId: payload.sourceId,\n })\n }\n\n const { isCanvas, lastPurchaseTab, gameApi } = globalState.getStore()\n if (isCanvas) {\n if (payload.page) {\n window.CanvasAgent?.instance?.navigate(payload.page)\n }\n window.CanvasAgent?.instance?.show()\n return\n }\n const sid = createSessionId()\n trackOpenAction(sid)\n const url = createIframeUrl({\n sid,\n page: lastPurchaseTab,\n ...payload,\n })\n createDialog(url)\n\n setTimeout(() => {\n // remove unread offer notifications counter on the IGS button while opening the IGS\n // small delay makes UX a bit better due to it happens after IGS initialization is started\n gameApi.invokeFn('setUnseenOffersCounter', 0)\n }, 1000)\n}\n\nexport const subscribeToCommonCxfEvents = (cxf: ICXF): void => {\n const pushHandlers = createPushHandlers()\n\n cxf.on(CxfEvents.OpenIGS, tryCatch(onOpen))\n cxf.on(\n CxfEvents.Push,\n tryCatch(({ id, payload }: IPushMessageData) => {\n log(CxfEvents.Push, id, payload)\n const handler = pushHandlers[id]\n handler && handler(payload)\n })\n )\n}\n\nexport const subscribeToGameEvents = (cxf: ICXF): void => {\n cxf.on(CxfEvents.Login, (e: ILoginData) => {\n const { gameEvents: eventsInLogin, language, token, zoneId } = e\n if (\n whitelistedZones.has(Number(zoneId)) &&\n (Number(zoneId) > 316 || localStorage.getItem('cxf_canvas') === 'enabled')\n ) {\n globalState.updateStore({\n isCanvas: true,\n })\n }\n const { gameEvents, isCanvas } = globalState.getStore()\n // eslint-disable-next-line unicorn/consistent-function-scoping\n const eventNotExistPredicateGenerator = (existingEvents: IGameEvent[]) => (event: IGameEvent) =>\n !existingEvents.map((event_) => event_.type).includes(event.type)\n globalState.updateStore({\n ...e,\n gameEvents: [...gameEvents.filter(eventNotExistPredicateGenerator(eventsInLogin)), ...eventsInLogin],\n })\n log(CxfEvents.Login, globalState.getStore())\n if (!isCanvas) {\n globalState.fetchUnreadOfferNotificationsCount()\n return\n }\n // Logic for Canvas\n if (typeof window.CanvasAgent?.create === 'function') {\n const { CANVAS_APP_ID_BY_GAME } = globalState.getConfig()\n const platform = detectPlatform()\n const canvasApps = (CANVAS_APP_ID_BY_GAME as Record<string, string | Record<string, string>>)[cxf.gameId]\n const canvasAppId =\n typeof canvasApps === 'string' ? canvasApps : (canvasApps as Record<string, string>)[platform]\n\n if (!canvasAppId) {\n logError('Canvas app id not found for platform', { platform, canvasApps })\n return\n }\n\n window.CanvasAgent.create({\n authClientId: 'lemonstand',\n canvasAppId,\n eventListener,\n locale: language,\n token,\n })\n .then((res) => {\n window.CanvasAgent.instance = res\n log(CxfEvents.Login, 'Canvas created')\n })\n .catch((error) => {\n logError('Cannot create instance of Canvas', error)\n })\n }\n })\n\n cxf.on(CxfEvents.GameEventUpdate, (e: IGameEvent[]) => {\n log(CxfEvents.GameEventUpdate, e)\n const { gameEvents, isCanvas } = globalState.getStore()\n const updatedEventTypes = new Set(e.map((event) => event.type))\n globalState.updateStore({\n gameEvents: [...gameEvents.filter((event) => !updatedEventTypes.has(event.type)), ...e],\n })\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n }\n log(CxfEvents.GameEventUpdate, 'reducer', globalState.getStore())\n })\n\n cxf.on(CxfEvents.GameEventAdd, (e: IGameEvent) => {\n log(CxfEvents.GameEventAdd, e)\n const { gameEvents, isCanvas } = globalState.getStore()\n globalState.updateStore({\n gameEvents: [...gameEvents, e],\n })\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n }\n log(CxfEvents.GameEventAdd, 'reducer', globalState.getStore())\n })\n\n cxf.on(CxfEvents.GameEventRemove, (e: number) => {\n log(CxfEvents.GameEventRemove, e)\n const { gameEvents, isCanvas } = globalState.getStore()\n globalState.updateStore({\n gameEvents: gameEvents.filter(({ type }) => type !== e),\n })\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n }\n log(CxfEvents.GameEventRemove, 'reducer', globalState.getStore())\n })\n\n cxf.on(CxfEvents.LevelChanged, (level: number) => {\n log(CxfEvents.LevelChanged, level)\n const { isCanvas } = globalState.getStore()\n globalState.updateStore({\n level,\n })\n log(CxfEvents.LevelChanged, 'reducer', globalState.getStore())\n if (isCanvas) {\n window.CanvasAgent?.instance?.refresh()\n } else {\n globalState.fetchUnreadOfferNotificationsCount()\n }\n })\n\n cxf.on(CxfEvents.LegendLevelChanged, (legendLevel: number) => {\n log(CxfEvents.LegendLevelChanged, `legendLevel: ${legendLevel}`)\n globalState.updateStore({\n legendLevel,\n })\n const store = globalState.getStore()\n log(CxfEvents.LegendLevelChanged, 'reducer', store)\n globalState.fetchUnreadOfferNotificationsCount()\n })\n}\n\n/*\n In E4K this event is used to control the subscriptions tab\n This is deprecated, as specific config values/tab visibility can be controlled using Lemonstands `config` query param\n*/\nexport const subscribeToNativeSubscriptionEnable = (cxf: ICXF): void => {\n cxf.on(WebshopEvents.CXF_NATIVE_SUBSCRIPTION_ENABLE, (enabled: 0 | 1) => {\n globalState.updateStore({\n subscriptionDisabled: enabled === 0,\n customizationSuffix: enabled === 0 ? 'no-subscription' : '',\n })\n globalState.preResolveConfig()\n })\n}\n\n/*\n The config file suffix (e.g. \"em.json\" + \"mobile\" -> \"em-mobile.json\") can be set through an event\n Used by MS and BFW integration pages\n*/\nexport const subscribeToCustomizationSuffix = (cxf: ICXF): void => {\n cxf.on(WebshopEvents.CXF_SET_CUSTOMIZATION_SUFFIX, (suffix: string) => {\n const { customizationSuffix } = globalState.getStore()\n if (suffix === customizationSuffix) {\n return\n }\n globalState.updateStore({\n customizationSuffix: suffix || '',\n })\n globalState.preResolveConfig()\n })\n}\n\n/*\n Information about whether ads are enabled or not is retrieved externally from `cxf-ad-banners`\n and stored to be passed to IGS\n*/\nexport const subscribeToAdStatus = (cxf: ICXF): void => {\n const config = globalState.getConfig()\n cxf.on(config.CXF_AD_STATUS, ({ areBannersAvailable, bannersDetails }: Record<string, any>) => {\n globalState.updateStore({\n adStatus: {\n areBannersAvailable,\n bannersDetails,\n },\n })\n })\n}\n\n/*\n Use a dedicated config variant on temp servers\n*/\nexport const subscribeToTempServerContext = (cxf: ICXF): void => {\n cxf.on(WebshopEvents.CXF_JOIN_TEMP_SERVER, (isTemp: 0 | 1) => {\n const store = globalState.getStore()\n globalState.updateStore({\n isTempServer: Boolean(isTemp),\n })\n\n // ensure suffix is not already set by the environment, e.g. BFW or MS integration\n // TODO: fully migrate client detection into `cxf-webshop`\n if (store.customizationSuffix === '' || store.customizationSuffix === 'temp') {\n globalState.updateStore({\n customizationSuffix: isTemp ? 'temp' : '',\n })\n globalState.preResolveConfig()\n }\n })\n}\n\nexport const createCxfEventHandlers = (): CxfEventHandlers => {\n return [\n subscribeToCommonCxfEvents,\n subscribeToGameEvents,\n subscribeToAdStatus,\n subscribeToTempServerContext,\n subscribeToNativeSubscriptionEnable,\n subscribeToCustomizationSuffix,\n ]\n}\n", "import { globalState } from './globalState'\n\nexport const removeDialog = (): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_DIALOG_CLOSE)\n}\n\nexport const createDialog = (url: string): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_DIALOG_OPEN, url)\n}\n", "import { globalState } from './globalState'\nimport { IRanchWebShopCallProperties, ITrackPayload } from './types'\nimport { getTokenAndLanguage, msToSec } from './utils'\n\nexport const trackOpenAction = (sid: string): void => {\n const config = globalState.getConfig()\n const store = globalState.getStore()\n const now = Date.now()\n const parameters = getTokenAndLanguage(store)\n const { zoneId } = parameters\n const sessionId = sid\n const { playerId, gameId, networkId, instanceId, sourceId } = store\n trackAction({\n eventId: config.WEB_SHOP_CALL_TRACK_ID,\n date: msToSec(now),\n unixtimeMS: now,\n sessionId,\n zoneId: zoneId ? Number.parseInt(zoneId, 10) : undefined,\n playerId: Number.parseInt(playerId as string, 10),\n gameId: Number.parseInt(gameId, 10),\n networkId: Number.parseInt(networkId, 10),\n instanceId: Number.parseInt(instanceId, 10),\n sourceId,\n } as IRanchWebShopCallProperties)\n}\n\nexport const trackAction = (payload: ITrackPayload): void => {\n const config = globalState.getConfig()\n const cxf = globalState.getCxf()\n cxf.emit(config.CXF_TRACK_MSG, payload)\n}\n", "export const whitelistedZones = new Set([218, 316, 318, 460, 461, 768, 802, 814, 830, 877])\n", "import { createDialog } from '../dialog'\nimport { fetchUnreadOfferNotificationsCount } from '../fetch'\nimport { globalState } from '../globalState'\nimport { trackOpenAction } from '../track'\nimport {\n OnLemonstandCategoryUpdateProperties,\n OnLemonstandNotificationsCreatedProperties,\n OnRewardProperties,\n PushHandlers,\n WebshopEvents,\n} from '../types'\nimport { log, logError } from '../utils'\nimport { createIframeUrl } from '../utils/url'\n\nexport const onReward = (payload: OnRewardProperties): void => {\n log('OnReward: payload', payload)\n const { isCanvas } = globalState.getStore()\n if (isCanvas) {\n window.CanvasAgent?.instance?.hide()\n window.CanvasAgent?.instance?.navigate()\n return\n }\n const url = createIframeUrl({\n route: encodeURIComponent(payload.successUrl),\n ...payload,\n })\n globalState.updateStore({\n lastPurchaseTab: payload.page,\n sourceId: 'successfulPayoutReward',\n })\n trackOpenAction(payload.sid)\n\n createDialog(url)\n}\n\nexport const onLemonstandCategoryUpdate = ({ target, action, data }: OnLemonstandCategoryUpdateProperties): void => {\n globalState.shopMessageBus.post({\n eventName: WebshopEvents.LEMONSTAND_CATEGORY_UPDATE,\n target,\n data: { action, data },\n })\n}\n\n/**\n * this handler works in case of offer notification activation and deactivation\n */\nexport const onLemonstandNotificationsCreated = ({ notifCount }: OnLemonstandNotificationsCreatedProperties): void => {\n log('onLemonstandNotificationsCreated -> notifCount:', notifCount)\n const store = globalState.getStore()\n if (notifCount > 0) {\n // random delay in range 1-120 sec on LIVE, and 1-15 sec on TEST\n const randomDelayMs = Math.floor(Math.random() * (Number(store.networkId) < 250 ? 120_000 : 15_000))\n setTimeout(() => {\n fetchUnreadOfferNotificationsCount()\n }, randomDelayMs)\n } else {\n store.gameApi.invokeFn('setUnseenOffersCounter', 0).catch((error) => {\n logError('setUnseenOffersCounter error:', error)\n })\n }\n}\n\nexport const createPushHandlers = (): PushHandlers => {\n return {\n reward: onReward,\n reward_received: onReward,\n [WebshopEvents.LEMONSTAND_CATEGORY_UPDATE]: onLemonstandCategoryUpdate,\n [WebshopEvents.LEMONSTAND_NOTIFICATIONS_CREATED]: onLemonstandNotificationsCreated,\n }\n}\n", "import { createDialog } from '../dialog'\nimport { fetchUnreadOfferNotificationsCount } from '../fetch'\nimport { globalState } from '../globalState'\nimport { Handlers, WebshopEvents } from '../types'\nimport { createSessionId, log } from '../utils'\nimport { createIframeUrl } from '../utils/url'\n\nexport const onSalesPageOpen = (): void => {\n log('OnOpenSalesOffersPage')\n const { isCanvas } = globalState.getStore()\n if (isCanvas) {\n window.CanvasAgent?.instance?.navigate('supersale')\n return\n }\n\n const sid = createSessionId()\n const url = createIframeUrl({\n page: 'sale-offers',\n sid,\n })\n createDialog(url)\n}\n\nexport const onLemonstandClose = (): void => {\n const store = globalState.getStore()\n log('onLemonstandClose', store)\n fetchUnreadOfferNotificationsCount()\n}\n\nexport const createPostMessageHandlers = (): Handlers => {\n return {\n [WebshopEvents.CXF_OPEN_SALES_MSG]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IAAI;AACxB,oBAAQ,KAAK,OAAO;AAAA,UACxB;AAAA,QACJ;AAAA,MACJ,CAAC;AAAA,IACL;AAGA,eAAW,WAAW,cAAc;AAChC,cAAQ,GAAG;AAAA,IACf;AAEA,gBAAY,iBAAiB;AAC7B,QAAI,iBAAiB;AAAA,EACzB;;;ADtBA,iBAAsC,KAAK,CAAC,QAAc;AAEtD,UAAM,SAAS,aAAa,IAAI,MAAM;AACtC,gBAAY,UAAU,MAAM;AAC5B,gBAAY,OAAO,GAAG;AAEtB,UAAM,QAAQ,gBAAgB,GAAG;AACjC,gBAAY,SAAS,KAAK;AAG1B,eAAW,OAAO,gBAA0B,EACvC,KAAK,MAAM;AACR,UAAI,wBAAwB,OAAO,gBAAgB,EAAE;AAAA,IACzD,CAAC,EACA,MAAM,CAAC,UAAiB;AACrB,eAAS,2BAA2B,KAAK;AAAA,IAC7C,CAAC;AAGL,QAAI,GAAG;AAAA,EACX,CAAC;",
6
6
  "names": ["debug", "require_dist", "a", "o", "e", "n", "c", "i", "m", "$", "CxfEvents", "debug", "import_cxf_events"]
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@goodgamestudios/cxf-webshop",
3
3
  "description": "WebShop CXF Module",
4
- "version": "7.1.0-qa.1",
4
+ "version": "7.1.0-qa.3",
5
5
  "keywords": [],
6
6
  "license": "UNLICENSED",
7
7
  "repository": {