@jarwizz/create-jarshop 0.1.7 → 0.1.8

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.
@@ -7,6 +7,9 @@ settings:
7
7
  overrides:
8
8
  eslint-import-resolver-typescript: 3.8.7
9
9
 
10
+ patchedDependencies:
11
+ '@vendure/dashboard@3.7.1': b2c0c0a597ac4bf69c5f19bc99f36e910661cbea1f5c6cc83b9582e6bd522148
12
+
10
13
  importers:
11
14
 
12
15
  .:
@@ -34,7 +37,7 @@ importers:
34
37
  version: 3.7.1(pg@8.22.0)(supports-color@7.2.0)(ts-morph@21.0.1)(ts-node@10.9.2(@types/node@24.13.3)(typescript@5.8.2))(typescript@5.8.2)
35
38
  '@vendure/dashboard':
36
39
  specifier: 3.7.1
37
- version: 3.7.1(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)
40
+ version: 3.7.1(patch_hash=b2c0c0a597ac4bf69c5f19bc99f36e910661cbea1f5c6cc83b9582e6bd522148)(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)
38
41
  '@vendure/email-plugin':
39
42
  specifier: 3.7.1
40
43
  version: 3.7.1(supports-color@7.2.0)(svgo@4.0.2)(typescript@5.8.2)
@@ -87,6 +90,9 @@ importers:
87
90
  vite:
88
91
  specifier: 7.3.6
89
92
  version: 7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)
93
+ vitest:
94
+ specifier: 4.1.10
95
+ version: 4.1.10(@types/node@24.13.3)(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))
90
96
 
91
97
  storefront:
92
98
  dependencies:
@@ -4049,6 +4055,7 @@ packages:
4049
4055
  eslint@9.39.5:
4050
4056
  resolution: {integrity: sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==}
4051
4057
  engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
4058
+ deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
4052
4059
  hasBin: true
4053
4060
  peerDependencies:
4054
4061
  jiti: '*'
@@ -10173,7 +10180,7 @@ snapshots:
10173
10180
  - uWebSockets.js
10174
10181
  - utf-8-validate
10175
10182
 
10176
- '@vendure/dashboard@3.7.1(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)':
10183
+ '@vendure/dashboard@3.7.1(patch_hash=b2c0c0a597ac4bf69c5f19bc99f36e910661cbea1f5c6cc83b9582e6bd522148)(@date-fns/tz@1.5.0)(@floating-ui/dom@1.8.0)(@sinclair/typebox@0.27.12)(@standard-schema/spec@1.1.0)(@tanstack/router-core@1.171.17)(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/extensions@3.29.2(@tiptap/core@3.29.2(@tiptap/pm@3.29.2))(@tiptap/pm@3.29.2))(@types/node@24.13.3)(ajv-formats@2.1.1(ajv@8.20.0))(ajv@8.20.0)(csstype@3.2.3)(esbuild@0.28.1)(eslint@10.8.0(jiti@2.7.0)(supports-color@7.2.0))(express@5.2.1(supports-color@7.2.0))(jiti@2.7.0)(lightningcss@1.32.0)(next@16.2.12(@babel/core@7.29.7(supports-color@7.2.0))(react-dom@19.2.8(react@19.2.8))(react@19.2.4))(rollup@4.62.4)(supports-color@7.2.0)(tsx@4.20.3)(typescript@5.8.2)':
10177
10184
  dependencies:
10178
10185
  '@babel/core': 7.29.7(supports-color@7.2.0)
10179
10186
  '@babel/preset-react': 7.29.7(@babel/core@7.29.7(supports-color@7.2.0))(supports-color@7.2.0)
@@ -10353,6 +10360,15 @@ snapshots:
10353
10360
  chai: 6.2.2
10354
10361
  tinyrainbow: 3.1.1
10355
10362
 
10363
+ '@vitest/mocker@4.1.10(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))':
10364
+ dependencies:
10365
+ '@vitest/spy': 4.1.10
10366
+ estree-walker: 3.0.3
10367
+ magic-string: 0.30.21
10368
+ optionalDependencies:
10369
+ msw: 2.15.0(@types/node@24.13.3)(typescript@5.8.2)
10370
+ vite: 7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)
10371
+
10356
10372
  '@vitest/mocker@4.1.10(msw@2.15.0(@types/node@24.13.3)(typescript@6.0.3))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))':
