bs-unified-ui 1.0.917 → 1.0.920

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.
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Custom hook to track current pathname changes in SPA
3
+ * Uses singleton PathTracker to prevent duplicate history API patches
3
4
  * Listens to:
4
5
  * - popstate (browser back/forward)
5
6
  * - history.pushState (programmatic navigation)
package/index.js CHANGED
@@ -45588,22 +45588,37 @@ var filterIndicatorsByEnabledEvents = function (receivedIndicators, triggerEvent
45588
45588
  };
45589
45589
 
45590
45590
  /**
45591
- * Custom hook to track current pathname changes in SPA
45592
- * Listens to:
45593
- * - popstate (browser back/forward)
45594
- * - history.pushState (programmatic navigation)
45595
- * - history.replaceState (programmatic navigation)
45591
+ * Global singleton to track pathname changes across all hook instances
45592
+ * This prevents multiple hooks from patching history APIs multiple times
45596
45593
  */
45597
- var useCurrentPath = function () {
45598
- var _a = React.useState(typeof window !== 'undefined' ? window.location.pathname : ''), currentPath = _a[0], setCurrentPath = _a[1];
45599
- React.useEffect(function () {
45600
- var handleLocationChange = function () {
45601
- setCurrentPath(window.location.pathname);
45594
+ var PathTracker = /** @class */ (function () {
45595
+ function PathTracker() {
45596
+ this.listeners = new Set();
45597
+ this.currentPath = '';
45598
+ this.isPatched = false;
45599
+ if (typeof window !== 'undefined') {
45600
+ this.currentPath = window.location.pathname;
45601
+ this.patchHistory();
45602
+ }
45603
+ }
45604
+ PathTracker.getInstance = function () {
45605
+ if (!PathTracker.instance) {
45606
+ PathTracker.instance = new PathTracker();
45607
+ }
45608
+ return PathTracker.instance;
45609
+ };
45610
+ PathTracker.prototype.patchHistory = function () {
45611
+ var _this = this;
45612
+ if (this.isPatched)
45613
+ return;
45614
+ this.isPatched = true;
45615
+ var handleChange = function () {
45616
+ _this.currentPath = window.location.pathname;
45617
+ _this.notifyListeners();
45602
45618
  };
45603
45619
  // Listen to popstate event (browser back/forward)
45604
- window.addEventListener('popstate', handleLocationChange);
45605
- // For SPAs, also listen to custom navigation events if needed
45606
- // This covers most routing libraries that update window.location
45620
+ window.addEventListener('popstate', handleChange);
45621
+ // Patch history.pushState and history.replaceState ONCE
45607
45622
  var originalPushState = window.history.pushState;
45608
45623
  var originalReplaceState = window.history.replaceState;
45609
45624
  window.history.pushState = function pushStateWrapper() {
@@ -45612,7 +45627,7 @@ var useCurrentPath = function () {
45612
45627
  args[_i] = arguments[_i];
45613
45628
  }
45614
45629
  originalPushState.apply(this, args);
45615
- handleLocationChange();
45630
+ handleChange();
45616
45631
  };
45617
45632
  window.history.replaceState = function replaceStateWrapper() {
45618
45633
  var args = [];
@@ -45620,14 +45635,45 @@ var useCurrentPath = function () {
45620
45635
  args[_i] = arguments[_i];
45621
45636
  }
45622
45637
  originalReplaceState.apply(this, args);
45623
- handleLocationChange();
45638
+ handleChange();
45624
45639
  };
45640
+ };
45641
+ PathTracker.prototype.subscribe = function (callback) {
45642
+ var _this = this;
45643
+ this.listeners.add(callback);
45625
45644
  return function () {
45626
- window.removeEventListener('popstate', handleLocationChange);
45627
- window.history.pushState = originalPushState;
45628
- window.history.replaceState = originalReplaceState;
45645
+ _this.listeners.delete(callback);
45629
45646
  };
45630
- }, []);
45647
+ };
45648
+ PathTracker.prototype.notifyListeners = function () {
45649
+ var _this = this;
45650
+ this.listeners.forEach(function (callback) {
45651
+ try {
45652
+ callback(_this.currentPath);
45653
+ }
45654
+ catch (e) {
45655
+ // Ignore errors in listeners
45656
+ }
45657
+ });
45658
+ };
45659
+ PathTracker.prototype.getCurrentPath = function () {
45660
+ return this.currentPath;
45661
+ };
45662
+ PathTracker.instance = null;
45663
+ return PathTracker;
45664
+ }());
45665
+ /**
45666
+ * Custom hook to track current pathname changes in SPA
45667
+ * Uses singleton PathTracker to prevent duplicate history API patches
45668
+ * Listens to:
45669
+ * - popstate (browser back/forward)
45670
+ * - history.pushState (programmatic navigation)
45671
+ * - history.replaceState (programmatic navigation)
45672
+ */
45673
+ var useCurrentPath = function () {
45674
+ var tracker = PathTracker.getInstance();
45675
+ var _a = React.useState(tracker.getCurrentPath()), currentPath = _a[0], setCurrentPath = _a[1];
45676
+ React.useEffect(function () { return tracker.subscribe(setCurrentPath); }, [tracker]);
45631
45677
  return currentPath;
45632
45678
  };
45633
45679
 
@@ -45724,10 +45770,12 @@ var ObservableSet = /** @class */ (function () {
45724
45770
  return ObservableSet;
45725
45771
  }());
45726
45772
 
45773
+ // Constant empty array to avoid recreating on each render
45774
+ var EMPTY_WAREHOUSES_CONFIG = [];
45727
45775
  var useNotificationsV2 = function (options) {
45728
45776
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45729
45777
  if (options === void 0) { options = {}; }
45730
- var onNotification = options.onNotification, onConnectionChange = options.onConnectionChange, onError = options.onError, _k = options.timezone, timezone = _k === void 0 ? 'America/Vancouver' : _k, navigate = options.navigate, bsOrgId = options.bsOrgId, cfWsId = options.cfWsId, soundConfig = options.soundConfig, triggerEvents = options.triggerEvents, _l = options.warehousesConfig, warehousesConfig = _l === void 0 ? [] : _l;
45778
+ var onNotification = options.onNotification, onConnectionChange = options.onConnectionChange, onError = options.onError, _k = options.timezone, timezone = _k === void 0 ? 'America/Vancouver' : _k, navigate = options.navigate, bsOrgId = options.bsOrgId, cfWsId = options.cfWsId, soundConfig = options.soundConfig, triggerEvents = options.triggerEvents, _l = options.warehousesConfig, warehousesConfig = _l === void 0 ? EMPTY_WAREHOUSES_CONFIG : _l;
45731
45779
  var _m = React.useState([]), popoverNotifications = _m[0], setPopoverNotifications = _m[1];
45732
45780
  var _o = React.useState(true), popoverLoading = _o[0], setPopoverLoading = _o[1];
45733
45781
  var _p = React.useState(false), popoverHasNextPage = _p[0], setPopoverHasNextPage = _p[1];
@@ -45770,8 +45818,6 @@ var useNotificationsV2 = function (options) {
45770
45818
  // Single ObservableSet to track all items requiring audio reminders with composite key: `${subType}:${id}`
45771
45819
  var allRemindersRef = React.useRef(new ObservableSet());
45772
45820
  var handleNotificationEventRef = React.useRef(function () { });
45773
- // Refs to always have latest functions (prevents duplicate intervals)
45774
- var playAudioForGroupRef = React.useRef(function () { });
45775
45821
  // Ref to always have latest indicators state
45776
45822
  var indicatorsRef = React.useRef(indicators);
45777
45823
  // Track previous reminder events to detect when events are enabled (falsy -> true)
@@ -45792,9 +45838,12 @@ var useNotificationsV2 = function (options) {
45792
45838
  var prevPageIndicatorRef = React.useRef();
45793
45839
  // Timer for debouncing fetchAudioRepeat calls
45794
45840
  var fetchAudioRepeatTimerRef = React.useRef(null);
45795
- // Ref to always have latest updateIndicators function
45796
- var updateIndicatorsRef = React.useRef();
45797
45841
  // Use refs to store latest callbacks to avoid recreating functions unnecessarily
45842
+ var updateIndicatorsRef = React.useRef();
45843
+ var fetchIndicatorsRef = React.useRef();
45844
+ var playAudioForGroupRef = React.useRef(function () { });
45845
+ var fetchIndicatorsInFlightRef = React.useRef(false);
45846
+ var fetchAudioRepeatInFlightRef = React.useRef(false);
45798
45847
  var onErrorRef = React.useRef(onError);
45799
45848
  var onNotificationRef = React.useRef(onNotification);
45800
45849
  var onConnectionChangeRef = React.useRef(onConnectionChange);
@@ -45879,6 +45928,8 @@ var useNotificationsV2 = function (options) {
45879
45928
  memoizedTriggerEvents === null || memoizedTriggerEvents === void 0 ? void 0 : memoizedTriggerEvents[DELIVERY_EVENTS.IMPORT_TASK],
45880
45929
  memoizedTriggerEvents === null || memoizedTriggerEvents === void 0 ? void 0 : memoizedTriggerEvents[DELIVERY_EVENTS.NEW_DRIVER],
45881
45930
  ]);
45931
+ // Memoize warehousesConfig to prevent recreating when array content is the same
45932
+ var memoizedWarehousesConfig = React.useMemo(function () { return warehousesConfig; }, [JSON.stringify(warehousesConfig)]);
45882
45933
  var markAsRead = React.useCallback(function (notificationId) { return __awaiter(void 0, void 0, void 0, function () {
45883
45934
  var err_1, errorMessage;
45884
45935
  var _a;
@@ -46018,16 +46069,6 @@ var useNotificationsV2 = function (options) {
46018
46069
  }
46019
46070
  return true;
46020
46071
  }, []);
46021
- // Update refs whenever callbacks change
46022
- React.useEffect(function () {
46023
- onErrorRef.current = onError;
46024
- }, [onError]);
46025
- React.useEffect(function () {
46026
- onNotificationRef.current = onNotification;
46027
- }, [onNotification]);
46028
- React.useEffect(function () {
46029
- onConnectionChangeRef.current = onConnectionChange;
46030
- }, [onConnectionChange]);
46031
46072
  var loadPopoverNotifications = React.useCallback(function (params) { return __awaiter(void 0, void 0, void 0, function () {
46032
46073
  var data_1, err_3, errorMessage;
46033
46074
  var _a;
@@ -46077,6 +46118,7 @@ var useNotificationsV2 = function (options) {
46077
46118
  var startRetryInterval = React.useCallback(function () {
46078
46119
  if (!bsOrgId)
46079
46120
  return;
46121
+ // Clear any existing interval to prevent duplicates
46080
46122
  clearRetryInterval();
46081
46123
  retryIntervalRef.current = setInterval(function () {
46082
46124
  var createdAtGte = isoMinusDaysInTimeZone(timezone, 7);
@@ -46112,14 +46154,6 @@ var useNotificationsV2 = function (options) {
46112
46154
  audioElement.play().catch(function () { });
46113
46155
  }
46114
46156
  }, [memoizedSoundConfig]);
46115
- // Update ref whenever playAudioForGroup changes
46116
- React.useEffect(function () {
46117
- playAudioForGroupRef.current = playAudioForGroup;
46118
- }, [playAudioForGroup]);
46119
- // Update ref whenever indicators changes
46120
- React.useEffect(function () {
46121
- indicatorsRef.current = indicators;
46122
- }, [indicators]);
46123
46157
  // Start audio repeat for specific group
46124
46158
  var startAudioRepeatForGroup = React.useCallback(function (group) {
46125
46159
  var _a;
@@ -46173,12 +46207,17 @@ var useNotificationsV2 = function (options) {
46173
46207
  case 0:
46174
46208
  if (!serviceRef.current || !bsOrgId)
46175
46209
  return [2 /*return*/];
46210
+ // Guard: Skip if already fetching to prevent duplicate calls
46211
+ if (fetchAudioRepeatInFlightRef.current) {
46212
+ return [2 /*return*/];
46213
+ }
46176
46214
  // Clear old reminders first to avoid stale data
46177
46215
  allRemindersRef.current.clear();
46178
46216
  _a.label = 1;
46179
46217
  case 1:
46180
- _a.trys.push([1, 3, , 4]);
46181
- return [4 /*yield*/, serviceRef.current.getAudioRepeat(bsOrgId, warehousesConfig)];
46218
+ _a.trys.push([1, 3, 4, 5]);
46219
+ fetchAudioRepeatInFlightRef.current = true;
46220
+ return [4 /*yield*/, serviceRef.current.getAudioRepeat(bsOrgId, memoizedWarehousesConfig)];
46182
46221
  case 2:
46183
46222
  response = _a.sent();
46184
46223
  data = response === null || response === void 0 ? void 0 : response.data;
@@ -46209,15 +46248,19 @@ var useNotificationsV2 = function (options) {
46209
46248
  startAudioRepeatForGroup(group);
46210
46249
  });
46211
46250
  }
46212
- return [3 /*break*/, 4];
46251
+ return [3 /*break*/, 5];
46213
46252
  case 3:
46214
46253
  _a.sent();
46215
- return [3 /*break*/, 4];
46216
- case 4: return [2 /*return*/];
46254
+ return [3 /*break*/, 5];
46255
+ case 4:
46256
+ fetchAudioRepeatInFlightRef.current = false;
46257
+ return [7 /*endfinally*/];
46258
+ case 5: return [2 /*return*/];
46217
46259
  }
46218
46260
  });
46219
46261
  }); }, [
46220
46262
  bsOrgId,
46263
+ memoizedWarehousesConfig,
46221
46264
  memoizedTriggerEvents,
46222
46265
  playAudioForGroup,
46223
46266
  startAudioRepeatForGroup,
@@ -46230,6 +46273,10 @@ var useNotificationsV2 = function (options) {
46230
46273
  case 0:
46231
46274
  if (!serviceRef.current || !bsOrgId)
46232
46275
  return [2 /*return*/];
46276
+ // Guard: Skip if already fetching to prevent duplicate calls
46277
+ if (fetchIndicatorsInFlightRef.current) {
46278
+ return [2 /*return*/];
46279
+ }
46233
46280
  categories = {};
46234
46281
  Object.entries(INDICATOR_MAPPING).forEach(function (_a) {
46235
46282
  var category = _a[0], events = _a[1];
@@ -46242,14 +46289,22 @@ var useNotificationsV2 = function (options) {
46242
46289
  if (Object.keys(categories).length === 0) {
46243
46290
  return [2 /*return*/];
46244
46291
  }
46245
- return [4 /*yield*/, serviceRef.current.getIndicators(bsOrgId, categories)];
46292
+ _a.label = 1;
46246
46293
  case 1:
46294
+ _a.trys.push([1, , 3, 4]);
46295
+ fetchIndicatorsInFlightRef.current = true;
46296
+ return [4 /*yield*/, serviceRef.current.getIndicators(bsOrgId, categories)];
46297
+ case 2:
46247
46298
  response = _a.sent();
46248
46299
  receivedIndicators = response === null || response === void 0 ? void 0 : response.data;
46249
46300
  if (receivedIndicators) {
46250
46301
  setIndicators(receivedIndicators);
46251
46302
  }
46252
- return [2 /*return*/];
46303
+ return [3 /*break*/, 4];
46304
+ case 3:
46305
+ fetchIndicatorsInFlightRef.current = false;
46306
+ return [7 /*endfinally*/];
46307
+ case 4: return [2 /*return*/];
46253
46308
  }
46254
46309
  });
46255
46310
  }); }, [bsOrgId, memoizedTriggerEvents]);
@@ -46288,10 +46343,29 @@ var useNotificationsV2 = function (options) {
46288
46343
  }
46289
46344
  });
46290
46345
  }); }, [bsOrgId, onError, memoizedTriggerEvents]);
