@vendure-platform/create 0.5.0 → 0.5.1
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.
- package/CHANGELOG.md +4 -0
- package/README.md +39 -39
- package/dist/add-to-existing.js +1 -1
- package/dist/assets/demo-data/initial-data.json +663 -663
- package/dist/assets/storefront/components.json +20 -20
- package/dist/assets/storefront/eslint.config.mjs +10 -10
- package/dist/assets/storefront/graphql.config.yml +1 -1
- package/dist/assets/storefront/next.config.ts +5 -4
- package/dist/assets/storefront/package.json +1 -1
- package/dist/assets/storefront/postcss.config.mjs +1 -1
- package/dist/assets/storefront/src/app/[locale]/(catalog)/catalog/page.tsx +17 -21
- package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/page.tsx +64 -42
- package/dist/assets/storefront/src/app/[locale]/(catalog)/layout.tsx +1 -5
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/actions.ts +69 -65
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/page.tsx +64 -38
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/page.tsx +24 -27
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-results.tsx +11 -9
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-term.tsx +4 -4
- package/dist/assets/storefront/src/app/[locale]/(scenario)/[...path]/page.tsx +1 -1
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/accept-invitation-client.tsx +8 -13
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/actions.ts +11 -14
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/page.tsx +30 -33
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/sign-out-and-retry.tsx +6 -6
- package/dist/assets/storefront/src/app/[locale]/account/addresses/actions.ts +30 -45
- package/dist/assets/storefront/src/app/[locale]/account/addresses/address-form.tsx +166 -159
- package/dist/assets/storefront/src/app/[locale]/account/addresses/addresses-client.tsx +35 -26
- package/dist/assets/storefront/src/app/[locale]/account/addresses/loading.tsx +1 -3
- package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +16 -18
- package/dist/assets/storefront/src/app/[locale]/account/approvals/actions.ts +5 -8
- package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +77 -69
- package/dist/assets/storefront/src/app/[locale]/account/company/actions.ts +10 -11
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/actions.ts +6 -15
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/address-form.tsx +57 -49
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/addresses-client.tsx +23 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/page.tsx +30 -30
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/actions.ts +20 -29
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-unit-form.tsx +32 -37
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-units-client.tsx +32 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +24 -24
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/types.ts +7 -4
- package/dist/assets/storefront/src/app/[locale]/account/company/edit-company-form.tsx +11 -21
- package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +23 -28
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +24 -24
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/payment-methods-client.tsx +5 -7
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +22 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/roles-client.tsx +11 -26
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/actions.ts +6 -10
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/page.tsx +18 -16
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/tax-ids-client.tsx +74 -67
- package/dist/assets/storefront/src/app/[locale]/account/company/users/actions.ts +16 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/users/edit-user-form.tsx +27 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/users/invite-user-form.tsx +27 -19
- package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +32 -29
- package/dist/assets/storefront/src/app/[locale]/account/company/users/users-client.tsx +35 -38
- package/dist/assets/storefront/src/app/[locale]/account/error.tsx +1 -3
- package/dist/assets/storefront/src/app/[locale]/account/layout.tsx +16 -22
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/page.tsx +151 -103
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-actions.ts +6 -7
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-dialog.tsx +22 -48
- package/dist/assets/storefront/src/app/[locale]/account/orders/loading.tsx +8 -8
- package/dist/assets/storefront/src/app/[locale]/account/orders/page.tsx +101 -61
- package/dist/assets/storefront/src/app/[locale]/account/profile/actions.ts +32 -23
- package/dist/assets/storefront/src/app/[locale]/account/profile/change-password-form.tsx +6 -16
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-email-form.tsx +7 -17
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-profile-form.tsx +6 -16
- package/dist/assets/storefront/src/app/[locale]/account/profile/loading.tsx +12 -18
- package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +15 -15
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/file-upload-tab.tsx +2 -6
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/manual-entry-tab.tsx +18 -15
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +3 -6
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/preview-table.tsx +10 -2
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/save-to-list-dialog.tsx +24 -26
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/sku-autocomplete.tsx +19 -10
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/text-input-tab.tsx +3 -8
- package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +86 -59
- package/dist/assets/storefront/src/app/[locale]/account/quotes/actions.ts +38 -45
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/new-quote-form.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/page.tsx +6 -6
- package/dist/assets/storefront/src/app/[locale]/account/quotes/page.tsx +92 -59
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-item-search.tsx +11 -9
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-member-form.tsx +31 -15
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/members-panel.tsx +52 -33
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/page.tsx +22 -14
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/rename-dialog.tsx +34 -13
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/actions.ts +117 -72
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/new-shared-cart-form.tsx +21 -14
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/page.tsx +10 -10
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/page.tsx +54 -41
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/page.tsx +22 -8
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/shopping-list-detail-client.tsx +62 -49
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/actions.ts +9 -4
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx +5 -11
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/loading.tsx +1 -1
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/page.tsx +32 -42
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/actions.ts +8 -8
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/claim-form.tsx +6 -10
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/page.tsx +76 -55
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/reveal-code.tsx +10 -6
- package/dist/assets/storefront/src/app/[locale]/account/verify-email/page.tsx +32 -39
- package/dist/assets/storefront/src/app/[locale]/cart/actions.ts +29 -23
- package/dist/assets/storefront/src/app/[locale]/cart/cart-items.tsx +111 -40
- package/dist/assets/storefront/src/app/[locale]/cart/cart-line-actions.tsx +9 -9
- package/dist/assets/storefront/src/app/[locale]/cart/cart-quantity-control.tsx +61 -48
- package/dist/assets/storefront/src/app/[locale]/cart/cart-remove-button.tsx +15 -9
- package/dist/assets/storefront/src/app/[locale]/cart/cart.tsx +38 -41
- package/dist/assets/storefront/src/app/[locale]/cart/code-input.tsx +8 -8
- package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +50 -32
- package/dist/assets/storefront/src/app/[locale]/cart/page.tsx +11 -11
- package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +48 -42
- package/dist/assets/storefront/src/app/[locale]/cart/reapproval-confirm.tsx +22 -20
- package/dist/assets/storefront/src/app/[locale]/cart/request-quote-button.tsx +7 -16
- package/dist/assets/storefront/src/app/[locale]/checkout/actions.ts +39 -65
- package/dist/assets/storefront/src/app/[locale]/checkout/cancel-quote-checkout-button.tsx +5 -5
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-flow.tsx +202 -202
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-provider.tsx +142 -142
- package/dist/assets/storefront/src/app/[locale]/checkout/order-summary.tsx +158 -139
- package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +56 -47
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/delivery-step.tsx +86 -88
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/payment-step.tsx +90 -91
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/review-step.tsx +166 -161
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/shipping-address-step.tsx +573 -494
- package/dist/assets/storefront/src/app/[locale]/error.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/forgot-password/actions.ts +10 -7
- package/dist/assets/storefront/src/app/[locale]/forgot-password/forgot-password-form.tsx +10 -25
- package/dist/assets/storefront/src/app/[locale]/forgot-password/page.tsx +5 -5
- package/dist/assets/storefront/src/app/[locale]/globals.css +48 -48
- package/dist/assets/storefront/src/app/[locale]/layout.tsx +53 -47
- package/dist/assets/storefront/src/app/[locale]/not-found.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +71 -44
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/page.tsx +7 -5
- package/dist/assets/storefront/src/app/[locale]/page.tsx +33 -35
- package/dist/assets/storefront/src/app/[locale]/register/actions.ts +7 -7
- package/dist/assets/storefront/src/app/[locale]/register/page.tsx +22 -16
- package/dist/assets/storefront/src/app/[locale]/register/registration-form.tsx +22 -34
- package/dist/assets/storefront/src/app/[locale]/register-company/actions.ts +15 -19
- package/dist/assets/storefront/src/app/[locale]/register-company/page.tsx +17 -15
- package/dist/assets/storefront/src/app/[locale]/register-company/registration-form.tsx +9 -15
- package/dist/assets/storefront/src/app/[locale]/reset-password/actions.ts +7 -8
- package/dist/assets/storefront/src/app/[locale]/reset-password/page.tsx +18 -12
- package/dist/assets/storefront/src/app/[locale]/reset-password/reset-password-form.tsx +8 -16
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/add-to-cart-button.tsx +10 -4
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/page.tsx +62 -30
- package/dist/assets/storefront/src/app/[locale]/sign-in/actions.ts +14 -16
- package/dist/assets/storefront/src/app/[locale]/sign-in/login-form.tsx +17 -30
- package/dist/assets/storefront/src/app/[locale]/sign-in/page.tsx +35 -30
- package/dist/assets/storefront/src/app/[locale]/verify/actions.ts +8 -8
- package/dist/assets/storefront/src/app/[locale]/verify/page.tsx +18 -14
- package/dist/assets/storefront/src/app/[locale]/verify/verify-content.tsx +25 -27
- package/dist/assets/storefront/src/app/[locale]/verify-pending/page.tsx +23 -23
- package/dist/assets/storefront/src/app/api/clear-company-context/route.ts +6 -3
- package/dist/assets/storefront/src/app/api/revalidate/route.ts +19 -28
- package/dist/assets/storefront/src/app/api/search-analytics/route.ts +1 -1
- package/dist/assets/storefront/src/components/commerce/account-nav-items.ts +43 -18
- package/dist/assets/storefront/src/components/commerce/account-sidebar.tsx +30 -22
- package/dist/assets/storefront/src/components/commerce/active-filters.tsx +1 -1
- package/dist/assets/storefront/src/components/commerce/add-to-shared-cart.tsx +49 -27
- package/dist/assets/storefront/src/components/commerce/approval-decision-form.tsx +9 -13
- package/dist/assets/storefront/src/components/commerce/approval-status-badge.tsx +23 -15
- package/dist/assets/storefront/src/components/commerce/business-unit-switcher.tsx +11 -11
- package/dist/assets/storefront/src/components/commerce/catalog-search-bar.tsx +2 -2
- package/dist/assets/storefront/src/components/commerce/category-product-section.tsx +28 -16
- package/dist/assets/storefront/src/components/commerce/category-sidebar.tsx +31 -18
- package/dist/assets/storefront/src/components/commerce/collection-hero-banner.tsx +2 -4
- package/dist/assets/storefront/src/components/commerce/company-state-badge.tsx +10 -16
- package/dist/assets/storefront/src/components/commerce/company-switcher.tsx +12 -12
- package/dist/assets/storefront/src/components/commerce/configurator-form.tsx +188 -79
- package/dist/assets/storefront/src/components/commerce/facet-filters.tsx +29 -49
- package/dist/assets/storefront/src/components/commerce/gift-card-pdp.tsx +4 -4
- package/dist/assets/storefront/src/components/commerce/gift-card-product-info.tsx +20 -30
- package/dist/assets/storefront/src/components/commerce/instant-search-dropdown.tsx +258 -227
- package/dist/assets/storefront/src/components/commerce/order-status-badge.tsx +27 -19
- package/dist/assets/storefront/src/components/commerce/packaging-unit-selector.tsx +27 -26
- package/dist/assets/storefront/src/components/commerce/permission-gate.tsx +4 -4
- package/dist/assets/storefront/src/components/commerce/price-range-filter.tsx +5 -5
- package/dist/assets/storefront/src/components/commerce/price-tiers.tsx +38 -21
- package/dist/assets/storefront/src/components/commerce/price.tsx +3 -3
- package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +35 -14
- package/dist/assets/storefront/src/components/commerce/product-card.tsx +31 -16
- package/dist/assets/storefront/src/components/commerce/product-carousel.tsx +20 -12
- package/dist/assets/storefront/src/components/commerce/product-grid.tsx +14 -13
- package/dist/assets/storefront/src/components/commerce/product-image-carousel.tsx +10 -8
- package/dist/assets/storefront/src/components/commerce/product-info.tsx +118 -74
- package/dist/assets/storefront/src/components/commerce/product-list-expansion.tsx +102 -74
- package/dist/assets/storefront/src/components/commerce/product-list-view.tsx +1 -1
- package/dist/assets/storefront/src/components/commerce/product-sidebar.tsx +36 -11
- package/dist/assets/storefront/src/components/commerce/product-view-switcher.tsx +33 -21
- package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +54 -36
- package/dist/assets/storefront/src/components/commerce/quote-activity-timeline.tsx +126 -50
- package/dist/assets/storefront/src/components/commerce/quote-comment-form.tsx +9 -13
- package/dist/assets/storefront/src/components/commerce/quote-csv-export-button.tsx +6 -6
- package/dist/assets/storefront/src/components/commerce/quote-product-search.tsx +22 -18
- package/dist/assets/storefront/src/components/commerce/quote-request-form.tsx +28 -27
- package/dist/assets/storefront/src/components/commerce/quote-status-badge.tsx +26 -18
- package/dist/assets/storefront/src/components/commerce/quote-validity-indicator.tsx +7 -7
- package/dist/assets/storefront/src/components/commerce/quote-version-comparison.tsx +50 -30
- package/dist/assets/storefront/src/components/commerce/related-products.tsx +37 -28
- package/dist/assets/storefront/src/components/commerce/shared-cart-status-badge.tsx +12 -8
- package/dist/assets/storefront/src/components/commerce/shop-by-category.tsx +8 -7
- package/dist/assets/storefront/src/components/commerce/shopping-list-toggle.tsx +14 -20
- package/dist/assets/storefront/src/components/commerce/sort-dropdown.tsx +9 -16
- package/dist/assets/storefront/src/components/commerce/store-credit-summary.tsx +30 -32
- package/dist/assets/storefront/src/components/commerce/subcollection-tiles.tsx +11 -13
- package/dist/assets/storefront/src/components/layout/auth-page-shell.tsx +2 -2
- package/dist/assets/storefront/src/components/layout/draft-mode-indicator.tsx +2 -7
- package/dist/assets/storefront/src/components/layout/draft-mode-link.tsx +4 -2
- package/dist/assets/storefront/src/components/layout/footer.tsx +70 -28
- package/dist/assets/storefront/src/components/layout/navbar/actions.ts +9 -12
- package/dist/assets/storefront/src/components/layout/navbar/cart-icon.tsx +9 -9
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker-wrapper.tsx +4 -9
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker.tsx +13 -8
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker-wrapper.tsx +4 -4
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker.tsx +11 -6
- package/dist/assets/storefront/src/components/layout/navbar/language-picker.tsx +7 -7
- package/dist/assets/storefront/src/components/layout/navbar/login-button.tsx +24 -21
- package/dist/assets/storefront/src/components/layout/navbar/mobile-nav.tsx +8 -8
- package/dist/assets/storefront/src/components/layout/navbar/nav-menu-items.tsx +4 -6
- package/dist/assets/storefront/src/components/layout/navbar/navbar-cart.tsx +1 -1
- package/dist/assets/storefront/src/components/layout/navbar/navbar-collections.tsx +41 -42
- package/dist/assets/storefront/src/components/layout/navbar/navbar-link.tsx +7 -10
- package/dist/assets/storefront/src/components/layout/navbar/navbar-user.tsx +18 -23
- package/dist/assets/storefront/src/components/layout/navbar/theme-switcher.tsx +9 -9
- package/dist/assets/storefront/src/components/layout/navbar.tsx +36 -31
- package/dist/assets/storefront/src/components/layout/search-input.tsx +35 -32
- package/dist/assets/storefront/src/components/providers/awaiting-approval-banner.tsx +12 -10
- package/dist/assets/storefront/src/components/providers/cart-count-server.tsx +14 -12
- package/dist/assets/storefront/src/components/providers/company-context-guard.tsx +4 -4
- package/dist/assets/storefront/src/components/providers/company-permissions-server.tsx +2 -6
- package/dist/assets/storefront/src/components/providers/theme-provider.tsx +3 -3
- package/dist/assets/storefront/src/components/shared/breadcrumbs.tsx +4 -1
- package/dist/assets/storefront/src/components/shared/country-select.tsx +63 -67
- package/dist/assets/storefront/src/components/shared/pagination.tsx +15 -28
- package/dist/assets/storefront/src/components/shared/prefetch-link.tsx +1 -1
- package/dist/assets/storefront/src/components/shared/skeletons/search-input-skeleton.tsx +1 -3
- package/dist/assets/storefront/src/components/ui/accordion.tsx +46 -51
- package/dist/assets/storefront/src/components/ui/alert-dialog.tsx +94 -121
- package/dist/assets/storefront/src/components/ui/alert.tsx +48 -54
- package/dist/assets/storefront/src/components/ui/aspect-ratio.tsx +5 -7
- package/dist/assets/storefront/src/components/ui/avatar.tsx +29 -44
- package/dist/assets/storefront/src/components/ui/badge.tsx +28 -37
- package/dist/assets/storefront/src/components/ui/breadcrumb.tsx +82 -89
- package/dist/assets/storefront/src/components/ui/button.tsx +43 -49
- package/dist/assets/storefront/src/components/ui/calendar.tsx +157 -198
- package/dist/assets/storefront/src/components/ui/card.tsx +53 -76
- package/dist/assets/storefront/src/components/ui/carousel.tsx +194 -212
- package/dist/assets/storefront/src/components/ui/chart.tsx +274 -317
- package/dist/assets/storefront/src/components/ui/checkbox.tsx +24 -27
- package/dist/assets/storefront/src/components/ui/collapsible.tsx +9 -21
- package/dist/assets/storefront/src/components/ui/command.tsx +114 -159
- package/dist/assets/storefront/src/components/ui/context-menu.tsx +167 -199
- package/dist/assets/storefront/src/components/ui/dialog.tsx +97 -114
- package/dist/assets/storefront/src/components/ui/drawer.tsx +93 -107
- package/dist/assets/storefront/src/components/ui/dropdown-menu.tsx +171 -206
- package/dist/assets/storefront/src/components/ui/empty-state.tsx +5 -5
- package/dist/assets/storefront/src/components/ui/field.tsx +196 -208
- package/dist/assets/storefront/src/components/ui/form.tsx +115 -139
- package/dist/assets/storefront/src/components/ui/hover-card.tsx +27 -33
- package/dist/assets/storefront/src/components/ui/input-otp.tsx +50 -59
- package/dist/assets/storefront/src/components/ui/input.tsx +17 -17
- package/dist/assets/storefront/src/components/ui/kbd-shortcut.tsx +3 -1
- package/dist/assets/storefront/src/components/ui/label.tsx +16 -19
- package/dist/assets/storefront/src/components/ui/menubar.tsx +193 -223
- package/dist/assets/storefront/src/components/ui/navigation-menu.tsx +123 -130
- package/dist/assets/storefront/src/components/ui/pagination.tsx +87 -108
- package/dist/assets/storefront/src/components/ui/popover.tsx +29 -35
- package/dist/assets/storefront/src/components/ui/progress.tsx +19 -26
- package/dist/assets/storefront/src/components/ui/radio-group.tsx +32 -38
- package/dist/assets/storefront/src/components/ui/resizable.tsx +37 -42
- package/dist/assets/storefront/src/components/ui/scroll-area.tsx +41 -47
- package/dist/assets/storefront/src/components/ui/select.tsx +130 -152
- package/dist/assets/storefront/src/components/ui/separator.tsx +21 -21
- package/dist/assets/storefront/src/components/ui/sheet.tsx +90 -111
- package/dist/assets/storefront/src/components/ui/sidebar.tsx +611 -649
- package/dist/assets/storefront/src/components/ui/skeleton.tsx +10 -10
- package/dist/assets/storefront/src/components/ui/slider.tsx +50 -55
- package/dist/assets/storefront/src/components/ui/sonner.tsx +20 -20
- package/dist/assets/storefront/src/components/ui/switch.tsx +23 -26
- package/dist/assets/storefront/src/components/ui/table.tsx +65 -97
- package/dist/assets/storefront/src/components/ui/tabs.tsx +39 -55
- package/dist/assets/storefront/src/components/ui/textarea.tsx +14 -14
- package/dist/assets/storefront/src/components/ui/toggle-group.tsx +56 -62
- package/dist/assets/storefront/src/components/ui/toggle.tsx +37 -38
- package/dist/assets/storefront/src/components/ui/tooltip.tsx +38 -46
- package/dist/assets/storefront/src/config/scenario-meta.ts +2 -2
- package/dist/assets/storefront/src/config/scenario.ts +14 -16
- package/dist/assets/storefront/src/contexts/auth-context.tsx +5 -6
- package/dist/assets/storefront/src/graphql.ts +5 -5
- package/dist/assets/storefront/src/hooks/use-mobile.ts +13 -13
- package/dist/assets/storefront/src/i18n/locale-utils.ts +3 -3
- package/dist/assets/storefront/src/i18n/navigation.ts +4 -4
- package/dist/assets/storefront/src/i18n/request.ts +4 -4
- package/dist/assets/storefront/src/i18n/routing.ts +5 -5
- package/dist/assets/storefront/src/i18n/server.ts +3 -3
- package/dist/assets/storefront/src/lib/actions/switch-channel.ts +9 -9
- package/dist/assets/storefront/src/lib/actions/switch-currency.ts +7 -7
- package/dist/assets/storefront/src/lib/auth.ts +1 -1
- package/dist/assets/storefront/src/lib/backend-health.ts +3 -3
- package/dist/assets/storefront/src/lib/cart-count-context.tsx +10 -4
- package/dist/assets/storefront/src/lib/cart-guard-utils.ts +2 -1
- package/dist/assets/storefront/src/lib/cart-guard.ts +7 -6
- package/dist/assets/storefront/src/lib/channel-server.ts +4 -4
- package/dist/assets/storefront/src/lib/company-context.ts +1 -1
- package/dist/assets/storefront/src/lib/company-permissions-context.tsx +1 -5
- package/dist/assets/storefront/src/lib/currency-server.ts +4 -4
- package/dist/assets/storefront/src/lib/format.ts +16 -7
- package/dist/assets/storefront/src/lib/metadata.ts +39 -44
- package/dist/assets/storefront/src/lib/quantity.ts +2 -4
- package/dist/assets/storefront/src/lib/search-bar-context.tsx +7 -4
- package/dist/assets/storefront/src/lib/use-recent-searches.ts +8 -6
- package/dist/assets/storefront/src/lib/utils.ts +3 -3
- package/dist/assets/storefront/src/lib/vendure/actions.ts +18 -16
- package/dist/assets/storefront/src/lib/vendure/api.ts +36 -23
- package/dist/assets/storefront/src/lib/vendure/approval-utils.ts +9 -8
- package/dist/assets/storefront/src/lib/vendure/cached.ts +20 -15
- package/dist/assets/storefront/src/lib/vendure/queries.ts +15 -5
- package/dist/assets/storefront/src/middleware.ts +1 -1
- package/dist/assets/storefront/src/scenarios/customer/hero.tsx +2 -2
- package/dist/assets/storefront/src/scenarios/customer/meta.ts +1 -1
- package/dist/bin/run.js +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/scaffold-storefront-only.js +1 -1
- package/dist/scaffolder.js +1 -1
- package/dist/template-renderer.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -19,18 +19,18 @@ npx @vendure-platform/create my-project \
|
|
|
19
19
|
|
|
20
20
|
## CLI Flags
|
|
21
21
|
|
|
22
|
-
| Flag
|
|
23
|
-
|
|
24
|
-
| `--plugins <list>`
|
|
25
|
-
| `--company <name>`
|
|
26
|
-
| `--registry-token <token>` | Vendure private-registry npm auth token (baked into `.npmrc`)
|
|
27
|
-
| `--license-token <token>`
|
|
28
|
-
| `--no-storefront`
|
|
29
|
-
| `--github`
|
|
30
|
-
| `--github-org <org>`
|
|
31
|
-
| `--no-install`
|
|
32
|
-
| `--no-git`
|
|
33
|
-
| `--dry-run`
|
|
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 |
|
|
34
34
|
|
|
35
35
|
When `--plugins` and `--company` are both provided, the CLI runs in non-interactive mode.
|
|
36
36
|
|
|
@@ -38,8 +38,8 @@ When `--plugins` and `--company` are both provided, the CLI runs in non-interact
|
|
|
38
38
|
|
|
39
39
|
The Vendure Enterprise Portal issues **two distinct tokens** with different purposes - keep them straight:
|
|
40
40
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
41
|
+
- **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`.
|
|
43
43
|
|
|
44
44
|
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
45
|
|
|
@@ -47,31 +47,31 @@ They are not interchangeable. Pass each via its dedicated flag (`--registry-toke
|
|
|
47
47
|
|
|
48
48
|
Plugins fall into three tiers (mirroring `@vendure-platform/plugin-meta`):
|
|
49
49
|
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
| Key
|
|
55
|
-
|
|
56
|
-
| `license-guard`
|
|
57
|
-
| `org-hierarchy`
|
|
58
|
-
| `advanced-search`
|
|
59
|
-
| `workflow-engine`
|
|
60
|
-
| `approval-workflows`
|
|
61
|
-
| `global-search`
|
|
62
|
-
| `entity-access-control` | Entity Access Control
|
|
63
|
-
| `tax-id-management`
|
|
64
|
-
| `shopping-list`
|
|
65
|
-
| `quick-order`
|
|
66
|
-
| `reorder-from-history`
|
|
67
|
-
| `store-credit`
|
|
68
|
-
| `quote-management`
|
|
69
|
-
| `price-rules`
|
|
70
|
-
| `packaging-units`
|
|
71
|
-
| `content-versioning`
|
|
72
|
-
| `configurator`
|
|
73
|
-
| `sso`
|
|
74
|
-
| `audit-trail`
|
|
50
|
+
- **Core**: always active, can't be disabled. Hidden from the interactive prompt.
|
|
51
|
+
- **Optional**: active by default. Pre-ticked in the prompt; deselect to emit `<key>: false` in the generated `vendure-config.ts`.
|
|
52
|
+
- **Requires config**: inactive by default. Pick from the prompt to enable; the generated config carries the env-var-driven options block.
|
|
53
|
+
|
|
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 |
|
|
75
75
|
|
|
76
76
|
The canonical list lives in `libs/plugin-meta/src/index.ts`; this table mirrors it.
|
|
77
77
|
|
package/dist/add-to-existing.js
CHANGED
|
@@ -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("fs-extra")),o=n(require("path")),i=n(require("@clack/prompts")),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 i=o.join(e,"package.json");if(!await r.pathExists(i))throw new Error(`No package.json found at ${i}. Run this from your Vendure project root.`);const a=await r.readJson(i),s="@vendure/core"in{...null!==(t=a.dependencies)&&void 0!==t?t:{},...null!==(n=a.devDependencies)&&void 0!==n?n:{}},l=[o.join(e,"src","vendure-config.ts"),o.join(e,"server","src","vendure-config.ts"),o.join(e,"src","vendure-config.js")];let u=null;for(const e of l)if(await r.pathExists(e)){u=e;break}return{projectDir:e,packageJsonPath:i,vendureConfigPath:u,hasVendureCore:s,envPath:o.join(e,".env"),npmrcPath:o.join(e,".npmrc"),gitignorePath:o.join(e,".gitignore")}}async function c(e,t){const{selectedPlugins:n,dryRun:i,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,i);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,i);_>0&&k.push(`Appended ${_} env var(s) to .env \u2014 fill in real values before booting.`),p&&await g(e.envPath,p,i)&&k.push("Filled in the empty VENDURE_PLATFORM_LICENSE_TOKEN value in .env.");const A=await h(e.npmrcPath,s,i);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",i)&&k.push("Added .npmrc to .gitignore so any future registry token never gets committed.");const N=y(w,c),O=o.join(e.projectDir,u);return i||await r.writeFile(O,N),k.push(`Wrote ${o.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,o){var i;const a=await r.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&&!o&&await r.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 r.pathExists(e))return!1;const o=(await r.readFile(e,"utf8")).split("\n");let i=!1;const a="VENDURE_PLATFORM_LICENSE_TOKEN";for(let e=0;e<o.length;e++){const n=o[e].trim();if(!n.startsWith("#")&&n===`${a}=`){o[e]=`${a}=${t}`,i=!0;break}}return i&&!n&&await r.writeFile(e,o.join("\n")),i}async function m(e,t,n){let o="";await r.pathExists(e)&&(o=await r.readFile(e,"utf8"));const i=new Set(o.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=o.endsWith("\n")||""===o?"":"\n";await r.writeFile(e,o+t+"\n# Added by @vendure-platform/create add\n"+s)}return a.length}async function h(e,t,n){const o=`@vendure-platform:registry=${(0,s.getRegistryUrl)()}`,i=`//${(0,s.getRegistryHostname)()}/:_authToken=`;let a="";await r.pathExists(e)&&(a=await r.readFile(e,"utf8"));const l=a.includes("@vendure-platform:registry="),u=a.includes(i),p=[];if(l||p.push(o),t&&!u&&p.push(`${i}${t}`),0===p.length)return{scopeAdded:!1,authAdded:!1};const c=""===a||a.endsWith("\n")?"":"\n";return n||await r.writeFile(e,a+c+p.join("\n")+"\n"),{scopeAdded:!l,authAdded:Boolean(t)&&!u}}async function v(e,t,n){let o="";await r.pathExists(e)&&(o=await r.readFile(e,"utf8"));const i=o.split("\n").map(e=>e.trim());if(i.includes(t)||i.includes(`/${t}`))return!1;const a=""===o||o.endsWith("\n")?"":"\n";return n||await r.writeFile(e,o+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(),r=await p(n);let s;if(r.hasVendureCore||i.log.warn("No @vendure/core dependency found in package.json. Continuing anyway \u2014 make sure this is the right directory."),r.vendureConfigPath?i.log.info(`Detected vendure-config.ts at ${o.relative(n,r.vendureConfigPath)}`):i.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)&&i.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 i.multiselect({message:"Optional plugins to include (core plugins are always installed):",options:e,initialValues:t,required:!1});"symbol"==typeof n&&(i.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 r=await i.password({message:t});"symbol"==typeof r&&(i.cancel("Cancelled."),process.exit(0));const o=r.trim();return""===o?void 0:o}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&&i.log.info(`Always-on core plugins: ${n.join(", ")}`);const r=P(await c(t,e));i.note(r,e.dryRun?"Dry run \u2014 would do:":"Next steps"),i.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=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:[""]}
|