10357
10373
  dependencies:
10358
10374
  '@vitest/spy': 4.1.10
@@ -15299,6 +15315,33 @@ snapshots:
15299
15315
  lightningcss: 1.32.0
15300
15316
  tsx: 4.20.3
15301
15317
 
15318
+ vitest@4.1.10(@types/node@24.13.3)(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)):
15319
+ dependencies:
15320
+ '@vitest/expect': 4.1.10
15321
+ '@vitest/mocker': 4.1.10(msw@2.15.0(@types/node@24.13.3)(typescript@5.8.2))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3))
15322
+ '@vitest/pretty-format': 4.1.10
15323
+ '@vitest/runner': 4.1.10
15324
+ '@vitest/snapshot': 4.1.10
15325
+ '@vitest/spy': 4.1.10
15326
+ '@vitest/utils': 4.1.10
15327
+ es-module-lexer: 2.3.2
15328
+ expect-type: 1.4.0
15329
+ magic-string: 0.30.21
15330
+ obug: 2.1.4
15331
+ pathe: 2.0.3
15332
+ picomatch: 4.0.5
15333
+ std-env: 4.2.0
15334
+ tinybench: 2.9.0
15335
+ tinyexec: 1.3.0
15336
+ tinyglobby: 0.2.17
15337
+ tinyrainbow: 3.1.1
15338
+ vite: 7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)
15339
+ why-is-node-running: 2.3.0
15340
+ optionalDependencies:
15341
+ '@types/node': 24.13.3
15342
+ transitivePeerDependencies:
15343
+ - msw
15344
+
15302
15345
  vitest@4.1.10(@types/node@24.13.3)(msw@2.15.0(@types/node@24.13.3)(typescript@6.0.3))(vite@7.3.6(@types/node@24.13.3)(jiti@2.7.0)(lightningcss@1.32.0)(tsx@4.20.3)):
15303
15346
  dependencies:
15304
15347
  '@vitest/expect': 4.1.10
@@ -33,3 +33,5 @@ trustPolicyExclude:
33
33
  - chokidar@4.0.3
34
34
  trustLockfile: false
35
35
  blockExoticSubdeps: true
