@wlloyalty/wll-react-sdk 1.4.0 → 1.4.2
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 +11 -3
- package/dist/native.js +10 -22
- package/dist/native.js.map +1 -1
- package/dist/types/context/WllSdkContext.d.ts +10 -2
- package/dist/web.js +10 -24
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,14 +5,22 @@ import { TSection } from '../types/section';
|
|
|
5
5
|
import { BaseThemeObject, ThemeContextType } from '../types/theme';
|
|
6
6
|
import { CTALinkTarget, Tile } from '../types/tile';
|
|
7
7
|
import { EventTypes } from '../utils/eventEmitter';
|
|
8
|
-
|
|
8
|
+
export declare enum CoreApiUrl {
|
|
9
|
+
PRODUCTION_EU = "https://api.core.wlloyalty.net/v1",
|
|
10
|
+
PRODUCTION_US = "https://api.core.us.wlloyalty.net/v1",
|
|
11
|
+
STAGING_EU = "https://api.staging.core.wlloyalty.net/v1",
|
|
12
|
+
STAGING_US = "https://api.staging.core.us.wlloyalty.net/v1",
|
|
13
|
+
DEVELOPMENT = "https://localhost:8080/v1"
|
|
14
|
+
}
|
|
15
|
+
export type AllowedCoreApiUrl = `${CoreApiUrl}`;
|
|
9
16
|
export type SDKConfig = {
|
|
10
17
|
apiKey: string;
|
|
11
18
|
userToken?: string;
|
|
12
19
|
fetcher?: Fetcher;
|
|
13
20
|
locale?: string;
|
|
14
|
-
|
|
21
|
+
coreApiUrl: AllowedCoreApiUrl;
|
|
15
22
|
};
|
|
23
|
+
type Fetcher = <T>(endpoint: string, options?: RequestInit) => Promise<APIResponse<T>>;
|
|
16
24
|
export type APIResponse<T> = {
|
|
17
25
|
status: 'success' | 'error';
|
|
18
26
|
data: T | null;
|
package/dist/web.js
CHANGED
|
@@ -7843,24 +7843,6 @@ var useNavigation = function (config) {
|
|
|
7843
7843
|
return handleNavigation;
|
|
7844
7844
|
};
|
|
7845
7845
|
|
|
7846
|
-
var getBaseUrl = function (environment) {
|
|
7847
|
-
if (environment === void 0) {
|
|
7848
|
-
environment = 'STAGING';
|
|
7849
|
-
}
|
|
7850
|
-
switch (environment) {
|
|
7851
|
-
case 'PRODUCTION':
|
|
7852
|
-
return 'https://api.core.wlloyalty.net/v1';
|
|
7853
|
-
case 'PRODUCTION-US':
|
|
7854
|
-
return 'https://api.core.us.wlloyalty.net/v1';
|
|
7855
|
-
case 'STAGING-US':
|
|
7856
|
-
return 'https://api.core.wlloyalty.net/v1';
|
|
7857
|
-
case 'DEVELOPMENT':
|
|
7858
|
-
return 'https://localhost:8080/v1';
|
|
7859
|
-
case 'STAGING':
|
|
7860
|
-
default:
|
|
7861
|
-
return 'https://api.staging.core.wlloyalty.net/v1';
|
|
7862
|
-
}
|
|
7863
|
-
};
|
|
7864
7846
|
var useCreateRequestOptions = function (config) {
|
|
7865
7847
|
return React.useCallback(function (options) {
|
|
7866
7848
|
if (options === void 0) {
|
|
@@ -7932,11 +7914,10 @@ var createResourceGetter = function (resource, includeHydrate) {
|
|
|
7932
7914
|
}
|
|
7933
7915
|
// Always append locale=en
|
|
7934
7916
|
params.append('locale', config.locale || 'en');
|
|
7935
|
-
var
|
|
7936
|
-
var baseUrl = getBaseUrl(env);
|
|
7917
|
+
var baseUrl = config.coreApiUrl;
|
|
7937
7918
|
var queryString = params.toString();
|
|
7938
7919
|
return makeRequest("".concat(baseUrl, "/tiles-management/").concat(resource, "/").concat(id).concat(queryString ? "?".concat(queryString) : ''));
|
|
7939
|
-
}, [makeRequest, config.
|
|
7920
|
+
}, [makeRequest, resource, includeHydrate, config.coreApiUrl, config.locale]);
|
|
7940
7921
|
};
|
|
7941
7922
|
};
|
|
7942
7923
|
var useGetGroupByID = createResourceGetter('groups', true);
|
|
@@ -8569,6 +8550,14 @@ function useResponsive() {
|
|
|
8569
8550
|
return context;
|
|
8570
8551
|
}
|
|
8571
8552
|
|
|
8553
|
+
exports.CoreApiUrl = void 0;
|
|
8554
|
+
(function (CoreApiUrl) {
|
|
8555
|
+
CoreApiUrl["PRODUCTION_EU"] = "https://api.core.wlloyalty.net/v1";
|
|
8556
|
+
CoreApiUrl["PRODUCTION_US"] = "https://api.core.us.wlloyalty.net/v1";
|
|
8557
|
+
CoreApiUrl["STAGING_EU"] = "https://api.staging.core.wlloyalty.net/v1";
|
|
8558
|
+
CoreApiUrl["STAGING_US"] = "https://api.staging.core.us.wlloyalty.net/v1";
|
|
8559
|
+
CoreApiUrl["DEVELOPMENT"] = "https://localhost:8080/v1";
|
|
8560
|
+
})(exports.CoreApiUrl || (exports.CoreApiUrl = {}));
|
|
8572
8561
|
var createTheme = function (baseTheme) {
|
|
8573
8562
|
if (baseTheme === void 0) {
|
|
8574
8563
|
baseTheme = {};
|
|
@@ -8674,9 +8663,6 @@ var validateConfig = function (config) {
|
|
|
8674
8663
|
if (config.locale && !/^[a-z]{2}$/.test(config.locale)) {
|
|
8675
8664
|
throw new Error('Invalid locale format. Expected ISO 639-1 language code (e.g. "en")');
|
|
8676
8665
|
}
|
|
8677
|
-
if (!config.environment) {
|
|
8678
|
-
config.environment = 'STAGING';
|
|
8679
|
-
}
|
|
8680
8666
|
};
|
|
8681
8667
|
|
|
8682
8668
|
function createVariantSystem(baseStyle, variantStyles) {
|