@weareconceptstudio/account 0.0.0 → 0.0.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.
Files changed (165) hide show
  1. package/dist/AccountConfig.d.ts +5 -0
  2. package/dist/AccountConfig.js +21 -0
  3. package/dist/components/AccountButton/index.d.ts +3 -0
  4. package/dist/components/AccountButton/index.js +22 -0
  5. package/dist/components/AccountButton/style.d.ts +2 -0
  6. package/dist/components/AccountButton/style.js +249 -0
  7. package/dist/components/AddressForm/index.d.ts +3 -0
  8. package/dist/components/AddressForm/index.js +100 -0
  9. package/dist/components/AddressForm/style.d.ts +2 -0
  10. package/dist/components/AddressForm/style.js +180 -0
  11. package/dist/components/AddressItem/index.d.ts +3 -0
  12. package/dist/components/AddressItem/index.js +41 -0
  13. package/dist/components/AddressItem/style.d.ts +2 -0
  14. package/dist/components/AddressItem/style.js +191 -0
  15. package/dist/components/CustomCheckbox/index.d.ts +7 -0
  16. package/dist/components/CustomCheckbox/index.js +15 -0
  17. package/dist/components/CustomCheckbox/style.d.ts +2 -0
  18. package/dist/components/CustomCheckbox/style.js +85 -0
  19. package/dist/components/EmptyCart/index.d.ts +5 -0
  20. package/dist/components/EmptyCart/index.js +14 -0
  21. package/dist/components/EmptyCart/style.d.ts +2 -0
  22. package/dist/components/EmptyCart/style.js +62 -0
  23. package/dist/components/EmptyOrders/index.d.ts +3 -0
  24. package/dist/components/EmptyOrders/index.js +12 -0
  25. package/dist/components/EmptyOrders/style.d.ts +2 -0
  26. package/dist/components/EmptyOrders/style.js +46 -0
  27. package/dist/components/FormInputCode/index.d.ts +24 -0
  28. package/dist/components/FormInputCode/index.js +145 -0
  29. package/dist/components/FormInputCode/style.d.ts +2 -0
  30. package/dist/components/FormInputCode/style.js +109 -0
  31. package/dist/components/OrderDetails/index.d.ts +3 -0
  32. package/dist/components/OrderDetails/index.js +48 -0
  33. package/dist/components/OrderDetails/style.d.ts +2 -0
  34. package/dist/components/OrderDetails/style.js +90 -0
  35. package/dist/components/OrderedItems/ReviewPopup/index.d.ts +0 -0
  36. package/dist/components/OrderedItems/ReviewPopup/index.js +202 -0
  37. package/dist/components/OrderedItems/ReviewPopup/style.d.ts +2 -0
  38. package/dist/components/OrderedItems/ReviewPopup/style.js +329 -0
  39. package/dist/components/OrderedItems/index.d.ts +7 -0
  40. package/dist/components/OrderedItems/index.js +108 -0
  41. package/dist/components/OrderedItems/style.d.ts +2 -0
  42. package/dist/components/OrderedItems/style.js +783 -0
  43. package/dist/components/OrdersList/OrderItem/index.d.ts +3 -0
  44. package/dist/components/OrdersList/OrderItem/index.js +21 -0
  45. package/dist/components/OrdersList/index.d.ts +10 -0
  46. package/dist/components/OrdersList/index.js +68 -0
  47. package/dist/components/OrdersList/style.d.ts +2 -0
  48. package/dist/components/OrdersList/style.js +373 -0
  49. package/dist/components/Pagination/index.d.ts +3 -0
  50. package/dist/components/Pagination/index.js +18 -0
  51. package/dist/components/Pagination/style.d.ts +2 -0
  52. package/dist/components/Pagination/style.js +72 -0
  53. package/dist/components/SelectShippingBilling/index.d.ts +3 -0
  54. package/dist/components/SelectShippingBilling/index.js +31 -0
  55. package/dist/components/SelectShippingBilling/style.d.ts +2 -0
  56. package/dist/components/SelectShippingBilling/style.js +112 -0
  57. package/dist/components/Sequence/index.d.ts +5 -0
  58. package/dist/components/Sequence/index.js +65 -0
  59. package/dist/components/Sequence/style.d.ts +2 -0
  60. package/dist/components/Sequence/style.js +317 -0
  61. package/dist/components/ShippingBillingForm/index.d.ts +3 -0
  62. package/dist/components/ShippingBillingForm/index.js +96 -0
  63. package/dist/components/ShippingBillingForm/style.d.ts +2 -0
  64. package/dist/components/ShippingBillingForm/style.js +77 -0
  65. package/dist/components/ShippingBillingInfo/index.d.ts +3 -0
  66. package/dist/components/ShippingBillingInfo/index.js +22 -0
  67. package/dist/components/ShippingBillingInfo/style.d.ts +2 -0
  68. package/dist/components/ShippingBillingInfo/style.js +98 -0
  69. package/dist/components/TotalCheckout/index.d.ts +3 -0
  70. package/dist/components/TotalCheckout/index.js +49 -0
  71. package/dist/components/TotalCheckout/style.d.ts +2 -0
  72. package/dist/components/TotalCheckout/style.js +211 -0
  73. package/dist/components/WarningMessage/index.d.ts +3 -0
  74. package/dist/components/WarningMessage/index.js +10 -0
  75. package/dist/components/WarningMessage/style.d.ts +2 -0
  76. package/dist/components/WarningMessage/style.js +34 -0
  77. package/dist/components/WarningMessageForPopup/index.d.ts +3 -0
  78. package/dist/components/WarningMessageForPopup/index.js +31 -0
  79. package/dist/components/WarningMessageForPopup/style.d.ts +2 -0
  80. package/dist/components/WarningMessageForPopup/style.js +82 -0
  81. package/dist/components/index.d.ts +18 -0
  82. package/dist/components/index.js +18 -0
  83. package/dist/index.d.ts +1 -0
  84. package/dist/index.js +2 -0
  85. package/dist/styles/helperClass.d.ts +2 -0
  86. package/dist/styles/helperClass.js +278 -0
  87. package/dist/styles/theme.d.ts +2 -0
  88. package/dist/styles/theme.js +63 -0
  89. package/dist/styles/typography.d.ts +2 -0
  90. package/dist/styles/typography.js +129 -0
  91. package/dist/styles/variables.d.ts +2 -0
  92. package/dist/styles/variables.js +401 -0
  93. package/dist/templates/AccountSettingsTemplate/AccountInfo/index.d.ts +38 -0
  94. package/dist/templates/AccountSettingsTemplate/AccountInfo/index.js +37 -0
  95. package/dist/templates/AccountSettingsTemplate/AccountInfo/style.d.ts +2 -0
  96. package/dist/templates/AccountSettingsTemplate/AccountInfo/style.js +165 -0
  97. package/dist/templates/AccountSettingsTemplate/AccountInfo/utils.d.ts +32 -0
  98. package/dist/templates/AccountSettingsTemplate/AccountInfo/utils.js +45 -0
  99. package/dist/templates/AccountSettingsTemplate/AccountPassword/index.d.ts +15 -0
  100. package/dist/templates/AccountSettingsTemplate/AccountPassword/index.js +36 -0
  101. package/dist/templates/AccountSettingsTemplate/AccountPassword/style.d.ts +2 -0
  102. package/dist/templates/AccountSettingsTemplate/AccountPassword/style.js +141 -0
  103. package/dist/templates/AccountSettingsTemplate/AccountPassword/utils.d.ts +10 -0
  104. package/dist/templates/AccountSettingsTemplate/AccountPassword/utils.js +22 -0
  105. package/dist/templates/AccountSettingsTemplate/index.d.ts +11 -0
  106. package/dist/templates/AccountSettingsTemplate/index.js +10 -0
  107. package/dist/templates/AccountSettingsTemplate/style.d.ts +2 -0
  108. package/dist/templates/AccountSettingsTemplate/style.js +37 -0
  109. package/dist/templates/AccountTemplate/index.d.ts +8 -0
  110. package/dist/templates/AccountTemplate/index.js +32 -0
  111. package/dist/templates/AccountTemplate/style.d.ts +2 -0
  112. package/dist/templates/AccountTemplate/style.js +293 -0
  113. package/dist/templates/AddressesTemplate/index.d.ts +3 -0
  114. package/dist/templates/AddressesTemplate/index.js +21 -0
  115. package/dist/templates/AddressesTemplate/style.d.ts +2 -0
  116. package/dist/templates/AddressesTemplate/style.js +89 -0
  117. package/dist/templates/CartTemplate/index.d.ts +3 -0
  118. package/dist/templates/CartTemplate/index.js +23 -0
  119. package/dist/templates/CartTemplate/style.d.ts +2 -0
  120. package/dist/templates/CartTemplate/style.js +37 -0
  121. package/dist/templates/CheckoutTemplate/index.d.ts +9 -0
  122. package/dist/templates/CheckoutTemplate/index.js +155 -0
  123. package/dist/templates/CheckoutTemplate/style.d.ts +2 -0
  124. package/dist/templates/CheckoutTemplate/style.js +173 -0
  125. package/dist/templates/ForgotPasswordTemplate/index.d.ts +5 -2
  126. package/dist/templates/ForgotPasswordTemplate/index.js +86 -3
  127. package/dist/templates/ForgotPasswordTemplate/style.d.ts +2 -0
  128. package/dist/templates/ForgotPasswordTemplate/style.js +186 -0
  129. package/dist/templates/OrderHistoryTemplate/index.d.ts +7 -0
  130. package/dist/templates/OrderHistoryTemplate/index.js +9 -0
  131. package/dist/templates/OrderHistoryTemplate/style.d.ts +2 -0
  132. package/dist/templates/OrderHistoryTemplate/style.js +3 -0
  133. package/dist/templates/OrderIndividualTemplate/index.d.ts +5 -0
  134. package/dist/templates/OrderIndividualTemplate/index.js +21 -0
  135. package/dist/templates/OrderIndividualTemplate/style.d.ts +2 -0
  136. package/dist/templates/OrderIndividualTemplate/style.js +3 -0
  137. package/dist/templates/ResetPasswordTemplate/index.d.ts +7 -2
  138. package/dist/templates/ResetPasswordTemplate/index.js +35 -2
  139. package/dist/templates/ResetPasswordTemplate/style.d.ts +2 -0
  140. package/dist/templates/ResetPasswordTemplate/style.js +163 -0
  141. package/dist/templates/SignInTemplate/index.d.ts +5 -2
  142. package/dist/templates/SignInTemplate/index.js +27 -2
  143. package/dist/templates/SignInTemplate/style.d.ts +2 -0
  144. package/dist/templates/SignInTemplate/style.js +168 -0
  145. package/dist/templates/SignUpTemplate/defaultFormFields.d.ts +11 -0
  146. package/dist/templates/SignUpTemplate/defaultFormFields.js +42 -0
  147. package/dist/templates/SignUpTemplate/index.d.ts +6 -2
  148. package/dist/templates/SignUpTemplate/index.js +33 -3
  149. package/dist/templates/SignUpTemplate/style.d.ts +2 -0
  150. package/dist/templates/SignUpTemplate/style.js +175 -0
  151. package/dist/templates/VerifyEmailAddressTemplate/index.d.ts +3 -0
  152. package/dist/templates/VerifyEmailAddressTemplate/index.js +105 -0
  153. package/dist/templates/VerifyEmailAddressTemplate/style.d.ts +2 -0
  154. package/dist/templates/VerifyEmailAddressTemplate/style.js +165 -0
  155. package/dist/templates/index.d.ts +8 -0
  156. package/dist/templates/index.js +11 -0
  157. package/dist/translations/en.d.ts +257 -0
  158. package/dist/translations/en.js +256 -0
  159. package/dist/translations/index.d.ts +259 -0
  160. package/dist/translations/index.js +2 -0
  161. package/dist/utils/_functions.d.ts +5 -0
  162. package/dist/utils/_functions.js +28 -0
  163. package/dist/utils/icons.d.ts +3 -0
  164. package/dist/utils/icons.js +27 -0
  165. package/package.json +5 -6
