@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/native.js CHANGED
@@ -3592,15 +3592,16 @@ var useContentTileStyles = function (hasArtwork) {
3592
3592
  imageContainer: {
3593
3593
  width: '100%',
3594
3594
  marginBottom: 0,
3595
+ overflow: 'hidden',
3595
3596
  },
3596
3597
  image: {
3597
3598
  position: 'absolute',
3598
- top: 0,
3599
- left: 0,
3600
- bottom: 0,
3601
- right: 0,
3602
- width: '100%',
3603
- height: '100%',
3599
+ top: -1,
3600
+ left: -1,
3601
+ bottom: -1,
3602
+ right: -1,
3603
+ width: '102%',
3604
+ height: '102%',
3604
3605
  resizeMode: 'cover',
3605
3606
  },
3606
3607
  content: {
@@ -3739,39 +3740,50 @@ var useGroupRefresh = function (_a) {
3739
3740
  }, [id, sdk, enabled, setGroupData]);
3740
3741
  };
3741
3742
 
3743
+ var inFlightRequests = new Map();
3742
3744
  var useInitialGroupFetch = function (_a) {
3743
3745
  var id = _a.id, setGroupData = _a.setGroupData;
3744
3746
  var sdk = useWllSdk();
3745
3747
  var _b = React.useState(true), isLoading = _b[0], setIsLoading = _b[1];
3746
3748
  var _c = React.useState(null), error = _c[0], setError = _c[1];
3747
3749
  React.useEffect(function () {
3750
+ if (!id || !(sdk === null || sdk === void 0 ? void 0 : sdk.refreshGroup)) {
3751
+ setError('Unable to fetch group data: invalid configuration');
3752
+ setIsLoading(false);
3753
+ return;
3754
+ }
3748
3755
  var cancelled = false;
3749
- var fetchGroup = function () { return __awaiter(void 0, void 0, void 0, function () {
3750
- var response;
3756
+ var fetch = function () { return __awaiter(void 0, void 0, void 0, function () {
3757
+ var existing, request, res;
3751
3758
  var _b;
3752
3759
  return __generator(this, function (_c) {
3753
3760
  switch (_c.label) {
3754
3761
  case 0:
3755
- if (!id || !(sdk === null || sdk === void 0 ? void 0 : sdk.refreshGroup)) {
3756
- setError('Unable to fetch group data: invalid configuration');
3757
- setIsLoading(false);
3758
- return [2 /*return*/];
3759
- }
3760
3762
  setIsLoading(true);
3761
3763
  setError(null);
3764
+ existing = inFlightRequests.get(id);
3765
+ request = existing !== null && existing !== void 0 ? existing : sdk.refreshGroup(id);
3766
+ if (!existing) {
3767
+ inFlightRequests.set(id, request);
3768
+ request.finally(function () {
3769
+ if (inFlightRequests.get(id) === request) {
3770
+ inFlightRequests.delete(id);
3771
+ }
3772
+ });
3773
+ }
3762
3774
  _c.label = 1;
3763
3775
  case 1:
3764
3776
  _c.trys.push([1, 3, 4, 5]);
3765
- return [4 /*yield*/, sdk.refreshGroup(id)];
3777
+ return [4 /*yield*/, request];
3766
3778
  case 2:
3767
- response = _c.sent();
3779
+ res = _c.sent();
3768
3780
  if (cancelled)
3769
3781
  return [2 /*return*/];
3770
- if ((response === null || response === void 0 ? void 0 : response.status) === 'success' && response.data) {
3771
- setGroupData(response.data);
3782
+ if ((res === null || res === void 0 ? void 0 : res.status) === 'success' && res.data) {
3783
+ setGroupData(res.data);
3772
3784
  }
3773
3785
  else {
3774
- setError((_b = response === null || response === void 0 ? void 0 : response.error) !== null && _b !== void 0 ? _b : 'Failed to fetch group data');
3786
+ setError((_b = res === null || res === void 0 ? void 0 : res.error) !== null && _b !== void 0 ? _b : 'Failed to fetch group data');
3775
3787
  }
3776
3788
  return [3 /*break*/, 5];
3777
3789
  case 3:
@@ -3787,7 +3799,7 @@ var useInitialGroupFetch = function (_a) {
3787
3799
  }
3788
3800
  });
3789
3801
  }); };
3790
- fetchGroup();
3802
+ fetch();
3791
3803
  return function () {
3792
3804
  cancelled = true;
3793
3805
  };