@odus/checkout 1.5.1 → 1.6.0

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.
@@ -238,10 +238,10 @@ var x = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
238
238
  let n = j.has(t), r = j.has(e);
239
239
  if (n && r && t !== e) {
240
240
  let { t } = o(), n = e, r = t(n === "US" ? "address.chooseState" : "address.chooseProvince");
241
- this._select?.setOptions(p(n), r), this._value = "";
241
+ this._select?.setOptions(p(n), r), this._value = "", this.emit("change", this._value);
242
242
  return;
243
243
  }
244
- n !== r && (this._value = "", this.render());
244
+ n !== r && (this._value = "", this.render(), this.emit("change", this._value));
245
245
  }
246
246
  render() {
247
247
  if (this.shadowRoot) if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, j.has(this._country)) {
@@ -259,10 +259,11 @@ var x = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
259
259
  value: this._value,
260
260
  autocomplete: "address-level1",
261
261
  onChange: (e) => {
262
- this._value = e.target.value, this.emit("change", this._value);
262
+ this._value = e.target.value, this._input?.setError(!1), this.emit("change", this._value);
263
263
  }
264
264
  }), this._input.addEventListener("blur", () => {
265
- this.emit("blur", this._value);
265
+ let e = this.getIsValid();
266
+ this._input?.setError(!e, this.getError() ?? void 0), this.emit("blur", this._value);
266
267
  }), this.shadowRoot.appendChild(this._input.getElement());
267
268
  }
268
269
  _renderSelect(e) {
@@ -276,10 +277,11 @@ var x = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
276
277
  options: n,
277
278
  autocomplete: "address-level1",
278
279
  onChange: (e) => {
279
- this._value = e.target.value, this.emit("change", this._value);
280
+ this._value = e.target.value, this._select?.setError(!1), this.emit("change", this._value);
280
281
  }
281
282
  }), this._select.addEventListener("blur", () => {
282
- this.emit("blur", this._value);
283
+ let e = this.getIsValid();
284
+ this._select?.setError(!e, this.getError() ?? void 0), this.emit("blur", this._value);
283
285
  }), this.shadowRoot.appendChild(this._select.getElement());
284
286
  }
285
287
  getCss() {
@@ -294,10 +296,12 @@ var x = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
294
296
  return this._value;
295
297
  }
296
298
  getIsValid() {
297
- return !0;
299
+ return this._select ? this._value.trim().length > 0 : !0;
298
300
  }
299
301
  getError() {
300
- return null;
302
+ if (this.getIsValid()) return null;
303
+ let { t: e } = o();
304
+ return e("validation.stateRequired");
301
305
  }
302
306
  }, N = class extends T {
303
307
  _value = "";
@@ -659,7 +663,7 @@ var x = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
659
663
  }
660
664
  _reinitWithTheme() {
661
665
  this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
662
- this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new t(), this.initVgs();
666
+ this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new t(), this._section?.setVgsService(this._vgsService), this.initVgs();
663
667
  }, 300);
664
668
  }
665
669
  _buildProfileFromTheme(e) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odus/checkout",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "displayName": "Odus Checkout SDK",
5
5
  "keywords": [
6
6
  "odus",
@@ -126,7 +126,7 @@
126
126
  "dependencies": {
127
127
  "@vgs/collect-js": "^0.8.0",
128
128
  "jsencrypt": "^3.5.4",
129
- "libphonenumber-js": "^1.12.36"
129
+ "libphonenumber-js": "^1.13.6"
130
130
  },
131
131
  "devDependencies": {
132
132
  "@types/applepayjs": "^14.0.9"