@vendure-platform/create 0.5.1 → 1.0.0-major.202609091053.0.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 (172) hide show
  1. package/README.md +48 -36
  2. package/dist/add-to-existing.d.ts +19 -13
  3. package/dist/add-to-existing.js +1 -1
  4. package/dist/assets/demo-data/assets/branding/logo.svg +4 -0
  5. package/dist/assets/demo-data/assets/images/absorbent-pad.webp +0 -0
  6. package/dist/assets/demo-data/assets/images/adjustable-wrench.webp +0 -0
  7. package/dist/assets/demo-data/assets/images/anchor-bolt.webp +0 -0
  8. package/dist/assets/demo-data/assets/images/angle-grinder.webp +0 -0
  9. package/dist/assets/demo-data/assets/images/barrier-tape.webp +0 -0
  10. package/dist/assets/demo-data/assets/images/bench-grinder.webp +0 -0
  11. package/dist/assets/demo-data/assets/images/bracket.webp +0 -0
  12. package/dist/assets/demo-data/assets/images/broom.webp +0 -0
  13. package/dist/assets/demo-data/assets/images/bucket.webp +0 -0
  14. package/dist/assets/demo-data/assets/images/cable-gland.webp +0 -0
  15. package/dist/assets/demo-data/assets/images/cable-tie.webp +0 -0
  16. package/dist/assets/demo-data/assets/images/cable-tray.webp +0 -0
  17. package/dist/assets/demo-data/assets/images/cable.webp +0 -0
  18. package/dist/assets/demo-data/assets/images/chimney-base-kit.webp +0 -0
  19. package/dist/assets/demo-data/assets/images/chimney-cowl-bird-guard.webp +0 -0
  20. package/dist/assets/demo-data/assets/images/chimney-cowl-open.webp +0 -0
  21. package/dist/assets/demo-data/assets/images/chimney-storm-collar.webp +0 -0
  22. package/dist/assets/demo-data/assets/images/chimney-wall-bracket.webp +0 -0
  23. package/dist/assets/demo-data/assets/images/circular-saw.webp +0 -0
  24. package/dist/assets/demo-data/assets/images/cleaning-spray.webp +0 -0
  25. package/dist/assets/demo-data/assets/images/conduit.webp +0 -0
  26. package/dist/assets/demo-data/assets/images/cordless-drill.webp +0 -0
  27. package/dist/assets/demo-data/assets/images/drill-bits.webp +0 -0
  28. package/dist/assets/demo-data/assets/images/dust-mask.webp +0 -0
  29. package/dist/assets/demo-data/assets/images/ear-defenders.webp +0 -0
  30. package/dist/assets/demo-data/assets/images/ear-plugs.webp +0 -0
  31. package/dist/assets/demo-data/assets/images/extension-lead.webp +0 -0
  32. package/dist/assets/demo-data/assets/images/eye-wash-station.webp +0 -0
  33. package/dist/assets/demo-data/assets/images/face-shield.webp +0 -0
  34. package/dist/assets/demo-data/assets/images/file-set.webp +0 -0
  35. package/dist/assets/demo-data/assets/images/first-aid-kit.webp +0 -0
  36. package/dist/assets/demo-data/assets/images/floor-sign.webp +0 -0
  37. package/dist/assets/demo-data/assets/images/flue-bend-45.webp +0 -0
  38. package/dist/assets/demo-data/assets/images/flue-bend-90.webp +0 -0
  39. package/dist/assets/demo-data/assets/images/flue-section-1000mm.webp +0 -0
  40. package/dist/assets/demo-data/assets/images/flue-section-250mm.webp +0 -0
  41. package/dist/assets/demo-data/assets/images/flue-section-500mm.webp +0 -0
  42. package/dist/assets/demo-data/assets/images/fuse.webp +0 -0
  43. package/dist/assets/demo-data/assets/images/glove-dispenser.webp +0 -0
  44. package/dist/assets/demo-data/assets/images/grinding-disc.webp +0 -0
  45. package/dist/assets/demo-data/assets/images/hacksaw.webp +0 -0
  46. package/dist/assets/demo-data/assets/images/hammer.webp +0 -0
  47. package/dist/assets/demo-data/assets/images/hand-sanitiser.webp +0 -0
  48. package/dist/assets/demo-data/assets/images/head-torch.webp +0 -0
  49. package/dist/assets/demo-data/assets/images/heat-gun.webp +0 -0
  50. package/dist/assets/demo-data/assets/images/hex-bolt.webp +0 -0
  51. package/dist/assets/demo-data/assets/images/hex-key-set.webp +0 -0
  52. package/dist/assets/demo-data/assets/images/hex-nut.webp +0 -0
  53. package/dist/assets/demo-data/assets/images/hi-vis-jacket.webp +0 -0
  54. package/dist/assets/demo-data/assets/images/hi-vis-vest.webp +0 -0
  55. package/dist/assets/demo-data/assets/images/hose-clamp.webp +0 -0
  56. package/dist/assets/demo-data/assets/images/impact-driver.webp +0 -0
  57. package/dist/assets/demo-data/assets/images/jigsaw.webp +0 -0
  58. package/dist/assets/demo-data/assets/images/junction-box.webp +0 -0
  59. package/dist/assets/demo-data/assets/images/knee-pads.webp +0 -0
  60. package/dist/assets/demo-data/assets/images/machine-screw.webp +0 -0
  61. package/dist/assets/demo-data/assets/images/made-to-order-configurable-chimney.webp +0 -0
  62. package/dist/assets/demo-data/assets/images/mallet.webp +0 -0
  63. package/dist/assets/demo-data/assets/images/mcb.webp +0 -0
  64. package/dist/assets/demo-data/assets/images/mop.webp +0 -0
  65. package/dist/assets/demo-data/assets/images/paper-towels.webp +0 -0
  66. package/dist/assets/demo-data/assets/images/pipe-wrench.webp +0 -0
  67. package/dist/assets/demo-data/assets/images/pliers-set.webp +0 -0
  68. package/dist/assets/demo-data/assets/images/pry-bar.webp +0 -0
  69. package/dist/assets/demo-data/assets/images/rcd.webp +0 -0
  70. package/dist/assets/demo-data/assets/images/reciprocating-saw.webp +0 -0
  71. package/dist/assets/demo-data/assets/images/rivet.webp +0 -0
  72. package/dist/assets/demo-data/assets/images/roof-flashing-high-pitch.webp +0 -0
  73. package/dist/assets/demo-data/assets/images/roof-flashing-low-pitch.webp +0 -0
  74. package/dist/assets/demo-data/assets/images/safety-boots.webp +0 -0
  75. package/dist/assets/demo-data/assets/images/safety-glasses.webp +0 -0
  76. package/dist/assets/demo-data/assets/images/safety-harness.webp +0 -0
  77. package/dist/assets/demo-data/assets/images/safety-helmet.webp +0 -0
  78. package/dist/assets/demo-data/assets/images/safety-sign.webp +0 -0
  79. package/dist/assets/demo-data/assets/images/sanding-disc.webp +0 -0
  80. package/dist/assets/demo-data/assets/images/saw-blade.webp +0 -0
  81. package/dist/assets/demo-data/assets/images/screwdriver-set.webp +0 -0
  82. package/dist/assets/demo-data/assets/images/screwdriver.webp +0 -0
  83. package/dist/assets/demo-data/assets/images/self-tapping-screw.webp +0 -0
  84. package/dist/assets/demo-data/assets/images/socket-set.webp +0 -0
  85. package/dist/assets/demo-data/assets/images/socket.webp +0 -0
  86. package/dist/assets/demo-data/assets/images/spanner-set.webp +0 -0
  87. package/dist/assets/demo-data/assets/images/spanner.webp +0 -0
  88. package/dist/assets/demo-data/assets/images/spill-kit.webp +0 -0
  89. package/dist/assets/demo-data/assets/images/spirit-level.webp +0 -0
  90. package/dist/assets/demo-data/assets/images/switch.webp +0 -0
  91. package/dist/assets/demo-data/assets/images/tape-measure.webp +0 -0
  92. package/dist/assets/demo-data/assets/images/terminal-block.webp +0 -0
  93. package/dist/assets/demo-data/assets/images/threaded-rod.webp +0 -0
  94. package/dist/assets/demo-data/assets/images/torque-wrench.webp +0 -0
  95. package/dist/assets/demo-data/assets/images/utility-knife.webp +0 -0
  96. package/dist/assets/demo-data/assets/images/wall-pass-sleeve.webp +0 -0
  97. package/dist/assets/demo-data/assets/images/wall-plug.webp +0 -0
  98. package/dist/assets/demo-data/assets/images/washer.webp +0 -0
  99. package/dist/assets/demo-data/assets/images/waste-bin.webp +0 -0
  100. package/dist/assets/demo-data/assets/images/wire-connector.webp +0 -0
  101. package/dist/assets/demo-data/assets/images/wire-cutters.webp +0 -0
  102. package/dist/assets/demo-data/assets/images/wood-screw.webp +0 -0
  103. package/dist/assets/demo-data/assets/images/work-gloves.webp +0 -0
  104. package/dist/assets/demo-data/assets/images/work-light.webp +0 -0
  105. package/dist/assets/demo-data/assets/initial-data.json +667 -0
  106. package/dist/assets/demo-data/assets/products.csv +779 -0
  107. package/dist/assets/storefront/next-env.d.ts +2 -1
  108. package/dist/assets/storefront/next.config.ts +14 -13
  109. package/dist/assets/storefront/package.json +3 -2
  110. package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +2 -0
  111. package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +2 -0
  112. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +2 -0
  113. package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +2 -0
  114. package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +2 -0
  115. package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +2 -0
  116. package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +2 -0
  117. package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +2 -0
  118. package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +2 -0
  119. package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +10 -6
  120. package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +8 -5
  121. package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +9 -6
  122. package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +2 -0
  123. package/dist/assets/storefront/src/app/[locale]/layout.tsx +3 -3
  124. package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +2 -60
  125. package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +4 -2
  126. package/dist/assets/storefront/src/components/commerce/product-card.tsx +4 -2
  127. package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +31 -14
  128. package/dist/assets/storefront/src/config/capabilities.ts +41 -0
  129. package/dist/assets/storefront/src/config/scenario.ts +10 -0
  130. package/dist/assets/storefront/src/graphql-env.d.ts +47 -41
  131. package/dist/assets/storefront/src/i18n/server.ts +33 -5
  132. package/dist/assets/storefront/src/lib/backend-health.ts +11 -3
  133. package/dist/assets/storefront/src/lib/vendure/capability-documents.ts +246 -0
  134. package/dist/assets/storefront/src/lib/vendure/capability-schema.ts +358 -0
  135. package/dist/assets/storefront/src/lib/vendure/capability-ui.ts +15 -0
  136. package/dist/assets/storefront/src/lib/vendure/mutations.ts +835 -532
  137. package/dist/assets/storefront/src/lib/vendure/queries.ts +862 -519
  138. package/dist/assets/storefront/src/proxy.ts +11 -0
  139. package/dist/assets/storefront/src/schema.graphql +337 -243
  140. package/dist/assets/templates/README.md.hbs +25 -1
  141. package/dist/assets/templates/docker-compose.yml.hbs +4 -0
  142. package/dist/assets/templates/env.hbs +34 -9
  143. package/dist/assets/templates/environment.d.ts.hbs +1 -0
  144. package/dist/assets/templates/gitignore.hbs +7 -4
  145. package/dist/assets/templates/migrate.ts.hbs +55 -0
  146. package/dist/assets/templates/npmrc.hbs +7 -2
  147. package/dist/assets/templates/platform-edition.ts.hbs +21 -0
  148. package/dist/assets/templates/server-package.json.hbs +15 -8
  149. package/dist/assets/templates/vendure-config.ts.hbs +18 -0
  150. package/dist/bin/run.js +1 -1
  151. package/dist/cli.js +1 -1
  152. package/dist/console-onboarding.d.ts +44 -0
  153. package/dist/console-onboarding.js +1 -0
  154. package/dist/hub-projects.d.ts +48 -0
  155. package/dist/hub-projects.js +1 -0
  156. package/dist/index.d.ts +1 -1
  157. package/dist/index.js +1 -1
  158. package/dist/plugin-registry.d.ts +61 -2
  159. package/dist/plugin-registry.js +1 -1
  160. package/dist/registry.d.ts +16 -13
  161. package/dist/registry.js +1 -1
  162. package/dist/scaffold-shared.js +1 -1
  163. package/dist/scaffold-storefront-only.js +1 -1
  164. package/dist/scaffolder.d.ts +11 -0
  165. package/dist/scaffolder.js +1 -1
  166. package/dist/storefront-copier.d.ts +7 -2
  167. package/dist/storefront-copier.js +1 -1
  168. package/dist/template-renderer.d.ts +26 -5
  169. package/dist/template-renderer.js +1 -1
  170. package/dist/types.d.ts +54 -23
  171. package/package.json +14 -2
  172. package/dist/assets/storefront/src/middleware.ts +0 -11
