@wlloyalty/wll-react-sdk 1.0.100 → 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.
- package/dist/index.d.ts +1 -0
- package/dist/native.js +59 -41
- package/dist/native.js.map +1 -1
- package/dist/types/context/WllSdkContext.d.ts +1 -0
- package/dist/web.js +30 -10
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
|
@@ -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));
|
|
@@ -21090,8 +21095,15 @@ var useGroupData = function (id) {
|
|
|
21090
21095
|
isLoading = _c[0],
|
|
21091
21096
|
setIsLoading = _c[1];
|
|
21092
21097
|
var fetchGroup = React.useCallback(function () {
|
|
21093
|
-
|
|
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) {
|
|
21094
21103
|
var response, err_1;
|
|
21104
|
+
if (showLoading === void 0) {
|
|
21105
|
+
showLoading = true;
|
|
21106
|
+
}
|
|
21095
21107
|
return __generator(this, function (_a) {
|
|
21096
21108
|
switch (_a.label) {
|
|
21097
21109
|
case 0:
|
|
@@ -21100,12 +21112,14 @@ var useGroupData = function (id) {
|
|
|
21100
21112
|
setIsLoading(false);
|
|
21101
21113
|
return [2 /*return*/];
|
|
21102
21114
|
}
|
|
21103
|
-
|
|
21115
|
+
if (showLoading) {
|
|
21116
|
+
setIsLoading(true);
|
|
21117
|
+
}
|
|
21104
21118
|
setError(null);
|
|
21105
21119
|
_a.label = 1;
|
|
21106
21120
|
case 1:
|
|
21107
21121
|
_a.trys.push([1, 3, 4, 5]);
|
|
21108
|
-
return [4 /*yield*/, sdk.
|
|
21122
|
+
return [4 /*yield*/, sdk.refreshGroup(id)];
|
|
21109
21123
|
case 2:
|
|
21110
21124
|
response = _a.sent();
|
|
21111
21125
|
if (response && response.status === 'success' && response.data) {
|
|
@@ -21120,7 +21134,9 @@ var useGroupData = function (id) {
|
|
|
21120
21134
|
console.error('Error fetching group:', err_1);
|
|
21121
21135
|
return [3 /*break*/, 5];
|
|
21122
21136
|
case 4:
|
|
21123
|
-
|
|
21137
|
+
if (showLoading) {
|
|
21138
|
+
setIsLoading(false);
|
|
21139
|
+
}
|
|
21124
21140
|
return [7 /*endfinally*/];
|
|
21125
21141
|
case 5:
|
|
21126
21142
|
return [2 /*return*/];
|
|
@@ -21128,13 +21144,17 @@ var useGroupData = function (id) {
|
|
|
21128
21144
|
});
|
|
21129
21145
|
});
|
|
21130
21146
|
}, [id, sdk]);
|
|
21147
|
+
var refreshGroup = React.useCallback(function () {
|
|
21148
|
+
return fetchGroup(false);
|
|
21149
|
+
}, [fetchGroup]);
|
|
21131
21150
|
React.useEffect(function () {
|
|
21132
|
-
fetchGroup();
|
|
21151
|
+
fetchGroup(true);
|
|
21133
21152
|
}, [fetchGroup]);
|
|
21134
21153
|
return {
|
|
21135
21154
|
groupData: groupData,
|
|
21136
21155
|
isLoading: isLoading,
|
|
21137
|
-
error: error
|
|
21156
|
+
error: error,
|
|
21157
|
+
refreshGroup: refreshGroup
|
|
21138
21158
|
};
|
|
21139
21159
|
};
|
|
21140
21160
|
/**
|