@wlloyalty/wll-react-sdk 1.0.51 → 1.0.53
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/components/__test__/test-setup.d.ts +9 -0
- package/dist/components/__test__/test-utils.d.ts +4 -0
- package/dist/components/atoms/BaseBanner/index.d.ts +15 -0
- package/dist/components/atoms/BaseTile/base-tile-body.d.ts +8 -0
- package/dist/components/atoms/BaseTile/base-tile-content.d.ts +4 -0
- package/dist/components/atoms/BaseTile/base-tile-header.d.ts +4 -0
- package/dist/components/atoms/BaseTile/base-tile-media.d.ts +2 -0
- package/dist/components/atoms/BaseTile/base-tile-title.d.ts +1 -0
- package/dist/components/atoms/BaseTile/index.d.ts +36 -0
- package/dist/components/atoms/BaseTile/styles.d.ts +47 -0
- package/dist/components/atoms/Button/Button.stories.d.ts +7 -0
- package/dist/components/atoms/Button/index.d.ts +12 -0
- package/dist/components/atoms/Button/styles.d.ts +2 -0
- package/dist/components/atoms/Icon/Icon.stories.d.ts +28 -0
- package/dist/components/atoms/Icon/index.d.ts +11 -0
- package/dist/components/atoms/Indicator/index.d.ts +2 -0
- package/dist/components/atoms/LoadingIndicator/index.d.ts +2 -0
- package/dist/components/atoms/Primatives/Column.d.ts +22 -0
- package/dist/components/atoms/Primatives/FullFlex.d.ts +20 -0
- package/dist/components/atoms/Primatives/Layout.d.ts +21 -0
- package/dist/components/atoms/Primatives/Row.d.ts +22 -0
- package/dist/components/atoms/Primatives/Spacer.d.ts +17 -0
- package/dist/components/atoms/Primatives/index.d.ts +5 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.stories.d.ts +8 -0
- package/dist/components/atoms/ProgressBar/index.d.ts +9 -0
- package/dist/components/atoms/ProgressiveImage/ProgressiveImage.stories.d.ts +9 -0
- package/dist/components/atoms/ProgressiveImage/index.d.ts +9 -0
- package/dist/components/atoms/Skeleton/index.d.ts +10 -0
- package/dist/components/atoms/SkeletonTile/index.d.ts +6 -0
- package/dist/components/atoms/Text/Text.stories.d.ts +11 -0
- package/dist/components/atoms/Text/index.d.ts +9 -0
- package/dist/components/atoms/TileContainer/index.d.ts +9 -0
- package/dist/components/atoms/index.d.ts +12 -0
- package/dist/components/hoc/withTileFetching.d.ts +9 -0
- package/dist/components/molecules/Carousel/Carousel.spec.d.ts +1 -0
- package/dist/components/molecules/Carousel/Carousel.stories.d.ts +12 -0
- package/dist/components/molecules/Carousel/index.d.ts +6 -0
- package/dist/components/molecules/Carousel/styles.d.ts +2 -0
- package/dist/components/molecules/Grid/Grid.spec.d.ts +1 -0
- package/dist/components/molecules/Grid/Grid.stories.d.ts +6 -0
- package/dist/components/molecules/Grid/index.d.ts +7 -0
- package/dist/components/molecules/ProgressIndicator/ProgressIndicator.stories.d.ts +8 -0
- package/dist/components/molecules/ProgressIndicator/index.d.ts +10 -0
- package/dist/components/molecules/SectionHeader/SectionHeader.spec.d.ts +1 -0
- package/dist/components/molecules/SectionHeader/SectionHeader.stories.d.ts +7 -0
- package/dist/components/molecules/SectionHeader/index.d.ts +6 -0
- package/dist/components/molecules/SectionHeader/styles.d.ts +2 -0
- package/dist/components/molecules/index.d.ts +4 -0
- package/dist/components/organisms/BadgeTile/BadgeTile.spec.d.ts +1 -0
- package/dist/components/organisms/BadgeTile/BadgeTile.stories.d.ts +21 -0
- package/dist/components/organisms/BadgeTile/badge-tile-date-earned.d.ts +1 -0
- package/dist/components/organisms/BadgeTile/badge-tile-description.d.ts +1 -0
- package/dist/components/organisms/BadgeTile/badge-tile-media.d.ts +6 -0
- package/dist/components/organisms/BadgeTile/badge-tile-status.d.ts +1 -0
- package/dist/components/organisms/BadgeTile/badge-tile-title.d.ts +1 -0
- package/dist/components/organisms/BadgeTile/index.d.ts +17 -0
- package/dist/components/organisms/BadgeTile/styles.d.ts +2 -0
- package/dist/components/organisms/BannerTile/BannerTile.spec.d.ts +1 -0
- package/dist/components/organisms/BannerTile/BannerTile.stories.d.ts +12 -0
- package/dist/components/organisms/BannerTile/banner-tile-cta.d.ts +1 -0
- package/dist/components/organisms/BannerTile/banner-tile-description.d.ts +1 -0
- package/dist/components/organisms/BannerTile/banner-tile-media.d.ts +5 -0
- package/dist/components/organisms/BannerTile/banner-tile-title.d.ts +1 -0
- package/dist/components/organisms/BannerTile/index.d.ts +18 -0
- package/dist/components/organisms/BannerTile/styles.d.ts +2 -0
- package/dist/components/organisms/ContentTile/ContentTile.spec.d.ts +2 -0
- package/dist/components/organisms/ContentTile/ContentTile.stories.d.ts +28 -0
- package/dist/components/organisms/ContentTile/content-tile-body.d.ts +1 -0
- package/dist/components/organisms/ContentTile/content-tile-container.d.ts +4 -0
- package/dist/components/organisms/ContentTile/content-tile-content.d.ts +4 -0
- package/dist/components/organisms/ContentTile/content-tile-header.d.ts +1 -0
- package/dist/components/organisms/ContentTile/content-tile-media.d.ts +1 -0
- package/dist/components/organisms/ContentTile/index.d.ts +21 -0
- package/dist/components/organisms/ContentTile/styles.d.ts +2 -0
- package/dist/components/organisms/Group/Group.stories.d.ts +10 -0
- package/dist/components/organisms/Group/index.d.ts +27 -0
- package/dist/components/organisms/PointsTile/PointsTile.spec.d.ts +3 -0
- package/dist/components/organisms/PointsTile/PointsTile.stories.d.ts +30 -0
- package/dist/components/organisms/PointsTile/index.d.ts +17 -0
- package/dist/components/organisms/PointsTile/points-tile-formatted-points.d.ts +1 -0
- package/dist/components/organisms/PointsTile/points-tile-media.d.ts +5 -0
- package/dist/components/organisms/PointsTile/points-tile-title.d.ts +1 -0
- package/dist/components/organisms/PointsTile/styles.d.ts +9 -0
- package/dist/components/organisms/RewardCategoryTile/RewardCategoryTile.spec.d.ts +17 -0
- package/dist/components/organisms/RewardCategoryTile/RewardCategoryTile.stories.d.ts +24 -0
- package/dist/components/organisms/RewardCategoryTile/index.d.ts +14 -0
- package/dist/components/organisms/RewardCategoryTile/reward-category-header.d.ts +1 -0
- package/dist/components/organisms/RewardCategoryTile/reward-category-media.d.ts +1 -0
- package/dist/components/organisms/RewardCategoryTile/styles.d.ts +2 -0
- package/dist/components/organisms/RewardTile/RewardTile.spec.d.ts +2 -0
- package/dist/components/organisms/RewardTile/RewardTile.stories.d.ts +12 -0
- package/dist/components/organisms/RewardTile/index.d.ts +19 -0
- package/dist/components/organisms/RewardTile/reward-tile-chevron.d.ts +1 -0
- package/dist/components/organisms/RewardTile/reward-tile-media.d.ts +5 -0
- package/dist/components/organisms/RewardTile/reward-tile-points.d.ts +1 -0
- package/dist/components/organisms/RewardTile/reward-tile-summary.d.ts +1 -0
- package/dist/components/organisms/RewardTile/reward-tile-title.d.ts +1 -0
- package/dist/components/organisms/RewardTile/styles.d.ts +2 -0
- package/dist/components/organisms/Section/Section.spec.d.ts +1 -0
- package/dist/components/organisms/Section/Section.stories.d.ts +7 -0
- package/dist/components/organisms/Section/index.d.ts +22 -0
- package/dist/components/organisms/Section/styles.d.ts +2 -0
- package/dist/components/organisms/TierTileUpdated/TierTileUpdated.stories.d.ts +33 -0
- package/dist/components/organisms/TierTileUpdated/index.d.ts +15 -0
- package/dist/components/organisms/TierTileUpdated/styles.d.ts +36 -0
- package/dist/components/organisms/index.d.ts +9 -0
- package/dist/constants/device.d.ts +7 -0
- package/dist/constants/grid.d.ts +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/responsive.d.ts +7 -0
- package/dist/context/ResponsiveContext.d.ts +4 -0
- package/dist/context/WllSdkContext.d.ts +33 -0
- package/dist/hooks/useHandleTilePress.d.ts +2 -0
- package/dist/hooks/useNavigationHandler.d.ts +3 -0
- package/dist/hooks/useResponsive.d.ts +8 -0
- package/dist/hooks/useTileSize.d.ts +5 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.js +7958 -8017
- package/dist/index.js.map +1 -1
- package/dist/types/common.d.ts +14 -0
- package/dist/types/group.d.ts +9 -0
- package/dist/types/navigation.d.ts +14 -0
- package/dist/types/responsive.d.ts +11 -0
- package/dist/types/section.d.ts +23 -0
- package/dist/types/theme.d.ts +40 -0
- package/dist/types/tile.d.ts +158 -0
- package/dist/types/wll.d.ts +60 -0
- package/dist/unit-tests/apiHelpers.spec.d.ts +1 -0
- package/dist/unit-tests/navigationHelpers.spec.d.ts +1 -0
- package/dist/unit-tests/pointsHelpers.spec.d.ts +1 -0
- package/dist/unit-tests/responsiveHelper.spec.d.ts +1 -0
- package/dist/unit-tests/transforms.spec.d.ts +1 -0
- package/dist/unit-tests/useNavigationHandler.spec.d.ts +1 -0
- package/dist/utils/apiHelpers.d.ts +28 -0
- package/dist/utils/navigationHelpers.d.ts +5 -0
- package/dist/utils/pointsHelpers.d.ts +21 -0
- package/dist/utils/responsiveHelper.d.ts +2 -0
- package/dist/utils/storybookHelpers.d.ts +5 -0
- package/dist/utils/storybookThemes.d.ts +74 -0
- package/dist/utils/styling.d.ts +26 -0
- package/dist/utils/themeHelpers.d.ts +13 -0
- package/dist/utils/transforms.d.ts +7 -0
- package/dist/utils/variant.d.ts +5 -0
- package/package.json +21 -6
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ImageProps, ViewStyle } from 'react-native';
|
|
2
|
+
export type ImagePropsNoSource = Omit<ImageProps, 'source'>;
|
|
3
|
+
export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
4
|
+
export type Justify = 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';
|
|
5
|
+
export type Align = 'start' | 'end' | 'center' | 'stretch' | 'baseline';
|
|
6
|
+
export type LayoutProps = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
justify?: Justify;
|
|
9
|
+
align?: Align;
|
|
10
|
+
direction?: FlexDirection;
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
};
|
|
13
|
+
export declare const justifyMap: Record<Justify, ViewStyle['justifyContent']>;
|
|
14
|
+
export declare const alignMap: Record<Align, ViewStyle['alignItems']>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type NavigationType = 'external' | 'internal' | 'modal';
|
|
2
|
+
type NavigationHandlerParams = {
|
|
3
|
+
target: string;
|
|
4
|
+
windowTarget: string;
|
|
5
|
+
};
|
|
6
|
+
export type NavigationConfig = {
|
|
7
|
+
navigationHandlers?: {
|
|
8
|
+
external?: (params: NavigationHandlerParams) => void;
|
|
9
|
+
internal?: (params: NavigationHandlerParams) => void;
|
|
10
|
+
modal?: (params: NavigationHandlerParams) => void;
|
|
11
|
+
};
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type DimensionMode = 'desktop' | 'tablet' | 'mobile';
|
|
2
|
+
export interface WindowDimensions {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ResponsiveContextType {
|
|
7
|
+
dimensionMode: DimensionMode;
|
|
8
|
+
isTablet: boolean;
|
|
9
|
+
isMobile: boolean;
|
|
10
|
+
isDesktop: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Tile } from './tile';
|
|
2
|
+
export declare enum SectionType {
|
|
3
|
+
Grid = "GRID",
|
|
4
|
+
Banner = "BANNER"
|
|
5
|
+
}
|
|
6
|
+
export type TSection = {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: SectionType;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
tiles: Tile[];
|
|
15
|
+
pointsMultiplier?: number;
|
|
16
|
+
pointsPrefix?: string | null;
|
|
17
|
+
pointsSuffix?: string | null;
|
|
18
|
+
priority: number;
|
|
19
|
+
active: boolean;
|
|
20
|
+
details?: [];
|
|
21
|
+
defaultLocale: string;
|
|
22
|
+
locale: string;
|
|
23
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { sizes } from '../utils/styling';
|
|
3
|
+
import { DerivedColors } from '../utils/themeHelpers';
|
|
4
|
+
export type BaseThemeObject = {
|
|
5
|
+
accent: string;
|
|
6
|
+
background: string;
|
|
7
|
+
errorPrimary: string;
|
|
8
|
+
negative: string;
|
|
9
|
+
pageButtonBackground: string;
|
|
10
|
+
pageButtonText: string;
|
|
11
|
+
positive: string;
|
|
12
|
+
primary: string;
|
|
13
|
+
surface: string;
|
|
14
|
+
surfaceText: string;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
export type DerivedProperties = {
|
|
18
|
+
accentText: string;
|
|
19
|
+
derivedBackground: string;
|
|
20
|
+
primaryText: string;
|
|
21
|
+
positiveText: string;
|
|
22
|
+
negativeText: string;
|
|
23
|
+
derivedSurfaceText: DerivedColors;
|
|
24
|
+
derivedSurface: DerivedColors;
|
|
25
|
+
alphaDerivedPrimary: DerivedColors;
|
|
26
|
+
alphaDerivedText: DerivedColors;
|
|
27
|
+
};
|
|
28
|
+
export type ThemeObject = BaseThemeObject & DerivedProperties & {
|
|
29
|
+
readonly sizes: typeof sizes;
|
|
30
|
+
};
|
|
31
|
+
export type ThemeContextType = {
|
|
32
|
+
theme: ThemeObject;
|
|
33
|
+
setTheme: (theme: ThemeObject) => void;
|
|
34
|
+
};
|
|
35
|
+
export type ThemeProviderProps = {
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
theme?: Partial<BaseThemeObject>;
|
|
38
|
+
};
|
|
39
|
+
export type Variant = 'primary' | 'accent' | 'positive' | 'negative';
|
|
40
|
+
export type Size = 'sm' | 'md' | 'lg';
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Availability, RewardCategory, TierType } from './wll';
|
|
2
|
+
export declare enum CTALinkTarget {
|
|
3
|
+
sameWindow = "SAME_FRAME",
|
|
4
|
+
newWindow = "NEW_WINDOW"
|
|
5
|
+
}
|
|
6
|
+
export declare enum TierTileType {
|
|
7
|
+
currentTier = "CURRENT",
|
|
8
|
+
specificTier = "SPECIFIC"
|
|
9
|
+
}
|
|
10
|
+
export declare enum ProgressType {
|
|
11
|
+
Name = "NAME",
|
|
12
|
+
Points = "POINTS"
|
|
13
|
+
}
|
|
14
|
+
export declare enum TileType {
|
|
15
|
+
Banner = "BANNER",
|
|
16
|
+
Points = "POINTS",
|
|
17
|
+
Content = "CONTENT",
|
|
18
|
+
Reward = "REWARD",
|
|
19
|
+
Badge = "BADGE",
|
|
20
|
+
RewardCategory = "REWARD_CATEGORY",
|
|
21
|
+
Tier = "TIER"
|
|
22
|
+
}
|
|
23
|
+
export declare enum TileHeight {
|
|
24
|
+
Half = "HALF",
|
|
25
|
+
Full = "FULL"
|
|
26
|
+
}
|
|
27
|
+
export type ProgessType = 'NAME' | 'POINTS';
|
|
28
|
+
export declare class BannerTileConfig {
|
|
29
|
+
artworkUrl?: string | null;
|
|
30
|
+
title?: string | null;
|
|
31
|
+
description?: string | null;
|
|
32
|
+
ctaText?: string | null;
|
|
33
|
+
ctaLink?: string | null;
|
|
34
|
+
ctaLinkTarget?: CTALinkTarget;
|
|
35
|
+
}
|
|
36
|
+
export declare class PointsTileConfig {
|
|
37
|
+
title?: string | null;
|
|
38
|
+
pointsMultiplier?: number;
|
|
39
|
+
pointsPrefix?: string | null;
|
|
40
|
+
pointsSuffix?: string | null;
|
|
41
|
+
artworkUrl?: string | null;
|
|
42
|
+
points?: number;
|
|
43
|
+
}
|
|
44
|
+
export declare class ContentTileConfig {
|
|
45
|
+
title?: string | null;
|
|
46
|
+
body?: string | null;
|
|
47
|
+
artworkUrl?: string | null;
|
|
48
|
+
ctaLinkTarget?: CTALinkTarget;
|
|
49
|
+
ctaLink?: string | null;
|
|
50
|
+
}
|
|
51
|
+
export declare class RewardTileConfig {
|
|
52
|
+
rewardId: string;
|
|
53
|
+
defaultLocale: string;
|
|
54
|
+
showPrice: boolean;
|
|
55
|
+
showArtwork?: boolean;
|
|
56
|
+
showDetails?: boolean;
|
|
57
|
+
id: string;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
name: string;
|
|
61
|
+
pictureUrl: string;
|
|
62
|
+
value: number;
|
|
63
|
+
price: number;
|
|
64
|
+
priority: number;
|
|
65
|
+
availability: Availability;
|
|
66
|
+
purchasable: boolean;
|
|
67
|
+
tier: string | null;
|
|
68
|
+
category: RewardCategory;
|
|
69
|
+
discounts: any[];
|
|
70
|
+
summary: string | null;
|
|
71
|
+
redemptionMessage: string | null;
|
|
72
|
+
visibilityCriteria: string | null;
|
|
73
|
+
type: 'VOUCHER';
|
|
74
|
+
codeType: 'HUMAN' | 'OTP';
|
|
75
|
+
code: string | null;
|
|
76
|
+
purchaseExpiration: string | null;
|
|
77
|
+
hideCode: boolean;
|
|
78
|
+
notificationConfig: any | null;
|
|
79
|
+
artworkUrl: string;
|
|
80
|
+
pointsMultiplier: string;
|
|
81
|
+
pointsPrefix: string | null;
|
|
82
|
+
pointsSuffix: string | null;
|
|
83
|
+
}
|
|
84
|
+
export declare enum BadgeTileType {
|
|
85
|
+
Specific = "SPECIFIC",
|
|
86
|
+
Latest = "LATEST_EARNED"
|
|
87
|
+
}
|
|
88
|
+
export declare class BadgeTileConfig {
|
|
89
|
+
type: BadgeTileType;
|
|
90
|
+
badgeId: string;
|
|
91
|
+
internalName?: string;
|
|
92
|
+
defaultLocale: string;
|
|
93
|
+
priority: number;
|
|
94
|
+
internalDescription?: string | null;
|
|
95
|
+
status?: string;
|
|
96
|
+
id: string;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
updatedAt: string;
|
|
99
|
+
details?: BadgeDetail[];
|
|
100
|
+
count: number;
|
|
101
|
+
name: string;
|
|
102
|
+
locale: string;
|
|
103
|
+
description: string;
|
|
104
|
+
artworkUrl: string;
|
|
105
|
+
emptyBadgeMessage?: string;
|
|
106
|
+
emptyBadgeArtworkUrl?: string;
|
|
107
|
+
awardedDatePrefix?: string;
|
|
108
|
+
badgeNotEarnedMessage?: string;
|
|
109
|
+
}
|
|
110
|
+
export type BadgeDetail = {
|
|
111
|
+
name: string;
|
|
112
|
+
locale: string;
|
|
113
|
+
description: string;
|
|
114
|
+
artworkUrl: string;
|
|
115
|
+
id: string;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
updatedAt: string;
|
|
118
|
+
emptyBadgeMessage?: string;
|
|
119
|
+
emptyBadgeArtworkUrl?: string;
|
|
120
|
+
awardedDatePrefix?: string;
|
|
121
|
+
badgeNotEarnedMessage?: string;
|
|
122
|
+
};
|
|
123
|
+
export declare class RewardCategoryTileConfig {
|
|
124
|
+
showName: boolean;
|
|
125
|
+
rewardCategoryId: string;
|
|
126
|
+
artworkUrl: string;
|
|
127
|
+
name: string;
|
|
128
|
+
}
|
|
129
|
+
export declare class TierTileConfig {
|
|
130
|
+
progressType: ProgressType;
|
|
131
|
+
pointsMultiplier?: number;
|
|
132
|
+
pointsPrefix?: string;
|
|
133
|
+
pointsSuffix?: string;
|
|
134
|
+
tier?: TierType;
|
|
135
|
+
tierId?: string;
|
|
136
|
+
targetTier?: TierType | undefined;
|
|
137
|
+
type?: TierTileType;
|
|
138
|
+
targetTierAttainingPeriod?: Date | null;
|
|
139
|
+
title: string;
|
|
140
|
+
emptyDescription?: string;
|
|
141
|
+
emptyArtworkUrl?: string;
|
|
142
|
+
pointsToTierPrefix?: string;
|
|
143
|
+
pointsToTierSuffix?: string;
|
|
144
|
+
locale: string;
|
|
145
|
+
}
|
|
146
|
+
export type Tile = {
|
|
147
|
+
id: string | null;
|
|
148
|
+
type?: TileType;
|
|
149
|
+
active: boolean;
|
|
150
|
+
createdAt: string | null;
|
|
151
|
+
updatedAt: string | null;
|
|
152
|
+
tileHeight: TileHeight;
|
|
153
|
+
configuration: TileConfig;
|
|
154
|
+
priority: number;
|
|
155
|
+
};
|
|
156
|
+
declare const getConfigForTileType: (tileType: TileType) => typeof BannerTileConfig | typeof PointsTileConfig | typeof ContentTileConfig | typeof RewardTileConfig | typeof BadgeTileConfig | typeof RewardCategoryTileConfig | typeof TierTileConfig;
|
|
157
|
+
export type TileConfig = InstanceType<ReturnType<typeof getConfigForTileType>>;
|
|
158
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type Badge = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
artworkUrl: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class Reward {
|
|
10
|
+
id?: string;
|
|
11
|
+
createdAt?: string;
|
|
12
|
+
updatedAt?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
pictureUrl?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
price?: number;
|
|
17
|
+
value?: number;
|
|
18
|
+
priority?: number;
|
|
19
|
+
availability?: Availability;
|
|
20
|
+
purchasable?: boolean;
|
|
21
|
+
tier?: string;
|
|
22
|
+
summary?: string;
|
|
23
|
+
redemptionMessage?: string;
|
|
24
|
+
visibilityCriteria?: string;
|
|
25
|
+
}
|
|
26
|
+
export type RewardCategory = {
|
|
27
|
+
name: string;
|
|
28
|
+
priority: number;
|
|
29
|
+
type: string;
|
|
30
|
+
id: string;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
description: string | null;
|
|
34
|
+
metadata: any | null;
|
|
35
|
+
pictureUrl: string;
|
|
36
|
+
};
|
|
37
|
+
export type Availability = {
|
|
38
|
+
start: string;
|
|
39
|
+
end: string;
|
|
40
|
+
};
|
|
41
|
+
type Effectivity = {
|
|
42
|
+
start: string;
|
|
43
|
+
end: string;
|
|
44
|
+
};
|
|
45
|
+
export type TierType = {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
description?: string | null;
|
|
49
|
+
artworkUrl?: string | null;
|
|
50
|
+
priority: number;
|
|
51
|
+
pointsRequirement?: number;
|
|
52
|
+
calculation?: string;
|
|
53
|
+
accumulationPeriod?: string;
|
|
54
|
+
effectivity?: Effectivity;
|
|
55
|
+
createdAt?: string;
|
|
56
|
+
updatedAt?: string;
|
|
57
|
+
earnedPoints?: number;
|
|
58
|
+
attained?: boolean;
|
|
59
|
+
};
|
|
60
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SDKConfig } from '../context/WllSdkContext';
|
|
2
|
+
type APIResponse<T> = {
|
|
3
|
+
status: 'success' | 'fail' | 'error';
|
|
4
|
+
data: T | null;
|
|
5
|
+
error?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const useCreateRequestOptions: (config: SDKConfig) => (options?: RequestInit) => {
|
|
8
|
+
headers: Headers;
|
|
9
|
+
body?: BodyInit | null;
|
|
10
|
+
cache?: RequestCache;
|
|
11
|
+
credentials?: RequestCredentials;
|
|
12
|
+
integrity?: string;
|
|
13
|
+
keepalive?: boolean;
|
|
14
|
+
method?: string;
|
|
15
|
+
mode?: RequestMode;
|
|
16
|
+
priority?: RequestPriority;
|
|
17
|
+
redirect?: RequestRedirect;
|
|
18
|
+
referrer?: string;
|
|
19
|
+
referrerPolicy?: ReferrerPolicy;
|
|
20
|
+
signal?: AbortSignal | null;
|
|
21
|
+
window?: null;
|
|
22
|
+
} | undefined;
|
|
23
|
+
export declare const useMakeRequest: (config: SDKConfig) => <T>(url: string) => Promise<APIResponse<T>>;
|
|
24
|
+
export declare const createResourceGetter: (resource: string, includeHydrate?: boolean) => (config: SDKConfig) => (id: string) => Promise<APIResponse<unknown>>;
|
|
25
|
+
export declare const useGetGroupByID: (config: SDKConfig) => (id: string) => Promise<APIResponse<unknown>>;
|
|
26
|
+
export declare const useGetSectionByID: (config: SDKConfig) => (id: string) => Promise<APIResponse<unknown>>;
|
|
27
|
+
export declare const useGetTileByID: (config: SDKConfig) => (id: string) => Promise<APIResponse<unknown>>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies a multiplier to a base value. Handles string multipliers by converting them to numbers.
|
|
3
|
+
* If the multiplier is invalid (NaN, null, undefined), defaults to 1.
|
|
4
|
+
*
|
|
5
|
+
* @param baseValue The base value to multiply
|
|
6
|
+
* @param pointsMultiplier Optional multiplier value (defaults to 1)
|
|
7
|
+
* @returns The calculated points value
|
|
8
|
+
*/
|
|
9
|
+
export declare const applyMultiplier: (baseValue: number, pointsMultiplier?: string | number | null) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Formats a points label by combining the label, points value, and optional prefix/suffix.
|
|
12
|
+
* Only includes non-empty values in the final string.
|
|
13
|
+
* Returns empty string if points is 0.
|
|
14
|
+
*
|
|
15
|
+
* @param label The main label text (e.g., "Reward points:"). Defaults to "Reward points:"
|
|
16
|
+
* @param points The points value to display. Defaults to 0
|
|
17
|
+
* @param prefix Optional prefix to display before the points value
|
|
18
|
+
* @param suffix Optional suffix to display after the points value
|
|
19
|
+
* @returns A formatted string containing only the non-empty parts joined together, or empty string if points is 0
|
|
20
|
+
*/
|
|
21
|
+
export declare const getPointsLabel: (label?: string | undefined, points?: number, prefix?: string | null, suffix?: string | null) => string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { BaseThemeObject } from '../types/theme';
|
|
2
|
+
export declare const storyBookThemes: {
|
|
3
|
+
modern: {
|
|
4
|
+
primary: string;
|
|
5
|
+
accent: string;
|
|
6
|
+
background: string;
|
|
7
|
+
surface: string;
|
|
8
|
+
surfaceText: string;
|
|
9
|
+
errorPrimary: string;
|
|
10
|
+
negative: string;
|
|
11
|
+
pageButtonBackground: string;
|
|
12
|
+
pageButtonText: string;
|
|
13
|
+
positive: string;
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
warm: {
|
|
17
|
+
primary: string;
|
|
18
|
+
accent: string;
|
|
19
|
+
background: string;
|
|
20
|
+
surface: string;
|
|
21
|
+
surfaceText: string;
|
|
22
|
+
errorPrimary: string;
|
|
23
|
+
negative: string;
|
|
24
|
+
pageButtonBackground: string;
|
|
25
|
+
pageButtonText: string;
|
|
26
|
+
positive: string;
|
|
27
|
+
text: string;
|
|
28
|
+
};
|
|
29
|
+
dark: {
|
|
30
|
+
background: string;
|
|
31
|
+
text: string;
|
|
32
|
+
primary: string;
|
|
33
|
+
accent: string;
|
|
34
|
+
surface: string;
|
|
35
|
+
surfaceText: string;
|
|
36
|
+
errorPrimary: string;
|
|
37
|
+
negative: string;
|
|
38
|
+
pageButtonBackground: string;
|
|
39
|
+
pageButtonText: string;
|
|
40
|
+
positive: string;
|
|
41
|
+
};
|
|
42
|
+
forest: {
|
|
43
|
+
primary: string;
|
|
44
|
+
accent: string;
|
|
45
|
+
background: string;
|
|
46
|
+
surface: string;
|
|
47
|
+
surfaceText: string;
|
|
48
|
+
errorPrimary: string;
|
|
49
|
+
negative: string;
|
|
50
|
+
pageButtonBackground: string;
|
|
51
|
+
pageButtonText: string;
|
|
52
|
+
positive: string;
|
|
53
|
+
text: string;
|
|
54
|
+
};
|
|
55
|
+
sunset: {
|
|
56
|
+
primary: string;
|
|
57
|
+
accent: string;
|
|
58
|
+
background: string;
|
|
59
|
+
surface: string;
|
|
60
|
+
surfaceText: string;
|
|
61
|
+
errorPrimary: string;
|
|
62
|
+
negative: string;
|
|
63
|
+
pageButtonBackground: string;
|
|
64
|
+
pageButtonText: string;
|
|
65
|
+
positive: string;
|
|
66
|
+
text: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type ThemeName = 'default' | 'dark' | 'modern' | 'warm' | 'forest' | 'sunset';
|
|
70
|
+
export declare const themes: Record<ThemeName, BaseThemeObject>;
|
|
71
|
+
export declare const themeItems: Array<{
|
|
72
|
+
value: ThemeName;
|
|
73
|
+
title: string;
|
|
74
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseThemeObject } from '../types/theme';
|
|
2
|
+
export declare const sizes: {
|
|
3
|
+
readonly borderRadiusSm: 15;
|
|
4
|
+
readonly borderRadiusLg: 20;
|
|
5
|
+
readonly borderRadiusButton: 9;
|
|
6
|
+
readonly borderRadiusRounded: 9999;
|
|
7
|
+
readonly xxxs: 4;
|
|
8
|
+
readonly xxs: 8;
|
|
9
|
+
readonly xs: 10;
|
|
10
|
+
readonly sm: 12;
|
|
11
|
+
readonly md: 14;
|
|
12
|
+
readonly lg: 16;
|
|
13
|
+
readonly xl: 18;
|
|
14
|
+
readonly xxl: 24;
|
|
15
|
+
readonly xxxl: 32;
|
|
16
|
+
readonly xxxxl: 40;
|
|
17
|
+
readonly xxxxxl: 60;
|
|
18
|
+
};
|
|
19
|
+
export declare const commonStyles: {
|
|
20
|
+
emptyContainer: {
|
|
21
|
+
flex: number;
|
|
22
|
+
justifyContent: "center";
|
|
23
|
+
alignItems: "center";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const defaultTheme: BaseThemeObject;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { themeItems, ThemeName, themes } from './storybookThemes';
|
|
2
|
+
export declare const getDerivedColor: (color: string) => string;
|
|
3
|
+
export declare const getReadableTextColor: (backgroundColor: string) => string;
|
|
4
|
+
type PercentageKey = 5 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 95;
|
|
5
|
+
export type DerivedColors = {
|
|
6
|
+
[K in PercentageKey]: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const getDerivedColorPercentages: (color: string) => DerivedColors;
|
|
9
|
+
export declare const getAlphaDerivedColors: (color: string) => DerivedColors;
|
|
10
|
+
export declare const shouldDesaturate: (type: string, count: number) => boolean;
|
|
11
|
+
export declare const desaturateColor: (color: string) => string;
|
|
12
|
+
export declare const getStateColor: (baseColor: string, type: string, count: number) => string;
|
|
13
|
+
export { themeItems, ThemeName, themes };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tile } from '../types/tile';
|
|
2
|
+
/**
|
|
3
|
+
* Sorts tiles by priority (higher priority first) and maintains original order for equal priorities
|
|
4
|
+
* @param tiles Array of tiles to sort
|
|
5
|
+
* @returns Sorted array of tiles
|
|
6
|
+
*/
|
|
7
|
+
export declare const sortByPriority: <T extends Pick<Tile, "priority">>(tiles: T[]) => T[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import { ThemeObject } from "../types/theme";
|
|
3
|
+
type StyleVariants<V extends string> = Record<V, ViewStyle | TextStyle>;
|
|
4
|
+
export declare function createVariantSystem<V extends string>(baseStyle: ViewStyle | TextStyle, variantStyles: (theme: ThemeObject) => StyleVariants<V>): (theme: ThemeObject, variant: V) => ViewStyle[];
|
|
5
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wlloyalty/wll-react-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
"docs:dev": "vitepress dev docs",
|
|
26
26
|
"docs:build": "vitepress build docs",
|
|
27
27
|
"docs:preview": "vitepress preview docs",
|
|
28
|
-
"create-component": "node ./bin/create-component"
|
|
28
|
+
"create-component": "node ./bin/create-component",
|
|
29
|
+
"test": "jest",
|
|
30
|
+
"test:watch": "jest --watch",
|
|
31
|
+
"test:coverage": "jest --coverage"
|
|
29
32
|
},
|
|
30
33
|
"lint-staged": {
|
|
31
34
|
"**/*.{ts,tsx}": [
|
|
@@ -52,12 +55,12 @@
|
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
54
57
|
"@babel/cli": "^7.22.x",
|
|
55
|
-
"@babel/core": "^7.
|
|
58
|
+
"@babel/core": "^7.26.7",
|
|
56
59
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
57
60
|
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
|
58
|
-
"@babel/preset-env": "^7.
|
|
59
|
-
"@babel/preset-react": "^7.
|
|
60
|
-
"@babel/preset-typescript": "^7.
|
|
61
|
+
"@babel/preset-env": "^7.26.7",
|
|
62
|
+
"@babel/preset-react": "^7.26.3",
|
|
63
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
61
64
|
"@commitlint/cli": "^19.5.0",
|
|
62
65
|
"@commitlint/config-conventional": "^19.5.0",
|
|
63
66
|
"@commitlint/cz-commitlint": "^19.5.0",
|
|
@@ -73,23 +76,35 @@
|
|
|
73
76
|
"@storybook/cli": "^8.2.9",
|
|
74
77
|
"@storybook/react": "^8.2.9",
|
|
75
78
|
"@storybook/react-webpack5": "^8.2.9",
|
|
79
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
80
|
+
"@testing-library/jest-native": "^5.4.3",
|
|
81
|
+
"@testing-library/react": "^16.2.0",
|
|
82
|
+
"@testing-library/react-native": "^13.0.1",
|
|
83
|
+
"@types/jest": "^29.5.14",
|
|
76
84
|
"@types/react": "^18.2.22",
|
|
77
85
|
"@types/react-dom": "^18.2.7",
|
|
78
86
|
"@types/react-native": "^0.72.2",
|
|
87
|
+
"babel-jest": "^29.7.0",
|
|
79
88
|
"babel-loader": "^9.2.1",
|
|
89
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
80
90
|
"babel-plugin-react-native-web": "^0.19.12",
|
|
81
91
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
82
92
|
"chromatic": "^11.7.1",
|
|
83
93
|
"commitizen": "^4.3.1",
|
|
84
94
|
"concurrently": "^8.2.2",
|
|
85
95
|
"husky": "^9.1.6",
|
|
96
|
+
"jest": "^29.7.0",
|
|
97
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
98
|
+
"jest-transform-stub": "^2.0.0",
|
|
86
99
|
"lint-staged": "^15.2.10",
|
|
100
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
87
101
|
"msw": "^2.6.0",
|
|
88
102
|
"prettier": "^3.3.3",
|
|
89
103
|
"react": "^18.2.0",
|
|
90
104
|
"react-dom": "^18.2.0",
|
|
91
105
|
"react-native": "0.72.14",
|
|
92
106
|
"react-native-web": "^0.19.9",
|
|
107
|
+
"react-test-renderer": "^18.2.0",
|
|
93
108
|
"rollup": "^3.28.1",
|
|
94
109
|
"rollup-plugin-dts": "^6.0.1",
|
|
95
110
|
"ts-loader": "^9.5.1",
|