package/README.md CHANGED
@@ -19,27 +19,37 @@ npx @vendure-platform/create my-project \
19
19
 
20
20
  ## CLI Flags
21
21
 
22
- | Flag | Description | Default |
23
- | -------------------------- | -------------------------------------------------------------- | --------------------------- |
24
- | `--plugins <list>` | Comma-separated optional plugin keys | (interactive prompt) |
25
- | `--company <name>` | Company name for branding | (derived from project name) |
26
- | `--registry-token <token>` | Vendure private-registry npm auth token (baked into `.npmrc`) | (interactive prompt) |
27
- | `--license-token <token>` | Vendure Platform server-side license token (written to `.env`) | (interactive prompt) |
28
- | `--no-storefront` | Skip the Next.js storefront | included |
29
- | `--github` | Create a private GitHub repo via `gh` CLI | no |
30
- | `--github-org <org>` | GitHub organization for the repo (only used with `--github`) | `vendurehq` |
31
- | `--no-install` | Skip `npm install` after scaffolding | runs install |
32
- | `--no-git` | Skip `git init` | inits git |
33
- | `--dry-run` | Print what would be created without writing files | off |
22
+ | Flag | Description | Default |
23
+ | -------------------------- | ------------------------------------------------------------- | --------------------------- |
24
+ | `--plugins <list>` | Comma-separated optional plugin keys | (interactive prompt) |
25
+ | `--company <name>` | Company name for branding | (derived from project name) |
26
+ | `--registry-token <token>` | Vendure private-registry npm auth token (baked into `.npmrc`) | (interactive prompt) |
27
+ | `--license-token <token>` | Console Environment Credential (written to `.env`) | (interactive prompt) |
28
+ | `--no-storefront` | Skip the Next.js storefront | included |
29
+ | `--github` | Create a private GitHub repo via `gh` CLI | no |
30
+ | `--github-org <org>` | GitHub organization for the repo (only used with `--github`) | `vendurehq` |
31
+ | `--no-install` | Skip `npm install` after scaffolding | runs install |
32
+ | `--no-git` | Skip `git init` | inits git |
33
+ | `--dry-run` | Print what would be created without writing files | off |
34
34
 
