@nuskin/react-loyalty-elements 1.1.0-review-comments.5 → 1.1.0-review-comments.6
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/package.json +2 -1
- package/src/CircularProgressBar/CircularProgressBar.styled.d.ts +41 -0
- package/src/CircularProgressBar/CircularProgressBar.styled.tsx +162 -0
- package/src/CircularProgressBar/RadialSeparator.d.ts +4 -0
- package/src/CircularProgressBar/RadialSeparator.tsx +23 -0
- package/src/CircularProgressBar/RewardProgressBar.d.ts +8 -0
- package/src/CircularProgressBar/RewardProgressBar.tsx +131 -0
- package/src/CircularProgressBar/RewardSubscriptionMonthDescription.d.ts +8 -0
- package/src/CircularProgressBar/RewardSubscriptionMonthDescription.tsx +80 -0
- package/src/CircularProgressBar/RewardSubscriptionTotal.d.ts +8 -0
- package/src/CircularProgressBar/RewardSubscriptionTotal.tsx +186 -0
- package/src/CircularProgressBar/SubscriptionReward.d.ts +4 -0
- package/src/CircularProgressBar/SubscriptionReward.tsx +131 -0
- package/src/CircularProgressBar/SubscriptionRewardMobile.d.ts +4 -0
- package/src/CircularProgressBar/SubscriptionRewardMobile.tsx +321 -0
- package/src/CircularProgressBar/index.d.ts +1 -0
- package/src/CircularProgressBar/index.ts +1 -0
- package/src/CircularProgressBar/logic/calculateMonthCompletionValues.d.ts +5 -0
- package/src/CircularProgressBar/logic/calculateMonthCompletionValues.ts +68 -0
- package/src/CircularProgressBar/specs/RadialSeperator.spec.d.ts +1 -0
- package/src/CircularProgressBar/specs/RadialSeperator.spec.tsx +33 -0
- package/src/CircularProgressBar/specs/RewardProgressBar.spec.d.ts +1 -0
- package/src/CircularProgressBar/specs/RewardProgressBar.spec.tsx +164 -0
- package/src/CircularProgressBar/specs/RewardSubscriptionMonthDescription.spec.d.ts +1 -0
- package/src/CircularProgressBar/specs/RewardSubscriptionMonthDescription.spec.tsx +87 -0
- package/src/CircularProgressBar/specs/RewardSubscriptionTotal.spec.d.ts +1 -0
- package/src/CircularProgressBar/specs/RewardSubscriptionTotal.spec.tsx +361 -0
- package/src/CircularProgressBar/specs/SubscriptionReward.spec.d.ts +1 -0
- package/src/CircularProgressBar/specs/SubscriptionReward.spec.tsx +389 -0
- package/src/CircularProgressBar/specs/SubscriptionRewardMobile.spec.d.ts +1 -0
- package/src/CircularProgressBar/specs/SubscriptionRewardMobile.spec.tsx +409 -0
- package/src/CircularProgressBar/specs/calculateMonthCompletionValues.spec.d.ts +1 -0
- package/src/CircularProgressBar/specs/calculateMonthCompletionValues.spec.tsx +200 -0
- package/src/CircularProgressBar/types.d.ts +93 -0
- package/src/CircularProgressBar/types.ts +99 -0
- package/src/Icons/Info.d.ts +2 -0
- package/src/Icons/Info.tsx +21 -0
- package/src/Icons/PromoLayoutIcon.d.ts +1 -0
- package/src/Icons/PromoLayoutIcon.tsx +40 -0
- package/src/Icons/SubscriptionVoucherIcon.d.ts +2 -0
- package/src/Icons/SubscriptionVoucherIcon.tsx +31 -0
- package/src/Icons/SubscriptionVoucherIconGrey.d.ts +2 -0
- package/src/Icons/SubscriptionVoucherIconGrey.tsx +31 -0
- package/src/Icons/index.d.ts +3 -0
- package/src/Icons/index.ts +3 -0
- package/src/SampleComponent/SampleComponent.d.ts +3 -0
- package/src/SampleComponent/SampleComponent.tsx +15 -0
- package/src/SampleComponent/index.d.ts +1 -0
- package/src/SampleComponent/index.ts +1 -0
- package/src/SampleComponent/specs/SampleComponent.spec.d.ts +1 -0
- package/src/SampleComponent/specs/SampleComponent.spec.tsx +27 -0
- package/src/SubscriptionRewardBanner/Rewards-Hero.jpg +0 -0
- package/src/SubscriptionRewardBanner/SubscriptionRewardBanner.d.ts +3 -0
- package/src/SubscriptionRewardBanner/SubscriptionRewardBanner.styled.d.ts +29 -0
- package/src/SubscriptionRewardBanner/SubscriptionRewardBanner.styled.tsx +79 -0
- package/src/SubscriptionRewardBanner/SubscriptionRewardBanner.tsx +69 -0
- package/src/SubscriptionRewardBanner/index.d.ts +1 -0
- package/src/SubscriptionRewardBanner/index.ts +1 -0
- package/src/SubscriptionRewardBanner/specs/SubscriptionRewardBanner.spec.d.ts +1 -0
- package/src/SubscriptionRewardBanner/specs/SubscriptionRewardBanner.spec.tsx +90 -0
- package/src/SubscriptionRewardBanner/types.d.ts +20 -0
- package/src/SubscriptionRewardBanner/types.ts +20 -0
- package/src/SubscriptionRewardModal/Rewards-Hero.jpg +0 -0
- package/src/SubscriptionRewardModal/SubscriptionRewardModal.d.ts +2 -0
- package/src/SubscriptionRewardModal/SubscriptionRewardModal.styled.d.ts +40 -0
- package/src/SubscriptionRewardModal/SubscriptionRewardModal.styled.tsx +78 -0
- package/src/SubscriptionRewardModal/SubscriptionRewardModal.tsx +117 -0
- package/src/SubscriptionRewardModal/index.d.ts +1 -0
- package/src/SubscriptionRewardModal/index.ts +1 -0
- package/src/SubscriptionRewardModal/specs/SubscriptionRewardModal.spec.d.ts +1 -0
- package/src/SubscriptionRewardModal/specs/SubscriptionRewardModal.spec.tsx +53 -0
- package/src/SubscriptionRewardModal/types.d.ts +20 -0
- package/src/SubscriptionRewardModal/types.ts +20 -0
- package/src/Utils/application/application.d.ts +14 -0
- package/src/Utils/application/application.ts +23 -0
- package/src/Utils/application/index.d.ts +2 -0
- package/src/Utils/application/index.ts +2 -0
- package/src/Utils/application/specs/application.spec.d.ts +1 -0
- package/src/Utils/application/specs/application.spec.ts +120 -0
- package/src/Utils/helper.d.ts +4 -0
- package/src/Utils/helper.ts +9 -0
- package/src/Utils/index.d.ts +0 -0
- package/src/Utils/index.ts +0 -0
- package/src/images/Rewards-Hero.jpg +0 -0
- package/src/images/rewards-logo-black.png +0 -0
- package/src/images/rewards-logo-white.png +0 -0
- package/src/images.d.ts +24 -0
- package/src/index.d.ts +5 -0
- package/src/index.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/react-loyalty-elements",
|
|
3
|
-
"version": "1.1.0-review-comments.
|
|
3
|
+
"version": "1.1.0-review-comments.6",
|
|
4
4
|
"description": "A React based component library for reusable Nextgen Loyalty component",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"files": [
|
|
86
86
|
"dist",
|
|
87
|
+
"src",
|
|
87
88
|
"README.md",
|
|
88
89
|
"package.json"
|
|
89
90
|
],
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const RewardProgressBarContainer: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const LoyaltyProgressSubContainer: import("@emotion/styled").StyledComponent<{
|
|
7
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
+
export declare const StyledCard: import("@emotion/styled").StyledComponent<{
|
|
11
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
12
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
13
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
+
export declare const Learn3XLink: import("@emotion/styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
16
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
17
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
+
export declare const ProgressBarCenter: import("@emotion/styled").StyledComponent<{
|
|
19
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
20
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
21
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
22
|
+
export declare const RewardProgressTotalContainer: import("@emotion/styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
24
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
25
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
26
|
+
export declare const RewardProgressTotalButtonWithIcon: import("@emotion/styled").StyledComponent<{
|
|
27
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
28
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
29
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
30
|
+
export declare const IconContainer: import("@emotion/styled").StyledComponent<{
|
|
31
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
32
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
33
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
34
|
+
export declare const SeparatorCard: import("@emotion/styled").StyledComponent<{
|
|
35
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
36
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
37
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
38
|
+
export declare const SeparatorInnerCard: import("@emotion/styled").StyledComponent<{
|
|
39
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
40
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
41
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { styled } from '@nuskin/foundation-theme';
|
|
2
|
+
|
|
3
|
+
export const RewardProgressBarContainer = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
align-items: center;
|
|
8
|
+
align-content: center;
|
|
9
|
+
background-color: #f5f5f5;
|
|
10
|
+
border: 1px solid #e0e0e0;
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
padding: 1.5rem;
|
|
13
|
+
margin-bottom: 20px;
|
|
14
|
+
height: 50%;
|
|
15
|
+
margin: auto;
|
|
16
|
+
|
|
17
|
+
@media (max-width: 950px) {
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const LoyaltyProgressSubContainer = styled.div`
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
align-items: center;
|
|
27
|
+
align-content: center;
|
|
28
|
+
|
|
29
|
+
.reward-logo {
|
|
30
|
+
width: 200px;
|
|
31
|
+
margin-bottom: 12px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.reward-progress {
|
|
35
|
+
height: 150px;
|
|
36
|
+
width: 150px;
|
|
37
|
+
}
|
|
38
|
+
.progress-bar {
|
|
39
|
+
background-color: #e0e0e0;
|
|
40
|
+
height: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (max-width: 950px) {
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
|
|
46
|
+
.info-container {
|
|
47
|
+
margin-left: 0px;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
.reward-progress-total-div {
|
|
51
|
+
margin-top: 10px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
export const StyledCard = styled.div`
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
margin-left: 16px;
|
|
60
|
+
|
|
61
|
+
.info-item {
|
|
62
|
+
margin: 5px 0;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
export const Learn3XLink = styled.div`
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
`;
|
|
71
|
+
export const ProgressBarCenter = styled.div`
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 50%;
|
|
74
|
+
left: 50%;
|
|
75
|
+
transform: translate(-50%, -50%);
|
|
76
|
+
text-align: center;
|
|
77
|
+
color: black;
|
|
78
|
+
|
|
79
|
+
.center-value-progress-bar-price {
|
|
80
|
+
margin: 0;
|
|
81
|
+
}
|
|
82
|
+
.center-value-progress-bar-voucher {
|
|
83
|
+
margin: 0;
|
|
84
|
+
letter-spacing: 0.01em;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
export const RewardProgressTotalContainer = styled.div`
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
align-items: center;
|
|
92
|
+
|
|
93
|
+
.total-button {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
background-color: #e5edf6;
|
|
97
|
+
border-radius: 20px;
|
|
98
|
+
font-size: 14px;
|
|
99
|
+
font-weight: 400;
|
|
100
|
+
line-height: 20px;
|
|
101
|
+
}
|
|
102
|
+
.reward-subtitle {
|
|
103
|
+
letter-spacing: 0;
|
|
104
|
+
display: flex;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (max-width: 950px) {
|
|
108
|
+
.reward-subtitle {
|
|
109
|
+
letter-spacing: 0;
|
|
110
|
+
display: flex;
|
|
111
|
+
text-align: center;
|
|
112
|
+
}
|
|
113
|
+
margin-top: 10px;
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
export const RewardProgressTotalButtonWithIcon = styled.div`
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
background-color: #e5edf6;
|
|
121
|
+
border-radius: 20px;
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
font-weight: 400;
|
|
124
|
+
line-height: 20px;
|
|
125
|
+
padding: 1rem;
|
|
126
|
+
margin-bottom: 14px;
|
|
127
|
+
|
|
128
|
+
@media (max-width: 950px) {
|
|
129
|
+
margin-top: 14px;
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
export const IconContainer = styled.span`
|
|
134
|
+
.info-icon {
|
|
135
|
+
margin-left: 6px !important;
|
|
136
|
+
}
|
|
137
|
+
.loyalty-icon {
|
|
138
|
+
height: 19px !important;
|
|
139
|
+
width: 19px !important;
|
|
140
|
+
margin-left: 6px !important;
|
|
141
|
+
}
|
|
142
|
+
.loyalty-warning-icon {
|
|
143
|
+
height: 19px !important;
|
|
144
|
+
width: 19px !important;
|
|
145
|
+
margin-right: 6px !important;
|
|
146
|
+
}
|
|
147
|
+
.outline-exclamation-icon {
|
|
148
|
+
height: 48px !important;
|
|
149
|
+
width: 48px !important;
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
export const SeparatorCard = styled.div`
|
|
154
|
+
position: absolute;
|
|
155
|
+
height: 100%;
|
|
156
|
+
`;
|
|
157
|
+
|
|
158
|
+
export const SeparatorInnerCard = styled.div`
|
|
159
|
+
background: #fff;
|
|
160
|
+
width: 6px;
|
|
161
|
+
height: 17%;
|
|
162
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SeparatorCard, SeparatorInnerCard } from './CircularProgressBar.styled';
|
|
3
|
+
|
|
4
|
+
function Separator(props: { readonly turns: number }) {
|
|
5
|
+
return (
|
|
6
|
+
<SeparatorCard
|
|
7
|
+
style={{
|
|
8
|
+
transform: `rotate(${props.turns}turn)`,
|
|
9
|
+
}}
|
|
10
|
+
>
|
|
11
|
+
<SeparatorInnerCard />
|
|
12
|
+
</SeparatorCard>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function RadialSeparators(props: { count: number }) {
|
|
17
|
+
const turns = 1 / props.count;
|
|
18
|
+
return Array(props.count)
|
|
19
|
+
.fill(null)
|
|
20
|
+
.map((_, index) => <Separator key={index} turns={index * turns + 0.5} />);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default RadialSeparators;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RewardProgressBarProps } from './types';
|
|
3
|
+
declare class RewardProgressBar extends React.Component<RewardProgressBarProps> {
|
|
4
|
+
constructor(props: RewardProgressBarProps);
|
|
5
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}
|
|
7
|
+
export default RewardProgressBar;
|
|
8
|
+
export { RewardProgressBar };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar';
|
|
3
|
+
import RadialSeparators from './RadialSeparator';
|
|
4
|
+
import { FaExclamationTriangle } from 'react-icons/fa';
|
|
5
|
+
import SubscriptionVoucherIcon from '../Icons/SubscriptionVoucherIcon';
|
|
6
|
+
import SubscriptionVoucherIconGrey from '../Icons/SubscriptionVoucherIconGrey';
|
|
7
|
+
import { IconContainer, LoyaltyProgressSubContainer, ProgressBarCenter } from './CircularProgressBar.styled';
|
|
8
|
+
import RewardSubscriptionMonthDescription from './RewardSubscriptionMonthDescription';
|
|
9
|
+
import { NsTypography } from '@nuskin/foundation-ui-components';
|
|
10
|
+
import { RewardProgressBarProps } from './types';
|
|
11
|
+
import { replacePlaceholders } from '../Utils/helper';
|
|
12
|
+
|
|
13
|
+
class RewardProgressBar extends React.Component<RewardProgressBarProps> {
|
|
14
|
+
constructor(props: RewardProgressBarProps) {
|
|
15
|
+
super(props);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
const {
|
|
20
|
+
value,
|
|
21
|
+
voucherValue,
|
|
22
|
+
maxMonths,
|
|
23
|
+
handleOpenSubscriptionRewardPopup,
|
|
24
|
+
notQualifyForRewardThisMonth,
|
|
25
|
+
translationConfig = {
|
|
26
|
+
voucherTargetAmount: '',
|
|
27
|
+
monthsComplete: '',
|
|
28
|
+
voucherEarned: '',
|
|
29
|
+
learnMore: '',
|
|
30
|
+
learn3xMore: '',
|
|
31
|
+
callToAction: '',
|
|
32
|
+
notQualify: '',
|
|
33
|
+
approximateMonthly: '',
|
|
34
|
+
approximateTotal: '',
|
|
35
|
+
currentlyTrack: '',
|
|
36
|
+
loyaltyLogoBlack: '',
|
|
37
|
+
},
|
|
38
|
+
learnMoreConfig = {
|
|
39
|
+
tagLine: '',
|
|
40
|
+
cardOneDescription: '',
|
|
41
|
+
cardOneVoucherAmount: '',
|
|
42
|
+
cardTwoDescription: '',
|
|
43
|
+
cardTwoVoucherAmount: '',
|
|
44
|
+
header: '',
|
|
45
|
+
loyaltyLogoWhite: '',
|
|
46
|
+
loyaltyBanner: '',
|
|
47
|
+
learnMore: '',
|
|
48
|
+
},
|
|
49
|
+
} = this.props;
|
|
50
|
+
const voucherTargetAmount = replacePlaceholders(translationConfig.voucherTargetAmount, {
|
|
51
|
+
currency_symbol: '',
|
|
52
|
+
voucher_amount: '',
|
|
53
|
+
});
|
|
54
|
+
return (
|
|
55
|
+
<LoyaltyProgressSubContainer>
|
|
56
|
+
<div className="reward-progress">
|
|
57
|
+
<CircularProgressbarWithChildren
|
|
58
|
+
value={(value / maxMonths) * 100}
|
|
59
|
+
strokeWidth={12}
|
|
60
|
+
background
|
|
61
|
+
styles={buildStyles({
|
|
62
|
+
rotation: 0.5,
|
|
63
|
+
strokeLinecap: 'butt',
|
|
64
|
+
backgroundColor: (() => {
|
|
65
|
+
if (value === maxMonths && !notQualifyForRewardThisMonth) {
|
|
66
|
+
return 'rgb(195 240 194)';
|
|
67
|
+
}
|
|
68
|
+
if (notQualifyForRewardThisMonth) {
|
|
69
|
+
return '#fff';
|
|
70
|
+
}
|
|
71
|
+
return '#fff';
|
|
72
|
+
})(),
|
|
73
|
+
pathColor: '#6BC56A',
|
|
74
|
+
trailColor: '#E0E0E0',
|
|
75
|
+
})}
|
|
76
|
+
>
|
|
77
|
+
<RadialSeparators count={maxMonths} />
|
|
78
|
+
{(() => {
|
|
79
|
+
if (value === maxMonths && !notQualifyForRewardThisMonth) {
|
|
80
|
+
return <SubscriptionVoucherIcon />;
|
|
81
|
+
} else if (notQualifyForRewardThisMonth) {
|
|
82
|
+
return (
|
|
83
|
+
<IconContainer>
|
|
84
|
+
<FaExclamationTriangle className="outline-exclamation-icon" color="#91ACC8" />
|
|
85
|
+
</IconContainer>
|
|
86
|
+
);
|
|
87
|
+
} else if (voucherValue != null || voucherValue != undefined) {
|
|
88
|
+
return (
|
|
89
|
+
<ProgressBarCenter>
|
|
90
|
+
<NsTypography
|
|
91
|
+
component="div"
|
|
92
|
+
className="center-value-progress-bar-price"
|
|
93
|
+
variant="title-l"
|
|
94
|
+
weight="bold"
|
|
95
|
+
>{`$${voucherValue}`}</NsTypography>
|
|
96
|
+
<NsTypography
|
|
97
|
+
variant="label-s"
|
|
98
|
+
weight="bold"
|
|
99
|
+
component="div"
|
|
100
|
+
className="center-value-progress-bar-voucher"
|
|
101
|
+
>
|
|
102
|
+
{voucherTargetAmount}
|
|
103
|
+
</NsTypography>
|
|
104
|
+
</ProgressBarCenter>
|
|
105
|
+
);
|
|
106
|
+
} else {
|
|
107
|
+
return (
|
|
108
|
+
<ProgressBarCenter>
|
|
109
|
+
<SubscriptionVoucherIconGrey />
|
|
110
|
+
</ProgressBarCenter>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
})()}
|
|
114
|
+
</CircularProgressbarWithChildren>
|
|
115
|
+
</div>
|
|
116
|
+
<RewardSubscriptionMonthDescription
|
|
117
|
+
value={value}
|
|
118
|
+
voucherValue={voucherValue}
|
|
119
|
+
notQualifyForRewardThisMonth={notQualifyForRewardThisMonth}
|
|
120
|
+
handleOpenSubscriptionRewardPopup={handleOpenSubscriptionRewardPopup}
|
|
121
|
+
maxMonths={maxMonths}
|
|
122
|
+
translationConfig={translationConfig}
|
|
123
|
+
learnMoreConfig={learnMoreConfig}
|
|
124
|
+
/>
|
|
125
|
+
</LoyaltyProgressSubContainer>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default RewardProgressBar;
|
|
131
|
+
export { RewardProgressBar };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RewardSubscriptionMonthDescriptionProps } from './types';
|
|
3
|
+
declare class RewardSubscriptionMonthDescription extends React.Component<RewardSubscriptionMonthDescriptionProps> {
|
|
4
|
+
constructor(props: RewardSubscriptionMonthDescriptionProps);
|
|
5
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}
|
|
7
|
+
export default RewardSubscriptionMonthDescription;
|
|
8
|
+
export { RewardSubscriptionMonthDescription };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Learn3XLink, StyledCard } from './CircularProgressBar.styled';
|
|
3
|
+
import { RewardSubscriptionMonthDescriptionProps } from './types';
|
|
4
|
+
import { replacePlaceholders, currencySymbol } from '../Utils/helper';
|
|
5
|
+
|
|
6
|
+
class RewardSubscriptionMonthDescription extends React.Component<RewardSubscriptionMonthDescriptionProps> {
|
|
7
|
+
constructor(props: RewardSubscriptionMonthDescriptionProps) {
|
|
8
|
+
super(props);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
render() {
|
|
12
|
+
const {
|
|
13
|
+
value,
|
|
14
|
+
voucherValue,
|
|
15
|
+
maxMonths,
|
|
16
|
+
handleOpenSubscriptionRewardPopup,
|
|
17
|
+
notQualifyForRewardThisMonth,
|
|
18
|
+
translationConfig = {
|
|
19
|
+
voucherTargetAmount: '',
|
|
20
|
+
monthsComplete: '',
|
|
21
|
+
voucherEarned: '',
|
|
22
|
+
learnMore: '',
|
|
23
|
+
learn3xMore: '',
|
|
24
|
+
callToAction: '',
|
|
25
|
+
notQualify: '',
|
|
26
|
+
approximateMonthly: '',
|
|
27
|
+
approximateTotal: '',
|
|
28
|
+
currentlyTrack: '',
|
|
29
|
+
loyaltyLogoBlack: '',
|
|
30
|
+
},
|
|
31
|
+
learnMoreConfig = {
|
|
32
|
+
tagLine: '',
|
|
33
|
+
cardOneDescription: '',
|
|
34
|
+
cardOneVoucherAmount: '',
|
|
35
|
+
cardTwoDescription: '',
|
|
36
|
+
cardTwoVoucherAmount: '',
|
|
37
|
+
header: '',
|
|
38
|
+
loyaltyLogoWhite: '',
|
|
39
|
+
loyaltyBanner: '',
|
|
40
|
+
learnMore: '',
|
|
41
|
+
},
|
|
42
|
+
} = this.props;
|
|
43
|
+
|
|
44
|
+
let popupText = '';
|
|
45
|
+
const minVoucher = 50;
|
|
46
|
+
const maxVoucher = 150;
|
|
47
|
+
if (voucherValue === minVoucher && !notQualifyForRewardThisMonth) {
|
|
48
|
+
popupText = translationConfig.learn3xMore;
|
|
49
|
+
} else if (voucherValue === maxVoucher || notQualifyForRewardThisMonth) {
|
|
50
|
+
popupText = learnMoreConfig.learnMore;
|
|
51
|
+
} else if (voucherValue === null || voucherValue === undefined) {
|
|
52
|
+
popupText = translationConfig.learnMore;
|
|
53
|
+
}
|
|
54
|
+
const monthsCompleteText = replacePlaceholders(translationConfig.monthsComplete, {
|
|
55
|
+
completed_months: value,
|
|
56
|
+
total_months: maxMonths,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const voucherEarnedText = replacePlaceholders(translationConfig.voucherEarned, {
|
|
60
|
+
currency_symbol: currencySymbol(),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<StyledCard>
|
|
65
|
+
<img className="reward-logo" src={translationConfig.loyaltyLogoBlack} alt="Rewards Logo" />
|
|
66
|
+
{value === maxMonths ? (
|
|
67
|
+
<div className="info-item">{voucherEarnedText}</div>
|
|
68
|
+
) : (
|
|
69
|
+
<div className="info-item">{monthsCompleteText}</div>
|
|
70
|
+
)}
|
|
71
|
+
<Learn3XLink id="learnMore" onClick={handleOpenSubscriptionRewardPopup}>
|
|
72
|
+
<u>{popupText}</u>
|
|
73
|
+
</Learn3XLink>
|
|
74
|
+
</StyledCard>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default RewardSubscriptionMonthDescription;
|
|
80
|
+
export { RewardSubscriptionMonthDescription };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RewardProgressBarProps } from './types';
|
|
3
|
+
declare class RewardSubscriptionTotal extends React.Component<RewardProgressBarProps> {
|
|
4
|
+
constructor(props: RewardProgressBarProps);
|
|
5
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}
|
|
7
|
+
export default RewardSubscriptionTotal;
|
|
8
|
+
export { RewardSubscriptionTotal };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FaExclamationTriangle } from 'react-icons/fa';
|
|
3
|
+
import {
|
|
4
|
+
IconContainer,
|
|
5
|
+
RewardProgressTotalButtonWithIcon,
|
|
6
|
+
RewardProgressTotalContainer,
|
|
7
|
+
} from './CircularProgressBar.styled';
|
|
8
|
+
import { NsTypography } from '@nuskin/foundation-ui-components';
|
|
9
|
+
import { RewardProgressBarProps } from './types';
|
|
10
|
+
import Info from '../Icons/Info';
|
|
11
|
+
import { Tooltip, IconButton } from '@mui/material';
|
|
12
|
+
import { replacePlaceholders } from '../Utils/helper';
|
|
13
|
+
class RewardSubscriptionTotal extends React.Component<RewardProgressBarProps> {
|
|
14
|
+
constructor(props: RewardProgressBarProps) {
|
|
15
|
+
super(props);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
const {
|
|
20
|
+
value,
|
|
21
|
+
voucherValue,
|
|
22
|
+
maxMonths,
|
|
23
|
+
notQualifyForRewardThisMonth,
|
|
24
|
+
amountShow,
|
|
25
|
+
translationConfig = {
|
|
26
|
+
voucherTargetAmount: '',
|
|
27
|
+
monthsComplete: '',
|
|
28
|
+
voucherEarned: '',
|
|
29
|
+
learnMore: '',
|
|
30
|
+
learn3xMore: '',
|
|
31
|
+
callToAction: '',
|
|
32
|
+
notQualify: '',
|
|
33
|
+
approximateMonthly: '',
|
|
34
|
+
approximateTotal: '',
|
|
35
|
+
currentlyTrack: '',
|
|
36
|
+
loyaltyLogoBlack: '',
|
|
37
|
+
estimateDisclaimer: '',
|
|
38
|
+
},
|
|
39
|
+
storeConfig = {
|
|
40
|
+
tiers: [
|
|
41
|
+
{
|
|
42
|
+
consecutive_months: 0,
|
|
43
|
+
min_spend: 0,
|
|
44
|
+
max_spend: 0,
|
|
45
|
+
promo_code: '',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
consecutive_months: 0,
|
|
49
|
+
min_spend: 0,
|
|
50
|
+
promo_code: '',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
} = this.props;
|
|
55
|
+
|
|
56
|
+
const currentlyTrackText = replacePlaceholders(translationConfig.currentlyTrack, {
|
|
57
|
+
currency_symbol: '$',
|
|
58
|
+
currency_amount: voucherValue,
|
|
59
|
+
});
|
|
60
|
+
const approximateTotalText = replacePlaceholders(translationConfig.approximateTotal, {
|
|
61
|
+
currency_symbol: '',
|
|
62
|
+
projected_month_spend: '',
|
|
63
|
+
});
|
|
64
|
+
const minAmount = storeConfig?.tiers?.[0]?.min_spend ?? 0;
|
|
65
|
+
const callToActionText = replacePlaceholders(translationConfig.callToAction, {
|
|
66
|
+
currency_symbol: '$',
|
|
67
|
+
current_spend_target: minAmount,
|
|
68
|
+
});
|
|
69
|
+
const approximateMonthlyText = replacePlaceholders(translationConfig.approximateMonthly, {
|
|
70
|
+
currency_symbol: '',
|
|
71
|
+
estimated_running_subscription_spend: '',
|
|
72
|
+
});
|
|
73
|
+
return (
|
|
74
|
+
<RewardProgressTotalContainer>
|
|
75
|
+
<RewardProgressTotalButtonWithIcon>
|
|
76
|
+
{notQualifyForRewardThisMonth ? (
|
|
77
|
+
<>
|
|
78
|
+
<IconContainer>
|
|
79
|
+
<FaExclamationTriangle className="loyalty-warning-icon" color="#4A6987" />
|
|
80
|
+
</IconContainer>
|
|
81
|
+
<NsTypography
|
|
82
|
+
variant="body-s"
|
|
83
|
+
weight="normal"
|
|
84
|
+
className="reward-subtitle"
|
|
85
|
+
colorOverride="#293A4A"
|
|
86
|
+
noSpacing
|
|
87
|
+
>
|
|
88
|
+
{translationConfig.notQualify}
|
|
89
|
+
</NsTypography>
|
|
90
|
+
</>
|
|
91
|
+
) : (
|
|
92
|
+
<>
|
|
93
|
+
<NsTypography
|
|
94
|
+
variant="body-s"
|
|
95
|
+
weight="normal"
|
|
96
|
+
colorOverride="#252525"
|
|
97
|
+
className="reward-subtitle"
|
|
98
|
+
component="span"
|
|
99
|
+
noSpacing
|
|
100
|
+
>
|
|
101
|
+
{approximateMonthlyText}
|
|
102
|
+
</NsTypography>
|
|
103
|
+
|
|
104
|
+
<NsTypography weight="bold" className="button-price" variant="body-s" component="span">
|
|
105
|
+
{`$${amountShow}`}
|
|
106
|
+
</NsTypography>
|
|
107
|
+
<IconContainer>
|
|
108
|
+
<Tooltip
|
|
109
|
+
slotProps={{
|
|
110
|
+
tooltip: {
|
|
111
|
+
sx: {
|
|
112
|
+
color: '#FFFFFF',
|
|
113
|
+
backgroundColor: '#252525',
|
|
114
|
+
fontFamily: 'Inter',
|
|
115
|
+
fontWeight: 400,
|
|
116
|
+
fontSize: '14px',
|
|
117
|
+
lineHeight: '20px',
|
|
118
|
+
'& .MuiTooltip-arrow': {
|
|
119
|
+
color: '#252525',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}}
|
|
124
|
+
title={translationConfig.estimateDisclaimer}
|
|
125
|
+
arrow
|
|
126
|
+
placement="top"
|
|
127
|
+
>
|
|
128
|
+
<span className="info-icon">
|
|
129
|
+
<IconButton>
|
|
130
|
+
<Info />
|
|
131
|
+
</IconButton>
|
|
132
|
+
</span>
|
|
133
|
+
</Tooltip>
|
|
134
|
+
</IconContainer>
|
|
135
|
+
</>
|
|
136
|
+
)}
|
|
137
|
+
</RewardProgressTotalButtonWithIcon>
|
|
138
|
+
{(() => {
|
|
139
|
+
if (value === maxMonths) {
|
|
140
|
+
return '';
|
|
141
|
+
} else if (notQualifyForRewardThisMonth) {
|
|
142
|
+
return (
|
|
143
|
+
<NsTypography
|
|
144
|
+
variant="body-s"
|
|
145
|
+
weight="normal"
|
|
146
|
+
className="reward-subtitle"
|
|
147
|
+
colorOverride="#252525"
|
|
148
|
+
component="div"
|
|
149
|
+
>
|
|
150
|
+
{approximateTotalText}
|
|
151
|
+
<NsTypography component="span" className="button-price" variant="body-s" weight="bold">
|
|
152
|
+
{` $${amountShow}`}
|
|
153
|
+
</NsTypography>
|
|
154
|
+
</NsTypography>
|
|
155
|
+
);
|
|
156
|
+
} else if (voucherValue != null || voucherValue != undefined) {
|
|
157
|
+
return (
|
|
158
|
+
<NsTypography
|
|
159
|
+
variant="body-s"
|
|
160
|
+
weight="bold"
|
|
161
|
+
className="reward-subtitle"
|
|
162
|
+
colorOverride="#252525"
|
|
163
|
+
>
|
|
164
|
+
{currentlyTrackText}
|
|
165
|
+
</NsTypography>
|
|
166
|
+
);
|
|
167
|
+
} else {
|
|
168
|
+
return (
|
|
169
|
+
<NsTypography
|
|
170
|
+
variant="body-s"
|
|
171
|
+
weight="bold"
|
|
172
|
+
className="reward-subtitle"
|
|
173
|
+
colorOverride="#252525"
|
|
174
|
+
>
|
|
175
|
+
{callToActionText}
|
|
176
|
+
</NsTypography>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
})()}
|
|
180
|
+
</RewardProgressTotalContainer>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export default RewardSubscriptionTotal;
|
|
186
|
+
export { RewardSubscriptionTotal };
|