@tonder.io/ionic-full-sdk 0.0.46-beta.9 → 0.0.47-beta.DEV1406.3a5debd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/classes/inlineCheckout.d.ts +5 -0
- package/dist/helpers/skyflow.d.ts +9 -0
- package/dist/helpers/template.d.ts +11 -2
- package/dist/helpers/utils.d.ts +16 -0
- package/dist/index.js +1 -1
- package/dist/types/inlineCheckout.d.ts +2 -0
- package/package.json +6 -2
- package/rollup.config.js +6 -1
- package/src/classes/inlineCheckout.ts +148 -52
- package/src/helpers/skyflow.ts +312 -190
- package/src/helpers/styles.ts +9 -8
- package/src/helpers/template.ts +278 -52
- package/src/helpers/utils.ts +57 -2
- package/src/types/inlineCheckout.ts +2 -0
package/src/helpers/template.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { getCardType, getPaymentMethodDetails
|
|
1
|
+
import {getCardFormLabels, getCardType, getPaymentMethodDetails} from './utils';
|
|
2
2
|
import {ITonderPaymentMethod} from "@tonder.io/ionic-lite-sdk/dist/types/paymentMethod";
|
|
3
3
|
import {CustomizationOptions} from "@tonder.io/ionic-lite-sdk/dist/types/commons";
|
|
4
|
+
import {defaultStyles} from "./styles";
|
|
4
5
|
|
|
5
6
|
export type CollectorIds = {
|
|
6
7
|
holderName: string,
|
|
@@ -26,13 +27,20 @@ export type Card = {
|
|
|
26
27
|
skyflow_id: string
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export const cardTemplate = (
|
|
30
|
+
export const cardTemplate = (data: {
|
|
31
|
+
renderPaymentButton?: boolean;
|
|
32
|
+
customization?: CustomizationOptions;
|
|
33
|
+
collectorIds: CollectorIds;
|
|
34
|
+
isEnrollmentCard?: boolean;
|
|
35
|
+
customStyles?: any;
|
|
36
|
+
} = {isEnrollmentCard: false, collectorIds: {} as CollectorIds}) => {
|
|
37
|
+
return `
|
|
30
38
|
<div class="container-tonder">
|
|
31
|
-
${ data.customization?.saveCards?.showSaved ?
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
${ data.customization?.saveCards?.showSaved ?
|
|
40
|
+
`<div id="${data.collectorIds!.cardsListContainer}" class="cards-list-container"></div>`
|
|
41
|
+
:``
|
|
34
42
|
}
|
|
35
|
-
${!isEnrollmentCard ? `
|
|
43
|
+
${!data.isEnrollmentCard ? `
|
|
36
44
|
<div class="pay-new-card">
|
|
37
45
|
<input checked id="new" class="card_selected" name="card_selected" type="radio"/>
|
|
38
46
|
<label class="card-item-label-new" for="new">
|
|
@@ -42,14 +50,14 @@ export const cardTemplate = (external: boolean, collectorIds: CollectorIds, isEn
|
|
|
42
50
|
</div>
|
|
43
51
|
`:``}
|
|
44
52
|
<div class="container-form">
|
|
45
|
-
<div id="${collectorIds.holderName}" class="empty-div"></div>
|
|
46
|
-
<div id="${collectorIds.cardNumber}" class="empty-div"></div>
|
|
53
|
+
<div id="${data.collectorIds.holderName}" class="empty-div empty-div-card"></div>
|
|
54
|
+
<div id="${data.collectorIds.cardNumber}" class="empty-div empty-div-card"></div>
|
|
47
55
|
<div class="collect-row">
|
|
48
|
-
<div id="${collectorIds.expirationMonth}" class="empty-div"></div>
|
|
49
|
-
<div id="${collectorIds.expirationYear}" class="expiration-year"></div>
|
|
50
|
-
<div id="${collectorIds.cvv}" class="empty-div"></div>
|
|
56
|
+
<div id="${data.collectorIds.expirationMonth}" class="empty-div empty-div-card"></div>
|
|
57
|
+
<div id="${data.collectorIds.expirationYear}" class="expiration-year"></div>
|
|
58
|
+
<div id="${data.collectorIds.cvv}" class="empty-div empty-div-card"></div>
|
|
51
59
|
</div>
|
|
52
|
-
${!isEnrollmentCard && !!data.customization?.saveCards?.showSaveCardOption ? `
|
|
60
|
+
${!data.isEnrollmentCard && !!data.customization?.saveCards?.showSaveCardOption ? `
|
|
53
61
|
<div class="checkbox">
|
|
54
62
|
<input id="save-checkout-card" type="checkbox">
|
|
55
63
|
<label for="save-checkout-card">
|
|
@@ -57,21 +65,21 @@ export const cardTemplate = (external: boolean, collectorIds: CollectorIds, isEn
|
|
|
57
65
|
</label>
|
|
58
66
|
</div>
|
|
59
67
|
`:``}
|
|
60
|
-
<div id="${collectorIds.msgError}"></div>
|
|
61
|
-
<div id="${collectorIds.msgNotification}"></div>
|
|
68
|
+
<div id="${data.collectorIds.msgError}"></div>
|
|
69
|
+
<div id="${data.collectorIds.msgNotification}"></div>
|
|
62
70
|
</div>
|
|
63
|
-
${!isEnrollmentCard ? `
|
|
71
|
+
${!data.isEnrollmentCard ? `
|
|
64
72
|
<div id="apmsListContainer" class="apms-list-container"></div>
|
|
65
73
|
`:``}
|
|
66
74
|
<div class="container-pay-button">
|
|
67
|
-
<button id="${collectorIds.tonderPayButton}" class="pay-button">Pagar</button>
|
|
68
|
-
${isEnrollmentCard ? `
|
|
69
|
-
<button id="${collectorIds.tonderSaveCardButton ? collectorIds.tonderSaveCardButton:''}" class="save-card-button">Guardar</button>
|
|
75
|
+
<button id="${data.collectorIds.tonderPayButton}" class="pay-button hidden">Pagar</button>
|
|
76
|
+
${data.isEnrollmentCard ? `
|
|
77
|
+
<button id="${data.collectorIds.tonderSaveCardButton ? data.collectorIds.tonderSaveCardButton:''}" class="save-card-button">Guardar</button>
|
|
70
78
|
`:``} </div>
|
|
71
|
-
<iframe class="tds-iframe" allowtransparency="true" id="${collectorIds.tdsIframe}"></iframe>
|
|
79
|
+
<iframe class="tds-iframe" allowtransparency="true" id="${data.collectorIds.tdsIframe}"></iframe>
|
|
72
80
|
</div>
|
|
73
81
|
|
|
74
|
-
|
|
82
|
+
<style>
|
|
75
83
|
|
|
76
84
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
|
|
77
85
|
|
|
@@ -95,10 +103,10 @@ ${external ? `` : `<style>
|
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
.container-form {
|
|
98
|
-
padding: 25px
|
|
106
|
+
padding: 25px 30px 0px 30px;
|
|
99
107
|
}
|
|
100
108
|
|
|
101
|
-
#${collectorIds.tdsIframe} {
|
|
109
|
+
#${data.collectorIds.tdsIframe} {
|
|
102
110
|
display: none;
|
|
103
111
|
position: fixed;
|
|
104
112
|
width: 100vw;
|
|
@@ -135,6 +143,7 @@ ${external ? `` : `<style>
|
|
|
135
143
|
display: flex !important;
|
|
136
144
|
justify-content: space-between !important;
|
|
137
145
|
width: 100% !important;
|
|
146
|
+
gap: 16px;
|
|
138
147
|
}
|
|
139
148
|
|
|
140
149
|
.collect-row > :first-child {
|
|
@@ -148,13 +157,12 @@ ${external ? `` : `<style>
|
|
|
148
157
|
|
|
149
158
|
.empty-div {
|
|
150
159
|
position: relative;
|
|
151
|
-
height: 80px !important;
|
|
152
160
|
margin-top: 2px;
|
|
153
161
|
margin-bottom: 4px;
|
|
154
|
-
margin-left: 10px !important;
|
|
155
|
-
margin-right: 10px !important;
|
|
156
162
|
}
|
|
157
|
-
|
|
163
|
+
.empty-div-card {
|
|
164
|
+
height: 80px !important;
|
|
165
|
+
}
|
|
158
166
|
.error-container{
|
|
159
167
|
color: red !important;
|
|
160
168
|
background-color: #FFDBDB !important;
|
|
@@ -188,10 +196,11 @@ ${external ? `` : `<style>
|
|
|
188
196
|
background-color: #000;
|
|
189
197
|
color: #fff;
|
|
190
198
|
margin-bottom: 10px;
|
|
191
|
-
display: none;
|
|
192
199
|
font-family: "Inter", sans-serif !important;
|
|
193
200
|
}
|
|
194
|
-
|
|
201
|
+
.hidden{
|
|
202
|
+
display: none;
|
|
203
|
+
}
|
|
195
204
|
.pay-button:disabled, pay-button[disabled] {
|
|
196
205
|
background-color: #B9B9B9;
|
|
197
206
|
}
|
|
@@ -218,6 +227,44 @@ ${external ? `` : `<style>
|
|
|
218
227
|
background-color: #B9B9B9;
|
|
219
228
|
}
|
|
220
229
|
|
|
230
|
+
.tndr-simulate-input-cvv-container{
|
|
231
|
+
height: 100%;
|
|
232
|
+
width: 100%;
|
|
233
|
+
position: absolute;
|
|
234
|
+
pointer-events: none;
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
.tndr-simulate-input-cvv {
|
|
238
|
+
width: 100%;
|
|
239
|
+
pointer-events: none;
|
|
240
|
+
position: relative;
|
|
241
|
+
}
|
|
242
|
+
.tndr-simulate-input-cvv-container label{
|
|
243
|
+
line-height: ${data?.customStyles?.labelStyles?.base?.lineHeight ? data?.customStyles?.labelStyles?.base?.lineHeight : ""};
|
|
244
|
+
color: transparent;
|
|
245
|
+
font-size: ${data?.customStyles?.labelStyles?.base?.fontSize ? data?.customStyles?.labelStyles?.base?.fontSize : defaultStyles.labelStyles.base.fontSize};
|
|
246
|
+
font-family: ${data?.customStyles?.labelStyles?.base?.fontFamily ? data?.customStyles?.labelStyles?.base?.fontFamily : defaultStyles.labelStyles.base.fontFamily};
|
|
247
|
+
font-weight: ${data?.customStyles?.labelStyles?.base?.fontWeight ? data?.customStyles?.labelStyles?.base?.fontWeight : defaultStyles.labelStyles.base.fontWeight};
|
|
248
|
+
text-align: ${data?.customStyles?.labelStyles?.base?.textAlign ? data?.customStyles?.labelStyles?.base?.textAlign : defaultStyles.labelStyles.base.textAlign};
|
|
249
|
+
pointer-events: none;
|
|
250
|
+
}
|
|
251
|
+
.tndr-simulate-input-cvv input {
|
|
252
|
+
width: 100%;
|
|
253
|
+
margin: 0;
|
|
254
|
+
padding: 0;
|
|
255
|
+
border: 0;
|
|
256
|
+
min-height: 44px;
|
|
257
|
+
background-color: transparent;
|
|
258
|
+
pointer-events: none;
|
|
259
|
+
}
|
|
260
|
+
.tndr-form-label{
|
|
261
|
+
line-height: ${data?.customStyles?.labelStyles?.base?.lineHeight ? data?.customStyles?.labelStyles?.base?.lineHeight : "22px"};
|
|
262
|
+
color: ${data?.customStyles?.labelStyles?.base?.color ? data?.customStyles?.labelStyles?.base?.color : defaultStyles.labelStyles.base.color};
|
|
263
|
+
font-size: ${data?.customStyles?.labelStyles?.base?.fontSize ? data?.customStyles?.labelStyles?.base?.fontSize : defaultStyles.labelStyles.base.fontSize};
|
|
264
|
+
font-family: ${data?.customStyles?.labelStyles?.base?.fontFamily ? data?.customStyles?.labelStyles?.base?.fontFamily : defaultStyles.labelStyles.base.fontFamily};
|
|
265
|
+
font-weight: ${data?.customStyles?.labelStyles?.base?.fontWeight ? data?.customStyles?.labelStyles?.base?.fontWeight : defaultStyles.labelStyles.base.fontWeight};
|
|
266
|
+
text-align: ${data?.customStyles?.labelStyles?.base?.textAlign ? data?.customStyles?.labelStyles?.base?.textAlign : defaultStyles.labelStyles.base.textAlign};
|
|
267
|
+
}
|
|
221
268
|
.lds-dual-ring {
|
|
222
269
|
display: inline-block;
|
|
223
270
|
width: 14px;
|
|
@@ -403,34 +450,202 @@ ${external ? `` : `<style>
|
|
|
403
450
|
}
|
|
404
451
|
|
|
405
452
|
</style>
|
|
406
|
-
`
|
|
453
|
+
`
|
|
454
|
+
}
|
|
407
455
|
|
|
408
|
-
export const cardItemsTemplate = (
|
|
456
|
+
export const cardItemsTemplate = (data: {
|
|
457
|
+
cards: Card[];
|
|
458
|
+
collectorIds:CollectorIds;
|
|
459
|
+
renderPaymentButton: boolean;
|
|
460
|
+
acId: string;
|
|
461
|
+
customStyles: any;
|
|
462
|
+
}) => {
|
|
409
463
|
|
|
410
|
-
const cardItemsHTML = cards.reduce((total: string, card: Card) => {
|
|
464
|
+
const cardItemsHTML = data.cards.reduce((total: string, card: Card) => {
|
|
465
|
+
const { cvvLabel } = getCardFormLabels(data.customStyles).labels;
|
|
466
|
+
|
|
411
467
|
return `${total}
|
|
412
|
-
<div class="
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
<
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
<
|
|
420
|
-
<
|
|
421
|
-
<
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
468
|
+
<div class="ac" id="card_container-${card.skyflow_id}">
|
|
469
|
+
<div class="card-item">
|
|
470
|
+
<input id="${card.skyflow_id}" class="card_selected" name="card_selected" type="radio"/>
|
|
471
|
+
<label class="card-item-label" for="${card.skyflow_id}">
|
|
472
|
+
<img class="card-image" src="${getCardType(card.card_scheme)}" />
|
|
473
|
+
<div class="card-number">${card.card_number}</div>
|
|
474
|
+
<div class="card-expiration">Exp. ${card.expiration_month}/${card.expiration_year}</div>
|
|
475
|
+
<div class="card-delete-icon">
|
|
476
|
+
<button id="delete_button_${card.skyflow_id}" class="card-delete-button">
|
|
477
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">
|
|
478
|
+
<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"/>
|
|
479
|
+
</svg>
|
|
480
|
+
</button>
|
|
481
|
+
</div>
|
|
482
|
+
</label>
|
|
483
|
+
</div>
|
|
484
|
+
<div class="ac-panel">
|
|
485
|
+
<div class="ac-card-panel-container" id="acContainer${card.skyflow_id}">
|
|
486
|
+
|
|
487
|
+
<div class="cvvContainer" id="cvvContainer${card.skyflow_id}">
|
|
488
|
+
<label class="tndr-form-label label-cvv-cards">${cvvLabel}</label>
|
|
489
|
+
<div id="${data.collectorIds.cvv}${card.skyflow_id}" class="empty-div">
|
|
490
|
+
<div class="tndr-simulate-input-cvv-container">
|
|
491
|
+
<div class="tndr-simulate-input-cvv">
|
|
492
|
+
<svg class="cvvIcon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="40" height="24" viewBox="0 0 270 178">
|
|
493
|
+
<defs>
|
|
494
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
495
|
+
<stop offset="0" stop-color="#386bbf"/>
|
|
496
|
+
<stop offset="1" stop-color="#032ea3"/>
|
|
497
|
+
</linearGradient>
|
|
498
|
+
<linearGradient id="linear-gradient-2" x1="0.5" y1="0.115" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
499
|
+
<stop offset="0" stop-color="#1c1c1c"/>
|
|
500
|
+
<stop offset="1" stop-color="#151515"/>
|
|
501
|
+
</linearGradient>
|
|
502
|
+
</defs>
|
|
503
|
+
<g id="Grupo_3" data-name="Grupo 3" transform="translate(-69 -312)">
|
|
504
|
+
<g id="Grupo_2" data-name="Grupo 2">
|
|
505
|
+
<rect id="Rectángulo_58" data-name="Rectángulo 58" width="253" height="165" rx="25" transform="translate(69 312)" fill="url(#linear-gradient)"/>
|
|
506
|
+
<rect id="Rectángulo_61" data-name="Rectángulo 61" width="68" height="8" rx="4" transform="translate(86 437)" fill="#fff" opacity="0.877"/>
|
|
507
|
+
<rect id="Rectángulo_66" data-name="Rectángulo 66" width="253" height="24" transform="translate(69 347)" fill="url(#linear-gradient-2)"/>
|
|
508
|
+
<g id="Elipse_4" data-name="Elipse 4" transform="translate(221 374)" fill="#fff" stroke="#191919" stroke-width="1">
|
|
509
|
+
<ellipse cx="59" cy="58" rx="59" ry="58" stroke="none"/>
|
|
510
|
+
<ellipse cx="59" cy="58" rx="58.5" ry="57.5" fill="none"/>
|
|
511
|
+
</g>
|
|
512
|
+
</g>
|
|
513
|
+
<text id="_123" data-name="123" transform="translate(240 448)" font-size="45" font-family="Menlo-Regular, Menlo"><tspan x="0" y="0">123</tspan></text>
|
|
514
|
+
</g>
|
|
515
|
+
</svg>
|
|
516
|
+
<input tabindex="-1"/>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
${ data?.renderPaymentButton ?
|
|
523
|
+
`<div class="container-card-pay-button">
|
|
524
|
+
<button id="${data.collectorIds.tonderPayButton ? data.collectorIds.tonderPayButton:''}${card.skyflow_id}" class="card-pay-button pay-button">Pagar</button>
|
|
525
|
+
</div> `
|
|
526
|
+
:``
|
|
527
|
+
}
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
426
530
|
</div>`
|
|
427
531
|
}, ``);
|
|
428
532
|
|
|
429
|
-
const cardItemStyle =
|
|
533
|
+
const cardItemStyle = `
|
|
430
534
|
<style>
|
|
431
|
-
|
|
432
535
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
|
|
433
|
-
|
|
536
|
+
.ac {
|
|
537
|
+
border: none;
|
|
538
|
+
background-color: transparent;
|
|
539
|
+
box-sizing: border-box;
|
|
540
|
+
margin-bottom: 0;
|
|
541
|
+
border-bottom: 1px solid #e2e8f0;
|
|
542
|
+
}
|
|
543
|
+
.ac-card-panel-container{
|
|
544
|
+
padding: ${data?.renderPaymentButton ? '20px 32px 0px 32px':'20px 32px 20px 32px'};
|
|
545
|
+
}
|
|
546
|
+
.cvvContainer{
|
|
547
|
+
max-width: 60%;
|
|
548
|
+
position: relative;
|
|
549
|
+
padding: 0 0 0 29px;
|
|
550
|
+
}
|
|
551
|
+
.cvvIcon {
|
|
552
|
+
position: absolute;
|
|
553
|
+
right: 8px;
|
|
554
|
+
top: 12px;
|
|
555
|
+
opacity: 0;
|
|
556
|
+
transform: translateY(10px);
|
|
557
|
+
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
558
|
+
}
|
|
559
|
+
.label-cvv-cards {
|
|
560
|
+
opacity: 0;
|
|
561
|
+
}
|
|
562
|
+
.cvvContainer.show .label-cvv-cards{
|
|
563
|
+
opacity: 1;
|
|
564
|
+
transition-delay: 0.3s;
|
|
565
|
+
}
|
|
566
|
+
.cvvContainer.show .cvvIcon,
|
|
567
|
+
.ac-card-panel-container.show .card-pay-button {
|
|
568
|
+
opacity: 1;
|
|
569
|
+
transform: translateY(0);
|
|
570
|
+
transition-delay: 0.3s;
|
|
571
|
+
}
|
|
572
|
+
.error-custom-inputs-tonder-cards{
|
|
573
|
+
bottom: 2px !important;
|
|
574
|
+
}
|
|
575
|
+
.container-card-pay-button{
|
|
576
|
+
margin: 20px 0px;
|
|
577
|
+
}
|
|
578
|
+
.card-pay-button{
|
|
579
|
+
display: block;
|
|
580
|
+
opacity: 0;
|
|
581
|
+
transform: translateY(10px);
|
|
582
|
+
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.ac .ac-header {
|
|
586
|
+
margin: 0;
|
|
587
|
+
padding: 0;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.ac .ac-trigger {
|
|
591
|
+
font:
|
|
592
|
+
bold 16px "Arial",
|
|
593
|
+
sans-serif;
|
|
594
|
+
color: var(--color-black);
|
|
595
|
+
text-align: left;
|
|
596
|
+
width: 100%;
|
|
597
|
+
padding: 8px 32px 8px 8px;
|
|
598
|
+
display: block;
|
|
599
|
+
cursor: pointer;
|
|
600
|
+
background-color: transparent;
|
|
601
|
+
transition: color 0.25s ease;
|
|
602
|
+
position: relative;
|
|
603
|
+
text-decoration: none;
|
|
604
|
+
margin: 0;
|
|
605
|
+
border: 0;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.ac .ac-trigger::after {
|
|
609
|
+
content: "+";
|
|
610
|
+
text-align: center;
|
|
611
|
+
width: 15px;
|
|
612
|
+
transform: translate(0, -50%);
|
|
613
|
+
position: absolute;
|
|
614
|
+
right: 10px;
|
|
615
|
+
top: 50%;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.ac .ac-trigger:focus {
|
|
619
|
+
color: var(--color-grey);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
.ac .ac-panel {
|
|
623
|
+
overflow: hidden;
|
|
624
|
+
transition-property: height, visibility;
|
|
625
|
+
transition-timing-function: ease;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.ac .ac-panel .ac-text {
|
|
629
|
+
font:
|
|
630
|
+
15px/24px "Arial",
|
|
631
|
+
sans-serif;
|
|
632
|
+
color: var(--color-black);
|
|
633
|
+
padding: 8px;
|
|
634
|
+
margin: 0;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.ac.js-enabled .ac-panel {
|
|
638
|
+
visibility: hidden;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.ac.is-active .ac-panel {
|
|
642
|
+
visibility: visible;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.ac.is-active > .ac-header .ac-trigger::after {
|
|
646
|
+
content: "\\2013";
|
|
647
|
+
}
|
|
648
|
+
|
|
434
649
|
.card-item-label {
|
|
435
650
|
display: flex;
|
|
436
651
|
justify-content: space-between;
|
|
@@ -448,7 +663,6 @@ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
|
|
|
448
663
|
justify-content: start;
|
|
449
664
|
align-items: center;
|
|
450
665
|
gap: 33% 15px;
|
|
451
|
-
border-bottom: 1px solid #e2e8f0;
|
|
452
666
|
padding: 0px 30px;
|
|
453
667
|
}
|
|
454
668
|
|
|
@@ -557,11 +771,23 @@ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
|
|
|
557
771
|
transition-duration: 150ms;
|
|
558
772
|
opacity: 10;
|
|
559
773
|
}
|
|
560
|
-
|
|
774
|
+
@media screen and (max-width: 768px) {
|
|
775
|
+
.cvvContainer {
|
|
776
|
+
max-width: 70%;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
@media screen and (max-width: 480px) {
|
|
781
|
+
.cvvContainer {
|
|
782
|
+
max-width: 100%;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
561
785
|
</style>
|
|
562
786
|
`
|
|
563
787
|
const cardItem = `
|
|
564
|
-
${
|
|
788
|
+
<div class="accordion-container${data.acId}">
|
|
789
|
+
${cardItemsHTML}
|
|
790
|
+
</div>
|
|
565
791
|
${cardItemStyle}
|
|
566
792
|
`
|
|
567
793
|
return cardItem;
|
|
@@ -584,7 +810,7 @@ export const apmItemsTemplate = (external: boolean, apms: ITonderPaymentMethod[]
|
|
|
584
810
|
</div>`
|
|
585
811
|
}, ``);
|
|
586
812
|
|
|
587
|
-
const apmItemStyle =
|
|
813
|
+
const apmItemStyle = `
|
|
588
814
|
<style>
|
|
589
815
|
.apm-item-label {
|
|
590
816
|
display: flex;
|
package/src/helpers/utils.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PAYMENT_METHOD } from "./constants";
|
|
2
2
|
import { Card } from "./template";
|
|
3
|
-
import
|
|
3
|
+
import get from "lodash.get";
|
|
4
|
+
import {defaultStyles} from "./styles";
|
|
4
5
|
|
|
5
6
|
export async function addScripts() {
|
|
6
7
|
try {
|
|
@@ -400,4 +401,58 @@ export const getPaymentMethodDetails = (scheme_data: string): {icon: string; lab
|
|
|
400
401
|
|
|
401
402
|
const clearSpace = (text: string) => {
|
|
402
403
|
return text.trim().replace(/\s+/g, '');
|
|
403
|
-
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export function generateRandomString(length: number) {
|
|
407
|
+
const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // Letras en minúscula y mayúscula
|
|
408
|
+
let result = "";
|
|
409
|
+
|
|
410
|
+
for (let i = 0; i < length; i++) {
|
|
411
|
+
const randomIndex = Math.floor(Math.random() * characters.length);
|
|
412
|
+
result += characters[randomIndex];
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return result;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export function getCardFormLabels(customStyles: any) {
|
|
419
|
+
return {
|
|
420
|
+
labels: {
|
|
421
|
+
nameLabel: get(customStyles, "labels.nameLabel", defaultStyles.labels.nameLabel),
|
|
422
|
+
cardLabel: get(customStyles, "labels.cardLabel", defaultStyles.labels.cardLabel),
|
|
423
|
+
cvvLabel: get(customStyles, "labels.cvvLabel", defaultStyles.labels.cvvLabel),
|
|
424
|
+
expiryDateLabel: get(
|
|
425
|
+
customStyles,
|
|
426
|
+
"labels.expiryDateLabel",
|
|
427
|
+
defaultStyles.labels.expiryDateLabel,
|
|
428
|
+
),
|
|
429
|
+
},
|
|
430
|
+
placeholders: {
|
|
431
|
+
namePlaceholder: get(
|
|
432
|
+
customStyles,
|
|
433
|
+
"placeholders.namePlaceholder",
|
|
434
|
+
defaultStyles.placeholders.namePlaceholder,
|
|
435
|
+
),
|
|
436
|
+
cardPlaceholder: get(
|
|
437
|
+
customStyles,
|
|
438
|
+
"placeholders.cardPlaceholder",
|
|
439
|
+
defaultStyles.placeholders.cardPlaceholder,
|
|
440
|
+
),
|
|
441
|
+
cvvPlaceholder: get(
|
|
442
|
+
customStyles,
|
|
443
|
+
"placeholders.cvvPlaceholder",
|
|
444
|
+
defaultStyles.placeholders.cvvPlaceholder,
|
|
445
|
+
),
|
|
446
|
+
expiryMonthPlaceholder: get(
|
|
447
|
+
customStyles,
|
|
448
|
+
"placeholders.expiryMonthPlaceholder",
|
|
449
|
+
defaultStyles.placeholders.expiryMonthPlaceholder,
|
|
450
|
+
),
|
|
451
|
+
expiryYearPlaceholder: get(
|
|
452
|
+
customStyles,
|
|
453
|
+
"placeholders.expiryYearPlaceholder",
|
|
454
|
+
defaultStyles.placeholders.expiryYearPlaceholder,
|
|
455
|
+
),
|
|
456
|
+
},
|
|
457
|
+
};
|
|
458
|
+
}
|
|
@@ -63,6 +63,8 @@ export interface IInlineCheckout {
|
|
|
63
63
|
removeCheckout(): void;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
+
* @deprecated This method is deprecated and will be removed in a future release.
|
|
67
|
+
* It is no longer necessary to use this method; you can now pass all payment data directly in the configureCheckout function.
|
|
66
68
|
* Set the payment data, such as customer, cart, and metadata. This is useful when using the default Tonder payment button.
|
|
67
69
|
* @returns {void}
|
|
68
70
|
* @public
|