tonder-web-sdk 1.9.1 → 1.9.2-beta.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tonder-web-sdk",
3
- "version": "1.9.1",
3
+ "version": "1.9.2-beta.1",
4
4
  "description": "tonder sdk for integrations",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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",
@@ -112,12 +107,6 @@ export async function initSkyflow(
112
107
  validations: [regexMatchRule],
113
108
  });
114
109
 
115
- handleSkyflowElementEvents(
116
- cvvElement,
117
- collectorIds.cvv,
118
- "errorCvvIdTonder"
119
- );
120
-
121
110
  const expiryMonthElement = await collectContainer.create({
122
111
  table: "cards",
123
112
  column: "expiration_month",
@@ -128,12 +117,6 @@ export async function initSkyflow(
128
117
  validations: [regexMatchRule],
129
118
  });
130
119
 
131
- handleSkyflowElementEvents(
132
- expiryMonthElement,
133
- collectorIds.expirationMonth,
134
- "errorExpiryMonthIdTonder"
135
- );
136
-
137
120
  const expiryYearElement = await collectContainer.create({
138
121
  table: "cards",
139
122
  column: "expiration_year",
@@ -144,12 +127,6 @@ export async function initSkyflow(
144
127
  validations: [regexMatchRule],
145
128
  });
146
129
 
147
- handleSkyflowElementEvents(
148
- expiryYearElement,
149
- collectorIds.expirationYear,
150
- "errorExpiryYearIdTonder"
151
- );
152
-
153
130
  await mountElements(
154
131
  cardNumberElement,
155
132
  cvvElement,
@@ -185,28 +162,23 @@ async function mountElements(
185
162
  }
186
163
 
187
164
 
188
- function handleSkyflowElementEvents(element, elementId, errorElementId, fieldMessage= "", requiredMessage = "El campo es requerido", invalidMessage= "El campo es inválido") {
165
+ function handleSkyflowElementEvents(element, fieldMessage= "", requiredMessage = "El campo es requerido", invalidMessage= "El campo es inválido") {
189
166
  if ("on" in element) {
190
167
  element.on(Skyflow.EventName.CHANGE, (state) => {
191
- let errorElement = document.getElementById(errorElementId);
192
- if (errorElement && state.isValid && !state.isEmpty) {
193
- errorElement.remove();
168
+ if (state.isValid && !state.isEmpty) {
169
+ element.resetError();
194
170
  }
195
171
  });
196
172
 
197
173
  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
174
  if (!state.isValid) {
204
- let errorLabel = document.createElement("div");
205
- errorLabel.classList.add("error-custom-inputs-tonder");
206
- errorLabel.id = errorElementId;
207
- errorLabel.textContent = state.isEmpty ? requiredMessage : fieldMessage != "" ?`El campo ${fieldMessage} es inválido`: invalidMessage;
208
- container?.appendChild(errorLabel);
175
+ const msj_error = state.isEmpty ? requiredMessage : fieldMessage != "" ?`El campo ${fieldMessage} es inválido`: invalidMessage;
176
+ element.setError(msj_error);
209
177
  }
210
178
  });
179
+
180
+ element.on(Skyflow.EventName.FOCUS, (state) => {
181
+ element.resetError();
182
+ });
211
183
  }
212
184
  }
@@ -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 10px 30px 10px;
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% 20px;
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: 90%;
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
- padding-left: 10px;
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
- padding-left: 10px;
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% 20px;
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%;