Skip to content

Commit 8a94e37

Browse files
authored
feat(vue-demo-store): custom registration page (#263)
1 parent dbd3412 commit 8a94e37

File tree

6 files changed

+483
-402
lines changed

6 files changed

+483
-402
lines changed

.changeset/nine-drinks-sort.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@shopware-pwa/types": patch
3+
---
4+
5+
improved CustomerGroup typing

.changeset/strong-geese-hope.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"vue-demo-store": patch
3+
---
4+
5+
custom registration page

packages/types/shopware-6-client/models/checkout/customer/CustomerGroup.d.ts

+14
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,18 @@ export type CustomerGroup = {
88
name: string;
99
displayGross: boolean;
1010
customFields: CustomFields;
11+
createdAt: string;
12+
updatedAt: null | string;
13+
displayGross: boolean;
14+
registrationActive: boolean;
15+
registrationTitle: string;
16+
registrationIntroduction: string;
17+
registrationOnlyCompanyRegistration: boolean;
18+
registrationSeoMetaDescription: null | string;
19+
translated: {
20+
[key in keyof Omit<
21+
CustomerGroup,
22+
"translated"
23+
> as CustomerGroup[key] extends string ? key : never]: string;
24+
};
1125
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<script setup lang="ts">
2+
import { invokeGet } from "@shopware-pwa/api-client";
3+
import { CustomerGroup } from "@shopware-pwa/types";
4+
5+
const props = defineProps<{
6+
navigationId: string;
7+
}>();
8+
9+
const { apiInstance } = useShopwareContext();
10+
11+
const { data: registrationResponse } = await useAsyncData(
12+
"cmsNavigation" + props.navigationId,
13+
async () => {
14+
const response = await invokeGet<CustomerGroup>(
15+
{
16+
address: `/store-api/customer-group-registration/config/${props.navigationId}`,
17+
},
18+
apiInstance
19+
);
20+
return response?.data || {};
21+
}
22+
);
23+
</script>
24+
25+
<template>
26+
<div class="container mx-auto bg-white flex flex-col">
27+
<h1
28+
class="mb-4 text-2xl font-extrabold leading-none tracking-tight text-gray-900 md:text-3xl lg:text-5xl dark:text-white text-center"
29+
>
30+
{{ registrationResponse?.translated.registrationTitle }}
31+
</h1>
32+
<div
33+
v-if="registrationResponse?.registrationActive"
34+
class="text-lg font-normal text-gray-500 lg:text-xl dark:text-gray-400"
35+
>
36+
<p class="px-6 sm:px-4 mb-6">
37+
{{ registrationResponse?.translated?.registrationIntroduction }}
38+
</p>
39+
<AccountRegisterForm :customer-group-id="registrationResponse?.id" />
40+
</div>
41+
<div
42+
v-else
43+
class="p-4 mb-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300"
44+
role="alert"
45+
>
46+
<span class="font-medium">Registration is not active!</span> Try again
47+
later or contact us.
48+
</div>
49+
</div>
50+
</template>

0 commit comments

Comments
 (0)