@weareconceptstudio/account 0.3.5 → 0.3.7

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 (30) hide show
  1. package/dist/components/AccountButton/index.js +6 -4
  2. package/dist/components/AccountButton/style.js +61 -1
  3. package/dist/components/Loader/index.d.ts +4 -1
  4. package/dist/components/Loader/index.js +19 -3
  5. package/dist/components/Loader/style.js +152 -1
  6. package/dist/components/TotalCheckout/BalanceComp/index.d.ts +10 -0
  7. package/dist/components/TotalCheckout/{MuramoneyComp → BalanceComp}/index.js +10 -10
  8. package/dist/components/TotalCheckout/BalanceComp/style.d.ts +2 -0
  9. package/dist/components/TotalCheckout/{MuramoneyComp → BalanceComp}/style.js +30 -30
  10. package/dist/components/TotalCheckout/CommentComp/index.d.ts +3 -1
  11. package/dist/components/TotalCheckout/CommentComp/index.js +1 -1
  12. package/dist/components/TotalCheckout/index.js +3 -3
  13. package/dist/components/TotalCheckout/style.js +4 -4
  14. package/dist/modules/account/AccountTemplate/index.js +2 -0
  15. package/dist/modules/account/AccountTemplate/style.js +29 -0
  16. package/dist/modules/address/ShippingBillingInfo/index.js +1 -1
  17. package/dist/modules/cart/SimpleItems/index.js +2 -2
  18. package/dist/modules/checkout/CheckoutTemplate/index.js +15 -3
  19. package/dist/modules/payment/AddNewCard/index.js +3 -3
  20. package/dist/modules/payment/Card/index.d.ts +2 -1
  21. package/dist/modules/payment/Card/index.js +3 -8
  22. package/dist/modules/payment/Payment/index.js +19 -3
  23. package/dist/modules/payment/PaymentMethodItem/index.js +2 -4
  24. package/dist/modules/payment/PaymentMethods/index.js +8 -4
  25. package/dist/modules/payment/PaymentWrap/index.js +1 -1
  26. package/package.json +1 -1
  27. package/dist/components/TotalCheckout/MuramoneyComp/index.d.ts +0 -10
  28. package/dist/components/TotalCheckout/MuramoneyComp/style.d.ts +0 -2
  29. /package/dist/components/TotalCheckout/{MuramoneyComp → BalanceComp}/utils.d.ts +0 -0
  30. /package/dist/components/TotalCheckout/{MuramoneyComp → BalanceComp}/utils.js +0 -0
@@ -3,21 +3,23 @@ import classNames from 'classnames';
3
3
  import { Link, useTranslation } from '@weareconceptstudio/core';
4
4
  import AccountButtonStyle from './style';
5
5
  const AccountButton = (props) => {
6
- const { btnType, text, className, onClick, children, url, customLinkProps, target, type = 'button', disabled = false, svg_icon } = props;
6
+ const { btnType, text, className, onClick, children, url, customLinkProps, target, type = 'button', disabled = false, svg_icon, loading = false } = props;
7
7
  const { translate } = useTranslation();
8
8
  const Component = useMemo(() => (url ? Link : 'button'), [url]);
9
9
  const customProps = useMemo(() => (url ? { ...customLinkProps, url, target } : { type, disabled }), [url, type, disabled]);
10
10
  const classString = classNames('btn-wrap', {
11
11
  [btnType]: btnType,
12
12
  [className]: className,
13
+ 'loading': loading,
13
14
  'disabled': disabled,
14
15
  });
15
16
  const handleClick = useCallback(() => {
16
17
  return !disabled && onClick?.();
17
18
  }, [onClick, disabled]);
18
- return (React.createElement(AccountButtonStyle, { onClick: handleClick, className: classString },
19
+ return (React.createElement(AccountButtonStyle, { onClick: handleClick, className: `${classString} ` },
19
20
  React.createElement(Component, { ...customProps },
20
- svg_icon || children || translate(text),
21
- " ")));
21
+ loading ? (React.createElement("div", { className: 'outside-wrapper-loader' },
22
+ React.createElement("div", { className: 'loader' }))) : null,
23
+ React.createElement("div", { className: `content-button ${loading ? 'loading' : ''}` }, svg_icon || children || translate(text)))));
22
24
  };
23
25
  export default AccountButton;
@@ -18,6 +18,7 @@ const AccountButtonStyle = styled.div `
18
18
 
19
19
  button,
20
20
  a {
21
+ position: relative;
21
22
  width: 100%;
22
23
  cursor: pointer;
23
24
  font-size: var(--account_p2);
@@ -182,7 +183,7 @@ const AccountButtonStyle = styled.div `
182
183
  }
183
184
 
184
185
  &.promo-code-version,
