c15t 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # c15t
2
2
 
3
+ ## 1.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - f6a3e5f: fix(core, react): translation overrides sometimes not set before banner is shown
8
+
3
9
  ## 1.4.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -884,9 +884,29 @@ function checkLocalStorageAccess(set) {
884
884
  }
885
885
  return false;
886
886
  }
887
- async function updateStore(data, { set, get, initialTranslationConfig }, hasLocalStorageAccess) {
887
+ function updateStore(data, { set, get, initialTranslationConfig }, hasLocalStorageAccess) {
888
888
  const { consentInfo, setDetectedCountry, callbacks, ignoreGeoLocation } = get();
889
889
  const { translations, location, jurisdiction, showConsentBanner } = data;
890
+ const updatedStore = {
891
+ isLoadingConsentInfo: false,
892
+ ...null === consentInfo ? {
893
+ showPopup: showConsentBanner && hasLocalStorageAccess || ignoreGeoLocation
894
+ } : {},
895
+ ...'NONE' === data.jurisdiction.code && !data.showConsentBanner && {
896
+ consents: {
897
+ necessary: true,
898
+ functionality: true,
899
+ experience: true,
900
+ marketing: true,
901
+ measurement: true
902
+ }
903
+ },
904
+ locationInfo: {
905
+ countryCode: location?.countryCode ?? '',
906
+ regionCode: location?.regionCode ?? ''
907
+ },
908
+ jurisdictionInfo: jurisdiction
909
+ };
890
910
  if (translations) {
891
911
  const translationConfig = (0, translations_namespaceObject.prepareTranslationConfig)({
892
912
  translations: {
@@ -895,18 +915,8 @@ async function updateStore(data, { set, get, initialTranslationConfig }, hasLoca
895
915
  disableAutoLanguageSwitch: true,
896
916
  defaultLanguage: translations.language
897
917
  }, initialTranslationConfig);
898
- set({
899
- translationConfig
900
- });
918
+ updatedStore.translationConfig = translationConfig;
901
919
  }
902
- set({
903
- locationInfo: {
904
- countryCode: location?.countryCode ?? '',
905
- regionCode: location?.regionCode ?? ''
906
- },
907
- jurisdictionInfo: jurisdiction
908
- });
909
- await new Promise((resolve)=>setTimeout(resolve, 1));
910
920
  if (data.location?.countryCode) {
911
921
  setDetectedCountry(data.location.countryCode);
912
922
  if (data.location.regionCode) callbacks.onLocationDetected?.({
@@ -914,21 +924,7 @@ async function updateStore(data, { set, get, initialTranslationConfig }, hasLoca
914
924
  regionCode: data.location.regionCode
915
925
  });
916
926
  }
917
- set({
918
- isLoadingConsentInfo: false,
919
- ...null === consentInfo ? {
920
- showPopup: showConsentBanner && hasLocalStorageAccess || ignoreGeoLocation
921
- } : {},
922
- ...'NONE' === data.jurisdiction.code && !data.showConsentBanner && {
923
- consents: {
924
- necessary: true,
925
- functionality: true,
926
- experience: true,
927
- marketing: true,
928
- measurement: true
929
- }
930
- }
931
- });
927
+ set(updatedStore);
932
928
  }
933
929
  async function fetchConsentBannerInfo(config) {
934
930
  const { get, set, manager, initialData } = config;
@@ -1208,7 +1204,7 @@ function createTrackingBlocker(config = {}, initialConsents) {
1208
1204
  };
1209
1205
  }
1210
1206
  var package_namespaceObject = {
1211
- i8: "1.4.2"
1207
+ i8: "1.4.4"
1212
1208
  };
1213
1209
  const initialState = {
1214
1210
  config: {
package/dist/index.js CHANGED
@@ -844,9 +844,29 @@ function checkLocalStorageAccess(set) {
844
844
  }
845
845
  return false;
846
846
  }
847
- async function updateStore(data, { set, get, initialTranslationConfig }, hasLocalStorageAccess) {
847
+ function updateStore(data, { set, get, initialTranslationConfig }, hasLocalStorageAccess) {
848
848
  const { consentInfo, setDetectedCountry, callbacks, ignoreGeoLocation } = get();
849
849
  const { translations, location, jurisdiction, showConsentBanner } = data;
850
+ const updatedStore = {
851
+ isLoadingConsentInfo: false,
852
+ ...null === consentInfo ? {
853
+ showPopup: showConsentBanner && hasLocalStorageAccess || ignoreGeoLocation
854
+ } : {},
855
+ ...'NONE' === data.jurisdiction.code && !data.showConsentBanner && {
856
+ consents: {
857
+ necessary: true,
858
+ functionality: true,
859
+ experience: true,
860
+ marketing: true,
861
+ measurement: true
862
+ }
863
+ },
864
+ locationInfo: {
865
+ countryCode: location?.countryCode ?? '',
866
+ regionCode: location?.regionCode ?? ''
867
+ },
868
+ jurisdictionInfo: jurisdiction
869
+ };
850
870
  if (translations) {
851
871
  const translationConfig = (0, __WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.prepareTranslationConfig)({
852
872
  translations: {
@@ -855,18 +875,8 @@ async function updateStore(data, { set, get, initialTranslationConfig }, hasLoca
855
875
  disableAutoLanguageSwitch: true,
856
876
  defaultLanguage: translations.language
857
877
  }, initialTranslationConfig);
858
- set({
859
- translationConfig
860
- });
878
+ updatedStore.translationConfig = translationConfig;
861
879
  }
862
- set({
863
- locationInfo: {
864
- countryCode: location?.countryCode ?? '',
865
- regionCode: location?.regionCode ?? ''
866
- },
867
- jurisdictionInfo: jurisdiction
868
- });
869
- await new Promise((resolve)=>setTimeout(resolve, 1));
870
880
  if (data.location?.countryCode) {
871
881
  setDetectedCountry(data.location.countryCode);
872
882
  if (data.location.regionCode) callbacks.onLocationDetected?.({
@@ -874,21 +884,7 @@ async function updateStore(data, { set, get, initialTranslationConfig }, hasLoca
874
884
  regionCode: data.location.regionCode
875
885
  });
876
886
  }
877
- set({
878
- isLoadingConsentInfo: false,
879
- ...null === consentInfo ? {
880
- showPopup: showConsentBanner && hasLocalStorageAccess || ignoreGeoLocation
881
- } : {},
882
- ...'NONE' === data.jurisdiction.code && !data.showConsentBanner && {
883
- consents: {
884
- necessary: true,
885
- functionality: true,
886
- experience: true,
887
- marketing: true,
888
- measurement: true
889
- }
890
- }
891
- });
887
+ set(updatedStore);
892
888
  }
893
889
  async function fetchConsentBannerInfo(config) {
894
890
  const { get, set, manager, initialData } = config;
@@ -1168,7 +1164,7 @@ function createTrackingBlocker(config = {}, initialConsents) {
1168
1164
  };
1169
1165
  }
1170
1166
  var package_namespaceObject = {
1171
- i8: "1.4.2"
1167
+ i8: "1.4.4"
1172
1168
  };
1173
1169
  const initialState = {
1174
1170
  config: {
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-consent-banner.d.ts","sourceRoot":"","sources":["../../src/libs/fetch-consent-banner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACN,KAAK,iBAAiB,EAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,KAAK,qBAAqB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;AAEvE;;GAEG;AACH,UAAU,wBAAwB;IACjC,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7E,wBAAwB,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACtD,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/C,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,CAAC;CAC/C;AA8FD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC3C,MAAM,EAAE,wBAAwB,GAC9B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA0E5C"}
1
+ {"version":3,"file":"fetch-consent-banner.d.ts","sourceRoot":"","sources":["../../src/libs/fetch-consent-banner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACN,KAAK,iBAAiB,EAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,KAAK,qBAAqB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;AAEvE;;GAEG;AACH,UAAU,wBAAwB;IACjC,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7E,wBAAwB,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACtD,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/C,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,CAAC;CAC/C;AA0FD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC3C,MAAM,EAAE,wBAAwB,GAC9B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA0E5C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c15t",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "license": "GPL-3.0-only",
5
5
  "type": "module",
6
6
  "exports": {