@cimplify/cli 0.7.16 → 0.7.17

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 (27) hide show
  1. package/dist/{add-YRLROMEN.mjs → add-VSGQEUDS.mjs} +1 -1
  2. package/dist/{chunk-ATCBAM44.mjs → chunk-NIDPHJ45.mjs} +1 -1
  3. package/dist/{chunk-7CCC37ER.mjs → chunk-OJRMBHMT.mjs} +1 -1
  4. package/dist/{chunk-7PNEG4JY.mjs → chunk-XKO2EB5J.mjs} +8 -8
  5. package/dist/dispatcher.mjs +9 -9
  6. package/dist/{doctor-UMTO3BI6.mjs → doctor-AMR3MFFS.mjs} +2 -2
  7. package/dist/{explain-2VWT5OFP.mjs → explain-6LYQ2OL4.mjs} +1 -1
  8. package/dist/{introspect-PCLYGIDK.mjs → introspect-HWOZIVET.mjs} +2 -2
  9. package/dist/{list-6FUJKW7D.mjs → list-WC7JWDCJ.mjs} +1 -1
  10. package/dist/{update-CCNTKRPV.mjs → update-6LL5PQEQ.mjs} +1 -1
  11. package/package.json +1 -1
  12. package/templates/storefront-auto/app/account/orders/[id]/page.tsx +42 -0
  13. package/templates/storefront-auto/components/order-detail.tsx +11 -0
  14. package/templates/storefront-bakery/app/account/orders/[id]/page.tsx +42 -0
  15. package/templates/storefront-bakery/components/order-detail.tsx +11 -0
  16. package/templates/storefront-fashion/app/account/orders/[id]/page.tsx +42 -0
  17. package/templates/storefront-fashion/components/order-detail.tsx +11 -0
  18. package/templates/storefront-grocery/app/account/orders/[id]/page.tsx +42 -0
  19. package/templates/storefront-grocery/components/order-detail.tsx +11 -0
  20. package/templates/storefront-pharmacy/app/account/orders/[id]/page.tsx +42 -0
  21. package/templates/storefront-pharmacy/components/order-detail.tsx +11 -0
  22. package/templates/storefront-restaurant/app/account/orders/[id]/page.tsx +42 -0
  23. package/templates/storefront-restaurant/components/order-detail.tsx +11 -0
  24. package/templates/storefront-retail/app/account/orders/[id]/page.tsx +42 -0
  25. package/templates/storefront-retail/components/order-detail.tsx +11 -0
  26. package/templates/storefront-services/app/account/orders/[id]/page.tsx +42 -0
  27. package/templates/storefront-services/components/order-detail.tsx +11 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { TEMPLATES } from './chunk-7PNEG4JY.mjs';
3
- import { package_default } from './chunk-ATCBAM44.mjs';
2
+ import { TEMPLATES } from './chunk-XKO2EB5J.mjs';
3
+ import { package_default } from './chunk-NIDPHJ45.mjs';
4
4
 
5
5
  // src/dispatcher.ts
6
6
  var VERSION = package_default.version ?? "unknown";
@@ -138,16 +138,16 @@ var COMMANDS = {
138
138
  logs: () => import('./logs-YNN2PQ24.mjs'),
139
139
  status: () => import('./status-JSYXM5RT.mjs'),
140
140
  dev: () => import('./dev-ONW2S77K.mjs'),
141
- introspect: () => import('./introspect-PCLYGIDK.mjs'),
141
+ introspect: () => import('./introspect-HWOZIVET.mjs'),
142
142
  inspect: () => import('./inspect-CGYX4DDF.mjs'),
143
- doctor: () => import('./doctor-UMTO3BI6.mjs'),
144
- explain: () => import('./explain-2VWT5OFP.mjs'),
143
+ doctor: () => import('./doctor-AMR3MFFS.mjs'),
144
+ explain: () => import('./explain-6LYQ2OL4.mjs'),
145
145
  assets: () => import('./assets-74SK63TR.mjs'),
146
146
  repo: () => import('./repo-KNQMSPVV.mjs'),
147
- list: () => import('./list-6FUJKW7D.mjs'),
148
- add: () => import('./add-YRLROMEN.mjs'),
149
- update: () => import('./update-CCNTKRPV.mjs'),
150
- upgrade: () => import('./update-CCNTKRPV.mjs'),
147
+ list: () => import('./list-WC7JWDCJ.mjs'),
148
+ add: () => import('./add-VSGQEUDS.mjs'),
149
+ update: () => import('./update-6LL5PQEQ.mjs'),
150
+ upgrade: () => import('./update-6LL5PQEQ.mjs'),
151
151
  "auth-step-up": () => import('./auth-step-up-BIUYQJP6.mjs')
152
152
  };
