@wlloyalty/wll-react-sdk 1.3.0 → 1.4.0
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 +22 -2
- package/dist/native.js.map +1 -1
- package/dist/types/context/WllSdkContext.d.ts +1 -0
- package/dist/web.js +24 -2
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/native.js
CHANGED
|
@@ -1523,7 +1523,22 @@ var useNavigation = function (config) {
|
|
|
1523
1523
|
return handleNavigation;
|
|
1524
1524
|
};
|
|
1525
1525
|
|
|
1526
|
-
var
|
|
1526
|
+
var getBaseUrl = function (environment) {
|
|
1527
|
+
if (environment === void 0) { environment = 'STAGING'; }
|
|
1528
|
+
switch (environment) {
|
|
1529
|
+
case 'PRODUCTION':
|
|
1530
|
+
return 'https://api.core.wlloyalty.net/v1';
|
|
1531
|
+
case 'PRODUCTION-US':
|
|
1532
|
+
return 'https://api.core.us.wlloyalty.net/v1';
|
|
1533
|
+
case 'STAGING-US':
|
|
1534
|
+
return 'https://api.core.wlloyalty.net/v1';
|
|
1535
|
+
case 'DEVELOPMENT':
|
|
1536
|
+
return 'https://localhost:8080/v1';
|
|
1537
|
+
case 'STAGING':
|
|
1538
|
+
default:
|
|
1539
|
+
return 'https://api.staging.core.wlloyalty.net/v1';
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1527
1542
|
var useCreateRequestOptions = function (config) {
|
|
1528
1543
|
return React.useCallback(function (options) {
|
|
1529
1544
|
if (options === void 0) { options = {}; }
|
|
@@ -1586,9 +1601,11 @@ var createResourceGetter = function (resource, includeHydrate) {
|
|
|
1586
1601
|
}
|
|
1587
1602
|
// Always append locale=en
|
|
1588
1603
|
params.append('locale', config.locale || 'en');
|
|
1604
|
+
var env = config.environment || 'STAGING';
|
|
1605
|
+
var baseUrl = getBaseUrl(env);
|
|
1589
1606
|
var queryString = params.toString();
|
|
1590
1607
|
return makeRequest("".concat(baseUrl, "/tiles-management/").concat(resource, "/").concat(id).concat(queryString ? "?".concat(queryString) : ''));
|
|
1591
|
-
}, [makeRequest]);
|
|
1608
|
+
}, [makeRequest, config.environment]);
|
|
1592
1609
|
};
|
|
1593
1610
|
};
|
|
1594
1611
|
var useGetGroupByID = createResourceGetter('groups', true);
|
|
@@ -2090,6 +2107,9 @@ var validateConfig = function (config) {
|
|
|
2090
2107
|
if (config.locale && !/^[a-z]{2}$/.test(config.locale)) {
|
|
2091
2108
|
throw new Error('Invalid locale format. Expected ISO 639-1 language code (e.g. "en")');
|
|
2092
2109
|
}
|
|
2110
|
+
if (!config.environment) {
|
|
2111
|
+
config.environment = 'STAGING';
|
|
2112
|
+
}
|
|
2093
2113
|
};
|
|
2094
2114
|
|
|
2095
2115
|
function createVariantSystem(baseStyle, variantStyles) {
|