tf-checkout-react 1.0.103 → 1.0.106
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/api/index.d.ts +3 -1
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/components/common/DatePickerField.d.ts +14 -0
- package/dist/components/common/RedirectModal.d.ts +7 -0
- package/dist/components/countdown/index.d.ts +3 -1
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +2 -0
- package/dist/components/rsvpContainer/index.d.ts +7 -0
- package/dist/components/ticketResale/index.d.ts +5 -3
- package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +5 -9
- package/dist/components/ticketsContainer/TicketsSection.d.ts +6 -3
- package/dist/components/ticketsContainer/index.d.ts +9 -2
- package/dist/components/timerWidget/index.d.ts +3 -3
- package/dist/images/cross.svg +44 -0
- package/dist/images/done.svg +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/tf-checkout-react.cjs.development.js +639 -223
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +645 -231
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/package.json +89 -89
- package/src/.DS_Store +0 -0
- package/src/.d.ts +2 -2
- package/src/api/index.ts +300 -278
- package/src/assets/images/cross.svg +44 -0
- package/src/assets/images/done.svg +3 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +811 -799
- package/src/components/billing-info-container/style.css +105 -105
- package/src/components/billing-info-container/utils.ts +225 -224
- package/src/components/common/CheckboxField.tsx +41 -41
- package/src/components/common/CustomField.tsx +87 -84
- package/src/components/common/DatePickerField.tsx +98 -0
- package/src/components/common/FormikPhoneNumberField.tsx +51 -51
- package/src/components/common/Loader.tsx +9 -9
- package/src/components/common/RadioField.tsx +35 -35
- package/src/components/common/RedirectModal.tsx +43 -0
- package/src/components/common/SelectField.tsx +80 -80
- package/src/components/common/SnackbarAlert.tsx +53 -53
- package/src/components/common/index.tsx +4 -4
- package/src/components/confirmModal/index.tsx +51 -51
- package/src/components/confirmModal/style.css +21 -21
- package/src/components/confirmationContainer/config.ts +72 -72
- package/src/components/confirmationContainer/index.tsx +197 -197
- package/src/components/confirmationContainer/social-buttons.tsx +94 -94
- package/src/components/confirmationContainer/style.css +202 -202
- package/src/components/countdown/index.tsx +98 -89
- package/src/components/countdown/style.css +9 -9
- package/src/components/index.ts +7 -7
- package/src/components/loginModal/index.tsx +209 -209
- package/src/components/loginModal/style.css +71 -71
- package/src/components/myTicketsContainer/index.tsx +196 -196
- package/src/components/myTicketsContainer/row.tsx +41 -41
- package/src/components/myTicketsContainer/style.css +39 -39
- package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
- package/src/components/orderDetailsContainer/index.tsx +252 -249
- package/src/components/orderDetailsContainer/style.css +72 -72
- package/src/components/orderDetailsContainer/ticketsTable.tsx +130 -124
- package/src/components/paymentContainer/index.tsx +285 -284
- package/src/components/registerModal/index.tsx +190 -190
- package/src/components/rsvpContainer/index.tsx +126 -0
- package/src/components/stripePayment/index.tsx +254 -253
- package/src/components/stripePayment/style.css +59 -59
- package/src/components/ticketResale/index.tsx +74 -56
- package/src/components/ticketResaleModal/index.tsx +215 -210
- package/src/components/ticketResaleModal/style.css +28 -28
- package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +88 -99
- package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
- package/src/components/ticketsContainer/TicketRow.tsx +83 -83
- package/src/components/ticketsContainer/TicketsSection.tsx +90 -81
- package/src/components/ticketsContainer/index.tsx +464 -430
- package/src/components/ticketsContainer/style.css +181 -181
- package/src/components/ticketsContainer/utils.ts +11 -11
- package/src/components/timerWidget/index.tsx +87 -70
- package/src/components/timerWidget/style.css +34 -26
- package/src/components/waitingList/index.tsx +178 -178
- package/src/components/waitingList/style.css +26 -26
- package/src/env.ts +20 -20
- package/src/index.ts +15 -13
- package/src/normalizers/index.ts +45 -45
- package/src/types/billing-info-data.ts +37 -37
- package/src/types/payment-field.ts +7 -7
- package/src/types/referral-promotion.ts +7 -7
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
- package/src/utils/downloadPDF.tsx +30 -30
- package/src/utils/formikErrorFocus.ts +24 -24
- package/src/utils/getImage.ts +14 -14
- package/src/utils/getQueryVariable.ts +13 -13
- package/src/utils/index.ts +5 -5
- package/src/utils/setConfigs.ts +26 -26
- package/src/utils/showZero.tsx +10 -10
- package/src/validators/index.ts +20 -20
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
}
|
|
5
|
-
.get-tickets-page {
|
|
6
|
-
width: 100%;
|
|
7
|
-
}
|
|
8
|
-
.event-detail__tier {
|
|
9
|
-
padding: 17px 35px 20px;
|
|
10
|
-
background-color: #fff;
|
|
11
|
-
}
|
|
12
|
-
.event-detail__tier-name {
|
|
13
|
-
font-family: Inter-Bold;
|
|
14
|
-
font-weight: 700;
|
|
15
|
-
line-height: 1.3;
|
|
16
|
-
text-transform: uppercase;
|
|
17
|
-
padding-right: 20%;
|
|
18
|
-
color: black;
|
|
19
|
-
font-size: 0.85rem;
|
|
20
|
-
font-family: 'Bebas Neue';
|
|
21
|
-
letter-spacing: 0.2em;
|
|
22
|
-
margin-top: 16px;
|
|
23
|
-
margin-bottom: 8px;
|
|
24
|
-
}
|
|
25
|
-
.event-detail__tier-status {
|
|
26
|
-
display: flex;
|
|
27
|
-
width: 100%;
|
|
28
|
-
flex-direction: row;
|
|
29
|
-
flex-wrap: wrap;
|
|
30
|
-
justify-content: space-between;
|
|
31
|
-
align-items: center;
|
|
32
|
-
margin-top: 8px;
|
|
33
|
-
}
|
|
34
|
-
.event-detail__tier-status.ticket-button {
|
|
35
|
-
color: #fff;
|
|
36
|
-
background-color: #212529;
|
|
37
|
-
border-color: #212529;
|
|
38
|
-
border-radius: 0;
|
|
39
|
-
border: 3px solid black;
|
|
40
|
-
letter-spacing: 0.2em;
|
|
41
|
-
font-weight: 700;
|
|
42
|
-
margin-bottom: 10px;
|
|
43
|
-
line-height: 1.5;
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
width: 200px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.event-tickets-container {
|
|
49
|
-
display: flex;
|
|
50
|
-
align-items: center;
|
|
51
|
-
justify-content: space-between;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.event-detail__tier-status.ticket-button.true {
|
|
55
|
-
background-color: #c1c3c6;
|
|
56
|
-
border-color: #afb0b1;
|
|
57
|
-
}
|
|
58
|
-
.event-detail__tier-price {
|
|
59
|
-
font-family: Inter-Bold;
|
|
60
|
-
font-size: 1.5rem;
|
|
61
|
-
line-height: 1;
|
|
62
|
-
color: #000;
|
|
63
|
-
text-align: center;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.event-detail__tier-price p {
|
|
67
|
-
margin: 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.event-detail__tier-price .fees {
|
|
71
|
-
font-size: 14px;
|
|
72
|
-
text-align: left;
|
|
73
|
-
margin-top: 4px;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.event-detail__tier-price .old-price {
|
|
77
|
-
margin-bottom: 5px;
|
|
78
|
-
color: #f00;
|
|
79
|
-
text-decoration: line-through;
|
|
80
|
-
font-size: 1.3rem;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.alert-info {
|
|
84
|
-
border: 1px solid #fbeed5;
|
|
85
|
-
padding: 8px 15px;
|
|
86
|
-
background-color: #d9edf7;
|
|
87
|
-
border-color: #bce8f1;
|
|
88
|
-
color: #3a87ad;
|
|
89
|
-
font-size: 1em;
|
|
90
|
-
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
|
91
|
-
border-radius: 4px;
|
|
92
|
-
margin: 0px 35px;
|
|
93
|
-
display: flex;
|
|
94
|
-
justify-content: center;
|
|
95
|
-
align-items: center;
|
|
96
|
-
}
|
|
97
|
-
.alert-info svg {
|
|
98
|
-
margin-right: 4px;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.event-detail__tier-state {
|
|
102
|
-
font-family: Inter-Bold;
|
|
103
|
-
font-weight: 300;
|
|
104
|
-
font-size: 0.75rem;
|
|
105
|
-
line-height: 1;
|
|
106
|
-
color: #30bc9d;
|
|
107
|
-
text-align: right;
|
|
108
|
-
text-transform: uppercase;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.event-detail__tier-state .ticket-not-started-message {
|
|
112
|
-
color: #000000;
|
|
113
|
-
text-transform: initial;
|
|
114
|
-
width: 50px;
|
|
115
|
-
text-align: left;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.promo-code-block input {
|
|
119
|
-
font-size: 14px;
|
|
120
|
-
padding: 1px 8px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.book-button {
|
|
124
|
-
background-color: #212529;
|
|
125
|
-
display: block;
|
|
126
|
-
text-align: center;
|
|
127
|
-
width: 100%;
|
|
128
|
-
height: 50px;
|
|
129
|
-
font-size: 26px;
|
|
130
|
-
color: #fff;
|
|
131
|
-
cursor: pointer;
|
|
132
|
-
background-color: #212529;
|
|
133
|
-
border-color: #212529;
|
|
134
|
-
border-radius: 0;
|
|
135
|
-
border: 3px solid black;
|
|
136
|
-
letter-spacing: 0.2em;
|
|
137
|
-
font-weight: 700;
|
|
138
|
-
line-height: 1.5;
|
|
139
|
-
margin: 25px auto 10px auto;
|
|
140
|
-
}
|
|
141
|
-
.book-button:hover {
|
|
142
|
-
background-color: #505050;
|
|
143
|
-
border-color: #505050;
|
|
144
|
-
}
|
|
145
|
-
.loader-container {
|
|
146
|
-
height: 100%;
|
|
147
|
-
width: 100%;
|
|
148
|
-
display: flex;
|
|
149
|
-
justify-content: center;
|
|
150
|
-
align-items: center;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.get-tickets-paper::-webkit-scrollbar {
|
|
154
|
-
width: 5px;
|
|
155
|
-
}
|
|
156
|
-
.get-tickets-paper::-webkit-scrollbar-track {
|
|
157
|
-
background: #f1f1f1;
|
|
158
|
-
}
|
|
159
|
-
.get-tickets-paper::-webkit-scrollbar-thumb {
|
|
160
|
-
background: #888;
|
|
161
|
-
}
|
|
162
|
-
.get-tickets-paper::-webkit-scrollbar-thumb:hover {
|
|
163
|
-
background: #555;
|
|
164
|
-
}
|
|
165
|
-
.get-tickets .get-tickets__selectbox {
|
|
166
|
-
width: 100%;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.disabled {
|
|
170
|
-
user-select: none;
|
|
171
|
-
pointer-events: none;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.hidden {
|
|
175
|
-
display: none;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.event-closed-message {
|
|
179
|
-
font-family: 'Bebas Neue';
|
|
180
|
-
letter-spacing: 0.5px;
|
|
181
|
-
}
|
|
1
|
+
body {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
}
|
|
5
|
+
.get-tickets-page {
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
.event-detail__tier {
|
|
9
|
+
padding: 17px 35px 20px;
|
|
10
|
+
background-color: #fff;
|
|
11
|
+
}
|
|
12
|
+
.event-detail__tier-name {
|
|
13
|
+
font-family: Inter-Bold;
|
|
14
|
+
font-weight: 700;
|
|
15
|
+
line-height: 1.3;
|
|
16
|
+
text-transform: uppercase;
|
|
17
|
+
padding-right: 20%;
|
|
18
|
+
color: black;
|
|
19
|
+
font-size: 0.85rem;
|
|
20
|
+
font-family: 'Bebas Neue';
|
|
21
|
+
letter-spacing: 0.2em;
|
|
22
|
+
margin-top: 16px;
|
|
23
|
+
margin-bottom: 8px;
|
|
24
|
+
}
|
|
25
|
+
.event-detail__tier-status {
|
|
26
|
+
display: flex;
|
|
27
|
+
width: 100%;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
flex-wrap: wrap;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
align-items: center;
|
|
32
|
+
margin-top: 8px;
|
|
33
|
+
}
|
|
34
|
+
.event-detail__tier-status.ticket-button {
|
|
35
|
+
color: #fff;
|
|
36
|
+
background-color: #212529;
|
|
37
|
+
border-color: #212529;
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
border: 3px solid black;
|
|
40
|
+
letter-spacing: 0.2em;
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
margin-bottom: 10px;
|
|
43
|
+
line-height: 1.5;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
width: 200px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.event-tickets-container {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.event-detail__tier-status.ticket-button.true {
|
|
55
|
+
background-color: #c1c3c6;
|
|
56
|
+
border-color: #afb0b1;
|
|
57
|
+
}
|
|
58
|
+
.event-detail__tier-price {
|
|
59
|
+
font-family: Inter-Bold;
|
|
60
|
+
font-size: 1.5rem;
|
|
61
|
+
line-height: 1;
|
|
62
|
+
color: #000;
|
|
63
|
+
text-align: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.event-detail__tier-price p {
|
|
67
|
+
margin: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.event-detail__tier-price .fees {
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
text-align: left;
|
|
73
|
+
margin-top: 4px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.event-detail__tier-price .old-price {
|
|
77
|
+
margin-bottom: 5px;
|
|
78
|
+
color: #f00;
|
|
79
|
+
text-decoration: line-through;
|
|
80
|
+
font-size: 1.3rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.alert-info {
|
|
84
|
+
border: 1px solid #fbeed5;
|
|
85
|
+
padding: 8px 15px;
|
|
86
|
+
background-color: #d9edf7;
|
|
87
|
+
border-color: #bce8f1;
|
|
88
|
+
color: #3a87ad;
|
|
89
|
+
font-size: 1em;
|
|
90
|
+
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
margin: 0px 35px;
|
|
93
|
+
display: flex;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
align-items: center;
|
|
96
|
+
}
|
|
97
|
+
.alert-info svg {
|
|
98
|
+
margin-right: 4px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.event-detail__tier-state {
|
|
102
|
+
font-family: Inter-Bold;
|
|
103
|
+
font-weight: 300;
|
|
104
|
+
font-size: 0.75rem;
|
|
105
|
+
line-height: 1;
|
|
106
|
+
color: #30bc9d;
|
|
107
|
+
text-align: right;
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.event-detail__tier-state .ticket-not-started-message {
|
|
112
|
+
color: #000000;
|
|
113
|
+
text-transform: initial;
|
|
114
|
+
width: 50px;
|
|
115
|
+
text-align: left;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.promo-code-block input {
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
padding: 1px 8px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.book-button {
|
|
124
|
+
background-color: #212529;
|
|
125
|
+
display: block;
|
|
126
|
+
text-align: center;
|
|
127
|
+
width: 100%;
|
|
128
|
+
height: 50px;
|
|
129
|
+
font-size: 26px;
|
|
130
|
+
color: #fff;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
background-color: #212529;
|
|
133
|
+
border-color: #212529;
|
|
134
|
+
border-radius: 0;
|
|
135
|
+
border: 3px solid black;
|
|
136
|
+
letter-spacing: 0.2em;
|
|
137
|
+
font-weight: 700;
|
|
138
|
+
line-height: 1.5;
|
|
139
|
+
margin: 25px auto 10px auto;
|
|
140
|
+
}
|
|
141
|
+
.book-button:hover {
|
|
142
|
+
background-color: #505050;
|
|
143
|
+
border-color: #505050;
|
|
144
|
+
}
|
|
145
|
+
.loader-container {
|
|
146
|
+
height: 100%;
|
|
147
|
+
width: 100%;
|
|
148
|
+
display: flex;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
align-items: center;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.get-tickets-paper::-webkit-scrollbar {
|
|
154
|
+
width: 5px;
|
|
155
|
+
}
|
|
156
|
+
.get-tickets-paper::-webkit-scrollbar-track {
|
|
157
|
+
background: #f1f1f1;
|
|
158
|
+
}
|
|
159
|
+
.get-tickets-paper::-webkit-scrollbar-thumb {
|
|
160
|
+
background: #888;
|
|
161
|
+
}
|
|
162
|
+
.get-tickets-paper::-webkit-scrollbar-thumb:hover {
|
|
163
|
+
background: #555;
|
|
164
|
+
}
|
|
165
|
+
.get-tickets .get-tickets__selectbox {
|
|
166
|
+
width: 100%;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.disabled {
|
|
170
|
+
user-select: none;
|
|
171
|
+
pointer-events: none;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.hidden {
|
|
175
|
+
display: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.event-closed-message {
|
|
179
|
+
font-family: 'Bebas Neue';
|
|
180
|
+
letter-spacing: 0.5px;
|
|
181
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export const getTicketSelectOptions = (
|
|
2
|
-
maxCount: number = 10,
|
|
3
|
-
minCount: number = 1,
|
|
4
|
-
multiplier: number = 1
|
|
5
|
-
) => {
|
|
6
|
-
const options = [{ label: 0, value: 0 }]
|
|
7
|
-
for (let i = minCount; i <= Math.min(50, maxCount); i += multiplier) {
|
|
8
|
-
options.push({ label: i, value: i })
|
|
9
|
-
}
|
|
10
|
-
return options
|
|
11
|
-
}
|
|
1
|
+
export const getTicketSelectOptions = (
|
|
2
|
+
maxCount: number = 10,
|
|
3
|
+
minCount: number = 1,
|
|
4
|
+
multiplier: number = 1
|
|
5
|
+
) => {
|
|
6
|
+
const options = [{ label: 0, value: 0 }]
|
|
7
|
+
for (let i = minCount; i <= Math.min(50, maxCount); i += multiplier) {
|
|
8
|
+
options.push({ label: i, value: i })
|
|
9
|
+
}
|
|
10
|
+
return options
|
|
11
|
+
}
|
|
@@ -1,70 +1,87 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import Countdown from 'react-countdown'
|
|
3
|
-
import { showZero } from '../../utils/showZero'
|
|
4
|
-
import '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
import React, { useState, memo } from 'react'
|
|
2
|
+
import Countdown from 'react-countdown'
|
|
3
|
+
import { showZero } from '../../utils/showZero'
|
|
4
|
+
import { getImage } from '../../utils/getImage'
|
|
5
|
+
import SVG from 'react-inlinesvg'
|
|
6
|
+
import './style.css'
|
|
7
|
+
|
|
8
|
+
export interface ITimerWidgetPage {
|
|
9
|
+
expires_at: number;
|
|
10
|
+
buyLoading?: boolean;
|
|
11
|
+
onCountdownFinish?: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IRenderer {
|
|
15
|
+
minutes: number;
|
|
16
|
+
seconds: number;
|
|
17
|
+
completed: number;
|
|
18
|
+
handleCountdownFinish: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const TimerWidget = ({
|
|
22
|
+
expires_at,
|
|
23
|
+
buyLoading,
|
|
24
|
+
onCountdownFinish = () => {},
|
|
25
|
+
}: ITimerWidgetPage) => {
|
|
26
|
+
const [showTimer, setShowTimer] = useState(true)
|
|
27
|
+
|
|
28
|
+
const handleCountdownFinish = () => {
|
|
29
|
+
setShowTimer(false)
|
|
30
|
+
if (!buyLoading) {
|
|
31
|
+
onCountdownFinish()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const renderer = ({
|
|
36
|
+
minutes,
|
|
37
|
+
seconds,
|
|
38
|
+
completed,
|
|
39
|
+
handleCountdownFinish,
|
|
40
|
+
}: IRenderer) => {
|
|
41
|
+
if (completed) {
|
|
42
|
+
handleCountdownFinish()
|
|
43
|
+
return null
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
<span>
|
|
47
|
+
{showZero(minutes)}:{showZero(seconds)}
|
|
48
|
+
</span>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const hideTimer = () => {
|
|
53
|
+
const timerRl: HTMLElement | null = document.querySelector('.timer')
|
|
54
|
+
if(timerRl) {
|
|
55
|
+
timerRl.style.visibility = "hidden";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return showTimer && !!expires_at ? (
|
|
60
|
+
<div className="timer">
|
|
61
|
+
<div className='close-icon' onClick={hideTimer}>
|
|
62
|
+
<SVG
|
|
63
|
+
src={getImage('cross.svg')}
|
|
64
|
+
width='10'
|
|
65
|
+
height='10'
|
|
66
|
+
fill='#fff'
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
<div className="toast-message">
|
|
70
|
+
<p>Please complete your purchase before the timer reaches zero.</p>
|
|
71
|
+
<p className="countdown">
|
|
72
|
+
<Countdown
|
|
73
|
+
date={Date.now() + expires_at * 1000}
|
|
74
|
+
renderer={(props: any) =>
|
|
75
|
+
renderer({
|
|
76
|
+
...props,
|
|
77
|
+
handleCountdownFinish,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
/>
|
|
81
|
+
</p>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
) : null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default memo(TimerWidget)
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
.timer {
|
|
2
|
-
position: absolute;
|
|
3
|
-
pointer-events: auto;
|
|
4
|
-
background-color: #000000;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
margin: 0 0 6px;
|
|
7
|
-
padding: 15px 15px 15px 50px;
|
|
8
|
-
width: 300px;
|
|
9
|
-
-moz-border-radius: 3px;
|
|
10
|
-
-webkit-border-radius: 3px;
|
|
11
|
-
border-radius: 3px;
|
|
12
|
-
background-position: 15px center;
|
|
13
|
-
background-repeat: no-repeat;
|
|
14
|
-
-moz-box-shadow: 0 0 12px #999;
|
|
15
|
-
-webkit-box-shadow: 0 0 12px #999;
|
|
16
|
-
box-shadow: 0 0 12px #999;
|
|
17
|
-
max-width: 300px;
|
|
18
|
-
color: #fff;
|
|
19
|
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=);
|
|
20
|
-
right: 15px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.timer .
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
.timer {
|
|
2
|
+
position: absolute;
|
|
3
|
+
pointer-events: auto;
|
|
4
|
+
background-color: #000000;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
margin: 0 0 6px;
|
|
7
|
+
padding: 15px 15px 15px 50px;
|
|
8
|
+
width: 300px;
|
|
9
|
+
-moz-border-radius: 3px;
|
|
10
|
+
-webkit-border-radius: 3px;
|
|
11
|
+
border-radius: 3px;
|
|
12
|
+
background-position: 15px center;
|
|
13
|
+
background-repeat: no-repeat;
|
|
14
|
+
-moz-box-shadow: 0 0 12px #999;
|
|
15
|
+
-webkit-box-shadow: 0 0 12px #999;
|
|
16
|
+
box-shadow: 0 0 12px #999;
|
|
17
|
+
max-width: 300px;
|
|
18
|
+
color: #fff;
|
|
19
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=);
|
|
20
|
+
right: 15px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.timer .close-icon {
|
|
24
|
+
position: absolute;
|
|
25
|
+
right: 10px;
|
|
26
|
+
top: 10px;
|
|
27
|
+
display: flex;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.timer .countdown {
|
|
32
|
+
font-weight: bold;
|
|
33
|
+
margin-top: 10px;
|
|
34
|
+
}
|