@faststore/core 3.64.1 → 3.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +49 -49
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +3 -2
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/2778.js +1 -1
- package/.next/server/chunks/4365.js +1 -0
- package/.next/server/chunks/5244.js +1 -0
- package/.next/server/chunks/6011.js +2 -2
- package/.next/server/chunks/6886.js +1 -1
- package/.next/server/chunks/7692.js +1 -1
- package/.next/server/chunks/{7819.js → 8130.js} +1 -6
- package/.next/server/chunks/83.js +1 -1
- package/.next/server/chunks/{1650.js → 8404.js} +1 -6
- package/.next/server/chunks/948.js +2 -2
- package/.next/server/chunks/9563.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +1 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/account/403.js +1 -1
- package/.next/server/pages/account/403.js.nft.json +1 -1
- package/.next/server/pages/account/404.js +1 -1
- package/.next/server/pages/account/404.js.nft.json +1 -1
- package/.next/server/pages/account/[...unknown].js.nft.json +1 -1
- package/.next/server/pages/account/orders/[id].js +1 -1
- package/.next/server/pages/account/orders/[id].js.nft.json +1 -1
- package/.next/server/pages/account/orders.js +1 -1
- package/.next/server/pages/account/orders.js.nft.json +1 -1
- package/.next/server/pages/account/profile.js +1 -1
- package/.next/server/pages/account/profile.js.nft.json +1 -1
- package/.next/server/pages/account/security.js +1 -1
- package/.next/server/pages/account/security.js.nft.json +1 -1
- package/.next/server/pages/account/user-details.js +1 -1
- package/.next/server/pages/account/user-details.js.nft.json +1 -1
- package/.next/server/pages/account.js +1 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +2 -2
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/api/health/live.js.nft.json +1 -1
- package/.next/server/pages/api/health/ready.js.nft.json +1 -1
- package/.next/server/pages/api/preview.js.nft.json +1 -1
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/{4803.82e70544e5ad3f13.js → 4803.de5b14237d616808.js} +1 -1
- package/.next/static/chunks/4949.ea0775ca3029fb98.js +1 -0
- package/.next/static/chunks/{7692.a2ae6dca22038761.js → 7692.1597d1d292a09609.js} +1 -1
- package/.next/static/chunks/7861.3fe27a385fea2fb7.js +6 -0
- package/.next/static/chunks/9173-c1819846b9006c7a.js +1 -0
- package/.next/static/chunks/941.80a0abd58f11d696.js +1 -0
- package/.next/static/chunks/pages/{[...slug]-72047653203f9fd2.js → [...slug]-0db18c1c0920e8d2.js} +1 -1
- package/.next/static/chunks/pages/_app-1c533ab202b7acef.js +1 -0
- package/.next/static/chunks/pages/account/403-c791997011f970b6.js +1 -0
- package/.next/static/chunks/pages/account/404-74e64bb12e8f5a68.js +1 -0
- package/.next/static/chunks/pages/account/orders/[id]-b9feb0c860ff1cec.js +1 -0
- package/.next/static/chunks/pages/account/orders-1d8409a8b4b0e581.js +1 -0
- package/.next/static/chunks/pages/account/profile-5a919fa02b76a422.js +1 -0
- package/.next/static/chunks/pages/account/security-b5ab3d1ecbbea9d9.js +1 -0
- package/.next/static/chunks/pages/account/user-details-6f9fe72e02f5c5df.js +1 -0
- package/.next/static/chunks/webpack-a24b8ac1ca628dfe.js +1 -0
- package/.next/static/css/32b1696118552960.css +1 -0
- package/.next/static/css/{84d35f475d0dc928.css → 831a1f72fe4b2d80.css} +1 -1
- package/.next/static/css/ba1d8927d8745656.css +1 -0
- package/.next/static/css/e46393a76c5d93a9.css +1 -0
- package/.next/static/czdZM7l3yYhwzU9FTEtWh/_buildManifest.js +1 -0
- package/.next/trace +131 -129
- package/.turbo/turbo-build.log +24 -21
- package/.turbo/turbo-test.log +5 -5
- package/@generated/gql.ts +14 -6
- package/@generated/graphql.ts +372 -5
- package/@generated/persisted-documents.json +4 -3
- package/@generated/schema.graphql +249 -0
- package/CHANGELOG.md +6 -0
- package/package.json +6 -4
- package/public/icons.svg +26 -0
- package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawer.tsx +3 -1
- package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawerBody.tsx +12 -2
- package/src/components/account/MyAccountDrawer/OrganizationSignInButton/OrganizationSignInButton.tsx +7 -1
- package/src/components/account/MyAccountLayout/MyAccountLayout.tsx +12 -2
- package/src/components/account/MyAccountMenu/styles.scss +1 -1
- package/src/components/account/MyAccountUserDetails/MyAccountUserDetails.tsx +61 -0
- package/src/components/account/MyAccountUserDetails/index.ts +1 -0
- package/src/components/account/MyAccountUserDetails/styles.module.scss +108 -0
- package/src/components/account/components/MyAccountTag/MyAccountTag.tsx +13 -0
- package/src/components/account/components/MyAccountTag/index.ts +1 -0
- package/src/components/account/components/MyAccountTag/styles.scss +23 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountBuyingPolicyAlert/MyAccountBuyingPolicyAlert.tsx +153 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountBuyingPolicyAlert/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountBuyingPolicyAlert/styles.scss +72 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/MyAccountOrderActionModal.tsx +41 -88
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/styles.module.scss +29 -16
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/MyAccountOrderActions.tsx +54 -107
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/styles.scss +5 -28
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx +16 -3
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentCard.tsx +1 -3
- package/src/components/account/orders/MyAccountOrderDetails/section.module.scss +13 -2
- package/src/components/account/profile/i18n.ts +7 -0
- package/src/components/account/profile/index.ts +1 -0
- package/src/components/account/profile/profile.module.scss +89 -0
- package/src/components/account/profile/profile.tsx +63 -0
- package/src/components/account/profile/use-date-formatter.ts +25 -0
- package/src/components/account/security/SecurityDrawer.tsx +160 -0
- package/src/components/account/security/SecuritySection.tsx +45 -0
- package/src/components/account/security/index.ts +2 -0
- package/src/components/account/security/styles.module.scss +263 -0
- package/src/components/navigation/Navbar/Navbar.tsx +4 -1
- package/src/components/navigation/NavbarSlider/NavbarSlider.tsx +4 -1
- package/src/experimental/myAccountSeverSideProps.ts +9 -0
- package/src/pages/account/orders/[id].tsx +61 -5
- package/src/pages/account/orders/index.tsx +14 -2
- package/src/pages/account/profile.tsx +31 -5
- package/src/pages/account/security.tsx +15 -4
- package/src/pages/account/user-details.tsx +54 -17
- package/src/sdk/account/getIsRepresentative.ts +20 -0
- package/src/sdk/account/getMyAccountRoutes.ts +17 -13
- package/src/sdk/account/useOrderAuthorization.ts +79 -0
- package/src/utils/getCookie.ts +7 -0
- package/src/utils/userOrderStatus.ts +4 -0
- package/test/server/index.test.ts +3 -0
- package/.next/server/chunks/2570.js +0 -1
- package/.next/server/chunks/941.js +0 -1
- package/.next/static/chunks/4949.58cc42cd6109f59a.js +0 -6
- package/.next/static/chunks/9173-94386b70c1626a31.js +0 -1
- package/.next/static/chunks/941.6fb7ccae2268ce5d.js +0 -1
- package/.next/static/chunks/pages/_app-c3dce4c45c6c6b35.js +0 -1
- package/.next/static/chunks/pages/account/403-6f4addf9a9d54a1c.js +0 -1
- package/.next/static/chunks/pages/account/404-9e8ca6ee5f981dae.js +0 -1
- package/.next/static/chunks/pages/account/orders/[id]-0780c7252aa3283f.js +0 -1
- package/.next/static/chunks/pages/account/orders-df4fc9cd58141910.js +0 -1
- package/.next/static/chunks/pages/account/profile-adfe3518bdab5463.js +0 -1
- package/.next/static/chunks/pages/account/security-ea5c8811b3e6e415.js +0 -1
- package/.next/static/chunks/pages/account/user-details-9309d14f4e59f398.js +0 -1
- package/.next/static/chunks/webpack-c76f1cac87402029.js +0 -1
- package/.next/static/css/506442c818624bd2.css +0 -1
- package/.next/static/xxciKxTM3tLvpTyfanFWB/_buildManifest.js +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/useOrderActionModal.ts +0 -38
- package/src/sdk/account/useApproveOrder.ts +0 -53
- package/src/sdk/account/useRejectOrder.ts +0 -53
- /package/.next/static/{xxciKxTM3tLvpTyfanFWB → czdZM7l3yYhwzU9FTEtWh}/_ssgManifest.js +0 -0
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
Dropdown,
|
|
3
|
+
DropdownButton,
|
|
4
|
+
DropdownItem,
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
Icon as UIIcon,
|
|
7
|
+
useUI,
|
|
8
|
+
IconButton as UIIconButton,
|
|
9
|
+
} from '@faststore/ui'
|
|
10
|
+
import { useState } from 'react'
|
|
11
|
+
import MyAccountOrderActionModal from 'src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal'
|
|
6
12
|
import { useCancelOrder } from 'src/sdk/account/useCancelOrder'
|
|
7
|
-
import { useApproveOrder } from 'src/sdk/account/useApproveOrder'
|
|
8
|
-
import { useRejectOrder } from 'src/sdk/account/useRejectOrder'
|
|
9
|
-
|
|
10
|
-
const TOASTS_CONFIG = {
|
|
11
|
-
cancel: {
|
|
12
|
-
success: 'Order canceled successfully',
|
|
13
|
-
error: "Order couldn't be canceled due to a technical issue. Try again.",
|
|
14
|
-
},
|
|
15
|
-
approve: {
|
|
16
|
-
success: 'Order approved successfully',
|
|
17
|
-
error: "Order couldn't be approved due to a technical issue. Try again.",
|
|
18
|
-
},
|
|
19
|
-
reject: {
|
|
20
|
-
success: 'Order rejected successfully',
|
|
21
|
-
error: "Order couldn't be rejected due to a technical issue. Try again.",
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
13
|
|
|
25
14
|
interface MyAccountOrderActionsProps {
|
|
26
15
|
allowCancellation: boolean
|
|
@@ -33,21 +22,12 @@ export default function MyAccountOrderActions({
|
|
|
33
22
|
orderId,
|
|
34
23
|
customerEmail,
|
|
35
24
|
}: MyAccountOrderActionsProps) {
|
|
36
|
-
const
|
|
37
|
-
const { isOpen, actionType, fade, openDialog, closeDialog } =
|
|
38
|
-
useOrderActionModal()
|
|
25
|
+
const [isCancelOpen, setIsCancelOpen] = useState<boolean>(false)
|
|
39
26
|
const { pushToast } = useUI()
|
|
40
27
|
|
|
41
|
-
const { cancelOrder, loading
|
|
42
|
-
const { approveOrder, loading: approveLoading } = useApproveOrder()
|
|
43
|
-
const { rejectOrder, loading: rejectLoading } = useRejectOrder()
|
|
44
|
-
|
|
45
|
-
const loading =
|
|
46
|
-
(actionType === 'cancel' && cancelLoading) ||
|
|
47
|
-
(actionType === 'approve' && approveLoading) ||
|
|
48
|
-
(actionType === 'reject' && rejectLoading)
|
|
28
|
+
const { cancelOrder, loading } = useCancelOrder()
|
|
49
29
|
|
|
50
|
-
const
|
|
30
|
+
const handleCancel = async () => {
|
|
51
31
|
const data = {
|
|
52
32
|
orderId,
|
|
53
33
|
customerEmail,
|
|
@@ -55,99 +35,66 @@ export default function MyAccountOrderActions({
|
|
|
55
35
|
reason: '',
|
|
56
36
|
}
|
|
57
37
|
|
|
58
|
-
const actions = {
|
|
59
|
-
cancel: cancelOrder,
|
|
60
|
-
approve: approveOrder,
|
|
61
|
-
reject: rejectOrder,
|
|
62
|
-
}
|
|
63
|
-
|
|
64
38
|
try {
|
|
65
|
-
|
|
39
|
+
await cancelOrder({ data: data })
|
|
66
40
|
|
|
67
|
-
|
|
68
|
-
throw new Error(`Invalid action type: ${type}`)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Execute the action
|
|
72
|
-
await action({ data: data })
|
|
73
|
-
|
|
74
|
-
closeDialog()
|
|
41
|
+
setIsCancelOpen(false)
|
|
75
42
|
pushToast({
|
|
76
43
|
status: 'INFO',
|
|
77
|
-
message:
|
|
44
|
+
message: 'Order canceled successfully',
|
|
78
45
|
icon: <UIIcon width={30} height={30} name="CircleWavyCheck" />,
|
|
79
46
|
})
|
|
80
47
|
} catch (error) {
|
|
81
48
|
pushToast({
|
|
82
49
|
status: 'ERROR',
|
|
83
|
-
message:
|
|
50
|
+
message: "Order couldn't be canceled due to a technical issue.",
|
|
84
51
|
icon: <UIIcon width={30} height={30} name="CircleWavyWarning" />,
|
|
85
52
|
})
|
|
86
53
|
}
|
|
87
54
|
}
|
|
88
55
|
|
|
56
|
+
// Don't render if no actions are available
|
|
57
|
+
if (!allowCancellation) {
|
|
58
|
+
return null
|
|
59
|
+
}
|
|
60
|
+
|
|
89
61
|
return (
|
|
90
62
|
<>
|
|
91
|
-
<div data-fs-order-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
size="small"
|
|
116
|
-
icon={<UIIcon name="XCircle" />}
|
|
117
|
-
type="button"
|
|
118
|
-
onClick={() => openDialog('reject')}
|
|
119
|
-
>
|
|
120
|
-
Reject
|
|
121
|
-
</UIButton>
|
|
122
|
-
)}
|
|
123
|
-
{isMobile || isTablet ? (
|
|
124
|
-
<UIIconButton
|
|
125
|
-
aria-label="Approve"
|
|
126
|
-
icon={<UIIcon name="CircleCheck" />}
|
|
127
|
-
variant="primary"
|
|
128
|
-
type="button"
|
|
129
|
-
onClick={() => openDialog('approve')}
|
|
130
|
-
/>
|
|
131
|
-
) : (
|
|
132
|
-
<UIButton
|
|
133
|
-
variant="primary"
|
|
134
|
-
size="small"
|
|
135
|
-
icon={<UIIcon name="CircleCheck" />}
|
|
136
|
-
type="button"
|
|
137
|
-
onClick={() => openDialog('approve')}
|
|
138
|
-
>
|
|
139
|
-
Approve
|
|
140
|
-
</UIButton>
|
|
141
|
-
)} */}
|
|
63
|
+
<div data-fs-order-actions>
|
|
64
|
+
<Dropdown>
|
|
65
|
+
<DropdownButton aria-label="View More" data-fs-dropdown-button>
|
|
66
|
+
<UIIcon
|
|
67
|
+
name="DotsThree"
|
|
68
|
+
width={20}
|
|
69
|
+
height={20}
|
|
70
|
+
data-fs-dropdown-icon
|
|
71
|
+
/>
|
|
72
|
+
</DropdownButton>
|
|
73
|
+
<DropdownMenu align="right">
|
|
74
|
+
{allowCancellation && (
|
|
75
|
+
<DropdownItem
|
|
76
|
+
type="button"
|
|
77
|
+
onClick={() => setIsCancelOpen(true)}
|
|
78
|
+
style={{
|
|
79
|
+
color: 'var(--fs-color-text)',
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
Cancel order
|
|
83
|
+
</DropdownItem>
|
|
84
|
+
)}
|
|
85
|
+
</DropdownMenu>
|
|
86
|
+
</Dropdown>
|
|
142
87
|
</div>
|
|
143
88
|
|
|
144
89
|
<MyAccountOrderActionModal
|
|
145
|
-
isOpen={
|
|
90
|
+
isOpen={isCancelOpen}
|
|
146
91
|
loading={loading}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
92
|
+
title="Cancel order"
|
|
93
|
+
message="Are you sure you want to cancel this order? This action can't be undone."
|
|
94
|
+
confirmText="Cancel order"
|
|
95
|
+
danger
|
|
96
|
+
onClose={() => setIsCancelOpen(false)}
|
|
97
|
+
onConfirm={handleCancel}
|
|
151
98
|
/>
|
|
152
99
|
</>
|
|
153
100
|
)
|
package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/styles.scss
CHANGED
|
@@ -1,33 +1,10 @@
|
|
|
1
|
-
[data-fs-order-
|
|
1
|
+
[data-fs-order-actions] {
|
|
2
2
|
display: flex;
|
|
3
|
-
flex-flow: row
|
|
3
|
+
flex-flow: row;
|
|
4
|
+
flex-shrink: 0;
|
|
4
5
|
align-items: center;
|
|
5
6
|
|
|
6
|
-
[data-fs-
|
|
7
|
-
|
|
8
|
-
--fs-button-secondary-bkg-color-hover: var(--fs-button-secondary-text-color);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@include media("<=tablet") {
|
|
12
|
-
position: fixed;
|
|
13
|
-
right: 0;
|
|
14
|
-
bottom: 0;
|
|
15
|
-
left: 0;
|
|
16
|
-
z-index: var(--fs-z-index-top);
|
|
17
|
-
gap: var(--fs-spacing-1);
|
|
18
|
-
justify-content: flex-end;
|
|
19
|
-
padding: 1.25rem;
|
|
20
|
-
background: var(--fs-color-body-bkg);
|
|
21
|
-
border-top: var(--fs-border-width) solid var(--fs-color-neutral-2);
|
|
22
|
-
box-shadow: 0 -1px 15px 0 rgb(0 0 0 / 10.2%);
|
|
23
|
-
|
|
24
|
-
[data-fs-order-details-header-actions-cancel] {
|
|
25
|
-
margin-right: auto;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@include media(">tablet") {
|
|
30
|
-
flex-flow: row;
|
|
31
|
-
flex-shrink: 0;
|
|
7
|
+
[data-fs-dropdown-button] {
|
|
8
|
+
width: var(--fs-spacing-7);
|
|
32
9
|
}
|
|
33
10
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ServerOrderDetailsQueryQuery } from '@generated/graphql'
|
|
2
|
-
|
|
3
1
|
import { Icon as UIIcon, IconButton as UIIconButton } from '@faststore/ui'
|
|
4
2
|
import MyAccountStatusCard from 'src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard'
|
|
5
3
|
import MyAccountDeliveryCard from './MyAccountDeliveryCard'
|
|
@@ -8,17 +6,18 @@ import MyAccountOrderActions from './MyAccountOrderActions'
|
|
|
8
6
|
import MyAccountOrderedByCard from './MyAccountOrderedByCard'
|
|
9
7
|
import MyAccountPaymentCard from './MyAccountPaymentCard'
|
|
10
8
|
import MyAccountSummaryCard from './MyAccountSummaryCard'
|
|
9
|
+
import MyAccountBuyingPolicyAlert from './MyAccountBuyingPolicyAlert'
|
|
11
10
|
|
|
12
11
|
import type { OrderStatusKey } from 'src/utils/userOrderStatus'
|
|
13
12
|
import MyAccountStatusBadge from '../../components/MyAccountStatusBadge'
|
|
14
13
|
import MyAccountMoreInformationCard from './MyAccountMoreInformationCard'
|
|
15
14
|
import styles from './section.module.scss'
|
|
15
|
+
import type { ServerOrderDetailsQueryQuery } from '@generated/graphql'
|
|
16
16
|
|
|
17
17
|
export interface MyAccountOrderDetailsProps {
|
|
18
18
|
order: ServerOrderDetailsQueryQuery['userOrder']
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// This constant is used to determine if we should go back in history or redirect to the orders page
|
|
22
21
|
const MIN_HISTORY_LENGTH_TO_GO_BACK = 2
|
|
23
22
|
|
|
24
23
|
export default function MyAccountOrderDetails({
|
|
@@ -51,14 +50,24 @@ export default function MyAccountOrderDetails({
|
|
|
51
50
|
/>
|
|
52
51
|
</div>
|
|
53
52
|
</div>
|
|
53
|
+
|
|
54
54
|
<MyAccountOrderActions
|
|
55
55
|
allowCancellation={order.allowCancellation}
|
|
56
56
|
orderId={order.orderId}
|
|
57
57
|
customerEmail={order.clientProfileData?.email}
|
|
58
58
|
/>
|
|
59
59
|
</header>
|
|
60
|
+
|
|
60
61
|
<main data-fs-order-details-content>
|
|
62
|
+
{order.ruleForAuthorization && (
|
|
63
|
+
<MyAccountBuyingPolicyAlert
|
|
64
|
+
ruleForAuthorization={order.ruleForAuthorization}
|
|
65
|
+
onAuthorizationComplete={() => window.location.reload()}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
|
|
61
69
|
<MyAccountOrderedByCard clientProfileData={order.clientProfileData} />
|
|
70
|
+
|
|
62
71
|
<MyAccountDeliveryCard
|
|
63
72
|
deliveryOptionsData={order.deliveryOptionsData}
|
|
64
73
|
fields={
|
|
@@ -66,12 +75,15 @@ export default function MyAccountOrderDetails({
|
|
|
66
75
|
?.fields || []
|
|
67
76
|
}
|
|
68
77
|
/>
|
|
78
|
+
|
|
69
79
|
<MyAccountStatusCard status={order.status as OrderStatusKey} />
|
|
80
|
+
|
|
70
81
|
<MyAccountPaymentCard
|
|
71
82
|
currencyCode={order.storePreferencesData.currencyCode}
|
|
72
83
|
paymentData={order.paymentData}
|
|
73
84
|
allowCancellation={order.allowCancellation}
|
|
74
85
|
/>
|
|
86
|
+
|
|
75
87
|
<MyAccountSummaryCard
|
|
76
88
|
totals={order.totals}
|
|
77
89
|
currencyCode={order.storePreferencesData.currencyCode}
|
|
@@ -89,6 +101,7 @@ export default function MyAccountOrderDetails({
|
|
|
89
101
|
)}
|
|
90
102
|
/>
|
|
91
103
|
))}
|
|
104
|
+
|
|
92
105
|
{moreInformationCustomFields?.length > 0 && (
|
|
93
106
|
<MyAccountMoreInformationCard fields={moreInformationCustomFields} />
|
|
94
107
|
)}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { useSession } from 'src/sdk/session'
|
|
2
1
|
import MyAccountCard from '../../../components/MyAccountCard'
|
|
3
2
|
import MyAccountPaymentFlagsIcon from './MyAccountPaymentFlagsIcon'
|
|
4
|
-
import { useCallback } from 'react'
|
|
5
3
|
import { Link } from '@faststore/ui'
|
|
6
|
-
import type { ServerOrderDetailsQueryQuery } from '@generated/graphql'
|
|
7
4
|
import { useFormatPrice } from '../../../utils/useFormatPrice'
|
|
5
|
+
import type { ServerOrderDetailsQueryQuery } from '@generated/graphql'
|
|
8
6
|
|
|
9
7
|
export type OrderPaymentData =
|
|
10
8
|
ServerOrderDetailsQueryQuery['userOrder']['paymentData']
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
.page {
|
|
2
2
|
@import "@faststore/ui/src/components/atoms/Icon/styles.scss";
|
|
3
3
|
@import "@faststore/ui/src/components/atoms/Badge/styles.scss";
|
|
4
|
+
@import "@faststore/ui/src/components/atoms/Loader/styles.scss";
|
|
4
5
|
@import "@faststore/ui/src/components/atoms/Button/styles.scss";
|
|
5
6
|
@import "@faststore/ui/src/components/molecules/Card/styles.scss";
|
|
7
|
+
@import "@faststore/ui/src/components/molecules/Alert/styles.scss";
|
|
8
|
+
@import "@faststore/ui/src/components/molecules/Dropdown/styles.scss";
|
|
6
9
|
@import "../../components/MyAccountAccordion/styles.scss";
|
|
7
10
|
@import "../../components/MyAccountCard/styles.scss";
|
|
8
11
|
@import "../../components/MyAccountStatusBadge/styles.scss";
|
|
@@ -14,6 +17,7 @@
|
|
|
14
17
|
@import "./MyAccountOrderActions/styles.scss";
|
|
15
18
|
@import "./MyAccountStatusCard/styles.scss";
|
|
16
19
|
@import "./MyAccountMoreInformationCard/styles.scss";
|
|
20
|
+
@import "./MyAccountBuyingPolicyAlert/styles.scss";
|
|
17
21
|
|
|
18
22
|
// --------------------------------------------------------
|
|
19
23
|
// Design Tokens
|
|
@@ -44,7 +48,7 @@
|
|
|
44
48
|
|
|
45
49
|
[data-fs-order-details-header] {
|
|
46
50
|
display: flex;
|
|
47
|
-
flex-direction:
|
|
51
|
+
flex-direction: row;
|
|
48
52
|
gap: var(--fs-order-details-header-gap);
|
|
49
53
|
align-items: flex-start;
|
|
50
54
|
justify-content: space-between;
|
|
@@ -53,7 +57,6 @@
|
|
|
53
57
|
@include media (">=tablet") {
|
|
54
58
|
--fs-order-details-header-gap : var(--fs-spacing-2);
|
|
55
59
|
|
|
56
|
-
flex-flow: row;
|
|
57
60
|
align-items: center;
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -112,6 +115,14 @@
|
|
|
112
115
|
grid-column: span 2;
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
[data-fs-buying-policy-alert] {
|
|
119
|
+
grid-column: span 2;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[data-fs-pending-policies-alert] {
|
|
123
|
+
grid-column: span 2;
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
[data-fs-delivery-option-accordion] {
|
|
116
127
|
grid-column: span 2;
|
|
117
128
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './profile'
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.section {
|
|
3
|
+
[data-fs-account-profile-header] {
|
|
4
|
+
padding-block: var(--fs-spacing-6);
|
|
5
|
+
padding-inline: var(--fs-spacing-11);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
[data-fs-account-profile-body] {
|
|
9
|
+
padding-inline: var(--fs-spacing-11);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[data-fs-account-profile-title] {
|
|
13
|
+
font-family: var(--fs-text-face-title);
|
|
14
|
+
font-size: var(--fs-text-size-4);
|
|
15
|
+
font-weight: var(--fs-text-weight-semibold);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[data-fs-account-profile-table] {
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-columns: minmax(11.25rem, auto) 1fr;
|
|
21
|
+
width: 100%;
|
|
22
|
+
border-spacing: 0;
|
|
23
|
+
border-collapse: collapse;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[data-fs-account-profile-table-body] {
|
|
27
|
+
display: contents;
|
|
28
|
+
gap: var(--fs-spacing-1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[data-fs-account-profile-table-row] {
|
|
32
|
+
display: contents;
|
|
33
|
+
|
|
34
|
+
&:last-child {
|
|
35
|
+
> [data-fs-account-profile-table-heading] {
|
|
36
|
+
border-bottom: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
> [data-fs-account-profile-table-data] {
|
|
40
|
+
border-bottom: none;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[data-fs-account-profile-table-heading] {
|
|
46
|
+
padding-block: var(--fs-spacing-4);
|
|
47
|
+
font-family: var(--fs-text-face-body);
|
|
48
|
+
font-size: var(--fs-text-size-2);
|
|
49
|
+
font-weight: var(--fs-text-weight-regular);
|
|
50
|
+
color: var(--fs-color-text-light);
|
|
51
|
+
text-align: left;
|
|
52
|
+
border-bottom: var(--fs-border-width) solid var(--fs-border-color-light);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-fs-account-profile-table-data] {
|
|
56
|
+
padding-block: var(--fs-spacing-4);
|
|
57
|
+
padding-inline: var(--fs-spacing-1);
|
|
58
|
+
font-family: var(--fs-text-face-body);
|
|
59
|
+
font-size: var(--fs-text-size-2);
|
|
60
|
+
font-weight: var(--fs-text-weight-regular);
|
|
61
|
+
color: var(--fs-color-text);
|
|
62
|
+
border-bottom: var(--fs-border-width) solid var(--fs-border-color-light);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@include media("<notebook") {
|
|
66
|
+
[data-fs-account-profile-header] {
|
|
67
|
+
padding-inline: var(--fs-spacing-4);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-fs-account-profile-body] {
|
|
71
|
+
padding-inline: var(--fs-spacing-4);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-fs-account-profile-table] {
|
|
75
|
+
grid-template-columns: 1fr;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[data-fs-account-profile-table-heading] {
|
|
79
|
+
padding-block: var(--fs-spacing-4) 0;
|
|
80
|
+
border-bottom: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[data-fs-account-profile-table-data] {
|
|
84
|
+
padding-block: var(--fs-spacing-1) var(--fs-spacing-4);
|
|
85
|
+
padding-inline: 0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { strings } from './i18n'
|
|
2
|
+
import styles from './profile.module.scss'
|
|
3
|
+
import { useDateFormatter } from './use-date-formatter'
|
|
4
|
+
|
|
5
|
+
interface UserProfile {
|
|
6
|
+
name: string | null
|
|
7
|
+
email: string | null
|
|
8
|
+
id: string | null
|
|
9
|
+
createdDate?: string | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ProfileSectionProps {
|
|
13
|
+
profile?: UserProfile
|
|
14
|
+
locale?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Renders the /account/profile section
|
|
19
|
+
*/
|
|
20
|
+
export function ProfileSection({
|
|
21
|
+
profile,
|
|
22
|
+
locale = 'en-US',
|
|
23
|
+
}: ProfileSectionProps) {
|
|
24
|
+
const { formatStringDate } = useDateFormatter(locale)
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div data-fs-account-profile-section className={styles.section}>
|
|
28
|
+
<header data-fs-account-profile-header>
|
|
29
|
+
<h1 data-fs-account-profile-title>{strings.profile}</h1>
|
|
30
|
+
</header>
|
|
31
|
+
<section data-fs-account-profile-body>
|
|
32
|
+
<table data-fs-account-profile-table>
|
|
33
|
+
<tbody data-fs-account-profile-table-body>
|
|
34
|
+
<tr data-fs-account-profile-table-row>
|
|
35
|
+
<th data-fs-account-profile-table-heading>{strings.name}</th>
|
|
36
|
+
<td data-fs-account-profile-table-data>{profile?.name}</td>
|
|
37
|
+
</tr>
|
|
38
|
+
<tr data-fs-account-profile-table-row>
|
|
39
|
+
<th data-fs-account-profile-table-heading>{strings.email}</th>
|
|
40
|
+
<td data-fs-account-profile-table-data>
|
|
41
|
+
<a href={`mailto:${profile?.email}`}>{profile?.email}</a>
|
|
42
|
+
</td>
|
|
43
|
+
</tr>
|
|
44
|
+
<tr data-fs-account-profile-table-row>
|
|
45
|
+
<th data-fs-account-profile-table-heading>{strings.id}</th>
|
|
46
|
+
<td data-fs-account-profile-table-data>{profile?.id}</td>
|
|
47
|
+
</tr>
|
|
48
|
+
{profile.createdDate && (
|
|
49
|
+
<tr data-fs-account-profile-table-row>
|
|
50
|
+
<th data-fs-account-profile-table-heading>
|
|
51
|
+
{strings.createdDate}
|
|
52
|
+
</th>
|
|
53
|
+
<td data-fs-account-profile-table-data>
|
|
54
|
+
{formatStringDate(profile.createdDate)}
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
)}
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
60
|
+
</section>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
|
+
|
|
3
|
+
export function useDateFormatter(locale: string) {
|
|
4
|
+
const dateFormatter = useMemo(
|
|
5
|
+
() =>
|
|
6
|
+
new Intl.DateTimeFormat(locale, {
|
|
7
|
+
dateStyle: 'medium',
|
|
8
|
+
}),
|
|
9
|
+
[locale]
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
const formatStringDate = useCallback(
|
|
13
|
+
(dateString: string) => {
|
|
14
|
+
const date = new Date(dateString)
|
|
15
|
+
const formattedDate = dateFormatter.format(date)
|
|
16
|
+
return formattedDate
|
|
17
|
+
},
|
|
18
|
+
[dateFormatter]
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
dateFormatter,
|
|
23
|
+
formatStringDate,
|
|
24
|
+
}
|
|
25
|
+
}
|