@wlloyalty/wll-react-sdk 1.4.1 → 1.4.3
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 +11 -24
- package/dist/native.js.map +1 -1
- package/dist/types/context/WllSdkContext.d.ts +10 -2
- package/dist/web.js +11 -26
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -685,14 +685,22 @@ type NavigationConfig = {
|
|
|
685
685
|
*/
|
|
686
686
|
type EventTypes = 'GROUP_DATA_CHANGED' | 'SECTION_DATA_CHANGED' | 'TILE_DATA_CHANGED' | string;
|
|
687
687
|
|
|
688
|
-
|
|
688
|
+
declare enum CoreApiUrl {
|
|
689
|
+
PRODUCTION_EU = "https://api.core.wlloyalty.net/v1",
|
|
690
|
+
PRODUCTION_US = "https://api.core.us.wlloyalty.net/v1",
|
|
691
|
+
STAGING_EU = "https://api.staging.core.wlloyalty.net/v1",
|
|
692
|
+
STAGING_US = "https://api.staging.core.us.wlloyalty.net/v1",
|
|
693
|
+
DEVELOPMENT = "https://localhost:8080/v1"
|
|
694
|
+
}
|
|
695
|
+
type AllowedCoreApiUrl = `${CoreApiUrl}`;
|
|
689
696
|
type SDKConfig = {
|
|
690
697
|
apiKey: string;
|
|
691
698
|
userToken?: string;
|
|
692
699
|
fetcher?: Fetcher;
|
|
693
700
|
locale?: string;
|
|
694
|
-
|
|
701
|
+
coreApiUrl: AllowedCoreApiUrl;
|
|
695
702
|
};
|
|
703
|
+
type Fetcher = <T>(endpoint: string, options?: RequestInit) => Promise<APIResponse<T>>;
|
|
696
704
|
type APIResponse<T> = {
|
|
697
705
|
status: 'success' | 'error';
|
|
698
706
|
data: T | null;
|
|
@@ -717,4 +725,4 @@ type WllSdkProviderProps = WithChildren & {
|
|
|
717
725
|
declare const WllSdkProvider: ({ children, theme: providedTheme, config, navigationConfig, }: WllSdkProviderProps) => JSX.Element;
|
|
718
726
|
declare const useWllSdk: () => WllSdkContextType;
|
|
719
727
|
|
|
720
|
-
export { type APIResponse, type Align, type Availability, type Badge, type BadgeDetail, _default$6 as BadgeTile, BadgeTileConfig, BadgeTileType, _default$5 as BannerTile, BannerTileConfig, BaseBanner, type BaseThemeObject, BaseTile, Button, CTALinkTarget, Carousel, CarouselNavButton, Column, _default$4 as ContentTile, ContentTileConfig, type DerivedColors, type DerivedProperties, type DesaturationType, type FlexDirection, FullFlex, Grid, Group, Icon, type ImagePropsNoSource, Indicator, type Justify, Layout, type LayoutProps$1 as LayoutProps, LoadingIndicator, type NavigationConfig, type NavigationType, type PercentageKey, _default$3 as PointsTile, PointsTileConfig, type ProgessType, ProgressBar, ProgressIndicator, ProgressType, ProgressiveImage, Reward, type RewardCategory, _default$2 as RewardCategoryTile, RewardCategoryTileConfig, _default$1 as RewardTile, RewardTileConfig, _default as RoundupTile, RoundupTileConfig, Row, type SDKConfig, Section, SectionHeader, SectionType, type Size, Skeleton, Spacer, type TGroup, type TSection, Text, type ThemeContextType, type ThemeObject, type ThemeProviderProps, TierTileConfig, TierTileType, TierTile as TierTileUpdated, type TierType, type Tile, type TileConfig, TileContainer, TileHeight, type TileSizeInfo, TileType, type Variant, WllSdkProvider, alignMap, justifyMap, useWllSdk };
|
|
728
|
+
export { type APIResponse, type Align, type AllowedCoreApiUrl, type Availability, type Badge, type BadgeDetail, _default$6 as BadgeTile, BadgeTileConfig, BadgeTileType, _default$5 as BannerTile, BannerTileConfig, BaseBanner, type BaseThemeObject, BaseTile, Button, CTALinkTarget, Carousel, CarouselNavButton, Column, _default$4 as ContentTile, ContentTileConfig, CoreApiUrl, type DerivedColors, type DerivedProperties, type DesaturationType, type FlexDirection, FullFlex, Grid, Group, Icon, type ImagePropsNoSource, Indicator, type Justify, Layout, type LayoutProps$1 as LayoutProps, LoadingIndicator, type NavigationConfig, type NavigationType, type PercentageKey, _default$3 as PointsTile, PointsTileConfig, type ProgessType, ProgressBar, ProgressIndicator, ProgressType, ProgressiveImage, Reward, type RewardCategory, _default$2 as RewardCategoryTile, RewardCategoryTileConfig, _default$1 as RewardTile, RewardTileConfig, _default as RoundupTile, RoundupTileConfig, Row, type SDKConfig, Section, SectionHeader, SectionType, type Size, Skeleton, Spacer, type TGroup, type TSection, Text, type ThemeContextType, type ThemeObject, type ThemeProviderProps, TierTileConfig, TierTileType, TierTile as TierTileUpdated, type TierType, type Tile, type TileConfig, TileContainer, TileHeight, type TileSizeInfo, TileType, type Variant, WllSdkProvider, alignMap, justifyMap, useWllSdk };
|
package/dist/native.js
CHANGED
|
@@ -1523,22 +1523,6 @@ var useNavigation = function (config) {
|
|
|
1523
1523
|
return handleNavigation;
|
|
1524
1524
|
};
|
|
1525
1525
|
|
|
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.staging.core.us.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
|
-
};
|
|
1542
1526
|
var useCreateRequestOptions = function (config) {
|
|
1543
1527
|
return React.useCallback(function (options) {
|
|
1544
1528
|
if (options === void 0) { options = {}; }
|
|
@@ -1601,11 +1585,10 @@ var createResourceGetter = function (resource, includeHydrate) {
|
|
|
1601
1585
|
}
|
|
1602
1586
|
// Always append locale=en
|
|
1603
1587
|
params.append('locale', config.locale || 'en');
|
|
1604
|
-
var
|
|
1605
|
-
var baseUrl = getBaseUrl(env);
|
|
1588
|
+
var baseUrl = config.coreApiUrl;
|
|
1606
1589
|
var queryString = params.toString();
|
|
1607
1590
|
return makeRequest("".concat(baseUrl, "/tiles-management/").concat(resource, "/").concat(id).concat(queryString ? "?".concat(queryString) : ''));
|
|
1608
|
-
}, [makeRequest, config.
|
|
1591
|
+
}, [makeRequest, resource, includeHydrate, config.coreApiUrl, config.locale]);
|
|
1609
1592
|
};
|
|
1610
1593
|
};
|
|
1611
1594
|
var useGetGroupByID = createResourceGetter('groups', true);
|
|
@@ -2018,6 +2001,14 @@ function useResponsive() {
|
|
|
2018
2001
|
return context;
|
|
2019
2002
|
}
|
|
2020
2003
|
|
|
2004
|
+
exports.CoreApiUrl = void 0;
|
|
2005
|
+
(function (CoreApiUrl) {
|
|
2006
|
+
CoreApiUrl["PRODUCTION_EU"] = "https://api.core.wlloyalty.net/v1";
|
|
2007
|
+
CoreApiUrl["PRODUCTION_US"] = "https://api.core.us.wlloyalty.net/v1";
|
|
2008
|
+
CoreApiUrl["STAGING_EU"] = "https://api.staging.core.wlloyalty.net/v1";
|
|
2009
|
+
CoreApiUrl["STAGING_US"] = "https://api.staging.core.us.wlloyalty.net/v1";
|
|
2010
|
+
CoreApiUrl["DEVELOPMENT"] = "https://localhost:8080/v1";
|
|
2011
|
+
})(exports.CoreApiUrl || (exports.CoreApiUrl = {}));
|
|
2021
2012
|
var createTheme = function (baseTheme) {
|
|
2022
2013
|
if (baseTheme === void 0) { baseTheme = {}; }
|
|
2023
2014
|
var mergedTheme = __assign(__assign({}, defaultTheme), baseTheme);
|
|
@@ -2107,9 +2098,6 @@ var validateConfig = function (config) {
|
|
|
2107
2098
|
if (config.locale && !/^[a-z]{2}$/.test(config.locale)) {
|
|
2108
2099
|
throw new Error('Invalid locale format. Expected ISO 639-1 language code (e.g. "en")');
|
|
2109
2100
|
}
|
|
2110
|
-
if (!config.environment) {
|
|
2111
|
-
config.environment = 'STAGING';
|
|
2112
|
-
}
|
|
2113
2101
|
};
|
|
2114
2102
|
|
|
2115
2103
|
function createVariantSystem(baseStyle, variantStyles) {
|
|
@@ -4462,8 +4450,7 @@ var GroupSections = function () {
|
|
|
4462
4450
|
return (jsxRuntimeExports.jsx(GroupEmptyState, { message: "This group doesn't have any active sections" }));
|
|
4463
4451
|
}
|
|
4464
4452
|
var sortedSections = sortByPriority(activeSections);
|
|
4465
|
-
|
|
4466
|
-
return (jsxRuntimeExports.jsx(Container, { accessible: true, accessibilityLabel: "Group: ".concat(groupData.name || 'Unnamed group'), role: "region", children: sortedSections.map(function (section) { return (jsxRuntimeExports.jsx(Section, { section: section }, section.id)); }) }));
|
|
4453
|
+
return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Group: ".concat(groupData.name || 'Unnamed group'), role: "region", children: sortedSections.map(function (section) { return (jsxRuntimeExports.jsx(Section, { section: section }, section.id)); }) }));
|
|
4467
4454
|
};
|
|
4468
4455
|
/**
|
|
4469
4456
|
* A page-level component that represents a Group view in the application.
|