@weareconceptstudio/account 0.0.7 → 0.0.8

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 (87) hide show
  1. package/dist/AccountProvider.d.ts +4 -1
  2. package/dist/AccountProvider.js +9 -7
  3. package/dist/components/EmptyOrders/index.js +5 -4
  4. package/dist/components/OrderedItems/index.d.ts +1 -1
  5. package/dist/components/OrderedItems/index.js +4 -37
  6. package/dist/components/cart/Items/Simple/Item/index.js +6 -13
  7. package/dist/components/cart/Items/Simple/ItemMobile/index.js +2 -15
  8. package/dist/components/cart/Items/Simple/index.js +3 -3
  9. package/dist/components/index.d.ts +0 -6
  10. package/dist/components/index.js +0 -6
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/modules/address/AddressForm/index.js +44 -0
  14. package/dist/{components → modules/address}/AddressItem/index.d.ts +2 -4
  15. package/dist/{components → modules/address}/AddressItem/index.js +11 -11
  16. package/dist/modules/address/AddressProvider.d.ts +7 -0
  17. package/dist/modules/address/AddressProvider.js +57 -0
  18. package/dist/{components → modules/address}/AddressWrap/index.d.ts +3 -2
  19. package/dist/{components → modules/address}/AddressWrap/index.js +7 -7
  20. package/dist/modules/address/AddressesTemplate/index.d.ts +3 -0
  21. package/dist/modules/address/AddressesTemplate/index.js +11 -0
  22. package/dist/modules/address/SelectAddress/index.d.ts +6 -0
  23. package/dist/modules/address/SelectAddress/index.js +22 -0
  24. package/dist/modules/address/SelectAddress/style.d.ts +2 -0
  25. package/dist/modules/address/SelectAddress/style.js +68 -0
  26. package/dist/modules/address/SelectShippingBilling/index.d.ts +3 -0
  27. package/dist/modules/address/SelectShippingBilling/index.js +29 -0
  28. package/dist/modules/address/SelectShippingBillingPopup/index.d.ts +3 -0
  29. package/dist/modules/address/SelectShippingBillingPopup/index.js +25 -0
  30. package/dist/{components/SelectShippingBilling → modules/address/SelectShippingBillingPopup}/style.js +0 -43
  31. package/dist/modules/address/ShippingBillingForm/index.js +15 -0
  32. package/dist/modules/address/index.d.ts +9 -0
  33. package/dist/modules/address/index.js +9 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/templates/AccountSettingsTemplate/AccountInfo/index.js +1 -1
  37. package/dist/templates/CartTemplate/index.d.ts +1 -2
  38. package/dist/templates/CartTemplate/index.js +6 -5
  39. package/dist/templates/CheckoutTemplate/StepReview/index.d.ts +3 -0
  40. package/dist/templates/CheckoutTemplate/StepReview/index.js +8 -0
  41. package/dist/templates/CheckoutTemplate/StepShipping/index.d.ts +5 -0
  42. package/dist/templates/CheckoutTemplate/StepShipping/index.js +9 -0
  43. package/dist/templates/CheckoutTemplate/index.d.ts +2 -2
  44. package/dist/templates/CheckoutTemplate/index.js +30 -149
  45. package/dist/templates/CheckoutTemplate/style.js +9 -9
  46. package/dist/templates/OrderIndividualTemplate/index.js +1 -1
  47. package/dist/templates/index.d.ts +0 -1
  48. package/dist/templates/index.js +0 -1
  49. package/dist/translations/en.d.ts +72 -133
  50. package/dist/translations/en.js +84 -133
  51. package/dist/translations/hy.d.ts +6 -0
  52. package/dist/translations/hy.js +6 -0
  53. package/dist/translations/index.d.ts +84 -133
  54. package/dist/translations/ru.d.ts +6 -0
  55. package/dist/translations/ru.js +6 -0
  56. package/dist/utils/_functions.d.ts +0 -3
  57. package/dist/utils/_functions.js +0 -10
  58. package/package.json +1 -1
  59. package/dist/components/AddressForm/index.js +0 -99
  60. package/dist/components/FavoriteButton/index.d.ts +0 -3
  61. package/dist/components/FavoriteButton/index.js +0 -42
  62. package/dist/components/OrderedItems/ReviewPopup/index.d.ts +0 -0
  63. package/dist/components/OrderedItems/ReviewPopup/index.js +0 -202
  64. package/dist/components/OrderedItems/ReviewPopup/style.d.ts +0 -2
  65. package/dist/components/OrderedItems/ReviewPopup/style.js +0 -329
  66. package/dist/components/SelectShippingBilling/index.d.ts +0 -3
  67. package/dist/components/SelectShippingBilling/index.js +0 -31
  68. package/dist/components/ShippingBillingForm/index.js +0 -96
  69. package/dist/templates/AddressesTemplate/index.d.ts +0 -6
  70. package/dist/templates/AddressesTemplate/index.js +0 -9
  71. /package/dist/{components → modules/address}/AddressForm/index.d.ts +0 -0
  72. /package/dist/{components → modules/address}/AddressForm/style.d.ts +0 -0
  73. /package/dist/{components → modules/address}/AddressForm/style.js +0 -0
  74. /package/dist/{components → modules/address}/AddressItem/style.d.ts +0 -0
  75. /package/dist/{components → modules/address}/AddressItem/style.js +0 -0
  76. /package/dist/{templates → modules/address}/AddressesTemplate/style.d.ts +0 -0
  77. /package/dist/{templates → modules/address}/AddressesTemplate/style.js +0 -0
  78. /package/dist/{components → modules/address}/EmptyAddress/index.d.ts +0 -0
  79. /package/dist/{components → modules/address}/EmptyAddress/index.js +0 -0
  80. /package/dist/{components/SelectShippingBilling → modules/address/SelectShippingBillingPopup}/style.d.ts +0 -0
  81. /package/dist/{components → modules/address}/ShippingBillingForm/index.d.ts +0 -0
  82. /package/dist/{components → modules/address}/ShippingBillingForm/style.d.ts +0 -0
  83. /package/dist/{components → modules/address}/ShippingBillingForm/style.js +0 -0
  84. /package/dist/{components → modules/address}/ShippingBillingInfo/index.d.ts +0 -0
  85. /package/dist/{components → modules/address}/ShippingBillingInfo/index.js +0 -0
  86. /package/dist/{components → modules/address}/ShippingBillingInfo/style.d.ts +0 -0
  87. /package/dist/{components → modules/address}/ShippingBillingInfo/style.js +0 -0