36
+ patchedDependencies:
37
+ "@vendure/dashboard@3.7.1": patches/@vendure__dashboard@3.7.1.patch
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The decisions behind cash on delivery, with nothing from Vendure in them.
3
+ *
4
+ * This file is the counterpart of `cod-payment.ts` in the way `order-lifecycle-core.ts`
5
+ * is the counterpart of `order-lifecycle-process.ts`: the rules live here, and the
6
+ * Vendure handler only gives them Vendure's shape. Keeping the rules free of imports
7
+ * lets the platform's contract matrix prove them from the root workspace, where this
8
+ * project's dependencies are never installed.
9
+ */
10
+
11
+ export type CashOnDeliveryAuthorization<Metadata> =
12
+ | {
13
+ amount: number;
14
+ state: "Authorized";
15
+ transactionId: string;
16
+ metadata: Metadata;
17
+ }
18
+ | {
19
+ amount: number;
20
+ state: "Declined";
21
+ errorMessage: string;
22
+ metadata: Metadata;
23
+ };
24
+
25
+ export type CashOnDeliverySettlement = { success: true };
26
+
27
+ /** One order, one cash collection: the id is the order's, so it cannot drift from it. */
28
+ export function cashOnDeliveryTransactionId(orderCode: string): string {
29
+ return `cod:${orderCode}`;
30
+ }
31
+
32
+ /**
33
+ * Cash on delivery, with the memory of what has already been collected.
34
+ *
35
+ * The memory matters because a collected payment is finished. Authorizing it again is
36
+ * how one order is charged twice, and it is refused here rather than only in Vendure's
37
+ * payment state machine, so a shop reading these rules through the adapter contract sees
38
+ * the same answer the shop itself gives.
39
+ *
40
+ * A ledger is created rather than kept in this module, so a caller that needs an
41
+ * untouched one — the contract matrix runs every rule from a clean start — can have it
42
+ * without reaching into private state.
43
+ */
44
+ export interface CashOnDeliveryLedger {
45
+ /**
46
+ * Checkout only records that cash will be collected. The payment stays Authorized
47
+ * until an operator confirms the money arrived, so nothing here pretends it was
48
+ * received.
49
+ */
50
+ authorize<Metadata>(input: {
51
+ orderCode: string;
52
+ amount: number;
53
+ metadata: Metadata;
54
+ }): CashOnDeliveryAuthorization<Metadata>;
55
+
56
+ /** An operator's statement that the cash arrived; there is no gateway to ask. */
57
+ settle(transactionId: string): CashOnDeliverySettlement;
58
+
59
+ /**
60
+ * An operator undoing a collection: either the cash never arrived, or it was
61
+ * marked collected by mistake. Vendure lets a settled payment be cancelled, so
62
+ * the ledger has to forget it too — otherwise the order could never be paid
63
+ * again, which is stricter than the platform and not what anyone asked for.
64
+ */
65
+ cancel(transactionId: string): CashOnDeliverySettlement;
66
+ }
67
+
68
+ export function createCashOnDeliveryLedger(): CashOnDeliveryLedger {
69
+ const collected = new Set<string>();
70
+
71
+ return {
72
+ authorize(input) {
73
+ const transactionId = cashOnDeliveryTransactionId(input.orderCode);
74
+
75
+ if (collected.has(transactionId)) {
76
+ return {
77
+ amount: input.amount,
78
+ state: "Declined",
79
+ errorMessage: "The cash for this order has already been collected",
80
+ metadata: input.metadata,
81
+ };
82
+ }
83
+
84
+ return {
85
+ amount: input.amount,
86
+ state: "Authorized",
87
+ transactionId,
88
+ metadata: input.metadata,
89
+ };
90
+ },
91
+
92
+ settle(transactionId) {
93
+ collected.add(transactionId);
94
+ return { success: true };
95
+ },
96
+
97
+ cancel(transactionId) {
98
+ collected.delete(transactionId);
99
+ return { success: true };
100
+ },
101
+ };
102
+ }
@@ -34,11 +34,81 @@ describe("jarShopCodPaymentHandler", () => {
34
34
  const result = await jarShopCodPaymentHandler.settlePayment(
35
35
  context,
36
36
  order,
37
- {} as Payment,
37
+ { transactionId: "cod:ORDER-123" } as Payment,
38
38
  [],
39
39
  method,
40
40
  );
41
41
 
42
42
  expect(result).toEqual({ success: true });
43
43
  });
44
+
45
+ it("refuses to authorize collection a second time once the cash arrived", async () => {
46
+ const collected = { code: "ORDER-456" } as Order;
47
+
48
+ await jarShopCodPaymentHandler.createPayment(
49
+ context,
50
+ collected,
51
+ 500,
52
+ [],
53
+ {},
54
+ method,
55
+ );
56
+ await jarShopCodPaymentHandler.settlePayment(
57
+ context,
58
+ collected,
59
+ { transactionId: "cod:ORDER-456" } as Payment,
60
+ [],
61
+ method,
62
+ );
63
+
64
+ const again = await jarShopCodPaymentHandler.createPayment(
65
+ context,
66
+ collected,
67
+ 500,
68
+ [],
69
+ {},
70
+ method,
71
+ );
72
+
73
+ expect(again).toMatchObject({ state: "Declined" });
74
+ });
75
+
76
+ it("lets the shop start again once a collection is cancelled", async () => {
77
+ const mistaken = { code: "ORDER-789" } as Order;
78
+ const payment = { transactionId: "cod:ORDER-789" } as Payment;
79
+
80
+ await jarShopCodPaymentHandler.createPayment(
81
+ context,
82
+ mistaken,
83
+ 500,
84
+ [],
85
+ {},
86
+ method,
87
+ );
88
+ await jarShopCodPaymentHandler.settlePayment(
89
+ context,
90
+ mistaken,
91
+ payment,
92
+ [],
93
+ method,
94
+ );
95
+ await jarShopCodPaymentHandler.cancelPayment!(
96
+ context,
97
+ mistaken,
98
+ payment,
99
+ [],
100
+ method,
101
+ );
102
+
103
+ const again = await jarShopCodPaymentHandler.createPayment(
104
+ context,
105
+ mistaken,
106
+ 500,
107
+ [],
108
+ {},
109
+ method,
110
+ );
111
+
112
+ expect(again).toMatchObject({ state: "Authorized" });
113
+ });
44
114
  });
