tonder-web-sdk 1.9.2-beta.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tonder-web-sdk",
3
- "version": "1.9.2-beta.1",
3
+ "version": "1.9.2-beta.2",
4
4
  "description": "tonder sdk for integrations",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -107,6 +107,11 @@ export async function initSkyflow(
107
107
  validations: [regexMatchRule],
108
108
  });
109
109
 
110
+ handleSkyflowElementEvents(
111
+ cvvElement,
112
+ ""
113
+ );
114
+
110
115
  const expiryMonthElement = await collectContainer.create({
111
116
  table: "cards",
112
117
  column: "expiration_month",
@@ -117,6 +122,12 @@ export async function initSkyflow(
117
122
  validations: [regexMatchRule],
118
123
  });
119
124
 
125
+ handleSkyflowElementEvents(
126
+ expiryMonthElement,
127
+ ""
128
+ );
129
+
130
+
120
131
  const expiryYearElement = await collectContainer.create({
121
132
  table: "cards",
122
133
  column: "expiration_year",
@@ -127,6 +138,12 @@ export async function initSkyflow(
127
138
  validations: [regexMatchRule],
128
139
  });
129
140
 
141
+ handleSkyflowElementEvents(
142
+ expiryYearElement,
143
+ "",
144
+ false
145
+ );
146
+
130
147
  await mountElements(
131
148
  cardNumberElement,
132
149
  cvvElement,
@@ -162,7 +179,7 @@ async function mountElements(
162
179
  }
163
180
 
164
181
 
165
- function handleSkyflowElementEvents(element, fieldMessage= "", requiredMessage = "El campo es requerido", invalidMessage= "El campo es inválido") {
182
+ function handleSkyflowElementEvents(element, fieldMessage= "", resetOnFocus = true, requiredMessage = "El campo es requerido", invalidMessage= "El campo es inválido") {
166
183
  if ("on" in element) {
167
184
  element.on(Skyflow.EventName.CHANGE, (state) => {
168
185
  if (state.isValid && !state.isEmpty) {
@@ -178,7 +195,9 @@ function handleSkyflowElementEvents(element, fieldMessage= "", requiredMessage =
178
195
  });
179
196
 
180
197
  element.on(Skyflow.EventName.FOCUS, (state) => {
181
- element.resetError();
198
+ if(resetOnFocus){
199
+ element.resetError();
200
+ }
182
201
  });
183
202
  }
184
203
  }