35
35
  When `--plugins` and `--company` are both provided, the CLI runs in non-interactive mode.
36
36
 
37
- ## Tokens: registry vs license
37
+ ## Vendure Console project lookup
38
38
 
39
- The Vendure Enterprise Portal issues **two distinct tokens** with different purposes - keep them straight:
39
+ Set `VENDURE_CONSOLE_ACCESS_TOKEN` to a WorkOS access token from Vendure Console. The interactive
40
+ flow lists the active Projects with paid Subscriptions in that Customer Account. Selecting a
41
+ Project installs its edition facade and skips manual plugin selection.
42
+
43
+ If the variable is absent, the scaffold runs offline without a warning. `VENDURE_HUB_PROJECTS`
44
+ can name a JSON fixture file for demo and create-flow tests. An explicit `--profile` takes
45
+ precedence over both sources.
46
+
47
+ ## Registry token and Environment Credential
48
+
49
+ Vendure Console issues two distinct credentials with different purposes:
40
50
 
41
51
  - **Registry token**: npm auth token for the private registry. Lets `${pm} install` download `@vendure-platform/*` packages. The CLI writes it into the project `.npmrc` as `_authToken`. `.npmrc` is gitignored.
42
- - **License token**: checked at server boot by the License Guard plugin. The CLI writes it into `.env` as `VENDURE_PLATFORM_LICENSE_TOKEN`.
52
+ - **Environment Credential**: checked at server boot by the License Guard plugin. The CLI writes it into `.env` as `VENDURE_PLATFORM_LICENSE_TOKEN`.
43
53
 
44
54
  They are not interchangeable. Pass each via its dedicated flag (`--registry-token`, `--license-token`) or paste each at its own interactive prompt. Either can be skipped (blank input) if you want to add it later.
45
55
 
@@ -51,27 +61,29 @@ Plugins fall into three tiers (mirroring `@vendure-platform/plugin-meta`):
51
61
  - **Optional**: active by default. Pre-ticked in the prompt; deselect to emit `<key>: false` in the generated `vendure-config.ts`.
52
62
  - **Requires config**: inactive by default. Pick from the prompt to enable; the generated config carries the env-var-driven options block.
53
63
 