@@ -1,8 +1,15 @@
1
1
  import { LanguageCode, PaymentMethodHandler } from "@vendure/core";
2
+ import { createCashOnDeliveryLedger } from "./cod-payment-core.js";
3
+
4
+ /** One ledger for the shop, so what it has already collected stays remembered. */
5
+ const ledger = createCashOnDeliveryLedger();
2
6
 
3
7
  /**
4
8
  * Cash on delivery is a two-step payment: checkout authorizes collection, and
5
9
  * an authenticated operator settles it only after money is actually received.
10
+ *
11
+ * The decisions are made in `cod-payment-core.ts`; this handler is the Vendure
12
+ * face of them and adds nothing of its own.
6
13
  */
7
14
  export const jarShopCodPaymentHandler = new PaymentMethodHandler({
8
15
  code: "jarshop-cod-handler",
@@ -17,12 +24,10 @@ export const jarShopCodPaymentHandler = new PaymentMethodHandler({
17
24
  },
18
25
  ],
19
26
  args: {},
20
- createPayment: async (_ctx, order, amount, _args, metadata) => ({
21
- amount,
22
- state: "Authorized" as const,
23
- transactionId: `cod:${order.code}`,
24
- metadata,
25
- }),
26
- settlePayment: async () => ({ success: true }),
27
- cancelPayment: async () => ({ success: true }),
27
+ createPayment: async (_ctx, order, amount, _args, metadata) =>
28
+ ledger.authorize({ orderCode: order.code, amount, metadata }),
29
+ settlePayment: async (_ctx, _order, payment) =>
30
+ ledger.settle(payment.transactionId),
31
+ cancelPayment: async (_ctx, _order, payment) =>
32
+ ledger.cancel(payment.transactionId),
28
33
  });
@@ -1,4 +1,5 @@
1
1
  import { api, defineDashboardExtension, useQuery } from "@vendure/dashboard";
2
+ import { JarShopLoginLogo } from "./login-branding.js";
2
3
  import { graphql } from "@/gql";
3
4
  import { useState, type FormEvent } from "react";
