@primestyleai/tryon 2.0.4 → 2.0.5
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/react/index.js +14 -2
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -7,6 +7,7 @@ function cx(base, override) {
|
|
|
7
7
|
}
|
|
8
8
|
const LS_PREFIX = "primestyle_";
|
|
9
9
|
function lsGet(key, fallback) {
|
|
10
|
+
if (typeof window === "undefined") return fallback;
|
|
10
11
|
try {
|
|
11
12
|
const raw = localStorage.getItem(LS_PREFIX + key);
|
|
12
13
|
return raw ? JSON.parse(raw) : fallback;
|
|
@@ -37,6 +38,7 @@ const SIZING_COUNTRIES = [
|
|
|
37
38
|
const STEP_LABELS = ["", "Welcome", "Photo", "Size", "Generate", "Results"];
|
|
38
39
|
const TOTAL_STEPS = 5;
|
|
39
40
|
function detectLocale() {
|
|
41
|
+
if (typeof window === "undefined") return "US";
|
|
40
42
|
const l = (navigator.language || "en-US").toLowerCase();
|
|
41
43
|
if (l.includes("en-gb") || l.includes("en-au")) return "UK";
|
|
42
44
|
if (l.includes("en")) return "US";
|
|
@@ -204,6 +206,17 @@ function PrimeStyleTryon({
|
|
|
204
206
|
const pollingRef = useRef(null);
|
|
205
207
|
const completedRef = useRef(false);
|
|
206
208
|
const bodyRef = useRef(null);
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
const id = "ps-tryon-styles";
|
|
211
|
+
if (document.getElementById(id)) return;
|
|
212
|
+
const el = document.createElement("style");
|
|
213
|
+
el.id = id;
|
|
214
|
+
el.textContent = STYLES;
|
|
215
|
+
document.head.appendChild(el);
|
|
216
|
+
return () => {
|
|
217
|
+
el.remove();
|
|
218
|
+
};
|
|
219
|
+
}, []);
|
|
207
220
|
useEffect(() => {
|
|
208
221
|
try {
|
|
209
222
|
const key = getApiKey();
|
|
@@ -1075,8 +1088,7 @@ function PrimeStyleTryon({
|
|
|
1075
1088
|
/* @__PURE__ */ jsx("a", { href: "https://myaifitting.com", target: "_blank", rel: "noopener noreferrer", children: "PrimeStyle AI" })
|
|
1076
1089
|
] })
|
|
1077
1090
|
] }) }),
|
|
1078
|
-
/* @__PURE__ */ jsx(ProfileDetailModal, {})
|
|
1079
|
-
/* @__PURE__ */ jsx("style", { children: STYLES })
|
|
1091
|
+
/* @__PURE__ */ jsx(ProfileDetailModal, {})
|
|
1080
1092
|
] });
|
|
1081
1093
|
}
|
|
1082
1094
|
const STYLES = `
|