@faststore/core 3.64.0 → 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/functions-config-manifest.json +1 -1
- 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 +12 -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/MyAccountListOrders/MyAccountListOrdersTable/MyAccountListOrdersTable.tsx +5 -5
- package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/MyAccountSelectedTags.tsx +16 -4
- 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/_fNL5rUsrvwdHfkRr9RdO/_buildManifest.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-6aad8b35fc95ce57.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/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/{_fNL5rUsrvwdHfkRr9RdO → czdZM7l3yYhwzU9FTEtWh}/_ssgManifest.js +0 -0
|
@@ -9,12 +9,14 @@ import { MyAccountLayout } from 'src/components/account'
|
|
|
9
9
|
import RenderSections from 'src/components/cms/RenderSections'
|
|
10
10
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
11
11
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
12
|
+
import { ProfileSection } from 'src/components/account/profile'
|
|
12
13
|
|
|
13
14
|
import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
|
|
14
15
|
|
|
15
16
|
import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/profile/after'
|
|
16
17
|
import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/profile/before'
|
|
17
18
|
import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
|
|
19
|
+
import { getIsRepresentative } from 'src/sdk/account/getIsRepresentative'
|
|
18
20
|
import { injectGlobalSections } from 'src/server/cms/global'
|
|
19
21
|
import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
20
22
|
import { gql } from '@generated/gql'
|
|
@@ -24,6 +26,7 @@ import type {
|
|
|
24
26
|
ServerProfileQueryQueryVariables,
|
|
25
27
|
} from '@generated/graphql'
|
|
26
28
|
import { validateUser } from 'src/sdk/account/validateUser'
|
|
29
|
+
import storeConfig from '../../../discovery.config'
|
|
27
30
|
|
|
28
31
|
/* A list of components that can be used in the CMS. */
|
|
29
32
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
@@ -31,10 +34,20 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
|
31
34
|
...CUSTOM_COMPONENTS,
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
type ProfilePagePros = {
|
|
38
|
+
accountProfile: {
|
|
39
|
+
name: string | null
|
|
40
|
+
email: string | null
|
|
41
|
+
id: string | null
|
|
42
|
+
}
|
|
43
|
+
} & MyAccountProps
|
|
44
|
+
|
|
34
45
|
export default function Profile({
|
|
35
46
|
globalSections,
|
|
36
47
|
accountName,
|
|
37
|
-
|
|
48
|
+
accountProfile,
|
|
49
|
+
isRepresentative,
|
|
50
|
+
}: ProfilePagePros) {
|
|
38
51
|
return (
|
|
39
52
|
<RenderSections
|
|
40
53
|
globalSections={globalSections.sections}
|
|
@@ -42,11 +55,12 @@ export default function Profile({
|
|
|
42
55
|
>
|
|
43
56
|
<NextSeo noindex nofollow />
|
|
44
57
|
|
|
45
|
-
<MyAccountLayout
|
|
58
|
+
<MyAccountLayout
|
|
59
|
+
isRepresentative={isRepresentative}
|
|
60
|
+
accountName={accountName}
|
|
61
|
+
>
|
|
46
62
|
<BeforeSection />
|
|
47
|
-
<
|
|
48
|
-
<h1>Profile</h1>
|
|
49
|
-
</div>
|
|
63
|
+
<ProfileSection profile={accountProfile} />
|
|
50
64
|
<AfterSection />
|
|
51
65
|
</MyAccountLayout>
|
|
52
66
|
</RenderSections>
|
|
@@ -56,6 +70,11 @@ export default function Profile({
|
|
|
56
70
|
const query = gql(`
|
|
57
71
|
query ServerProfileQuery {
|
|
58
72
|
accountName
|
|
73
|
+
accountProfile {
|
|
74
|
+
name
|
|
75
|
+
email
|
|
76
|
+
id
|
|
77
|
+
}
|
|
59
78
|
}
|
|
60
79
|
`)
|
|
61
80
|
|
|
@@ -75,6 +94,11 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
75
94
|
}
|
|
76
95
|
}
|
|
77
96
|
|
|
97
|
+
const isRepresentative = getIsRepresentative({
|
|
98
|
+
headers: context.req.headers as Record<string, string>,
|
|
99
|
+
account: storeConfig.api.storeId,
|
|
100
|
+
})
|
|
101
|
+
|
|
78
102
|
const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
|
|
79
103
|
query: context.query,
|
|
80
104
|
})
|
|
@@ -126,6 +150,8 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
126
150
|
props: {
|
|
127
151
|
globalSections: globalSectionsResult,
|
|
128
152
|
accountName: profile.data.accountName,
|
|
153
|
+
accountProfile: profile.data.accountProfile,
|
|
154
|
+
isRepresentative,
|
|
129
155
|
},
|
|
130
156
|
}
|
|
131
157
|
}
|
|
@@ -16,6 +16,7 @@ import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
|
|
|
16
16
|
import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/security/after'
|
|
17
17
|
import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/security/before'
|
|
18
18
|
import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
|
|
19
|
+
import { getIsRepresentative } from 'src/sdk/account/getIsRepresentative'
|
|
19
20
|
import { injectGlobalSections } from 'src/server/cms/global'
|
|
20
21
|
import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
21
22
|
import { execute } from 'src/server'
|
|
@@ -25,6 +26,8 @@ import type {
|
|
|
25
26
|
ServerSecurityQueryQueryVariables,
|
|
26
27
|
} from '@generated/graphql'
|
|
27
28
|
import { validateUser } from 'src/sdk/account/validateUser'
|
|
29
|
+
import storeConfig from '../../../discovery.config'
|
|
30
|
+
import { SecuritySection } from 'src/components/account/security'
|
|
28
31
|
|
|
29
32
|
/* A list of components that can be used in the CMS. */
|
|
30
33
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
@@ -39,6 +42,7 @@ type SecurityPageProps = {
|
|
|
39
42
|
export default function Page({
|
|
40
43
|
globalSections,
|
|
41
44
|
accountName,
|
|
45
|
+
isRepresentative,
|
|
42
46
|
}: SecurityPageProps) {
|
|
43
47
|
return (
|
|
44
48
|
<RenderSections
|
|
@@ -47,11 +51,12 @@ export default function Page({
|
|
|
47
51
|
>
|
|
48
52
|
<NextSeo noindex nofollow />
|
|
49
53
|
|
|
50
|
-
<MyAccountLayout
|
|
54
|
+
<MyAccountLayout
|
|
55
|
+
isRepresentative={isRepresentative}
|
|
56
|
+
accountName={accountName}
|
|
57
|
+
>
|
|
51
58
|
<BeforeSection />
|
|
52
|
-
<
|
|
53
|
-
<h1>Security</h1>
|
|
54
|
-
</div>
|
|
59
|
+
<SecuritySection />
|
|
55
60
|
<AfterSection />
|
|
56
61
|
</MyAccountLayout>
|
|
57
62
|
</RenderSections>
|
|
@@ -80,6 +85,11 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
|
|
88
|
+
const isRepresentative = getIsRepresentative({
|
|
89
|
+
headers: context.req.headers as Record<string, string>,
|
|
90
|
+
account: storeConfig.api.storeId,
|
|
91
|
+
})
|
|
92
|
+
|
|
83
93
|
const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
|
|
84
94
|
query: context.query,
|
|
85
95
|
})
|
|
@@ -131,6 +141,7 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
131
141
|
props: {
|
|
132
142
|
globalSections: globalSectionsResult,
|
|
133
143
|
accountName: security.data.accountName,
|
|
144
|
+
isRepresentative,
|
|
134
145
|
},
|
|
135
146
|
}
|
|
136
147
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/* ######################################### */
|
|
2
|
-
/* Mocked Page until development is finished, it will be removed after */
|
|
3
|
-
|
|
4
1
|
import { NextSeo } from 'next-seo'
|
|
5
2
|
import type { ComponentType } from 'react'
|
|
6
3
|
import { MyAccountLayout } from 'src/components/account'
|
|
@@ -13,17 +10,20 @@ import type { GetServerSideProps } from 'next'
|
|
|
13
10
|
|
|
14
11
|
import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
|
|
15
12
|
|
|
16
|
-
import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/user-details/after'
|
|
17
|
-
import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/user-details/before'
|
|
18
|
-
import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
|
|
19
|
-
import { injectGlobalSections } from 'src/server/cms/global'
|
|
20
|
-
import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
21
13
|
import { gql } from '@generated/gql'
|
|
22
|
-
import { execute } from 'src/server'
|
|
23
14
|
import type {
|
|
24
15
|
ServerUserDetailsQueryQuery,
|
|
25
16
|
ServerUserDetailsQueryQueryVariables,
|
|
26
17
|
} from '@generated/graphql'
|
|
18
|
+
import MyAccountUserDetails from 'src/components/account/MyAccountUserDetails/MyAccountUserDetails'
|
|
19
|
+
import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/user-details/after'
|
|
20
|
+
import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/user-details/before'
|
|
21
|
+
import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
|
|
22
|
+
import { getIsRepresentative } from 'src/sdk/account/getIsRepresentative'
|
|
23
|
+
import { execute } from 'src/server'
|
|
24
|
+
import { injectGlobalSections } from 'src/server/cms/global'
|
|
25
|
+
import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
26
|
+
import storeConfig from '../../../discovery.config'
|
|
27
27
|
import { validateUser } from 'src/sdk/account/validateUser'
|
|
28
28
|
|
|
29
29
|
/* A list of components that can be used in the CMS. */
|
|
@@ -32,10 +32,21 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
|
32
32
|
...CUSTOM_COMPONENTS,
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
type UserDetailsPagePros = {
|
|
36
|
+
userDetails: {
|
|
37
|
+
name: string
|
|
38
|
+
email: string
|
|
39
|
+
role: string[]
|
|
40
|
+
orgUnit: string
|
|
41
|
+
}
|
|
42
|
+
} & MyAccountProps
|
|
43
|
+
|
|
44
|
+
export default function Page({
|
|
36
45
|
globalSections,
|
|
37
46
|
accountName,
|
|
38
|
-
|
|
47
|
+
isRepresentative,
|
|
48
|
+
userDetails,
|
|
49
|
+
}: UserDetailsPagePros) {
|
|
39
50
|
return (
|
|
40
51
|
<RenderSections
|
|
41
52
|
globalSections={globalSections.sections}
|
|
@@ -43,11 +54,12 @@ export default function UserDetails({
|
|
|
43
54
|
>
|
|
44
55
|
<NextSeo noindex nofollow />
|
|
45
56
|
|
|
46
|
-
<MyAccountLayout
|
|
57
|
+
<MyAccountLayout
|
|
58
|
+
isRepresentative={isRepresentative}
|
|
59
|
+
accountName={accountName}
|
|
60
|
+
>
|
|
47
61
|
<BeforeSection />
|
|
48
|
-
<
|
|
49
|
-
<h1>User Details</h1>
|
|
50
|
-
</div>
|
|
62
|
+
<MyAccountUserDetails userDetails={userDetails} />
|
|
51
63
|
<AfterSection />
|
|
52
64
|
</MyAccountLayout>
|
|
53
65
|
</RenderSections>
|
|
@@ -57,6 +69,12 @@ export default function UserDetails({
|
|
|
57
69
|
const query = gql(`
|
|
58
70
|
query ServerUserDetailsQuery {
|
|
59
71
|
accountName
|
|
72
|
+
userDetails {
|
|
73
|
+
name
|
|
74
|
+
email
|
|
75
|
+
role
|
|
76
|
+
orgUnit
|
|
77
|
+
}
|
|
60
78
|
}
|
|
61
79
|
`)
|
|
62
80
|
|
|
@@ -76,6 +94,11 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
76
94
|
}
|
|
77
95
|
}
|
|
78
96
|
|
|
97
|
+
const isRepresentative = getIsRepresentative({
|
|
98
|
+
headers: context.req.headers as Record<string, string>,
|
|
99
|
+
account: storeConfig.api.storeId,
|
|
100
|
+
})
|
|
101
|
+
|
|
79
102
|
const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
|
|
80
103
|
query: context.query,
|
|
81
104
|
})
|
|
@@ -101,14 +124,26 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
101
124
|
variables: {},
|
|
102
125
|
operation: query,
|
|
103
126
|
},
|
|
104
|
-
{
|
|
127
|
+
{
|
|
128
|
+
headers: { ...context.req.headers },
|
|
129
|
+
}
|
|
105
130
|
),
|
|
106
131
|
globalSectionsPromise,
|
|
107
132
|
globalSectionsHeaderPromise,
|
|
108
133
|
globalSectionsFooterPromise,
|
|
109
134
|
])
|
|
110
135
|
|
|
111
|
-
|
|
136
|
+
// If the user is not a representative (b2b), redirect them to the account home page
|
|
137
|
+
if (!isRepresentative) {
|
|
138
|
+
return {
|
|
139
|
+
redirect: {
|
|
140
|
+
destination: '/account',
|
|
141
|
+
permanent: false,
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (userDetails?.errors) {
|
|
112
147
|
const statusCode: number = (userDetails.errors[0] as any)?.extensions
|
|
113
148
|
?.status
|
|
114
149
|
const destination: string =
|
|
@@ -132,6 +167,8 @@ export const getServerSideProps: GetServerSideProps<
|
|
|
132
167
|
props: {
|
|
133
168
|
globalSections: globalSectionsResult,
|
|
134
169
|
accountName: userDetails.data.accountName,
|
|
170
|
+
userDetails: userDetails.data?.userDetails ?? {},
|
|
171
|
+
isRepresentative,
|
|
135
172
|
},
|
|
136
173
|
}
|
|
137
174
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { parse } from 'cookie'
|
|
2
|
+
import { parseJwt } from 'src/utils/getCookie'
|
|
3
|
+
|
|
4
|
+
type GetIsRepresentativeParams = {
|
|
5
|
+
headers?: Record<string, string>
|
|
6
|
+
account: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getIsRepresentative({
|
|
10
|
+
headers,
|
|
11
|
+
account,
|
|
12
|
+
}: GetIsRepresentativeParams): boolean {
|
|
13
|
+
const authCookie = parse(headers?.cookie ?? '')?.[
|
|
14
|
+
'VtexIdclientAutCookie_' + account
|
|
15
|
+
]
|
|
16
|
+
const jwt = parseJwt(authCookie)
|
|
17
|
+
|
|
18
|
+
const isRepresentative = jwt?.isRepresentative
|
|
19
|
+
return !!isRepresentative
|
|
20
|
+
}
|
|
@@ -10,24 +10,28 @@ interface GetMyAccountRouteParams {
|
|
|
10
10
|
routes: Route[]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export const USER_DETAILS_ROUTE = '/account/user-details'
|
|
14
|
+
export const ORDERS_ROUTE = '/account/orders'
|
|
15
|
+
export const SECURITY_ROUTE = '/account/security'
|
|
16
|
+
|
|
13
17
|
// This is the default route list for My Account, we should add then as the feature is implemented
|
|
14
18
|
const DEFAULT_ROUTES: Route[] = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
{
|
|
20
|
+
title: 'Profile',
|
|
21
|
+
route: '/account/profile',
|
|
22
|
+
},
|
|
19
23
|
{
|
|
20
24
|
title: 'Orders',
|
|
21
|
-
route:
|
|
25
|
+
route: ORDERS_ROUTE,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: 'User Details',
|
|
29
|
+
route: USER_DETAILS_ROUTE,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: 'Security',
|
|
33
|
+
route: SECURITY_ROUTE,
|
|
22
34
|
},
|
|
23
|
-
// {
|
|
24
|
-
// title: 'User Details',
|
|
25
|
-
// route: '/account/user-details',
|
|
26
|
-
// },
|
|
27
|
-
// {
|
|
28
|
-
// title: 'Security',
|
|
29
|
-
// route: '/account/security',
|
|
30
|
-
// },
|
|
31
35
|
]
|
|
32
36
|
|
|
33
37
|
export function getMyAccountRoutes({ routes }: GetMyAccountRouteParams) {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { gql } from '@generated'
|
|
2
|
+
import { useLazyQuery } from '../graphql/useLazyQuery'
|
|
3
|
+
import type {
|
|
4
|
+
MutationProcessOrderAuthorizationArgs as Variables,
|
|
5
|
+
ProcessOrderAuthorizationMutationMutation,
|
|
6
|
+
} from '@generated/graphql'
|
|
7
|
+
|
|
8
|
+
export const mutation = gql(`
|
|
9
|
+
mutation ProcessOrderAuthorizationMutation($data: IProcessOrderAuthorization!) {
|
|
10
|
+
processOrderAuthorization(data: $data) {
|
|
11
|
+
isPendingForOtherAuthorizer
|
|
12
|
+
ruleForAuthorization {
|
|
13
|
+
orderAuthorizationId
|
|
14
|
+
dimensionId
|
|
15
|
+
rule {
|
|
16
|
+
id
|
|
17
|
+
name
|
|
18
|
+
status
|
|
19
|
+
doId
|
|
20
|
+
authorizedEmails
|
|
21
|
+
priority
|
|
22
|
+
trigger {
|
|
23
|
+
condition {
|
|
24
|
+
conditionType
|
|
25
|
+
description
|
|
26
|
+
lessThan
|
|
27
|
+
greatherThan
|
|
28
|
+
expression
|
|
29
|
+
}
|
|
30
|
+
effect {
|
|
31
|
+
description
|
|
32
|
+
effectType
|
|
33
|
+
funcPath
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
timeout
|
|
37
|
+
notification
|
|
38
|
+
scoreInterval {
|
|
39
|
+
accept
|
|
40
|
+
deny
|
|
41
|
+
}
|
|
42
|
+
authorizationData {
|
|
43
|
+
requireAllApprovals
|
|
44
|
+
authorizers {
|
|
45
|
+
id
|
|
46
|
+
email
|
|
47
|
+
type
|
|
48
|
+
authorizationDate
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
isUserAuthorized
|
|
52
|
+
isUserNextAuthorizer
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`)
|
|
58
|
+
|
|
59
|
+
export const useOrderAuthorization = () => {
|
|
60
|
+
const [processOrderAuthorization, { data, error, isValidating: loading }] =
|
|
61
|
+
useLazyQuery<ProcessOrderAuthorizationMutationMutation, Variables>(
|
|
62
|
+
mutation,
|
|
63
|
+
{
|
|
64
|
+
data: {
|
|
65
|
+
orderAuthorizationId: '',
|
|
66
|
+
ruleId: '',
|
|
67
|
+
dimensionId: '',
|
|
68
|
+
approved: false,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
processOrderAuthorization,
|
|
75
|
+
data: data?.processOrderAuthorization || null,
|
|
76
|
+
error,
|
|
77
|
+
loading,
|
|
78
|
+
}
|
|
79
|
+
}
|
package/src/utils/getCookie.ts
CHANGED
|
@@ -12,3 +12,10 @@ export function getCookie(name: string): string | undefined {
|
|
|
12
12
|
|
|
13
13
|
return undefined // Cookie not found
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
export function parseJwt(token: string) {
|
|
17
|
+
if (!token) {
|
|
18
|
+
return null
|
|
19
|
+
}
|
|
20
|
+
return JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString())
|
|
21
|
+
}
|
|
@@ -12,6 +12,10 @@ export const orderStatusMap = {
|
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
// Approval Pending
|
|
15
|
+
'waiting-for-authorization': {
|
|
16
|
+
variant: 'warning',
|
|
17
|
+
label: 'Approval Pending',
|
|
18
|
+
},
|
|
15
19
|
'waiting-for-confirmation': { variant: 'warning', label: 'Approval Pending' },
|
|
16
20
|
|
|
17
21
|
// Payment Pending
|
|
@@ -76,6 +76,8 @@ const QUERIES = [
|
|
|
76
76
|
'productCount',
|
|
77
77
|
'userOrder',
|
|
78
78
|
'listUserOrders',
|
|
79
|
+
'userDetails',
|
|
80
|
+
'accountProfile',
|
|
79
81
|
'accountName',
|
|
80
82
|
'validateUser',
|
|
81
83
|
]
|
|
@@ -85,6 +87,7 @@ const MUTATIONS = [
|
|
|
85
87
|
'validateSession',
|
|
86
88
|
'subscribeToNewsletter',
|
|
87
89
|
'cancelOrder',
|
|
90
|
+
'processOrderAuthorization',
|
|
88
91
|
]
|
|
89
92
|
|
|
90
93
|
describe('FastStore GraphQL Layer', () => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=2570,exports.ids=[2570],exports.modules={2562:(e,a,n)=>{n.d(a,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var r=n(15759),l=n(20997);let __WEBPACK_DEFAULT_EXPORT__=function({status:e,statusFallback:a}){return l.jsx("span",{"data-fs-my-account-badge":!0,"data-fs-my-account-badge-variant":function({status:e}){return r._y[e]?.variant||"neutral"}({status:e}),children:r._y[e]?.label||a||"-"})}},96896:(e,a,n)=>{n.d(a,{p:()=>useFormatPrice});var r=n(70031),l=n(16689);let useFormatPrice=()=>{let{locale:e}=(0,r.kP)();return(0,l.useCallback)((a,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n,minimumFractionDigits:2}).format(a/100),[e])}},15759:(e,a,n)=>{n.d(a,{BX:()=>t,JU:()=>groupOrderStatusByLabel,_y:()=>r,j4:()=>l});let r={created:{variant:"success",label:"Order Placed"},creating:{variant:"success",label:"Order Placed"},"on-order-completed":{variant:"success",label:"Order Placed"},"on-order-completed-ffm":{variant:"success",label:"Order Placed"},"order-accepted":{variant:"success",label:"Order Placed"},"order-created":{variant:"success",label:"Order Placed"},"waiting-for-seller-confirmation":{variant:"success",label:"Order Placed"},"waiting-for-confirmation":{variant:"warning",label:"Approval Pending"},"approving-transaction":{variant:"warning",label:"Payment Pending"},"notify-payment":{variant:"warning",label:"Payment Pending"},"payment-pending":{variant:"warning",label:"Payment Pending"},"payment-approved":{variant:"success",label:"Payment Approved"},"approve-payment":{variant:"success",label:"Payment Approved"},"payment-denied":{variant:"neutral",label:"Payment Denied"},"authorize-fulfillment":{variant:"success",label:"Ready for Delivery"},handling:{variant:"success",label:"Ready for Delivery"},invoice:{variant:"success",label:"Ready for Delivery"},"invoice-after-cancellation-deny":{variant:"success",label:"Ready for Delivery"},invoicing:{variant:"success",label:"Ready for Delivery"},packing:{variant:"success",label:"Ready for Delivery"},picking:{variant:"success",label:"Ready for Delivery"},"ready-for-handling":{variant:"success",label:"Ready for Delivery"},"ready-for-invoicing":{variant:"success",label:"Ready for Delivery"},"ready-for-packing":{variant:"success",label:"Ready for Delivery"},"ready-for-picking":{variant:"success",label:"Ready for Delivery"},"release-to-fulfillment":{variant:"success",label:"Ready for Delivery"},"start-handling":{variant:"success",label:"Ready for Delivery"},"waiting-ffmt-authorization":{variant:"success",label:"Ready for Delivery"},"waiting-for-fulfillment":{variant:"success",label:"Ready for Delivery"},"window-to-cancel":{variant:"success",label:"Ready for Delivery"},invoiced:{variant:"success",label:"Invoiced"},"accepting-cancel":{variant:"neutral",label:"Cancellation Requested"},cancel:{variant:"neutral",label:"Cancellation Requested"},canceling:{variant:"neutral",label:"Cancellation Requested"},"cancellation-requested":{variant:"neutral",label:"Cancellation Requested"},"cancellation-requested-with-ack":{variant:"neutral",label:"Cancellation Requested"},"request-cancel":{variant:"neutral",label:"Cancellation Requested"},"waiting-for-seller-decision":{variant:"neutral",label:"Cancellation Requested"},canceled:{variant:"neutral",label:"Canceled"}},groupOrderStatusByLabel=()=>{let e={};for(let[a,n]of Object.entries(r)){let{label:r}=n,l=r.toLowerCase();e[l]||(e[l]=[]),e[l].push(a)}return e},l=["Order Placed","Approval Pending","Payment Pending","Payment Approved","Payment Denied","Ready for Delivery","Invoiced","Cancellation Requested","Canceled"],t={"order placed":"Order Placed","approval pending":"Approval Pending","payment pending":"Payment Pending","payment approved":"Payment Approved","payment denied":"Payment Denied","ready for delivery":"Ready for Delivery",invoiced:"Invoiced","cancellation requested":"Cancellation Requested",canceled:"Canceled"}}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=941,exports.ids=[941],exports.modules={90941:(e,t,r)=>{r.r(t),r.d(t,{default:()=>search});var a=r(43412),o=r.n(a);let getBaseDomain=e=>{if(e[0]===e[1])return`.${new URL(o().storeUrl).hostname}`;let t=e.map(e=>{try{let t=new URL(e).hostname,r=o().api.subDomainPrefix||[],a=RegExp(`^(${["www",...r].join("|")})\\.`);return t.replace(a,"")}catch{return""}}),r=t.map(e=>e.split(".").reverse()),a=Math.min(...r.map(e=>e.length)),s=[];for(let e=0;e<a;e++){let t=new Set(r.map(t=>t[e]));if(1===t.size)s.push(r[0][e]);else break}if(s.length<2){let t=`No common domain found for URLs: ${e.join(", ")}`;return console.warn(`${t}. Please check the Production URLs in the discovery.config file.`),""}return"."+s.reverse().join(".")};function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}let randomUUID=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID().replaceAll("-",""):(1e6*Math.random()).toFixed(0),createOrRefreshCookie=(e,t)=>{let r=o().secureSubdomain?getBaseDomain([o().storeUrl,o().secureSubdomain]):`.${new URL(o().storeUrl).hostname}`;return()=>{let a=function(e){let t=decodeURIComponent(document.cookie),r=t.split(";");for(let t of r){let[r,a]=t.trim().split("=");if(r===e)return a}}(e),o=void 0===a;return o&&(a=randomUUID()),document.cookie=`${e}=${a}; max-age=${t}; domain=${r}; path=/;`,a}},s={anonymous:createOrRefreshCookie("vtex-search-anonymous",31536e3),session:createOrRefreshCookie("vtex-search-session",1800)},sendEvent=e=>fetch(`https://sp.vtex.com/event-api/v1/${o().api.storeId}/event`,{method:"POST",body:JSON.stringify(_objectSpread(_objectSpread({},e),{},{userAgent:navigator.userAgent,anonymous:s.anonymous(),session:s.session()})),headers:{"content-type":"application/json"}}),isFullTextSearch=e=>"string"==typeof e.searchParams.get("q")&&/^\/s(\/)?$/g.test(e.pathname);setInterval(()=>sendEvent({type:"session.ping"}),6e4);let search=e=>{switch(e.name){case"search_select_item":{let t=new URL(e.params.url);if(!isFullTextSearch(t))return;for(let r of e.params.items??[]){let e=r.item_id??r.item_variant,a=r.index;e&&a&&sendEvent({type:"search.click",productId:e,position:a,url:t.href,text:t.searchParams.get("q")??"<empty>"})}break}case"intelligent_search_query":sendEvent({type:"search.query",url:e.params.url,text:e.params.term,misspelled:e.params.isTermMisspelled,match:e.params.totalCount,operator:e.params.logicalOperator,locale:e.params.locale});break;case"intelligent_search_autocomplete_query":sendEvent({type:"search.autocomplete.query",url:e.params.url,text:e.params.term,misspelled:e.params.isTermMisspelled,match:e.params.totalCount,operator:e.params.logicalOperator,locale:e.params.locale});break;case"intelligent_search_autocomplete_click":sendEvent(_objectSpread(_objectSpread({text:e.params.term,url:e.params.url??"",productId:e.params.productId??""},e.params.position&&{position:e.params.position}),{},{type:"search.autocomplete.click"}))}}}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(c,s,a,t,e,u,n){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[c,s,a,"static/css/b1806cbafd0c1f81.css","static/chunks/pages/index-6e68be53d1fef20e.js"],"/404":[c,s,a,t,"static/chunks/pages/404-3582ed9196afdf1e.js"],"/500":[c,s,a,t,"static/chunks/pages/500-1b4eca062588da7f.js"],"/_error":["static/chunks/pages/_error-d820b4586477c368.js"],"/account":["static/chunks/pages/account-377dfe7a5276ceca.js"],"/account/403":[c,s,a,"static/css/b7bba8fce075688b.css","static/chunks/pages/account/403-6f4addf9a9d54a1c.js"],"/account/404":[c,s,a,"static/css/5347dbc8b71de47d.css","static/chunks/pages/account/404-9e8ca6ee5f981dae.js"],"/account/orders":[c,s,a,"static/css/8a3f440e0ff9cd8e.css","static/chunks/pages/account/orders-6aad8b35fc95ce57.js"],"/account/orders/[id]":[c,s,a,"static/css/506442c818624bd2.css","static/chunks/pages/account/orders/[id]-0780c7252aa3283f.js"],"/account/profile":[c,s,a,e,"static/chunks/pages/account/profile-adfe3518bdab5463.js"],"/account/security":[c,s,a,e,"static/chunks/pages/account/security-ea5c8811b3e6e415.js"],"/account/user-details":[c,s,a,e,"static/chunks/pages/account/user-details-9309d14f4e59f398.js"],"/account/[...unknown]":["static/chunks/pages/account/[...unknown]-aad8638fc7323b61.js"],"/checkout":[c,s,a,"static/chunks/pages/checkout-3a4983b22625c4e3.js"],"/login":[c,s,a,t,"static/chunks/pages/login-de3dd10c6b35159a.js"],"/s":[c,s,a,u,n,t,"static/chunks/pages/s-9b0f606f120d66b0.js"],"/[slug]/p":[c,s,a,"static/chunks/7498-5246b607527180dd.js","static/css/a3ca6a9b63f657be.css","static/css/62a5153ac7061286.css","static/chunks/3166-50d81179a0f5a894.js","static/css/6831395ff5fd317a.css","static/chunks/pages/[slug]/p-a255e4a7352455df.js"],"/[...slug]":[c,s,a,u,n,"static/chunks/pages/[...slug]-72047653203f9fd2.js"],sortedPages:["/","/404","/500","/_app","/_error","/account","/account/403","/account/404","/account/orders","/account/orders/[id]","/account/profile","/account/security","/account/user-details","/account/[...unknown]","/checkout","/login","/s","/[slug]/p","/[...slug]"]}}("static/chunks/6031-18797e7ebff417ab.js","static/css/202a74b80e6ce63f.css","static/chunks/9173-94386b70c1626a31.js","static/css/2980acad3f8e1028.css","static/css/84d35f475d0dc928.css","static/css/2841bab51b99dd53.css","static/chunks/7191-2a7b8ddbd07128b6.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|