@jarwizz/create-jarshop 0.1.9 → 0.4.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.
Files changed (120) hide show
  1. package/README.md +15 -0
  2. package/dist/cli.d.ts +1 -0
  3. package/dist/cli.js +1 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/generator.d.ts +11 -1
  6. package/dist/generator.js +45 -11
  7. package/dist/generator.js.map +1 -1
  8. package/dist/presets.d.ts +28 -0
  9. package/dist/presets.js +105 -0
  10. package/dist/presets.js.map +1 -0
  11. package/dist/template/CONTEXT.md +4 -2
  12. package/dist/template/README.md +255 -3
  13. package/dist/template/env.example.template +19 -0
  14. package/dist/template/gitignore.template +1 -0
  15. package/dist/template/jarshop.config.ts +37 -0
  16. package/dist/template/package.json +4 -0
  17. package/dist/template/pnpm-lock.yaml +3284 -1815
  18. package/dist/template/pnpm-workspace.yaml +6 -1
  19. package/dist/template/src/client/features.ts +41 -0
  20. package/dist/template/src/client/invoicing.ts +29 -0
  21. package/dist/template/src/dev-storefront-environment.test.ts +45 -0
  22. package/dist/template/src/dev-storefront-environment.ts +32 -0
  23. package/dist/template/src/dev-storefront.ts +3 -12
  24. package/dist/template/src/environment.d.ts +8 -0
  25. package/dist/template/src/invoice-email-recover.ts +59 -0
  26. package/dist/template/src/jarshop-config-loader.ts +118 -0
  27. package/dist/template/src/jarshop-config.test.ts +365 -0
  28. package/dist/template/src/jarshop-config.ts +462 -0
  29. package/dist/template/src/jarshop-features.test.ts +222 -0
  30. package/dist/template/src/jarshop-features.ts +112 -0
  31. package/dist/template/src/migrations/1788100000000-jarshop-guest-order-session.ts +27 -0
  32. package/dist/template/src/operation-codes.ts +34 -0
  33. package/dist/template/src/packeta-config.test.ts +95 -0
  34. package/dist/template/src/packeta-countries.test.ts +161 -0
  35. package/dist/template/src/packeta-countries.ts +120 -0
  36. package/dist/template/src/packeta-validation.test.ts +35 -0
  37. package/dist/template/src/packeta-validation.ts +52 -0
  38. package/dist/template/src/payment-return-url.test.ts +57 -0
  39. package/dist/template/src/payment-return-url.ts +34 -0
  40. package/dist/template/src/plugins/jarshop-checkout/confirmation-view.test.ts +79 -0
  41. package/dist/template/src/plugins/jarshop-checkout/confirmation.ts +51 -0
  42. package/dist/template/src/plugins/jarshop-checkout/dashboard/index.tsx +1 -0
  43. package/dist/template/src/plugins/jarshop-checkout/index.ts +4 -0
  44. package/dist/template/src/plugins/jarshop-checkout/invoice-delivery.plugin.ts +79 -0
  45. package/dist/template/src/plugins/jarshop-checkout/invoice-email-events.ts +35 -0
  46. package/dist/template/src/plugins/jarshop-checkout/invoice-email-lifecycle.ts +235 -0
  47. package/dist/template/src/plugins/jarshop-checkout/invoice-email-worker.test.ts +426 -0
  48. package/dist/template/src/plugins/jarshop-checkout/invoice-email.test.ts +107 -0
  49. package/dist/template/src/plugins/jarshop-checkout/jarshop-checkout.plugin.ts +167 -58
  50. package/dist/template/src/plugins/jarshop-checkout/market-active-order-core.ts +108 -0
  51. package/dist/template/src/plugins/jarshop-checkout/market-active-order.test.ts +205 -0
  52. package/dist/template/src/plugins/jarshop-checkout/market-active-order.ts +186 -0
  53. package/dist/template/src/plugins/jarshop-checkout/market-channels.test.ts +58 -0
  54. package/dist/template/src/plugins/jarshop-checkout/market-channels.ts +87 -0
  55. package/dist/template/src/plugins/jarshop-checkout/operation-code-check.ts +36 -0
  56. package/dist/template/src/plugins/jarshop-checkout/order-email-configuration.entity.ts +1 -1
  57. package/dist/template/src/plugins/jarshop-checkout/order-email-configuration.ts +1 -0
  58. package/dist/template/src/plugins/jarshop-checkout/order-email-delivery-core.ts +94 -1
  59. package/dist/template/src/plugins/jarshop-checkout/order-email-delivery.entity.ts +1 -0
  60. package/dist/template/src/plugins/jarshop-checkout/order-email-outbox.ts +83 -1
  61. package/dist/template/src/plugins/jarshop-checkout/order-email-worker.ts +136 -1
  62. package/dist/template/src/plugins/jarshop-checkout/shipping-tax.test.ts +109 -0
  63. package/dist/template/src/plugins/jarshop-checkout/shipping.test.ts +156 -0
  64. package/dist/template/src/plugins/jarshop-checkout/shipping.ts +75 -11
  65. package/dist/template/src/seed.ts +473 -185
  66. package/dist/template/src/vendure-config.ts +258 -113
  67. package/dist/template/storefront/README.md +7 -0
  68. package/dist/template/storefront/app/[locale]/[slug]/page.tsx +3 -2
  69. package/dist/template/storefront/app/[locale]/account/login/page.tsx +3 -2
  70. package/dist/template/storefront/app/[locale]/account/page.tsx +10 -4
  71. package/dist/template/storefront/app/[locale]/account/password-reset/callback/route.ts +4 -2
  72. package/dist/template/storefront/app/[locale]/account/password-reset/complete/page.tsx +3 -2
  73. package/dist/template/storefront/app/[locale]/account/password-reset/page.tsx +3 -2
  74. package/dist/template/storefront/app/[locale]/account/register/page.tsx +3 -2
  75. package/dist/template/storefront/app/[locale]/account/verify/complete/route.ts +4 -2
  76. package/dist/template/storefront/app/[locale]/account/verify/page.tsx +3 -2
  77. package/dist/template/storefront/app/[locale]/cart/page.tsx +3 -2
  78. package/dist/template/storefront/app/[locale]/checkout/actions.ts +43 -0
  79. package/dist/template/storefront/app/[locale]/checkout/checkout-form.tsx +188 -36
  80. package/dist/template/storefront/app/[locale]/checkout/confirmation/route.ts +2 -2
  81. package/dist/template/storefront/app/[locale]/checkout/packeta-chooser.tsx +96 -0
  82. package/dist/template/storefront/app/[locale]/checkout/page.tsx +60 -2
  83. package/dist/template/storefront/app/[locale]/checkout/payment-return/actions.ts +55 -0
  84. package/dist/template/storefront/app/[locale]/checkout/payment-return/page.tsx +32 -0
  85. package/dist/template/storefront/app/[locale]/checkout/payment-return/payment-return.tsx +84 -0
  86. package/dist/template/storefront/app/[locale]/checkout/success/page.tsx +32 -2
  87. package/dist/template/storefront/app/[locale]/layout.tsx +3 -2
  88. package/dist/template/storefront/app/[locale]/page.tsx +3 -2
  89. package/dist/template/storefront/app/globals.css +16 -0
  90. package/dist/template/storefront/app/layout.tsx +6 -2
  91. package/dist/template/storefront/lib/cart.ts +2 -4
  92. package/dist/template/storefront/lib/checkout-contract.test.ts +18 -1
  93. package/dist/template/storefront/lib/checkout-contract.ts +8 -0
  94. package/dist/template/storefront/lib/checkout-countries.test.ts +61 -0
  95. package/dist/template/storefront/lib/checkout-countries.ts +67 -0
  96. package/dist/template/storefront/lib/checkout.ts +22 -11
  97. package/dist/template/storefront/lib/commerce.ts +262 -2
  98. package/dist/template/storefront/lib/confirmation.test.ts +116 -0
  99. package/dist/template/storefront/lib/confirmation.ts +13 -7
  100. package/dist/template/storefront/lib/i18n.test.ts +32 -12
  101. package/dist/template/storefront/lib/i18n.ts +29 -8
  102. package/dist/template/storefront/lib/market-config.ts +40 -0
  103. package/dist/template/storefront/lib/market-routing.test.ts +107 -0
  104. package/dist/template/storefront/lib/market-routing.ts +57 -0
  105. package/dist/template/storefront/lib/market.ts +51 -0
  106. package/dist/template/storefront/lib/packeta-selection.test.ts +141 -0
  107. package/dist/template/storefront/lib/packeta-selection.ts +98 -0
  108. package/dist/template/storefront/lib/payment-return-actions.test.ts +61 -0
  109. package/dist/template/storefront/lib/payment-return-page.test.ts +30 -0
  110. package/dist/template/storefront/lib/payment-return-polling.test.ts +37 -0
  111. package/dist/template/storefront/lib/payment-return-polling.ts +58 -0
  112. package/dist/template/storefront/messages/en.json +13 -1
  113. package/dist/template/storefront/messages/sk.json +13 -1
  114. package/dist/template/storefront/package.json +2 -1
  115. package/dist/template/storefront/proxy.ts +35 -0
  116. package/dist/template/turbo.json +5 -1
  117. package/dist/template-manifest.json +1 -1
  118. package/dist/template.js +1 -0
  119. package/dist/template.js.map +1 -1
  120. package/package.json +1 -1
