@wlloyalty/wll-react-sdk 1.0.1
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/README.md +8 -0
- package/dist/components/atoms/BaseBanner/BaseBanner.stories.d.ts +8 -0
- package/dist/components/atoms/BaseBanner/index.d.ts +9 -0
- package/dist/components/atoms/BaseTile/BaseTile.stories.d.ts +14 -0
- package/dist/components/atoms/BaseTile/index.d.ts +17 -0
- package/dist/components/atoms/Button/Button.stories.d.ts +7 -0
- package/dist/components/atoms/Button/index.d.ts +9 -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/Image/index.d.ts +9 -0
- package/dist/components/atoms/LoadingIndicator/index.d.ts +7 -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/Text/Text.stories.d.ts +11 -0
- package/dist/components/atoms/Text/index.d.ts +10 -0
- package/dist/components/atoms/TileContainer/index.d.ts +7 -0
- package/dist/components/atoms/index.d.ts +9 -0
- package/dist/components/molecules/Carousel/Carousel.stories.d.ts +13 -0
- package/dist/components/molecules/Carousel/index.d.ts +7 -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 +11 -0
- package/dist/components/molecules/ProgressIndicator/index.d.ts +11 -0
- package/dist/components/molecules/SectionHeader/SectionHeader.stories.d.ts +7 -0
- package/dist/components/molecules/SectionHeader/index.d.ts +7 -0
- package/dist/components/molecules/index.d.ts +5 -0
- package/dist/components/organisms/BadgeTile/BadgeTile.stories.d.ts +9 -0
- package/dist/components/organisms/BadgeTile/index.d.ts +13 -0
- package/dist/components/organisms/BannerTile/BannerTile.stories.d.ts +9 -0
- package/dist/components/organisms/BannerTile/index.d.ts +16 -0
- package/dist/components/organisms/ContentTile/ContentTile.stories.d.ts +28 -0
- package/dist/components/organisms/ContentTile/index.d.ts +7 -0
- package/dist/components/organisms/PointsTile/PointsTile.stories.d.ts +9 -0
- package/dist/components/organisms/PointsTile/index.d.ts +17 -0
- package/dist/components/organisms/RewardCategoryTile/RewardCategoryTile.stories.d.ts +12 -0
- package/dist/components/organisms/RewardCategoryTile/index.d.ts +12 -0
- package/dist/components/organisms/RewardTile/RewardTile.stories.d.ts +9 -0
- package/dist/components/organisms/RewardTile/index.d.ts +16 -0
- package/dist/components/organisms/Section/Section.stories.d.ts +3 -0
- package/dist/components/organisms/Section/index.d.ts +19 -0
- package/dist/components/organisms/TierTile/TierTile.stories.d.ts +22 -0
- package/dist/components/organisms/TierTile/index.d.ts +25 -0
- package/dist/components/organisms/index.d.ts +9 -0
- package/dist/constants/device.d.ts +7 -0
- package/dist/context/WllSdkContext.d.ts +25 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +8 -0
- package/dist/types/common.d.ts +2 -0
- package/dist/types/section.d.ts +19 -0
- package/dist/types/theme.d.ts +39 -0
- package/dist/types/tile.d.ts +91 -0
- package/dist/types/wll.d.ts +62 -0
- package/dist/utils/responsiveHelper.d.ts +5 -0
- package/dist/utils/storybookHelpers.d.ts +5 -0
- package/dist/utils/styling.d.ts +11 -0
- package/dist/utils/themeHelpers.d.ts +9 -0
- package/dist/utils/transforms.d.ts +0 -0
- package/dist/utils/variant.d.ts +5 -0
- package/package.json +81 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v0.427.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tile } from './tile';
|
|
2
|
+
export declare enum SectionType {
|
|
3
|
+
Grid = "GRID",
|
|
4
|
+
Banner = "BANNER"
|
|
5
|
+
}
|
|
6
|
+
export type Section = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: SectionType;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
tiles: Tile[];
|
|
14
|
+
pointsMultiplier?: number;
|
|
15
|
+
pointsPrefix?: string | null;
|
|
16
|
+
pointsSuffix?: string | null;
|
|
17
|
+
priority: number;
|
|
18
|
+
active: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
};
|
|
27
|
+
export type ThemeObject = BaseThemeObject & DerivedProperties & {
|
|
28
|
+
readonly sizes: typeof sizes;
|
|
29
|
+
};
|
|
30
|
+
export type ThemeContextType = {
|
|
31
|
+
theme: ThemeObject;
|
|
32
|
+
setTheme: (theme: ThemeObject) => void;
|
|
33
|
+
};
|
|
34
|
+
export type ThemeProviderProps = {
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
theme?: Partial<BaseThemeObject>;
|
|
37
|
+
};
|
|
38
|
+
export type Variant = 'primary' | 'accent' | 'positive' | 'negative';
|
|
39
|
+
export type Size = 'sm' | 'md' | 'lg';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Badge, Reward, RewardCategory, TierType } from './wll';
|
|
2
|
+
export declare enum UrlTarget {
|
|
3
|
+
sameWindow = "SAME_WINDOW",
|
|
4
|
+
newWindow = "NEW_WINDOW"
|
|
5
|
+
}
|
|
6
|
+
export declare enum BadgeTileType {
|
|
7
|
+
latestEarned = "LATEST_EARNED",
|
|
8
|
+
specificBadge = "SPECIFIC_BADGE"
|
|
9
|
+
}
|
|
10
|
+
export declare enum TierTileType {
|
|
11
|
+
currentTier = "CURRENT_TIER",
|
|
12
|
+
currentTargetNext = "CURRENT_TARGET_NEXT",
|
|
13
|
+
currentTargetSpecific = "CURRENT_TARGET_SPECIFIC"
|
|
14
|
+
}
|
|
15
|
+
export declare enum ProgressType {
|
|
16
|
+
Name = "NAME",
|
|
17
|
+
Points = "POINTS"
|
|
18
|
+
}
|
|
19
|
+
export declare enum TileType {
|
|
20
|
+
Banner = "BANNER",
|
|
21
|
+
Points = "POINTS",
|
|
22
|
+
Content = "CONTENT",
|
|
23
|
+
Reward = "REWARD",
|
|
24
|
+
Badge = "BADGE",
|
|
25
|
+
RewardCategory = "REWARD_CATEGORY",
|
|
26
|
+
Tier = "TIER"
|
|
27
|
+
}
|
|
28
|
+
export declare enum TileHeight {
|
|
29
|
+
Half = "HALF",
|
|
30
|
+
Full = "FULL"
|
|
31
|
+
}
|
|
32
|
+
export type ProgessType = 'NAME' | 'POINTS';
|
|
33
|
+
export declare class BannerTileConfig {
|
|
34
|
+
imageUrl?: string | null;
|
|
35
|
+
title?: string | null;
|
|
36
|
+
description?: string | null;
|
|
37
|
+
buttonText?: string | null;
|
|
38
|
+
url?: string | null;
|
|
39
|
+
urlTarget?: UrlTarget;
|
|
40
|
+
}
|
|
41
|
+
export declare class PointsTileConfig {
|
|
42
|
+
title?: string | null;
|
|
43
|
+
multiplier?: number;
|
|
44
|
+
prefix?: string | null;
|
|
45
|
+
suffix?: string | null;
|
|
46
|
+
imageUrl?: string | null;
|
|
47
|
+
points?: number;
|
|
48
|
+
}
|
|
49
|
+
export declare class ContentTileConfig {
|
|
50
|
+
title?: string | null;
|
|
51
|
+
subtitle?: string | null;
|
|
52
|
+
imageUrl?: string | null;
|
|
53
|
+
linkURL?: string | null;
|
|
54
|
+
}
|
|
55
|
+
export declare class RewardTileConfig {
|
|
56
|
+
reward?: Reward;
|
|
57
|
+
showPrice?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare class BadgeTileConfig {
|
|
60
|
+
badgeTileType?: BadgeTileType;
|
|
61
|
+
badgeId?: string | null;
|
|
62
|
+
badge?: Badge;
|
|
63
|
+
count: number;
|
|
64
|
+
}
|
|
65
|
+
export declare class RewardCategoryTileConfig {
|
|
66
|
+
categoryId?: string | null;
|
|
67
|
+
allowDecorationOverlay?: boolean;
|
|
68
|
+
rewardCategory?: RewardCategory;
|
|
69
|
+
}
|
|
70
|
+
export declare class TierTileConfig {
|
|
71
|
+
progressType: ProgressType;
|
|
72
|
+
pointsMultiplier?: number;
|
|
73
|
+
pointsPrefix?: string;
|
|
74
|
+
pointsSuffix?: string;
|
|
75
|
+
tier?: TierType;
|
|
76
|
+
targetTier?: TierType | undefined;
|
|
77
|
+
type?: TierTileType;
|
|
78
|
+
targetTierAttainingPeriod?: Date | null;
|
|
79
|
+
}
|
|
80
|
+
export type Tile = {
|
|
81
|
+
id: string | null;
|
|
82
|
+
type?: TileType;
|
|
83
|
+
active: boolean;
|
|
84
|
+
createdAt: string | null;
|
|
85
|
+
updatedAt: string | null;
|
|
86
|
+
tileHeight: TileHeight;
|
|
87
|
+
configuration: TileConfig;
|
|
88
|
+
};
|
|
89
|
+
declare const getConfigForTileType: (tileType: TileType) => typeof BannerTileConfig | typeof PointsTileConfig | typeof ContentTileConfig | typeof RewardTileConfig | typeof BadgeTileConfig | typeof RewardCategoryTileConfig | typeof TierTileConfig;
|
|
90
|
+
export type TileConfig = InstanceType<ReturnType<typeof getConfigForTileType>>;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
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 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
|
+
export declare class Reward {
|
|
23
|
+
id?: string;
|
|
24
|
+
createdAt?: string;
|
|
25
|
+
updatedAt?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
pictureUrl?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
price?: number;
|
|
30
|
+
value?: number;
|
|
31
|
+
priority?: number;
|
|
32
|
+
availability?: Availability;
|
|
33
|
+
purchasable?: boolean;
|
|
34
|
+
tier?: string;
|
|
35
|
+
summary?: string;
|
|
36
|
+
redemptionMessage?: string;
|
|
37
|
+
visibilityCriteria?: string;
|
|
38
|
+
}
|
|
39
|
+
type Availability = {
|
|
40
|
+
start: string;
|
|
41
|
+
end: string;
|
|
42
|
+
};
|
|
43
|
+
type Effectivity = {
|
|
44
|
+
start: string;
|
|
45
|
+
end: string;
|
|
46
|
+
};
|
|
47
|
+
export type TierType = {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
artworkUrl?: string;
|
|
52
|
+
priority: number;
|
|
53
|
+
pointsRequirement?: number;
|
|
54
|
+
calculation?: string;
|
|
55
|
+
accumulationPeriod?: string;
|
|
56
|
+
effectivity?: Effectivity;
|
|
57
|
+
createdAt?: string;
|
|
58
|
+
updatedAt?: string;
|
|
59
|
+
earnedPoints?: number;
|
|
60
|
+
attained?: boolean;
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 {};
|
|
File without changes
|
|
@@ -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
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wlloyalty/wll-react-sdk",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "webpack --config webpack.config.js",
|
|
16
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
17
|
+
"build:all": "yarn build && yarn build:types",
|
|
18
|
+
"prepare": "yarn build:all",
|
|
19
|
+
"storybook": "storybook dev -p 6006",
|
|
20
|
+
"build-storybook": "storybook build",
|
|
21
|
+
"test-storybook": "test-storybook",
|
|
22
|
+
"chromatic": "npx chromatic"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@types/color": "^3.0.6",
|
|
26
|
+
"color": "^4.2.3",
|
|
27
|
+
"lucide-react": "^0.427.0",
|
|
28
|
+
"zod": "^3.23.8"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": "^18.0.0",
|
|
32
|
+
"react-dom": "^18.0.0",
|
|
33
|
+
"react-native": ">=0.70.0 <0.73.0",
|
|
34
|
+
"react-native-web": "^0.19.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/cli": "^7.22.x",
|
|
38
|
+
"@babel/core": "^7.25.2",
|
|
39
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
40
|
+
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
|
41
|
+
"@babel/preset-env": "^7.25.4",
|
|
42
|
+
"@babel/preset-react": "^7.24.7",
|
|
43
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
44
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
45
|
+
"@rollup/plugin-commonjs": "^25.0.4",
|
|
46
|
+
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
47
|
+
"@rollup/plugin-typescript": "^11.1.3",
|
|
48
|
+
"@storybook/addon-essentials": "^8.2.9",
|
|
49
|
+
"@storybook/addon-interactions": "^8.2.9",
|
|
50
|
+
"@storybook/addon-links": "^8.2.9",
|
|
51
|
+
"@storybook/addon-onboarding": "^8.2.9",
|
|
52
|
+
"@storybook/addon-react-native-web": "^0.0.20",
|
|
53
|
+
"@storybook/cli": "^8.2.9",
|
|
54
|
+
"@storybook/react": "^8.2.9",
|
|
55
|
+
"@storybook/react-webpack5": "^8.2.9",
|
|
56
|
+
"@types/react": "^18.2.22",
|
|
57
|
+
"@types/react-dom": "^18.2.7",
|
|
58
|
+
"@types/react-native": "^0.72.2",
|
|
59
|
+
"babel-loader": "^9.2.1",
|
|
60
|
+
"babel-plugin-react-native-web": "^0.19.12",
|
|
61
|
+
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
62
|
+
"chromatic": "^11.7.1",
|
|
63
|
+
"concurrently": "^8.2.2",
|
|
64
|
+
"prettier": "^3.3.3",
|
|
65
|
+
"react": "^18.2.0",
|
|
66
|
+
"react-dom": "^18.2.0",
|
|
67
|
+
"react-native": "0.72.14",
|
|
68
|
+
"react-native-web": "^0.19.9",
|
|
69
|
+
"rollup": "^3.28.1",
|
|
70
|
+
"rollup-plugin-dts": "^6.0.1",
|
|
71
|
+
"ts-loader": "^9.5.1",
|
|
72
|
+
"typescript": "^5.2.2",
|
|
73
|
+
"webpack": "^5.88.2",
|
|
74
|
+
"webpack-cli": "^5.1.4",
|
|
75
|
+
"webpack-dev-server": "^4.15.1"
|
|
76
|
+
},
|
|
77
|
+
"volta": {
|
|
78
|
+
"node": "18.20.4",
|
|
79
|
+
"yarn": "1.22.22"
|
|
80
|
+
}
|
|
81
|
+
}
|