185
- &.muramoney-version {
186
+ &.balance-version {
186
187
  width: fit-content;
187
188
 
188
189
  a,
@@ -217,6 +218,65 @@ const AccountButtonStyle = styled.div `
217
218
  }
218
219
  }
219
220
 
221
+ .content-button {
222
+ transition: opacity 0.3s ease-out;
223
+ }
224
+
225
+ &.loading {
226
+ pointer-events: none;
227
+ cursor: default;
228
+
229
+ .content-button {
230
+ &.loading {
231
+ opacity: 0;
232
+ }
233
+ }
234
+ }
235
+
236
+ .outside-wrapper-loader {
237
+ position: absolute;
238
+ width: 100%;
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: center;
242
+ height: calc(100% - var(--account_btnPadTB) * 2);
243
+ }
244
+
245
+ .loader {
246
+ /* width: var(--sp4x); */
247
+ height: 100%;
248
+ aspect-ratio: 1;
249
+ display: grid;
250
+ border-radius: 50%;
251
+ background:
252
+ linear-gradient(0deg, rgb(255 255 255/50%) 30%, transparent 0 70%, rgb(255 255 255/100%) 0) 50%/8% 100%,
253
+ linear-gradient(90deg, rgb(255 255 255/25%) 30%, transparent 0 70%, rgb(255 255 255/75%) 0) 50%/100% 8%;
254
+ background-repeat: no-repeat;
255
+ animation: l23 1s infinite steps(12);
256
+ z-index: 7;
257
+
258
+ &::before,
259
+ &::after {
260
+ content: '';
261
+ grid-area: 1/1;
262
+ border-radius: 50%;
263
+ background: inherit;
264
+ opacity: 0.915;
265
+ transform: rotate(30deg);
266
+ }
267
+
268
+ &::after {
269
+ opacity: 0.83;
270
+ transform: rotate(60deg);
271
+ }
272
+ }
273
+
274
+ @keyframes l23 {
275
+ 100% {
276
+ transform: rotate(1turn);
277
+ }
278
+ }
279
+
220
280
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
221
281
  --account_btnPadTB: var(--sp2x);
222
282
  --account_btnPadLR: var(--sp7x);
@@ -1,2 +1,5 @@
1
1
  export default Loader;
2
- declare function Loader(): import("react").JSX.Element;
2
+ declare function Loader({ className }: {
3
+ className: any;
4
+ }): React.JSX.Element;
5
+ import React from 'react';
@@ -1,7 +1,23 @@
1
+ 'use client';
2
+ import React, { useState, useEffect } from 'react';
1
3
  //* Styles
2
4
  import LoaderStyle from './style';
3
- //* Component
4
- const Loader = () => {
5
- return React.createElement(LoaderStyle, null);
5
+ const Loader = ({ className }) => {
6
+ //! State
7
+ const [loaderState, setLoaderState] = useState('');
8
+ useEffect(() => {
9
+ setTimeout(() => {
10
+ setLoaderState('start');
11
+ }, 100);
12
+ setTimeout(() => {
13
+ setLoaderState('end');
14
+ }, 2000);
15
+ }, []);
16
+ return (React.createElement(LoaderStyle, { className: `${loaderState || ''}` },
17
+ React.createElement("div", { className: `loader ${className || ''}` },
18
+ React.createElement("div", { className: 'cont' },
19
+ React.createElement("span", { className: 'line-top' }),
20
+ React.createElement("div", { className: 'circle' }),
21
+ React.createElement("span", { className: 'line-bottom' })))));
6
22
  };
7
23
  export default Loader;
@@ -1,3 +1,154 @@
1
1
  import styled from 'styled-components';
2
- const LoaderStyle = styled.div ``;
2
+ const LoaderStyle = styled.div `
3
+ --sizeCircle: calc(var(--sp12x) + var(--sp0-5x));
4
+ --sizeLine: var(--sp2-5x);
5
+
6
+ &:before {
7
+ content: '';
8
+ position: absolute;
9
+ top: 0;
10
+ left: 0;
11
+ width: 100%;
12
+ height: 100%;
13
+ background-color: var(--account_backgroundColor);
14
+ z-index: 1;
15
+ transition: 1s linear;
16
+ }
17
+
18
+ .loader {
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ bottom: 0;
23
+ right: 0;
24
+ width: 100%;
25
+ height: 100vh;
26
+ z-index: 10;
27
+ pointer-events: none;
28
+
29
+ &:before {
30
+ background-color: var(--account_backgroundColor);
31
+ }
32
+
33
+ &:before {
34
+ content: '';
35
+ position: absolute;
36
+ top: 0;
37
+ left: 0;
38
+ width: 100%;
39
+ height: 100%;
40
+ transition: 1s linear 1.8s;
41
+ }
42
+
43
+ .cont {
44
+ position: absolute;
45
+ top: 50%;
46
+ left: 50%;
47
+ transform: translate(-50%, -50%);
48
+ width: var(--sizeCircle);
49
+ height: var(--sizeCircle);
50
+ transition: 0.5s linear 1.5s;
51
+
52
+ span {
53
+ background-color: var(--account_primaryColor1);
54
+ height: var(--sizeLine);
55
+ width: 0;
56
+ position: absolute;
57
+ transition: 0.5s ease-out 1s;
58
+
59
+ &.line-top {
60
+ bottom: calc(100% + var(--sizeLine));
61
+ left: 0;
62
+ }
63
+
64
+ &.line-bottom {
65
+ top: calc(100% + var(--sizeLine));
66
+ right: 0;
67
+ }
68
+ }
69
+
70
+ .circle {
71
+ border-radius: 100%;
72
+ overflow: hidden;
73
+ width: 100%;
74
+ height: 100%;
75
+ position: relative;
76
+ background-color: var(--account_primaryColor5);
77
+
78
+ &:before {
79
+ content: '';
80
+ position: absolute;
81
+ top: 100%;
82
+ left: 0;
83
+ width: 100%;
84
+ height: 100%;
85
+ background: linear-gradient(45deg, rgba(167, 0, 222, 1) 0%, rgba(254, 0, 133, 1) 100%);
86
+ transition: 0.5s ease-in-out;
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ &.start {
93
+ &:before {
94
+ opacity: 0;
95
+ }
96
+
97
+ .loader {
98
+ &:before {
99
+ opacity: 0;
100
+ }
101
+
102
+ .cont {
103
+ transform: translate(-50%, -50%) scale(0);
104
+
105
+ span {
106
+ width: 100%;
107
+ }
108
+
109
+ .circle {
110
+ &:before {
111
+ top: 0;
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+
118
+ &.end {
119
+ &:before,
120
+ .loader {
121
+ opacity: 0;
122
+ visibility: hidden;
123
+ }
124
+ }
125
+
126
+ .loader {
127
+ &.account {
128
+ top: calc(-1 * var(--headerFixedHeight) - var(--headerBannerHeight) - var(--account_accountPadT) - var(--account_stickyMarTop));
129
+ }
130
+ }
131
+
132
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
133
+ --sizeCircle: calc(var(--sp6x) + var(--sp0-5x));
134
+ --sizeLine: calc(var(--sp1x) + var(--sp0-5x) / 2);
135
+
136
+ .loader {
137
+ &.account {
138
+ top: 0;
139
+ }
140
+ }
141
+ }
142
+
143
+ @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
144
+ --sizeCircle: calc(var(--sp6x) + var(--sp0-5x));
145
+ --sizeLine: calc(var(--sp1x) + var(--sp0-5x) / 2);
146
+
147
+ .loader {
148
+ &.account {
149
+ top: 0;
150
+ }
151
+ }
152
+ }
153
+ `;
3
154
  export default LoaderStyle;
@@ -0,0 +1,10 @@
1
+ export default BalanceComp;
2
+ declare function BalanceComp({ isBalance, currency, balance, useBalance, balanceHandler, getItemCount }: {
3
+ isBalance?: boolean;
4
+ currency: any;
5
+ balance: any;
6
+ useBalance: any;
7
+ balanceHandler: any;
8
+ getItemCount: any;
9
+ }): React.JSX.Element;
10
+ import React from 'react';
@@ -4,8 +4,8 @@ import { FormBuilder } from '@weareconceptstudio/form';
4
4
  import AccountButton from '../../AccountButton';
5
5
  import { balanceFields } from './utils';
6
6
  //* Style
7
- import MuramoneyCompStyle from './style';
8
- const MuramoneyComp = ({ isMuramoney = true, currency, balance, useBalance, balanceHandler, getItemCount }) => {
7
+ import BalanceCompStyle from './style';
8
+ const BalanceComp = ({ isBalance = true, currency, balance, useBalance, balanceHandler, getItemCount }) => {
9
9
  const { translate } = useTranslation();
10
10
  //! States
11
11
  const [disable, setDisable] = useState(false);
@@ -14,7 +14,7 @@ const MuramoneyComp = ({ isMuramoney = true, currency, balance, useBalance, bala
14
14
  setDisable(true);
15
15
  balanceHandler(values.balance);
16
16
  };
17
- return isMuramoney ? (React.createElement(MuramoneyCompStyle, { className: `collapse-distance ${getItemCount && balance ? ' ' : 'disable'}` },
17
+ return isBalance ? (React.createElement(BalanceCompStyle, { className: `collapse-distance ${getItemCount && balance ? ' ' : 'disable'}` },
18
18
  React.createElement(CollapseItem, { disable: disable,
19
19
  // status={'open'}
20
20
  title: React.createElement(React.Fragment, null,
@@ -22,14 +22,14 @@ const MuramoneyComp = ({ isMuramoney = true, currency, balance, useBalance, bala
22
22
  React.createElement("svg", { width: '12', height: '12', fill: 'none', viewBox: '0 0 12 12', xmlns: 'http://www.w3.org/2000/svg' },
23
23
  React.createElement("path", { d: 'M0 6H12', stroke: 'black', strokeWidth: '2' }),
24
24
  React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
25
- React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium muramoney-text' }, `${translate('useYourMoney')} (${handlePriceCheckFunc(balance, currency)} ${translate('balanceLowercase')})`)), description: React.createElement(React.Fragment, null, useBalance ? (React.createElement("div", { className: `muramoney-success-block` },
26
- React.createElement(Text, { className: 'account-p account-p4 account-primary-color2 account-font-medium muramoney-success-text' }, handlePriceCheckFunc(useBalance, currency)),
27
- React.createElement(Text, { text: 'remove', className: 'account-p account-p4 account-primary-color2 account-font-medium muramoney-remove-text', onClick: () => {
25
+ React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium balance-text' }, `${translate('useYourMoney')} (${handlePriceCheckFunc(balance, currency)} ${translate('balanceLowercase')})`)), description: React.createElement(React.Fragment, null, useBalance ? (React.createElement("div", { className: `balance-success-block` },
26
+ React.createElement(Text, { className: 'account-p account-p4 account-primary-color2 account-font-medium balance-success-text' }, handlePriceCheckFunc(useBalance, currency)),
27
+ React.createElement(Text, { text: 'remove', className: 'account-p account-p4 account-primary-color2 account-font-medium balance-remove-text', onClick: () => {
28
28
  balanceHandler(null);
29
29
  setDisable(false);
30
- } }))) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: balanceFields, className: `muramoney-block`, formOptions: {
31
- className: 'muramoney-container',
30
+ } }))) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: balanceFields, className: `balance-block`, formOptions: {
31
+ className: 'balance-container',
32
32
  } },
33
- React.createElement(AccountButton, { text: `add`, type: 'submit', btnType: `muramoney-version` })))) }))) : null;
33
+ React.createElement(AccountButton, { text: `add`, type: 'submit', btnType: `balance-version` })))) }))) : null;
34
34
  };
35
- export default MuramoneyComp;
35
+ export default BalanceComp;
@@ -0,0 +1,2 @@
1
+ export default BalanceCompStyle;
2
+ declare const BalanceCompStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,51 +1,51 @@
1
1
  import styled from 'styled-components';
2
- const MuramoneyCompStyle = styled.div `
3
- --account_muramoneyCompDistance: var(--sp5x);
2
+ const BalanceCompStyle = styled.div `
3
+ --account_balanceCompDistance: var(--sp5x);
4
4
 
5
- --account_muramoneyInputPadTB: var(--sp2x);
6
- --account_muramoneyInputPadLR: var(--sp2x);
7
- --account_muramoneyContainerGap: var(--sp2x);
5
+ --account_balanceInputPadTB: var(--sp2x);
6
+ --account_balanceInputPadLR: var(--sp2x);
7
+ --account_balanceContainerGap: var(--sp2x);
8
8
 
9
9
  border-top: 1px solid rgba(0, 0, 0, 0.4);
10
10
 
11
- .muramoney-container {
11
+ .balance-container {
12
12
  display: flex;
13
13
  justify-content: space-between;
14
- gap: var(--account_muramoneyContainerGap);
14
+ gap: var(--account_balanceContainerGap);
15
15
  }
16
16
 
17
- .muramoney-version {
17
+ .balance-version {
18
18
  width: fit-content !important;
19
19
  height: fit-content !important;
20
20
  margin-top: unset !important;
21
21
  }
22
22
 
23
- .muramoney-block {
23
+ .balance-block {
24
24
  flex: 1;
25
25
 
26
26
  .base-input {
27
- padding: var(--account_muramoneyInputPadTB) var(--account_muramoneyInputPadLR) !important;
27
+ padding: var(--account_balanceInputPadTB) var(--account_balanceInputPadLR) !important;
28
28
  border: 2px solid var(--account_primaryColor2) !important;
29
29
  }
30
30
  }
31
31
 
32
- .muramoney-text {
32
+ .balance-text {
33
33
  width: fit-content;
34
34
  transition: color var(--account_trTime) ease-out;
35
35
  cursor: pointer;
36
36
  }
37
37
 
38
- .muramoney-success-block {
38
+ .balance-success-block {
39
39
  display: flex;
40
- gap: var(--account_muramoneyContainerGap);
40
+ gap: var(--account_balanceContainerGap);
41
41
  justify-content: space-between;
42
- padding: var(--account_muramoneyInputPadTB) var(--account_muramoneyInputPadLR);
42
+ padding: var(--account_balanceInputPadTB) var(--account_balanceInputPadLR);
43
43
  border-radius: var(--sp1x);
44
44
  border: 2px solid var(--account_surfaceColor);
45
45
  background-color: var(--account_surfaceColor);
46
46
  }
47
47
 
48
- .muramoney-remove-text {
48
+ .balance-remove-text {
49
49
  text-decoration-line: underline;
50
50
  text-decoration-style: solid;
51
51
  text-decoration-skip-ink: none;
@@ -67,51 +67,51 @@ const MuramoneyCompStyle = styled.div `
67
67
 
68
68
  /* //! 1920 */
69
69
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
70
- --account_muramoneyCompDistance: var(--sp3-5x);
70
+ --account_balanceCompDistance: var(--sp3-5x);
71
71
 
72
- --account_muramoneyContainerGap: var(--sp2x);
72
+ --account_balanceContainerGap: var(--sp2x);
73
73
  }
74
74
 
75
75
  /* //! 1510 */
76
76
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
77
- --account_muramoneyCompDistance: var(--sp4x);
77
+ --account_balanceCompDistance: var(--sp4x);
78
78
 
79
- --account_muramoneyContainerGap: var(--sp2x);
79
+ --account_balanceContainerGap: var(--sp2x);
80
80
  }
81
81
 
82
82
  /* //! 1440 */
83
83
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
84
- --account_muramoneyCompDistance: var(--sp3x);
84
+ --account_balanceCompDistance: var(--sp3x);
85
85
 
86
- --account_muramoneyContainerGap: var(--sp2x);
86
+ --account_balanceContainerGap: var(--sp2x);
87
87
  }
88
88
 
89
89
  /* //! 1280 */
90
90
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
91
- --account_muramoneyCompDistance: var(--sp3x);
91
+ --account_balanceCompDistance: var(--sp3x);
92
92
 
93
- --account_muramoneyContainerGap: var(--sp1x);
93
+ --account_balanceContainerGap: var(--sp1x);
94
94
  }
95
95
 
96
96
  /* //! 1024 */
97
97
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
98
- --account_muramoneyCompDistance: var(--sp3x);
98
+ --account_balanceCompDistance: var(--sp3x);
99
99
 
100
- --account_muramoneyContainerGap: var(--sp1x);
100
+ --account_balanceContainerGap: var(--sp1x);
101
101
  }
102
102
 
103
103
  /* //! 768 */
104
104
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
105
- --account_muramoneyCompDistance: var(--sp3x);
105
+ --account_balanceCompDistance: var(--sp3x);
106
106
 
107
- --account_muramoneyContainerGap: var(--sp1x);
107
+ --account_balanceContainerGap: var(--sp1x);
108
108
  }
109
109
 
110
110
  /* //! Mobile */
111
111
  @media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
112
- --account_muramoneyCompDistance: var(--sp3x);
112
+ --account_balanceCompDistance: var(--sp3x);
113
113
 
114
- --account_muramoneyContainerGap: var(--sp1x);
114
+ --account_balanceContainerGap: var(--sp1x);
115
115
  }
116
116
  `;
117
- export default MuramoneyCompStyle;
117
+ export default BalanceCompStyle;
@@ -1,3 +1,5 @@
1
1
  export default CommentComp;
2
- declare function CommentComp(): React.JSX.Element;
2
+ declare function CommentComp({ fillCheckoutData }: {
3
+ fillCheckoutData: any;
4
+ }): React.JSX.Element;
3
5
  import React from 'react';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { CollapseContainer, CollapseItem, Text } from '@weareconceptstudio/core';
3
3
  import { Input } from '@weareconceptstudio/form';
4
4
  import CommentCompStyle from './style';
5
- const CommentComp = () => {
5
+ const CommentComp = ({ fillCheckoutData }) => {
6
6
  return (React.createElement(CommentCompStyle, { className: 'collapse-distance' },
7
7
  React.createElement(CollapseContainer, null,
8
8
  React.createElement(CollapseItem, { status: 'open', title: React.createElement(React.Fragment, null,
@@ -5,7 +5,7 @@ import { useAddressContext, useCheckoutContext } from '../../modules';
5
5
  import AccountButton from '../AccountButton';
6
6
  import FreeShippingComp from './FreeShippingComp';
7
7
  import PromoCodeComp from './PromoCodeComp';
8
- import MuramoneyComp from './MuramoneyComp';
8
+ import BalanceComp from './BalanceComp';
9
9
  import CommentComp from './CommentComp';
10
10
  //* Style
11
11
  import TotalCheckoutStyle from './style';
@@ -73,9 +73,9 @@ const TotalCheckout = memo(({ isShipping, children, confirmation, buttonProps, i
73
73
  !isCheckout ? (React.createElement(FreeShippingComp, { currency: currency, shippingCost: shippingCost, shippingCostValue: shippingCostValue, freeShippingRange: freeShippingRange })) : null,
74
74
  React.createElement(CollapseContainer, { className: 'collapse-container-wrapper' },
75
75
  React.createElement("div", { ref: innerCollapseRef },
76
- React.createElement(MuramoneyComp, { getItemCount: itemsCount, balance: user?.balance || 0, currency: currency, balanceHandler: handleBalance, useBalance: useBalance }),
76
+ React.createElement(BalanceComp, { getItemCount: itemsCount, balance: user?.balance || 0, currency: currency, balanceHandler: handleBalance, useBalance: useBalance }),
77
77
  React.createElement(PromoCodeComp, { getItemCount: itemsCount, promo_code: promo_code }))),
78
78
  isCheckout && typeof isShipping === 'boolean' && !isShipping ? React.createElement(CommentComp, { fillCheckoutData: fillCheckoutData }) : null,
79
- React.createElement(AccountButton, { url: buttonProps.url, btnType: `full-width`, text: buttonProps.text, type: buttonProps.type, className: `sticky-wrap-btn`, disabled: buttonProps.disabled, onClick: () => buttonProps.handleClick && buttonProps.handleClick() }))) : (React.createElement(SkeletonTotalCheckout, null))))));
79
+ React.createElement(AccountButton, { loading: buttonProps.loadingButton, url: buttonProps.url, btnType: `full-width`, text: buttonProps.text, type: buttonProps.type, className: `sticky-wrap-btn`, disabled: buttonProps.disabled, onClick: () => buttonProps.handleClick && buttonProps.handleClick() }))) : (React.createElement(SkeletonTotalCheckout, null))))));
80
80
  });
81
81
  export default TotalCheckout;
@@ -72,7 +72,7 @@ const TotalCheckoutStyle = styled.section `
72
72
  }
73
73
 
74
74
  .promo-code-text,
75
- .muramoney-text,
75
+ .balance-text,
76
76
  .comment-text {
77
77
  font-size: var(--account_textSize) !important;
78
78
  line-height: var(--account_lineHeight) !important;
@@ -151,7 +151,7 @@ const TotalCheckoutStyle = styled.section `
151
151
  @media (pointer: fine) {
152
152
  @media (hover: hover) {
153
153
  &:hover {
154
- .muramoney-text,
154
+ .balance-text,
155
155
  .promo-code-text,
156
156
  .comment-text {
157
157
  color: var(--account_primaryColor3);
@@ -184,8 +184,8 @@ const TotalCheckoutStyle = styled.section `
184
184
  }
185
185
  }
