@thefittingroom/shop-ui 3.0.0-alpha-1 → 3.0.0-alpha-3
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/esm/components/Vto.d.ts +7 -0
- package/dist/esm/index.js +44 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +2 -2
- package/dist/esm/tfr.d.ts +2 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v3.0.0-alpha-
|
|
2
|
+
* thefittingroom v3.0.0-alpha-3 (2025-01-17T20:40:51.077Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function loadImageRecursive(imageURL, imageURLs) {
|
|
@@ -26587,6 +26587,42 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
26587
26587
|
FitNames: FitNames
|
|
26588
26588
|
});
|
|
26589
26589
|
|
|
26590
|
+
class VtoComponent {
|
|
26591
|
+
constructor(vtoMainDivId) {
|
|
26592
|
+
this.vtoMainDivId = vtoMainDivId;
|
|
26593
|
+
this.isInit = false;
|
|
26594
|
+
}
|
|
26595
|
+
init() {
|
|
26596
|
+
if (this.isInit)
|
|
26597
|
+
return;
|
|
26598
|
+
const vtoMainDiv = document.getElementById(this.vtoMainDivId);
|
|
26599
|
+
if (!vtoMainDiv)
|
|
26600
|
+
throw new Error(`Element with id ${this.vtoMainDivId} not found`);
|
|
26601
|
+
vtoMainDiv.innerHTML = `
|
|
26602
|
+
<div class="tfr-slider-wrapper">
|
|
26603
|
+
<img id="tfr-tryon-image" src="" />
|
|
26604
|
+
<input type="range" id="tfr-slider" />
|
|
26605
|
+
</div>
|
|
26606
|
+
`;
|
|
26607
|
+
this.isInit = true;
|
|
26608
|
+
}
|
|
26609
|
+
onNewFramesReady(frames) {
|
|
26610
|
+
const tryOnImage = document.getElementById('tfr-tryon-image');
|
|
26611
|
+
const onChange = (slider, imageUrl) => {
|
|
26612
|
+
console.debug('slider change', slider, imageUrl);
|
|
26613
|
+
tryOnImage.src = imageUrl;
|
|
26614
|
+
};
|
|
26615
|
+
const slider = InitImageSlider('tfr-slider', onChange);
|
|
26616
|
+
if (Array.isArray(frames) && frames.length > 0) {
|
|
26617
|
+
const e = slider.Load(frames);
|
|
26618
|
+
if (e instanceof Error) {
|
|
26619
|
+
console.error(e);
|
|
26620
|
+
return;
|
|
26621
|
+
}
|
|
26622
|
+
}
|
|
26623
|
+
}
|
|
26624
|
+
}
|
|
26625
|
+
|
|
26590
26626
|
var L = {
|
|
26591
26627
|
AssociatedEmail: 'If there is an account associated with that email, We have sent a link to reset your password.',
|
|
26592
26628
|
BackToSignIn: 'Back to sign in',
|
|
@@ -27904,7 +27940,7 @@ var AvatarState;
|
|
|
27904
27940
|
})(AvatarState || (AvatarState = {}));
|
|
27905
27941
|
|
|
27906
27942
|
class FittingRoom {
|
|
27907
|
-
constructor(shopId, modalDivId, sizeRecMainDivId, hooks = {}, cssVariables, _env) {
|
|
27943
|
+
constructor(shopId, modalDivId, sizeRecMainDivId, vtoMainDivId, hooks = {}, cssVariables, _env) {
|
|
27908
27944
|
this.shopId = shopId;
|
|
27909
27945
|
this.hooks = hooks;
|
|
27910
27946
|
this.isLoggedIn = false;
|
|
@@ -27919,6 +27955,10 @@ class FittingRoom {
|
|
|
27919
27955
|
this.tfrModal = new TfrModal(modalDivId, this.signIn.bind(this), this.forgotPassword.bind(this), this.submitTel.bind(this));
|
|
27920
27956
|
this.tfrShop = initShop(Number(this.shopId), env);
|
|
27921
27957
|
this.tfrSizeRec = new TfrSizeRec(sizeRecMainDivId, cssVariables, this.tfrShop, this.onSignInClick.bind(this), this.signOut.bind(this), this.onFitInfoClick.bind(this), this.onTryOnClick.bind(this));
|
|
27958
|
+
try {
|
|
27959
|
+
this.vtoComponent = new VtoComponent(vtoMainDivId);
|
|
27960
|
+
}
|
|
27961
|
+
catch (_a) { }
|
|
27922
27962
|
}
|
|
27923
27963
|
get shop() {
|
|
27924
27964
|
return this.tfrShop;
|
|
@@ -28019,7 +28059,8 @@ class FittingRoom {
|
|
|
28019
28059
|
}
|
|
28020
28060
|
async onTryOnClick(styleId, sizeId) {
|
|
28021
28061
|
const frames = await this.shop.tryOn(styleId, sizeId);
|
|
28022
|
-
this.
|
|
28062
|
+
this.vtoComponent.init();
|
|
28063
|
+
this.vtoComponent.onNewFramesReady(frames);
|
|
28023
28064
|
}
|
|
28024
28065
|
onUserProfileChange(userProfile) {
|
|
28025
28066
|
var _a, _b, _c, _d;
|