@shipeasy/sdk 2.1.13 → 2.1.15

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.
@@ -798,9 +798,18 @@ function labelAttrs(key, variables, desc) {
798
798
  }
799
799
  var _createElement = null;
800
800
  var _I18N_SSR_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-i18n");
801
+ var _I18N_CACHE_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-i18n-cache");
801
802
  var _EDIT_MODE_SSR_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode");
802
803
  function getSSRI18nStore() {
803
- return globalThis[_I18N_SSR_SYM]?.() ?? null;
804
+ const fromGetter = globalThis[_I18N_SSR_SYM]?.();
805
+ if (fromGetter && Object.keys(fromGetter.strings).length > 0) return fromGetter;
806
+ const cache = globalThis[_I18N_CACHE_SYM];
807
+ if (cache) {
808
+ for (const v of cache.values()) {
809
+ if (Object.keys(v.strings).length > 0) return v;
810
+ }
811
+ }
812
+ return fromGetter ?? null;
804
813
  }
805
814
  var _EDIT_MODE_FALLBACK_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode-fallback");
806
815
  function isEditLabelsMode() {
@@ -755,9 +755,18 @@ function labelAttrs(key, variables, desc) {
755
755
  }
756
756
  var _createElement = null;
757
757
  var _I18N_SSR_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-i18n");
758
+ var _I18N_CACHE_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-i18n-cache");
758
759
  var _EDIT_MODE_SSR_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode");
759
760
  function getSSRI18nStore() {
760
- return globalThis[_I18N_SSR_SYM]?.() ?? null;
761
+ const fromGetter = globalThis[_I18N_SSR_SYM]?.();
762
+ if (fromGetter && Object.keys(fromGetter.strings).length > 0) return fromGetter;
763
+ const cache = globalThis[_I18N_CACHE_SYM];
764
+ if (cache) {
765
+ for (const v of cache.values()) {
766
+ if (Object.keys(v.strings).length > 0) return v;
767
+ }
768
+ }
769
+ return fromGetter ?? null;
761
770
  }
762
771
  var _EDIT_MODE_FALLBACK_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode-fallback");
763
772
  function isEditLabelsMode() {
@@ -539,7 +539,7 @@ function getBootstrapHtml(bootstrap, i18nData, opts) {
539
539
  if (i18nData) payload.i18n = i18nData;
540
540
  if (opts.editLabels) payload.editLabels = true;
541
541
  parts.push(
542
- `(function(){if(!new URLSearchParams(location.search).has('se_edit_labels'))return;try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
542
+ `(function(){var Q=new URLSearchParams(location.search).has('se_edit_labels');var C=/(?:^|;\\s*)se_edit_labels=1(?:;|$)/.test(document.cookie);if(!Q&&!C)return;if(Q){try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
543
543
  );
544
544
  parts.push(`window.__SE_BOOTSTRAP=${JSON.stringify(payload)};`);
545
545
  if (i18nData?.strings && Object.keys(i18nData.strings).length > 0) {
@@ -496,7 +496,7 @@ function getBootstrapHtml(bootstrap, i18nData, opts) {
496
496
  if (i18nData) payload.i18n = i18nData;
497
497
  if (opts.editLabels) payload.editLabels = true;
498
498
  parts.push(
499
- `(function(){if(!new URLSearchParams(location.search).has('se_edit_labels'))return;try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
499
+ `(function(){var Q=new URLSearchParams(location.search).has('se_edit_labels');var C=/(?:^|;\\s*)se_edit_labels=1(?:;|$)/.test(document.cookie);if(!Q&&!C)return;if(Q){try{document.cookie='se_edit_labels=1;path=/;max-age=86400;samesite=lax';}catch(_){}}var R;function P(v){if(!v||typeof v.t!=='function'||v.__sePatched)return;var O=v.t.bind(v);v.__sePatched=true;window._sei18n_t=O;v.t=function(k,vars){var r=O(k,vars);if(r===k)return k;var V='';try{if(vars&&typeof vars==='object'){var hasKey=false;for(var _k in vars){hasKey=true;break;}if(hasKey)V=JSON.stringify(vars);}}catch(_){V='';}return '\\uFFF9'+k+'\\uFFFA'+V+'\\uFFFA'+r+'\\uFFFB';};}Object.defineProperty(window,'i18n',{configurable:true,get:function(){return R;},set:function(v){P(v);R=v;}});})();`
500
500
  );
501
501
  parts.push(`window.__SE_BOOTSTRAP=${JSON.stringify(payload)};`);
502
502
  if (i18nData?.strings && Object.keys(i18nData.strings).length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipeasy/sdk",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
4
4
  "description": "Shipeasy SDK — feature gates, runtime configs, experiments, and metrics for the Shipeasy hosted service.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://shipeasy.ai",