@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.
Files changed (43) hide show
  1. package/dist/components/atoms/BaseTile/index.d.ts +11 -1
  2. package/dist/components/atoms/Content/index.d.ts +14 -0
  3. package/dist/components/atoms/Icon/Icon.stories.d.ts +4 -4
  4. package/dist/components/atoms/ProgressBar/index.d.ts +1 -0
  5. package/dist/components/atoms/ProgressiveImage/ProgressiveImage.stories.d.ts +9 -0
  6. package/dist/components/atoms/ProgressiveImage/index.d.ts +10 -0
  7. package/dist/components/atoms/{BaseBanner/BaseBanner.stories.d.ts → RowHeader/RowHeader.stories.d.ts} +3 -3
  8. package/dist/components/atoms/RowHeader/index.d.ts +8 -0
  9. package/dist/components/atoms/Text/Text.stories.d.ts +3 -3
  10. package/dist/components/atoms/Text/index.d.ts +1 -1
  11. package/dist/components/atoms/TileContainer/index.d.ts +1 -1
  12. package/dist/components/atoms/index.d.ts +13 -9
  13. package/dist/components/molecules/Grid/index.d.ts +2 -2
  14. package/dist/components/molecules/ProgressIndicator/ProgressIndicator.stories.d.ts +2 -5
  15. package/dist/components/molecules/SectionHeader/index.d.ts +1 -1
  16. package/dist/components/organisms/BadgeTile/index.d.ts +1 -0
  17. package/dist/components/organisms/BadgeTileUpdated/BadgeTileUpdated.stories.d.ts +18 -0
  18. package/dist/components/organisms/BadgeTileUpdated/index.d.ts +19 -0
  19. package/dist/components/organisms/ContentTile/index.d.ts +17 -1
  20. package/dist/components/organisms/Group/Group.stories.d.ts +6 -0
  21. package/dist/components/organisms/Group/index.d.ts +6 -0
  22. package/dist/components/organisms/RewardCategoryTile/index.d.ts +4 -4
  23. package/dist/components/organisms/RewardTile/RewardTile.stories.d.ts +3 -0
  24. package/dist/components/organisms/RewardTile/index.d.ts +8 -2
  25. package/dist/components/organisms/Section/index.d.ts +5 -12
  26. package/dist/components/organisms/TierTile/TierTile.d.ts +7 -0
  27. package/dist/components/organisms/TierTileUpdated/TierTileUpdated.stories.d.ts +33 -0
  28. package/dist/components/organisms/TierTileUpdated/index.d.ts +15 -0
  29. package/dist/components/organisms/index.d.ts +4 -1
  30. package/dist/constants/grid.d.ts +1 -0
  31. package/dist/context/WllSdkContext.d.ts +11 -6
  32. package/dist/hooks/useTileSize.d.ts +5 -0
  33. package/dist/index.js +1 -1
  34. package/dist/types/group.d.ts +9 -0
  35. package/dist/types/section.d.ts +1 -0
  36. package/dist/types/theme.d.ts +1 -0
  37. package/dist/types/tile.d.ts +78 -23
  38. package/dist/types/wll.d.ts +14 -16
  39. package/dist/utils/apiHelpers.d.ts +28 -0
  40. package/dist/utils/styling.d.ts +1 -1
  41. package/dist/utils/themeHelpers.d.ts +3 -0
  42. package/package.json +2 -1
  43. package/dist/components/atoms/BaseTile/BaseTile.stories.d.ts +0 -14
@@ -0,0 +1,9 @@
1
+ import { TSection } from './section';
2
+ export type TGroup = {
3
+ name: string;
4
+ active: boolean;
5
+ id: string;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ sections: TSection[];
9
+ };
@@ -5,6 +5,7 @@ export declare enum SectionType {
5
5
  }
6
6
  export type TSection = {
7
7
  id: string;
8
+ name: string;
8
9
  type: SectionType;
9
10
  createdAt: string;
10
11
  updatedAt: string;
@@ -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;
@@ -1,16 +1,11 @@
1
- import { Badge, Reward, RewardCategory, TierType } from './wll';
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 = "CURRENT_TIER",
12
- currentTargetNext = "CURRENT_TARGET_NEXT",
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
- imageUrl?: string | null;
29
+ artworkUrl?: string | null;
35
30
  title?: string | null;
36
31
  description?: string | null;
37
- buttonText?: string | null;
38
- url?: string | null;
39
- urlTarget?: UrlTarget;
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
- imageUrl?: string | null;
41
+ artworkUrl?: string | null;
47
42
  points?: number;
48
43
  }
49
44
  export declare class ContentTileConfig {
50
45
  title?: string | null;
51
- subtitle?: string | null;
52
- imageUrl?: string | null;
46
+ description?: string | null;
47
+ artworkUrl?: string | null;
53
48
  linkURL?: string | null;
54
49
  }
55
50
  export declare class RewardTileConfig {
56
- reward?: Reward;
57
- showPrice?: boolean;
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
- badgeTileType?: BadgeTileType;
61
- badgeId?: string | null;
62
- badge?: Badge;
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
- categoryId?: string | null;
67
- allowDecorationOverlay?: boolean;
68
- rewardCategory?: RewardCategory;
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>>;
@@ -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 Availability = {
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 {};
@@ -1,4 +1,4 @@
1
- import { BaseThemeObject } from "../types/theme";
1
+ import { BaseThemeObject } from '../types/theme';
2
2
  export declare const sizes: {
3
3
  borderRadiusSm: number;
4
4
  borderRadiusLg: number;
@@ -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",
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
- }>;