@@ -24,8 +24,10 @@ project.
24
24
 
25
25
  Open the generated applications at:
26
26
 
27
- - Storefront SK: <http://localhost:3001/sk>
28
- - Storefront EN: <http://localhost:3001/en>
27
+ - Storefront in the default market's languages, for example
28
+ <http://localhost:3001/sk> and <http://localhost:3001/en>
29
+ - Another market locally: set `JARSHOP_DEV_MARKET=<code>` in `.env`, or map one
30
+ of its `domains` to `127.0.0.1` and open that host on port 3001
29
31
  - JarShop Dashboard: <http://localhost:3000/dashboard>
30
32
  - Health check: <http://localhost:3000/health>
31
33
 
@@ -38,6 +40,254 @@ production, replace every credential and provide secrets through the deployment
38
40
  secret store. Never commit `.env`, production credentials, private keys or
39
41
  Terraform state.
40
42
 
43
+ ## Markets
44
+
45
+ `jarshop.config.ts` at the project root is client-owned. The generator writes it
46
+ from the chosen preset, and upgrades never change it. Each market declares its
47
+ Vendure Channel token, currency, courier countries, path languages and domains:
48
+
49
+ - **One market is one Vendure Channel** with its own currency, prices, tax zone
50
+ and carts. Customer accounts are shared across markets.
51
+ - The default market is served by Vendure's default Channel. The server pins
52
+ that Channel's token to the market's `channelToken` on startup.
53
+ - The storefront selects the market by request host (`X-Forwarded-Host`, then
54
+ `Host`) against the markets' `domains`. The `/[locale]` path prefix is limited
55
+ to that market's `languages`: another real language redirects (307) to the
56
+ same path in the market's `defaultLanguage`, a regional tag such as `en-GB`
57
+ redirects to `en`, and a segment that is no language answers 404, so no page
58
+ renders under two URLs.
59
+ - In development, a host that no market lists, such as `localhost`, uses
60
+ `JARSHOP_DEV_MARKET` when it names a market and the default market otherwise.
61
+ A single-market project serves its market on any host, so it needs no domain
62
+ at all. In production (`NODE_ENV=production`) a project with several markets
63
+ answers an unlisted host with 404 and ignores `JARSHOP_DEV_MARKET`; point
64
+ health checks at the server's `/health`, not at the storefront by IP.
65
+ - Courier delivery accepts only the market's `countries`. Account and order
66
+ links in emails and redirect-payment return URLs use the market of the
67
+ request Channel: its first domain outside development, and
68
+ `JARSHOP_STOREFRONT_URL` in development or when a market has no domain.
69
+ - `placeJarShopOrder` refuses a `marketCode` or `currencyCode` that is not the
70
+ request Channel's market with `VALIDATION_ERROR`.
71
+ - On startup the server checks that every market's `channelToken` names a
72
+ Vendure Channel. In `APP_ENV=dev` or `test` a missing Channel is a warning
73
+ until `pnpm db:seed` creates it; otherwise the server refuses to start and
74
+ names the market. Set `JARSHOP_MARKET_CHANNEL_CHECK=warn` to start once and
75
+ create the Channel in the Dashboard.
76
+
77
+ ### Reverse proxy and deployment
78
+
79
+ - The storefront trusts `X-Forwarded-Host` to choose the market. The proxy in
80
+ front of it must **overwrite** that header with the host the shopper used
81
+ (nginx: `proxy_set_header X-Forwarded-Host $host;`), never append to a value
82
+ the client sent, and the storefront must not be reachable without the proxy.
83
+ Otherwise a client can pick another market's Channel by sending the header.
84
+ - Ship `jarshop.config.ts` with the server runtime at the project root, next to
85
+ `package.json` and `dist/`, not under `node_modules`. The server loads it at
86
+ startup by walking up from `dist/`; the storefront bundles it at build time,
87
+ so a storefront image needs a rebuild after the file changes.
88
+ - Projects generated before markets existed have no `jarshop.config.ts`. The
89
+ server then stops with an error naming the missing file, and `next build`
90
+ fails to resolve `../../jarshop.config`. Create the file at the project root
91
+ before upgrading; the `sk-standard` equivalent of the old behaviour is:
92
+
93
+ ```ts
94
+ import type { JarShopConfig } from "./src/jarshop-config.js";
95
+
96
+ const config = {
97
+ defaultMarket: "sk",
98
+ markets: [
99
+ {
100
+ code: "sk",
101
+ channelToken: "sk",
102
+ defaultLanguage: "sk",
103
+ languages: ["sk", "en"],
104
+ currency: "EUR",
105
+ countries: ["SK"],
106
+ domains: [],
107
+ },
108
+ ],
109
+ } satisfies JarShopConfig;
110
+
111
+ export default config;
112
+ ```
113
+
114
+ The default market's `channelToken` replaces the default Channel's token on
115
+ the next start; a storefront that still sends the old token must be rebuilt
116
+ together with the server.
117
+
118
+ The server and the storefront validate the file when they start and list every
119
+ problem at once, for example an unknown currency, a country that is not an
120
+ ISO 3166-1 alpha-2 code, a domain claimed by two markets or a `defaultMarket`
121
+ that names no market. The file is plain data loaded without a build step: keep
122
+ it to object literals and the `satisfies JarShopConfig` check.
123
+
124
+ The development seed creates or updates one Channel per market with its zone,
125
+ countries, zero demo tax rate, shipping methods priced in the market currency,
126
+ COD payment, legal links and the demo product. A real installation creates each
127
+ non-default market Channel in the Dashboard with the token from
128
+ `jarshop.config.ts`.
129
+
130
+ Not yet market-aware: UI copy exists only in Slovak and English, so another
131
+ configured language renders English text until `storefront/messages/<language>.json`
132
+ is added to `storefront/lib/i18n.ts`; order emails and invoices remain Slovak or
133
+ English; a market selected by a path segment on one shared domain is not
134
+ supported.
135
+
136
+ ## Packeta pickup points
137
+
138
+ The generated Vendure workspace and Next.js workspace pin the same exact
139
+ `@jarwizz/feature-packeta` version. Vendure imports its `./server` entry and the
140
+ storefront imports only `./storefront`; the server also installs the matching
141
+ `@jarwizz/feature-adapter-kit` selection plugin, migrations and payment gate.
142
+
143
+ `PACKETA_API_KEY` belongs only to the Vendure server environment. The local
144
+ value is a fake 16-character development key. Replace it through the deployment
145
+ secret store outside development. The storefront reads the approved public
146
+ widget configuration at request time through its local Commerce Facade, so no
147
+ `NEXT_PUBLIC_*` Packeta value or storefront rebuild is needed when the key
148
+ rotates.
149
+
150
+ Packeta serves the destination countries of the markets in `jarshop.config.ts`
151
+ that have a Packeta network (currently CZ, HU, RO and SK; see
152
+ `src/packeta-countries.ts`). The demo seed creates `packeta-pickup` in each
153
+ market's Channel that ships to such a country, priced in that market's
154
+ currency, and the server accepts a Packeta order only for the country and
155
+ currency pair of a market. Because the currency is the only market identity
156
+ Packeta sees, two markets that both ship through Packeta must use different
157
+ currencies: the server refuses to start otherwise and names the markets. A
158
+ market for any other country gets no Packeta method. Pickup points and Z-BOXes
159
+ are on unless `JARSHOP_PACKETA_ZBOX_ENABLED=0`.
160
+ The checkout lists exactly the market's countries and asks for a pickup point of
161
+ the chosen one. Choosing another country releases the order's address (a
162
+ pickup point or courier address pins the order to its country) and quotes the
163
+ new country, so its own methods appear. Packeta is offered where an eligible
164
+ method needs a pickup point; if its widget configuration cannot be read there,
165
+ the checkout shows a retryable error instead of hiding Packeta. Browser widget data remains provisional: checkout sends only
166
+ the internal point id, renders only the snapshot returned by server validation
167
+ and refuses order submission until that snapshot exists. To switch Packeta off,
168
+ set `packeta: false` in `src/client/features.ts`, or set
169
+ `JARSHOP_PACKETA_ENABLED=0` for one environment, and disable the
170
+ `packeta-pickup` shipping method: Vendure omits the Packeta plugin and shipping
171
+ operations, the seed does not recreate its method, and the storefront does not
172
+ receive widget configuration. The kit-owned historical snapshot table remains
173
+ intact.
174
+
175
+ ## Invoicing
176
+
177
+ The starter enables `@jarwizz/jarshop-invoicing` through `invoicing` in
178
+ `src/client/features.ts`, using the reviewed, client-owned configuration in
179
+ `src/client/invoicing.ts`. Replace the synthetic Seller Profile and Last Issued
180
+ Number before real use. A shop that issues invoices elsewhere sets
181
+ `invoicing: false`; see [Adding features](#adding-features-payment-shipping-invoicing-plugins). Existing Client Projects adopt the published package
182
+ explicitly; generating a starter does not update an existing project.
183
+
184
+ Install Chrome and a local Slovak-capable font such as DejaVu Sans on the worker,
185
+ then set `PUPPETEER_EXECUTABLE_PATH` in the environment. pnpm explicitly denies
186
+ Puppeteer's browser-download script. Set `JARSHOP_INVOICE_DIRECTORY` to storage
187
+ shared by server and worker, and include it and the database in backups.
188
+
189
+ Run `pnpm db:migrate` and then the development `pnpm db:seed` explicitly. The
190
+ seed enables invoices and replaces the default Channel's stored template; it
191
+ is idempotent and never runs as a server or worker startup effect. For a real
192
+ Channel, use a reviewed explicit seed calling the package's
193
+ `seedSlovakNonVatInvoiceTemplate`; the demo seed rejects production.
194
+
195
+ COD placement queues invoice generation. Rendering failures leave checkout
196
+ complete and are visible in the worker logs and Vendure's `generate-invoice`
197
+ queue with automatic retries. Invoice email delivery is a separate feature.
198
+ The current unreleased invoicing pin needs the local verified tarball workflow;
199
+ registry installation becomes available through the package release slice.
200
+
201
+ ## Adding features (payment, shipping, invoicing, plugins)
202
+
203
+ `src/client/` is client-owned: upgrades never change it. Its `features.ts`
204
+ decides what the platform-managed `src/vendure-config.ts` registers beside
205
+ JarShop Core, so adding a provider never means editing a managed file:
206
+
207
+ | Field | Meaning |
208
+ | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
209
+ | `paymentMethodHandlers` | Every payment handler. The starter lists COD and the in-memory reference redirect gateway. |
210
+ | `shippingEligibilityCheckers`, `shippingCalculators` | Every shipping operation apart from Packeta's. The demo pickup and courier methods use Vendure's defaults. |
211
+ | `packeta` | Packeta pickup points. `JARSHOP_PACKETA_ENABLED=0` still switches it off for one environment. |
212
+ | `invoicing` | Built-in invoicing configuration, or `false`. |
213
+ | `plugins`, `migrations` | Any other Vendure plugin and the migrations it exports. |
214
+
215
+ The lists are complete: an operation left out is not registered, and a payment
216
+ or shipping method that still names it cannot be used, so disable such methods
217
+ in the Dashboard. Two operations of one kind with the same code stop the server
218
+ at startup; this is checked on the lists in `features.ts` and again on Vendure's
219
+ final configuration, so an operation a plugin adds in its own `configuration`
220
+ hook is covered too. `src/jarshop-features.ts` is the stable API that
221
+ `features.ts` imports from; its exports are not renamed or removed without a
222
+ major Starter Release. The demo seed creates only the methods, COD payment and invoice
223
+ template whose operations or plugin are registered.
224
+
225
+ For example, adding Comgate and the Blog after `pnpm add` of both packages:
226
+
227
+ ```ts
228
+ // src/client/features.ts, beside the starter's existing imports
229
+ import {
230
+ JarShopComgatePlugin,
231
+ createComgatePaymentMethodHandler,
232
+ type ComgateInstallationOptions,
233
+ } from "@jarwizz/feature-comgate/server";
234
+ import {
235
+ JarShopBlogPlugin,
236
+ jarShopBlogMigrations,
237
+ } from "@jarwizz/jarshop-blog/server";
238
+
239
+ const comgate = {
240
+ merchantId: process.env.COMGATE_MERCHANT_ID ?? "",
241
+ // ...the remaining installation options from the Comgate README
242
+ } satisfies ComgateInstallationOptions;
243
+
244
+ const features = {
245
+ paymentMethodHandlers: [
246
+ jarShopCodPaymentHandler,
247
+ createComgatePaymentMethodHandler({ options: comgate, code: "comgate" }),
248
+ ],
249
+ shippingEligibilityCheckers: [defaultShippingEligibilityChecker],
250
+ shippingCalculators: [defaultShippingCalculator],
251
+ packeta: true,
252
+ invoicing: invoicingConfig,
253
+ plugins: [JarShopComgatePlugin.init({ options: comgate }), JarShopBlogPlugin],
254
+ migrations: [...jarShopBlogMigrations],
255
+ } satisfies JarShopFeatures;
256
+ ```
257
+
258
+ Then run `pnpm db:migrate` explicitly; a registered migration never runs at
259
+ startup. A plugin's own `dashboard` extension is how the Dashboard grows: the
260
+ Dashboard build picks it up with the plugin. Your own plugins can live under
261
+ `src/client/` beside `features.ts`. Storefront parts of a Feature still follow
262
+ its Storefront Recipe in `storefront/`.
263
+
264
+ ### Switching invoicing off
265
+
266
+ With `invoicing: false` the server and worker register no invoicing plugin, no
267
+ invoicing migrations, no invoice email delivery and no `jarShopRedeliverInvoice`
268
+ mutation; the seed skips the invoice template, and the worker needs no Chrome.
269
+ The order-confirmation and lifecycle emails are unaffected.
270
+
271
+ In a database that already ran the invoicing migration, nothing is dropped:
272
+ the `invoice` and `invoice_config` tables, their rows and the PDFs stay as they
273
+ are, and only the registered migration class disappears. An invoice email still
274
+ queued in the outbox is deferred, not failed: it stays `pending` with
275
+ `INVOICING_DISABLED`, spends no delivery attempt and is looked at again every
276
+ hour. It never reaches a customer without its PDF, and once invoicing is
277
+ switched back on it is sent on the next pass after its deferral ends. Switching
278
+ invoicing back on reuses the existing tables without rerunning the migration.
279
+ Do not run `migration:revert` across the invoicing migration while it is
280
+ unregistered.
281
+
282
+ > **Warning: do not generate migrations while invoicing is off in a database
283
+ > that has invoice tables.** With `invoicing: false` the invoice entities are
284
+ > not registered, so TypeORM's schema diff (`npx vendure migrate` → generate,
285
+ > or `typeorm migration:generate`) sees the `invoice` and `invoice_config`
286
+ > tables as unknown and writes `DROP TABLE` statements for them. Generate new
287
+ > migrations with invoicing switched on (temporarily if needed), or delete
288
+ > those statements from the generated file before committing it. Running the
289
+ > generated migration would destroy issued invoices.
290
+
41
291
  ## Order-email transport
