@wlloyalty/wll-react-sdk 1.0.4 → 1.0.7

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 (74) hide show
  1. package/dist/index.d.ts +606 -9
  2. package/dist/index.js +20113 -2
  3. package/dist/index.js.map +1 -0
  4. package/package.json +7 -6
  5. package/dist/components/atoms/BaseBanner/index.d.ts +0 -9
  6. package/dist/components/atoms/BaseTile/index.d.ts +0 -27
  7. package/dist/components/atoms/Button/Button.stories.d.ts +0 -7
  8. package/dist/components/atoms/Button/index.d.ts +0 -9
  9. package/dist/components/atoms/Content/index.d.ts +0 -14
  10. package/dist/components/atoms/Icon/Icon.stories.d.ts +0 -28
  11. package/dist/components/atoms/Icon/index.d.ts +0 -11
  12. package/dist/components/atoms/Image/index.d.ts +0 -9
  13. package/dist/components/atoms/LoadingIndicator/index.d.ts +0 -7
  14. package/dist/components/atoms/ProgressBar/ProgressBar.stories.d.ts +0 -8
  15. package/dist/components/atoms/ProgressBar/index.d.ts +0 -10
  16. package/dist/components/atoms/ProgressiveImage/ProgressiveImage.stories.d.ts +0 -9
  17. package/dist/components/atoms/ProgressiveImage/index.d.ts +0 -10
  18. package/dist/components/atoms/RowHeader/RowHeader.stories.d.ts +0 -8
  19. package/dist/components/atoms/RowHeader/index.d.ts +0 -8
  20. package/dist/components/atoms/Text/Text.stories.d.ts +0 -11
  21. package/dist/components/atoms/Text/index.d.ts +0 -10
  22. package/dist/components/atoms/TileContainer/index.d.ts +0 -7
  23. package/dist/components/atoms/index.d.ts +0 -13
  24. package/dist/components/molecules/Carousel/Carousel.stories.d.ts +0 -13
  25. package/dist/components/molecules/Carousel/index.d.ts +0 -7
  26. package/dist/components/molecules/Grid/Grid.stories.d.ts +0 -6
  27. package/dist/components/molecules/Grid/index.d.ts +0 -7
  28. package/dist/components/molecules/ProgressIndicator/ProgressIndicator.stories.d.ts +0 -8
  29. package/dist/components/molecules/ProgressIndicator/index.d.ts +0 -11
  30. package/dist/components/molecules/SectionHeader/SectionHeader.stories.d.ts +0 -7
  31. package/dist/components/molecules/SectionHeader/index.d.ts +0 -7
  32. package/dist/components/molecules/index.d.ts +0 -5
  33. package/dist/components/organisms/BadgeTile/BadgeTile.stories.d.ts +0 -9
  34. package/dist/components/organisms/BadgeTile/index.d.ts +0 -14
  35. package/dist/components/organisms/BadgeTileUpdated/BadgeTileUpdated.stories.d.ts +0 -18
  36. package/dist/components/organisms/BadgeTileUpdated/index.d.ts +0 -19
  37. package/dist/components/organisms/BannerTile/BannerTile.stories.d.ts +0 -9
  38. package/dist/components/organisms/BannerTile/index.d.ts +0 -16
  39. package/dist/components/organisms/ContentTile/ContentTile.stories.d.ts +0 -28
  40. package/dist/components/organisms/ContentTile/index.d.ts +0 -23
  41. package/dist/components/organisms/Group/Group.stories.d.ts +0 -6
  42. package/dist/components/organisms/Group/index.d.ts +0 -6
  43. package/dist/components/organisms/PointsTile/PointsTile.stories.d.ts +0 -9
  44. package/dist/components/organisms/PointsTile/index.d.ts +0 -17
  45. package/dist/components/organisms/RewardCategoryTile/RewardCategoryTile.stories.d.ts +0 -12
  46. package/dist/components/organisms/RewardCategoryTile/index.d.ts +0 -12
  47. package/dist/components/organisms/RewardTile/RewardTile.stories.d.ts +0 -12
  48. package/dist/components/organisms/RewardTile/index.d.ts +0 -22
  49. package/dist/components/organisms/Section/Section.stories.d.ts +0 -3
  50. package/dist/components/organisms/Section/index.d.ts +0 -12
  51. package/dist/components/organisms/TierTile/TierTile.d.ts +0 -7
  52. package/dist/components/organisms/TierTile/TierTile.stories.d.ts +0 -22
  53. package/dist/components/organisms/TierTile/index.d.ts +0 -25
  54. package/dist/components/organisms/TierTileUpdated/TierTileUpdated.stories.d.ts +0 -33
  55. package/dist/components/organisms/TierTileUpdated/index.d.ts +0 -15
  56. package/dist/components/organisms/index.d.ts +0 -12
  57. package/dist/constants/device.d.ts +0 -7
  58. package/dist/constants/grid.d.ts +0 -1
  59. package/dist/context/WllSdkContext.d.ts +0 -30
  60. package/dist/hooks/useTileSize.d.ts +0 -5
  61. package/dist/index.js.LICENSE.txt +0 -6
  62. package/dist/types/common.d.ts +0 -2
  63. package/dist/types/group.d.ts +0 -9
  64. package/dist/types/section.d.ts +0 -20
  65. package/dist/types/theme.d.ts +0 -40
  66. package/dist/types/tile.d.ts +0 -146
  67. package/dist/types/wll.d.ts +0 -60
  68. package/dist/utils/apiHelpers.d.ts +0 -28
  69. package/dist/utils/responsiveHelper.d.ts +0 -5
  70. package/dist/utils/storybookHelpers.d.ts +0 -5
  71. package/dist/utils/styling.d.ts +0 -11
  72. package/dist/utils/themeHelpers.d.ts +0 -12
  73. package/dist/utils/transforms.d.ts +0 -0
  74. package/dist/utils/variant.d.ts +0 -5