54
- | Key | Plugin | Category | Tier |
55
- | ----------------------- | ------------------------- | -------- | -------------------- |
56
- | `license-guard` | License Guard | platform | core-requires-config |
57
- | `org-hierarchy` | Org Hierarchy | b2b | core |
58
- | `advanced-search` | Advanced Search | search | core |
59
- | `workflow-engine` | Workflow Engine | platform | core |
60
- | `approval-workflows` | Approval Workflows | b2b | optional |
61
- | `global-search` | Global Search | search | optional |
62
- | `entity-access-control` | Entity Access Control | b2b | optional |
63
- | `tax-id-management` | Tax ID Management | b2b | optional |
64
- | `shopping-list` | Shopping List | commerce | optional |
65
- | `quick-order` | Quick Order | commerce | optional |
66
- | `reorder-from-history` | Reorder from History | commerce | optional |
67
- | `store-credit` | Store Credit / Gift Cards | commerce | optional |
68
- | `quote-management` | Quote Management | b2b | optional |
69
- | `price-rules` | Price Rules | commerce | optional |
70
- | `packaging-units` | Packaging Units | commerce | optional |
71
- | `content-versioning` | Content Versioning | platform | optional |
72
- | `configurator` | Configurator | commerce | optional |
73
- | `sso` | SSO | platform | requires-config |
74
- | `audit-trail` | Audit Trail | platform | requires-config |
64
+ | Key | Plugin | Category | Tier |
65
+ | ----------------------- | ---------------------- | -------- | -------------------- |
66
+ | `license-guard` | License Guard | platform | core-requires-config |
67
+ | `org-hierarchy` | Org Hierarchy | b2b | core |
68
+ | `advanced-search` | Advanced Search | search | core |
69
+ | `workflow-engine` | Workflow Engine | platform | core |
70
+ | `approval-workflows` | Approval Workflows | b2b | optional |
71
+ | `global-search` | Global Search | search | optional |
72
+ | `entity-access-control` | Entity Access Control | b2b | optional |
73
+ | `tax-id-management` | Tax ID Management | b2b | optional |
74
+ | `shopping-list` | Shopping List | commerce | optional |
75
+ | `shopping-list-managed` | Managed Shopping Lists | commerce | optional |
76
+ | `quick-order` | Quick Order | commerce | optional |
77
+ | `reorder-from-history` | Reorder from History | commerce | optional |
78
+ | `store-credit` | Store Credit | commerce | optional |
79
+ | `gift-cards` | Gift Cards | commerce | optional |
80
+ | `quote-management` | Quote Management | b2b | optional |
81
+ | `price-rules` | Price Rules | commerce | optional |
82
+ | `packaging-units` | Packaging Units | commerce | optional |
83
+ | `content-versioning` | Content Versioning | platform | optional |
84
+ | `configurator` | Configurator | commerce | optional |
85
+ | `sso` | SSO | platform | requires-config |
86
+ | `audit-trail` | Audit Trail | platform | requires-config |
75
87
 
76
88
  The canonical list lives in `libs/plugin-meta/src/index.ts`; this table mirrors it.
77
89
 
@@ -1,3 +1,4 @@
1
+ import { type ConsoleOnboarding } from './console-onboarding';
1
2
  /**
2
3
  * Options for the `add` subcommand. Mirrors the create CLI's `ScaffoldOptions`
3
4
  * but minimal — we only need the plugin selection. Everything else is derived
@@ -11,26 +12,31 @@ export interface AddToExistingOptions {
11
12
  /** Print actions without writing files. */
12
13
  dryRun: boolean;
13
14
  /**
14
- * Vendure private-registry npm auth token. When supplied, written as
15
- * `_authToken` into the project `.npmrc` (literal value) so
16
- * `${pm} install` can pull `@vendure-platform/*` packages without any
17
- * pre-existing `~/.npmrc` setup. The project `.gitignore` is updated to
18
- * ignore `.npmrc` so the literal token never gets committed.
15
+ * A Registry Access Token supplied on the command line, for CI and offline
16
+ * runs. The interactive flow signs in to Console and has Console issue one
17
+ * instead, so nothing is pasted.
19
18
  *
20
- * Distinct from `licenseToken`. When omitted, only the scope mapping is
21
- * written and the user is expected to have `~/.npmrc` set up, or to
22
- * re-run with `--registry-token` later.
19
+ * When present it is written as the literal `_authToken` in the project
20
+ * `.npmrc`, which `.gitignore` is updated to cover. npm cannot read `.env`
21
+ * during install, so env-var indirection would not work here.
23
22
  */
24
23
  registryToken?: string;
25
24
  /**
26
- * Vendure Platform server-side license token. When supplied, written as
27
- * `VENDURE_PLATFORM_LICENSE_TOKEN` into `.env` (filling an empty
28
- * existing value, never overwriting a non-empty one). Read at boot by
29
- * the License Guard plugin.
25
+ * An Environment Credential supplied on the command line, for CI and
26
+ * offline runs. When present it fills an empty
27
+ * `VENDURE_PLATFORM_LICENSE_TOKEN` in `.env` and never overwrites a value
28
+ * that is already there.
30
29
  *
31
- * Distinct from `registryToken`.
30
+ * The interactive flow writes no such secret: `vendure console link`
31
+ * establishes the credential in `.vendure/credentials.json` and
32
+ * `vendure dev` passes it to the server.
32
33
  */
33
34
  licenseToken?: string;
35
+ /**
36
+ * What the interactive flow learned from Console. Writes the Project Link
37
+ * Manifest and gets the Registry Access Token when the run applies.
38
+ */
39
+ consoleOnboarding?: ConsoleOnboarding;
34
40
  }
