@wlloyalty/wll-react-sdk 1.1.0 → 1.2.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.
package/dist/web.js CHANGED
@@ -20448,16 +20448,17 @@ var useContentTileStyles = function (hasArtwork) {
20448
20448
  return StyleSheet$1.create({
20449
20449
  imageContainer: {
20450
20450
  width: '100%',
20451
- marginBottom: 0
20451
+ marginBottom: 0,
20452
+ overflow: 'hidden'
20452
20453
  },
20453
20454
  image: {
20454
20455
  position: 'absolute',
20455
- top: 0,
20456
- left: 0,
20457
- bottom: 0,
20458
- right: 0,
20459
- width: '100%',
20460
- height: '100%',
20456
+ top: -1,
20457
+ left: -1,
20458
+ bottom: -1,
20459
+ right: -1,
20460
+ width: '102%',
20461
+ height: '102%',
20461
20462
  resizeMode: 'cover'
20462
20463
  },
20463
20464
  content: {
@@ -20640,6 +20641,7 @@ var useGroupRefresh = function (_a) {
20640
20641
  }, [id, sdk, enabled, setGroupData]);
20641
20642
  };
20642
20643
 
20644
+ var inFlightRequests = new Map();
20643
20645
  var useInitialGroupFetch = function (_a) {
20644
20646
  var id = _a.id,
20645
20647
  setGroupData = _a.setGroupData;
@@ -20651,32 +20653,42 @@ var useInitialGroupFetch = function (_a) {
20651
20653
  error = _c[0],
20652
20654
  setError = _c[1];
20653
20655
  React.useEffect(function () {
20656
+ if (!id || !(sdk === null || sdk === void 0 ? void 0 : sdk.refreshGroup)) {
20657
+ setError('Unable to fetch group data: invalid configuration');
20658
+ setIsLoading(false);
20659
+ return;
20660
+ }
20654
20661
  var cancelled = false;
20655
- var fetchGroup = function () {
20662
+ var fetch = function () {
20656
20663
  return __awaiter(void 0, void 0, void 0, function () {
20657
- var response;
20664
+ var existing, request, res;
20658
20665
  var _b;
20659
20666
  return __generator(this, function (_c) {
20660
20667
  switch (_c.label) {
20661
20668
  case 0:
20662
- if (!id || !(sdk === null || sdk === void 0 ? void 0 : sdk.refreshGroup)) {
20663
- setError('Unable to fetch group data: invalid configuration');
20664
- setIsLoading(false);
20665
- return [2 /*return*/];
20666
- }
20667
20669
  setIsLoading(true);
20668
20670
  setError(null);
20671
+ existing = inFlightRequests.get(id);
20672
+ request = existing !== null && existing !== void 0 ? existing : sdk.refreshGroup(id);
20673
+ if (!existing) {
20674
+ inFlightRequests.set(id, request);
20675
+ request.finally(function () {
20676
+ if (inFlightRequests.get(id) === request) {
20677
+ inFlightRequests.delete(id);
20678
+ }
20679
+ });
20680
+ }
20669
20681
  _c.label = 1;
20670
20682
  case 1:
20671
20683
  _c.trys.push([1, 3, 4, 5]);
20672
- return [4 /*yield*/, sdk.refreshGroup(id)];
20684
+ return [4 /*yield*/, request];
20673
20685
  case 2:
20674
- response = _c.sent();
20686
+ res = _c.sent();
20675
20687
  if (cancelled) return [2 /*return*/];
20676
- if ((response === null || response === void 0 ? void 0 : response.status) === 'success' && response.data) {
20677
- setGroupData(response.data);
20688
+ if ((res === null || res === void 0 ? void 0 : res.status) === 'success' && res.data) {
20689
+ setGroupData(res.data);
20678
20690
  } else {
20679
- setError((_b = response === null || response === void 0 ? void 0 : response.error) !== null && _b !== void 0 ? _b : 'Failed to fetch group data');
20691
+ setError((_b = res === null || res === void 0 ? void 0 : res.error) !== null && _b !== void 0 ? _b : 'Failed to fetch group data');
20680
20692
  }
20681
20693
  return [3 /*break*/, 5];
20682
20694
  case 3:
@@ -20692,7 +20704,7 @@ var useInitialGroupFetch = function (_a) {
20692
20704
  });
20693
20705
  });
20694
20706
  };
20695
- fetchGroup();
20707
+ fetch();
20696
20708
  return function () {
20697
20709
  cancelled = true;
20698
20710
  };