@crystaldesign/widget-library 25.9.0-beta.9 → 25.10.0-beta.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.
@@ -100,9 +100,14 @@ if (typeof window !== 'undefined' && !window.__divaWidgetCache) {
100
100
  */
101
101
  function useGlobalCache(_ref) {
102
102
  var uniqueWidgetId = _ref.uniqueWidgetId,
103
- widgetType = _ref.widgetType;
103
+ widgetType = _ref.widgetType,
104
+ noGlobalCache = _ref.noGlobalCache;
104
105
  var getOrFetch = useCallback(function (key, fetcher) {
105
106
  LOG$2.debug("[".concat(widgetType, ":").concat(uniqueWidgetId, "] getOrFetch called for key: ").concat(key));
107
+ if (noGlobalCache) {
108
+ LOG$2.debug("[".concat(widgetType, ":").concat(uniqueWidgetId, "] Global cache disabled, fetching directly for key: ").concat(key));
109
+ return fetcher();
110
+ }
106
111
  if (typeof window === 'undefined' || !window.__divaWidgetCache) {
107
112
  LOG$2.debug("[".concat(widgetType, ":").concat(uniqueWidgetId, "] No global cache available, fetching directly for key: ").concat(key));
108
113
  return fetcher();
@@ -260,7 +265,8 @@ var generateWidgetId = function generateWidgetId() {
260
265
  function useProductData(_ref) {
261
266
  var productIds = _ref.productIds,
262
267
  variants = _ref.variants,
263
- widgetType = _ref.widgetType;
268
+ widgetType = _ref.widgetType,
269
+ noGlobalCache = _ref.noGlobalCache;
264
270
  // Generate stable widget ID that persists for the lifetime of this hook instance
265
271
  // Function to handle selectedProduct changes
266
272
 
@@ -271,7 +277,8 @@ function useProductData(_ref) {
271
277
  handler = _useDivaCore.handler;
272
278
  var _useGlobalCache = useGlobalCache({
273
279
  uniqueWidgetId: widgetId,
274
- widgetType: widgetType
280
+ widgetType: widgetType,
281
+ noGlobalCache: noGlobalCache
275
282
  }),
276
283
  getOrFetch = _useGlobalCache.getOrFetch,
277
284
  setCache = _useGlobalCache.setCache;
@@ -812,13 +819,13 @@ function useGallery(_ref) {
812
819
  var _swiper$params;
813
820
  setCurrentMediaIndex(mediaIndex);
814
821
  if (swiper !== null && swiper !== void 0 && (_swiper$params = swiper.params) !== null && _swiper$params !== void 0 && _swiper$params.loop) {
815
- swiper === null || swiper === void 0 || swiper.slideToLoop(mediaIndex);
822
+ swiper === null || swiper === void 0 || swiper.slideToLoop(mediaIndex, 0);
816
823
  } else {
817
- swiper === null || swiper === void 0 || swiper.slideTo(mediaIndex);
824
+ swiper === null || swiper === void 0 || swiper.slideTo(mediaIndex, 0);
818
825
  }
819
826
  }
820
827
  }
821
- }, [currentProductId]);
828
+ }, [currentProductId, swiper]);
822
829
  var hasSirvMedia = useMemo(function () {
823
830
  var _loop = function _loop(i) {
824
831
  if (medias.find(function (m) {
@@ -1151,7 +1158,8 @@ var ArActionIcon = function ArActionIcon(_ref) {
1151
1158
  if (element !== null && element !== void 0 && element.style) element.style.display = 'none';
1152
1159
  }, []);
1153
1160
  if (!url || !arViewerBaseUrl) return /*#__PURE__*/jsx(Fragment, {});
1154
- var finalURL = arViewerBaseUrl + '/arViewer?arMedia=' + url;
1161
+ var apllyConfiguratorSessionId = DivaUtils.ConfigurationId ? '&configurationId=' + DivaUtils.ConfigurationId : '';
1162
+ var finalURL = arViewerBaseUrl + '/arViewer?arMedia=' + url + '&divaSessionId=' + DivaUtils.SessionId + apllyConfiguratorSessionId;
1155
1163
  var arText = typeof (config === null || config === void 0 ? void 0 : config.text) === 'string' ? config.text : (config === null || config === void 0 ? void 0 : config.text) !== false ? t('widget.gallery.arActionIcon.text') : '';
1156
1164
  return /*#__PURE__*/jsx("div", _objectSpread$1(_objectSpread$1({}, triggerProps), {}, {
1157
1165
  onClick: function onClick() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Gallery/ArActionIcon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,aAAa,EAAE,mBAAmB,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,QAAA,MAAM,YAAY,mCAAoC,iBAAiB,sBAmDtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Gallery/ArActionIcon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,aAAa,EAAE,mBAAmB,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,QAAA,MAAM,YAAY,mCAAoC,iBAAiB,sBAoDtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -51,6 +51,11 @@ 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;
54
59
  }
55
60
  declare global {
56
61
  interface Window {
@@ -63,6 +68,6 @@ declare global {
63
68
  * Global cache for shared data between widgets of a website
64
69
  * Simple implementation with request deduplication
65
70
  */
66
- export declare function useGlobalCache({ uniqueWidgetId, widgetType }: UseGlobalCacheProps): DivaWidgetCache;
71
+ export declare function useGlobalCache({ uniqueWidgetId, widgetType, noGlobalCache }: UseGlobalCacheProps): DivaWidgetCache;
67
72
  export {};
68
73
  //# 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,CAAC;CACnB;AAED,UAAU,eAAe;IACvB;;;;;;;OAOG;IACH,UAAU,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1E;;;OAGG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;OAIG;IACH,QAAQ,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"}
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,CAAC;CACnB;AAED,UAAU,eAAe;IACvB;;;;;;;OAOG;IACH,UAAU,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1E;;;OAGG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;OAIG;IACH,QAAQ,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;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;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,aAAa,EAAE,EAAE,mBAAmB,GAAG,eAAe,CAuGlH"}
@@ -6,8 +6,13 @@ 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;
9
14
  }
10
- export declare function useProductData({ productIds, variants, widgetType }: UseProductDataProps): {
15
+ export declare function useProductData({ productIds, variants, widgetType, noGlobalCache }: UseProductDataProps): {
11
16
  productVariants: ProductData[];
12
17
  error: boolean;
13
18
  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;AAQ1F,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;;;;oCAyLzC,MAAM,EAAE,KAAG,OAAO,CAAC,GAAG,CAAC;6CAyBd,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,GAAG,CAAC;;sCAxF3E,MAAM;2BAmHI,MAAM,QAAQ,GAAG;EAoChD"}
1
+ {"version":3,"file":"useProductData.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useProductData.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAQ1F,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;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAKD,wBAAgB,cAAc,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,mBAAmB;;;;oCAyLxD,MAAM,EAAE,KAAG,OAAO,CAAC,GAAG,CAAC;6CAyBd,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,GAAG,CAAC;;sCAxF3E,MAAM;2BAmHI,MAAM,QAAQ,GAAG;EAoChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/widget-library",
3
- "version": "25.9.0-beta.9",
3
+ "version": "25.10.0-beta.1",
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": "8264ad08999b0d1aa43b9503d6ec65aee5eba836"
39
+ "gitHead": "500bd13abd3eb41d6891dd0bd1402f04d60388c2"
40
40
  }