@wlloyalty/wll-react-sdk 1.0.3 → 1.0.4
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/atoms/BaseTile/index.d.ts +11 -1
- package/dist/components/atoms/Content/index.d.ts +14 -0
- package/dist/components/atoms/Icon/Icon.stories.d.ts +4 -4
- package/dist/components/atoms/ProgressBar/index.d.ts +1 -0
- package/dist/components/atoms/ProgressiveImage/ProgressiveImage.stories.d.ts +9 -0
- package/dist/components/atoms/ProgressiveImage/index.d.ts +10 -0
- package/dist/components/atoms/{BaseBanner/BaseBanner.stories.d.ts → RowHeader/RowHeader.stories.d.ts} +3 -3
- package/dist/components/atoms/RowHeader/index.d.ts +8 -0
- package/dist/components/atoms/Text/Text.stories.d.ts +3 -3
- package/dist/components/atoms/Text/index.d.ts +1 -1
- package/dist/components/atoms/TileContainer/index.d.ts +1 -1
- package/dist/components/atoms/index.d.ts +13 -9
- package/dist/components/molecules/Grid/index.d.ts +2 -2
- package/dist/components/molecules/ProgressIndicator/ProgressIndicator.stories.d.ts +2 -5
- package/dist/components/molecules/SectionHeader/index.d.ts +1 -1
- package/dist/components/organisms/BadgeTile/index.d.ts +1 -0
- package/dist/components/organisms/BadgeTileUpdated/BadgeTileUpdated.stories.d.ts +18 -0
- package/dist/components/organisms/BadgeTileUpdated/index.d.ts +19 -0
- package/dist/components/organisms/ContentTile/index.d.ts +17 -1
- package/dist/components/organisms/Group/Group.stories.d.ts +6 -0
- package/dist/components/organisms/Group/index.d.ts +6 -0
- package/dist/components/organisms/RewardCategoryTile/index.d.ts +4 -4
- package/dist/components/organisms/RewardTile/RewardTile.stories.d.ts +3 -0
- package/dist/components/organisms/RewardTile/index.d.ts +8 -2
- package/dist/components/organisms/Section/index.d.ts +5 -12
- package/dist/components/organisms/TierTile/TierTile.d.ts +7 -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/index.d.ts +4 -1
- package/dist/constants/grid.d.ts +1 -0
- package/dist/context/WllSdkContext.d.ts +11 -6
- package/dist/hooks/useTileSize.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/types/group.d.ts +9 -0
- package/dist/types/section.d.ts +1 -0
- package/dist/types/theme.d.ts +1 -0
- package/dist/types/tile.d.ts +78 -23
- package/dist/types/wll.d.ts +14 -16
- package/dist/utils/apiHelpers.d.ts +28 -0
- package/dist/utils/styling.d.ts +1 -1
- package/dist/utils/themeHelpers.d.ts +3 -0
- package/package.json +2 -1
- package/dist/components/atoms/BaseTile/BaseTile.stories.d.ts +0 -14
package/dist/types/section.d.ts
CHANGED
package/dist/types/theme.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type DerivedProperties = {
|
|
|
23
23
|
derivedSurfaceText: DerivedColors;
|
|
24
24
|
derivedSurface: DerivedColors;
|
|
25
25
|
alphaDerivedPrimary: DerivedColors;
|
|
26
|
+
alphaDerivedText: DerivedColors;
|
|
26
27
|
};
|
|
27
28
|
export type ThemeObject = BaseThemeObject & DerivedProperties & {
|
|
28
29
|
readonly sizes: typeof sizes;
|
package/dist/types/tile.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Availability, RewardCategory, TierType } from './wll';
|
|
2
2
|
export declare enum UrlTarget {
|
|
3
3
|
sameWindow = "SAME_WINDOW",
|
|
4
4
|
newWindow = "NEW_WINDOW"
|
|
5
5
|
}
|
|
6
|
-
export declare enum BadgeTileType {
|
|
7
|
-
latestEarned = "LATEST_EARNED",
|
|
8
|
-
specificBadge = "SPECIFIC_BADGE"
|
|
9
|
-
}
|
|
10
6
|
export declare enum TierTileType {
|
|
11
|
-
currentTier = "
|
|
12
|
-
|
|
13
|
-
currentTargetSpecific = "CURRENT_TARGET_SPECIFIC"
|
|
7
|
+
currentTier = "CURRENT",
|
|
8
|
+
specificTier = "SPECIFIC"
|
|
14
9
|
}
|
|
15
10
|
export declare enum ProgressType {
|
|
16
11
|
Name = "NAME",
|
|
@@ -31,41 +26,94 @@ export declare enum TileHeight {
|
|
|
31
26
|
}
|
|
32
27
|
export type ProgessType = 'NAME' | 'POINTS';
|
|
33
28
|
export declare class BannerTileConfig {
|
|
34
|
-
|
|
29
|
+
artworkUrl?: string | null;
|
|
35
30
|
title?: string | null;
|
|
36
31
|
description?: string | null;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
ctaText?: string | null;
|
|
33
|
+
ctaLink?: string | null;
|
|
34
|
+
ctaLinkTarget?: UrlTarget;
|
|
40
35
|
}
|
|
41
36
|
export declare class PointsTileConfig {
|
|
42
37
|
title?: string | null;
|
|
43
38
|
multiplier?: number;
|
|
44
39
|
prefix?: string | null;
|
|
45
40
|
suffix?: string | null;
|
|
46
|
-
|
|
41
|
+
artworkUrl?: string | null;
|
|
47
42
|
points?: number;
|
|
48
43
|
}
|
|
49
44
|
export declare class ContentTileConfig {
|
|
50
45
|
title?: string | null;
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
description?: string | null;
|
|
47
|
+
artworkUrl?: string | null;
|
|
53
48
|
linkURL?: string | null;
|
|
54
49
|
}
|
|
55
50
|
export declare class RewardTileConfig {
|
|
56
|
-
|
|
57
|
-
showPrice
|
|
51
|
+
rewardId: string;
|
|
52
|
+
showPrice: boolean;
|
|
53
|
+
showArtwork?: boolean;
|
|
54
|
+
showDetails?: boolean;
|
|
55
|
+
id: string;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
name: string;
|
|
59
|
+
pictureUrl: string;
|
|
60
|
+
value: number;
|
|
61
|
+
price: number;
|
|
62
|
+
priority: number;
|
|
63
|
+
availability: Availability;
|
|
64
|
+
purchasable: boolean;
|
|
65
|
+
tier: string | null;
|
|
66
|
+
category: RewardCategory;
|
|
67
|
+
discounts: any[];
|
|
68
|
+
summary: string | null;
|
|
69
|
+
redemptionMessage: string | null;
|
|
70
|
+
visibilityCriteria: string | null;
|
|
71
|
+
type: 'VOUCHER';
|
|
72
|
+
codeType: 'HUMAN' | 'OTP';
|
|
73
|
+
code: string | null;
|
|
74
|
+
purchaseExpiration: string | null;
|
|
75
|
+
hideCode: boolean;
|
|
76
|
+
notificationConfig: any | null;
|
|
77
|
+
artworkUrl: string;
|
|
78
|
+
pointsMultiplier: string;
|
|
79
|
+
pointsPrefix: string | null;
|
|
80
|
+
pointsSuffix: string | null;
|
|
81
|
+
}
|
|
82
|
+
export declare enum BadgeTileType {
|
|
83
|
+
Specific = "SPECIFIC",
|
|
84
|
+
Latest = "LATEST_EARNED"
|
|
58
85
|
}
|
|
59
86
|
export declare class BadgeTileConfig {
|
|
60
|
-
|
|
61
|
-
badgeId
|
|
62
|
-
|
|
87
|
+
type: BadgeTileType;
|
|
88
|
+
badgeId: string;
|
|
89
|
+
internalName?: string;
|
|
90
|
+
priority: number;
|
|
91
|
+
internalDescription?: string | null;
|
|
92
|
+
status?: string;
|
|
93
|
+
id: string;
|
|
94
|
+
createdAt: string;
|
|
95
|
+
updatedAt: string;
|
|
96
|
+
details?: BadgeDetail[];
|
|
63
97
|
count: number;
|
|
64
98
|
}
|
|
99
|
+
export type BadgeDetail = {
|
|
100
|
+
name: string;
|
|
101
|
+
locale: string;
|
|
102
|
+
description: string;
|
|
103
|
+
artworkUrl: string;
|
|
104
|
+
id: string;
|
|
105
|
+
createdAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
emptyBadgeMessage?: string;
|
|
108
|
+
emptyBadgeArtworkUrl?: string;
|
|
109
|
+
awardedDatePrefix?: string;
|
|
110
|
+
badgeNotEarnedMessage?: string;
|
|
111
|
+
};
|
|
65
112
|
export declare class RewardCategoryTileConfig {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
113
|
+
showName: boolean;
|
|
114
|
+
rewardCategoryId: string;
|
|
115
|
+
artworkUrl: string;
|
|
116
|
+
name: string;
|
|
69
117
|
}
|
|
70
118
|
export declare class TierTileConfig {
|
|
71
119
|
progressType: ProgressType;
|
|
@@ -73,9 +121,15 @@ export declare class TierTileConfig {
|
|
|
73
121
|
pointsPrefix?: string;
|
|
74
122
|
pointsSuffix?: string;
|
|
75
123
|
tier?: TierType;
|
|
124
|
+
tierId?: string;
|
|
76
125
|
targetTier?: TierType | undefined;
|
|
77
126
|
type?: TierTileType;
|
|
78
127
|
targetTierAttainingPeriod?: Date | null;
|
|
128
|
+
title: string;
|
|
129
|
+
emptyDescription?: string;
|
|
130
|
+
emptyArtworkUrl?: string;
|
|
131
|
+
pointsToTierPrefix?: string;
|
|
132
|
+
pointsToTierSuffix?: string;
|
|
79
133
|
}
|
|
80
134
|
export type Tile = {
|
|
81
135
|
id: string | null;
|
|
@@ -85,6 +139,7 @@ export type Tile = {
|
|
|
85
139
|
updatedAt: string | null;
|
|
86
140
|
tileHeight: TileHeight;
|
|
87
141
|
configuration: TileConfig;
|
|
142
|
+
priority: number;
|
|
88
143
|
};
|
|
89
144
|
declare const getConfigForTileType: (tileType: TileType) => typeof BannerTileConfig | typeof PointsTileConfig | typeof ContentTileConfig | typeof RewardTileConfig | typeof BadgeTileConfig | typeof RewardCategoryTileConfig | typeof TierTileConfig;
|
|
90
145
|
export type TileConfig = InstanceType<ReturnType<typeof getConfigForTileType>>;
|
package/dist/types/wll.d.ts
CHANGED
|
@@ -6,19 +6,6 @@ export type Badge = {
|
|
|
6
6
|
createdAt: string;
|
|
7
7
|
updatedAt: string;
|
|
8
8
|
};
|
|
9
|
-
export declare class RewardCategory {
|
|
10
|
-
name?: string;
|
|
11
|
-
priority?: number;
|
|
12
|
-
type?: string;
|
|
13
|
-
id?: string;
|
|
14
|
-
createdAt?: string;
|
|
15
|
-
updatedAt?: string;
|
|
16
|
-
description?: string;
|
|
17
|
-
metadata?: string;
|
|
18
|
-
pictureUrl?: string;
|
|
19
|
-
rewards?: Reward[];
|
|
20
|
-
parent?: string;
|
|
21
|
-
}
|
|
22
9
|
export declare class Reward {
|
|
23
10
|
id?: string;
|
|
24
11
|
createdAt?: string;
|
|
@@ -36,7 +23,18 @@ export declare class Reward {
|
|
|
36
23
|
redemptionMessage?: string;
|
|
37
24
|
visibilityCriteria?: string;
|
|
38
25
|
}
|
|
39
|
-
type
|
|
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 = {
|
|
40
38
|
start: string;
|
|
41
39
|
end: string;
|
|
42
40
|
};
|
|
@@ -47,8 +45,8 @@ type Effectivity = {
|
|
|
47
45
|
export type TierType = {
|
|
48
46
|
id: string;
|
|
49
47
|
name: string;
|
|
50
|
-
description?: string;
|
|
51
|
-
artworkUrl?: string;
|
|
48
|
+
description?: string | null;
|
|
49
|
+
artworkUrl?: string | null;
|
|
52
50
|
priority: number;
|
|
53
51
|
pointsRequirement?: number;
|
|
54
52
|
calculation?: string;
|
|
@@ -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 {};
|
package/dist/utils/styling.d.ts
CHANGED
|
@@ -6,4 +6,7 @@ export type DerivedColors = {
|
|
|
6
6
|
};
|
|
7
7
|
export declare const getDerivedColorPercentages: (color: string) => DerivedColors;
|
|
8
8
|
export declare const getAlphaDerivedColors: (color: string) => DerivedColors;
|
|
9
|
+
export declare const shouldDesaturate: (type: string, count: number) => boolean;
|
|
10
|
+
export declare const desaturateColor: (color: string) => string;
|
|
11
|
+
export declare const getStateColor: (baseColor: string, type: string, count: number) => string;
|
|
9
12
|
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.4",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
62
62
|
"chromatic": "^11.7.1",
|
|
63
63
|
"concurrently": "^8.2.2",
|
|
64
|
+
"msw": "^2.6.0",
|
|
64
65
|
"prettier": "^3.3.3",
|
|
65
66
|
"react": "^18.2.0",
|
|
66
67
|
"react-dom": "^18.2.0",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/react';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const _default: Meta;
|
|
4
|
-
export default _default;
|
|
5
|
-
export declare const FullHeight: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, {
|
|
6
|
-
tile: import("../../../types/tile").Tile;
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
style?: import("react-native").ViewStyle;
|
|
9
|
-
}>;
|
|
10
|
-
export declare const HalfHeight: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, {
|
|
11
|
-
tile: import("../../../types/tile").Tile;
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
style?: import("react-native").ViewStyle;
|
|
14
|
-
}>;
|