@thefittingroom/shop-ui 0.0.15 → 0.0.16
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/README.md +7 -1
- package/dist/esm/components/locale.d.ts +1 -0
- package/dist/esm/index.js +24 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +3 -3
- package/dist/esm/tfr.d.ts +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ const hooks: TfrHooks = {
|
|
|
27
27
|
onLoading: () => {},
|
|
28
28
|
onLoadingComplete: () => {},
|
|
29
29
|
onVtoReady: (frames: string[]) => {},
|
|
30
|
-
onError: () => {},
|
|
30
|
+
onError: (error: string) => {},
|
|
31
31
|
onLogin: () => {},
|
|
32
32
|
onLogout: () => {},
|
|
33
33
|
}
|
|
@@ -39,8 +39,14 @@ const modalDivId: string = 'tfr-modal'
|
|
|
39
39
|
const tfr = await initFittingRoom(shopId, modalDivId, hooks)
|
|
40
40
|
|
|
41
41
|
// on page nav to new product
|
|
42
|
+
// * Required for VTO
|
|
42
43
|
tfr.setSku(sku)
|
|
43
44
|
|
|
45
|
+
// on user login to brand site
|
|
46
|
+
// * Required for VTO
|
|
47
|
+
// e.g. uuid, email address, username, internal database Id
|
|
48
|
+
tft.setBrandUserId(brandUserId)
|
|
49
|
+
|
|
44
50
|
// close the modal
|
|
45
51
|
tfr.close()
|
|
46
52
|
```
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v0.0.
|
|
2
|
+
* thefittingroom v0.0.16 (2023-09-05T16:47:56.281Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/*!
|
|
6
|
-
* thefittingroom v0.0.
|
|
6
|
+
* thefittingroom v0.0.11 (2023-09-04T22:52:56.755Z)
|
|
7
7
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -22772,6 +22772,12 @@ class RecommendedAvailableSizesError extends Error {
|
|
|
22772
22772
|
this.available_sizes = available_sizes;
|
|
22773
22773
|
}
|
|
22774
22774
|
}
|
|
22775
|
+
class BrandUserIdNotSetError extends Error {
|
|
22776
|
+
constructor() {
|
|
22777
|
+
super('brand user id not set');
|
|
22778
|
+
this.name = 'BrandUserIdNotSetError';
|
|
22779
|
+
}
|
|
22780
|
+
}
|
|
22775
22781
|
// Backend responses
|
|
22776
22782
|
const AvatarNotCreated = 'avatar not created';
|
|
22777
22783
|
|
|
@@ -22784,12 +22790,14 @@ var errors = /*#__PURE__*/Object.freeze({
|
|
|
22784
22790
|
NoColorwaySizeAssetsFoundError: NoColorwaySizeAssetsFoundError,
|
|
22785
22791
|
NoStylesFoundError: NoStylesFoundError,
|
|
22786
22792
|
RecommendedAvailableSizesError: RecommendedAvailableSizesError,
|
|
22793
|
+
BrandUserIdNotSetError: BrandUserIdNotSetError,
|
|
22787
22794
|
AvatarNotCreated: AvatarNotCreated
|
|
22788
22795
|
});
|
|
22789
22796
|
|
|
22790
22797
|
class FirebaseUser {
|
|
22791
22798
|
constructor(firestore, app) {
|
|
22792
22799
|
this.firestore = firestore;
|
|
22800
|
+
this.brandUserId = null;
|
|
22793
22801
|
this.auth = getAuth(app);
|
|
22794
22802
|
this.auth.setPersistence(browserLocalPersistence);
|
|
22795
22803
|
}
|
|
@@ -22809,6 +22817,9 @@ class FirebaseUser {
|
|
|
22809
22817
|
setUser(user) {
|
|
22810
22818
|
this.user = user;
|
|
22811
22819
|
}
|
|
22820
|
+
setBrandUserId(brandUserId) {
|
|
22821
|
+
this.brandUserId = brandUserId;
|
|
22822
|
+
}
|
|
22812
22823
|
async getToken() {
|
|
22813
22824
|
var _a;
|
|
22814
22825
|
if (!((_a = this.user) === null || _a === void 0 ? void 0 : _a.uid))
|
|
@@ -23112,7 +23123,11 @@ class TfrShop {
|
|
|
23112
23123
|
async requestColorwaySizeAssetFrames(colorwaySizeAssetId) {
|
|
23113
23124
|
if (!this.isLoggedIn)
|
|
23114
23125
|
throw new UserNotLoggedInError();
|
|
23115
|
-
|
|
23126
|
+
if (!this.user.brandUserId)
|
|
23127
|
+
throw new BrandUserIdNotSetError();
|
|
23128
|
+
await Fetcher.Post(this.user, `/colorway-size-assets/${colorwaySizeAssetId}/frames`, {
|
|
23129
|
+
brand_user_id: String(this.user.brandUserId),
|
|
23130
|
+
});
|
|
23116
23131
|
}
|
|
23117
23132
|
async getColorwaySizeAssetFrames(colorwaySizeAssetSKU) {
|
|
23118
23133
|
var _a, _b, _c;
|
|
@@ -23191,6 +23206,7 @@ const InitImageSlider = (sliderID, onChange) => {
|
|
|
23191
23206
|
var L = {
|
|
23192
23207
|
AssociatedEmail: 'If there is an account associated with that email, We have sent a link to reset your password.',
|
|
23193
23208
|
BackToSignIn: 'Back to sign in',
|
|
23209
|
+
BrandUserIdNotSet: 'User not logged in to brand site.',
|
|
23194
23210
|
CreateAvatarSc: 'Scan the QR code/click link to download our app and create an avatar:',
|
|
23195
23211
|
DontHaveAcc: "Don't have an account?",
|
|
23196
23212
|
DontHaveAvatar: "Whoops! Looks like you don't have an avatar yet.",
|
|
@@ -36281,6 +36297,9 @@ class FittingRoom {
|
|
|
36281
36297
|
this.nav.onError(L.SomethingWentWrong);
|
|
36282
36298
|
}
|
|
36283
36299
|
}
|
|
36300
|
+
setBrandUserId(brandUserId) {
|
|
36301
|
+
this.tfrShop.user.setBrandUserId(brandUserId);
|
|
36302
|
+
}
|
|
36284
36303
|
async submitTel(tel) {
|
|
36285
36304
|
try {
|
|
36286
36305
|
await this.tfrShop.submitTelephoneNumber(tel);
|
|
@@ -36319,6 +36338,8 @@ class FittingRoom {
|
|
|
36319
36338
|
this.hooks.onVtoReady(frames);
|
|
36320
36339
|
}
|
|
36321
36340
|
catch (error) {
|
|
36341
|
+
if (error instanceof errors.BrandUserIdNotSetError)
|
|
36342
|
+
return this.nav.onError(L.BrandUserIdNotSet);
|
|
36322
36343
|
if (error instanceof errors.AvatarNotCreatedError)
|
|
36323
36344
|
return this.nav.onError(L.DontHaveAvatar);
|
|
36324
36345
|
if (error instanceof errors.RecommendedAvailableSizesError)
|