@thefittingroom/shop-ui 1.1.3 → 1.1.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/README.md +6 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,10 +23,10 @@ import { initFittingRoom } from '@thefittingroom/shop-ui'
|
|
|
23
23
|
const shopId: number = 9001
|
|
24
24
|
|
|
25
25
|
// UI Hooks
|
|
26
|
+
// These are used to hook into the lifecycle methods within the shop UI
|
|
26
27
|
const hooks: TfrHooks = {
|
|
27
28
|
onLoading: () => {},
|
|
28
29
|
onLoadingComplete: () => {},
|
|
29
|
-
onVtoReady: (frames: string[]) => {},
|
|
30
30
|
onError: (error: string) => {},
|
|
31
31
|
onLogin: () => {},
|
|
32
32
|
onLogout: () => {},
|
|
@@ -35,20 +35,18 @@ const hooks: TfrHooks = {
|
|
|
35
35
|
// the div id to contain the modal elements
|
|
36
36
|
const modalDivId: string = 'tfr-modal'
|
|
37
37
|
|
|
38
|
+
// The div id to contain the size recommendation UI
|
|
39
|
+
const sizeRecDivId: string = 'tfr-size-rec'
|
|
40
|
+
|
|
38
41
|
// initFittingRoom is an async function and must be awaited
|
|
39
|
-
const tfr = await initFittingRoom(shopId, modalDivId, hooks)
|
|
42
|
+
const tfr = await initFittingRoom(shopId, modalDivId, sizeRecDivId, hooks, 'prod')
|
|
40
43
|
|
|
41
44
|
// on page nav to new product
|
|
42
|
-
// * Required for VTO
|
|
43
45
|
tfr.setSku(sku)
|
|
44
46
|
|
|
45
47
|
// on user login to brand site
|
|
46
|
-
// * Required for VTO
|
|
47
48
|
// e.g. uuid, email address, username, internal database Id
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// close the modal
|
|
51
|
-
tfr.close()
|
|
49
|
+
tfr.setBrandUserId(brandUserId)
|
|
52
50
|
```
|
|
53
51
|
|
|
54
52
|
Several low level methods are exposed via `tfr.shop`
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.1.
|
|
2
|
+
* thefittingroom v1.1.5 (2024-04-05T19:10:10.348Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function e(t,n){let i=function(){0!==n.length&&e(n.slice(-1),n.slice(0,-1))};var r=new Image;r.onload=i,r.onerror=i,r.src=t}function t(t){e(t.slice(-1),t.slice(0,-1))}const n=(e,n)=>{const i=document.getElementById(e);if(!i)throw new Error(`Slider with id ${e} not found`);return{Load(e){if(!Array.isArray(e)||!e.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");t(e);const r=(null==e?void 0:e.length)-2;i.value=r.toString(),i.max=(e.length-1).toString();const s=()=>{const t=parseInt(i.value);n(i,e[t])};return n(i,e[r]),i.removeEventListener("input",s),i.addEventListener("input",s),()=>{i.removeEventListener("input",s)}}}},i=function(e){const t=[];let n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&i+1<e.length&&56320==(64512&e.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++i)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},r={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let t=0;t<e.length;t+=3){const r=e[t],s=t+1<e.length,o=s?e[t+1]:0,d=t+2<e.length,a=d?e[t+2]:0,c=r>>2,l=(3&r)<<4|o>>4;let u=(15&o)<<2|a>>6,h=63&a;d||(h=64,s||(u=64)),i.push(n[c],n[l],n[u],n[h])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,i=0;for(;n<e.length;){const r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){const r=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0;++t;const o=t<e.length?n[e.charAt(t)]:64;++t;const d=t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==s||null==o||null==d)throw Error();const a=r<<2|s>>4;if(i.push(a),64!==o){const e=s<<4&240|o>>2;if(i.push(e),64!==d){const e=o<<6&192|d;i.push(e)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},s=function(e){return function(e){const t=i(e);return r.encodeByteArray(t,!0)}(e).replace(/\./g,"")},o=function(e){try{return r.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thefittingroom/shop-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "the fitting room UI library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"typescript": "^4.0.2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@thefittingroom/sdk": "1.1.
|
|
35
|
+
"@thefittingroom/sdk": "1.1.2"
|
|
36
36
|
}
|
|
37
37
|
}
|