@tonder.io/ionic-full-sdk 0.0.24-beta → 0.0.26-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,493 +1,521 @@
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" class="card_selected" 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
- .error-custom-inputs-tonder {
59
- background-color: white;
60
- position: absolute;
61
- left: 0px;
62
- bottom: -1px;
63
- width: 100%;
64
- font-size: 12px;
65
- color: red;
66
- font-family: "Inter", sans-serif !important;
67
- }
68
-
69
- .expiration-year .error-custom-inputs-tonder {
70
- background-color: white;
71
- position: absolute;
72
- left: 0px;
73
- bottom: 3px;
74
- width: 100%;
75
- font-size: 12px;
76
- color: red;
77
- font-family: "Inter", sans-serif !important;
78
- }
79
-
80
- .container-tonder {
81
- background-color: #F9F9F9;
82
- margin: 0 auto !important;
83
- padding: 30px 10px 30px 10px;
84
- overflow: hidden;
85
- transition: max-height 0.5s ease-out;
86
- max-width: 600px;
87
- border: solid 1px #e3e3e3;
88
- }
89
-
90
- .collect-row {
91
- display: flex !important;
92
- justify-content: space-between !important;
93
- width: 100% !important;
94
- }
95
-
96
- .collect-row > :first-child {
97
- min-width: 120px; !important
98
- }
99
-
100
- .expiration-year {
101
- position: relative !important;
102
- padding-top: 24px !important;
103
- }
104
-
105
- .empty-div {
106
- position: relative;
107
- height: 80px !important;
108
- margin-top: 2px;
109
- margin-bottom: 4px;
110
- margin-left: 10px !important;
111
- margin-right: 10px !important;
112
- }
113
-
114
- .error-container{
115
- color: red !important;
116
- background-color: #FFDBDB !important;
117
- margin-bottom: 13px !important;
118
- font-size: 80% !important;
119
- padding: 8px 10px !important;
120
- border-radius: 10px !important;
121
- text-align: left !important;
122
- }
123
-
124
- .message-container{
125
- color: #3bc635 !important;
126
- background-color: #DAFCE4 !important;
127
- margin-bottom: 13px !important;
128
- font-size: 80% !important;
129
- padding: 8px 10px !important;
130
- border-radius: 10px !important;
131
- text-align: left !important;
132
- }
133
-
134
- .pay-button {
135
- font-size: 16px;
136
- font-weight: bold;
137
- min-height: 2.3rem;
138
- border-radius: 0.5rem;
139
- cursor: pointer;
140
- width: 100%;
141
- padding: 1rem;
142
- text-align: center;
143
- border: none;
144
- background-color: #000;
145
- color: #fff;
146
- margin-bottom: 10px;
147
- display: none;
148
- font-family: "Inter", sans-serif !important;
149
- }
150
-
151
- .pay-button:disabled, pay-button[disabled] {
152
- background-color: #B9B9B9;
153
- }
154
-
155
- .lds-dual-ring {
156
- display: inline-block;
157
- width: 14px;
158
- height: 14px;
159
- }
160
-
161
- .lds-dual-ring:after {
162
- content: " ";
163
- display: block;
164
- width: 14px;
165
- height: 14px;
166
- border-radius: 50%;
167
- border: 6px solid #fff;
168
- border-color: #fff transparent #fff transparent;
169
- animation: lds-dual-ring 1.2s linear infinite;
170
- }
171
-
172
- @keyframes lds-dual-ring {
173
- 0% {
174
- transform: rotate(0deg);
175
- }
176
- 100% {
177
- transform: rotate(360deg);
178
- }
179
- }
180
-
181
- @media screen and (max-width: 600px) {
182
- .payment_method_zplit {
183
- font-size: 16px !important;
184
- width: 100% !important;
185
- }
186
-
187
- .payment_method_zplit label img {
188
- display: none !important;
189
- }
190
- }
191
-
192
- .cards-list-container {
193
- display: flex;
194
- flex-direction: column;
195
- padding: 0px 10px 0px 10px;
196
- gap: 33% 20px;
197
- }
198
-
199
- .checkbox label {
200
- margin-left: 10px;
201
- font-size: '12px';
202
- font-weight: '500';
203
- color: #1D1D1D;
204
- font-family: "Inter", sans-serif !important;
205
- }
206
-
207
- .checkbox {
208
- margin-top: 10px;
209
- margin-bottom: 20px;
210
- width: 100%;
211
- text-align: left;
212
- }
213
-
214
- .pay-new-card {
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
- .pay-new-card .card-number {
228
- font-size: 16px;
229
- font-family: "Inter", sans-serif !important;
230
- }
231
-
232
- .card-image {
233
- width: 39px;
234
- height: 24px;
235
- text-align: left;
236
- }
237
-
238
- .card-item-label-new {
239
- display: flex;
240
- justify-content: start;
241
- align-items: center;
242
- color: #1D1D1D;
243
- gap: 33% 20px;
244
- margin-top: 10px;
245
- margin-bottom: 10px;
246
- padding-left: 10px;
247
- padding-right: 10px;
248
- width: 90%;
249
- }
250
-
251
- .card_selected {
252
- position: relative;
253
- width: 16px;
254
- height: 16px;
255
- appearance: none;
256
- cursor: pointer;
257
- border-radius: 100%;
258
- border: 1px #3bc635 solid;
259
- color: #3bc635;
260
- transition-property: all;
261
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
262
- transition-duration: 150ms;
263
- }
264
-
265
- .card_selected:before {
266
- width: 8px;
267
- height: 8px;
268
- content: "";
269
- position: absolute;
270
- top: 50%;
271
- left: 50%;
272
- display: block;
273
- transform: translate(-50%, -50%);
274
- border-radius: 100%;
275
- background-color: #3bc635;
276
- opacity: 0;
277
- transition-property: opacity;
278
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
279
- transition-duration: 150ms;
280
- }
281
-
282
- .card_selected:checked {
283
- border: 1px #3bc635 solid;
284
- position: relative;
285
- width: 16px;
286
- height: 16px;
287
- appearance: none;
288
- cursor: pointer;
289
- border-radius: 100%;
290
- color: #3bc635;
291
- transition-property: all;
292
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
293
- transition-duration: 150ms;
294
- }
295
-
296
- .card_selected:checked:before {
297
- content: "";
298
- border: 1px #3bc635 solid;
299
- width: 8px;
300
- height: 8px;
301
- position: absolute;
302
- top: 50%;
303
- left: 50%;
304
- display: block;
305
- transform: translate(-50%, -50%);
306
- border-radius: 100%;
307
- background-color: #3bc635;
308
- opacity: 50;
309
- transition-property: opacity;
310
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
311
- transition-duration: 150ms;
312
- }
313
-
314
- .card_selected:hover:before {
315
- width: 8px;
316
- height: 8px;
317
- content: "";
318
- position: absolute;
319
- top: 50%;
320
- left: 50%;
321
- display: block;
322
- transform: translate(-50%, -50%);
323
- border-radius: 100%;
324
- background-color: #3bc635;
325
- transition-property: opacity;
326
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
327
- transition-duration: 150ms;
328
- opacity: 10;
329
- }
330
-
331
- </style>
332
- `}`
333
-
334
- export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
335
-
336
- const cardItemsHTML = cards.reduce((total: string, card: Card) => {
337
- return `${total}
338
- <div class="card-item" id="card_container-${card.skyflow_id}">
339
- <input id="${card.skyflow_id}" class="card_selected" name="card_selected" type="radio"/>
340
- <label class="card-item-label" for="${card.skyflow_id}">
341
- <img class="card-image" src="${getCardType(card.card_scheme)}" />
342
- <div class="card-number">${card.card_number}</div>
343
- <div class="card-expiration">Exp. ${card.expiration_month}/${card.expiration_year}</div>
344
- <div class="card-delete-icon">
345
- <button id="delete_button_${card.skyflow_id}" class="card-delete-button">
346
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">
347
- <path fill="currentColor" d="M292.309-140.001q-30.308 0-51.308-21t-21-51.308V-720h-40v-59.999H360v-35.384h240v35.384h179.999V-720h-40v507.691q0 30.308-21 51.308t-51.308 21H292.309ZM376.155-280h59.999v-360h-59.999v360Zm147.691 0h59.999v-360h-59.999v360Z"/>
348
- </svg>
349
- </button>
350
- </div>
351
- </label>
352
- </div>`
353
- }, ``);
354
-
355
- const cardItemStyle = external ? '' : `
356
- <style>
357
-
358
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
359
-
360
- .card-item-label {
361
- display: flex;
362
- justify-content: space-between;
363
- align-items: center;
364
- color: #1D1D1D;
365
- gap: 33% 20px;
366
- margin-top: 10px;
367
- margin-bottom: 10px;
368
- padding-left: 10px;
369
- padding-right: 10px;
370
- width: 90%;
371
- }
372
-
373
- .card-item {
374
- display: flex;
375
- justify-content: start;
376
- align-items: center;
377
- gap: 33% 20px;
378
- }
379
-
380
- .card-item .card-number {
381
- font-size: 16px;
382
- font-family: "Inter", sans-serif !important;
383
- }
384
-
385
- .card-item .card-expiration {
386
- font-size: 16px;
387
- font-family: "Inter", sans-serif !important;
388
- }
389
-
390
- .card-image {
391
- width: 39px;
392
- height: 24px;
393
- text-align: left;
394
- }
395
-
396
- .card-delete-button {
397
- background-color: transparent !important;
398
- color: #000000 !important;
399
- }
400
-
401
- .card-delete-button:hover {
402
- background-color: transparent !important;
403
- color: #D91C1C !important;
404
- }
405
-
406
- .card_selected {
407
- position: relative;
408
- width: 16px;
409
- height: 16px;
410
- appearance: none;
411
- cursor: pointer;
412
- border-radius: 100%;
413
- border: 1px #3bc635 solid;
414
- color: #3bc635;
415
- transition-property: all;
416
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
417
- transition-duration: 150ms;
418
- }
419
-
420
- .card_selected:before {
421
- width: 8px;
422
- height: 8px;
423
- content: "";
424
- position: absolute;
425
- top: 50%;
426
- left: 50%;
427
- display: block;
428
- transform: translate(-50%, -50%);
429
- border-radius: 100%;
430
- background-color: #3bc635;
431
- opacity: 0;
432
- transition-property: opacity;
433
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
434
- transition-duration: 150ms;
435
- }
436
-
437
- .card_selected:checked {
438
- border: 1px #3bc635 solid;
439
- position: relative;
440
- width: 16px;
441
- height: 16px;
442
- appearance: none;
443
- cursor: pointer;
444
- border-radius: 100%;
445
- color: #3bc635;
446
- transition-property: all;
447
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
448
- transition-duration: 150ms;
449
- }
450
-
451
- .card_selected:checked:before {
452
- content: "";
453
- border: 1px #3bc635 solid;
454
- width: 8px;
455
- height: 8px;
456
- position: absolute;
457
- top: 50%;
458
- left: 50%;
459
- display: block;
460
- transform: translate(-50%, -50%);
461
- border-radius: 100%;
462
- background-color: #3bc635;
463
- opacity: 50;
464
- transition-property: opacity;
465
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
466
- transition-duration: 150ms;
467
- }
468
-
469
- .card_selected:hover:before {
470
- width: 8px;
471
- height: 8px;
472
- content: "";
473
- position: absolute;
474
- top: 50%;
475
- left: 50%;
476
- display: block;
477
- transform: translate(-50%, -50%);
478
- border-radius: 100%;
479
- background-color: #3bc635;
480
- transition-property: opacity;
481
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
482
- transition-duration: 150ms;
483
- opacity: 10;
484
- }
485
-
486
- </style>
487
- `
488
- const cardItem = `
489
- ${cardItemsHTML}
490
- ${cardItemStyle}
491
- `
492
- 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
+ tonderSaveCardButton: string,
11
+ msgError: string,
12
+ msgNotification: string,
13
+ cardsListContainer: string
14
+ }
15
+
16
+ export type Card = {
17
+ card_scheme: string,
18
+ cardholder_name: string,
19
+ card_number: string,
20
+ expiration_month: string,
21
+ expiration_year: string,
22
+ skyflow_id: string
23
+ }
24
+
25
+ export const cardTemplate = (external: boolean, collectorIds: CollectorIds, isEnrollmentCard: boolean = false) => `
26
+ <div class="container-tonder">
27
+ <div id="${collectorIds.cardsListContainer}" class="cards-list-container"></div>
28
+ ${!isEnrollmentCard ? `
29
+ <div class="pay-new-card">
30
+ <input checked id="new" class="card_selected" name="card_selected" type="radio"/>
31
+ <label class="card-item-label-new" for="new">
32
+ <img class="card-image" src="${getCardType("XXXX")}" />
33
+ <div class="card-number">Pagar con tarjeta</div>
34
+ </label>
35
+ </div>
36
+ `:``}
37
+ <div class="container-form">
38
+ <div id="${collectorIds.holderName}" class="empty-div"></div>
39
+ <div id="${collectorIds.cardNumber}" class="empty-div"></div>
40
+ <div class="collect-row">
41
+ <div id="${collectorIds.expirationMonth}" class="empty-div"></div>
42
+ <div id="${collectorIds.expirationYear}" class="expiration-year"></div>
43
+ <div id="${collectorIds.cvv}" class="empty-div"></div>
44
+ </div>
45
+ ${!isEnrollmentCard ? `
46
+ <div class="checkbox">
47
+ <input id="save-checkout-card" type="checkbox">
48
+ <label for="save-checkout-card">
49
+ Guardar tarjeta para futuros pagos
50
+ </label>
51
+ </div>
52
+ `:``}
53
+ <div id="${collectorIds.msgError}"></div>
54
+ <div id="${collectorIds.msgNotification}"></div>
55
+ </div>
56
+ <button id="${collectorIds.tonderPayButton}" class="pay-button">Pagar</button>
57
+ <button id="${collectorIds.tonderSaveCardButton}" class="save-card-button">Guardar</button>
58
+ </div>
59
+
60
+ ${external ? `` : `<style>
61
+
62
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
63
+
64
+ .error-custom-inputs-tonder {
65
+ background-color: white;
66
+ position: absolute;
67
+ left: 0px;
68
+ bottom: -1px;
69
+ width: 100%;
70
+ font-size: 12px;
71
+ color: red;
72
+ font-family: "Inter", sans-serif !important;
73
+ }
74
+
75
+ .expiration-year .error-custom-inputs-tonder {
76
+ background-color: white;
77
+ position: absolute;
78
+ left: 0px;
79
+ bottom: 3px;
80
+ width: 100%;
81
+ font-size: 12px;
82
+ color: red;
83
+ font-family: "Inter", sans-serif !important;
84
+ }
85
+
86
+ .container-tonder {
87
+ background-color: #F9F9F9;
88
+ margin: 0 auto !important;
89
+ padding: 30px 10px 30px 10px;
90
+ overflow: hidden;
91
+ transition: max-height 0.5s ease-out;
92
+ max-width: 600px;
93
+ border: solid 1px #e3e3e3;
94
+ }
95
+
96
+ .collect-row {
97
+ display: flex !important;
98
+ justify-content: space-between !important;
99
+ width: 100% !important;
100
+ }
101
+
102
+ .collect-row > :first-child {
103
+ min-width: 120px; !important
104
+ }
105
+
106
+ .expiration-year {
107
+ position: relative !important;
108
+ padding-top: 24px !important;
109
+ }
110
+
111
+ .empty-div {
112
+ position: relative;
113
+ height: 80px !important;
114
+ margin-top: 2px;
115
+ margin-bottom: 4px;
116
+ margin-left: 10px !important;
117
+ margin-right: 10px !important;
118
+ }
119
+
120
+ .error-container{
121
+ color: red !important;
122
+ background-color: #FFDBDB !important;
123
+ margin-bottom: 13px !important;
124
+ font-size: 80% !important;
125
+ padding: 8px 10px !important;
126
+ border-radius: 10px !important;
127
+ text-align: left !important;
128
+ }
129
+
130
+ .message-container{
131
+ color: #3bc635 !important;
132
+ background-color: #DAFCE4 !important;
133
+ margin-bottom: 13px !important;
134
+ font-size: 80% !important;
135
+ padding: 8px 10px !important;
136
+ border-radius: 10px !important;
137
+ text-align: left !important;
138
+ }
139
+
140
+ .pay-button {
141
+ font-size: 16px;
142
+ font-weight: bold;
143
+ min-height: 2.3rem;
144
+ border-radius: 0.5rem;
145
+ cursor: pointer;
146
+ width: 100%;
147
+ padding: 1rem;
148
+ text-align: center;
149
+ border: none;
150
+ background-color: #000;
151
+ color: #fff;
152
+ margin-bottom: 10px;
153
+ display: none;
154
+ font-family: "Inter", sans-serif !important;
155
+ }
156
+
157
+ .pay-button:disabled, pay-button[disabled] {
158
+ background-color: #B9B9B9;
159
+ }
160
+
161
+ .save-card-button {
162
+ font-size: 16px;
163
+ font-weight: bold;
164
+ min-height: 2.3rem;
165
+ border-radius: 0.5rem;
166
+ cursor: pointer;
167
+ width: 100%;
168
+ padding: 1rem;
169
+ text-align: center;
170
+ border: none;
171
+ background-color: #000;
172
+ color: #fff;
173
+ margin-bottom: 10px;
174
+ margin-top: 25px;
175
+ display: none;
176
+ font-family: "Inter", sans-serif !important;
177
+ }
178
+
179
+ .save-card-button:disabled, save-card-button[disabled] {
180
+ background-color: #B9B9B9;
181
+ }
182
+
183
+ .lds-dual-ring {
184
+ display: inline-block;
185
+ width: 14px;
186
+ height: 14px;
187
+ }
188
+
189
+ .lds-dual-ring:after {
190
+ content: " ";
191
+ display: block;
192
+ width: 14px;
193
+ height: 14px;
194
+ border-radius: 50%;
195
+ border: 6px solid #fff;
196
+ border-color: #fff transparent #fff transparent;
197
+ animation: lds-dual-ring 1.2s linear infinite;
198
+ }
199
+
200
+ @keyframes lds-dual-ring {
201
+ 0% {
202
+ transform: rotate(0deg);
203
+ }
204
+ 100% {
205
+ transform: rotate(360deg);
206
+ }
207
+ }
208
+
209
+ @media screen and (max-width: 600px) {
210
+ .payment_method_zplit {
211
+ font-size: 16px !important;
212
+ width: 100% !important;
213
+ }
214
+
215
+ .payment_method_zplit label img {
216
+ display: none !important;
217
+ }
218
+ }
219
+
220
+ .cards-list-container {
221
+ display: flex;
222
+ flex-direction: column;
223
+ padding: 0px 10px 0px 10px;
224
+ gap: 33% 20px;
225
+ }
226
+
227
+ .checkbox label {
228
+ margin-left: 10px;
229
+ font-size: '12px';
230
+ font-weight: '500';
231
+ color: #1D1D1D;
232
+ font-family: "Inter", sans-serif !important;
233
+ }
234
+
235
+ .checkbox {
236
+ margin-top: 10px;
237
+ margin-bottom: 20px;
238
+ width: 100%;
239
+ text-align: left;
240
+ }
241
+
242
+ .pay-new-card {
243
+ display: flex;
244
+ justify-content: start;
245
+ align-items: center;
246
+ color: #1D1D1D;
247
+ gap: 33% 20px;
248
+ margin-top: 10px;
249
+ margin-bottom: 10px;
250
+ padding-left: 10px;
251
+ padding-right: 10px;
252
+ width: 90%;
253
+ }
254
+
255
+ .pay-new-card .card-number {
256
+ font-size: 16px;
257
+ font-family: "Inter", sans-serif !important;
258
+ }
259
+
260
+ .card-image {
261
+ width: 39px;
262
+ height: 24px;
263
+ text-align: left;
264
+ }
265
+
266
+ .card-item-label-new {
267
+ display: flex;
268
+ justify-content: start;
269
+ align-items: center;
270
+ color: #1D1D1D;
271
+ gap: 33% 20px;
272
+ margin-top: 10px;
273
+ margin-bottom: 10px;
274
+ padding-left: 10px;
275
+ padding-right: 10px;
276
+ width: 90%;
277
+ }
278
+
279
+ .card_selected {
280
+ position: relative;
281
+ width: 16px;
282
+ height: 16px;
283
+ appearance: none;
284
+ cursor: pointer;
285
+ border-radius: 100%;
286
+ border: 1px #3bc635 solid;
287
+ color: #3bc635;
288
+ transition-property: all;
289
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
290
+ transition-duration: 150ms;
291
+ }
292
+
293
+ .card_selected:before {
294
+ width: 8px;
295
+ height: 8px;
296
+ content: "";
297
+ position: absolute;
298
+ top: 50%;
299
+ left: 50%;
300
+ display: block;
301
+ transform: translate(-50%, -50%);
302
+ border-radius: 100%;
303
+ background-color: #3bc635;
304
+ opacity: 0;
305
+ transition-property: opacity;
306
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
307
+ transition-duration: 150ms;
308
+ }
309
+
310
+ .card_selected:checked {
311
+ border: 1px #3bc635 solid;
312
+ position: relative;
313
+ width: 16px;
314
+ height: 16px;
315
+ appearance: none;
316
+ cursor: pointer;
317
+ border-radius: 100%;
318
+ color: #3bc635;
319
+ transition-property: all;
320
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
321
+ transition-duration: 150ms;
322
+ }
323
+
324
+ .card_selected:checked:before {
325
+ content: "";
326
+ border: 1px #3bc635 solid;
327
+ width: 8px;
328
+ height: 8px;
329
+ position: absolute;
330
+ top: 50%;
331
+ left: 50%;
332
+ display: block;
333
+ transform: translate(-50%, -50%);
334
+ border-radius: 100%;
335
+ background-color: #3bc635;
336
+ opacity: 50;
337
+ transition-property: opacity;
338
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
339
+ transition-duration: 150ms;
340
+ }
341
+
342
+ .card_selected:hover:before {
343
+ width: 8px;
344
+ height: 8px;
345
+ content: "";
346
+ position: absolute;
347
+ top: 50%;
348
+ left: 50%;
349
+ display: block;
350
+ transform: translate(-50%, -50%);
351
+ border-radius: 100%;
352
+ background-color: #3bc635;
353
+ transition-property: opacity;
354
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
355
+ transition-duration: 150ms;
356
+ opacity: 10;
357
+ }
358
+
359
+ </style>
360
+ `}`
361
+
362
+ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
363
+
364
+ const cardItemsHTML = cards.reduce((total: string, card: Card) => {
365
+ return `${total}
366
+ <div class="card-item" id="card_container-${card.skyflow_id}">
367
+ <input id="${card.skyflow_id}" class="card_selected" name="card_selected" type="radio"/>
368
+ <label class="card-item-label" for="${card.skyflow_id}">
369
+ <img class="card-image" src="${getCardType(card.card_scheme)}" />
370
+ <div class="card-number">${card.card_number}</div>
371
+ <div class="card-expiration">Exp. ${card.expiration_month}/${card.expiration_year}</div>
372
+ <div class="card-delete-icon">
373
+ <button id="delete_button_${card.skyflow_id}" class="card-delete-button">
374
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">
375
+ <path fill="currentColor" d="M292.309-140.001q-30.308 0-51.308-21t-21-51.308V-720h-40v-59.999H360v-35.384h240v35.384h179.999V-720h-40v507.691q0 30.308-21 51.308t-51.308 21H292.309ZM376.155-280h59.999v-360h-59.999v360Zm147.691 0h59.999v-360h-59.999v360Z"/>
376
+ </svg>
377
+ </button>
378
+ </div>
379
+ </label>
380
+ </div>`
381
+ }, ``);
382
+
383
+ const cardItemStyle = external ? '' : `
384
+ <style>
385
+
386
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
387
+
388
+ .card-item-label {
389
+ display: flex;
390
+ justify-content: space-between;
391
+ align-items: center;
392
+ color: #1D1D1D;
393
+ gap: 33% 20px;
394
+ margin-top: 10px;
395
+ margin-bottom: 10px;
396
+ padding-left: 10px;
397
+ padding-right: 10px;
398
+ width: 90%;
399
+ }
400
+
401
+ .card-item {
402
+ display: flex;
403
+ justify-content: start;
404
+ align-items: center;
405
+ gap: 33% 20px;
406
+ }
407
+
408
+ .card-item .card-number {
409
+ font-size: 16px;
410
+ font-family: "Inter", sans-serif !important;
411
+ }
412
+
413
+ .card-item .card-expiration {
414
+ font-size: 16px;
415
+ font-family: "Inter", sans-serif !important;
416
+ }
417
+
418
+ .card-image {
419
+ width: 39px;
420
+ height: 24px;
421
+ text-align: left;
422
+ }
423
+
424
+ .card-delete-button {
425
+ background-color: transparent !important;
426
+ color: #000000 !important;
427
+ }
428
+
429
+ .card-delete-button:hover {
430
+ background-color: transparent !important;
431
+ color: #D91C1C !important;
432
+ }
433
+
434
+ .card_selected {
435
+ position: relative;
436
+ width: 16px;
437
+ height: 16px;
438
+ appearance: none;
439
+ cursor: pointer;
440
+ border-radius: 100%;
441
+ border: 1px #3bc635 solid;
442
+ color: #3bc635;
443
+ transition-property: all;
444
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
445
+ transition-duration: 150ms;
446
+ }
447
+
448
+ .card_selected:before {
449
+ width: 8px;
450
+ height: 8px;
451
+ content: "";
452
+ position: absolute;
453
+ top: 50%;
454
+ left: 50%;
455
+ display: block;
456
+ transform: translate(-50%, -50%);
457
+ border-radius: 100%;
458
+ background-color: #3bc635;
459
+ opacity: 0;
460
+ transition-property: opacity;
461
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
462
+ transition-duration: 150ms;
463
+ }
464
+
465
+ .card_selected:checked {
466
+ border: 1px #3bc635 solid;
467
+ position: relative;
468
+ width: 16px;
469
+ height: 16px;
470
+ appearance: none;
471
+ cursor: pointer;
472
+ border-radius: 100%;
473
+ color: #3bc635;
474
+ transition-property: all;
475
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
476
+ transition-duration: 150ms;
477
+ }
478
+
479
+ .card_selected:checked:before {
480
+ content: "";
481
+ border: 1px #3bc635 solid;
482
+ width: 8px;
483
+ height: 8px;
484
+ position: absolute;
485
+ top: 50%;
486
+ left: 50%;
487
+ display: block;
488
+ transform: translate(-50%, -50%);
489
+ border-radius: 100%;
490
+ background-color: #3bc635;
491
+ opacity: 50;
492
+ transition-property: opacity;
493
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
494
+ transition-duration: 150ms;
495
+ }
496
+
497
+ .card_selected:hover:before {
498
+ width: 8px;
499
+ height: 8px;
500
+ content: "";
501
+ position: absolute;
502
+ top: 50%;
503
+ left: 50%;
504
+ display: block;
505
+ transform: translate(-50%, -50%);
506
+ border-radius: 100%;
507
+ background-color: #3bc635;
508
+ transition-property: opacity;
509
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
510
+ transition-duration: 150ms;
511
+ opacity: 10;
512
+ }
513
+
514
+ </style>
515
+ `
516
+ const cardItem = `
517
+ ${cardItemsHTML}
518
+ ${cardItemStyle}
519
+ `
520
+ return cardItem;
493
521
  }