@thefittingroom/shop-ui 0.0.13 → 0.0.14
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.
|
@@ -10,5 +10,5 @@ import ScanCodeModal from './Modals/ScanCodeModal';
|
|
|
10
10
|
import SignInModal from './Modals/SignInModal';
|
|
11
11
|
import SizeErrorModal from './Modals/SizeErrorModal';
|
|
12
12
|
import TryOnModal from './Modals/TryOnModal';
|
|
13
|
-
import InitImageSlider from './slider';
|
|
14
|
-
export {
|
|
13
|
+
import { InitImageSlider } from './slider';
|
|
14
|
+
export { ErrorModal, ForgotPasswordModal, InitImageSlider, InitModalManager, LoadingAvatarModal, LoggedOutModal, ModalManager, NoAvatarModal, ResetLinkModal, ScanCodeModal, SignInModal, SizeErrorModal, TryOnModal, };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare const InitImageSlider: (sliderID: string, onChange: (slider: HTMLInputElement, imageUrl: string) => void) => {
|
|
1
|
+
export declare const InitImageSlider: (sliderID: string, onChange: (slider: HTMLInputElement, imageUrl: string) => void) => {
|
|
2
2
|
Load(imageURLs: string[]): Error | (() => void);
|
|
3
3
|
};
|
|
4
|
-
export default InitImageSlider;
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v0.0.
|
|
2
|
+
* thefittingroom v0.0.14 (2023-07-31T17:58:33.095Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/*!
|
|
@@ -23138,6 +23138,50 @@ var AvatarState$1;
|
|
|
23138
23138
|
|
|
23139
23139
|
const VTO_TIMEOUT_MS = TfrShop.vtoTimeout;
|
|
23140
23140
|
|
|
23141
|
+
function loadImageRecursive(imageURL, imageURLs) {
|
|
23142
|
+
let next = function () {
|
|
23143
|
+
if (imageURLs.length === 0) {
|
|
23144
|
+
return;
|
|
23145
|
+
}
|
|
23146
|
+
loadImageRecursive(imageURLs.slice(-1), imageURLs.slice(0, -1));
|
|
23147
|
+
};
|
|
23148
|
+
var img = new Image();
|
|
23149
|
+
img.onload = next;
|
|
23150
|
+
img.onerror = next;
|
|
23151
|
+
img.src = imageURL;
|
|
23152
|
+
}
|
|
23153
|
+
function loadImages(imageURLs) {
|
|
23154
|
+
loadImageRecursive(imageURLs.slice(-1), imageURLs.slice(0, -1));
|
|
23155
|
+
}
|
|
23156
|
+
const InitImageSlider = (sliderID, onChange) => {
|
|
23157
|
+
const slider = document.getElementById(sliderID);
|
|
23158
|
+
if (!slider) {
|
|
23159
|
+
throw new Error(`Slider with id ${sliderID} not found`);
|
|
23160
|
+
}
|
|
23161
|
+
return {
|
|
23162
|
+
Load(imageURLs) {
|
|
23163
|
+
if (!Array.isArray(imageURLs) || !imageURLs.length) {
|
|
23164
|
+
console.debug('slider has no images to load');
|
|
23165
|
+
return new Error('slider has no images to load');
|
|
23166
|
+
}
|
|
23167
|
+
loadImages(imageURLs);
|
|
23168
|
+
const defaultScrollValue = (imageURLs === null || imageURLs === void 0 ? void 0 : imageURLs.length) - 2;
|
|
23169
|
+
slider.value = defaultScrollValue.toString();
|
|
23170
|
+
slider.max = (imageURLs.length - 1).toString();
|
|
23171
|
+
const handleSliderChange = () => {
|
|
23172
|
+
const currentValue = parseInt(slider.value);
|
|
23173
|
+
onChange(slider, imageURLs[currentValue]);
|
|
23174
|
+
};
|
|
23175
|
+
onChange(slider, imageURLs[defaultScrollValue]);
|
|
23176
|
+
slider.removeEventListener('input', handleSliderChange);
|
|
23177
|
+
slider.addEventListener('input', handleSliderChange);
|
|
23178
|
+
return () => {
|
|
23179
|
+
slider.removeEventListener('input', handleSliderChange);
|
|
23180
|
+
};
|
|
23181
|
+
},
|
|
23182
|
+
};
|
|
23183
|
+
};
|
|
23184
|
+
|
|
23141
23185
|
var L = {
|
|
23142
23186
|
AssociatedEmail: 'If there is an account associated with that email, We have sent a link to reset your password.',
|
|
23143
23187
|
BackToSignIn: 'Back to sign in',
|
|
@@ -36021,50 +36065,6 @@ const SizeErrorModal = (props) => {
|
|
|
36021
36065
|
};
|
|
36022
36066
|
};
|
|
36023
36067
|
|
|
36024
|
-
function loadImageRecursive(imageURL, imageURLs) {
|
|
36025
|
-
let next = function () {
|
|
36026
|
-
if (imageURLs.length === 0) {
|
|
36027
|
-
return;
|
|
36028
|
-
}
|
|
36029
|
-
loadImageRecursive(imageURLs.slice(-1), imageURLs.slice(0, -1));
|
|
36030
|
-
};
|
|
36031
|
-
var img = new Image();
|
|
36032
|
-
img.onload = next;
|
|
36033
|
-
img.onerror = next;
|
|
36034
|
-
img.src = imageURL;
|
|
36035
|
-
}
|
|
36036
|
-
function loadImages(imageURLs) {
|
|
36037
|
-
loadImageRecursive(imageURLs.slice(-1), imageURLs.slice(0, -1));
|
|
36038
|
-
}
|
|
36039
|
-
const InitImageSlider = (sliderID, onChange) => {
|
|
36040
|
-
const slider = document.getElementById(sliderID);
|
|
36041
|
-
if (!slider) {
|
|
36042
|
-
throw new Error(`Slider with id ${sliderID} not found`);
|
|
36043
|
-
}
|
|
36044
|
-
return {
|
|
36045
|
-
Load(imageURLs) {
|
|
36046
|
-
if (!Array.isArray(imageURLs) || !imageURLs.length) {
|
|
36047
|
-
console.debug('slider has no images to load');
|
|
36048
|
-
return new Error('slider has no images to load');
|
|
36049
|
-
}
|
|
36050
|
-
loadImages(imageURLs);
|
|
36051
|
-
const defaultScrollValue = (imageURLs === null || imageURLs === void 0 ? void 0 : imageURLs.length) - 2;
|
|
36052
|
-
slider.value = defaultScrollValue.toString();
|
|
36053
|
-
slider.max = (imageURLs.length - 1).toString();
|
|
36054
|
-
const handleSliderChange = () => {
|
|
36055
|
-
const currentValue = parseInt(slider.value);
|
|
36056
|
-
onChange(slider, imageURLs[currentValue]);
|
|
36057
|
-
};
|
|
36058
|
-
onChange(slider, imageURLs[defaultScrollValue]);
|
|
36059
|
-
slider.removeEventListener('input', handleSliderChange);
|
|
36060
|
-
slider.addEventListener('input', handleSliderChange);
|
|
36061
|
-
return () => {
|
|
36062
|
-
slider.removeEventListener('input', handleSliderChange);
|
|
36063
|
-
};
|
|
36064
|
-
},
|
|
36065
|
-
};
|
|
36066
|
-
};
|
|
36067
|
-
|
|
36068
36068
|
const TryOnModal = (props) => {
|
|
36069
36069
|
let close = () => void 0;
|
|
36070
36070
|
const onNavBack = () => {
|
|
@@ -36333,5 +36333,5 @@ const initFittingRoom = async (shopId, modalDivId, hooks, env = 'dev') => {
|
|
|
36333
36333
|
return tfr;
|
|
36334
36334
|
};
|
|
36335
36335
|
|
|
36336
|
-
export { VTO_TIMEOUT_MS, initFittingRoom };
|
|
36336
|
+
export { InitImageSlider, VTO_TIMEOUT_MS, initFittingRoom };
|
|
36337
36337
|
//# sourceMappingURL=index.js.map
|