@wlloyalty/wll-react-sdk 1.3.0 → 1.3.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.
@@ -11,6 +11,7 @@ export type SDKConfig = {
11
11
  userToken?: string;
12
12
  fetcher?: Fetcher;
13
13
  locale?: string;
14
+ environment?: 'PRODUCTION' | 'STAGING' | 'DEVELOPMENT';
14
15
  };
15
16
  export type APIResponse<T> = {
16
17
  status: 'success' | 'error';
package/dist/web.js CHANGED
@@ -7843,7 +7843,20 @@ var useNavigation = function (config) {
7843
7843
  return handleNavigation;
7844
7844
  };
7845
7845
 
7846
- var baseUrl = 'https://api.staging.core.wlloyalty.net/v1';
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 'DEVELOPMENT':
7854
+ return 'https://localhost:8080/v1';
7855
+ case 'STAGING':
7856
+ default:
7857
+ return 'https://api.staging.core.wlloyalty.net/v1';
7858
+ }
7859
+ };
7847
7860
  var useCreateRequestOptions = function (config) {
7848
7861
  return React.useCallback(function (options) {
7849
7862
  if (options === void 0) {
@@ -7915,9 +7928,11 @@ var createResourceGetter = function (resource, includeHydrate) {
7915
7928
  }
7916
7929
  // Always append locale=en
7917
7930
  params.append('locale', config.locale || 'en');
7931
+ var env = config.environment || 'STAGING';
7932
+ var baseUrl = getBaseUrl(env);
7918
7933
  var queryString = params.toString();
7919
7934
  return makeRequest("".concat(baseUrl, "/tiles-management/").concat(resource, "/").concat(id).concat(queryString ? "?".concat(queryString) : ''));
7920
- }, [makeRequest]);
7935
+ }, [makeRequest, config.environment]);
7921
7936
  };
7922
7937
  };
7923
7938
  var useGetGroupByID = createResourceGetter('groups', true);
@@ -8655,6 +8670,9 @@ var validateConfig = function (config) {
8655
8670
  if (config.locale && !/^[a-z]{2}$/.test(config.locale)) {
8656
8671
  throw new Error('Invalid locale format. Expected ISO 639-1 language code (e.g. "en")');
8657
8672
  }
8673
+ if (!config.environment) {
8674
+ config.environment = 'STAGING';
8675
+ }
8658
8676
  };
8659
8677
 
8660
8678
  function createVariantSystem(baseStyle, variantStyles) {