46291
- // Update ref whenever updateIndicators changes
46346
+ // Update function refs to avoid stale closures
46347
+ React.useEffect(function () {
46348
+ onErrorRef.current = onError;
46349
+ }, [onError]);
46350
+ React.useEffect(function () {
46351
+ onNotificationRef.current = onNotification;
46352
+ }, [onNotification]);
46353
+ React.useEffect(function () {
46354
+ onConnectionChangeRef.current = onConnectionChange;
46355
+ }, [onConnectionChange]);
46292
46356
  React.useEffect(function () {
46293
46357
  updateIndicatorsRef.current = updateIndicators;
46294
46358
  }, [updateIndicators]);
46359
+ React.useEffect(function () {
46360
+ fetchIndicatorsRef.current = fetchIndicators;
46361
+ }, [fetchIndicators]);
46362
+ React.useEffect(function () {
46363
+ playAudioForGroupRef.current = playAudioForGroup;
46364
+ }, [playAudioForGroup]);
46365
+ // Update state ref
46366
+ React.useEffect(function () {
46367
+ indicatorsRef.current = indicators;
46368
+ }, [indicators]);
46295
46369
  // Queue indicator update to batch multiple updates together
46296
46370
  var queueUpdateIndicators = React.useCallback(function (indicator, value) {
46297
46371
  // Add to pending queue
@@ -46683,10 +46757,11 @@ var useNotificationsV2 = function (options) {
46683
46757
  if (!isInitialized || !bsOrgId)
46684
46758
  return undefined;
46685
46759
  var timeoutId = setTimeout(function () {
46686
- fetchIndicators();
46687
- }, 2000);
46760
+ var _a;
46761
+ (_a = fetchIndicatorsRef.current) === null || _a === void 0 ? void 0 : _a.call(fetchIndicatorsRef);
46762
+ }, 3000);
46688
46763
  return function () { return clearTimeout(timeoutId); };
46689
- }, [isInitialized, bsOrgId, fetchIndicators]);
46764
+ }, [isInitialized, bsOrgId]);
46690
46765
  React.useEffect(function () {
46691
46766
  if (isInitialized && isActiveNotificationPage && bsOrgId) {
46692
46767
  var apiParams = __assign({}, filter);
@@ -46817,7 +46892,7 @@ var useNotificationsV2 = function (options) {
46817
46892
  fetchAudioRepeatTimerRef.current = setTimeout(function () {
46818
46893
  fetchAudioRepeat();
46819
46894
  fetchAudioRepeatTimerRef.current = null;
46820
- }, 2000);
46895
+ }, 3000);
46821
46896
  }
46822
46897
  }, [fetchAudioRepeat, memoizedSoundConfig, memoizedReminderEvents]);