@@ -1,32 +1,20 @@
1
1
  declare const _default: {
2
2
  en: {
3
- saveAndApply: string;
4
- addNewAdd: string;
5
3
  editCart: string;
6
4
  shopNow: string;
7
- firstName: string;
8
- lastName: string;
9
- email: string;
10
- phone: string;
11
- password: string;
12
5
  noData: string;
13
- contactUs: string;
14
6
  privacyPolicy: string;
15
7
  welcomeBack: string;
16
8
  login: string;
17
- forgotPasswordLink: string;
18
9
  accountText: string;
19
10
  joinNow: string;
11
+ forgotPasswordLink: string;
20
12
  forgotPassword: string;
21
13
  forgotPasswordDescription: string;
22
- submit: string;
23
14
  thankYou: string;
24
15
  recoveryText: string;
25
16
  tryAgainText: string;
26
17
  tryAgain: string;
27
- newPassword: string;
28
- confirmNewPassword: string;
29
- resetPassword: string;
30
18
  successfullyMessage: string;
31
19
  registration: string;
32
20
  alreadyHaveAnAccount: string;
@@ -45,75 +33,115 @@ declare const _default: {
45
33
  codeResendSuccessTitle: string;
46
34
  codeResendSuccessSubtitle: string;
47
35
  myAccount: string;
36
+ accountInformation: string;
48
37
  accountSettings: string;
49
38
  orderHistory: string;
50
- addresses: string;
51
39
  signOut: string;
52
- accountInformation: string;
53
- edit: string;
40
+ firstName: string;
54
41
  first_name: string;
42
+ firstNamePlaceholder: string;
55
43
  last_name: string;
56
- phone_: string;
44
+ lastName: string;
45
+ lastNamePlaceholder: string;
57
46
  email_: string;
47
+ emailPlaceholder: string;
48
+ email: string;
49
+ phone: string;
50
+ phone_: string;
51
+ phone_input: string;
52
+ phonePlaceholder: string;
53
+ password: string;
58
54
  password_: string;
59
55
  password_title: string;
60
- cancel: string;
61
- phone_input: string;
62
- enterCurrentPassword: string;
63
- enterNewPassword: string;
64
- firstNamePlaceholder: string;
65
- lastNamePlaceholder: string;
66
- emailPlaceholder: string;
67
56
  passwordPlaceholder: string;
68
- phonePlaceholder: string;
57
+ enterCurrentPassword: string;
69
58
  enterCurrentPasswordPlaceholder: string;
59
+ enterNewPassword: string;
70
60
  enterNewPasswordPlaceholder: string;
71
61
  newPasswordPlaceholder: string;
72
62
  confirmNewPasswordPlaceholder: string;
63
+ recoverPassword: string;
64
+ recoverPasswordDesc: string;
65
+ newPassword: string;
66
+ confirmNewPassword: string;
67
+ resetPassword: string;
73
68
  emptyTitle: string;
74
69
  emptyDesc: string;
70
+ cancel: string;
71
+ canceled: string;
72
+ backToList: string;
73
+ saveChanges: string;
74
+ continueToShop: string;
75
+ saveAndApply: string;
76
+ remove: string;
77
+ goHome: string;
78
+ change: string;
79
+ edit: string;
80
+ submit: string;
81
+ orderItems: string;
75
82
  orderDate: string;
76
83
  totalItems: string;
77
84
  orderNumber: string;
78
85
  orderStatus: string;
79
86
  totalPrice: string;
80
87
  viewOrder: string;
81
- sortBy: string;
82
- sortByWithSymbol: string;
83
- delivered: string;
84
- canceled: string;
85
88
  inProgress: string;
86
89
  orderDetails: string;
87
90
  deliverDate: string;
91
+ sortBy: string;
92
+ sortByWithSymbol: string;
93
+ delivered: string;
94
+ addresses: string;
95
+ address: string;
88
96
  shippingAndBillingInfo: string;
89
97
  shippedTo: string;
90
- backToList: string;
91
- item: string;
92
- quantity: string;
93
- price: string;
94
- total: string;
95
- orderItems: string;
96
- billedTo: string;
97
- color: string;
98
- size: string;
99
- clearAll: string;
98
+ addNewAdd: string;
100
99
  shippingAddress: string;
101
100
  billingAddress: string;
102
101
  emptyAddress: string;
103
- default: string;
104
- remove: string;
105
102
  deleteAddressMessage: string;
106
103
  confirmDeleteAddress: string;
104
+ addNewAddress: string;
107
105
  addNewShippingAddress: string;
108
106
  addNewBillingAddress: string;
107
+ updateYourAddress: string;
109
108
  updateYourShippingAddress: string;
110
109
  updateYourBillingAddress: string;
110
+ thisYourDefaultAddress: string;
111
111
  thisYourDefaultShippingAddress: string;
112
112
  thisYourDefaultBillingAddress: string;
113
113
  makeYourDefaultShippingAddress: string;
114
114
  makeYourDefaultBillingAddress: string;
115
+ makeYourDefaultAddress: string;
116
+ defaultAddress: string;
115
117
  defaultShippingAddress: string;
116
118
  defaultBillingAddress: string;
119
+ addToCart: string;
120
+ addedToCart: string;
121
+ quantityWithSymbol: string;
122
+ free: string;
123
+ shippingCost: string;
124
+ cartEmpty: string;
125
+ cartEmptyDesc: string;
126
+ orderSummary: string;
127
+ subtotal: string;
128
+ shipping: string;
129
+ myCart: string;
130
+ proceedToCheckout: string;
131
+ continueShopping: string;
132
+ proceedToPayment: string;
133
+ checkoutCommentPlaceholder: string;
134
+ item: string;
135
+ quantity: string;
136
+ price: string;
137
+ total: string;
138
+ yourSettingsHaveBeenSaved: string;
139
+ yourPasswordHaveBeenChanged: string;
140
+ removeAccount: string;
141
+ deleteYourAccount: string;
142
+ deleteYourAccountDesc: string;
143
+ billedTo: string;
144
+ default: string;
117
145
  country: string;
118
146
  countryPlaceholder: string;
119
147
  address_1: string;
@@ -124,108 +152,19 @@ declare const _default: {
124
152
  zipCodePlaceholder: string;
125
153
  city: string;
126
154
  cityPlaceholder: string;
127
- address_1IsRequired: string;
128
- cityIsRequired: string;
129
- zip_codeIsRequired: string;
130
155
  done: string;
131
- outOfStock: string;
132
- cartEmpty: string;
133
- cartEmptyDesc: string;
134
- orderSummary: string;
135
- subtotal: string;
136
- shipping: string;
137
- proceedToCheckout: string;
138
- continueShopping: string;
139
- myCart: string;
140
- addToWishlist: string;
141
- productDetails: string;
142
- shippingInformation: string;
143
- productSku: string;
144
- colorCode: string;
145
- message404Title: string;
146
- message404Desc: string;
147
- goHome: string;
148
156
  useAlsoBillingAddress: string;
149
- review: string;
157
+ shippingInformation: string;
150
158
  payment: string;
151
159
  confirmation: string;
152
- change: string;
153
160
  billing: string;
154
161
  selectShippingAddress: string;
155
162
  selectBillingAddress: string;
156
- confirmMessageTitle: string;
157
- confirmMessageDesc: string;
158
- mostPopular: string;
159
- trendingProducts: string;
160
- youMayAlsoLike: string;
161
- mostWanted: string;
162
163
  all: string;
163
164
  by: string;
164
- read: string;
165
- blogIndSendEmailText: string;
166
- frequentlyAskedQuestions: string;
167
- followUsDesc: string;
168
165
  view: string;
169
- addToCart: string;
170
- addedToCart: string;
171
- resetAllFilters: string;
172
- readingMaterial: string;
173
- subscribeSectionPlaceholder: string;
174
- subscribeSectionBtnText: string;
175
- partnership: string;
176
- quantityWithSymbol: string;
177
- saveChanges: string;
178
- yourSettingsHaveBeenSaved: string;
179
- yourPasswordHaveBeenChanged: string;
180
- oopsNoResults: string;
181
- searchEmptyMessage: string;
182
- removeAccount: string;
183
- recoverPassword: string;
184
- recoverPasswordDesc: string;
185
- deleteYourAccount: string;
186
- deleteYourAccountDesc: string;
187
- zeroItems: string;
188
- zeroItemsDesc: string;
189
- myWishlist: string;
190
- removeFromList: string;
191
- city_idIsRequired: string;
192
- warningMessageFirstPart: string;
193
- warningMessageSecondPart: string;
194
- proceedToPayment: string;
195
- checkoutCommentPlaceholder: string;
196
- footerEmailIsRequired: string;
197
- free: string;
198
- shippingCost: string;
199
- addToTheRegistry: string;
200
- addedToTheRegistry: string;
201
- recommended: string;
202
- writeReview: string;
203
- editReview: string;
204
- writeReviewDesc: string;
205
- writeYourReview: string;
206
- writeYourReviewDesc1: string;
207
- reviewGuidelinesWithSymbol: string;
208
- writeYourReviewDesc2: string;
209
- contactUsWithSymbol: string;
210
- yourOverallRating: string;
211
- wouldYouRecommend: string;
212
- yes: string;
213
- no: string;
214
- reviewTitle: string;
215
- type: string;
216
- yourReview: string;
217
- upload: string;
218
- submitReview: string;
219
- is_recommendedIsRequired: string;
220
- productReviewGuidelines: string;
221
- archiveRegistry: string;
222
- noteMessage: string;
223
- iRecommendThisProduct: string;
224
- removeRegistryPopupTitle: string;
225
- removeRegistryPopupDesc: string;
226
- thankYouPopupTitle: string;
227
- thankYouPopupDesc: string;
228
- continueToShop: string;
166
+ confirmMessageTitle: string;
167
+ confirmMessageDesc: string;
229
168
  };
230
169
  hy: {
231
170
  saveAndApply: string;
@@ -276,6 +215,7 @@ declare const _default: {
276
215
  accountSettings: string;
277
216
  orderHistory: string;
278
217
  addresses: string;
218
+ address: string;
279
219
  signOut: string;
280
220
  accountInformation: string;
281
221
  edit: string;
@@ -332,14 +272,19 @@ declare const _default: {
332
272
  remove: string;
333
273
  deleteAddressMessage: string;
334
274
  confirmDeleteAddress: string;
275
+ addNewAddress: string;
335
276
  addNewShippingAddress: string;
336
277
  addNewBillingAddress: string;
278
+ updateYourAddress: string;
337
279
  updateYourShippingAddress: string;
338
280
  updateYourBillingAddress: string;
281
+ thisYourDefaultAddress: string;
339
282
  thisYourDefaultShippingAddress: string;
340
283
  thisYourDefaultBillingAddress: string;
341
284
  makeYourDefaultShippingAddress: string;
342
285
  makeYourDefaultBillingAddress: string;
286
+ makeYourDefaultAddress: string;
287
+ defaultAddress: string;
343
288
  defaultShippingAddress: string;
344
289
  defaultBillingAddress: string;
345
290
  country: string;
@@ -433,6 +378,7 @@ declare const _default: {
433
378
  accountSettings: string;
434
379
  orderHistory: string;
435
380
  addresses: string;
381
+ address: string;
436
382
  signOut: string;
437
383
  accountInformation: string;
438
384
  edit: string;
@@ -489,14 +435,19 @@ declare const _default: {
489
435
  remove: string;
490
436
  deleteAddressMessage: string;
491
437
  confirmDeleteAddress: string;
438
+ addNewAddress: string;
492
439
  addNewShippingAddress: string;
493
440
  addNewBillingAddress: string;
441
+ updateYourAddress: string;
494
442
  updateYourShippingAddress: string;
495
443
  updateYourBillingAddress: string;
444
+ thisYourDefaultAddress: string;
496
445
  thisYourDefaultShippingAddress: string;
497
446
  thisYourDefaultBillingAddress: string;
498
447
  makeYourDefaultShippingAddress: string;
499
448
  makeYourDefaultBillingAddress: string;
449
+ makeYourDefaultAddress: string;
450
+ defaultAddress: string;
500
451
  defaultShippingAddress: string;
501
452
  defaultBillingAddress: string;
502
453
  country: string;
@@ -47,6 +47,7 @@ declare const _default: {
47
47
  accountSettings: string;
48
48
  orderHistory: string;
49
49
  addresses: string;
50
+ address: string;
50
51
  signOut: string;
51
52
  accountInformation: string;
52
53
  edit: string;
@@ -103,14 +104,19 @@ declare const _default: {
103
104
  remove: string;
104
105
  deleteAddressMessage: string;
105
106
  confirmDeleteAddress: string;
107
+ addNewAddress: string;
106
108
  addNewShippingAddress: string;
107
109
  addNewBillingAddress: string;
110
+ updateYourAddress: string;
108
111
  updateYourShippingAddress: string;
109
112
  updateYourBillingAddress: string;
113
+ thisYourDefaultAddress: string;
110
114
  thisYourDefaultShippingAddress: string;
111
115
  thisYourDefaultBillingAddress: string;
112
116
  makeYourDefaultShippingAddress: string;
113
117
  makeYourDefaultBillingAddress: string;
118
+ makeYourDefaultAddress: string;
119
+ defaultAddress: string;
114
120
  defaultShippingAddress: string;
115
121
  defaultBillingAddress: string;
116
122
  country: string;
@@ -47,6 +47,7 @@ export default {
47
47
  accountSettings: 'Настройки аккаунта',
48
48
  orderHistory: 'История заказов',
49
49
  addresses: 'Адреса',
50
+ address: 'Адрес',
50
51
  signOut: 'Выйти',
51
52
  accountInformation: 'Информация аккаунта',
52
53
  edit: 'Редактировать',
@@ -103,14 +104,19 @@ export default {
103
104
  remove: 'Удалить',
104
105
  deleteAddressMessage: 'Вы уверены, что хотите удалить этот адрес?',
105
106
  confirmDeleteAddress: 'Пожалуйста, подтвердите удаление адреса.',
107
+ addNewAddress: 'Добавить новый адрес',
106
108
  addNewShippingAddress: 'Добавить новый адрес доставки',
107
109
  addNewBillingAddress: 'Добавить новый адрес оплаты',
110
+ updateYourAddress: 'Обновите адрес',
108
111
  updateYourShippingAddress: 'Обновите адрес доставки',
109
112
  updateYourBillingAddress: 'Обновите адрес оплаты',
113
+ thisYourDefaultAddress: 'Это ваш адрес по умолчанию.',
110
114
  thisYourDefaultShippingAddress: 'Это ваш адрес доставки по умолчанию.',
111
115
  thisYourDefaultBillingAddress: 'Это ваш адрес оплаты по умолчанию.',
112
116
  makeYourDefaultShippingAddress: 'Сделать адресом доставки по умолчанию.',
113
117
  makeYourDefaultBillingAddress: 'Сделать адресом оплаты по умолчанию.',
118
+ makeYourDefaultAddress: 'Сделать адресом по умолчанию.',
119
+ defaultAddress: 'Адрес по умолчанию',
114
120
  defaultShippingAddress: 'Адрес доставки по умолчанию',
115
121
  defaultBillingAddress: 'Адрес оплаты по умолчанию',
116
122
  country: 'Страна',
@@ -1,5 +1,2 @@
1
1
  export function numToLocalString(num: any): any;
2
2
  export function handlePriceCheckFunc(price: any, currency?: any): string;
3
- export function getUserToken(): any;
4
- export function setUserToken(token: any): void;
5
- export function removeUserToken(): void;
@@ -1,4 +1,3 @@
1
- import { getCookie, removeCookie, setCookie } from '@weareconceptstudio/core';
2
1
  export const numToLocalString = (num) => {
3
2
  if (typeof num === 'string') {
4
3
  return Number(num).toLocaleString();
@@ -17,12 +16,3 @@ export const handlePriceCheckFunc = (price, currency = null) => {
17
16
  return `${numToLocalString(typeof val === 'object' ? val[0] : val)} ${currency}`;
18
17
  }
19
18
  };
20
- export const getUserToken = () => {
21
- return getCookie(process.env.APP_USER_TOKEN_KEY);
22
- };
23
- export const setUserToken = (token) => {
24
- return setCookie(process.env.APP_USER_TOKEN_KEY, token);
25
- };
26
- export const removeUserToken = () => {
27
- return removeCookie(process.env.APP_USER_TOKEN_KEY);
28
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weareconceptstudio/account",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Concept Studio Account",
5
5
  "author": "Concept Studio",
6
6
  "license": "ISC",
@@ -1,99 +0,0 @@
1
- import React, { memo as Memo, useState, useCallback, useRef } from 'react';
2
- import { useUi, Text } from '@weareconceptstudio/core';
3
- import { Form, Input, PhoneNumber, Select } from '@weareconceptstudio/form';
4
- import AccountButton from '../ui/AccountButton';
5
- import { useTheme } from 'styled-components';
6
- import theme from '../../styles/theme';
7
- //* Icons
8
- import { CheckboxIcon, CheckboxCheckedIcon } from '../../utils/icons';
9
- //* Style
10
- import AddressFormStyle from './style';
11
- //TODO: Form -> ref, onChange, Select, Form Item -> options,Global Data
12
- const globalData = {
13
- countries: [],
14
- cities: [],
15
- regions: [
16
- { value: 'yerevan', label: 'Yerevan' },
17
- { value: 'shirak', label: 'Shirak' },
18
- { value: 'aragatsotn', label: 'Aragatsotn' },
19
- { value: 'lori', label: 'Lori' },
20
- { value: 'kotayq', label: 'Kotayq' },
21
- { value: 'tavush', label: 'Tavush' },
22
- { value: 'vayots-dzor', label: 'Vayots Dzor' },
23
- { value: 'syuniq', label: 'Syuniq' },
24
- { value: 'ararat', label: 'Ararat' },
25
- { value: 'armavir', label: 'Armavir' },
26
- { value: 'gegharquniq', label: 'Gegharquniq' },
27
- ],
28
- };
29
- const AddressForm = Memo(({ title, data, selected, createAddress, updateAddress }) => {
30
- const globalTheme = useTheme();
31
- const { closePopup } = useUi();
32
- //! Ref
33
- const form = useRef();
34
- //! States
35
- const [isChecked, setIsChecked] = useState(data?.is_default);
36
- const [countryId, setCountryId] = useState(globalData.countries.length > 1 ? data?.country_id : 1);
37
- const [regionId, setRegionId] = useState(data?.region_id);
38
- const [isDisabled, setIsDisabled] = useState(false);
39
- //! On Finish
40
- const onFinish = useCallback((values) => {
41
- // const newData = { ...values, is_default: isChecked };
42
- // setIsDisabled(true);
43
- // return (
44
- // !isDisabled &&
45
- // eval(data?.id ? `updateAddress(newData, data.id)` : `createAddress(newData)`).then(
46
- // () => {
47
- // closePopup();
48
- // }
49
- // )
50
- // );
51
- }, [data, isChecked, createAddress, updateAddress, isDisabled]);
52
- const handleFormChange = useCallback((val) => {
53
- const name = Object.keys(val)[0];
54
- if (name === 'country_id') {
55
- setCountryId(val[name]);
56
- setRegionId('');
57
- form.current.setFieldsValue({ region_id: '', city_id: '' });
58
- }
59
- else if (name === 'region_id') {
60
- setRegionId(val[name]);
61
- form.current.setFieldsValue({ city_id: '' });
62
- }
63
- }, []);
64
- return (React.createElement(AddressFormStyle, { theme: theme(globalTheme), className: 'address-form-block' },
65
- React.createElement(Text, { tag: `h6`, text: title, className: `account-h6 account-font-bold account-primary-color1 address-form-block-title` }),
66
- React.createElement(Form, { ref: form, onSubmit: onFinish, onChange: handleFormChange, initialValues: data },
67
- React.createElement("div", { className: `form-wrapper` },
68
- React.createElement(Form.Item, { name: 'country_id', label: 'country' },
69
- React.createElement(Select, { placeholder: 'Armenia',
70
- // options={globalData.regions}
71
- disabled: true })),
72
- React.createElement(Form.Item, { name: 'type', required: false },
73
- React.createElement(Input, { type: 'hidden' })),
74
- React.createElement(Form.Item, { name: 'first_name', label: 'firstName' },
75
- React.createElement(Input, { placeholder: 'firstNamePlaceholder' })),
76
- React.createElement(Form.Item, { name: 'last_name', label: 'lastName' },
77
- React.createElement(Input, { placeholder: 'lastNamePlaceholder' })),
78
- React.createElement(Form.Item, { name: 'region_id', label: 'region', className: !countryId ? 'disabled' : '' },
79
- React.createElement(Select, { placeholder: 'Select Region', options: globalData.regions })),
80
- React.createElement(Form.Item, { name: 'city_id', label: 'city' },
81
- React.createElement(Select, { placeholder: 'cityPlaceholder', disabled: !regionId })),
82
- React.createElement(Form.Item, { name: 'address_1', label: 'address_1' },
83
- React.createElement(Input, { placeholder: 'address_1Placeholder' })),
84
- React.createElement(Form.Item, { name: 'address_2', label: 'address_2' },
85
- React.createElement(Input, { placeholder: 'address_2Placeholder' })),
86
- React.createElement(Form.Item, { name: 'zip_code', label: 'zipCode' },
87
- React.createElement(Input.Number, { placeholder: 'zipCodePlaceholder' })),
88
- React.createElement(Form.Item, { name: 'phone', label: 'phone' },
89
- React.createElement(PhoneNumber, null))),
90
- React.createElement("div", { className: `default-info-wrap` }, !data?.is_default ? (React.createElement("div", { className: `banner-wrap cursor-pointer`, onClick: () => setIsChecked(!isChecked) },
91
- isChecked ? (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
92
- React.createElement(CheckboxCheckedIcon, null))) : (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
93
- React.createElement(CheckboxIcon, null))),
94
- React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1 address-form-is-default-checkbox`, text: `${selected.type === 'shipping' ? 'makeYourDefaultShippingAddress' : 'makeYourDefaultBillingAddress'}` }))) : (React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1 address-form-is-default`, text: `${selected.type === 'shipping' ? 'thisYourDefaultShippingAddress' : 'thisYourDefaultBillingAddress'}` }))),
95
- React.createElement("div", { className: `cancel-and-save-wrap` },
96
- React.createElement(AccountButton, { text: `cancel`, onClick: closePopup, btnType: `green-large-text`, className: `address-form-cancel-btn` }),
97
- React.createElement(AccountButton, { type: 'submit', text: `saveAndApply`, btnType: `full-width`, className: `address-form-cancel-submit ${isDisabled ? 'disabled' : ''}` })))));
98
- });
99
- export default AddressForm;
@@ -1,3 +0,0 @@
1
- export default FavoriteButton;
2
- declare const FavoriteButton: React.NamedExoticComponent<object>;
3
- import React from 'react';
@@ -1,42 +0,0 @@
1
- import React, { memo, useCallback, useMemo } from 'react';
2
- import Button from '../ui/AccountButton';
3
- const addToFavorite = () => { };
4
- const removeFavorite = () => { };
5
- //* Icons
6
- const favoriteIcon = (React.createElement("svg", { version: '1.1', viewBox: '0 0 32 32', xmlns: 'http://www.w3.org/2000/svg' },
7
- React.createElement("path", { id: 'path-1', fill: '#ecefec', d: 'M14.622 0l-12.889 7.911-1.733 13.867 7.822 8.8 13.911 1.422 10.267-11.689-3.6-16.711-13.778-3.6z' }),
8
- React.createElement("path", { id: 'path-2', fill: '#8c9b8b', d: 'M17.066 24.8c-0.178 0-0.267-0.044-0.356-0.178l-10.667-9.911c-0.222-0.222-0.222-0.533-0.044-0.756l4.622-5.511c0.178-0.222 0.444-0.267 0.622-0.089l5.689 3.111 3.733-4.089c0.089-0.089 0.267-0.178 0.444-0.178s0.311 0.044 0.356 0.222l4.489 5.467c0.178 0.222 0.178 0.489 0 0.622l-8.533 11.067c-0.044 0.133-0.133 0.222-0.356 0.222z' }),
9
- React.createElement("path", { id: 'path-3', fill: '#b2bdb1', d: 'M17.067 24.978c-0.178 0-0.311-0.044-0.444-0.178l-10.667-9.956c-0.267-0.222-0.267-0.622-0.044-0.933l4.578-5.511c0.222-0.267 0.533-0.311 0.844-0.178l5.556 3.067 3.689-4.044c0.133-0.133 0.311-0.222 0.533-0.222 0.178 0 0.356 0.089 0.489 0.267l4.489 5.511c0.178 0.222 0.178 0.578 0 0.844l-8.533 11.067c-0.133 0.133-0.267 0.222-0.489 0.267zM7.289 14.267l9.689 9.022 7.778-10.044-3.689-4.533-3.511 3.867c-0.222 0.222-0.533 0.267-0.8 0.133l-5.6-3.067-3.867 4.622z' })));
10
- const FavoriteButton = memo(({ type, favorites, productId, optionId, variantId, qty }) => {
11
- //! Check Active Favorite
12
- const isFavorite = useMemo(() => {
13
- return favorites.some((favorite) => favorite.product.id === productId && favorite.selectedOption.id === optionId && favorite.selectedVariant.id === variantId);
14
- }, [favorites, productId, variantId, optionId]);
15
- //! Add to favorite
16
- const addFavoriteHandleClick = useCallback(() => {
17
- isFavorite
18
- ? removeFavorite({
19
- productId,
20
- variantId,
21
- optionId,
22
- })
23
- : addToFavorite({
24
- productId,
25
- variantId,
26
- optionId,
27
- qty,
28
- update: true,
29
- });
30
- }, [productId, variantId, optionId, qty, isFavorite]);
31
- return type === 'withIcon' ? (
32
- // <Icon
33
- // name={`favorite`}
34
- // className={`pi-favorite ${isFavorite ? 'pi-active' : ''}`}
35
- // onClick={addFavoriteHandleClick}>
36
- // <span className='path1' />
37
- // <span className='path2' />
38
- // <span className='path3' />
39
- // </Icon>
40
- React.createElement("div", { onClick: addFavoriteHandleClick, className: `pi-favorite ${isFavorite ? 'pi-active' : ''}` }, favoriteIcon)) : (React.createElement(Button, { text: 'addToWishlist', btnType: `green-small-text`, onClick: addFavoriteHandleClick, className: `wishlist-btn ${isFavorite ? 'active' : ''}` }));
41
- });
42
- export default FavoriteButton;