186
186
 
187
- .muramoney-container,
188
- .muramoney-success-block,
187
+ .balance-container,
188
+ .balance-success-block,
189
189
  .promo-code-container,
190
190
  .promo-code-success-block {
191
191
  margin-top: var(--account_commentMarginTop);
@@ -2,6 +2,7 @@ import React, { useMemo } from 'react';
2
2
  import { Text, Link, useUi, Page } from '@weareconceptstudio/core';
3
3
  import AccountStyle from './style';
4
4
  import { useAccountContext } from '../../../AccountProvider';
5
+ import Loader from '../../../components/Loader';
5
6
  const AccountTemplate = ({ isFullWidth = true, menuOptions = [], children }) => {
6
7
  const { winWidth } = useUi();
7
8
  const { useUser } = useAccountContext();
@@ -29,6 +30,7 @@ const AccountTemplate = ({ isFullWidth = true, menuOptions = [], children }) =>
29
30
  React.createElement(Text, { text: 'signOut', onClick: signOut, className: 'account-p account-p1 account-error-color account-font-bold sign-out' }))),
30
31
  lineStore,
31
32
  React.createElement("div", { className: `right-bar` },
33
+ React.createElement(Loader, { className: 'account' }),
32
34
  React.createElement("div", { className: `max-width-wrap ${isFullWidth ? 'full-max-width' : ''}` }, children)))))) : null;
