@wlloyalty/wll-react-sdk 1.0.99 → 1.0.101

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.
@@ -21,6 +21,7 @@ type WllSdkContextType = ThemeContextType & {
21
21
  getSectionByID: (id: string) => Promise<APIResponse<TSection>>;
22
22
  getTileByID: (id: string) => Promise<APIResponse<Tile>>;
23
23
  handleNavigation: (link: string, target: CTALinkTarget) => Promise<void>;
24
+ refreshGroup: (id: string) => Promise<APIResponse<TGroup>>;
24
25
  } & Readonly<{
25
26
  readonly config: SDKConfig;
26
27
  }>;
package/dist/web.js CHANGED
@@ -8252,9 +8252,6 @@ var validateTheme = function (theme) {
8252
8252
  var createSafeColor = function (color) {
8253
8253
  try {
8254
8254
  var colorInstance = Color(color);
8255
- console.log('Original color:', color);
8256
- console.log('Color instance toString:', colorInstance.toString());
8257
- console.log('Color instance hex:', colorInstance.hex());
8258
8255
  return colorInstance;
8259
8256
  } catch (error) {
8260
8257
  console.error("Invalid color value: ".concat(color), error);
@@ -8521,6 +8518,13 @@ var WllSdkProvider = function (_a) {
8521
8518
  var getSectionByID = useGetSectionByID(config);
8522
8519
  var getTileByID = useGetTileByID(config);
8523
8520
  var handleNavigation = useNavigation(navigationConfig);
8521
+ var refreshGroup = React.useCallback(function (id) {
8522
+ return __awaiter(void 0, void 0, void 0, function () {
8523
+ return __generator(this, function (_a) {
8524
+ return [2 /*return*/, getGroupByID(id)];
8525
+ });
8526
+ });
8527
+ }, [getGroupByID]);
8524
8528
  var contextValue = React.useMemo(function () {
8525
8529
  return {
8526
8530
  theme: theme,
@@ -8529,9 +8533,10 @@ var WllSdkProvider = function (_a) {
8529
8533
  getSectionByID: getSectionByID,
8530
8534
  getTileByID: getTileByID,
8531
8535
  handleNavigation: handleNavigation,
8536
+ refreshGroup: refreshGroup,
8532
8537
  config: config
8533
8538
  };
8534
- }, [theme, setTheme, getGroupByID, getSectionByID, getTileByID, handleNavigation, config]);
8539
+ }, [theme, setTheme, getGroupByID, getSectionByID, getTileByID, handleNavigation, refreshGroup, config]);
8535
8540
  return /*#__PURE__*/React.createElement(WllSdkContext.Provider, {
8536
8541
  value: contextValue
8537
8542
  }, /*#__PURE__*/React.createElement(ResponsiveProvider, null, children));
@@ -18915,12 +18920,27 @@ var Text = function (_a) {
18915
18920
  }
18916
18921
  };
18917
18922
  var variantStyle = getVariantStyle(variant);
18918
- var baseTextStyle = {
18919
- fontFamily: theme.fontFamily
18920
- };
18921
- // NOTE: We must apply fontFamily as base style to ensure it's always applied
18923
+ // NOTE: React Native Web has different style resolution rules compared to CSS.
18924
+ // 1. We create styles using StyleSheet.create for better performance
18925
+ // 2. Base styles set the initial fontFamily
18926
+ // 3. variantStyle contains responsive fontSize and other variant-specific styles
18927
+ // 4. webOverrides ensures fontFamily is correctly applied on web platform
18928
+ // (prevents system font stack from being incorrectly applied)
18929
+ // 5. custom style prop has highest precedence
18930
+ // The order matters because RN Web resolves styles by specific properties
18931
+ // rather than last-declaration-wins like in CSS
18932
+ // https://necolas.github.io/react-native-web/docs/styling/#how-it-works
18933
+ var styles = StyleSheet$1.create({
18934
+ base: {
18935
+ fontFamily: theme.fontFamily
18936
+ },
18937
+ webOverrides: IS_WEB ? {
18938
+ fontFamily: theme.fontFamily
18939
+ } : {}
18940
+ });
18941
+ var combinedStyles = [styles.base, variantStyle, styles.webOverrides, style];
18922
18942
  return /*#__PURE__*/React__namespace.createElement(Text$3, __assign({
18923
- style: [baseTextStyle, variantStyle, style]
18943
+ style: combinedStyles
18924
18944
  }, props));
18925
18945
  };
18926
18946
 
@@ -21075,8 +21095,15 @@ var useGroupData = function (id) {
21075
21095
  isLoading = _c[0],
21076
21096
  setIsLoading = _c[1];
21077
21097
  var fetchGroup = React.useCallback(function () {
21078
- return __awaiter(void 0, void 0, void 0, function () {
21098
+ var args_1 = [];
21099
+ for (var _i = 0; _i < arguments.length; _i++) {
21100
+ args_1[_i] = arguments[_i];
21101
+ }
21102
+ return __awaiter(void 0, __spreadArray([], args_1, true), void 0, function (showLoading) {
21079
21103
  var response, err_1;
21104
+ if (showLoading === void 0) {
21105
+ showLoading = true;
21106
+ }
21080
21107
  return __generator(this, function (_a) {
21081
21108
  switch (_a.label) {
21082
21109
  case 0:
@@ -21085,12 +21112,14 @@ var useGroupData = function (id) {
21085
21112
  setIsLoading(false);
21086
21113
  return [2 /*return*/];
21087
21114
  }
21088
- setIsLoading(true);
21115
+ if (showLoading) {
21116
+ setIsLoading(true);
21117
+ }
21089
21118
  setError(null);
21090
21119
  _a.label = 1;
21091
21120
  case 1:
21092
21121
  _a.trys.push([1, 3, 4, 5]);
21093
- return [4 /*yield*/, sdk.getGroupByID(id)];
21122
+ return [4 /*yield*/, sdk.refreshGroup(id)];
21094
21123
  case 2:
21095
21124
  response = _a.sent();
21096
21125
  if (response && response.status === 'success' && response.data) {
@@ -21105,7 +21134,9 @@ var useGroupData = function (id) {
21105
21134
  console.error('Error fetching group:', err_1);
21106
21135
  return [3 /*break*/, 5];
21107
21136
  case 4:
21108
- setIsLoading(false);
21137
+ if (showLoading) {
21138
+ setIsLoading(false);
21139
+ }
21109
21140
  return [7 /*endfinally*/];
21110
21141
  case 5:
21111
21142
  return [2 /*return*/];
@@ -21113,13 +21144,17 @@ var useGroupData = function (id) {
21113
21144
  });
21114
21145
  });
21115
21146
  }, [id, sdk]);
21147
+ var refreshGroup = React.useCallback(function () {
21148
+ return fetchGroup(false);
21149
+ }, [fetchGroup]);
21116
21150
  React.useEffect(function () {
21117
- fetchGroup();
21151
+ fetchGroup(true);
21118
21152
  }, [fetchGroup]);
21119
21153
  return {
21120
21154
  groupData: groupData,
21121
21155
  isLoading: isLoading,
21122
- error: error
21156
+ error: error,
21157
+ refreshGroup: refreshGroup
21123
21158
  };
21124
21159
  };
21125
21160
  /**