153
153
  var COMMAND_PREFIXES = {
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { gatherIntrospection } from './chunk-7CCC37ER.mjs';
2
+ import { gatherIntrospection } from './chunk-OJRMBHMT.mjs';
3
3
  import './chunk-K5464A3L.mjs';
4
4
  import './chunk-DBZ3UOQ2.mjs';
5
- import './chunk-ATCBAM44.mjs';
5
+ import './chunk-NIDPHJ45.mjs';
6
6
  import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
7
7
  import { ApiClient } from './chunk-MAOO6ZZ5.mjs';
8
8
  import { readAuthOrNull } from './chunk-UBAI443T.mjs';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { package_default } from './chunk-ATCBAM44.mjs';
2
+ import { package_default } from './chunk-NIDPHJ45.mjs';
3
3
  import { parseArgs } from './chunk-C4M3DXKC.mjs';
4
4
  import { bold, dim, info, result, CliError, CLI_ERROR_CODE } from './chunk-E2T2SBP5.mjs';
5
5
 
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-7CCC37ER.mjs';
2
+ export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-OJRMBHMT.mjs';
3
3
  import './chunk-K5464A3L.mjs';
4
4
  import './chunk-DBZ3UOQ2.mjs';
5
- import './chunk-ATCBAM44.mjs';
5
+ import './chunk-NIDPHJ45.mjs';
6
6
  import './chunk-C4M3DXKC.mjs';
7
7
  import './chunk-UBAI443T.mjs';
8
8
  import './chunk-E2T2SBP5.mjs';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { REGISTRY_INDEX } from './chunk-7PNEG4JY.mjs';
2
+ import { REGISTRY_INDEX } from './chunk-XKO2EB5J.mjs';
3
3
  import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
4
4
  import { CliError, CLI_ERROR_CODE, info, bold, dim, green, result } from './chunk-E2T2SBP5.mjs';
5
5
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { package_default } from './chunk-ATCBAM44.mjs';
2
+ import { package_default } from './chunk-NIDPHJ45.mjs';
3
3
  import { promptYesNo } from './chunk-ITAFAORS.mjs';
4
4
  import { parseArgs, flagBool, flagString } from './chunk-C4M3DXKC.mjs';
5
5
  import { success, bold, info, dim, result, failure, CliError, CLI_ERROR_CODE, step, isJsonMode } from './chunk-E2T2SBP5.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/cli",
3
- "version": "0.7.16",
3
+ "version": "0.7.17",
4
4
  "description": "Cimplify CLI — deploy, manage env vars, link projects, and scaffold storefronts",
5
5
  "keywords": [
6
6
  "cimplify",
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { notFound } from "next/navigation";
2
+ import { AccountSignedOutPrompt, toAccountOrderView } from "@cimplify/sdk/react";
3
+ import type { EnrichedOrder } from "@cimplify/sdk";
4
+ import { brand } from "@/lib/brand";
5
+ import { apiFetch, serverAccessToken, serverSession } from "@/lib/cimplify-server";
6
+ import { OrderDetail } from "@/components/order-detail";
7
+
8
+ const CLIENT_ID = process.env.NEXT_PUBLIC_CIMPLIFY_CLIENT_ID ?? "";
9
+ const REDIRECT_URI = process.env.CIMPLIFY_REDIRECT_URI ?? "";
10
+
11
+ export default async function OrderDetailPage({
12
+ params,
13
+ }: {
14
+ params: Promise<{ id: string }>;
15
+ }) {
16
+ const { id } = await params;
17
+
18
+ const session = await serverSession();
19
+ if (!session) {
20
+ return (
21
+ <AccountSignedOutPrompt
22
+ clientId={CLIENT_ID}
23
+ redirectUri={REDIRECT_URI}
24
+ eyebrow={brand.account.loginEyebrow}
25
+ title={brand.account.loginTitle}
26
+ description={brand.account.loginSubtitle}
27
+ />
28
+ );
29
+ }
30
+
31
+ const bearer = await serverAccessToken();
32
+ const order = await apiFetch<EnrichedOrder>(`/api/v1/orders/${encodeURIComponent(id)}`, {
33
+ bearer,
34
+ });
35
+ if (!order) notFound();
36
+
37
+ return (
38
+ <div className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6">
39
+ <OrderDetail {...toAccountOrderView(order)} />
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { useRouter } from "next/navigation";
4
+ import { AccountOrderView, type AccountOrderViewProps } from "@cimplify/sdk/react";
5
+
6
+ // Thin client wrapper so the server page can pass the (serializable) view-model
7
+ // while `onBack` (a function) is supplied on the client.
8
+ export function OrderDetail(props: AccountOrderViewProps) {
9
+ const router = useRouter();
10
+ return <AccountOrderView {...props} onBack={() => router.push("/account/orders")} />;
11
+ }