@@ -1,12 +0,0 @@
1
- import BadgeTile from './BadgeTile';
2
- import BadgeTileUpdated from './BadgeTileUpdated';
3
- import BannerTile from './BannerTile';
4
- import ContentTile from './ContentTile';
5
- import Group from './Group';
6
- import PointsTile from './PointsTile';
7
- import RewardCategoryTile from './RewardCategoryTile';
8
- import RewardTile from './RewardTile';
9
- import Section from './Section';
10
- import TierTile from './TierTile';
11
- import TierTileUpdated from './TierTileUpdated';
12
- export { BadgeTile, BadgeTileUpdated, BannerTile, ContentTile, Group, PointsTile, RewardCategoryTile, RewardTile, Section, TierTile, TierTileUpdated, };
@@ -1,7 +0,0 @@
1
- export declare const IS_WEB: boolean;
2
- export declare const IS_IOS: boolean;
3
- export declare const IS_ANDROID: boolean;
4
- export declare const IS_MOBILE: boolean;
5
- export declare const IS_DESKTOP: boolean;
6
- export declare const SCREEN_WIDTH: number;
7
- export declare const SCREEN_HEIGHT: number;
@@ -1 +0,0 @@
1
- export declare const GRID_GAP = 16;
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { TGroup } from '../types/group';
3
- import { TSection } from '../types/section';
4
- import { BaseThemeObject, ThemeContextType } from '../types/theme';
5
- import { Tile } from '../types/tile';
6
- type Fetcher = <T>(endpoint: string, options?: RequestInit) => Promise<APIResponse<T>>;
7
- export type SDKConfig = {
8
- apiKey: string;
9
- userToken?: string;
10
- fetcher?: Fetcher;
11
- locale?: string;
12
- };
13
- export type APIResponse<T> = {
14
- status: 'success' | 'error';
15
- data: T | null;
16
- error?: string;
17
- };
18
- type WllSdkContextType = ThemeContextType & {
19
- getGroupByID: (id: string) => Promise<APIResponse<TGroup>>;
20
- getSectionByID: (id: string) => Promise<APIResponse<TSection>>;
21
- getTileByID: (id: string) => Promise<APIResponse<Tile>>;
22
- };
23
- type WllSdkProviderProps = {
24
- children: React.ReactNode;
25
- theme?: Partial<BaseThemeObject>;
26
- config: SDKConfig;
27
- };
28
- export declare const WllSdkProvider: React.FC<WllSdkProviderProps>;
29
- export declare const useWllSdk: () => WllSdkContextType;
30
- export {};
@@ -1,5 +0,0 @@
1
- import { Tile } from '../types/tile';
2
- export declare const useTileSize: (tile: Tile) => {
3
- isFullSize: boolean;
4
- isHalfSize: boolean;
5
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * @license lucide-react v0.427.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */
@@ -1,2 +0,0 @@
1
- import { ImageProps } from 'react-native';
2
- export type ImagePropsNoSource = Omit<ImageProps, 'source'>;
@@ -1,9 +0,0 @@
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
- };
@@ -1,20 +0,0 @@
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
- };
@@ -1,40 +0,0 @@
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';
@@ -1,146 +0,0 @@
1
- import { Availability, RewardCategory, TierType } from './wll';
2
- export declare enum UrlTarget {
3
- sameWindow = "SAME_WINDOW",
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?: UrlTarget;
35
- }
36
- export declare class PointsTileConfig {
37
- title?: string | null;
38
- multiplier?: number;
39
- prefix?: string | null;
40
- suffix?: string | null;
41
- artworkUrl?: string | null;
42
- points?: number;
43
- }
44
- export declare class ContentTileConfig {
45
- title?: string | null;
46
- description?: string | null;
47
- artworkUrl?: string | null;
48
- linkURL?: string | null;
49
- }
50
- export declare class RewardTileConfig {
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"
85
- }
86
- export declare class BadgeTileConfig {
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[];
97
- count: number;
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
- };
112
- export declare class RewardCategoryTileConfig {
113
- showName: boolean;
114
- rewardCategoryId: string;
115
- artworkUrl: string;
116
- name: string;
117
- }
118
- export declare class TierTileConfig {
119
- progressType: ProgressType;
120
- pointsMultiplier?: number;
121
- pointsPrefix?: string;
122
- pointsSuffix?: string;
123
- tier?: TierType;
124
- tierId?: string;
125
- targetTier?: TierType | undefined;
126
- type?: TierTileType;
127
- targetTierAttainingPeriod?: Date | null;
128
- title: string;
129
- emptyDescription?: string;
130
- emptyArtworkUrl?: string;
131
- pointsToTierPrefix?: string;
132
- pointsToTierSuffix?: string;
133
- }
134
- export type Tile = {
135
- id: string | null;
136
- type?: TileType;
137
- active: boolean;
138
- createdAt: string | null;
139
- updatedAt: string | null;
140
- tileHeight: TileHeight;
141
- configuration: TileConfig;
142
- priority: number;
143
- };
144
- declare const getConfigForTileType: (tileType: TileType) => typeof BannerTileConfig | typeof PointsTileConfig | typeof ContentTileConfig | typeof RewardTileConfig | typeof BadgeTileConfig | typeof RewardCategoryTileConfig | typeof TierTileConfig;
145
- export type TileConfig = InstanceType<ReturnType<typeof getConfigForTileType>>;
146
- export {};
@@ -1,60 +0,0 @@
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 {};
@@ -1,28 +0,0 @@
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,5 +0,0 @@
1
- type ResponsiveStyle<T> = {
2
- [K in keyof T]: T[K] | [T[K], T[K], T[K]];
3
- };
4
- export declare const createResponsiveStyle: <T extends object>(style: ResponsiveStyle<T>) => T;
5
- export {};
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export declare const TileWrapper: React.FC<{
3
- isHalfTile?: boolean;
4
- children: React.ReactNode;
5
- }>;
@@ -1,11 +0,0 @@
1
- import { BaseThemeObject } from '../types/theme';
2
- export declare const sizes: {
3
- borderRadiusSm: number;
4
- borderRadiusLg: number;
5
- borderRadiusButton: number;
6
- borderRadiusRounded: number;
7
- sm: number;
8
- md: number;
9
- lg: number;
10
- };
11
- export declare const defaultTheme: BaseThemeObject;
@@ -1,12 +0,0 @@
1
- export declare const getDerivedColor: (color: string) => string;
2
- export declare const getReadableTextColor: (backgroundColor: string) => string;
3
- type PercentageKey = 5 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 95;
4
- export type DerivedColors = {
5
- [K in PercentageKey]: string;
6
- };
7
- export declare const getDerivedColorPercentages: (color: string) => DerivedColors;
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;
12
- export {};
File without changes
@@ -1,5 +0,0 @@
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 {};