4
5
  import {
@@ -261,6 +262,9 @@ function EmailBrandConfigurationBlock() {
261
262
  }
262
263
 
263
264
  defineDashboardExtension({
265
+ login: {
266
+ logo: { component: JarShopLoginLogo },
267
+ },
264
268
  pageBlocks: [
265
269
  {
266
270
  id: "jarshop-order-email-delivery-status",
@@ -0,0 +1,49 @@
1
+ // Replaces the default Vendure wordmark on the Dashboard login page via the
2
+ // login.logo extension point (see defineDashboardExtension in ./index.tsx).
3
+ //
4
+ // The brand ships two tile variants that differ only in their three fill
5
+ // colours: a blue tile for light surfaces and a light tile for the dark
6
+ // Dashboard. Rather than render both and hide one, the single mark below swaps
7
+ // those fills on the `dark` class that the Dashboard's theme provider puts on
8
+ // the root element, so the login logo stays legible in light, dark and system
9
+ // themes without any script. The favicon is the blue tile in every theme,
10
+ // because a browser tab has no way to ask the page which theme is active.
11
+ export function JarShopLoginLogo() {
12
+ return (
13
+ <svg
14
+ viewBox="0 0 1200 1200"
15
+ className="h-16 w-auto"
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ role="img"
18
+ aria-label="JarShop"
19
+ >
20
+ <title>JarShop</title>
21
+ <rect
22
+ x="440"
23
+ y="60"
24
+ width="320"
25
+ height="84"
26
+ rx="42"
27
+ className="fill-[#243A52] dark:fill-[#E9F0F7]"
28
+ />
29
+ <rect
30
+ x="100"
31
+ y="200"
32
+ width="1000"
33
+ height="900"
34
+ rx="220"
35
+ className="fill-[#243A52] dark:fill-[#E9F0F7]"
36
+ />
37
+ <g transform="translate(225,368) scale(0.5)">
38
+ <path
39
+ className="fill-[#A8C0DA] dark:fill-[#4C6C91]"
40
+ d="M 431.1 225.3 L 431.1 259.6 590.5 419 L 750 578.4 750 543.5 L 750 508.5 591.2 349.8 C 503.9 262.4, 432.2 191, 431.8 191 C 431.4 191, 431.1 206.4, 431.1 225.3 M 78 578.5 L 78 613.5 237 772.5 L 396 931.5 396 896.5 L 396 861.5 237 702.5 L 78 543.5 78 578.5 M 799.1 599.3 L 799.1 633.6 951 785.5 L 1103 937.5 1103 902.5 L 1103 867.5 951.7 716.2 C 868.6 633.1, 800.2 565, 799.8 565 C 799.4 565, 799.1 580.4, 799.1 599.3"
41
+ />
42
+ <path
43
+ className="fill-[#4C6C91] dark:fill-[#243A52]"
44
+ d="M 555.2 702.3 L 396 861.5 396.2 896.3 L 396.5 931 573 754.5 L 749.5 578 732 560.5 L 714.5 543 555.2 702.3 M 1261.7 708.8 L 1103 867.5 1103 902.3 C 1103 921.4, 1103.3 937, 1103.8 937 C 1104.2 937, 1176 865.5, 1263.3 778.2 L 1422 619.4 1422 584.7 C 1421.9 565.6, 1421.6 550, 1421.2 550 C 1420.8 550, 1349.1 621.4, 1261.7 708.8"
45
+ />
46
+ </g>
47
+ </svg>
48
+ );
49
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The shipping rates the seed configures on the starter's own methods, in minor
3
+ * units of the Channel currency, tax included.
4
+ *
5
+ * The seed reads them to configure `default-shipping-calculator`, and the platform's
6
+ * contract matrix reads them to know what the native methods must quote. One module
7
+ * for both is what keeps the matrix from proving a price the shop no longer charges.
8
+ * It imports nothing, so the root matrix can load it without pulling Vendure in.
9
+ */
10
+ export const seededShippingRates = Object.freeze({
11
+ pickup: 0,
12
+ courier: 490,
13
+ });
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  CurrencyCode,
3
+ GlobalSettingsService,
3
4
  LanguageCode,
4
5
  ProductService,
5
6
  ProductVariantService,
@@ -20,6 +21,7 @@ import {
20
21
  import { GlobalFlag } from "@vendure/common/lib/generated-types";
21
22
  import { config } from "./vendure-config";
22
23
  import { JarShopLegalConfiguration } from "./plugins/jarshop-checkout/legal.entity.js";
24
+ import { seededShippingRates } from "./plugins/jarshop-checkout/shipping-rates.js";
23
25
 
24
26
  const productSlug = "jarshop-demo-product";
25
27
 
@@ -42,6 +44,7 @@ async function seed(): Promise<void> {
42
44
  const taxCategoryService = app.get(TaxCategoryService);
43
45
  const taxRateService = app.get(TaxRateService);
44
46
  const channelService = app.get(ChannelService);
47
+ const globalSettingsService = app.get(GlobalSettingsService);
45
48
  const paymentMethodService = app.get(PaymentMethodService);
46
49
  const shippingMethodService = app.get(ShippingMethodService);
47
50
  const connection = app.get(TransactionalConnection);
@@ -70,15 +73,43 @@ async function seed(): Promise<void> {
70
73
  memberIds: [slovakia.id],
71
74
  });
72
75
  }
76
+ // The Dashboard offers a translation tab per language listed in the global
77
+ // settings, and the Shop API falls back to the channel default language.
78
+ // Both are database state, so an installation created before JarShop chose
79
+ // Slovak still has to be corrected here rather than in the config alone.
80
+ const storeLanguages = [LanguageCode.sk, LanguageCode.en];
81
+ const globalSettings = await globalSettingsService.getSettings(ctx);
82
+ const missingGlobalLanguages = storeLanguages.filter(
83
+ (languageCode) =>
84
+ !globalSettings.availableLanguages.includes(languageCode),
85
+ );
86
+ if (missingGlobalLanguages.length > 0) {
87
+ await globalSettingsService.updateSettings(ctx, {
88
+ availableLanguages: [
89
+ ...globalSettings.availableLanguages,
90
+ ...missingGlobalLanguages,
91
+ ],
92
+ });
93
+ }
94
+
95
+ const channelLanguagesMissing =
96
+ channel.defaultLanguageCode !== LanguageCode.sk ||
97
+ storeLanguages.some(
98
+ (languageCode) =>
99
+ !(channel.availableLanguageCodes ?? []).includes(languageCode),
100
+ );
73
101
  if (
74
102
  !channel.defaultTaxZone ||
75
- channel.defaultCurrencyCode !== CurrencyCode.EUR
103
+ channel.defaultCurrencyCode !== CurrencyCode.EUR ||
104
+ channelLanguagesMissing
76
105
  ) {
77
106
  await channelService.update(ctx, {
78
107
  id: channel.id,
79
108
  defaultTaxZoneId: taxZone.id,
80
109
  defaultCurrencyCode: CurrencyCode.EUR,
81
110
  availableCurrencyCodes: [CurrencyCode.EUR],
111
+ defaultLanguageCode: LanguageCode.sk,
112
+ availableLanguageCodes: storeLanguages,
82
113
  });
83
114
  channel = await channelService.getDefaultChannel(ctx);
84
115
  ctx = await requestContextService.create({
@@ -101,7 +132,7 @@ async function seed(): Promise<void> {
101
132
  calculator: {
102
133
  code: "default-shipping-calculator",
103
134
  arguments: [
104
- { name: "rate", value: "0" },
135
+ { name: "rate", value: String(seededShippingRates.pickup) },
105
136
  { name: "taxRate", value: "0" },
106
137
  { name: "includesTax", value: "auto" },
107
138
  ],
@@ -134,7 +165,7 @@ async function seed(): Promise<void> {
134
165
  calculator: {
135
166
  code: "default-shipping-calculator",
136
167
  arguments: [
137
- { name: "rate", value: "490" },
168
+ { name: "rate", value: String(seededShippingRates.courier) },
138
169
  { name: "taxRate", value: "0" },
139
170
  { name: "includesTax", value: "auto" },
140
171
  ],
@@ -2,6 +2,7 @@ import {
2
2
  DefaultJobQueuePlugin,
3
3
  DefaultSchedulerPlugin,
4
4
  DefaultSearchPlugin,
5
+ LanguageCode,
5
6
  VendureConfig,
6
7
  } from "@vendure/core";
7
8
  import { AssetServerPlugin } from "@vendure/asset-server-plugin";
@@ -39,6 +40,10 @@ function storefrontAccountUrl(locale: string, path: string): string {
39
40
  }
40
41
 
41
42
  export const config: VendureConfig = {
43
+ // JarShop sells in Slovakia first. This is read when a new installation
44
+ // populates its default channel and global settings, so it decides which
45
+ // translation the Dashboard and Shop API fall back to.
46
+ defaultLanguageCode: LanguageCode.sk,
42
47
  apiOptions: {
43
48
  port: Number(process.env.PORT ?? 3000),
44
49
  adminApiPath: "admin-api",
@@ -81,7 +86,10 @@ export const config: VendureConfig = {
81
86
  paymentOptions: { paymentMethodHandlers: [jarShopCodPaymentHandler] },
82
87
  plugins: [
83
88
  JarShopCheckoutPlugin,
84
- GraphiqlPlugin.init(),
89
+ // A GraphQL IDE is a development convenience, not something a live
90
+ // storefront's admin needs exposed - and its own page is titled
91
+ // "Vendure GraphiQL", which JarShop has no override for.
92
+ ...(isDev ? [GraphiqlPlugin.init()] : []),
85
93
  AssetServerPlugin.init({
86
94
  route: "assets",
87
95
  assetUploadDir: path.join(__dirname, "../static/assets"),
@@ -2,7 +2,7 @@
2
2
  <mj-section background-color="#375a67">
3
3
  <mj-column width="100%">
4
4
  <mj-text align="center" color="#eee">
5
- <span>[footer text]</span>
5
+ <span>&copy; JarShop</span>
6
6
  </mj-text>
7
7
  </mj-column>
8
8
  </mj-section>
@@ -13,6 +13,8 @@
13
13
  <mj-body>
14
14
  <mj-section background-color="#f0f0f0">
15
15
  <mj-column>
16
- <mj-text>[company header]</mj-text>
16
+ <mj-text align="center" font-size="20px" font-weight="700" color="#1f2a37">
17
+ JarShop
18
+ </mj-text>
17
19
  </mj-column>
18
20
  </mj-section>
@@ -7,6 +7,7 @@
7
7
  },
8
8
  "lint:storefront": {},
9
9
  "typecheck:storefront": {},
10
+ "test:vendure": {},
10
11
  "test:storefront": {},
11
12
  "dev:server": { "cache": false, "persistent": true },
12
13
  "dev:worker": { "cache": false, "persistent": true },
@@ -1,4 +1,5 @@
1
1
  import { vendureDashboardPlugin } from "@vendure/dashboard/vite";
2
+ import { LanguageCode } from "@vendure/core";
2
3
  import { join, resolve } from "node:path";
3
4
  import { fileURLToPath, pathToFileURL } from "node:url";
4
5
  import { defineConfig } from "vite";
@@ -7,7 +8,15 @@ const projectRoot = fileURLToPath(new URL(".", import.meta.url));
7
8
 
8
9
  export default defineConfig({
9
10
  base: "/dashboard",
10
- build: { outDir: join(projectRoot, "dist/dashboard") },
11
+ build: {
12
+ outDir: join(projectRoot, "dist/dashboard"),
13
+ // The output directory is named by an absolute path, which is outside the
14
+ // Vite root, and Vite will not empty such a directory unless asked. Without
15
+ // this, every dashboard build layers its hashed assets on top of the last
16
+ // one: the directory grows without bound and the served chunk graph can mix
17
+ // two builds, which fails at runtime as a null React dispatcher.
18
+ emptyOutDir: true,
19
+ },
11
20
  plugins: [
12
21
  vendureDashboardPlugin({
13
22
  vendureConfigPath: pathToFileURL(
@@ -20,7 +29,25 @@ export default defineConfig({
20
29
  host: "http://localhost",
21
30
  port: Number(process.env.PORT ?? 3000),
22
31
  },
32
+ // JarShop ships its own Slovak catalogue through a patch on
33
+ // @vendure/dashboard. Vendure's own default language list has no Slovak
34
+ // in it, so the display-language dialog has to be told about it here.
35
+ i18n: {
36
+ defaultLanguage: LanguageCode.sk,
37
+ defaultLocale: "SK",
38
+ availableLanguages: [LanguageCode.sk, LanguageCode.en],
39
+ availableLocales: ["SK", "CZ", "AT", "GB", "US"],
40
+ },
23
41
  gqlOutputPath: "./src/gql",
42
+ // Dashboard extensions shipped by an installed Feature Package are found by
43
+ // scanning node_modules. The default guess is derived from wherever
44
+ // `@vendure/core` resolves, which under pnpm is a directory inside
45
+ // `node_modules/.pnpm` that holds Vendure alone — every other installed
46
+ // package is invisible from there. Point the scanner at this project's own
47
+ // `node_modules` so package-provided extensions are discovered.
48
+ pluginPackageScanner: {
49
+ nodeModulesRoot: resolve(projectRoot, "node_modules"),
50
+ },
24
51
  }),
25
52
  ],
26
53
  resolve: {
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ // A bare `vitest run` would pick up `vite.config.mts`, which loads the
4
+ // Dashboard build plugin and the whole Vendure config just to run unit tests.
5
+ // This file keeps the Vendure-side plugin tests on a plain Node runner.
6
+ export default defineConfig({
7
+ test: {
8
+ environment: "node",
9
+ include: ["src/**/*.test.ts"],
10
+ },
11
+ });
@@ -1,3 +1,3 @@
1
1
  {
2
- "digest": "sha256:2376fe84803b036833d2afbccd72f9971964a89dd07c6592ef0c06ac07c3e40f"
2
+ "digest": "sha256:3f0fe65753ae37ca686b790a1167cc3c5eeedfac66616cd59bf6fb8fe44dfa85"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jarwizz/create-jarshop",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "description": "Generate an independent JarShop Client Project.",
6
6
  "license": "MIT",