@primestyleai/tryon 5.6.11 → 5.6.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/react/index.js
CHANGED
|
@@ -8633,6 +8633,7 @@ function BasicsStepMobile({
|
|
|
8633
8633
|
onSwitchToScan,
|
|
8634
8634
|
onNext,
|
|
8635
8635
|
canProceed,
|
|
8636
|
+
fastPathLabel,
|
|
8636
8637
|
error,
|
|
8637
8638
|
t
|
|
8638
8639
|
}) {
|
|
@@ -8808,7 +8809,7 @@ function BasicsStepMobile({
|
|
|
8808
8809
|
className: "ps-bpm-next-btn",
|
|
8809
8810
|
onClick: onNext,
|
|
8810
8811
|
disabled: !canProceed,
|
|
8811
|
-
children: t("Next")
|
|
8812
|
+
children: fastPathLabel || t("Next")
|
|
8812
8813
|
}
|
|
8813
8814
|
),
|
|
8814
8815
|
/* @__PURE__ */ jsx(
|
|
@@ -9079,6 +9080,8 @@ function BodyProfileView({
|
|
|
9079
9080
|
setSizingUnit,
|
|
9080
9081
|
onComplete,
|
|
9081
9082
|
onSnapSubmit,
|
|
9083
|
+
hasActiveProfileWithMeasurements = false,
|
|
9084
|
+
onUseActiveProfile,
|
|
9082
9085
|
onBack,
|
|
9083
9086
|
t
|
|
9084
9087
|
}) {
|
|
@@ -9490,8 +9493,9 @@ function BodyProfileView({
|
|
|
9490
9493
|
switchToImperial,
|
|
9491
9494
|
onUploadPhoto: () => setStep("photo"),
|
|
9492
9495
|
onSwitchToScan: () => setStep("photo"),
|
|
9493
|
-
onNext: handleNext,
|
|
9496
|
+
onNext: hasActiveProfileWithMeasurements && onUseActiveProfile ? onUseActiveProfile : handleNext,
|
|
9494
9497
|
canProceed: true,
|
|
9498
|
+
fastPathLabel: hasActiveProfileWithMeasurements ? t("Find My Best Fit") : void 0,
|
|
9495
9499
|
error,
|
|
9496
9500
|
t
|
|
9497
9501
|
},
|
|
@@ -9741,23 +9745,28 @@ function BodyProfileView({
|
|
|
9741
9745
|
})(),
|
|
9742
9746
|
error && /* @__PURE__ */ jsx("p", { className: "ps-bp-error", children: error })
|
|
9743
9747
|
] }, "step-bra"),
|
|
9744
|
-
!(isMobile && step === "basics") &&
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9748
|
+
!(isMobile && step === "basics") && (() => {
|
|
9749
|
+
const useProfileFast = step === "basics" && hasActiveProfileWithMeasurements && !!onUseActiveProfile;
|
|
9750
|
+
const handleClick = useProfileFast ? onUseActiveProfile : handleNext;
|
|
9751
|
+
const label = useProfileFast ? t("Find My Best Fit") : isLastStep ? t("Find My Size") : t("Next");
|
|
9752
|
+
return /* @__PURE__ */ jsxs("div", { className: "ps-bp-nav", children: [
|
|
9753
|
+
step !== "basics" ? /* @__PURE__ */ jsxs("button", { className: "ps-bp-back-btn", onClick: handleBackStep, type: "button", children: [
|
|
9754
|
+
/* @__PURE__ */ jsx("span", { className: "ps-bp-back-arrow", children: "←" }),
|
|
9755
|
+
" ",
|
|
9756
|
+
t("Back")
|
|
9757
|
+
] }) : /* @__PURE__ */ jsx("span", {}),
|
|
9758
|
+
/* @__PURE__ */ jsx(
|
|
9759
|
+
"button",
|
|
9760
|
+
{
|
|
9761
|
+
className: `ps-bp-next-btn${!useProfileFast && !canProceed ? " ps-bp-btn-disabled" : ""}`,
|
|
9762
|
+
onClick: handleClick,
|
|
9763
|
+
disabled: !useProfileFast && !canProceed,
|
|
9764
|
+
type: "button",
|
|
9765
|
+
children: label
|
|
9766
|
+
}
|
|
9767
|
+
)
|
|
9768
|
+
] });
|
|
9769
|
+
})()
|
|
9761
9770
|
] })
|
|
9762
9771
|
] }) });
|
|
9763
9772
|
}
|
|
@@ -10034,6 +10043,26 @@ function PrimeStyleTryonInner({
|
|
|
10034
10043
|
},
|
|
10035
10044
|
[activeProfileId, profiles, apiUrl, productImage, productTitle, effectiveProductId, setActiveProfileId$1]
|
|
10036
10045
|
);
|
|
10046
|
+
const handleUseActiveProfile = useCallback(() => {
|
|
10047
|
+
const p = profiles.find((x) => x.id === activeProfileId);
|
|
10048
|
+
if (!p || !p.measurements || Object.keys(p.measurements).length === 0) return;
|
|
10049
|
+
setSizingResult(null);
|
|
10050
|
+
setSizingLoading(true);
|
|
10051
|
+
setEstimationDone(true);
|
|
10052
|
+
setView("size-result");
|
|
10053
|
+
recommendForProduct({
|
|
10054
|
+
productId: effectiveProductId,
|
|
10055
|
+
productTitle,
|
|
10056
|
+
productImage,
|
|
10057
|
+
sizeGuideData,
|
|
10058
|
+
profile: p,
|
|
10059
|
+
apiUrl,
|
|
10060
|
+
skipCache: true
|
|
10061
|
+
}).then((res) => {
|
|
10062
|
+
if (res?.raw) setSizingResult(res.raw);
|
|
10063
|
+
}).catch(() => {
|
|
10064
|
+
}).finally(() => setSizingLoading(false));
|
|
10065
|
+
}, [profiles, activeProfileId, effectiveProductId, productTitle, productImage, sizeGuideData, apiUrl]);
|
|
10037
10066
|
const applyProfileRef = useRef(() => {
|
|
10038
10067
|
});
|
|
10039
10068
|
const handleOpen = useCallback(() => {
|
|
@@ -10861,6 +10890,11 @@ function PrimeStyleTryonInner({
|
|
|
10861
10890
|
setWeightUnit,
|
|
10862
10891
|
sizingUnit,
|
|
10863
10892
|
setSizingUnit,
|
|
10893
|
+
hasActiveProfileWithMeasurements: (() => {
|
|
10894
|
+
const p = profiles.find((x) => x.id === activeProfileId);
|
|
10895
|
+
return !!(p && p.measurements && Object.keys(p.measurements).length > 0);
|
|
10896
|
+
})(),
|
|
10897
|
+
onUseActiveProfile: handleUseActiveProfile,
|
|
10864
10898
|
onComplete: (data) => {
|
|
10865
10899
|
formRef.current.gender = data.gender;
|
|
10866
10900
|
if (data.bandSize) formRef.current.bandSize = data.bandSize;
|
|
@@ -10975,30 +11009,7 @@ function PrimeStyleTryonInner({
|
|
|
10975
11009
|
activeProfileId,
|
|
10976
11010
|
onSelectProfile: (id) => {
|
|
10977
11011
|
setActiveProfileId$1(id);
|
|
10978
|
-
|
|
10979
|
-
if (!p || !p.measurements || Object.keys(p.measurements).length === 0) {
|
|
10980
|
-
setView("body-profile");
|
|
10981
|
-
return;
|
|
10982
|
-
}
|
|
10983
|
-
setSizingResult(null);
|
|
10984
|
-
setSizingLoading(true);
|
|
10985
|
-
setEstimationDone(true);
|
|
10986
|
-
setView("size-result");
|
|
10987
|
-
recommendForProduct({
|
|
10988
|
-
productId: effectiveProductId,
|
|
10989
|
-
productTitle,
|
|
10990
|
-
productImage,
|
|
10991
|
-
sizeGuideData,
|
|
10992
|
-
profile: p,
|
|
10993
|
-
apiUrl,
|
|
10994
|
-
skipCache: true
|
|
10995
|
-
// always re-recommend on explicit profile select
|
|
10996
|
-
}).then((res) => {
|
|
10997
|
-
if (res?.raw) {
|
|
10998
|
-
setSizingResult(res.raw);
|
|
10999
|
-
}
|
|
11000
|
-
}).catch(() => {
|
|
11001
|
-
}).finally(() => setSizingLoading(false));
|
|
11012
|
+
setView("body-profile");
|
|
11002
11013
|
},
|
|
11003
11014
|
onSaveProfileMeasurements: (id, measurements) => {
|
|
11004
11015
|
updateProfileMeasurements(id, measurements, profiles.find((x) => x.id === id)?.measurementsUnit || "cm");
|
|
@@ -22,8 +22,11 @@ interface BasicsStepMobileProps {
|
|
|
22
22
|
onNext: () => void;
|
|
23
23
|
/** Whether the Next button should be enabled */
|
|
24
24
|
canProceed: boolean;
|
|
25
|
+
/** Optional override label for the Next button (e.g. "Find My Best Fit"
|
|
26
|
+
* when an active profile is selected and we're skipping the wizard) */
|
|
27
|
+
fastPathLabel?: string;
|
|
25
28
|
error: string;
|
|
26
29
|
t: TranslateFn;
|
|
27
30
|
}
|
|
28
|
-
export declare function BasicsStepMobile({ hUnit, wUnit, isImperialMode, height, setHeight, heightFeet, setHeightFeet, heightInches, setHeightInches, weight, setWeight, age, setAge, switchToMetric, switchToImperial, onUploadPhoto, onSwitchToScan, onNext, canProceed, error, t, }: BasicsStepMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function BasicsStepMobile({ hUnit, wUnit, isImperialMode, height, setHeight, heightFeet, setHeightFeet, heightInches, setHeightInches, weight, setWeight, age, setAge, switchToMetric, switchToImperial, onUploadPhoto, onSwitchToScan, onNext, canProceed, fastPathLabel, error, t, }: BasicsStepMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
29
32
|
export {};
|
|
@@ -36,8 +36,14 @@ interface BodyProfileViewProps {
|
|
|
36
36
|
gender: string;
|
|
37
37
|
age?: number;
|
|
38
38
|
}) => void;
|
|
39
|
+
/** True if the user has an active profile with stored measurements —
|
|
40
|
+
* changes the basics step Next button to "Find My Best Fit" */
|
|
41
|
+
hasActiveProfileWithMeasurements?: boolean;
|
|
42
|
+
/** Fast-path callback: skip the rest of the wizard and run /sizing/recommend
|
|
43
|
+
* with the active profile's stored measurements directly. */
|
|
44
|
+
onUseActiveProfile?: () => void;
|
|
39
45
|
onBack: () => void;
|
|
40
46
|
t: TranslateFn;
|
|
41
47
|
}
|
|
42
|
-
export declare function BodyProfileView({ productImage, productTitle, isWomen, formRef, sizingCountry, heightUnit, setHeightUnit, weightUnit, setWeightUnit, sizingUnit, setSizingUnit, onComplete, onSnapSubmit, onBack, t, }: BodyProfileViewProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function BodyProfileView({ productImage, productTitle, isWomen, formRef, sizingCountry, heightUnit, setHeightUnit, weightUnit, setWeightUnit, sizingUnit, setSizingUnit, onComplete, onSnapSubmit, hasActiveProfileWithMeasurements, onUseActiveProfile, onBack, t, }: BodyProfileViewProps): import("react/jsx-runtime").JSX.Element;
|
|
43
49
|
export {};
|