42
292
 
43
293
  Development uses the deterministic `file` transport from `.env.example`. It is
@@ -58,8 +308,10 @@ startup. Use `pnpm db:migrate` after the database is available.
58
308
 
59
309
  ```text
60
310
  .jarshop/ Generator, release and ownership facts
311
+ jarshop.config.ts Client-owned markets: channels, languages, domains
312
+ src/client/ Client-owned features: payment, shipping, invoicing, plugins
61
313
  src/ Vendure server, worker, migration and seed source
62
- storefront/app/ Client-owned SK/EN routes and UI
314
+ storefront/app/ Client-owned localized routes and UI
63
315
  storefront/lib/commerce.ts Typed Commerce Facade
64
316
  docker-compose.yml Local PostgreSQL
65
317
  AGENTS.md Human and agent operating rules
@@ -4,6 +4,11 @@ NEXT_TELEMETRY_DISABLED=1
4
4
  PORT=3000
5
5
  JARSHOP_STOREFRONT_PORT=3001
6
6
  JARSHOP_COMMERCE_ENDPOINT=http://localhost:3000/shop-api
7
+ # Fake public key for local development only. Production supplies its own
8
+ # 16-character Packeta API key through the server environment.
9
+ PACKETA_API_KEY=0000000000000000
10
+ JARSHOP_PACKETA_ENABLED=1
11
+ JARSHOP_PACKETA_ZBOX_ENABLED=1
7
12
  COOKIE_SECRET=replace-with-a-local-development-secret
8
13
  SUPERADMIN_USERNAME=superadmin
9
14
  SUPERADMIN_PASSWORD=change-me-locally
@@ -30,3 +35,17 @@ JARSHOP_EMAIL_FILE_TRANSPORT_PATH=./static/email/jarshop-outbox
30
35
  # JARSHOP_EMAIL_SMTP_USERNAME=orders@example.com
31
36
  # JARSHOP_EMAIL_SMTP_PASSWORD=replace-in-secret-store
32
37
  JARSHOP_STOREFRONT_URL=http://localhost:3001
38
+ # Market served on a host that jarshop.config.ts does not list, such as
39
+ # localhost. Empty selects the configured defaultMarket.
40
+ JARSHOP_DEV_MARKET=
41
+ # Outside dev/test the server refuses to start while a market in
42
+ # jarshop.config.ts has no Vendure Channel. Set to `warn` to start once and
43
+ # create the missing Channels in the Dashboard.
44
+ JARSHOP_MARKET_CHANNEL_CHECK=
45
+ NEXT_PUBLIC_JARSHOP_PAYMENT_RETURN_POLL_INTERVAL_MS=1000
46
+ NEXT_PUBLIC_JARSHOP_PAYMENT_RETURN_POLL_WINDOW_MS=15000
47
+ # Worker Chrome is installed explicitly; pnpm never downloads a browser.
48
+ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
49
+ # Worker and server must share this directory (and its backups).
50
+ JARSHOP_INVOICE_DIRECTORY=./static/invoices
51
+ JARSHOP_VENDURE_HOST=http://localhost:3000
@@ -8,5 +8,6 @@ dist/
8
8
  static/assets/*
9
9
  static/email/test-emails/*
10
10
  static/email/jarshop-outbox/*
11
+ static/invoices/
11
12
  src/gql/
12
13
  !.gitkeep
@@ -0,0 +1,37 @@
1
+ import type { JarShopConfig } from "./src/jarshop-config.js";
2
+
3
+ /**
4
+ * Client-owned JarShop configuration, generated from the `sk-standard` preset.
5
+ *
6
+ * Each market is one Vendure Channel with its own currency, prices, tax zone
7
+ * and carts; customer accounts are shared across markets. The storefront
8
+ * selects a market by request host and serves only that market's languages as
9
+ * the path prefix. In development a host that no market lists, such as
10
+ * `localhost`, uses `JARSHOP_DEV_MARKET` when set and otherwise `defaultMarket`,
11
+ * whose market is served by Vendure's default Channel; in production a project
12
+ * with several markets answers such a host with 404. The server and the
13
+ * storefront validate this file when they start. Keep it plain data: it is
14
+ * loaded without a build.
15
+ *
16
+ * An optional `vatRate` (percent, 0-100) per market gives that market's demo
17
+ * tax zone a standard VAT rate when `pnpm db:seed` runs; without it the demo
18
+ * seed keeps a 0% rate. With a `vatRate` the seed also makes that market's
19
+ * Channel price-inclusive, so a demo price stays the gross price.
20
+ * Production tax setup stays in the Dashboard.
21
+ */
22
+ const config = {
23
+ defaultMarket: "sk",
24
+ markets: [
25
+ {
26
+ code: "sk",
27
+ channelToken: "sk",
28
+ defaultLanguage: "sk",
29
+ languages: ["sk", "en"],
30
+ currency: "EUR",
31
+ countries: ["SK"],
32
+ domains: [],
33
+ },
34
+ ],
35
+ } satisfies JarShopConfig;
36
+
37
+ export default config;
@@ -31,9 +31,13 @@
31
31
  "db:down": "docker compose down"
32
32
  },
33
33
  "dependencies": {
34
+ "@jarwizz/feature-adapter-kit": "0.4.0",
35
+ "@jarwizz/feature-packeta": "0.2.0",
36
+ "@jarwizz/jarshop-invoicing": "0.1.0",
34
37
  "@aws-sdk/client-s3": "3.1121.0",
35
38
  "@aws-sdk/lib-storage": "3.1121.0",
36
39
  "@nestjs/common": "11.1.28",
40
+ "@nestjs/core": "11.1.28",
37
41
  "@nestjs/graphql": "13.1.0",
38
42
  "@vendure/asset-server-plugin": "3.7.1",
39
43
  "@vendure/common": "3.7.1",