46823
46898
  // Restart interval when repeatingInterval or mute changes per group
@@ -47127,29 +47202,63 @@ var NotificationToast = React.forwardRef(function (props, ref) {
47127
47202
  var NotificationContext = React.createContext(null);
47128
47203
  var NotificationProviderBase = function (_a) {
47129
47204
  var children = _a.children, config = _a.config, useNotificationsHook = _a.useNotificationsHook;
47130
- // Memoize callbacks to prevent recreating on every render
47205
+ // Use refs to store callbacks to avoid recreating them
47206
+ var onNotificationRef = React.useRef(config.onNotification);
47207
+ var onConnectionChangeRef = React.useRef(config.onConnectionChange);
47208
+ var onErrorRef = React.useRef(config.onError);
47209
+ // Update refs when callbacks change
47210
+ onNotificationRef.current = config.onNotification;
47211
+ onConnectionChangeRef.current = config.onConnectionChange;
47212
+ onErrorRef.current = config.onError;
47213
+ // Create stable callbacks that use refs
47131
47214
  var onNotificationCb = React.useCallback(function (notification) {
47132
47215
  var _a;
47133
- (_a = config.onNotification) === null || _a === void 0 ? void 0 : _a.call(config, notification);
47134
- }, [config.onNotification]);
47216
+ (_a = onNotificationRef.current) === null || _a === void 0 ? void 0 : _a.call(onNotificationRef, notification);
47217
+ }, []);
47135
47218
  var onConnectionChangeCb = React.useCallback(function (isConnected) {
47136
47219
  var _a;
47137
- (_a = config.onConnectionChange) === null || _a === void 0 ? void 0 : _a.call(config, isConnected);
47138
- }, [config.onConnectionChange]);
47220
+ (_a = onConnectionChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onConnectionChangeRef, isConnected);
47221
+ }, []);
47139
47222
  var onErrorCb = React.useCallback(function (error) {
47140
47223
  var _a;
47141
- (_a = config.onError) === null || _a === void 0 ? void 0 : _a.call(config, error);
47142
- }, [config.onError]);
47143
- var notificationState = useNotificationsHook(__assign(__assign({}, config), { onNotification: onNotificationCb, onConnectionChange: onConnectionChangeCb, onError: onErrorCb }));
47144
- return (React.createElement(SnackbarProvider, { maxSnack: (config === null || config === void 0 ? void 0 : config.maxVisibleToasts) || 5, autoHideDuration: (config === null || config === void 0 ? void 0 : config.autoRemoveDelay) || 5000, anchorOrigin: {
47224
+ (_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, error);
47225
+ }, []);
47226
+ // Memoize the config object to prevent recreating it
47227
+ var memoizedConfig = React.useMemo(function () { return (__assign(__assign({}, config), { onNotification: onNotificationCb, onConnectionChange: onConnectionChangeCb, onError: onErrorCb })); }, [
47228
+ config.bsOrgId,
47229
+ config.cfWsId,
47230
+ config.timezone,
47231
+ config.navigate,
47232
+ config.soundConfig,
47233
+ config.triggerEvents,
47234
+ config.warehousesConfig,
47235
+ config.maxVisibleToasts,
47236
+ config.autoRemoveDelay,
47237
+ onNotificationCb,
47238
+ onConnectionChangeCb,
47239
+ onErrorCb,
47240
+ ]);
47241
+ var notificationState = useNotificationsHook(memoizedConfig);
47242
+ // Memoize SnackbarProvider props to prevent re-renders
47243
+ var snackbarProps = React.useMemo(function () { return ({
47244
+ maxSnack: (config === null || config === void 0 ? void 0 : config.maxVisibleToasts) || 5,
47245
+ autoHideDuration: (config === null || config === void 0 ? void 0 : config.autoRemoveDelay) || 5000,
47246
+ anchorOrigin: {
47145
47247
  vertical: 'top',
47146
47248
  horizontal: 'right',
47147
- }, dense: true, preventDuplicate: true, disableWindowBlurListener: true, classes: {
47249
+ },
47250
+ dense: true,
47251
+ preventDuplicate: true,
47252
+ disableWindowBlurListener: true,
47253
+ classes: {
47148
47254
  containerRoot: 'snackbarStack',
47149
47255
  containerAnchorOriginTopRight: 'snackbarStack',
47150
- }, Components: {
47256
+ },
47257
+ Components: {
47151
47258
  notification: NotificationToast,
47152
- } },
47259
+ },
47260
+ }); }, [config === null || config === void 0 ? void 0 : config.maxVisibleToasts, config === null || config === void 0 ? void 0 : config.autoRemoveDelay]);
47261
+ return (React.createElement(SnackbarProvider, __assign({}, snackbarProps),
47153
47262
  React.createElement(material.GlobalStyles, { styles: {
47154
47263
  '.snackbarStack': {
47155
47264
  display: 'flex !important',
@@ -47159,12 +47268,22 @@ var NotificationProviderBase = function (_a) {
47159
47268
  } }),
47160
47269
  React.createElement(NotificationContext.Provider, { value: notificationState }, children)));
47161
47270
  };
47271
+ // Default empty config to prevent creating new object on each render
47272
+ var EMPTY_CONFIG = {};
47162
47273
  var NotificationProvider = function (_a) {
47163
- var children = _a.children, _b = _a.config, config = _b === void 0 ? {} : _b;
47164
- var isV2 = config.isV2, restConfig = __rest(config, ["isV2"]);
47165
- if (isV2)
47166
- return (React.createElement(NotificationProviderBase, { config: restConfig, useNotificationsHook: useNotificationsV2 }, children));
47167
- return (React.createElement(NotificationProviderBase, { config: restConfig, useNotificationsHook: useNotifications }, children));
47274
+ var children = _a.children, _b = _a.config, config = _b === void 0 ? EMPTY_CONFIG : _b;
47275
+ // Extract isV2 flag
47276
+ var isV2 = config === null || config === void 0 ? void 0 : config.isV2;
47277
+ // Memoize the config without isV2 to prevent recreating object
47278
+ var restConfig = React.useMemo(function () {
47279
+ if (!config)
47280
+ return {};
47281
+ config.isV2; var rest = __rest(config, ["isV2"]);
47282
+ return rest;
47283
+ }, [config]);
47284
+ // Memoize the hook selection
47285
+ var useNotificationsHook = React.useMemo(function () { return (isV2 ? useNotificationsV2 : useNotifications); }, [isV2]);
47286
+ return (React.createElement(NotificationProviderBase, { config: restConfig, useNotificationsHook: useNotificationsHook }, children));
47168
47287
  };
47169
47288
  var useNotificationContext = function () {
47170
47289
  var context = React.useContext(NotificationContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bs-unified-ui",
3
- "version": "1.0.917",
3
+ "version": "1.0.920",
4
4
  "license": "MIT",
5
5
  "author": "Advesa",
6
6
  "description": "UI Components for Unified Breadstack UI",