@tonder.io/ionic-full-sdk 0.0.8 → 0.0.10-beta

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.
@@ -1,296 +1,296 @@
1
- import { getCardType } from './utils';
2
-
3
- export type CollectorIds = {
4
- holderName: string,
5
- cardNumber: string,
6
- expirationMonth: string,
7
- expirationYear: string,
8
- cvv: string,
9
- tonderPayButton: string,
10
- msgError: string,
11
- msgNotification: string,
12
- cardsListContainer: string
13
- }
14
-
15
- export type Card = {
16
- card_scheme: string,
17
- cardholder_name: string,
18
- card_number: string,
19
- expiration_month: string,
20
- expiration_year: string,
21
- skyflow_id: string
22
- }
23
-
24
- export const cardTemplate = (external: boolean, collectorIds: CollectorIds) => `
25
- <div class="container-tonder">
26
- <div id="${collectorIds.cardsListContainer}" class="cards-list-container"></div>
27
- <div class="pay-new-card">
28
- <input checked id="new" name="card_selected" type="radio"/>
29
- <label class="card-item-label-new" for="new">
30
- <img class="card-image" src="${getCardType("XXXX")}" />
31
- <div class="card-number">Pagar con tarjeta</div>
32
- </label>
33
- </div>
34
- <div class="container-form">
35
- <div id="${collectorIds.holderName}" class="empty-div"></div>
36
- <div id="${collectorIds.cardNumber}" class="empty-div"></div>
37
- <div class="collect-row">
38
- <div id="${collectorIds.expirationMonth}" class="empty-div"></div>
39
- <div id="${collectorIds.expirationYear}" class="expiration-year"></div>
40
- <div id="${collectorIds.cvv}" class="empty-div"></div>
41
- </div>
42
- <div class="checkbox">
43
- <input id="save-checkout-card" type="checkbox">
44
- <label for="save-checkout-card">
45
- Guardar tarjeta para futuros pagos
46
- </label>
47
- </div>
48
- <div id="${collectorIds.msgError}"></div>
49
- <div id="${collectorIds.msgNotification}"></div>
50
- </div>
51
- <button id="${collectorIds.tonderPayButton}" class="pay-button">Pagar</button>
52
- </div>
53
-
54
- ${external ? `` : `<style>
55
-
56
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
57
-
58
- .container-tonder {
59
- background-color: #F9F9F9;
60
- margin: 0 auto !important;
61
- padding: 30px 10px 30px 10px;
62
- overflow: hidden;
63
- transition: max-height 0.5s ease-out;
64
- max-width: 600px;
65
- border: solid 1px #e3e3e3;
66
- }
67
-
68
- .collect-row {
69
- display: flex !important;
70
- justify-content: space-between !important;
71
- width: 100% !important;
72
- }
73
-
74
- .collect-row > :first-child {
75
- min-width: 120px; !important
76
- }
77
-
78
- .expiration-year {
79
- padding-top: 25px !important;
80
- }
81
-
82
- .empty-div {
83
- height: 80px !important;
84
- margin-top: 2px;
85
- margin-bottom: 4px;
86
- margin-left: 10px !important;
87
- margin-right: 10px !important;
88
- }
89
-
90
- .error-container{
91
- color: red !important;
92
- background-color: #FFDBDB !important;
93
- margin-bottom: 13px !important;
94
- font-size: 80% !important;
95
- padding: 8px 10px !important;
96
- border-radius: 10px !important;
97
- text-align: left !important;
98
- }
99
-
100
- .message-container{
101
- color: green !important;
102
- background-color: #DAFCE4 !important;
103
- margin-bottom: 13px !important;
104
- font-size: 80% !important;
105
- padding: 8px 10px !important;
106
- border-radius: 10px !important;
107
- text-align: left !important;
108
- }
109
-
110
- .pay-button {
111
- font-size: 16px;
112
- font-weight: bold;
113
- min-height: 2.3rem;
114
- border-radius: 0.5rem;
115
- cursor: pointer;
116
- width: 100%;
117
- padding: 1rem;
118
- text-align: center;
119
- border: none;
120
- background-color: #000;
121
- color: #fff;
122
- margin-bottom: 10px;
123
- display: none;
124
- font-family: "Inter", sans-serif !important;
125
- }
126
-
127
- .pay-button:disabled, pay-button[disabled] {
128
- background-color: #B9B9B9;
129
- }
130
-
131
- .lds-dual-ring {
132
- display: inline-block;
133
- width: 14px;
134
- height: 14px;
135
- }
136
-
137
- .lds-dual-ring:after {
138
- content: " ";
139
- display: block;
140
- width: 14px;
141
- height: 14px;
142
- border-radius: 50%;
143
- border: 6px solid #fff;
144
- border-color: #fff transparent #fff transparent;
145
- animation: lds-dual-ring 1.2s linear infinite;
146
- }
147
-
148
- @keyframes lds-dual-ring {
149
- 0% {
150
- transform: rotate(0deg);
151
- }
152
- 100% {
153
- transform: rotate(360deg);
154
- }
155
- }
156
-
157
- @media screen and (max-width: 600px) {
158
- .payment_method_zplit {
159
- font-size: 16px !important;
160
- width: 100% !important;
161
- }
162
-
163
- .payment_method_zplit label img {
164
- display: none !important;
165
- }
166
- }
167
-
168
- .cards-list-container {
169
- display: flex;
170
- flex-direction: column;
171
- padding: 0px 10px 0px 10px;
172
- gap: 33% 20px;
173
- }
174
-
175
- .checkbox label {
176
- margin-left: 10px;
177
- font-size: '12px';
178
- font-weight: '500';
179
- color: #1D1D1D;
180
- font-family: "Inter", sans-serif !important;
181
- }
182
-
183
- .checkbox {
184
- margin-top: 10px;
185
- margin-bottom: 10px;
186
- width: 100%;
187
- text-align: left;
188
- }
189
-
190
- .pay-new-card {
191
- display: flex;
192
- justify-content: start;
193
- align-items: center;
194
- color: #1D1D1D;
195
- gap: 33% 20px;
196
- margin-top: 10px;
197
- margin-bottom: 10px;
198
- padding-left: 10px;
199
- padding-right: 10px;
200
- width: 90%;
201
- }
202
-
203
- .pay-new-card .card-number {
204
- font-size: 16px;
205
- font-family: "Inter", sans-serif !important;
206
- }
207
-
208
- .card-image {
209
- width: 39px;
210
- height: 24px;
211
- text-align: left;
212
- }
213
-
214
- .card-item-label-new {
215
- display: flex;
216
- justify-content: start;
217
- align-items: center;
218
- color: #1D1D1D;
219
- gap: 33% 20px;
220
- margin-top: 10px;
221
- margin-bottom: 10px;
222
- padding-left: 10px;
223
- padding-right: 10px;
224
- width: 90%;
225
- }
226
-
227
- </style>
228
- `}`
229
-
230
- export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
231
-
232
- const cardItemsHTML = cards.reduce((total: string, card: Card) => {
233
- return `${total}
234
- <div class="card-item">
235
- <input id="${card.skyflow_id}" name="card_selected" type="radio"/>
236
- <label class="card-item-label" for="${card.skyflow_id}">
237
- <img class="card-image" src="${getCardType(card.card_scheme)}" />
238
- <div class="card-number">${card.card_number}</div>
239
- <div class="card-expiration">Exp. ${card.expiration_month}/${card.expiration_year}</div>
240
- </label>
241
- </div>`
242
- }, ``);
243
-
244
- const cardItemStyle = external ? '' : `
245
- <style>
246
-
247
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
248
-
249
- .card-item-label {
250
- display: flex;
251
- justify-content: space-between;
252
- align-items: center;
253
- color: #1D1D1D;
254
- gap: 33% 20px;
255
- margin-top: 10px;
256
- margin-bottom: 10px;
257
- padding-left: 10px;
258
- padding-right: 10px;
259
- width: 90%;
260
- }
261
-
262
- .card_selected {
263
- width: 10%;
264
- }
265
-
266
- .card-item {
267
- display: flex;
268
- justify-content: start;
269
- align-items: center;
270
- gap: 33% 20px;
271
- }
272
-
273
- .card-item .card-number {
274
- font-size: 16px;
275
- font-family: "Inter", sans-serif !important;
276
- }
277
-
278
- .card-item .card-expiration {
279
- font-size: 16px;
280
- font-family: "Inter", sans-serif !important;
281
- }
282
-
283
- .card-image {
284
- width: 39px;
285
- height: 24px;
286
- text-align: left;
287
- }
288
-
289
- </style>
290
- `
291
- const cardItem = `
292
- ${cardItemsHTML}
293
- ${cardItemStyle}
294
- `
295
- return cardItem;
1
+ import { getCardType } from './utils';
2
+
3
+ export type CollectorIds = {
4
+ holderName: string,
5
+ cardNumber: string,
6
+ expirationMonth: string,
7
+ expirationYear: string,
8
+ cvv: string,
9
+ tonderPayButton: string,
10
+ msgError: string,
11
+ msgNotification: string,
12
+ cardsListContainer: string
13
+ }
14
+
15
+ export type Card = {
16
+ card_scheme: string,
17
+ cardholder_name: string,
18
+ card_number: string,
19
+ expiration_month: string,
20
+ expiration_year: string,
21
+ skyflow_id: string
22
+ }
23
+
24
+ export const cardTemplate = (external: boolean, collectorIds: CollectorIds) => `
25
+ <div class="container-tonder">
26
+ <div id="${collectorIds.cardsListContainer}" class="cards-list-container"></div>
27
+ <div class="pay-new-card">
28
+ <input checked id="new" name="card_selected" type="radio"/>
29
+ <label class="card-item-label-new" for="new">
30
+ <img class="card-image" src="${getCardType("XXXX")}" />
31
+ <div class="card-number">Pagar con tarjeta</div>
32
+ </label>
33
+ </div>
34
+ <div class="container-form">
35
+ <div id="${collectorIds.holderName}" class="empty-div"></div>
36
+ <div id="${collectorIds.cardNumber}" class="empty-div"></div>
37
+ <div class="collect-row">
38
+ <div id="${collectorIds.expirationMonth}" class="empty-div"></div>
39
+ <div id="${collectorIds.expirationYear}" class="expiration-year"></div>
40
+ <div id="${collectorIds.cvv}" class="empty-div"></div>
41
+ </div>
42
+ <div class="checkbox">
43
+ <input id="save-checkout-card" type="checkbox">
44
+ <label for="save-checkout-card">
45
+ Guardar tarjeta para futuros pagos
46
+ </label>
47
+ </div>
48
+ <div id="${collectorIds.msgError}"></div>
49
+ <div id="${collectorIds.msgNotification}"></div>
50
+ </div>
51
+ <button id="${collectorIds.tonderPayButton}" class="pay-button">Pagar</button>
52
+ </div>
53
+
54
+ ${external ? `` : `<style>
55
+
56
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
57
+
58
+ .container-tonder {
59
+ background-color: #F9F9F9;
60
+ margin: 0 auto !important;
61
+ padding: 30px 10px 30px 10px;
62
+ overflow: hidden;
63
+ transition: max-height 0.5s ease-out;
64
+ max-width: 600px;
65
+ border: solid 1px #e3e3e3;
66
+ }
67
+
68
+ .collect-row {
69
+ display: flex !important;
70
+ justify-content: space-between !important;
71
+ width: 100% !important;
72
+ }
73
+
74
+ .collect-row > :first-child {
75
+ min-width: 120px; !important
76
+ }
77
+
78
+ .expiration-year {
79
+ padding-top: 25px !important;
80
+ }
81
+
82
+ .empty-div {
83
+ height: 80px !important;
84
+ margin-top: 2px;
85
+ margin-bottom: 4px;
86
+ margin-left: 10px !important;
87
+ margin-right: 10px !important;
88
+ }
89
+
90
+ .error-container{
91
+ color: red !important;
92
+ background-color: #FFDBDB !important;
93
+ margin-bottom: 13px !important;
94
+ font-size: 80% !important;
95
+ padding: 8px 10px !important;
96
+ border-radius: 10px !important;
97
+ text-align: left !important;
98
+ }
99
+
100
+ .message-container{
101
+ color: green !important;
102
+ background-color: #DAFCE4 !important;
103
+ margin-bottom: 13px !important;
104
+ font-size: 80% !important;
105
+ padding: 8px 10px !important;
106
+ border-radius: 10px !important;
107
+ text-align: left !important;
108
+ }
109
+
110
+ .pay-button {
111
+ font-size: 16px;
112
+ font-weight: bold;
113
+ min-height: 2.3rem;
114
+ border-radius: 0.5rem;
115
+ cursor: pointer;
116
+ width: 100%;
117
+ padding: 1rem;
118
+ text-align: center;
119
+ border: none;
120
+ background-color: #000;
121
+ color: #fff;
122
+ margin-bottom: 10px;
123
+ display: none;
124
+ font-family: "Inter", sans-serif !important;
125
+ }
126
+
127
+ .pay-button:disabled, pay-button[disabled] {
128
+ background-color: #B9B9B9;
129
+ }
130
+
131
+ .lds-dual-ring {
132
+ display: inline-block;
133
+ width: 14px;
134
+ height: 14px;
135
+ }
136
+
137
+ .lds-dual-ring:after {
138
+ content: " ";
139
+ display: block;
140
+ width: 14px;
141
+ height: 14px;
142
+ border-radius: 50%;
143
+ border: 6px solid #fff;
144
+ border-color: #fff transparent #fff transparent;
145
+ animation: lds-dual-ring 1.2s linear infinite;
146
+ }
147
+
148
+ @keyframes lds-dual-ring {
149
+ 0% {
150
+ transform: rotate(0deg);
151
+ }
152
+ 100% {
153
+ transform: rotate(360deg);
154
+ }
155
+ }
156
+
157
+ @media screen and (max-width: 600px) {
158
+ .payment_method_zplit {
159
+ font-size: 16px !important;
160
+ width: 100% !important;
161
+ }
162
+
163
+ .payment_method_zplit label img {
164
+ display: none !important;
165
+ }
166
+ }
167
+
168
+ .cards-list-container {
169
+ display: flex;
170
+ flex-direction: column;
171
+ padding: 0px 10px 0px 10px;
172
+ gap: 33% 20px;
173
+ }
174
+
175
+ .checkbox label {
176
+ margin-left: 10px;
177
+ font-size: '12px';
178
+ font-weight: '500';
179
+ color: #1D1D1D;
180
+ font-family: "Inter", sans-serif !important;
181
+ }
182
+
183
+ .checkbox {
184
+ margin-top: 10px;
185
+ margin-bottom: 10px;
186
+ width: 100%;
187
+ text-align: left;
188
+ }
189
+
190
+ .pay-new-card {
191
+ display: flex;
192
+ justify-content: start;
193
+ align-items: center;
194
+ color: #1D1D1D;
195
+ gap: 33% 20px;
196
+ margin-top: 10px;
197
+ margin-bottom: 10px;
198
+ padding-left: 10px;
199
+ padding-right: 10px;
200
+ width: 90%;
201
+ }
202
+
203
+ .pay-new-card .card-number {
204
+ font-size: 16px;
205
+ font-family: "Inter", sans-serif !important;
206
+ }
207
+
208
+ .card-image {
209
+ width: 39px;
210
+ height: 24px;
211
+ text-align: left;
212
+ }
213
+
214
+ .card-item-label-new {
215
+ display: flex;
216
+ justify-content: start;
217
+ align-items: center;
218
+ color: #1D1D1D;
219
+ gap: 33% 20px;
220
+ margin-top: 10px;
221
+ margin-bottom: 10px;
222
+ padding-left: 10px;
223
+ padding-right: 10px;
224
+ width: 90%;
225
+ }
226
+
227
+ </style>
228
+ `}`
229
+
230
+ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
231
+
232
+ const cardItemsHTML = cards.reduce((total: string, card: Card) => {
233
+ return `${total}
234
+ <div class="card-item">
235
+ <input id="${card.skyflow_id}" name="card_selected" type="radio"/>
236
+ <label class="card-item-label" for="${card.skyflow_id}">
237
+ <img class="card-image" src="${getCardType(card.card_scheme)}" />
238
+ <div class="card-number">${card.card_number}</div>
239
+ <div class="card-expiration">Exp. ${card.expiration_month}/${card.expiration_year}</div>
240
+ </label>
241
+ </div>`
242
+ }, ``);
243
+
244
+ const cardItemStyle = external ? '' : `
245
+ <style>
246
+
247
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
248
+
249
+ .card-item-label {
250
+ display: flex;
251
+ justify-content: space-between;
252
+ align-items: center;
253
+ color: #1D1D1D;
254
+ gap: 33% 20px;
255
+ margin-top: 10px;
256
+ margin-bottom: 10px;
257
+ padding-left: 10px;
258
+ padding-right: 10px;
259
+ width: 90%;
260
+ }
261
+
262
+ .card_selected {
263
+ width: 10%;
264
+ }
265
+
266
+ .card-item {
267
+ display: flex;
268
+ justify-content: start;
269
+ align-items: center;
270
+ gap: 33% 20px;
271
+ }
272
+
273
+ .card-item .card-number {
274
+ font-size: 16px;
275
+ font-family: "Inter", sans-serif !important;
276
+ }
277
+
278
+ .card-item .card-expiration {
279
+ font-size: 16px;
280
+ font-family: "Inter", sans-serif !important;
281
+ }
282
+
283
+ .card-image {
284
+ width: 39px;
285
+ height: 24px;
286
+ text-align: left;
287
+ }
288
+
289
+ </style>
290
+ `
291
+ const cardItem = `
292
+ ${cardItemsHTML}
293
+ ${cardItemStyle}
294
+ `
295
+ return cardItem;
296
296
  }