tonder-web-sdk 1.16.3 → 1.16.6-beta.DEV-1433.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/README.md +22 -25
- package/package.json +10 -3
- package/types/common.d.ts +4 -0
- package/v1/bundle.min.js +1 -18
- package/.env-example +0 -1
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -8
- package/.prettierrc +0 -10
- package/cypress/e2e/1-getting-started/todo.cy.js +0 -143
- package/cypress/e2e/2-advanced-examples/actions.cy.js +0 -299
- package/cypress/e2e/2-advanced-examples/aliasing.cy.js +0 -39
- package/cypress/e2e/2-advanced-examples/assertions.cy.js +0 -176
- package/cypress/e2e/2-advanced-examples/connectors.cy.js +0 -98
- package/cypress/e2e/2-advanced-examples/cookies.cy.js +0 -118
- package/cypress/e2e/2-advanced-examples/cypress_api.cy.js +0 -185
- package/cypress/e2e/2-advanced-examples/files.cy.js +0 -85
- package/cypress/e2e/2-advanced-examples/location.cy.js +0 -32
- package/cypress/e2e/2-advanced-examples/misc.cy.js +0 -104
- package/cypress/e2e/2-advanced-examples/navigation.cy.js +0 -56
- package/cypress/e2e/2-advanced-examples/network_requests.cy.js +0 -163
- package/cypress/e2e/2-advanced-examples/querying.cy.js +0 -114
- package/cypress/e2e/2-advanced-examples/spies_stubs_clocks.cy.js +0 -201
- package/cypress/e2e/2-advanced-examples/storage.cy.js +0 -110
- package/cypress/e2e/2-advanced-examples/traversal.cy.js +0 -121
- package/cypress/e2e/2-advanced-examples/utilities.cy.js +0 -108
- package/cypress/e2e/2-advanced-examples/viewport.cy.js +0 -58
- package/cypress/e2e/2-advanced-examples/waiting.cy.js +0 -30
- package/cypress/e2e/2-advanced-examples/window.cy.js +0 -22
- package/cypress/fixtures/example.json +0 -5
- package/cypress/support/commands.js +0 -25
- package/cypress/support/e2e.js +0 -20
- package/cypress.config.js +0 -9
- package/eslint.config.mjs +0 -15
- package/index.js.example +0 -50
- package/samples/react/README.md +0 -70
- package/samples/react/build/asset-manifest.json +0 -16
- package/samples/react/build/favicon.ico +0 -0
- package/samples/react/build/index.html +0 -1
- package/samples/react/build/logo192.png +0 -0
- package/samples/react/build/logo512.png +0 -0
- package/samples/react/build/manifest.json +0 -25
- package/samples/react/build/robots.txt +0 -3
- package/samples/react/build/static/css/main.073c9b0a.css +0 -2
- package/samples/react/build/static/css/main.073c9b0a.css.map +0 -1
- package/samples/react/build/static/js/787.b83ed06f.chunk.js +0 -2
- package/samples/react/build/static/js/787.b83ed06f.chunk.js.map +0 -1
- package/samples/react/build/static/js/main.0a848807.js +0 -3
- package/samples/react/build/static/js/main.0a848807.js.LICENSE.txt +0 -39
- package/samples/react/build/static/js/main.0a848807.js.map +0 -1
- package/samples/react/build/static/media/sdk-icons.b491623214b2af4cccdb.png +0 -0
- package/samples/react/package-lock.json +0 -28973
- package/samples/react/package.json +0 -44
- package/samples/react/public/favicon.ico +0 -0
- package/samples/react/public/index.html +0 -43
- package/samples/react/public/logo192.png +0 -0
- package/samples/react/public/logo512.png +0 -0
- package/samples/react/public/manifest.json +0 -25
- package/samples/react/public/robots.txt +0 -3
- package/samples/react/src/App.css +0 -38
- package/samples/react/src/App.js +0 -22
- package/samples/react/src/App.test.js +0 -8
- package/samples/react/src/assets/img/sdk-icons.png +0 -0
- package/samples/react/src/components/Cart.js +0 -29
- package/samples/react/src/components/ProductCard.js +0 -27
- package/samples/react/src/context/CartContext.js +0 -116
- package/samples/react/src/index.css +0 -13
- package/samples/react/src/index.js +0 -17
- package/samples/react/src/logo.svg +0 -1
- package/samples/react/src/reportWebVitals.js +0 -13
- package/samples/react/src/screens/Checkout.js +0 -82
- package/samples/react/src/screens/Store.js +0 -21
- package/samples/react/src/setupTests.js +0 -5
- package/samples/react/src/storeProducts.js +0 -30
- package/src/classes/3dsHandler.js +0 -199
- package/src/classes/BaseInlineCheckout.js +0 -303
- package/src/classes/LiteInlineCheckout.js +0 -217
- package/src/classes/checkout.js +0 -129
- package/src/classes/globalLoader.js +0 -31
- package/src/classes/inlineCheckout.js +0 -713
- package/src/data/apmApi.js +0 -38
- package/src/data/businessApi.js +0 -16
- package/src/data/cardApi.js +0 -134
- package/src/data/checkoutApi.js +0 -92
- package/src/data/customerApi.js +0 -32
- package/src/data/index.js +0 -17
- package/src/data/openPayApi.js +0 -16
- package/src/data/skyflowApi.js +0 -16
- package/src/helpers/skyflow.js +0 -370
- package/src/helpers/styles.js +0 -90
- package/src/helpers/template-skeleton.js +0 -59
- package/src/helpers/template.js +0 -1104
- package/src/helpers/utils.js +0 -257
- package/src/helpers/validations.js +0 -53
- package/src/index-dev.js +0 -329
- package/src/index.html +0 -180
- package/src/index.js +0 -21
- package/src/shared/catalog/commonLogosCatalog.js +0 -7
- package/src/shared/catalog/paymentMethodsCatalog.js +0 -246
- package/src/shared/constants/colors.js +0 -15
- package/src/shared/constants/displayMode.js +0 -4
- package/src/shared/constants/fieldPathNames.js +0 -4
- package/src/shared/constants/htmlTonderIds.js +0 -18
- package/src/shared/constants/messages.js +0 -11
- package/src/shared/constants/paymentMethodAPM.js +0 -63
- package/src/shared/constants/tonderUrl.js +0 -8
- package/webpack.config.js +0 -77
package/src/helpers/skyflow.js
DELETED
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
import { getDefaultStyles } from "./styles";
|
|
2
|
-
import { getVaultToken } from "../data/skyflowApi";
|
|
3
|
-
import { buildErrorResponseFromCatch, getCardFormLabels } from "./utils";
|
|
4
|
-
import { DISPLAY_MODE } from "../shared/constants/displayMode";
|
|
5
|
-
|
|
6
|
-
export async function initSkyflow(
|
|
7
|
-
vaultId,
|
|
8
|
-
vaultUrl,
|
|
9
|
-
baseUrl,
|
|
10
|
-
apiKey,
|
|
11
|
-
signal,
|
|
12
|
-
customStyles = {},
|
|
13
|
-
collectorIds,
|
|
14
|
-
displayMode,
|
|
15
|
-
) {
|
|
16
|
-
const skyflow = await initializeSkyflow(vaultId, vaultUrl, baseUrl, apiKey, signal);
|
|
17
|
-
|
|
18
|
-
// Create collect Container.
|
|
19
|
-
const collectContainer = await skyflow.container(Skyflow.ContainerType.COLLECT);
|
|
20
|
-
// Custom styles for collect elements.
|
|
21
|
-
let collectStylesOptions = {
|
|
22
|
-
...getDefaultStyles(displayMode === DISPLAY_MODE.dark),
|
|
23
|
-
...(Object.keys(customStyles).length > 0 ? { ...customStyles } : {}),
|
|
24
|
-
...getCardFormLabels(customStyles),
|
|
25
|
-
};
|
|
26
|
-
const stylesForCardNumber = { ...collectStylesOptions.inputStyles.base };
|
|
27
|
-
stylesForCardNumber.textIndent = "44px";
|
|
28
|
-
|
|
29
|
-
const stylesForExpiryMonth = {
|
|
30
|
-
...collectStylesOptions.inputStyles.base,
|
|
31
|
-
borderBottomRightRadius: 0,
|
|
32
|
-
borderTopRightRadius: 0,
|
|
33
|
-
};
|
|
34
|
-
const stylesForExpiryYear = {
|
|
35
|
-
...collectStylesOptions.inputStyles.base,
|
|
36
|
-
borderBottomLeftRadius: 0,
|
|
37
|
-
borderTopLeftRadius: 0,
|
|
38
|
-
borderLeft: "1px solid #CED0D1",
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const lengthMatchRule = {
|
|
42
|
-
type: Skyflow.ValidationRuleType.LENGTH_MATCH_RULE,
|
|
43
|
-
params: {
|
|
44
|
-
max: 70,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const cardHolderNameElement = await collectContainer.create({
|
|
49
|
-
table: "cards",
|
|
50
|
-
column: "cardholder_name",
|
|
51
|
-
...collectStylesOptions,
|
|
52
|
-
label: collectStylesOptions.labels?.nameLabel,
|
|
53
|
-
placeholder: collectStylesOptions.placeholders?.namePlaceholder,
|
|
54
|
-
type: Skyflow.ElementType.CARDHOLDER_NAME,
|
|
55
|
-
validations: [lengthMatchRule, regexMatchRule],
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
handleSkyflowElementEvents(
|
|
59
|
-
cardHolderNameElement,
|
|
60
|
-
"titular de la tarjeta",
|
|
61
|
-
collectStylesOptions.errorTextStyles,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
// Create collect elements.
|
|
65
|
-
const cardNumberElement = await collectContainer.create({
|
|
66
|
-
table: "cards",
|
|
67
|
-
column: "card_number",
|
|
68
|
-
...collectStylesOptions,
|
|
69
|
-
inputStyles: {
|
|
70
|
-
...collectStylesOptions.inputStyles,
|
|
71
|
-
base: stylesForCardNumber,
|
|
72
|
-
},
|
|
73
|
-
label: collectStylesOptions.labels?.cardLabel,
|
|
74
|
-
placeholder: collectStylesOptions.placeholders?.cardPlaceholder,
|
|
75
|
-
type: Skyflow.ElementType.CARD_NUMBER,
|
|
76
|
-
validations: [regexMatchRule],
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
handleSkyflowElementEvents(
|
|
80
|
-
cardNumberElement,
|
|
81
|
-
"número de tarjeta",
|
|
82
|
-
collectStylesOptions.errorTextStyles,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const expiryMonthElement = await collectContainer.create({
|
|
86
|
-
table: "cards",
|
|
87
|
-
column: "expiration_month",
|
|
88
|
-
...collectStylesOptions,
|
|
89
|
-
inputStyles: {
|
|
90
|
-
...collectStylesOptions.inputStyles,
|
|
91
|
-
base: stylesForExpiryMonth,
|
|
92
|
-
},
|
|
93
|
-
label: "",
|
|
94
|
-
placeholder: collectStylesOptions.placeholders?.expiryMonthPlaceholder,
|
|
95
|
-
type: Skyflow.ElementType.EXPIRATION_MONTH,
|
|
96
|
-
validations: [regexMatchRule],
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
handleSkyflowElementEvents(
|
|
100
|
-
expiryMonthElement,
|
|
101
|
-
"",
|
|
102
|
-
collectStylesOptions.errorTextStyles,
|
|
103
|
-
true,
|
|
104
|
-
"Campo requerido",
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
const expiryYearElement = await collectContainer.create({
|
|
108
|
-
table: "cards",
|
|
109
|
-
column: "expiration_year",
|
|
110
|
-
...collectStylesOptions,
|
|
111
|
-
inputStyles: {
|
|
112
|
-
...collectStylesOptions.inputStyles,
|
|
113
|
-
base: stylesForExpiryYear,
|
|
114
|
-
},
|
|
115
|
-
label: "",
|
|
116
|
-
placeholder: collectStylesOptions.placeholders?.expiryYearPlaceholder,
|
|
117
|
-
type: Skyflow.ElementType.EXPIRATION_YEAR,
|
|
118
|
-
validations: [regexMatchRule],
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
handleSkyflowElementEvents(expiryYearElement, "", collectStylesOptions.errorTextStyles);
|
|
122
|
-
|
|
123
|
-
const cvvElement = await collectContainer.create({
|
|
124
|
-
table: "cards",
|
|
125
|
-
column: "cvv",
|
|
126
|
-
...collectStylesOptions,
|
|
127
|
-
label: "",
|
|
128
|
-
placeholder: collectStylesOptions.placeholders?.cvvPlaceholder,
|
|
129
|
-
type: Skyflow.ElementType.CVV,
|
|
130
|
-
validations: [regexMatchRule],
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
handleSkyflowElementEvents(cvvElement, "", collectStylesOptions.errorTextStyles);
|
|
134
|
-
const elementsConfig = {
|
|
135
|
-
cardNumber: {
|
|
136
|
-
element: cardNumberElement,
|
|
137
|
-
container: "#collectCardNumber",
|
|
138
|
-
},
|
|
139
|
-
cvv: {
|
|
140
|
-
element: cvvElement,
|
|
141
|
-
container: "#collectCvv",
|
|
142
|
-
},
|
|
143
|
-
expiryMonth: {
|
|
144
|
-
element: expiryMonthElement,
|
|
145
|
-
container: "#collectExpirationMonth",
|
|
146
|
-
},
|
|
147
|
-
expiryYear: {
|
|
148
|
-
element: expiryYearElement,
|
|
149
|
-
container: "#collectExpirationYear",
|
|
150
|
-
},
|
|
151
|
-
cardHolderName: {
|
|
152
|
-
element: cardHolderNameElement,
|
|
153
|
-
container: "#collectCardholderName",
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
await mountElements(elementsConfig);
|
|
158
|
-
return {
|
|
159
|
-
container: collectContainer,
|
|
160
|
-
elements: {
|
|
161
|
-
cardHolderNameElement,
|
|
162
|
-
cardNumberElement,
|
|
163
|
-
cvvElement,
|
|
164
|
-
expiryMonthElement,
|
|
165
|
-
expiryYearElement,
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export async function initUpdateSkyflow(
|
|
171
|
-
skyflowId,
|
|
172
|
-
vaultId,
|
|
173
|
-
vaultUrl,
|
|
174
|
-
baseUrl,
|
|
175
|
-
apiKey,
|
|
176
|
-
signal,
|
|
177
|
-
customStyles = {},
|
|
178
|
-
displayMode,
|
|
179
|
-
) {
|
|
180
|
-
const skyflow = await initializeSkyflow(vaultId, vaultUrl, baseUrl, apiKey, signal);
|
|
181
|
-
|
|
182
|
-
let collectStylesOptions = {
|
|
183
|
-
...getDefaultStyles(displayMode === DISPLAY_MODE.dark),
|
|
184
|
-
...(Object.keys(customStyles).length > 0 ? { ...customStyles } : {}),
|
|
185
|
-
...getCardFormLabels(customStyles),
|
|
186
|
-
};
|
|
187
|
-
// Create collect Container.
|
|
188
|
-
const collectContainer = await skyflow.container(Skyflow.ContainerType.COLLECT);
|
|
189
|
-
|
|
190
|
-
const cvvElement = await collectContainer.create({
|
|
191
|
-
table: "cards",
|
|
192
|
-
column: "cvv",
|
|
193
|
-
...collectStylesOptions,
|
|
194
|
-
label: "",
|
|
195
|
-
placeholder: collectStylesOptions.placeholders?.cvvPlaceholder,
|
|
196
|
-
type: Skyflow.ElementType.CVV,
|
|
197
|
-
validations: [regexMatchRule],
|
|
198
|
-
skyflowID: skyflowId,
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
handleSkyflowElementEvents(cvvElement, "", collectStylesOptions.errorTextStyles);
|
|
202
|
-
|
|
203
|
-
const elementsConfig = {
|
|
204
|
-
cvv: {
|
|
205
|
-
element: cvvElement,
|
|
206
|
-
container: `#collectCvv${skyflowId}`,
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
await mountElements(elementsConfig);
|
|
210
|
-
|
|
211
|
-
return {
|
|
212
|
-
container: collectContainer,
|
|
213
|
-
elements: {
|
|
214
|
-
cvvElement,
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
async function initializeSkyflow(vaultId, vaultUrl, baseUrl, apiKey, signal) {
|
|
220
|
-
return await Skyflow.init({
|
|
221
|
-
vaultID: vaultId,
|
|
222
|
-
vaultURL: vaultUrl,
|
|
223
|
-
getBearerToken: async () => {
|
|
224
|
-
// Pass the signal to the fetch call
|
|
225
|
-
return await getVaultToken(baseUrl, apiKey, signal);
|
|
226
|
-
},
|
|
227
|
-
options: {
|
|
228
|
-
logLevel: Skyflow.LogLevel.ERROR,
|
|
229
|
-
env: Skyflow.Env.DEV,
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
async function mountElements(elementsConfig) {
|
|
235
|
-
if (typeof elementsConfig !== "object" || elementsConfig === null) {
|
|
236
|
-
throw new Error("Invalid configuration object");
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
for (const [elementKey, { element, container }] of Object.entries(elementsConfig)) {
|
|
240
|
-
if (element && container) {
|
|
241
|
-
element.mount(container);
|
|
242
|
-
} else {
|
|
243
|
-
console.warn(`Skipping mount for '${elementKey}' due to missing element or container.`);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function handleSkyflowElementEvents(
|
|
249
|
-
element,
|
|
250
|
-
fieldMessage = "",
|
|
251
|
-
error_styles = {},
|
|
252
|
-
resetOnFocus = true,
|
|
253
|
-
requiredMessage = "Campo requerido",
|
|
254
|
-
invalidMessage = "Campo inválido",
|
|
255
|
-
focusNextElement = null,
|
|
256
|
-
) {
|
|
257
|
-
if ("on" in element) {
|
|
258
|
-
element.on(Skyflow.EventName.CHANGE, state => {
|
|
259
|
-
updateErrorLabel(element, error_styles, "transparent");
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
element.on(Skyflow.EventName.BLUR, state => {
|
|
263
|
-
if (!state.isValid) {
|
|
264
|
-
const msj_error = state.isEmpty
|
|
265
|
-
? requiredMessage
|
|
266
|
-
: fieldMessage != ""
|
|
267
|
-
? `El campo ${fieldMessage} es inválido`
|
|
268
|
-
: invalidMessage;
|
|
269
|
-
element.setError(msj_error);
|
|
270
|
-
}
|
|
271
|
-
updateErrorLabel(element, error_styles);
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
element.on(Skyflow.EventName.FOCUS, state => {
|
|
275
|
-
updateErrorLabel(element, error_styles, "transparent");
|
|
276
|
-
element.resetError();
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function updateErrorLabel(element, errorStyles, color = "") {
|
|
282
|
-
if (Object.keys(errorStyles).length > 0) {
|
|
283
|
-
element.update({
|
|
284
|
-
errorTextStyles: {
|
|
285
|
-
...errorStyles,
|
|
286
|
-
base: {
|
|
287
|
-
...(errorStyles.base && { ...errorStyles.base }),
|
|
288
|
-
...(color != "" && { color }),
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export async function getSkyflowTokens({ baseUrl, apiKey, vault_id, vault_url, data }) {
|
|
296
|
-
const skyflow = Skyflow.init({
|
|
297
|
-
vaultID: vault_id,
|
|
298
|
-
vaultURL: vault_url,
|
|
299
|
-
getBearerToken: async () => await getVaultToken(baseUrl, apiKey),
|
|
300
|
-
options: {
|
|
301
|
-
logLevel: Skyflow.LogLevel.ERROR,
|
|
302
|
-
env: Skyflow.Env.DEV,
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
const collectContainer = skyflow.container(Skyflow.ContainerType.COMPOSABLE);
|
|
307
|
-
|
|
308
|
-
const fieldPromises = await getFieldsPromise(data, collectContainer);
|
|
309
|
-
|
|
310
|
-
const result = await Promise.all(fieldPromises);
|
|
311
|
-
const mountFail = result.some(item => !item);
|
|
312
|
-
|
|
313
|
-
if (mountFail) {
|
|
314
|
-
throw buildErrorResponseFromCatch(Error("Ocurrió un error al montar los campos de la tarjeta"));
|
|
315
|
-
} else {
|
|
316
|
-
try {
|
|
317
|
-
const collectResponseSkyflowTonder = await collectContainer.collect();
|
|
318
|
-
if (collectResponseSkyflowTonder) return collectResponseSkyflowTonder["records"][0]["fields"];
|
|
319
|
-
throw buildErrorResponseFromCatch(
|
|
320
|
-
Error("Por favor, verifica todos los campos de tu tarjeta"),
|
|
321
|
-
);
|
|
322
|
-
} catch (error) {
|
|
323
|
-
throw buildErrorResponseFromCatch(error);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
async function getFieldsPromise(data, collectContainer) {
|
|
328
|
-
const fields = await getFields(data, collectContainer);
|
|
329
|
-
if (!fields) return [];
|
|
330
|
-
return fields.map(field => {
|
|
331
|
-
return new Promise(resolve => {
|
|
332
|
-
const div = document.createElement("div");
|
|
333
|
-
div.hidden = true;
|
|
334
|
-
div.id = `id-${field.key}`;
|
|
335
|
-
document.querySelector(`body`)?.appendChild(div);
|
|
336
|
-
setTimeout(() => {
|
|
337
|
-
field.element.mount(`#id-${field.key}`);
|
|
338
|
-
setInterval(() => {
|
|
339
|
-
if (field.element.isMounted()) {
|
|
340
|
-
const value = data[field.key];
|
|
341
|
-
field.element.update({ value: value });
|
|
342
|
-
return resolve(field.element.isMounted());
|
|
343
|
-
}
|
|
344
|
-
}, 120);
|
|
345
|
-
}, 120);
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
async function getFields(data, collectContainer) {
|
|
351
|
-
return await Promise.all(
|
|
352
|
-
Object.keys(data).map(async key => {
|
|
353
|
-
const cardHolderNameElement = await collectContainer.create({
|
|
354
|
-
table: "cards",
|
|
355
|
-
column: key,
|
|
356
|
-
type: Skyflow.ElementType.INPUT_FIELD,
|
|
357
|
-
});
|
|
358
|
-
return { element: cardHolderNameElement, key: key };
|
|
359
|
-
}),
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
const regexEmpty = RegExp("^(?!\s*$).+");
|
|
364
|
-
const regexMatchRule = {
|
|
365
|
-
type: Skyflow.ValidationRuleType.REGEX_MATCH_RULE,
|
|
366
|
-
params: {
|
|
367
|
-
regex: regexEmpty,
|
|
368
|
-
error: "El campo es requerido", // Optional, default error is 'VALIDATION FAILED'.
|
|
369
|
-
},
|
|
370
|
-
};
|
package/src/helpers/styles.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
export const defaultStyles = {
|
|
2
|
-
inputStyles: {
|
|
3
|
-
base: {
|
|
4
|
-
padding: "10px 7px",
|
|
5
|
-
borderRadius: "5px",
|
|
6
|
-
color: "#000000",
|
|
7
|
-
marginTop: "2px",
|
|
8
|
-
backgroundColor: "#F5F5F5",
|
|
9
|
-
fontFamily: '"Inter", sans-serif',
|
|
10
|
-
fontSize: "14px",
|
|
11
|
-
"&::placeholder": {
|
|
12
|
-
color: "#ccc",
|
|
13
|
-
},
|
|
14
|
-
fontWeight: 400,
|
|
15
|
-
},
|
|
16
|
-
cardIcon: {
|
|
17
|
-
position: "absolute",
|
|
18
|
-
left: "6px",
|
|
19
|
-
bottom: "calc(50% - 12px)",
|
|
20
|
-
},
|
|
21
|
-
complete: {
|
|
22
|
-
color: "#4caf50",
|
|
23
|
-
},
|
|
24
|
-
empty: {},
|
|
25
|
-
focus: {},
|
|
26
|
-
invalid: {
|
|
27
|
-
border: "1px solid #f44336",
|
|
28
|
-
},
|
|
29
|
-
global: {
|
|
30
|
-
"@import":
|
|
31
|
-
'url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
labelStyles: {
|
|
35
|
-
base: {
|
|
36
|
-
fontSize: "14px",
|
|
37
|
-
fontWeight: "600",
|
|
38
|
-
fontFamily: '"Inter", sans-serif',
|
|
39
|
-
color: "#333333",
|
|
40
|
-
textAlign: "start",
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
errorTextStyles: {
|
|
44
|
-
base: {
|
|
45
|
-
fontSize: "14px",
|
|
46
|
-
fontWeight: "500",
|
|
47
|
-
color: "#f44336",
|
|
48
|
-
fontFamily: '"Inter", sans-serif',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
labels: {
|
|
52
|
-
nameLabel: "Nombre del titular de la tarjeta",
|
|
53
|
-
cardLabel: "Número de tarjeta",
|
|
54
|
-
cvvLabel: "CVC/CVV",
|
|
55
|
-
expiryDateLabel: "Fecha de expiración",
|
|
56
|
-
},
|
|
57
|
-
placeholders: {
|
|
58
|
-
namePlaceholder: "Nombre del titular de la tarjeta",
|
|
59
|
-
cardPlaceholder: "1234 1234 1234 1234",
|
|
60
|
-
cvvPlaceholder: "CVV",
|
|
61
|
-
expiryMonthPlaceholder: "MM",
|
|
62
|
-
expiryYearPlaceholder: "AA",
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const getDefaultStyles = isDark => {
|
|
67
|
-
const darkBaseInputStyles = {
|
|
68
|
-
backgroundColor: "#5C5C5C",
|
|
69
|
-
color: "#FFFFFF",
|
|
70
|
-
"&::placeholder": {
|
|
71
|
-
color: "#AAAAAA",
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const darkBaseLabelStyles = {
|
|
76
|
-
color: "#FFFFFF",
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
...defaultStyles,
|
|
81
|
-
inputStyles: {
|
|
82
|
-
...defaultStyles.inputStyles,
|
|
83
|
-
base: { ...defaultStyles.inputStyles.base, ...(isDark ? { ...darkBaseInputStyles } : {}) },
|
|
84
|
-
},
|
|
85
|
-
labelStyles: {
|
|
86
|
-
...defaultStyles.labelStyles,
|
|
87
|
-
base: { ...defaultStyles.labelStyles.base, ...(isDark ? { ...darkBaseLabelStyles } : {}) },
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export const cardTemplateSkeleton = `
|
|
2
|
-
<div class="container-tonder-skeleton">
|
|
3
|
-
<div class="skeleton-loader"></div>
|
|
4
|
-
<div class="skeleton-loader"></div>
|
|
5
|
-
<div class="collect-row-skeleton">
|
|
6
|
-
<div class="skeleton-loader skeleton-loader-item"></div>
|
|
7
|
-
<div class="skeleton-loader skeleton-loader-item"></div>
|
|
8
|
-
<div class="skeleton-loader skeleton-loader-item"></div>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
<style>
|
|
13
|
-
.container-tonder-skeleton {
|
|
14
|
-
background-color: #F9F9F9;
|
|
15
|
-
margin: 0 auto !important;
|
|
16
|
-
padding: 30px 10px 30px 10px;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
transition: max-height 0.5s ease-out;
|
|
19
|
-
max-width: 600px;
|
|
20
|
-
height: 100%;
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
gap: 45px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.collect-row-skeleton {
|
|
27
|
-
display: flex !important;
|
|
28
|
-
justify-content: space-between !important;
|
|
29
|
-
margin-left: 10px !important;
|
|
30
|
-
margin-right: 10px !important;
|
|
31
|
-
gap: 10px;
|
|
32
|
-
}
|
|
33
|
-
.skeleton-loader {
|
|
34
|
-
height: 45px !important;
|
|
35
|
-
border-radius: 8px;
|
|
36
|
-
margin-top: 2px;
|
|
37
|
-
margin-bottom: 4px;
|
|
38
|
-
margin-left: 10px !important;
|
|
39
|
-
margin-right: 10px !important;
|
|
40
|
-
background-color: #e0e0e0;
|
|
41
|
-
animation: pulse 1.5s infinite ease-in-out;
|
|
42
|
-
}
|
|
43
|
-
.skeleton-loader-item{
|
|
44
|
-
width: 35%;
|
|
45
|
-
margin: 0 !important;
|
|
46
|
-
}
|
|
47
|
-
@keyframes pulse {
|
|
48
|
-
0% {
|
|
49
|
-
background-color: #e0e0e0;
|
|
50
|
-
}
|
|
51
|
-
50% {
|
|
52
|
-
background-color: #f0f0f0;
|
|
53
|
-
}
|
|
54
|
-
100% {
|
|
55
|
-
background-color: #e0e0e0;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
</style>
|
|
59
|
-
`;
|