@thefittingroom/shop-ui 0.0.16 → 0.1.1
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/index.js +12 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +2 -2
- package/dist/esm/init.d.ts +1 -1
- package/dist/esm/tfr.d.ts +3 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v0.0.16 (2023-
|
|
2
|
+
* thefittingroom v0.0.16 (2023-11-20T17:29:10.547Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/*!
|
|
@@ -36221,9 +36221,10 @@ var AvatarState;
|
|
|
36221
36221
|
})(AvatarState || (AvatarState = {}));
|
|
36222
36222
|
|
|
36223
36223
|
class FittingRoom {
|
|
36224
|
-
constructor(shopId, modalDivId, hooks = {}, _env) {
|
|
36224
|
+
constructor(shopId, modalDivId, hooks = {}, tryOnEnabled = false, _env) {
|
|
36225
36225
|
this.shopId = shopId;
|
|
36226
36226
|
this.hooks = hooks;
|
|
36227
|
+
this.tryOnEnabled = tryOnEnabled;
|
|
36227
36228
|
// prettier-ignore
|
|
36228
36229
|
const env = _env
|
|
36229
36230
|
? _env
|
|
@@ -36286,7 +36287,8 @@ class FittingRoom {
|
|
|
36286
36287
|
break;
|
|
36287
36288
|
case AvatarState.CREATED:
|
|
36288
36289
|
console.debug('avatar_state: created');
|
|
36289
|
-
this.
|
|
36290
|
+
if (this.tryOnEnabled)
|
|
36291
|
+
this.tryOn();
|
|
36290
36292
|
break;
|
|
36291
36293
|
default:
|
|
36292
36294
|
this.nav.onError(L.SomethingWentWrong);
|
|
@@ -36326,9 +36328,14 @@ class FittingRoom {
|
|
|
36326
36328
|
const trySizes = availableSizeLabels.length > 1 ? `${tryFirstSizes} ${L.OrSize} ${lastSize}` : tryFirstSizes;
|
|
36327
36329
|
return `${trySizes}. ${L.WeRecommendSize} ${recommendedSizeLabel}.`;
|
|
36328
36330
|
}
|
|
36331
|
+
onSignInClick() {
|
|
36332
|
+
this.nav.toScan();
|
|
36333
|
+
}
|
|
36329
36334
|
async tryOn() {
|
|
36330
36335
|
if (!this.shop.isLoggedIn)
|
|
36331
36336
|
return this.nav.toScan();
|
|
36337
|
+
if (!this.tryOnEnabled)
|
|
36338
|
+
return;
|
|
36332
36339
|
try {
|
|
36333
36340
|
if (this.hooks.onLoading)
|
|
36334
36341
|
this.hooks.onLoading();
|
|
@@ -36359,8 +36366,8 @@ class FittingRoom {
|
|
|
36359
36366
|
}
|
|
36360
36367
|
}
|
|
36361
36368
|
|
|
36362
|
-
const initFittingRoom = async (shopId, modalDivId, hooks, env = 'dev') => {
|
|
36363
|
-
const tfr = new FittingRoom(shopId, modalDivId, hooks, env);
|
|
36369
|
+
const initFittingRoom = async (shopId, modalDivId, hooks, tryOnEnabled = false, env = 'dev') => {
|
|
36370
|
+
const tfr = new FittingRoom(shopId, modalDivId, hooks, tryOnEnabled, env);
|
|
36364
36371
|
await tfr.onInit();
|
|
36365
36372
|
return tfr;
|
|
36366
36373
|
};
|