@ikas/storefront 4.0.0-alpha.5 → 4.0.0-alpha.50

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.
Files changed (85) hide show
  1. package/package.json +13 -13
  2. package/src/analytics/analytics.ts +2 -1
  3. package/src/analytics/googleUniversal.ts +12 -2
  4. package/src/analytics/head/index.tsx +1 -2
  5. package/src/analytics/ikas.ts +25 -7
  6. package/src/components/checkout/components/address-form/index.tsx +1 -1
  7. package/src/components/checkout/components/address-form/model.ts +1 -0
  8. package/src/components/checkout/components/button/style.module.scss +2 -2
  9. package/src/components/checkout/components/cart-summary/cart-item/index.tsx +16 -29
  10. package/src/components/checkout/components/cart-summary/cart-item/style.module.scss +60 -23
  11. package/src/components/checkout/components/cart-summary/index.tsx +58 -27
  12. package/src/components/checkout/components/cart-summary/style.module.scss +48 -3
  13. package/src/components/checkout/components/customer-addresses/index.tsx +7 -2
  14. package/src/components/checkout/components/customer-addresses/model.ts +16 -8
  15. package/src/components/checkout/components/error/index.tsx +1 -1
  16. package/src/components/checkout/components/error/unknown-error/index.tsx +4 -2
  17. package/src/components/checkout/components/form-item/index.tsx +9 -11
  18. package/src/components/checkout/components/master-pass/credit-card-form/index.tsx +2 -0
  19. package/src/components/checkout/components/offer-product/index.tsx +16 -19
  20. package/src/components/checkout/components/offer-product/style.module.scss +1 -3
  21. package/src/components/checkout/components/phone-number-input/get-countries.ts +37 -5
  22. package/src/components/checkout/components/phone-number-input/index.tsx +15 -10
  23. package/src/components/checkout/index.tsx +28 -19
  24. package/src/components/checkout/model.ts +214 -91
  25. package/src/components/checkout/modelMasterPass.ts +2 -2
  26. package/src/components/checkout/steps/step-info/index.tsx +9 -3
  27. package/src/components/checkout/steps/step-payment/billing-address/index.tsx +1 -1
  28. package/src/components/checkout/steps/step-payment/index.tsx +11 -2
  29. package/src/components/checkout/steps/step-payment/payment-gateways/index.tsx +12 -3
  30. package/src/components/checkout/steps/step-payment/payment-gateways/installments/index.tsx +5 -3
  31. package/src/components/checkout/steps/step-payment/style.module.scss +5 -0
  32. package/src/components/checkout/steps/step-shipping/index.tsx +9 -4
  33. package/src/components/checkout/steps/step-success/index.tsx +15 -7
  34. package/src/components/page/head.tsx +12 -0
  35. package/src/components/page/index.tsx +10 -9
  36. package/src/components/page-editor/ThemeComponentEditor.tsx +19 -8
  37. package/src/components/page-editor/model.ts +44 -107
  38. package/src/models/data/cart/campaign-offer/index.ts +13 -2
  39. package/src/models/data/cart/index.ts +1 -1
  40. package/src/models/data/category/path-item/index.ts +4 -0
  41. package/src/models/data/checkout/index.ts +36 -4
  42. package/src/models/data/checkout-settings/price/index.ts +2 -0
  43. package/src/models/data/country/index.ts +4 -0
  44. package/src/models/data/country/location-translations/index.ts +15 -0
  45. package/src/models/data/index.ts +3 -0
  46. package/src/models/data/merchant-settings/index.ts +9 -0
  47. package/src/models/data/order/index.ts +51 -32
  48. package/src/models/data/order/line-item/base-unit/index.ts +22 -0
  49. package/src/models/data/order/line-item/base-unit/unit-type/index.ts +14 -0
  50. package/src/models/data/order/line-item/index.ts +76 -18
  51. package/src/models/data/order/line-item/variant/index.ts +8 -0
  52. package/src/models/data/order/line-item/variant/price/index.ts +2 -0
  53. package/src/models/data/order/line-item/variant/unit/index.ts +17 -0
  54. package/src/models/data/order/line-item/variant/value/index.ts +1 -1
  55. package/src/models/data/order/transaction/index.ts +2 -5
  56. package/src/models/data/product/attribute-value/index.ts +40 -0
  57. package/src/models/data/product/base-unit/index.ts +32 -0
  58. package/src/models/data/product/filter/index.ts +4 -13
  59. package/src/models/data/product/index.ts +45 -7
  60. package/src/models/data/product/option-set/index.ts +8 -3
  61. package/src/models/data/product/option-set/option/index.ts +36 -13
  62. package/src/models/data/product/variant/index.ts +26 -1
  63. package/src/models/data/product/variant/price/index.ts +25 -9
  64. package/src/models/data/product/variant/unit/index.ts +17 -0
  65. package/src/models/data/product/variant-type/index.ts +2 -0
  66. package/src/models/data/raffle/index.ts +9 -7
  67. package/src/models/data/state/index.ts +6 -2
  68. package/src/models/data/storefront/index.ts +2 -0
  69. package/src/models/data/storefront/routing/index.tsx +4 -0
  70. package/src/models/ui/product-list/index.ts +26 -17
  71. package/src/models/ui/raffle-list/index.ts +1 -1
  72. package/src/models/ui/validator/form/raffle-form.ts +16 -3
  73. package/src/models/ui/validator/rules/index.ts +14 -13
  74. package/src/page-data-init/index.ts +159 -404
  75. package/src/pages/checkout.tsx +2 -1
  76. package/src/pages/editor.tsx +5 -2
  77. package/src/store/base.ts +2 -2
  78. package/src/store/cart/index.ts +2 -2
  79. package/src/store/customer/index.ts +7 -17
  80. package/src/store/index.ts +2 -0
  81. package/src/store/raffle/index.ts +7 -10
  82. package/src/utils/constants.ts +1 -1
  83. package/src/utils/currency.ts +9 -183
  84. package/src/components/checkout/components/phone-number-input/locale/en.ts +0 -257
  85. package/src/models/data/category/init.ts +0 -33
