@salifbiaye/create-boutique 0.1.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/README.md +1 -0
- package/cli/dist/commands.js +382 -0
- package/cli/dist/create.js +194 -0
- package/cli/dist/docker.js +19 -0
- package/cli/dist/generate.js +322 -0
- package/cli/dist/guide.js +72 -0
- package/cli/dist/index.js +156 -0
- package/cli/dist/paths.js +29 -0
- package/cli/dist/ports.js +54 -0
- package/cli/dist/project.js +119 -0
- package/cli/dist/themes.js +24 -0
- package/docs/fiche-client.en.html +137 -0
- package/docs/fiche-client.html +137 -0
- package/docs/guide-complet.en.html +259 -0
- package/docs/guide-complet.fr.html +259 -0
- package/package.json +51 -0
- package/templates/backend/.dockerignore +9 -0
- package/templates/backend/Dockerfile +30 -0
- package/templates/backend/README.md +78 -0
- package/templates/backend/TEMPLATE_VERSION +1 -0
- package/templates/backend/docker/entrypoint.sh +28 -0
- package/templates/backend/instrumentation.ts +24 -0
- package/templates/backend/medusa-config.ts +114 -0
- package/templates/backend/package-lock.json +16222 -0
- package/templates/backend/package.json +39 -0
- package/templates/backend/src/admin/README.md +33 -0
- package/templates/backend/src/admin/components/image-field.tsx +61 -0
- package/templates/backend/src/admin/i18n/README.md +58 -0
- package/templates/backend/src/admin/i18n/index.ts +8 -0
- package/templates/backend/src/admin/i18n/json/en.json +66 -0
- package/templates/backend/src/admin/i18n/json/fr.json +66 -0
- package/templates/backend/src/admin/lib/client.ts +9 -0
- package/templates/backend/src/admin/routes/boutique-campaigns/campaign-drawer.tsx +286 -0
- package/templates/backend/src/admin/routes/boutique-campaigns/page.tsx +113 -0
- package/templates/backend/src/admin/tsconfig.json +24 -0
- package/templates/backend/src/admin/vite-env.d.ts +1 -0
- package/templates/backend/src/admin/widgets/category-image.tsx +56 -0
- package/templates/backend/src/api/README.md +135 -0
- package/templates/backend/src/api/admin/boutique-campaigns/[salesChannelId]/route.ts +30 -0
- package/templates/backend/src/api/admin/boutique-campaigns/route.ts +24 -0
- package/templates/backend/src/api/middlewares.ts +28 -0
- package/templates/backend/src/api/rate-limit.ts +30 -0
- package/templates/backend/src/api/route.ts +6 -0
- package/templates/backend/src/api/store/campaign/route.ts +25 -0
- package/templates/backend/src/api/store/order-lookup/route.ts +74 -0
- package/templates/backend/src/emails/en.json +64 -0
- package/templates/backend/src/emails/fr.json +64 -0
- package/templates/backend/src/jobs/README.md +38 -0
- package/templates/backend/src/lib/emails.ts +94 -0
- package/templates/backend/src/lib/notify.ts +148 -0
- package/templates/backend/src/lib/project.ts +146 -0
- package/templates/backend/src/links/README.md +26 -0
- package/templates/backend/src/links/campaign-sales-channel.ts +9 -0
- package/templates/backend/src/modules/README.md +117 -0
- package/templates/backend/src/modules/campaign/index.ts +9 -0
- package/templates/backend/src/modules/campaign/migrations/.snapshot-boutique-campaign.json +272 -0
- package/templates/backend/src/modules/campaign/migrations/Migration20260928141440.ts +16 -0
- package/templates/backend/src/modules/campaign/migrations/Migration20260928145243.ts +13 -0
- package/templates/backend/src/modules/campaign/models/campaign.ts +28 -0
- package/templates/backend/src/modules/campaign/service.ts +6 -0
- package/templates/backend/src/modules/campaign/validators.ts +94 -0
- package/templates/backend/src/modules/resend/index.ts +6 -0
- package/templates/backend/src/modules/resend/service.ts +63 -0
- package/templates/backend/src/scripts/README.md +63 -0
- package/templates/backend/src/scripts/campaign-export.ts +15 -0
- package/templates/backend/src/scripts/campaign-import.ts +38 -0
- package/templates/backend/src/scripts/price-report.ts +34 -0
- package/templates/backend/src/scripts/seed.ts +418 -0
- package/templates/backend/src/scripts/storage.ts +63 -0
- package/templates/backend/src/subscribers/README.md +61 -0
- package/templates/backend/src/subscribers/account-emails.ts +27 -0
- package/templates/backend/src/subscribers/fulfillment-emails.ts +42 -0
- package/templates/backend/src/subscribers/order-emails.ts +12 -0
- package/templates/backend/src/subscribers/return-refund-emails.ts +50 -0
- package/templates/backend/src/workflows/README.md +81 -0
- package/templates/backend/src/workflows/steps/upsert-campaign.ts +53 -0
- package/templates/backend/src/workflows/upsert-campaign.ts +30 -0
- package/templates/backend/tsconfig.json +36 -0
- package/templates/storefront/.dockerignore +7 -0
- package/templates/storefront/.github/ISSUE_TEMPLATE/bug-report.yml +71 -0
- package/templates/storefront/.prettierrc +8 -0
- package/templates/storefront/Dockerfile +37 -0
- package/templates/storefront/LICENSE +21 -0
- package/templates/storefront/README.md +127 -0
- package/templates/storefront/locales/en.json +269 -0
- package/templates/storefront/locales/fr.json +269 -0
- package/templates/storefront/next-env.d.ts +7 -0
- package/templates/storefront/next-sitemap.js +19 -0
- package/templates/storefront/next.config.js +29 -0
- package/templates/storefront/package-lock.json +9031 -0
- package/templates/storefront/package.json +49 -0
- package/templates/storefront/postcss.config.js +6 -0
- package/templates/storefront/public/favicon.ico +0 -0
- package/templates/storefront/scripts/sync-design.mjs +30 -0
- package/templates/storefront/src/app/(checkout)/checkout/page.tsx +31 -0
- package/templates/storefront/src/app/(checkout)/layout.tsx +29 -0
- package/templates/storefront/src/app/(checkout)/not-found.tsx +20 -0
- package/templates/storefront/src/app/(main)/account/@dashboard/addresses/page.tsx +34 -0
- package/templates/storefront/src/app/(main)/account/@dashboard/loading.tsx +9 -0
- package/templates/storefront/src/app/(main)/account/@dashboard/orders/details/[id]/page.tsx +33 -0
- package/templates/storefront/src/app/(main)/account/@dashboard/orders/page.tsx +37 -0
- package/templates/storefront/src/app/(main)/account/@dashboard/page.tsx +22 -0
- package/templates/storefront/src/app/(main)/account/@dashboard/profile/page.tsx +53 -0
- package/templates/storefront/src/app/(main)/account/@login/page.tsx +12 -0
- package/templates/storefront/src/app/(main)/account/layout.tsx +20 -0
- package/templates/storefront/src/app/(main)/account/loading.tsx +9 -0
- package/templates/storefront/src/app/(main)/cart/loading.tsx +5 -0
- package/templates/storefront/src/app/(main)/cart/not-found.tsx +21 -0
- package/templates/storefront/src/app/(main)/cart/page.tsx +21 -0
- package/templates/storefront/src/app/(main)/categories/[...category]/page.tsx +55 -0
- package/templates/storefront/src/app/(main)/collections/[handle]/page.tsx +55 -0
- package/templates/storefront/src/app/(main)/layout.tsx +43 -0
- package/templates/storefront/src/app/(main)/legal/[page]/page.tsx +42 -0
- package/templates/storefront/src/app/(main)/not-found.tsx +21 -0
- package/templates/storefront/src/app/(main)/order/[id]/confirmed/loading.tsx +5 -0
- package/templates/storefront/src/app/(main)/order/[id]/confirmed/page.tsx +23 -0
- package/templates/storefront/src/app/(main)/order/[id]/transfer/[token]/accept/page.tsx +42 -0
- package/templates/storefront/src/app/(main)/order/[id]/transfer/[token]/decline/page.tsx +42 -0
- package/templates/storefront/src/app/(main)/order/[id]/transfer/[token]/page.tsx +35 -0
- package/templates/storefront/src/app/(main)/order/track/page.tsx +32 -0
- package/templates/storefront/src/app/(main)/page.tsx +68 -0
- package/templates/storefront/src/app/(main)/products/[handle]/page.tsx +86 -0
- package/templates/storefront/src/app/(main)/store/page.tsx +28 -0
- package/templates/storefront/src/app/api/health/route.ts +13 -0
- package/templates/storefront/src/app/layout.tsx +42 -0
- package/templates/storefront/src/app/not-found.tsx +21 -0
- package/templates/storefront/src/app/opengraph-image.jpg +0 -0
- package/templates/storefront/src/app/twitter-image.jpg +0 -0
- package/templates/storefront/src/instrumentation-node.ts +18 -0
- package/templates/storefront/src/instrumentation.ts +9 -0
- package/templates/storefront/src/lib/boutique/campaign.ts +116 -0
- package/templates/storefront/src/lib/boutique/config.ts +152 -0
- package/templates/storefront/src/lib/boutique/fonts.ts +29 -0
- package/templates/storefront/src/lib/boutique/i18n-client.tsx +34 -0
- package/templates/storefront/src/lib/boutique/i18n.ts +43 -0
- package/templates/storefront/src/lib/boutique/schema.ts +131 -0
- package/templates/storefront/src/lib/config.ts +39 -0
- package/templates/storefront/src/lib/constants.tsx +75 -0
- package/templates/storefront/src/lib/context/modal-context.tsx +34 -0
- package/templates/storefront/src/lib/data/cart.ts +434 -0
- package/templates/storefront/src/lib/data/categories.ts +49 -0
- package/templates/storefront/src/lib/data/collections.ts +59 -0
- package/templates/storefront/src/lib/data/cookies.ts +103 -0
- package/templates/storefront/src/lib/data/customer.ts +261 -0
- package/templates/storefront/src/lib/data/fulfillment.ts +68 -0
- package/templates/storefront/src/lib/data/onboarding.ts +9 -0
- package/templates/storefront/src/lib/data/order-lookup.ts +34 -0
- package/templates/storefront/src/lib/data/orders.ts +112 -0
- package/templates/storefront/src/lib/data/payment.ts +35 -0
- package/templates/storefront/src/lib/data/products.ts +127 -0
- package/templates/storefront/src/lib/data/regions.ts +70 -0
- package/templates/storefront/src/lib/data/variants.ts +38 -0
- package/templates/storefront/src/lib/hooks/use-in-view.tsx +29 -0
- package/templates/storefront/src/lib/hooks/use-toggle-state.tsx +46 -0
- package/templates/storefront/src/lib/util/compare-addresses.ts +28 -0
- package/templates/storefront/src/lib/util/get-percentage-diff.ts +6 -0
- package/templates/storefront/src/lib/util/get-product-price.ts +79 -0
- package/templates/storefront/src/lib/util/isEmpty.ts +11 -0
- package/templates/storefront/src/lib/util/medusa-error.ts +22 -0
- package/templates/storefront/src/lib/util/money.ts +35 -0
- package/templates/storefront/src/lib/util/product.ts +5 -0
- package/templates/storefront/src/lib/util/repeat.ts +5 -0
- package/templates/storefront/src/lib/util/sort-products.ts +50 -0
- package/templates/storefront/src/modules/account/components/account-info/index.tsx +140 -0
- package/templates/storefront/src/modules/account/components/account-nav/index.tsx +198 -0
- package/templates/storefront/src/modules/account/components/address-book/index.tsx +28 -0
- package/templates/storefront/src/modules/account/components/address-card/add-address.tsx +169 -0
- package/templates/storefront/src/modules/account/components/address-card/edit-address-modal.tsx +241 -0
- package/templates/storefront/src/modules/account/components/login/index.tsx +65 -0
- package/templates/storefront/src/modules/account/components/order-card/index.tsx +88 -0
- package/templates/storefront/src/modules/account/components/order-overview/index.tsx +47 -0
- package/templates/storefront/src/modules/account/components/overview/index.tsx +169 -0
- package/templates/storefront/src/modules/account/components/profile-billing-address/index.tsx +193 -0
- package/templates/storefront/src/modules/account/components/profile-email/index.tsx +75 -0
- package/templates/storefront/src/modules/account/components/profile-name/index.tsx +79 -0
- package/templates/storefront/src/modules/account/components/profile-password/index.tsx +72 -0
- package/templates/storefront/src/modules/account/components/profile-phone/index.tsx +74 -0
- package/templates/storefront/src/modules/account/components/register/index.tsx +107 -0
- package/templates/storefront/src/modules/account/components/transfer-request-form/index.tsx +83 -0
- package/templates/storefront/src/modules/account/templates/account-layout.tsx +43 -0
- package/templates/storefront/src/modules/account/templates/login-template.tsx +27 -0
- package/templates/storefront/src/modules/cart/components/cart-item-select/index.tsx +75 -0
- package/templates/storefront/src/modules/cart/components/empty-cart-message/index.tsx +25 -0
- package/templates/storefront/src/modules/cart/components/item/index.tsx +144 -0
- package/templates/storefront/src/modules/cart/components/sign-in-prompt/index.tsx +27 -0
- package/templates/storefront/src/modules/cart/templates/index.tsx +51 -0
- package/templates/storefront/src/modules/cart/templates/items.tsx +58 -0
- package/templates/storefront/src/modules/cart/templates/preview.tsx +51 -0
- package/templates/storefront/src/modules/cart/templates/summary.tsx +50 -0
- package/templates/storefront/src/modules/categories/templates/index.tsx +94 -0
- package/templates/storefront/src/modules/checkout/components/address-select/index.tsx +117 -0
- package/templates/storefront/src/modules/checkout/components/addresses/index.tsx +186 -0
- package/templates/storefront/src/modules/checkout/components/billing_address/index.tsx +114 -0
- package/templates/storefront/src/modules/checkout/components/country-select/index.tsx +50 -0
- package/templates/storefront/src/modules/checkout/components/discount-code/index.tsx +181 -0
- package/templates/storefront/src/modules/checkout/components/error-message/index.tsx +13 -0
- package/templates/storefront/src/modules/checkout/components/payment/index.tsx +261 -0
- package/templates/storefront/src/modules/checkout/components/payment-button/index.tsx +195 -0
- package/templates/storefront/src/modules/checkout/components/payment-container/index.tsx +130 -0
- package/templates/storefront/src/modules/checkout/components/payment-test/index.tsx +12 -0
- package/templates/storefront/src/modules/checkout/components/payment-wrapper/index.tsx +42 -0
- package/templates/storefront/src/modules/checkout/components/payment-wrapper/stripe-wrapper.tsx +54 -0
- package/templates/storefront/src/modules/checkout/components/review/index.tsx +54 -0
- package/templates/storefront/src/modules/checkout/components/shipping/index.tsx +417 -0
- package/templates/storefront/src/modules/checkout/components/shipping-address/index.tsx +219 -0
- package/templates/storefront/src/modules/checkout/components/submit-button/index.tsx +32 -0
- package/templates/storefront/src/modules/checkout/templates/checkout-form/index.tsx +38 -0
- package/templates/storefront/src/modules/checkout/templates/checkout-summary/index.tsx +31 -0
- package/templates/storefront/src/modules/collections/templates/index.tsx +44 -0
- package/templates/storefront/src/modules/common/components/cart-totals/index.tsx +84 -0
- package/templates/storefront/src/modules/common/components/checkbox/index.tsx +44 -0
- package/templates/storefront/src/modules/common/components/delete-button/index.tsx +42 -0
- package/templates/storefront/src/modules/common/components/divider/index.tsx +9 -0
- package/templates/storefront/src/modules/common/components/filter-radio-group/index.tsx +61 -0
- package/templates/storefront/src/modules/common/components/input/index.tsx +79 -0
- package/templates/storefront/src/modules/common/components/interactive-link/index.tsx +33 -0
- package/templates/storefront/src/modules/common/components/line-item-options/index.tsx +26 -0
- package/templates/storefront/src/modules/common/components/line-item-price/index.tsx +63 -0
- package/templates/storefront/src/modules/common/components/line-item-unit-price/index.tsx +62 -0
- package/templates/storefront/src/modules/common/components/localized-client-link/index.tsx +29 -0
- package/templates/storefront/src/modules/common/components/modal/index.tsx +118 -0
- package/templates/storefront/src/modules/common/components/native-select/index.tsx +76 -0
- package/templates/storefront/src/modules/common/components/radio/index.tsx +27 -0
- package/templates/storefront/src/modules/common/icons/back.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/bancontact.tsx +26 -0
- package/templates/storefront/src/modules/common/icons/chevron-down.tsx +30 -0
- package/templates/storefront/src/modules/common/icons/eye-off.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/eye.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/fast-delivery.tsx +65 -0
- package/templates/storefront/src/modules/common/icons/ideal.tsx +26 -0
- package/templates/storefront/src/modules/common/icons/map-pin.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/package.tsx +44 -0
- package/templates/storefront/src/modules/common/icons/paypal.tsx +30 -0
- package/templates/storefront/src/modules/common/icons/placeholder-image.tsx +44 -0
- package/templates/storefront/src/modules/common/icons/refresh.tsx +51 -0
- package/templates/storefront/src/modules/common/icons/spinner.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/trash.tsx +51 -0
- package/templates/storefront/src/modules/common/icons/user.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/x.tsx +37 -0
- package/templates/storefront/src/modules/layout/components/cart-mismatch-banner/index.tsx +59 -0
- package/templates/storefront/src/modules/order/components/help/index.tsx +26 -0
- package/templates/storefront/src/modules/order/components/item/index.tsx +57 -0
- package/templates/storefront/src/modules/order/components/items/index.tsx +44 -0
- package/templates/storefront/src/modules/order/components/onboarding-cta/index.tsx +28 -0
- package/templates/storefront/src/modules/order/components/order-details/index.tsx +64 -0
- package/templates/storefront/src/modules/order/components/order-summary/index.tsx +61 -0
- package/templates/storefront/src/modules/order/components/payment-details/index.tsx +64 -0
- package/templates/storefront/src/modules/order/components/shipping-details/index.tsx +74 -0
- package/templates/storefront/src/modules/order/components/transfer-actions/index.tsx +83 -0
- package/templates/storefront/src/modules/order/components/transfer-image/index.tsx +275 -0
- package/templates/storefront/src/modules/order/templates/order-completed-template.tsx +53 -0
- package/templates/storefront/src/modules/order/templates/order-details-template.tsx +46 -0
- package/templates/storefront/src/modules/products/components/thumbnail/index.tsx +70 -0
- package/templates/storefront/src/modules/products/templates/index.tsx +118 -0
- package/templates/storefront/src/modules/shipping/components/free-shipping-price-nudge/index.tsx +285 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-button/index.tsx +5 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-card-details/index.tsx +10 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-cart-item/index.tsx +35 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-cart-totals/index.tsx +30 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-code-form/index.tsx +13 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-line-item/index.tsx +35 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-confirmed-header/index.tsx +14 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-information/index.tsx +36 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-items/index.tsx +43 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-summary/index.tsx +15 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-product-preview/index.tsx +15 -0
- package/templates/storefront/src/modules/skeletons/templates/skeleton-cart-page/index.tsx +65 -0
- package/templates/storefront/src/modules/skeletons/templates/skeleton-order-confirmed/index.tsx +21 -0
- package/templates/storefront/src/modules/skeletons/templates/skeleton-product-grid/index.tsx +23 -0
- package/templates/storefront/src/modules/store/components/pagination/index.tsx +114 -0
- package/templates/storefront/src/modules/store/components/refinement-list/index.tsx +41 -0
- package/templates/storefront/src/modules/store/components/refinement-list/sort-products/index.tsx +48 -0
- package/templates/storefront/src/modules/store/templates/index.tsx +42 -0
- package/templates/storefront/src/modules/store/templates/paginated-products.tsx +80 -0
- package/templates/storefront/src/modules/ub/button.tsx +41 -0
- package/templates/storefront/src/modules/ub/campaign-blocks.tsx +197 -0
- package/templates/storefront/src/modules/ub/campaign-ended.tsx +28 -0
- package/templates/storefront/src/modules/ub/category-tiles.tsx +41 -0
- package/templates/storefront/src/modules/ub/countdown.tsx +46 -0
- package/templates/storefront/src/modules/ub/footer.tsx +56 -0
- package/templates/storefront/src/modules/ub/icons.tsx +42 -0
- package/templates/storefront/src/modules/ub/nav.tsx +90 -0
- package/templates/storefront/src/modules/ub/pdp/buy-box.tsx +140 -0
- package/templates/storefront/src/modules/ub/pdp/gallery.tsx +40 -0
- package/templates/storefront/src/modules/ub/product-card.tsx +66 -0
- package/templates/storefront/src/modules/ub/top-bar.tsx +20 -0
- package/templates/storefront/src/modules/ub/track-form.tsx +92 -0
- package/templates/storefront/src/proxy.ts +89 -0
- package/templates/storefront/src/styles/globals.css +98 -0
- package/templates/storefront/src/styles/ub/bundle.css +372 -0
- package/templates/storefront/src/styles/ub/fonts.css +17 -0
- package/templates/storefront/src/styles/ub/medusa-ui.css +90 -0
- package/templates/storefront/src/styles/ub/overrides.css +12 -0
- package/templates/storefront/src/styles/ub/tokens.css +9 -0
- package/templates/storefront/src/types/global.ts +24 -0
- package/templates/storefront/src/types/icon.ts +4 -0
- package/templates/storefront/tailwind.config.js +164 -0
- package/templates/storefront/themes/black-friday/campaign.en.json +31 -0
- package/templates/storefront/themes/black-friday/campaign.fr.json +31 -0
- package/templates/storefront/themes/black-friday/theme.json +9 -0
- package/templates/storefront/themes/cyber-monday/campaign.en.json +31 -0
- package/templates/storefront/themes/cyber-monday/campaign.fr.json +31 -0
- package/templates/storefront/themes/cyber-monday/theme.json +9 -0
- package/templates/storefront/themes/halloween/campaign.en.json +31 -0
- package/templates/storefront/themes/halloween/campaign.fr.json +31 -0
- package/templates/storefront/themes/halloween/theme.json +9 -0
- package/templates/storefront/themes/noel/campaign.en.json +31 -0
- package/templates/storefront/themes/noel/campaign.fr.json +31 -0
- package/templates/storefront/themes/noel/theme.json +9 -0
- package/templates/storefront/themes/nouvel-an/campaign.en.json +31 -0
- package/templates/storefront/themes/nouvel-an/campaign.fr.json +31 -0
- package/templates/storefront/themes/nouvel-an/theme.json +9 -0
- package/templates/storefront/themes/thanksgiving/campaign.en.json +31 -0
- package/templates/storefront/themes/thanksgiving/campaign.fr.json +31 -0
- package/templates/storefront/themes/thanksgiving/theme.json +9 -0
- package/templates/storefront/tsconfig.json +53 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Custom Workflows
|
|
2
|
+
|
|
3
|
+
A workflow is a series of queries and actions that complete a task.
|
|
4
|
+
|
|
5
|
+
The workflow is created in a TypeScript or JavaScript file under the `src/workflows` directory.
|
|
6
|
+
|
|
7
|
+
> Learn more about workflows in [this documentation](https://docs.medusajs.com/learn/fundamentals/workflows).
|
|
8
|
+
|
|
9
|
+
For example:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {
|
|
13
|
+
createStep,
|
|
14
|
+
createWorkflow,
|
|
15
|
+
WorkflowResponse,
|
|
16
|
+
StepResponse,
|
|
17
|
+
} from "@medusajs/framework/workflows-sdk"
|
|
18
|
+
|
|
19
|
+
const step1 = createStep("step-1", async () => {
|
|
20
|
+
return new StepResponse(`Hello from step one!`)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
type WorkflowInput = {
|
|
24
|
+
name: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const step2 = createStep(
|
|
28
|
+
"step-2",
|
|
29
|
+
async ({ name }: WorkflowInput) => {
|
|
30
|
+
return new StepResponse(`Hello ${name} from step two!`)
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
type WorkflowOutput = {
|
|
35
|
+
message1: string
|
|
36
|
+
message2: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const helloWorldWorkflow = createWorkflow(
|
|
40
|
+
"hello-world",
|
|
41
|
+
(input: WorkflowInput) => {
|
|
42
|
+
const greeting1 = step1()
|
|
43
|
+
const greeting2 = step2(input)
|
|
44
|
+
|
|
45
|
+
return new WorkflowResponse({
|
|
46
|
+
message1: greeting1,
|
|
47
|
+
message2: greeting2
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
export default helloWorldWorkflow
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Execute Workflow
|
|
56
|
+
|
|
57
|
+
You can execute the workflow from other resources, such as API routes, scheduled jobs, or subscribers.
|
|
58
|
+
|
|
59
|
+
For example, to execute the workflow in an API route:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import type {
|
|
63
|
+
MedusaRequest,
|
|
64
|
+
MedusaResponse,
|
|
65
|
+
} from "@medusajs/framework"
|
|
66
|
+
import myWorkflow from "../../../workflows/hello-world"
|
|
67
|
+
|
|
68
|
+
export async function GET(
|
|
69
|
+
req: MedusaRequest,
|
|
70
|
+
res: MedusaResponse
|
|
71
|
+
) {
|
|
72
|
+
const { result } = await myWorkflow(req.scope)
|
|
73
|
+
.run({
|
|
74
|
+
input: {
|
|
75
|
+
name: req.query.name as string,
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
res.send(result)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ContainerRegistrationKeys, MedusaError, Modules } from "@medusajs/framework/utils"
|
|
2
|
+
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
|
|
3
|
+
import { CAMPAIGN_MODULE } from "../../modules/campaign"
|
|
4
|
+
import CampaignModuleService from "../../modules/campaign/service"
|
|
5
|
+
|
|
6
|
+
export type UpsertCampaignData = {
|
|
7
|
+
sales_channel_id: string
|
|
8
|
+
starts_at: Date
|
|
9
|
+
ends_at: Date
|
|
10
|
+
next_campaign: string | null
|
|
11
|
+
texts: Record<string, unknown> | null
|
|
12
|
+
vars: Record<string, unknown> | null
|
|
13
|
+
hero_image: string | null
|
|
14
|
+
logo: string | null
|
|
15
|
+
promo_image: string | null
|
|
16
|
+
show_countdown: boolean | null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type Compensation = { created?: string; previous?: UpsertCampaignData & { id: string } }
|
|
20
|
+
|
|
21
|
+
/** Crée ou met à jour la campagne d'un sales channel ; rollback : restaure l'état précédent. */
|
|
22
|
+
export const upsertCampaignStep = createStep(
|
|
23
|
+
"upsert-campaign",
|
|
24
|
+
async (input: UpsertCampaignData, { container }) => {
|
|
25
|
+
if (!(input.starts_at < input.ends_at)) {
|
|
26
|
+
throw new MedusaError(MedusaError.Types.INVALID_DATA, "La date de début doit précéder la date de fin")
|
|
27
|
+
}
|
|
28
|
+
const service: CampaignModuleService = container.resolve(CAMPAIGN_MODULE)
|
|
29
|
+
const [existing] = await service.listBoutiqueCampaigns({ sales_channel_id: input.sales_channel_id })
|
|
30
|
+
|
|
31
|
+
if (existing) {
|
|
32
|
+
const updated = await service.updateBoutiqueCampaigns({ id: existing.id, ...input })
|
|
33
|
+
return new StepResponse(updated, { previous: existing as unknown as Compensation["previous"] } as Compensation)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const created = await service.createBoutiqueCampaigns(input)
|
|
37
|
+
const link = container.resolve(ContainerRegistrationKeys.LINK)
|
|
38
|
+
await link.create({
|
|
39
|
+
[Modules.SALES_CHANNEL]: { sales_channel_id: input.sales_channel_id },
|
|
40
|
+
[CAMPAIGN_MODULE]: { boutique_campaign_id: created.id },
|
|
41
|
+
})
|
|
42
|
+
return new StepResponse(created, { created: created.id } as Compensation)
|
|
43
|
+
},
|
|
44
|
+
async (comp, { container }) => {
|
|
45
|
+
if (!comp) return
|
|
46
|
+
const service: CampaignModuleService = container.resolve(CAMPAIGN_MODULE)
|
|
47
|
+
if (comp.created) await service.deleteBoutiqueCampaigns(comp.created)
|
|
48
|
+
if (comp.previous) {
|
|
49
|
+
const { id, sales_channel_id, starts_at, ends_at, next_campaign, texts, vars, hero_image, logo, promo_image, show_countdown } = comp.previous
|
|
50
|
+
await service.updateBoutiqueCampaigns({ id, sales_channel_id, starts_at, ends_at, next_campaign, texts, vars, hero_image, logo, promo_image, show_countdown })
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createWorkflow, transform, WorkflowResponse } from "@medusajs/framework/workflows-sdk"
|
|
2
|
+
import type { CampaignInput } from "../modules/campaign/validators"
|
|
3
|
+
import { upsertCampaignStep } from "./steps/upsert-campaign"
|
|
4
|
+
|
|
5
|
+
type Input = { sales_channel_id: string; campaign: CampaignInput }
|
|
6
|
+
|
|
7
|
+
/** Enregistre la campagne d'une boutique (admin « Campagnes », seed, `campaign import`). */
|
|
8
|
+
export const upsertCampaignWorkflow = createWorkflow("upsert-campaign", function (input: Input) {
|
|
9
|
+
const data = transform({ input }, ({ input }) => {
|
|
10
|
+
const { startsAt, endsAt, nextCampaign, vars, heroImage, logo, promoImage, showCountdown, topbar, hero, promo, sections } = input.campaign
|
|
11
|
+
const texts = Object.fromEntries(
|
|
12
|
+
Object.entries({ topbar, hero, promo, sections }).filter(([, v]) => v !== undefined && JSON.stringify(v) !== "{}")
|
|
13
|
+
)
|
|
14
|
+
return {
|
|
15
|
+
sales_channel_id: input.sales_channel_id,
|
|
16
|
+
starts_at: new Date(startsAt),
|
|
17
|
+
ends_at: new Date(endsAt),
|
|
18
|
+
next_campaign: nextCampaign ?? null,
|
|
19
|
+
texts: Object.keys(texts).length ? texts : null,
|
|
20
|
+
vars: vars ?? null,
|
|
21
|
+
hero_image: heroImage ?? null,
|
|
22
|
+
logo: logo ?? null,
|
|
23
|
+
promo_image: promoImage ?? null,
|
|
24
|
+
show_countdown: showCountdown ?? null,
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const campaign = upsertCampaignStep(data)
|
|
29
|
+
return new WorkflowResponse(campaign)
|
|
30
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2021",
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"module": "Node16",
|
|
6
|
+
"moduleResolution": "Node16",
|
|
7
|
+
"emitDecoratorMetadata": true,
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"skipDefaultLibCheck": true,
|
|
11
|
+
"declaration": false,
|
|
12
|
+
"sourceMap": false,
|
|
13
|
+
"inlineSourceMap": true,
|
|
14
|
+
"outDir": "./.medusa/server",
|
|
15
|
+
"rootDir": "./",
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
"forceConsistentCasingInFileNames": true,
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"checkJs": false,
|
|
20
|
+
"strictNullChecks": true
|
|
21
|
+
},
|
|
22
|
+
"ts-node": {
|
|
23
|
+
"swc": true
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"**/*",
|
|
27
|
+
".medusa/types/*"
|
|
28
|
+
],
|
|
29
|
+
"exclude": [
|
|
30
|
+
"node_modules",
|
|
31
|
+
"src/admin",
|
|
32
|
+
".medusa/server",
|
|
33
|
+
".medusa/admin",
|
|
34
|
+
".cache"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Bug report for the Medusa Next.js Starter
|
|
2
|
+
description: File a bug report.
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: ["status: needs triaging", "bug"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: "## System information"
|
|
9
|
+
- type: markdown
|
|
10
|
+
attributes:
|
|
11
|
+
value: |
|
|
12
|
+
The system information will help us reproduce the issue in the same environment
|
|
13
|
+
- type: textarea
|
|
14
|
+
attributes:
|
|
15
|
+
label: Package.json file
|
|
16
|
+
description: Copy/paste the contents of the `package.json` file. No need to use backticks
|
|
17
|
+
placeholder: No need to use markdown backticks. Just copy/paste the contents of the file
|
|
18
|
+
render: JSON
|
|
19
|
+
validations:
|
|
20
|
+
required: true
|
|
21
|
+
- type: input
|
|
22
|
+
attributes:
|
|
23
|
+
label: Node.js version
|
|
24
|
+
description: Copy/paste the output of `node -v` command.
|
|
25
|
+
placeholder: v21.0.0
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
- type: input
|
|
29
|
+
attributes:
|
|
30
|
+
label: Operating system name and version
|
|
31
|
+
validations:
|
|
32
|
+
required: true
|
|
33
|
+
- type: input
|
|
34
|
+
attributes:
|
|
35
|
+
label: Browser name
|
|
36
|
+
- type: markdown
|
|
37
|
+
attributes:
|
|
38
|
+
value: "## Describe the issue"
|
|
39
|
+
- type: markdown
|
|
40
|
+
attributes:
|
|
41
|
+
value: |
|
|
42
|
+
Please explain your issue in-depth along with the relevant screenshots and code snippets
|
|
43
|
+
- type: textarea
|
|
44
|
+
attributes:
|
|
45
|
+
label: What happended?
|
|
46
|
+
placeholder: A clear and concise description of what the bug is
|
|
47
|
+
validations:
|
|
48
|
+
required: true
|
|
49
|
+
- type: textarea
|
|
50
|
+
attributes:
|
|
51
|
+
label: Expected behavior
|
|
52
|
+
validations:
|
|
53
|
+
required: true
|
|
54
|
+
- type: textarea
|
|
55
|
+
attributes:
|
|
56
|
+
label: Actual behavior
|
|
57
|
+
validations:
|
|
58
|
+
required: true
|
|
59
|
+
- type: markdown
|
|
60
|
+
attributes:
|
|
61
|
+
value: "## Reproduction"
|
|
62
|
+
- type: markdown
|
|
63
|
+
attributes:
|
|
64
|
+
value: |
|
|
65
|
+
Providing a reproduction repo allows us to quickly validate the issue and get back to you.
|
|
66
|
+
- type: input
|
|
67
|
+
attributes:
|
|
68
|
+
label: Link to reproduction repo
|
|
69
|
+
description: Please reproduce the issue in isolation and share it as a Github repo with us
|
|
70
|
+
validations:
|
|
71
|
+
required: true
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Storefront Usine à Boutiques : une image par projet, une instance par boutique.
|
|
2
|
+
# Chaque container reçoit BOUTIQUE=<slug> et monte config/ (lecture seule) + keys/.
|
|
3
|
+
# Rien de propre à une boutique n'est figé au build.
|
|
4
|
+
|
|
5
|
+
FROM node:24-alpine AS deps
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
COPY package.json package-lock.json .npmrc ./
|
|
8
|
+
RUN npm ci --no-audit --no-fund
|
|
9
|
+
|
|
10
|
+
FROM node:24-alpine AS build
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
ENV NEXT_TELEMETRY_DISABLED=1
|
|
13
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
14
|
+
COPY . .
|
|
15
|
+
RUN npm run build
|
|
16
|
+
|
|
17
|
+
FROM node:24-alpine AS run
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
ENV NODE_ENV=production \
|
|
20
|
+
NEXT_TELEMETRY_DISABLED=1 \
|
|
21
|
+
PORT=8000 \
|
|
22
|
+
HOSTNAME=0.0.0.0 \
|
|
23
|
+
CONFIG_DIR=/app/config \
|
|
24
|
+
KEYS_DIR=/app/keys
|
|
25
|
+
|
|
26
|
+
RUN addgroup -S app && adduser -S app -G app
|
|
27
|
+
COPY --from=build --chown=app:app /app/.next/standalone ./
|
|
28
|
+
COPY --from=build --chown=app:app /app/.next/static ./.next/static
|
|
29
|
+
COPY --from=build --chown=app:app /app/public ./public
|
|
30
|
+
COPY --from=build --chown=app:app /app/themes ./themes
|
|
31
|
+
COPY --from=build --chown=app:app /app/locales ./locales
|
|
32
|
+
|
|
33
|
+
USER app
|
|
34
|
+
EXPOSE 8000
|
|
35
|
+
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s --retries=5 \
|
|
36
|
+
CMD wget -qO- http://127.0.0.1:8000/api/health || exit 1
|
|
37
|
+
CMD ["node", "server.js"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Medusa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
> ⚠️ This repository is now deprecated. Use the [dtc-starter](https://github.com/medusajs/dtc-starter) instead.
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.medusajs.com">
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/59018053/229103275-b5e482bb-4601-46e6-8142-244f531cebdb.svg">
|
|
7
|
+
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
|
|
8
|
+
<img alt="Medusa logo" src="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
|
|
9
|
+
</picture>
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<h1 align="center">
|
|
14
|
+
Medusa Next.js Starter Template
|
|
15
|
+
</h1>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
Combine Medusa's modules for your commerce backend with the newest Next.js 15 features for a performant storefront.</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://github.com/medusajs/medusa/blob/master/CONTRIBUTING.md">
|
|
22
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://discord.gg/xpCwq3Kfn8">
|
|
25
|
+
<img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
|
|
26
|
+
</a>
|
|
27
|
+
<a href="https://twitter.com/intent/follow?screen_name=medusajs">
|
|
28
|
+
<img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" />
|
|
29
|
+
</a>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
### Prerequisites
|
|
33
|
+
|
|
34
|
+
To use the [Next.js Starter Template](https://medusajs.com/nextjs-commerce/), you should have a Medusa server running locally on port 9000.
|
|
35
|
+
For a quick setup, run:
|
|
36
|
+
|
|
37
|
+
```shell
|
|
38
|
+
npx create-medusa-app@latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Check out [create-medusa-app docs](https://docs.medusajs.com/learn/installation) for more details and troubleshooting.
|
|
42
|
+
|
|
43
|
+
# Overview
|
|
44
|
+
|
|
45
|
+
The Medusa Next.js Starter is built with:
|
|
46
|
+
|
|
47
|
+
- [Next.js](https://nextjs.org/)
|
|
48
|
+
- [Tailwind CSS](https://tailwindcss.com/)
|
|
49
|
+
- [Typescript](https://www.typescriptlang.org/)
|
|
50
|
+
- [Medusa](https://medusajs.com/)
|
|
51
|
+
|
|
52
|
+
Features include:
|
|
53
|
+
|
|
54
|
+
- Full ecommerce support:
|
|
55
|
+
- Product Detail Page
|
|
56
|
+
- Product Overview Page
|
|
57
|
+
- Product Collections
|
|
58
|
+
- Cart
|
|
59
|
+
- Checkout with Stripe
|
|
60
|
+
- User Accounts
|
|
61
|
+
- Order Details
|
|
62
|
+
- Full Next.js 15 support:
|
|
63
|
+
- App Router
|
|
64
|
+
- Next fetching/caching
|
|
65
|
+
- Server Components
|
|
66
|
+
- Server Actions
|
|
67
|
+
- Streaming
|
|
68
|
+
- Static Pre-Rendering
|
|
69
|
+
|
|
70
|
+
# Quickstart
|
|
71
|
+
|
|
72
|
+
### Setting up the environment variables
|
|
73
|
+
|
|
74
|
+
Navigate into your projects directory and get your environment variables ready:
|
|
75
|
+
|
|
76
|
+
```shell
|
|
77
|
+
cd nextjs-starter-medusa/
|
|
78
|
+
mv .env.template .env.local
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Install dependencies
|
|
82
|
+
|
|
83
|
+
Use Yarn to install all dependencies.
|
|
84
|
+
|
|
85
|
+
```shell
|
|
86
|
+
yarn
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Start developing
|
|
90
|
+
|
|
91
|
+
You are now ready to start up your project.
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
yarn dev
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Open the code and start customizing
|
|
98
|
+
|
|
99
|
+
Your site is now running at http://localhost:8000!
|
|
100
|
+
|
|
101
|
+
# Payment integrations
|
|
102
|
+
|
|
103
|
+
By default this starter supports the following payment integrations
|
|
104
|
+
|
|
105
|
+
- [Stripe](https://stripe.com/)
|
|
106
|
+
|
|
107
|
+
To enable the integrations you need to add the following to your `.env.local` file:
|
|
108
|
+
|
|
109
|
+
```shell
|
|
110
|
+
NEXT_PUBLIC_STRIPE_KEY=<your-stripe-public-key>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
You'll also need to setup the integrations in your Medusa server. See the [Medusa documentation](https://docs.medusajs.com) for more information on how to configure [Stripe](https://docs.medusajs.com/resources/commerce-modules/payment/payment-provider/stripe#main).
|
|
114
|
+
|
|
115
|
+
# Resources
|
|
116
|
+
|
|
117
|
+
## Learn more about Medusa
|
|
118
|
+
|
|
119
|
+
- [Website](https://www.medusajs.com/)
|
|
120
|
+
- [GitHub](https://github.com/medusajs)
|
|
121
|
+
- [Documentation](https://docs.medusajs.com/)
|
|
122
|
+
|
|
123
|
+
## Learn more about Next.js
|
|
124
|
+
|
|
125
|
+
- [Website](https://nextjs.org/)
|
|
126
|
+
- [GitHub](https://github.com/vercel/next.js)
|
|
127
|
+
- [Documentation](https://nextjs.org/docs)
|