33
35
  };
34
36
  export default AccountTemplate;
@@ -90,6 +90,7 @@ const AccountStyle = styled.section `
90
90
  width: var(--account_rightBarWidth);
91
91
  padding: 0 calc(var(--account_colDistance) / 2);
92
92
  margin-top: var(--account_stickyMarTop);
93
+ position: relative;
93
94
 
94
95
  .max-width-wrap {
95
96
  width: 100%;
@@ -239,6 +240,20 @@ const AccountStyle = styled.section `
239
240
  padding: 0 var(--account_contPaddingLR);
240
241
  }
241
242
 
243
+ .right-bar {
244
+ height: 100vh;
245
+ animation: heightMobile 1s ease-out 1.8s forwards;
246
+
247
+ @keyframes heightMobile {
248
+ 0% {
249
+ height: 100vh;
250
+ }
251
+ 100% {
252
+ height: auto;
253
+ }
254
+ }
255
+ }
256
+
242
257
  .space-line {
243
258
  width: 100%;
244
259
  border-bottom: 1px solid var(--account_primaryColor5);
@@ -277,6 +292,20 @@ const AccountStyle = styled.section `
277
292
  padding: 0 var(--account_contPaddingLR);
278
293
  }
279
294
 
295
+ .right-bar {
296
+ height: 150vh;
297
+ animation: heightMobile 1s ease-out 1.8s forwards;
298
+
299
+ @keyframes heightMobile {
300
+ 0% {
301
+ height: 100vh;
302
+ }
303
+ 100% {
304
+ height: auto;
305
+ }
306
+ }
307
+ }
308
+
280
309
  .space-line {
281
310
  width: 100%;
282
311
  border-bottom: 1px solid var(--account_primaryColor5);
@@ -11,6 +11,6 @@ const ShippingBillingInfo = memo(({ className, shipping_address, billing_address
11
11
  React.createElement("div", { className: `info-space-line` }),
12
12
  React.createElement("div", { className: `info-wrap shipped` },
13
13
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 value`, text: `shippedTo` }),
14
- shipping_address.map((item) => (React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color1 nowrap`, text: item }))))));
14
+ shipping_address.map((item, index) => (React.createElement(Text, { key: index, className: `account-p account-p3 account-font-regular account-primary-color1 nowrap`, text: item }))))));
15
15
  });
16
16
  export default ShippingBillingInfo;
@@ -11,7 +11,7 @@ const CartItems = memo(({ data, className, title, smallFontSize, additionalParam
11
11
  const { winWidth } = useUi();
12
12
  const { maxQty, currency } = useAccountContext();
13
13
  //! Store
14
- const orderStore = useMemo(() => {
14
+ const itemsStore = useMemo(() => {
15
15
  return winWidth >= 768 ? (React.createElement("div", { className: `order-items-table-wrap` },
16
16
  React.createElement("div", { className: `titles-wrap` },
17
17
  React.createElement("div", { className: `title-wrap tl-col-1` },
@@ -37,6 +37,6 @@ const CartItems = memo(({ data, className, title, smallFontSize, additionalParam
37
37
  React.createElement(Text, { className: `account-p ${smallFontSize ? 'account-p2' : 'account-p1'} account-font-bold account-primary-color1 cart-items-title2-version`, text: title }),
38
38
  React.createElement(AccountButton, { url: '/cart/', text: `editCart`, btnType: `green-small-text`, className: 'cart-items-edit-btn' }))) : (React.createElement(Text, { className: `account-p ${smallFontSize ? 'account-p2' : 'account-p1'} account-font-bold account-primary-color1 cart-items-title1-version`, text: title })),
39
39
  additionalParameters.horizontalLine ? React.createElement("div", { className: `order-items-line` }) : null,
40
- orderStore));
40
+ itemsStore));
41
41
  });
42
42
  export default CartItems;
@@ -1,5 +1,5 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { api, Page } from '@weareconceptstudio/core';
1
+ import React, { useCallback, useRef, useState } from 'react';
2
+ import { Page } from '@weareconceptstudio/core';
3
3
  import { Sequence, TotalCheckout } from '../../../components';
4
4
  import { useAddressContext } from '../../address';
5
5
  import { useAccountContext } from '../../../AccountProvider';
@@ -26,8 +26,19 @@ const CheckoutTemplate = () => {
26
26
  const handleCheckoutFirstStep = () => {
27
27
  firstStepFormRef.current.submit();
28
28
  };
29
+ const [loadingProcessToPayment, setLoadingProcessToPayment] = useState(false);
29
30
  const handleCheckoutBtn = useCallback(() => {
30
- checkStep.isShipping ? handleCheckoutFirstStep() : handleCheckout();
31
+ if (checkStep.isShipping) {
32
+ handleCheckoutFirstStep();
33
+ }
34
+ else {
35
+ setLoadingProcessToPayment(true);
36
+ handleCheckout().finally(() => {
37
+ setTimeout(() => {
38
+ setLoadingProcessToPayment(false);
39
+ }, 1000);
40
+ });
41
+ }
31
42
  }, [checkStep]);
32
43
  return (React.createElement(Page, { className: 'checkout use-account' },
33
44
  React.createElement(AccountContainer, { className: `second-version` },
@@ -38,6 +49,7 @@ const CheckoutTemplate = () => {
38
49
  handleClick: handleCheckoutBtn,
39
50
  type: checkStep.isShipping ? 'submit' : 'button',
40
51
  text: checkStep.isShipping ? 'proceedToCheckout' : 'proceedToPayment',
52
+ loadingButton: loadingProcessToPayment,
41
53
  } }, !addressLoading ? (React.createElement(React.Fragment, null,
42
54
  React.createElement(Sequence, { step: checkStep.isShipping ? 'shipping' : 'review' }),
43
55
  checkStep.isShipping ? React.createElement(StepShipping, { firstStepFormRef: firstStepFormRef }) : React.createElement(StepReview, { items: items }))) : (React.createElement(React.Fragment, null,
@@ -4,14 +4,14 @@ import { popupCardSVG } from '../icons';
4
4
  //* Style
5
5
  import AddNewCardStyle from './style';
6
6
  const AddNewCard = ({ className, isCheckout }) => {
7
- const addNew = async () => {
8
- return await api.post('add-card', { backUrl: `${window.location.href}${isCheckout ? '?c=paymentMethods' : ''}` }).then((res) => {
7
+ const addNewCard = async () => {
8
+ return await api.post('add-card', { backUrl: `${window.location.href}`, isCheckout }).then((res) => {
9
9
  if (res.redirect_url) {
10
10
  window.location.href = res.redirect_url;
11
11
  }
12
12
  });
13
13
  };
14
- return (React.createElement(AddNewCardStyle, { className: `new-card-container ${className || ''}`, onClick: addNew },
14
+ return (React.createElement(AddNewCardStyle, { className: `new-card-container ${className || ''}`, onClick: addNewCard },
15
15
  React.createElement("div", { className: `new-card-wrap` },
16
16
  React.createElement("div", { className: 'account-card-add-icon' }, popupCardSVG),
17
17
  React.createElement(Text, { className: `account-add-card-text account-p account-p3 account-font-medium account-primary-color1`, text: 'addNewCard' }))));
@@ -1,9 +1,10 @@
1
1
  export default Card;
2
- declare function Card({ cardOption, className, selectedPayment, setSelectedPayment, deleteCard }: {
2
+ declare function Card({ cardOption, className, selectedPayment, setSelectedPayment, deleteCard, isCheckout }: {
3
3
  cardOption: any;
4
4
  className: any;
5
5
  selectedPayment: any;
6
6
  setSelectedPayment: any;
7
7
  deleteCard: any;
8
+ isCheckout: any;
8
9
  }): React.JSX.Element;
9
10
  import React from 'react';
@@ -6,13 +6,8 @@ import WarningMessageForPopup from '../../../components/WarningMessageForPopup';
6
6
  import AccountButton from '../../../components/AccountButton';
7
7
  //* Style
8
8
  import CardStyle from './style';
9
- const Card = ({ cardOption, className, selectedPayment, setSelectedPayment, deleteCard }) => {
9
+ const Card = ({ cardOption, className, selectedPayment, setSelectedPayment, deleteCard, isCheckout }) => {
10
10
  const { openPopup } = useUi();
11
- const formatCardNumber = (number) => {
12
- if (!number)
13
- return '';
14
- return number.replace(/(.{4})/g, '$1 ').trim();
15
- };
16
11
  //! Handle Popups
17
12
  const handleDeletePopup = useCallback(() => {
18
13
  openPopup(React.createElement(WarningMessageForPopup, { isDelete: true, title: 'deleteCardMessage', description: 'confirmDeleteCard', onRemove: () => deleteCard(cardOption.id) }), {
@@ -28,9 +23,9 @@ const Card = ({ cardOption, className, selectedPayment, setSelectedPayment, dele
28
23
  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' })))) : null),
29
24
  React.createElement("div", { className: `card-wrap-center` },
30
25
  React.createElement(Text, { className: `card-full-name account-p account-p3 account-font-regular`, text: cardOption.name }),
31
- React.createElement(Text, { className: `card-number account-p account-p1 account-font-regular`, text: formatCardNumber(cardOption.number) })),
26
+ React.createElement(Text, { className: `card-number account-p account-p1 account-font-regular`, text: cardOption.number })),
32
27
  React.createElement("div", { className: `card-wrap-bottom` },
33
28
  React.createElement(Text, { className: `account-p account-p3 account-font-regular`, text: cardOption.is_expired ? 'cardExpired' : `Exp. Date ${cardOption.exp_date}` }),
34
- React.createElement(AccountButton, { text: `remove`, onClick: handleDeletePopup, btnType: `green-small-text`, className: `account-card-remove-btn account-p account-p3 account-font-regular` }))));
29
+ !isCheckout && selectedPayment != cardOption.id ? (React.createElement(AccountButton, { text: `remove`, onClick: handleDeletePopup, btnType: `green-small-text`, className: `account-card-remove-btn account-p account-p3 account-font-regular` })) : null)));
35
30
  };
36
31
  export default Card;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Text } from '@weareconceptstudio/core';
2
+ import { Text, api } from '@weareconceptstudio/core';
3
3
  import { useCheckoutContext } from '../../checkout';
4
4
  //* Components
5
5
  import AccountButton from '../../../components/AccountButton';
@@ -7,12 +7,28 @@ import PaymentMethods from '../PaymentMethods';
7
7
  import SelectedPayment from '../SelectedPayment';
8
8
  //* Style
9
9
  import PaymentStyle from './style';
10
+ import { useAccountContext } from '../../../AccountProvider';
10
11
  const Payment = ({ title, onClick, className }) => {
12
+ const { useUser } = useAccountContext();
11
13
  const { checkoutData, fillCheckoutData } = useCheckoutContext();
14
+ const { user } = useUser();
15
+ const addNewCard = async () => {
16
+ return await api.post('add-card', { backUrl: `${window.location.href}`, isCheckout: true }).then((res) => {
17
+ if (res.redirect_url) {
18
+ window.location.href = res.redirect_url;
19
+ }
20
+ });
21
+ };
22
+ const setSelectedPayment = (value) => {
23
+ fillCheckoutData('paymentType', value);
24
+ if (value == 'card') {
25
+ addNewCard();
26
+ }
27
+ };
12
28
  return (React.createElement(PaymentStyle, { className: `item-container ${className || ''}` },
13
29
  React.createElement("div", { className: `change-payment-wrap` },
14
30
  React.createElement(Text, { className: `account-p account-p2 account-font-bold account-primary-color1`, text: title }),
15
- checkoutData.paymentType && (React.createElement(AccountButton, { text: `change`, btnType: `green-small-text`, onClick: onClick }))),
16
- checkoutData.paymentType ? (React.createElement(SelectedPayment, null)) : (React.createElement(PaymentMethods, { selectedPayment: checkoutData.paymentType, setSelectedPayment: (value) => fillCheckoutData('paymentType', value) }))));
31
+ user.default_payment_method && (React.createElement(AccountButton, { text: `change`, btnType: `green-small-text`, onClick: onClick }))),
32
+ user.default_payment_method ? (React.createElement(SelectedPayment, null)) : (React.createElement(PaymentMethods, { selectedPayment: checkoutData.paymentType, setSelectedPayment: setSelectedPayment }))));
17
33
  };
18
34
  export default Payment;
@@ -23,9 +23,7 @@ const PaymentMethodItem = ({ item, selectedPayment, setSelectedPayment, singlePa
23
23
  React.createElement("svg", { version: '1.1', viewBox: '0 0 32 32', xmlns: 'http://www.w3.org/2000/svg', className: `checkbox-icon ${selectedPayment === item.value || (item.value == 'card' && isNumeric(selectedPayment)) || singlePayment ? 'selected' : 'note-selected'}` },
24
24
  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' })))),
25
25
  isCardType && singlePayment && (React.createElement("div", { className: 'card-details' },
26
- React.createElement("span", { className: 'card-number' }, item.card.number),
27
- React.createElement("span", { className: 'card-exp-date' },
28
- "Exp. Date ",
29
- item.card.exp_date)))));
26
+ React.createElement("span", { className: 'card-number' }, item.card.short_number),
27
+ item.card.is_expired ? (React.createElement(Text, { tag: 'span', className: 'card-exp-date', text: 'cardExpired' })) : null))));
30
28
  };
31
29
  export default PaymentMethodItem;
@@ -1,11 +1,15 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
+ import { useAccountContext } from '../../../AccountProvider';
2
3
  //* Components
3
4
  import PaymentMethodItem from '../PaymentMethodItem';
4
5
  //* Style
5
6
  import PaymentMethodsStyle from './style';
6
- import { useAccountContext } from '../../../AccountProvider';
7
7
  const PaymentMethods = ({ className, selectedPayment, setSelectedPayment }) => {
8
- const { paymentOptions } = useAccountContext();
9
- return (React.createElement(PaymentMethodsStyle, { className: `payment-item-container ${className || ''}` }, paymentOptions.map((item, index) => (React.createElement(PaymentMethodItem, { item: item, index: index, selectedPayment: selectedPayment, setSelectedPayment: setSelectedPayment })))));
8
+ const { paymentOptions, useUser } = useAccountContext();
9
+ const { user } = useUser();
10
+ const paymentMethods = useMemo(() => {
11
+ return !!user.default_payment_method ? paymentOptions : [{ label: 'Card', value: 'card' }, ...paymentOptions];
12
+ }, [user, paymentOptions]);
13
+ return (React.createElement(PaymentMethodsStyle, { className: `payment-item-container ${className || ''}` }, paymentMethods.map((item, index) => (React.createElement(PaymentMethodItem, { key: index, item: item, selectedPayment: selectedPayment, setSelectedPayment: setSelectedPayment })))));
10
14
  };
11
15
  export default PaymentMethods;
@@ -19,7 +19,7 @@ const PaymentWrap = ({ selectedPayment, setSelectedPayment, isCheckout = false }
19
19
  return (React.createElement(PaymentWrapStyle, null,
20
20
  React.createElement("div", { className: `flex-wrapper` },
21
21
  React.createElement(AddNewCard, { isCheckout: isCheckout }),
22
- cards?.map((card, index) => (React.createElement(Card, { key: index, cardOption: card, selectedPayment: selectedPayment, setSelectedPayment: setSelectedPayment, deleteCard: deleteCard })))),
22
+ cards?.map((card, index) => (React.createElement(Card, { key: index, cardOption: card, selectedPayment: selectedPayment, setSelectedPayment: setSelectedPayment, deleteCard: deleteCard, isCheckout: isCheckout })))),
23
23
  React.createElement("div", { className: 'line' }),
24
24
  React.createElement(PaymentMethods, { selectedPayment: selectedPayment, setSelectedPayment: setSelectedPayment })));
25
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weareconceptstudio/account",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Concept Studio Account",
5
5
  "author": "Concept Studio",
6
6
  "license": "ISC",
@@ -1,10 +0,0 @@
1
- export default MuramoneyComp;
2
- declare function MuramoneyComp({ isMuramoney, currency, balance, useBalance, balanceHandler, getItemCount }: {
3
- isMuramoney?: boolean;
4
- currency: any;
5
- balance: any;
6
- useBalance: any;
7
- balanceHandler: any;
8
- getItemCount: any;
9
- }): React.JSX.Element;
10
- import React from 'react';
@@ -1,2 +0,0 @@
1
- export default MuramoneyCompStyle;
2
- declare const MuramoneyCompStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;