@@ -183,6 +183,16 @@ export class EmailRule<T> extends ValidationRule<T> {
183
183
  }
184
184
  }
185
185
 
186
+ /**
187
+ * 1) start with plus(+) or digit
188
+ * 2) any digit or one char white space
189
+ * 3) end with digit
190
+ *
191
+ * For example:
192
+ * ✅ Valid +90535 555 5555
193
+ * ✅ valid 905355555555
194
+ * 🚫 Unvalid +90535 5 55 5555
195
+ */
186
196
  export class PhoneRule<T> extends ValidationRule<T> {
187
197
  get errorMessage() {
188
198
  if (!this.message) return "";
@@ -193,10 +203,8 @@ export class PhoneRule<T> extends ValidationRule<T> {
193
203
  async run(): Promise<boolean> {
194
204
  if (!this.value) return true;
195
205
 
196
- const result = this.value.match(/\d/g);
197
- return (
198
- (!!result && result.length <= 11) || !!/^\+(\d{12})$/gm.test(this.value)
199
- );
206
+ const result = this.value.match(/^[\+\d](\d+\s)*\d+$/g);
207
+ return !!result;
200
208
  }
201
209
  }
202
210
 
@@ -246,15 +254,8 @@ export class IdentityNumberRule<T> extends ValidationRule<T> {
246
254
  TCSum = 0;
247
255
 
248
256
  const incorrect = [
249
- 11111111110,
250
- 22222222220,
251
- 33333333330,
252
- 44444444440,
253
- 55555555550,
254
- 66666666660,
255
- 7777777770,
256
- 88888888880,
257
- 99999999990,
257
+ 11111111110, 22222222220, 33333333330, 44444444440, 55555555550,
258
+ 66666666660, 7777777770, 88888888880, 99999999990,
258
259
  ];
259
260
 
260
261
  if (tcknString.length !== 11) return false;