tonder-web-sdk 1.9.1 → 1.9.2-beta.2
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 +1 -1
- package/src/helpers/skyflow.js +16 -25
- package/src/helpers/template.js +15 -12
- package/v1/bundle.min.js +3 -3
package/package.json
CHANGED
package/src/helpers/skyflow.js
CHANGED
|
@@ -74,8 +74,6 @@ export async function initSkyflow(
|
|
|
74
74
|
|
|
75
75
|
handleSkyflowElementEvents(
|
|
76
76
|
cardHolderNameElement,
|
|
77
|
-
collectorIds.holderName,
|
|
78
|
-
"errorCardHolderIdTonder",
|
|
79
77
|
"titular de la tarjeta"
|
|
80
78
|
);
|
|
81
79
|
|
|
@@ -96,12 +94,9 @@ export async function initSkyflow(
|
|
|
96
94
|
|
|
97
95
|
handleSkyflowElementEvents(
|
|
98
96
|
cardNumberElement,
|
|
99
|
-
collectorIds.cardNumber,
|
|
100
|
-
"errorCardNumberIdTonder",
|
|
101
97
|
"número de tarjeta"
|
|
102
98
|
);
|
|
103
99
|
|
|
104
|
-
|
|
105
100
|
const cvvElement = await collectContainer.create({
|
|
106
101
|
table: "cards",
|
|
107
102
|
column: "cvv",
|
|
@@ -114,8 +109,7 @@ export async function initSkyflow(
|
|
|
114
109
|
|
|
115
110
|
handleSkyflowElementEvents(
|
|
116
111
|
cvvElement,
|
|
117
|
-
|
|
118
|
-
"errorCvvIdTonder"
|
|
112
|
+
""
|
|
119
113
|
);
|
|
120
114
|
|
|
121
115
|
const expiryMonthElement = await collectContainer.create({
|
|
@@ -130,10 +124,10 @@ export async function initSkyflow(
|
|
|
130
124
|
|
|
131
125
|
handleSkyflowElementEvents(
|
|
132
126
|
expiryMonthElement,
|
|
133
|
-
|
|
134
|
-
"errorExpiryMonthIdTonder"
|
|
127
|
+
""
|
|
135
128
|
);
|
|
136
129
|
|
|
130
|
+
|
|
137
131
|
const expiryYearElement = await collectContainer.create({
|
|
138
132
|
table: "cards",
|
|
139
133
|
column: "expiration_year",
|
|
@@ -146,8 +140,8 @@ export async function initSkyflow(
|
|
|
146
140
|
|
|
147
141
|
handleSkyflowElementEvents(
|
|
148
142
|
expiryYearElement,
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
"",
|
|
144
|
+
false
|
|
151
145
|
);
|
|
152
146
|
|
|
153
147
|
await mountElements(
|
|
@@ -185,27 +179,24 @@ async function mountElements(
|
|
|
185
179
|
}
|
|
186
180
|
|
|
187
181
|
|
|
188
|
-
function handleSkyflowElementEvents(element,
|
|
182
|
+
function handleSkyflowElementEvents(element, fieldMessage= "", resetOnFocus = true, requiredMessage = "El campo es requerido", invalidMessage= "El campo es inválido") {
|
|
189
183
|
if ("on" in element) {
|
|
190
184
|
element.on(Skyflow.EventName.CHANGE, (state) => {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
errorElement.remove();
|
|
185
|
+
if (state.isValid && !state.isEmpty) {
|
|
186
|
+
element.resetError();
|
|
194
187
|
}
|
|
195
188
|
});
|
|
196
189
|
|
|
197
190
|
element.on(Skyflow.EventName.BLUR, (state) => {
|
|
198
|
-
let container = document.getElementById(elementId);
|
|
199
|
-
let errorElement = document.getElementById(errorElementId);
|
|
200
|
-
if (errorElement) {
|
|
201
|
-
errorElement.remove();
|
|
202
|
-
}
|
|
203
191
|
if (!state.isValid) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
192
|
+
const msj_error = state.isEmpty ? requiredMessage : fieldMessage != "" ?`El campo ${fieldMessage} es inválido`: invalidMessage;
|
|
193
|
+
element.setError(msj_error);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
element.on(Skyflow.EventName.FOCUS, (state) => {
|
|
198
|
+
if(resetOnFocus){
|
|
199
|
+
element.resetError();
|
|
209
200
|
}
|
|
210
201
|
});
|
|
211
202
|
}
|
package/src/helpers/template.js
CHANGED
|
@@ -35,7 +35,7 @@ export const cardTemplate = `
|
|
|
35
35
|
.container-tonder {
|
|
36
36
|
background-color: #F9F9F9;
|
|
37
37
|
margin: 0 auto !important;
|
|
38
|
-
padding: 30px
|
|
38
|
+
padding: 30px 25px;
|
|
39
39
|
overflow: hidden;
|
|
40
40
|
transition: max-height 0.5s ease-out;
|
|
41
41
|
max-width: 600px;
|
|
@@ -134,7 +134,8 @@ export const cardTemplate = `
|
|
|
134
134
|
top: 0;
|
|
135
135
|
left: 0;
|
|
136
136
|
width: 100%;
|
|
137
|
-
height: 100
|
|
137
|
+
height: 100%;
|
|
138
|
+
z-index: 1;
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
@media screen and (max-width: 600px) {
|
|
@@ -174,12 +175,13 @@ export const cardTemplate = `
|
|
|
174
175
|
justify-content: start;
|
|
175
176
|
align-items: center;
|
|
176
177
|
color: #1D1D1D;
|
|
177
|
-
gap: 33%
|
|
178
|
+
gap: 33% 15px;
|
|
178
179
|
margin-top: 10px;
|
|
179
180
|
margin-bottom: 10px;
|
|
180
181
|
padding-left: 10px;
|
|
181
182
|
padding-right: 10px;
|
|
182
|
-
width:
|
|
183
|
+
width: 100%;
|
|
184
|
+
position: relative;
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
.pay-new-card .card-number {
|
|
@@ -199,15 +201,14 @@ export const cardTemplate = `
|
|
|
199
201
|
gap: 33% 20px;
|
|
200
202
|
margin-top: 10px;
|
|
201
203
|
margin-bottom: 10px;
|
|
202
|
-
|
|
203
|
-
padding-right: 10px;
|
|
204
|
-
width: 90%;
|
|
204
|
+
width: 100%;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
.card_selected {
|
|
208
208
|
position: relative;
|
|
209
209
|
width: 16px;
|
|
210
210
|
height: 16px;
|
|
211
|
+
min-width: 16px;
|
|
211
212
|
appearance: none;
|
|
212
213
|
cursor: pointer;
|
|
213
214
|
border-radius: 100%;
|
|
@@ -240,6 +241,7 @@ export const cardTemplate = `
|
|
|
240
241
|
position: relative;
|
|
241
242
|
width: 16px;
|
|
242
243
|
height: 16px;
|
|
244
|
+
min-width: 16px;
|
|
243
245
|
appearance: none;
|
|
244
246
|
cursor: pointer;
|
|
245
247
|
border-radius: 100%;
|
|
@@ -284,6 +286,7 @@ export const cardTemplate = `
|
|
|
284
286
|
opacity: 10;
|
|
285
287
|
}
|
|
286
288
|
|
|
289
|
+
|
|
287
290
|
.error-custom-inputs-tonder {
|
|
288
291
|
background-color: white;
|
|
289
292
|
position: absolute;
|
|
@@ -337,16 +340,15 @@ export const cardItemsTemplate = (cards) => {
|
|
|
337
340
|
gap: 33% 20px;
|
|
338
341
|
margin-top: 10px;
|
|
339
342
|
margin-bottom: 10px;
|
|
340
|
-
|
|
341
|
-
padding-right: 10px;
|
|
342
|
-
width: 90%;
|
|
343
|
+
width: 100%;
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
.card-item {
|
|
347
|
+
position: relative;
|
|
346
348
|
display: flex;
|
|
347
349
|
justify-content: start;
|
|
348
350
|
align-items: center;
|
|
349
|
-
gap: 33%
|
|
351
|
+
gap: 33% 15px;
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
.card-item .card-number {
|
|
@@ -373,10 +375,10 @@ export const cardItemsTemplate = (cards) => {
|
|
|
373
375
|
background-color: transparent !important;
|
|
374
376
|
color: #D91C1C !important;
|
|
375
377
|
}
|
|
376
|
-
|
|
377
378
|
.card_selected {
|
|
378
379
|
position: relative;
|
|
379
380
|
width: 16px;
|
|
381
|
+
min-width: 16px;
|
|
380
382
|
height: 16px;
|
|
381
383
|
appearance: none;
|
|
382
384
|
cursor: pointer;
|
|
@@ -410,6 +412,7 @@ export const cardItemsTemplate = (cards) => {
|
|
|
410
412
|
position: relative;
|
|
411
413
|
width: 16px;
|
|
412
414
|
height: 16px;
|
|
415
|
+
min-width: 16px;
|
|
413
416
|
appearance: none;
|
|
414
417
|
cursor: pointer;
|
|
415
418
|
border-radius: 100%;
|