@@ -0,0 +1,5 @@
1
+ export function AccountConfig({ fontFamily, children }: {
2
+ fontFamily?: string;
3
+ children: any;
4
+ }): React.JSX.Element;
5
+ import React from 'react';
@@ -0,0 +1,21 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useTranslation } from '@weareconceptstudio/core';
3
+ import { ThemeProvider } from 'styled-components';
4
+ //* Translations
5
+ import translations from './translations';
6
+ //* Styles
7
+ import theme from './styles/theme';
8
+ import AccountHelperClass from './styles/helperClass';
9
+ import AccountVariables from './styles/variables';
10
+ import AccountTypography from './styles/typography';
11
+ export const AccountConfig = ({ fontFamily = 'core_Font', children }) => {
12
+ const { addTranslation } = useTranslation();
13
+ useEffect(() => {
14
+ addTranslation(translations, 'prepend');
15
+ }, []);
16
+ return (React.createElement(ThemeProvider, { theme: theme },
17
+ React.createElement(AccountVariables, { fontFamily: fontFamily }),
18
+ React.createElement(AccountHelperClass, null),
19
+ React.createElement(AccountTypography, null),
20
+ children));
21
+ };
@@ -0,0 +1,3 @@
1
+ export default AccountButton;
2
+ declare const AccountButton: React.NamedExoticComponent<object>;
3
+ import React from 'react';
@@ -0,0 +1,22 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import classNames from 'classnames';
3
+ import { Link, useTranslation } from '@weareconceptstudio/core';
4
+ import { useTheme } from 'styled-components';
5
+ import theme from '../../styles/theme';
6
+ //* Style
7
+ import AccountButtonStyle from './style';
8
+ const AccountButton = memo(({ btnType, text, className, onClick, children, url, customLinkProps, target, type = 'button', disabled = false, svg_icon }) => {
9
+ const { translate } = useTranslation();
10
+ const globalTheme = useTheme();
11
+ const Component = useMemo(() => (url ? Link : 'button'), [url]);
12
+ const customProps = useMemo(() => (url ? { ...customLinkProps, url, target } : { type, disabled }), [url, type, disabled]);
13
+ const classString = classNames('btn-wrap', {
14
+ [btnType]: btnType,
15
+ [className]: className,
16
+ });
17
+ return (React.createElement(AccountButtonStyle, { onClick: onClick, className: classString, theme: theme(globalTheme) },
18
+ React.createElement(Component, { ...customProps },
19
+ svg_icon || children || translate(text),
20
+ " ")));
21
+ });
22
+ export default AccountButton;
@@ -0,0 +1,2 @@
1
+ export default AccountButtonStyle;
2
+ declare const AccountButtonStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,249 @@
1
+ import styled from 'styled-components';
2
+ const AccountButtonStyle = styled.div `
3
+ --account_btnPadTB: var(--sp2-5x);
4
+ --account_btnPadLR: var(--sp8x);
5
+ --account_btnBorderRad: var(--sp1x);
6
+
7
+ //! Small icons wrap sizes
8
+ --account_wrapSize: var(--sp7x);
9
+
10
+ //! Small icons size
11
+ --account_smallIconsSize: var(--sp2-5x);
12
+
13
+ display: inline-flex;
14
+
15
+ button,
16
+ a {
17
+ width: 100%;
18
+ cursor: pointer;
19
+ font-size: var(--account_p2);
20
+ line-height: var(--account_lineHeight);
21
+ font-family: var(--account_Font);
22
+ font-weight: 700;
23
+ padding: var(--account_btnPadTB) var(--account_btnPadLR);
24
+ background-color: var(--account_primaryColor14);
25
+ border: 2px solid var(--account_primaryColor14);
26
+ color: var(--account_backgroundColor);
27
+ border-radius: var(--account_btnBorderRad);
28
+ transition: 0.1s;
29
+ display: inline-flex;
30
+ justify-content: center;
31
+ align-items: center;
32
+ overflow: hidden;
33
+ isolation: isolate;
34
+ -webkit-appearance: none;
35
+
36
+ @media (hover: hover) {
37
+ &:hover {
38
+ background-color: var(--account_secondaryColor9);
39
+ border: 2px solid var(--account_secondaryColor9);
40
+ }
41
+ }
42
+ }
43
+
44
+ &.full-width {
45
+ button,
46
+ a {
47
+ width: 100%;
48
+ }
49
+ }
50
+
51
+ &.outline {
52
+ button,
53
+ a {
54
+ background-color: var(--account_backgroundColor);
55
+ border: 2px solid var(--account_primaryColor14);
56
+ color: var(--account_primaryColor14);
57
+
58
+ @media (hover: hover) {
59
+ &:hover {
60
+ border: 2px solid var(--account_secondaryColor9);
61
+ color: var(--account_secondaryColor9);
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ &.purple-text {
68
+ width: fit-content;
69
+
70
+ button,
71
+ a {
72
+ padding: 0;
73
+ background-color: unset;
74
+ color: var(--account_primaryColor14);
75
+ border-radius: 0;
76
+ border: unset;
77
+ text-decoration: underline;
78
+ transition: color var(--account_trTime);
79
+
80
+ @media (hover: hover) {
81
+ &:hover {
82
+ color: var(--account_secondaryColor9);
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ &.green-small-text {
89
+ width: fit-content;
90
+
91
+ button,
92
+ a {
93
+ font-size: var(--account_p3);
94
+ padding: 0;
95
+ background-color: unset;
96
+ color: var(--account_primaryColor3);
97
+ border-radius: 0;
98
+ border: unset;
99
+ text-decoration: underline;
100
+ transition: color var(--account_trTime);
101
+
102
+ @media (hover: hover) {
103
+ &:hover {
104
+ color: var(--account_primaryColor1);
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ &.green-large-text {
111
+ width: fit-content;
112
+
113
+ button,
114
+ a {
115
+ padding: 0;
116
+ background-color: unset;
117
+ color: var(--account_primaryColor1);
118
+ border-radius: 0;
119
+ border: unset;
120
+ text-decoration: underline;
121
+ transition: color var(--account_trTime);
122
+
123
+ @media (hover: hover) {
124
+ &:hover {
125
+ color: var(--account_primaryColor3);
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ &.icon {
132
+ button,
133
+ a {
134
+ width: var(--account_wrapSize);
135
+ height: var(--account_wrapSize);
136
+ padding: 0;
137
+ font-size: unset;
138
+ background-color: unset;
139
+ color: unset;
140
+ font-family: unset;
141
+ font-weight: unset;
142
+ border: 2px solid var(--account_primaryColor5);
143
+
144
+ svg {
145
+ width: var(--account_smallIconsSize);
146
+ height: var(--account_smallIconsSize);
147
+ fill: var(--account_primaryColor1);
148
+ }
149
+
150
+ @media (hover: hover) {
151
+ &:hover {
152
+ color: unset;
153
+ background-color: var(--account_primaryColor1);
154
+ border: 2px solid var(--account_primaryColor1);
155
+
156
+ svg {
157
+ fill: var(--account_backgroundColor);
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+
164
+ &.disabled {
165
+ button,
166
+ a {
167
+ pointer-events: none;
168
+ opacity: 0.5;
169
+ }
170
+ }
171
+
172
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
173
+ --account_btnPadTB: var(--sp2x);
174
+ --account_btnPadLR: var(--sp7x);
175
+
176
+ //! Small icons wrap sizes
177
+ --account_wrapSize: var(--sp6x);
178
+
179
+ //! Small icons size
180
+ --account_smallIconsSize: var(--sp2x);
181
+ }
182
+
183
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
184
+ --account_btnPadTB: var(--sp1-5x);
185
+ --account_btnPadLR: var(--sp6x);
186
+
187
+ //! Small icons wrap sizes
188
+ --account_wrapSize: var(--sp5x);
189
+
190
+ //! Small icons size
191
+ --account_smallIconsSize: var(--sp1-5x);
192
+ }
193
+
194
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
195
+ --account_btnPadTB: var(--sp1-5x);
196
+ --account_btnPadLR: var(--sp6x);
197
+
198
+ //! Small icons wrap sizes
199
+ --account_wrapSize: var(--sp5x);
200
+
201
+ //! Small icons size
202
+ --account_smallIconsSize: var(--sp1-5x);
203
+ }
204
+
205
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
206
+ --account_btnPadTB: var(--sp1-5x);
207
+ --account_btnPadLR: var(--sp6x);
208
+
209
+ //! Small icons wrap sizes
210
+ --account_wrapSize: var(--sp5x);
211
+
212
+ //! Small icons size
213
+ --account_smallIconsSize: var(--sp1-5x);
214
+ }
215
+
216
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
217
+ --account_btnPadTB: var(--sp1x);
218
+ --account_btnPadLR: var(--sp5x);
219
+
220
+ //! Small icons wrap sizes
221
+ --account_wrapSize: var(--sp5x);
222
+
223
+ //! Small icons size
224
+ --account_smallIconsSize: var(--sp1-5x);
225
+ }
226
+
227
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
228
+ --account_btnPadTB: var(--sp1-5x);
229
+ --account_btnPadLR: var(--sp5x);
230
+
231
+ //! Small icons wrap sizes
232
+ --account_wrapSize: var(--sp5x);
233
+
234
+ //! Small icons size
235
+ --account_smallIconsSize: var(--sp1-5x);
236
+ }
237
+
238
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
239
+ --account_btnPadTB: var(--sp1-5x);
240
+ --account_btnPadLR: var(--sp3x);
241
+
242
+ //! Small icons wrap sizes
243
+ --account_wrapSize: var(--sp4x);
244
+
245
+ //! Small icons size
246
+ --account_smallIconsSize: var(--sp1-5x);
247
+ }
248
+ `;
249
+ export default AccountButtonStyle;
@@ -0,0 +1,3 @@
1
+ export default AddressForm;
2
+ declare const AddressForm: React.NamedExoticComponent<object>;
3
+ import React from 'react';
@@ -0,0 +1,100 @@
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 { useTheme } from 'styled-components';
5
+ import theme from '../../styles/theme';
6
+ //* Icons
7
+ import { CheckboxIcon, CheckboxCheckedIcon } from '../../utils/icons';
8
+ //* Style
9
+ import AddressFormStyle from './style';
10
+ //* Components
11
+ import AccountButton from '../AccountButton';
12
+ //TODO: Form -> ref, onChange, Select, Form Item -> options,Global Data
13
+ const globalData = {
14
+ countries: [],
15
+ cities: [],
16
+ regions: [
17
+ { value: 'yerevan', label: 'Yerevan' },
18
+ { value: 'shirak', label: 'Shirak' },
19
+ { value: 'aragatsotn', label: 'Aragatsotn' },
20
+ { value: 'lori', label: 'Lori' },
21
+ { value: 'kotayq', label: 'Kotayq' },
22
+ { value: 'tavush', label: 'Tavush' },
23
+ { value: 'vayots-dzor', label: 'Vayots Dzor' },
24
+ { value: 'syuniq', label: 'Syuniq' },
25
+ { value: 'ararat', label: 'Ararat' },
26
+ { value: 'armavir', label: 'Armavir' },
27
+ { value: 'gegharquniq', label: 'Gegharquniq' },
28
+ ],
29
+ };
30
+ const AddressForm = Memo(({ title, data, selected, createAddress, updateAddress }) => {
31
+ const globalTheme = useTheme();
32
+ const { closePopup } = useUi();
33
+ //! Ref
34
+ const form = useRef();
35
+ //! States
36
+ const [isChecked, setIsChecked] = useState(data?.is_default);
37
+ const [countryId, setCountryId] = useState(globalData.countries.length > 1 ? data?.country_id : 1);
38
+ const [regionId, setRegionId] = useState(data?.region_id);
39
+ const [isDisabled, setIsDisabled] = useState(false);
40
+ //! On Finish
41
+ const onFinish = useCallback((values) => {
42
+ // const newData = { ...values, is_default: isChecked };
43
+ // setIsDisabled(true);
44
+ // return (
45
+ // !isDisabled &&
46
+ // eval(data?.id ? `updateAddress(newData, data.id)` : `createAddress(newData)`).then(
47
+ // () => {
48
+ // closePopup();
49
+ // }
50
+ // )
51
+ // );
52
+ }, [data, isChecked, createAddress, updateAddress, isDisabled]);
53
+ const handleFormChange = useCallback((val) => {
54
+ const name = Object.keys(val)[0];
55
+ if (name === 'country_id') {
56
+ setCountryId(val[name]);
57
+ setRegionId('');
58
+ form.current.setFieldsValue({ region_id: '', city_id: '' });
59
+ }
60
+ else if (name === 'region_id') {
61
+ setRegionId(val[name]);
62
+ form.current.setFieldsValue({ city_id: '' });
63
+ }
64
+ }, []);
65
+ return (React.createElement(AddressFormStyle, { theme: theme(globalTheme) },
66
+ React.createElement(Text, { tag: `h6`, text: title, className: `account-h6 account-font-bold account-primary-color1` }),
67
+ React.createElement(Form, { ref: form, onSubmit: onFinish, onChange: handleFormChange, initialValues: data || { type: selected.type, country_id: 1 } },
68
+ React.createElement("div", { className: `form-wrapper` },
69
+ React.createElement(Form.Item, { name: 'country_id', label: 'country' },
70
+ React.createElement(Select, { placeholder: 'Armenia',
71
+ // options={globalData.regions}
72
+ disabled: true })),
73
+ React.createElement(Form.Item, { name: 'type' },
74
+ React.createElement(Input, { type: 'hidden' })),
75
+ React.createElement(Form.Item, { name: 'first_name', label: 'firstName' },
76
+ React.createElement(Input, { placeholder: 'firstNamePlaceholder' })),
77
+ React.createElement(Form.Item, { name: 'last_name', label: 'lastName' },
78
+ React.createElement(Input, { placeholder: 'lastNamePlaceholder' })),
79
+ React.createElement(Form.Item, { name: 'region_id', label: 'region', className: !countryId ? 'disabled' : '' },
80
+ React.createElement(Select, { placeholder: 'Select Region', options: globalData.regions })),
81
+ React.createElement(Form.Item, { name: 'city_id', label: 'city' },
82
+ React.createElement(Select, { placeholder: 'cityPlaceholder', disabled: !regionId })),
83
+ React.createElement(Form.Item, { name: 'address_1', label: 'address_1' },
84
+ React.createElement(Input, { placeholder: 'address_1Placeholder' })),
85
+ React.createElement(Form.Item, { name: 'address_2', label: 'address_2' },
86
+ React.createElement(Input, { placeholder: 'address_2Placeholder' })),
87
+ React.createElement(Form.Item, { name: 'zip_code', label: 'zipCode' },
88
+ React.createElement(Input.Number, { placeholder: 'zipCodePlaceholder' })),
89
+ React.createElement(Form.Item, { name: 'phone', label: 'phone' },
90
+ React.createElement(PhoneNumber, null))),
91
+ React.createElement("div", { className: `default-info-wrap` }, !data?.is_default ? (React.createElement("div", { className: `banner-wrap cursor-pointer`, onClick: () => setIsChecked(!isChecked) },
92
+ isChecked ? (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
93
+ React.createElement(CheckboxCheckedIcon, null))) : (React.createElement("div", { className: 'checkbox-wrap', role: 'button' },
94
+ React.createElement(CheckboxIcon, null))),
95
+ React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1`, text: `${selected.type === 'shipping' ? 'makeYourDefaultShippingAddress' : 'makeYourDefaultBillingAddress'}` }))) : (React.createElement(Text, { className: `account-p account-p2 account-font-medium account-primary-color1`, text: `${selected.type === 'shipping' ? 'thisYourDefaultShippingAddress' : 'thisYourDefaultBillingAddress'}` }))),
96
+ React.createElement("div", { className: `cancel-and-save-wrap` },
97
+ React.createElement(AccountButton, { text: `cancel`, onClick: closePopup, btnType: `green-large-text` }),
98
+ React.createElement(AccountButton, { type: 'submit', text: `saveAndApply`, btnType: `full-width`, className: `${isDisabled ? 'disabled' : ''}` })))));
99
+ });
100
+ export default AddressForm;
@@ -0,0 +1,2 @@
1
+ export default AddressFormStyle;
2
+ declare const AddressFormStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,180 @@
1
+ import styled from 'styled-components';
2
+ const AddressFormStyle = styled.div `
3
+ --account_antFormMTop: var(--sp5x);
4
+ --account_antFormItemWidth: 50%;
5
+ --account_antFormItemMTop: var(--sp4x);
6
+ --account_formItemDistance: var(--sp3x);
7
+ --account_defaultInfoWrapMTop: var(--sp5x);
8
+ --account_cancelAndSaveWrapMTop: var(--sp5x);
9
+ --account_checkboxWrapSize: var(--sp4x);
10
+ --account_checkboxWrapDistance: var(--sp2x);
11
+ --account_cancelDistance: var(--sp5x);
12
+
13
+ form {
14
+ margin-top: var(--account_antFormMTop);
15
+
16
+ .form-wrapper {
17
+ display: flex;
18
+ flex-wrap: wrap;
19
+ margin-left: calc(-1 * calc(var(--account_formItemDistance) / 2));
20
+ margin-right: calc(-1 * calc(var(--account_formItemDistance) / 2));
21
+
22
+ .form-item {
23
+ width: var(--account_antFormItemWidth);
24
+ padding: 0 calc(var(--account_formItemDistance) / 2);
25
+
26
+ &:not(:nth-child(1), :nth-child(2)) {
27
+ margin-top: var(--account_antFormItemMTop);
28
+ }
29
+ }
30
+ }
31
+
32
+ .default-info-wrap {
33
+ margin-top: var(--account_defaultInfoWrapMTop);
34
+
35
+ .banner-wrap {
36
+ display: inline-flex;
37
+ align-items: center;
38
+
39
+ .checkbox-wrap {
40
+ display: flex;
41
+ align-items: center;
42
+ margin-right: var(--account_checkboxWrapDistance);
43
+
44
+ svg {
45
+ cursor: pointer;
46
+ width: var(--account_checkboxWrapSize);
47
+ height: var(--account_checkboxWrapSize);
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ .cancel-and-save-wrap {
54
+ display: flex;
55
+ justify-content: flex-end;
56
+ align-items: center;
57
+ margin-top: var(--account_cancelAndSaveWrapMTop);
58
+
59
+ .btn-wrap {
60
+ &:first-child {
61
+ margin-right: var(--account_cancelDistance);
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ .r-1 {
68
+ fill: var(--account_backgroundColor);
69
+ }
70
+
71
+ .r-2 {
72
+ fill: var(--account_primaryColor1);
73
+ }
74
+
75
+ .r-3 {
76
+ fill: var(--account_primaryColor4);
77
+ }
78
+
79
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
80
+ --account_antFormMTop: var(--sp4x);
81
+ --account_antFormItemWidth: 50%;
82
+ --account_antFormItemMTop: var(--sp4x);
83
+ --account_formItemDistance: var(--sp4x);
84
+ --account_defaultInfoWrapMTop: var(--sp4x);
85
+ --account_cancelAndSaveWrapMTop: var(--sp4x);
86
+ --account_checkboxWrapSize: var(--sp2-5x);
87
+ --account_checkboxWrapDistance: var(--sp2x);
88
+ --account_cancelDistance: var(--sp4x);
89
+ }
90
+
91
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
92
+ --account_antFormMTop: var(--sp3x);
93
+ --account_antFormItemWidth: 50%;
94
+ --account_antFormItemMTop: var(--sp3x);
95
+ --account_formItemDistance: var(--sp3x);
96
+ --account_defaultInfoWrapMTop: var(--sp3x);
97
+ --account_cancelAndSaveWrapMTop: var(--sp3x);
98
+ --account_checkboxWrapSize: var(--sp3x);
99
+ --account_checkboxWrapDistance: var(--sp2x);
100
+ --account_cancelDistance: var(--sp3x);
101
+ }
102
+
103
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
104
+ --account_antFormMTop: var(--sp3x);
105
+ --account_antFormItemWidth: 50%;
106
+ --account_antFormItemMTop: var(--sp2x);
107
+ --account_formItemDistance: var(--sp2x);
108
+ --account_defaultInfoWrapMTop: var(--sp3x);
109
+ --account_cancelAndSaveWrapMTop: var(--sp3x);
110
+ --account_checkboxWrapSize: var(--sp3x);
111
+ --account_checkboxWrapDistance: var(--sp1-5x);
112
+ --account_cancelDistance: var(--sp3x);
113
+ }
114
+
115
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
116
+ --account_antFormMTop: var(--sp3x);
117
+ --account_antFormItemWidth: 50%;
118
+ --account_antFormItemMTop: var(--sp2x);
119
+ --account_formItemDistance: var(--sp2x);
120
+ --account_defaultInfoWrapMTop: var(--sp3x);
121
+ --account_cancelAndSaveWrapMTop: var(--sp3x);
122
+ --account_checkboxWrapSize: var(--sp2-5x);
123
+ --account_checkboxWrapDistance: var(--sp1x);
124
+ --account_cancelDistance: var(--sp2-5x);
125
+ }
126
+
127
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
128
+ --account_antFormMTop: var(--sp3x);
129
+ --account_antFormItemWidth: 50%;
130
+ --account_antFormItemMTop: var(--sp2x);
131
+ --account_formItemDistance: var(--sp2x);
132
+ --account_defaultInfoWrapMTop: var(--sp3x);
133
+ --account_cancelAndSaveWrapMTop: var(--sp3x);
134
+ --account_checkboxWrapSize: var(--sp2-5x);
135
+ --account_checkboxWrapDistance: var(--sp1x);
136
+ --account_cancelDistance: var(--sp2-5x);
137
+ }
138
+
139
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
140
+ --account_antFormMTop: var(--sp3x);
141
+ --account_antFormItemWidth: 50%;
142
+ --account_antFormItemMTop: var(--sp2x);
143
+ --account_formItemDistance: var(--sp2x);
144
+ --account_defaultInfoWrapMTop: var(--sp3x);
145
+ --account_cancelAndSaveWrapMTop: var(--sp3x);
146
+ --account_checkboxWrapSize: var(--sp2-5x);
147
+ --account_checkboxWrapDistance: var(--sp1x);
148
+ --account_cancelDistance: var(--sp2-5x);
149
+ }
150
+
151
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
152
+ --account_antFormMTop: var(--sp3x);
153
+ --account_antFormItemWidth: 100%;
154
+ --account_antFormItemMTop: var(--sp2x);
155
+ --account_formItemDistance: var(--sp2x);
156
+ --account_defaultInfoWrapMTop: var(--sp3x);
157
+ --account_cancelAndSaveWrapMTop: var(--sp3x);
158
+ --account_checkboxWrapSize: var(--sp2-5x);
159
+ --account_checkboxWrapDistance: var(--sp1x);
160
+ --account_cancelDistance: var(--sp2x);
161
+
162
+ form {
163
+ .cancel-and-save-wrap {
164
+ flex-direction: column-reverse;
165
+
166
+ .btn-wrap {
167
+ &:first-child {
168
+ margin-right: 0;
169
+ margin-top: var(--account_cancelDistance);
170
+ }
171
+
172
+ &:last-child {
173
+ width: 100%;
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ `;
180
+ export default AddressFormStyle;
@@ -0,0 +1,3 @@
1
+ export default AddressItem;
2
+ declare const AddressItem: React.NamedExoticComponent<object>;
3
+ import React from 'react';
@@ -0,0 +1,41 @@
1
+ import React, { memo as Memo, useCallback } from 'react';
2
+ import { Text, useUi } from '@weareconceptstudio/core';
3
+ //* Components
4
+ import AddressForm from '../AddressForm';
5
+ import AccountButton from '../AccountButton';
6
+ import WarningMessageForPopup from '../WarningMessageForPopup';
7
+ //* Style
8
+ import AddressItemStyle from './style';
9
+ //TODO:
10
+ const deleteAddress = () => { };
11
+ const AddressItem = Memo(({ title, data, checkout_review, select_address, type, onClick, checkedId, setCheckedId }) => {
12
+ const { openPopup } = useUi();
13
+ //! Handle Popups
14
+ const handleDeletePopup = useCallback(() => {
15
+ openPopup(React.createElement(WarningMessageForPopup, { isDelete: true, title: 'deleteAddressMessage', description: 'confirmDeleteAddress', onRemove: () => deleteAddress(data.id, data.type) }), { className: 'messagePopup' });
16
+ }, [data]);
17
+ const handleEditAddressPopup = useCallback(() => {
18
+ openPopup(React.createElement(AddressForm, { data: data, selected: { value: true, type: data.type }, title: type === 'billing' ? `updateYourBillingAddress` : `updateYourShippingAddress` }));
19
+ }, [data]);
20
+ return (data && (React.createElement(AddressItemStyle, { className: `item-container` },
21
+ checkout_review && (React.createElement("div", { className: `change-address-wrap` },
22
+ React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1`, text: title }),
23
+ React.createElement(AccountButton, { text: `change`, btnType: `green-small-text`, onClick: onClick }))),
24
+ React.createElement("div", { className: `item-internal-wrap` },
25
+ React.createElement("div", { className: `relative-wrapper` },
26
+ React.createElement("div", { className: `personal-data-wrap` },
27
+ React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: `${data.first_name} ${data.last_name}` }),
28
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 col-wrap`, text: `${data.address_1}, ${data.address_2 ? data.address_2 + ',' : ''}` }),
29
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1`, text: `${data.region}, ${data.zip_code}, ${data.city}, ${data.country}` }),
30
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 phone col-wrap`, text: `${data.phone_number}` })),
31
+ data.is_default ? (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 margin-style`, text: `${type === 'shipping' ? 'defaultShippingAddress' : 'defaultBillingAddress'}` })) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 margin-style opacity-zero`, text: `empty` })),
32
+ select_address && (React.createElement("div", { className: `circle-selected-wrap cursor-pointer ${checkedId === data.id ? 'active' : ''}`, onClick: () => setCheckedId(data.id) },
33
+ React.createElement("svg", { version: '1.1', viewBox: '0 0 32 32', xmlns: 'http://www.w3.org/2000/svg', className: `checkbox-icon ${checkedId === data.id ? 'selected' : 'note-selected'}` },
34
+ React.createElement("path", { d: 'M13.345 30.462c-1.062 0-1.859-0.531-2.39-1.328l-9.56-16.996c-0.797-1.328-0.266-2.921 1.062-3.718 1.328-0.531 2.921 0 3.718 1.328l7.436 13.012 12.481-20.183c0.797-1.328 2.39-1.593 3.718-0.797s1.593 2.39 0.797 3.718l-14.871 23.635c-0.531 0.797-1.328 1.328-2.39 1.328z' }))))),
35
+ !checkout_review && (React.createElement("div", { className: `edit-remove-wrapper` },
36
+ React.createElement(AccountButton, { text: `edit`, btnType: `green-small-text`, onClick: handleEditAddressPopup }),
37
+ !select_address && !data.is_default && (React.createElement(React.Fragment, null,
38
+ React.createElement("div", { className: `vertical-line` }),
39
+ React.createElement(AccountButton, { text: `remove`, btnType: `green-small-text`, onClick: handleDeletePopup })))))))));
40
+ });
41
+ export default AddressItem;
@@ -0,0 +1,2 @@
1
+ export default AddressItemStyle;
2
+ declare const AddressItemStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;