35
41
  interface DetectedProject {
36
42
  projectDir: string;
@@ -1 +1 @@
1
- "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(){var n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},n(e)};return function(r){if(r&&r.__esModule)return r;var o={};if(null!=r)for(var i=n(r),a=0;a<i.length;a++)"default"!==i[a]&&e(o,r,i[a]);return t(o,r),o}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.detectExistingProject=p,exports.applyAddToExisting=c,exports.runAddToExistingCli=w,exports.addToExisting=k,exports.formatChecklist=P;const r=n(require("@clack/prompts")),o=n(require("fs-extra")),i=n(require("path")),a=require("./plugin-registry"),s=require("./registry"),l=require("./template-renderer"),u="vendure-platform-installation-guide.md";async function p(e){var t,n;const r=i.join(e,"package.json");if(!await o.pathExists(r))throw new Error(`No package.json found at ${r}. Run this from your Vendure project root.`);const a=await o.readJson(r),s="@vendure/core"in{...null!==(t=a.dependencies)&&void 0!==t?t:{},...null!==(n=a.devDependencies)&&void 0!==n?n:{}},l=[i.join(e,"src","vendure-config.ts"),i.join(e,"server","src","vendure-config.ts"),i.join(e,"src","vendure-config.js")];let u=null;for(const e of l)if(await o.pathExists(e)){u=e;break}return{projectDir:e,packageJsonPath:r,vendureConfigPath:u,hasVendureCore:s,envPath:i.join(e,".env"),npmrcPath:i.join(e,".npmrc"),gitignorePath:i.join(e,".gitignore")}}async function c(e,t){const{selectedPlugins:n,dryRun:r,registryToken:s,licenseToken:p}=t,c=(0,a.resolveActivePluginKeys)(n),w=c.map(e=>(0,a.getPlugin)(e)),b=(0,l.resolvePluginVersionSpec)(),k=[],P=w.map(e=>e.packageName),j=await d(e.packageJsonPath,b,P,r);if(j.length>0){const e=1===j.length?j[0]:`${j.length} packages (${j[0]}, \u2026)`;k.push(`Added ${e} at ${b} to package.json \u2014 run \`npm install\` (or your package manager equivalent).`)}const E=f(w,p),_=await m(e.envPath,E,r);_>0&&k.push(`Appended ${_} env var(s) to .env \u2014 fill in real values before booting.`),p&&await g(e.envPath,p,r)&&k.push("Filled in the empty VENDURE_PLATFORM_LICENSE_TOKEN value in .env.");const A=await h(e.npmrcPath,s,r);if(A.scopeAdded||A.authAdded){const e=[];A.scopeAdded&&e.push("scope"),A.authAdded&&e.push("auth token"),k.push(`Updated .npmrc (${e.join(" + ")}).`)}await v(e.gitignorePath,".npmrc",r)&&k.push("Added .npmrc to .gitignore so any future registry token never gets committed.");const N=y(w,c),O=i.join(e.projectDir,u);return r||await o.writeFile(O,N),k.push(`Wrote ${i.relative(e.projectDir,O)} \u2014 follow it to wire up your vendure-config.ts.`),k.push("Swap `import { bootstrap } from '@vendure/core'` for `'@vendure-platform/platform'` in your server entry file (and `bootstrapWorker` if you have a worker). See the installation guide's \"Bootstrap import\" section."),k.push("Generate and run a migration for the new platform entities."),k.push("Rebuild the dashboard if you serve a pre-built artefact."),k.push("Grant new permissions to existing admin roles via Settings \u2192 Roles."),k}async function d(e,t,n,r){var i;const a=await o.readJson(e);null!==(i=a.dependencies)&&void 0!==i||(a.dependencies={});const s=["@vendure-platform/platform",...n].filter((e,t,n)=>n.indexOf(e)===t),l=[];for(const e of s)a.dependencies[e]||(a.dependencies[e]=t,l.push(e));return l.length>0&&!r&&await o.writeJson(e,a,{spaces:2}),l}function f(e,t){const n=[{name:"VENDURE_PLATFORM_LICENSE_TOKEN",defaultValue:null!=t?t:""},{name:"VENDURE_PLATFORM_LICENSE_GUARD_LOCAL_DEV",defaultValue:"1"}];for(const t of e)for(const e of t.envVars)n.some(t=>t.name===e.name)||n.push(e);return n}async function g(e,t,n){if(!await o.pathExists(e))return!1;const r=(await o.readFile(e,"utf8")).split("\n");let i=!1;const a="VENDURE_PLATFORM_LICENSE_TOKEN";for(let e=0;e<r.length;e++){const n=r[e].trim();if(!n.startsWith("#")&&n===`${a}=`){r[e]=`${a}=${t}`,i=!0;break}}return i&&!n&&await o.writeFile(e,r.join("\n")),i}async function m(e,t,n){let r="";await o.pathExists(e)&&(r=await o.readFile(e,"utf8"));const i=new Set(r.split("\n").map(e=>{var t;return null===(t=e.split("=")[0])||void 0===t?void 0:t.trim()}).filter(e=>Boolean(e)&&!e.startsWith("#"))),a=t.filter(e=>!i.has(e.name));if(0===a.length)return 0;const s=a.map(e=>`${e.name}=${e.defaultValue}`).join("\n")+"\n";if(!n){const t=r.endsWith("\n")||""===r?"":"\n";await o.writeFile(e,r+t+"\n# Added by @vendure-platform/create add\n"+s)}return a.length}async function h(e,t,n){const r=`@vendure-platform:registry=${(0,s.getRegistryUrl)()}`,i=`//${(0,s.getRegistryHostname)()}/:_authToken=`;let a="";await o.pathExists(e)&&(a=await o.readFile(e,"utf8"));const l=a.includes("@vendure-platform:registry="),u=a.includes(i),p=[];if(l||p.push(r),t&&!u&&p.push(`${i}${t}`),0===p.length)return{scopeAdded:!1,authAdded:!1};const c=""===a||a.endsWith("\n")?"":"\n";return n||await o.writeFile(e,a+c+p.join("\n")+"\n"),{scopeAdded:!l,authAdded:Boolean(t)&&!u}}async function v(e,t,n){let r="";await o.pathExists(e)&&(r=await o.readFile(e,"utf8"));const i=r.split("\n").map(e=>e.trim());if(i.includes(t)||i.includes(`/${t}`))return!1;const a=""===r||r.endsWith("\n")?"":"\n";return n||await o.writeFile(e,r+a+t+"\n"),!0}function y(e,t){const n=["import { VendurePlatform } from '@vendure-platform/platform';"],r=[];for(const t of e)t.platformImports&&n.push(...t.platformImports),t.platformOptionsBlock&&r.push(` ${t.platformOptionsBlock},`);const o=a.pluginRegistry.filter(e=>"optional"===e.tier&&!t.includes(e.key)).map(e=>e.key);for(const e of o){const t=(0,a.getPlugin)(e).platformKey;r.push(` ${t}: false,`)}return`# Vendure Platform installation guide\n\nPaste these changes into your existing project. Step 1 is the most important \u2014\nwithout it, every Vendure Platform plugin refuses to start with\n\`LICENSE_GUARD_NONCE_MISMATCH\`.\n\n## 1. Bootstrap import (server entry point)\n\nIn your server entry file (typically \`src/index.ts\` or wherever you call\n\`bootstrap()\`), swap the bootstrap import from \`@vendure/core\` to\n\`@vendure-platform/platform\`:\n\n\`\`\`ts\n// before\nimport { bootstrap } from '@vendure/core';\n\n// after\nimport { bootstrap } from '@vendure-platform/platform';\n\`\`\`\n\nIf you also run a separate worker process, swap \`bootstrapWorker\` too:\n\n\`\`\`ts\nimport { bootstrapWorker } from '@vendure-platform/platform';\n\`\`\`\n\nThe \`@vendure-platform/platform\` bootstrap is a drop-in wrapper around\n\`@vendure/core\`'s \`bootstrap\` that primes the runtime license guard before\nNest builds the DI container. Without this swap, plugins like \`OrgHierarchyPlugin\`\nfail at startup with \`LICENSE_GUARD_NONCE_MISMATCH\`.\n\n## 2. Imports in vendure-config.ts\n\nAdd to the top of the file (after your existing imports):\n\n\`\`\`ts\n${n.join("\n")}\n\`\`\`\n\n## 3. Plugins array\n\nSpread \`VendurePlatform.init({...})\` into the \`plugins\` array \u2014 typically\nbetween \`DefaultJobQueuePlugin\` and \`DashboardPlugin\`:\n\n\`\`\`ts\n...VendurePlatform.init({\n${0===r.length?" // All optional plugins enabled with default config":r.join("\n")}\n}),\n\`\`\`\n\n## 4. Order process\n\nIf \`approvalWorkflows\` is enabled (default), VendurePlatform will append\n\`approvalOrderProcess\` to your order process chain and override\n\`arrangingPaymentRequiresContents\` and \`checkAllItemsBeforeCancel\`. If you\nhave custom order process handlers they are preserved; the flags above are\nnot.\n\nSee https://docs.vendure.io/current/platform/getting-started/introduction for the full reference.\n`}async function w(e){var t;const n=process.cwd(),o=await p(n);let s;if(o.hasVendureCore||r.log.warn("No @vendure/core dependency found in package.json. Continuing anyway \u2014 make sure this is the right directory."),o.vendureConfigPath?r.log.info(`Detected vendure-config.ts at ${i.relative(n,o.vendureConfigPath)}`):r.log.warn("No vendure-config.ts found under src/ or server/src/. The installation guide will still be written to the project root."),(void 0===e.plugins||void 0===e.registryToken||void 0===e.licenseToken)&&r.intro("Add Vendure Platform to existing project"),void 0!==e.plugins)s=e.plugins.split(",").map(e=>e.trim()).filter(Boolean);else{const e=a.pluginRegistry.filter(e=>"optional"===e.tier||"requires-config"===e.tier).sort((e,t)=>e.category!==t.category?e.category.localeCompare(t.category):e.displayName.localeCompare(t.displayName)).map(e=>({label:`${e.displayName} (${e.category})`,value:e.key,hint:"requires-config"===e.tier?"needs configuration":void 0})),t=a.pluginRegistry.filter(e=>"optional"===e.tier).map(e=>e.key),n=await r.multiselect({message:"Optional plugins to include (core plugins are always installed):",options:e,initialValues:t,required:!1});"symbol"==typeof n&&(r.cancel("Cancelled."),process.exit(0)),s=n}const l=await b(e.registryToken,"Vendure private-registry npm auth token (from https://enterprise.vendure.io). Used by your package manager (npm/bun/pnpm) at install time. Leave blank to skip:"),u=await b(e.licenseToken,"Vendure Platform license token (server-side, written to .env). Leave blank to skip:");return{projectDir:n,selectedPlugins:s,dryRun:null!==(t=e.dryRun)&&void 0!==t&&t,registryToken:l,licenseToken:u}}async function b(e,t){const n=null==e?void 0:e.trim();if(void 0!==n)return""===n?void 0:n;const o=await r.password({message:t});"symbol"==typeof o&&(r.cancel("Cancelled."),process.exit(0));const i=o.trim();return""===i?void 0:i}async function k(e){const t=await p(e.projectDir),n=a.ALWAYS_ACTIVE_KEYS.map(e=>(0,a.getPlugin)(e).displayName);n.length>0&&r.log.info(`Always-on core plugins: ${n.join(", ")}`);const o=P(await c(t,e));r.note(o,e.dryRun?"Dry run \u2014 would do:":"Next steps"),r.outro(e.dryRun?"Dry run complete \u2014 no files written.":"Done.")}function P(e){const t=Math.max(40,Math.min(process.stdout.columns||80,100)-6);return e.map((e,n)=>{const r=`${n+1}. `,o=" ".repeat(r.length);return j(e,t-r.length).map((e,t)=>(0===t?r:o)+e).join("\n")}).join("\n")}function j(e,t){const n=[];let r="";for(const o of e.split(/\s+/))""===r?r=o:r.length+1+o.length<=t?r+=" "+o:(n.push(r),r=o);return""!==r&&n.push(r),n.length>0?n:[""]}
1
+ "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(){var n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},n(e)};return function(r){if(r&&r.__esModule)return r;var o={};if(null!=r)for(var i=n(r),a=0;a<i.length;a++)"default"!==i[a]&&e(o,r,i[a]);return t(o,r),o}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.detectExistingProject=d,exports.applyAddToExisting=p,exports.runAddToExistingCli=P,exports.addToExisting=k,exports.formatChecklist=E;const r=n(require("@clack/prompts")),o=n(require("fs-extra")),i=n(require("path")),a=require("./console-onboarding"),s=require("./plugin-registry"),l=require("./registry"),u=require("./template-renderer"),c="vendure-platform-installation-guide.md";async function d(e){var t,n;const r=i.join(e,"package.json");if(!await o.pathExists(r))throw new Error(`No package.json found at ${r}. Run this from your Vendure project root.`);const a=await o.readJson(r),s="@vendure/core"in{...null!==(t=a.dependencies)&&void 0!==t?t:{},...null!==(n=a.devDependencies)&&void 0!==n?n:{}},l=[i.join(e,"src","vendure-config.ts"),i.join(e,"server","src","vendure-config.ts"),i.join(e,"src","vendure-config.js")];let u=null;for(const e of l)if(await o.pathExists(e)){u=e;break}return{projectDir:e,packageJsonPath:r,vendureConfigPath:u,hasVendureCore:s,envPath:i.join(e,".env"),npmrcPath:i.join(e,".npmrc"),gitignorePath:i.join(e,".gitignore")}}async function p(e,t){var n;const{selectedPlugins:r,dryRun:a,licenseToken:l,consoleOnboarding:d}=t,p=(0,s.resolveActivePluginKeys)(r),P=p.map(e=>(0,s.getPlugin)(e)),j=(0,u.resolvePluginVersionSpec)(),k=[],E=a?void 0:await b(d,t.projectDir);(null==E?void 0:E.registryLogin)&&k.push(`Log in to the registry: ${E.registryLogin}`);const A=null!==(n=t.registryToken)&&void 0!==n?n:null==E?void 0:E.registryToken;A||(null==E?void 0:E.registryLogin)||k.push("Run `vendure console link` to link this project and get a Registry Access Token.");const _=P.map(e=>e.packageName),T=await f(e.packageJsonPath,j,_,a);if(T.length>0){const e=1===T.length?T[0]:`${T.length} packages (${T[0]}, \u2026)`;k.push(`Added ${e} at ${j} to package.json \u2014 run \`npm install\` (or your package manager equivalent).`)}const C=g(P,l),O=await m(e.envPath,C,a);O>0&&k.push(`Appended ${O} env var(s) to .env \u2014 fill in real values before booting.`),l&&await h(e.envPath,l,a)&&k.push("Filled in the empty VENDURE_PLATFORM_LICENSE_TOKEN value in .env.");const x=await v(e.npmrcPath,A,a);if(x.scopeAdded||x.authAdded){const e=[];x.scopeAdded&&e.push("scope"),x.authAdded&&e.push("auth token"),k.push(`Updated .npmrc (${e.join(" + ")}).`)}await y(e.gitignorePath,".npmrc",a)&&k.push("Added .npmrc to .gitignore so any future registry token never gets committed.");const N=w(P,p),R=i.join(e.projectDir,c);return a||await o.writeFile(R,N),k.push(`Wrote ${i.relative(e.projectDir,R)} \u2014 follow it to wire up your vendure-config.ts.`),k.push("Swap `import { bootstrap } from '@vendure/core'` for `'@vendure-platform/platform'` in your server entry file (and `bootstrapWorker` if you have a worker). See the installation guide's \"Bootstrap import\" section."),k.push("Generate and run a migration for the new platform entities."),k.push("Rebuild the dashboard if you serve a pre-built artefact."),k.push("Grant new permissions to existing admin roles via Settings \u2192 Roles."),k}async function f(e,t,n,r){var i;const a=await o.readJson(e);null!==(i=a.dependencies)&&void 0!==i||(a.dependencies={});const s=["@vendure-platform/platform",...n].filter((e,t,n)=>n.indexOf(e)===t),l=[];for(const e of s)a.dependencies[e]||(a.dependencies[e]=t,l.push(e));return l.length>0&&!r&&await o.writeJson(e,a,{spaces:2}),l}function g(e,t){const n=[{name:"VENDURE_PLATFORM_LICENSE_TOKEN",defaultValue:null!=t?t:""},{name:"VENDURE_PLATFORM_LICENSE_GUARD_LOCAL_DEV",defaultValue:"1"}];for(const t of e)for(const e of t.envVars)n.some(t=>t.name===e.name)||n.push(e);return n}async function h(e,t,n){if(!await o.pathExists(e))return!1;const r=(await o.readFile(e,"utf8")).split("\n");let i=!1;const a="VENDURE_PLATFORM_LICENSE_TOKEN";for(let e=0;e<r.length;e++){const n=r[e].trim();if(!n.startsWith("#")&&n===`${a}=`){r[e]=`${a}=${t}`,i=!0;break}}return i&&!n&&await o.writeFile(e,r.join("\n")),i}async function m(e,t,n){let r="";await o.pathExists(e)&&(r=await o.readFile(e,"utf8"));const i=new Set(r.split("\n").map(e=>{var t;return null===(t=e.split("=")[0])||void 0===t?void 0:t.trim()}).filter(e=>Boolean(e)&&!e.startsWith("#"))),a=t.filter(e=>!i.has(e.name));if(0===a.length)return 0;const s=a.map(e=>`${e.name}=${e.defaultValue}`).join("\n")+"\n";if(!n){const t=r.endsWith("\n")||""===r?"":"\n";await o.writeFile(e,r+t+"\n# Added by @vendure-platform/create add\n"+s)}return a.length}async function v(e,t,n){const r=(0,l.getRegistryUrl)(),i=`@vendure-platform:registry=${r}`,a=(0,l.registryAuthTokenKey)(r);let s="";await o.pathExists(e)&&(s=await o.readFile(e,"utf8"));const u=s.includes("@vendure-platform:registry="),c=s.includes(a),d=[];if(u||d.push(i),t&&!c&&d.push(`${a}${t}`),0===d.length)return{scopeAdded:!1,authAdded:!1};const p=""===s||s.endsWith("\n")?"":"\n";return n||await o.writeFile(e,s+p+d.join("\n")+"\n"),{scopeAdded:!u,authAdded:Boolean(t)&&!c}}async function y(e,t,n){let r="";await o.pathExists(e)&&(r=await o.readFile(e,"utf8"));const i=r.split("\n").map(e=>e.trim());if(i.includes(t)||i.includes(`/${t}`))return!1;const a=""===r||r.endsWith("\n")?"":"\n";return n||await o.writeFile(e,r+a+t+"\n"),!0}function w(e,t){const n=["import { VendurePlatform } from '@vendure-platform/platform';"],{context:r,hbs:o}=(0,u.buildTemplateContext)("","",t,!1);for(const t of e)t.platformImports&&n.push(...t.platformImports);const i=n.join("\n"),a=o.compile("{{platformPluginOptions}}")(r);return`# Vendure Platform installation guide\n\nPaste these changes into your existing project. Step 1 is the most important \u2014\nwithout it, every Vendure Platform plugin refuses to start with\n\`LICENSE_GUARD_NONCE_MISMATCH\`.\n\n## 1. Bootstrap import (server entry point)\n\nIn your server entry file (typically \`src/index.ts\` or wherever you call\n\`bootstrap()\`), swap the bootstrap import from \`@vendure/core\` to\n\`@vendure-platform/platform\`:\n\n\`\`\`ts\n// before\nimport { bootstrap } from '@vendure/core';\n\n// after\nimport { bootstrap } from '@vendure-platform/platform';\n\`\`\`\n\nIf you also run a separate worker process, swap \`bootstrapWorker\` too:\n\n\`\`\`ts\nimport { bootstrapWorker } from '@vendure-platform/platform';\n\`\`\`\n\nThe \`@vendure-platform/platform\` bootstrap is a drop-in wrapper around\n\`@vendure/core\`'s \`bootstrap\` that primes the runtime license guard before\nNest builds the DI container. Without this swap, plugins like \`OrgAccountsPlugin\`\nfail at startup with \`LICENSE_GUARD_NONCE_MISMATCH\`.\n\n## 2. Imports in vendure-config.ts\n\nAdd to the top of the file (after your existing imports):\n\n\`\`\`ts\n${i}\n\`\`\`\n\n## 3. Plugins array\n\nSpread \`VendurePlatform.init({...})\` into the \`plugins\` array \u2014 typically\nbetween \`DefaultJobQueuePlugin\` and \`DashboardPlugin\`:\n\n\`\`\`ts\n...VendurePlatform.init({\n compositionCapabilities: ${JSON.stringify(r.compositionCapabilities)},\n${a}\n}),\n\`\`\`\n\nKeep \`compositionCapabilities\` with these options. It includes the selected\nplugins and their capability dependencies so the composer can register them\nbefore the Environment Credential is exchanged for a signed grant. This local\nhint does not authorize runtime access. License Guard checks the configured\nmodules against the signed grant at boot.\n\n## 4. Order process\n\nIf \`approvalWorkflows\` is selected, VendurePlatform will append\n\`approvalOrderProcess\` to your order process chain and override\n\`arrangingPaymentRequiresContents\` and \`checkAllItemsBeforeCancel\`. If you\nhave custom order process handlers they are preserved; the flags above are\nnot.\n\nSee https://docs.vendure.io/current/platform/getting-started/introduction for the full reference.\n`}async function b(e,t){if(e)try{return await e.finish(t)}catch(e){return void r.log.warn(`${e instanceof Error?e.message:String(e)} Run "vendure console link" here to finish.`)}}async function P(e){var t,n,o;const l=process.cwd(),u=await d(l);let c;if(u.hasVendureCore||r.log.warn("No @vendure/core dependency found in package.json. Continuing anyway \u2014 make sure this is the right directory."),u.vendureConfigPath?r.log.info(`Detected vendure-config.ts at ${i.relative(l,u.vendureConfigPath)}`):r.log.warn("No vendure-config.ts found under src/ or server/src/. The installation guide will still be written to the project root."),(void 0===e.plugins||void 0===e.registryToken)&&r.intro("Add Vendure Platform to existing project"),void 0!==e.plugins)c=e.plugins.split(",").map(e=>e.trim()).filter(Boolean);else{const e=s.pluginRegistry.filter(e=>"optional"===e.tier||"requires-config"===e.tier).sort((e,t)=>e.category!==t.category?e.category.localeCompare(t.category):e.displayName.localeCompare(t.displayName)).map(e=>({label:`${e.displayName} (${e.category})`,value:e.key,hint:"requires-config"===e.tier?"needs configuration":void 0})),t=s.pluginRegistry.filter(e=>"optional"===e.tier).map(e=>e.key),n=await r.multiselect({message:"Optional plugins to include (core plugins are always installed):",options:e,initialValues:t,required:!1});"symbol"==typeof n&&(r.cancel("Cancelled."),process.exit(0)),c=n}const p=void 0!==e.registryToken||e.dryRun?void 0:await(0,a.startConsoleOnboarding)({projectDir:l,interactive:j()});return{projectDir:l,selectedPlugins:c,dryRun:null!==(t=e.dryRun)&&void 0!==t&&t,registryToken:(null===(n=e.registryToken)||void 0===n?void 0:n.trim())||void 0,licenseToken:(null===(o=e.licenseToken)||void 0===o?void 0:o.trim())||void 0,consoleOnboarding:p}}function j(){return Boolean(process.stdin.isTTY&&process.stdout.isTTY)}async function k(e){const t=await d(e.projectDir),n=s.ALWAYS_ACTIVE_KEYS.map(e=>(0,s.getPlugin)(e).displayName);n.length>0&&r.log.info(`Always-on core plugins: ${n.join(", ")}`);const o=E(await p(t,e));r.note(o,e.dryRun?"Dry run \u2014 would do:":"Next steps"),r.outro(e.dryRun?"Dry run complete \u2014 no files written.":"Done.")}function E(e){const t=Math.max(40,Math.min(process.stdout.columns||80,100)-6);return e.map((e,n)=>{const r=`${n+1}. `,o=" ".repeat(r.length);return A(e,t-r.length).map((e,t)=>(0===t?r:o)+e).join("\n")}).join("\n")}function A(e,t){const n=[];let r="";for(const o of e.split(/\s+/))""===r?r=o:r.length+1+o.length<=t?r+=" "+o:(n.push(r),r=o);return""!==r&&n.push(r),n.length>0?n:[""]}
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 40 27">
2
+ <path fill="#17C1FF" d="M10.746 12.008v9.263c0 .166.093.323.237.404l8.407 4.763c.302.17.671.17.973 0l8.407-4.762a.466.466 0 0 0 .237-.405v-9.263a.476.476 0 0 0-.714-.405l-7.93 4.491a.996.996 0 0 1-.973 0l-7.93-4.49a.476.476 0 0 0-.714.404Z"/>
3
+ <path fill="#17C1FF" d="M8.893.072.486 4.832A.948.948 0 0 0 0 5.657v9.522c0 .166.092.323.237.405l8.176 4.633a.476.476 0 0 0 .714-.405V10.83c0-.341.185-.655.487-.824l7.93-4.491a.463.463 0 0 0 0-.81L9.366.072a.48.48 0 0 0-.477 0h.003ZM30.86.063l8.407 4.76c.301.17.486.486.486.825v9.522a.469.469 0 0 1-.237.405l-8.176 4.633a.476.476 0 0 1-.714-.405v-8.982a.945.945 0 0 0-.486-.824l-7.93-4.491a.463.463 0 0 1 0-.81L30.386.063a.48.48 0 0 1 .477 0h-.003Z"/>
4
+ </svg>