@shipeasy/sdk 2.1.11 → 2.1.12
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/dist/client/index.js +5 -1
- package/dist/client/index.mjs +5 -1
- package/dist/server/index.js +10 -3
- package/dist/server/index.mjs +10 -3
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -791,12 +791,16 @@ var _EDIT_MODE_SSR_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode
|
|
|
791
791
|
function getSSRI18nStore() {
|
|
792
792
|
return globalThis[_I18N_SSR_SYM]?.() ?? null;
|
|
793
793
|
}
|
|
794
|
+
var _EDIT_MODE_FALLBACK_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode-fallback");
|
|
794
795
|
function isEditLabelsMode() {
|
|
795
796
|
if (typeof window !== "undefined") {
|
|
796
797
|
return !!window.__SE_BOOTSTRAP?.editLabels || new URLSearchParams(location.search).has("se_edit_labels");
|
|
797
798
|
}
|
|
798
799
|
const val = globalThis[_EDIT_MODE_SSR_SYM];
|
|
799
|
-
|
|
800
|
+
if (typeof val === "boolean") return val;
|
|
801
|
+
if (typeof val === "function") return val();
|
|
802
|
+
const fb = globalThis[_EDIT_MODE_FALLBACK_SYM];
|
|
803
|
+
return typeof fb === "boolean" ? fb : false;
|
|
800
804
|
}
|
|
801
805
|
function interpolate(raw, variables) {
|
|
802
806
|
if (!variables) return raw;
|
package/dist/client/index.mjs
CHANGED
|
@@ -748,12 +748,16 @@ var _EDIT_MODE_SSR_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode
|
|
|
748
748
|
function getSSRI18nStore() {
|
|
749
749
|
return globalThis[_I18N_SSR_SYM]?.() ?? null;
|
|
750
750
|
}
|
|
751
|
+
var _EDIT_MODE_FALLBACK_SYM = /* @__PURE__ */ Symbol.for("@shipeasy/sdk:ssr-edit-mode-fallback");
|
|
751
752
|
function isEditLabelsMode() {
|
|
752
753
|
if (typeof window !== "undefined") {
|
|
753
754
|
return !!window.__SE_BOOTSTRAP?.editLabels || new URLSearchParams(location.search).has("se_edit_labels");
|
|
754
755
|
}
|
|
755
756
|
const val = globalThis[_EDIT_MODE_SSR_SYM];
|
|
756
|
-
|
|
757
|
+
if (typeof val === "boolean") return val;
|
|
758
|
+
if (typeof val === "function") return val();
|
|
759
|
+
const fb = globalThis[_EDIT_MODE_FALLBACK_SYM];
|
|
760
|
+
return typeof fb === "boolean" ? fb : false;
|
|
757
761
|
}
|
|
758
762
|
function interpolate(raw, variables) {
|
|
759
763
|
if (!variables) return raw;
|
package/dist/server/index.js
CHANGED
|
@@ -493,10 +493,17 @@ async function shipeasy(opts) {
|
|
|
493
493
|
let resolvedUrlOverrides = opts.urlOverrides;
|
|
494
494
|
if (!resolvedUrlOverrides) {
|
|
495
495
|
try {
|
|
496
|
-
const { headers } = await import("next/headers");
|
|
496
|
+
const { headers, cookies } = await import("next/headers");
|
|
497
497
|
const h = await Promise.resolve(headers());
|
|
498
498
|
const search = h.get("x-se-search") ?? "";
|
|
499
|
-
if (search)
|
|
499
|
+
if (search) {
|
|
500
|
+
resolvedUrlOverrides = search;
|
|
501
|
+
} else {
|
|
502
|
+
const c = await Promise.resolve(cookies());
|
|
503
|
+
if (c.get?.("se_edit_labels")?.value === "1") {
|
|
504
|
+
resolvedUrlOverrides = "se_edit_labels=1";
|
|
505
|
+
}
|
|
506
|
+
}
|
|
500
507
|
} catch {
|
|
501
508
|
}
|
|
502
509
|
}
|
|
@@ -532,7 +539,7 @@ function getBootstrapHtml(bootstrap, i18nData, opts) {
|
|
|
532
539
|
if (i18nData) payload.i18n = i18nData;
|
|
533
540
|
if (opts.editLabels) payload.editLabels = true;
|
|
534
541
|
parts.push(
|
|
535
|
-
`(function(){if(!new URLSearchParams(location.search).has('se_edit_labels'))return;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(){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;}});})();`
|
|
536
543
|
);
|
|
537
544
|
parts.push(`window.__SE_BOOTSTRAP=${JSON.stringify(payload)};`);
|
|
538
545
|
if (i18nData?.strings && Object.keys(i18nData.strings).length > 0) {
|
package/dist/server/index.mjs
CHANGED
|
@@ -450,10 +450,17 @@ async function shipeasy(opts) {
|
|
|
450
450
|
let resolvedUrlOverrides = opts.urlOverrides;
|
|
451
451
|
if (!resolvedUrlOverrides) {
|
|
452
452
|
try {
|
|
453
|
-
const { headers } = await import("next/headers");
|
|
453
|
+
const { headers, cookies } = await import("next/headers");
|
|
454
454
|
const h = await Promise.resolve(headers());
|
|
455
455
|
const search = h.get("x-se-search") ?? "";
|
|
456
|
-
if (search)
|
|
456
|
+
if (search) {
|
|
457
|
+
resolvedUrlOverrides = search;
|
|
458
|
+
} else {
|
|
459
|
+
const c = await Promise.resolve(cookies());
|
|
460
|
+
if (c.get?.("se_edit_labels")?.value === "1") {
|
|
461
|
+
resolvedUrlOverrides = "se_edit_labels=1";
|
|
462
|
+
}
|
|
463
|
+
}
|
|
457
464
|
} catch {
|
|
458
465
|
}
|
|
459
466
|
}
|
|
@@ -489,7 +496,7 @@ function getBootstrapHtml(bootstrap, i18nData, opts) {
|
|
|
489
496
|
if (i18nData) payload.i18n = i18nData;
|
|
490
497
|
if (opts.editLabels) payload.editLabels = true;
|
|
491
498
|
parts.push(
|
|
492
|
-
`(function(){if(!new URLSearchParams(location.search).has('se_edit_labels'))return;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(){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;}});})();`
|
|
493
500
|
);
|
|
494
501
|
parts.push(`window.__SE_BOOTSTRAP=${JSON.stringify(payload)};`);
|
|
495
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.
|
|
3
|
+
"version": "2.1.12",
|
|
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",
|