@crystaldesign/widget-library 25.8.0-rc.7 → 25.9.0-beta.2
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/build/esm/index.js +4 -10
- package/build/types/widget-library/src/components/Gallery/useGallery.d.ts.map +1 -1
- package/build/types/widget-library/src/hooks/useGlobalCache.d.ts +1 -6
- package/build/types/widget-library/src/hooks/useGlobalCache.d.ts.map +1 -1
- package/build/types/widget-library/src/hooks/useProductData.d.ts +1 -6
- package/build/types/widget-library/src/hooks/useProductData.d.ts.map +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -99,14 +99,9 @@ if (typeof window !== 'undefined' && !window.__divaWidgetCache) {
|
|
|
99
99
|
*/
|
|
100
100
|
function useGlobalCache(_ref) {
|
|
101
101
|
var uniqueWidgetId = _ref.uniqueWidgetId,
|
|
102
|
-
widgetType = _ref.widgetType
|
|
103
|
-
noGlobalCache = _ref.noGlobalCache;
|
|
102
|
+
widgetType = _ref.widgetType;
|
|
104
103
|
var getOrFetch = useCallback(function (key, fetcher) {
|
|
105
104
|
LOG$2.debug("[".concat(widgetType, ":").concat(uniqueWidgetId, "] getOrFetch called for key: ").concat(key));
|
|
106
|
-
if (noGlobalCache) {
|
|
107
|
-
LOG$2.debug("[".concat(widgetType, ":").concat(uniqueWidgetId, "] Global cache disabled, fetching directly for key: ").concat(key));
|
|
108
|
-
return fetcher();
|
|
109
|
-
}
|
|
110
105
|
if (typeof window === 'undefined' || !window.__divaWidgetCache) {
|
|
111
106
|
LOG$2.debug("[".concat(widgetType, ":").concat(uniqueWidgetId, "] No global cache available, fetching directly for key: ").concat(key));
|
|
112
107
|
return fetcher();
|
|
@@ -264,8 +259,7 @@ var generateWidgetId = function generateWidgetId() {
|
|
|
264
259
|
function useProductData(_ref) {
|
|
265
260
|
var productIds = _ref.productIds,
|
|
266
261
|
variants = _ref.variants,
|
|
267
|
-
widgetType = _ref.widgetType
|
|
268
|
-
noGlobalCache = _ref.noGlobalCache;
|
|
262
|
+
widgetType = _ref.widgetType;
|
|
269
263
|
// Generate stable widget ID that persists for the lifetime of this hook instance
|
|
270
264
|
// Function to handle selectedProduct changes
|
|
271
265
|
|
|
@@ -276,8 +270,7 @@ function useProductData(_ref) {
|
|
|
276
270
|
handler = _useDivaCore.handler;
|
|
277
271
|
var _useGlobalCache = useGlobalCache({
|
|
278
272
|
uniqueWidgetId: widgetId,
|
|
279
|
-
widgetType: widgetType
|
|
280
|
-
noGlobalCache: noGlobalCache
|
|
273
|
+
widgetType: widgetType
|
|
281
274
|
}),
|
|
282
275
|
getOrFetch = _useGlobalCache.getOrFetch,
|
|
283
276
|
setCache = _useGlobalCache.setCache;
|
|
@@ -789,6 +782,7 @@ function useGallery(_ref) {
|
|
|
789
782
|
setSwiperIsInitialized(true);
|
|
790
783
|
return;
|
|
791
784
|
}
|
|
785
|
+
if (swiper.isBeginning) return;
|
|
792
786
|
var newMediaIndex = swiper.realIndex;
|
|
793
787
|
var media = medias[newMediaIndex];
|
|
794
788
|
setCurrentMediaIndex(newMediaIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGallery.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Gallery/useGallery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,MAAM,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAC3D,gBAAgB,EAChB,mBAAmB,GACpB,EAAE,YAAY;;;;;;;;4BAsCkB,WAAW;
|
|
1
|
+
{"version":3,"file":"useGallery.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Gallery/useGallery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,MAAM,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAC3D,gBAAgB,EAChB,mBAAmB,GACpB,EAAE,YAAY;;;;;;;;4BAsCkB,WAAW;EAiC3C"}
|
|
@@ -51,11 +51,6 @@ interface UseGlobalCacheProps {
|
|
|
51
51
|
* Widget type, used for events and logging
|
|
52
52
|
*/
|
|
53
53
|
widgetType: string;
|
|
54
|
-
/**
|
|
55
|
-
* If true, the global cache will not be used
|
|
56
|
-
* This is used in the product list, where we always want to fetch the latest data
|
|
57
|
-
*/
|
|
58
|
-
noGlobalCache?: boolean;
|
|
59
54
|
}
|
|
60
55
|
declare global {
|
|
61
56
|
interface Window {
|
|
@@ -68,6 +63,6 @@ declare global {
|
|
|
68
63
|
* Global cache for shared data between widgets of a website
|
|
69
64
|
* Simple implementation with request deduplication
|
|
70
65
|
*/
|
|
71
|
-
export declare function useGlobalCache({ uniqueWidgetId, widgetType
|
|
66
|
+
export declare function useGlobalCache({ uniqueWidgetId, widgetType }: UseGlobalCacheProps): DivaWidgetCache;
|
|
72
67
|
export {};
|
|
73
68
|
//# sourceMappingURL=useGlobalCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalCache.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useGlobalCache.ts"],"names":[],"mappings":"AAKA,UAAU,UAAU,CAAC,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAA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AAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC5C;AAED,UAAU,mBAAmB;IAC3B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,iBAAiB,EAAE;YACjB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;SACrC,CAAC;KACH;CACF;AASD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,mBAAmB,GAAG,eAAe,CAkGnG"}
|
|
@@ -6,13 +6,8 @@ export interface UseProductDataProps {
|
|
|
6
6
|
* Widget type, used for logging
|
|
7
7
|
*/
|
|
8
8
|
widgetType: string;
|
|
9
|
-
/**
|
|
10
|
-
* If true, the global cache will not be used
|
|
11
|
-
* This is used in the product list, where we always want to fetch the latest data
|
|
12
|
-
*/
|
|
13
|
-
noGlobalCache?: boolean;
|
|
14
9
|
}
|
|
15
|
-
export declare function useProductData({ productIds, variants, widgetType
|
|
10
|
+
export declare function useProductData({ productIds, variants, widgetType }: UseProductDataProps): {
|
|
16
11
|
productVariants: ProductData[];
|
|
17
12
|
error: boolean;
|
|
18
13
|
loading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProductData.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useProductData.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAM1F,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useProductData.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useProductData.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAM1F,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,wBAAgB,cAAc,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB;;;;oCA2JzC,MAAM,EAAE,KAAG,OAAO,CAAC,GAAG,CAAC;6CAyBd,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,GAAG,CAAC;;sCAxE3E,MAAM;2BAmGI,MAAM,QAAQ,GAAG;EAiBhD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/widget-library",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.9.0-beta.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"storybook": "storybook dev -p 6006",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"suiteName": "widget-library",
|
|
37
37
|
"outputDirectory": "./test-reports"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "5bbeef377055646aadcf38f1150972f95a823a81"
|
|
40
40
|
}
|