@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,51 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import { IconProps } from "types/icon"
|
|
4
|
+
|
|
5
|
+
const Refresh: React.FC<IconProps> = ({
|
|
6
|
+
size = "16",
|
|
7
|
+
color = "currentColor",
|
|
8
|
+
...attributes
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
width={size}
|
|
13
|
+
height={size}
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
{...attributes}
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
d="M19.8007 3.33301V8.53308H14.6006"
|
|
21
|
+
stroke={color}
|
|
22
|
+
strokeWidth="1.5"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
/>
|
|
26
|
+
<path
|
|
27
|
+
d="M4.2002 12C4.20157 10.4949 4.63839 9.02228 5.45797 7.75984C6.27755 6.4974 7.44488 5.49905 8.81917 4.8852C10.1935 4.27135 11.716 4.06823 13.2031 4.30034C14.6903 4.53244 16.0785 5.18986 17.2004 6.19329L19.8004 8.53332"
|
|
28
|
+
stroke={color}
|
|
29
|
+
strokeWidth="1.5"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M4.2002 20.6669V15.4668H9.40027"
|
|
35
|
+
stroke={color}
|
|
36
|
+
strokeWidth="1.5"
|
|
37
|
+
strokeLinecap="round"
|
|
38
|
+
strokeLinejoin="round"
|
|
39
|
+
/>
|
|
40
|
+
<path
|
|
41
|
+
d="M19.8004 12C19.799 13.5051 19.3622 14.9778 18.5426 16.2402C17.7231 17.5026 16.5557 18.501 15.1814 19.1148C13.8072 19.7287 12.2846 19.9318 10.7975 19.6997C9.31033 19.4676 7.9221 18.8102 6.80023 17.8067L4.2002 15.4667"
|
|
42
|
+
stroke={color}
|
|
43
|
+
strokeWidth="1.5"
|
|
44
|
+
strokeLinecap="round"
|
|
45
|
+
strokeLinejoin="round"
|
|
46
|
+
/>
|
|
47
|
+
</svg>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default Refresh
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import { IconProps } from "types/icon"
|
|
4
|
+
|
|
5
|
+
const Spinner: React.FC<IconProps> = ({
|
|
6
|
+
size = "16",
|
|
7
|
+
color = "currentColor",
|
|
8
|
+
...attributes
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
className="animate-spin"
|
|
13
|
+
width={size}
|
|
14
|
+
height={size}
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
fill="none"
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
{...attributes}
|
|
19
|
+
>
|
|
20
|
+
<circle
|
|
21
|
+
className="opacity-25"
|
|
22
|
+
cx="12"
|
|
23
|
+
cy="12"
|
|
24
|
+
r="10"
|
|
25
|
+
stroke={color}
|
|
26
|
+
strokeWidth="4"
|
|
27
|
+
></circle>
|
|
28
|
+
<path
|
|
29
|
+
className="opacity-75"
|
|
30
|
+
fill={color}
|
|
31
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
32
|
+
></path>
|
|
33
|
+
</svg>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Spinner
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import { IconProps } from "types/icon"
|
|
4
|
+
|
|
5
|
+
const Trash: React.FC<IconProps> = ({
|
|
6
|
+
size = "16",
|
|
7
|
+
color = "currentColor",
|
|
8
|
+
...attributes
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
width={size}
|
|
13
|
+
height={size}
|
|
14
|
+
viewBox="0 0 20 20"
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
{...attributes}
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
d="M3.33301 5.49054H4.81449H16.6663"
|
|
21
|
+
stroke={color}
|
|
22
|
+
strokeWidth="1.5"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
/>
|
|
26
|
+
<path
|
|
27
|
+
d="M7.14286 5.5V4C7.14286 3.60218 7.29337 3.22064 7.56128 2.93934C7.82919 2.65804 8.19255 2.5 8.57143 2.5H11.4286C11.8075 2.5 12.1708 2.65804 12.4387 2.93934C12.7066 3.22064 12.8571 3.60218 12.8571 4V5.5M15 5.5V16C15 16.3978 14.8495 16.7794 14.5816 17.0607C14.3137 17.342 13.9503 17.5 13.5714 17.5H6.42857C6.04969 17.5 5.68633 17.342 5.41842 17.0607C5.15051 16.7794 5 16.3978 5 16V5.5H15Z"
|
|
28
|
+
stroke={color}
|
|
29
|
+
strokeWidth="1.5"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M8.33203 9.23724V13.4039"
|
|
35
|
+
stroke={color}
|
|
36
|
+
strokeWidth="1.5"
|
|
37
|
+
strokeLinecap="round"
|
|
38
|
+
strokeLinejoin="round"
|
|
39
|
+
/>
|
|
40
|
+
<path
|
|
41
|
+
d="M11.666 9.23724V13.4039"
|
|
42
|
+
stroke={color}
|
|
43
|
+
strokeWidth="1.5"
|
|
44
|
+
strokeLinecap="round"
|
|
45
|
+
strokeLinejoin="round"
|
|
46
|
+
/>
|
|
47
|
+
</svg>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default Trash
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import { IconProps } from "types/icon"
|
|
4
|
+
|
|
5
|
+
const User: React.FC<IconProps> = ({
|
|
6
|
+
size = "16",
|
|
7
|
+
color = "currentColor",
|
|
8
|
+
...attributes
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
width={size}
|
|
13
|
+
height={size}
|
|
14
|
+
viewBox="0 0 20 20"
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
{...attributes}
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
d="M16.6663 18V16.3333C16.6663 15.4493 16.3152 14.6014 15.69 13.9763C15.0649 13.3512 14.2171 13 13.333 13H6.66634C5.78229 13 4.93444 13.3512 4.30932 13.9763C3.6842 14.6014 3.33301 15.4493 3.33301 16.3333V18"
|
|
21
|
+
stroke={color}
|
|
22
|
+
strokeWidth="1.5"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
/>
|
|
26
|
+
<path
|
|
27
|
+
d="M10.0003 9.66667C11.8413 9.66667 13.3337 8.17428 13.3337 6.33333C13.3337 4.49238 11.8413 3 10.0003 3C8.15938 3 6.66699 4.49238 6.66699 6.33333C6.66699 8.17428 8.15938 9.66667 10.0003 9.66667Z"
|
|
28
|
+
stroke={color}
|
|
29
|
+
strokeWidth="1.5"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default User
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import { IconProps } from "types/icon"
|
|
4
|
+
|
|
5
|
+
const X: React.FC<IconProps> = ({
|
|
6
|
+
size = "20",
|
|
7
|
+
color = "currentColor",
|
|
8
|
+
...attributes
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
width={size}
|
|
13
|
+
height={size}
|
|
14
|
+
viewBox="0 0 20 20"
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
{...attributes}
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
d="M15 5L5 15"
|
|
21
|
+
stroke={color}
|
|
22
|
+
strokeWidth="1.5"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
/>
|
|
26
|
+
<path
|
|
27
|
+
d="M5 5L15 15"
|
|
28
|
+
stroke={color}
|
|
29
|
+
strokeWidth="1.5"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default X
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { T } from "@lib/boutique/i18n-client"
|
|
5
|
+
import { transferCart } from "@lib/data/customer"
|
|
6
|
+
import { ExclamationCircleSolid } from "@medusajs/icons"
|
|
7
|
+
import { StoreCart, StoreCustomer } from "@medusajs/types"
|
|
8
|
+
import { Button } from "@medusajs/ui"
|
|
9
|
+
import { useState } from "react"
|
|
10
|
+
|
|
11
|
+
function CartMismatchBanner(props: {
|
|
12
|
+
customer: StoreCustomer
|
|
13
|
+
cart: StoreCart
|
|
14
|
+
}) {
|
|
15
|
+
const { customer, cart } = props
|
|
16
|
+
const [isPending, setIsPending] = useState(false)
|
|
17
|
+
const [actionText, setActionText] = useState("Run transfer again")
|
|
18
|
+
|
|
19
|
+
if (!customer || !!cart.customer_id) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const handleSubmit = async () => {
|
|
24
|
+
try {
|
|
25
|
+
setIsPending(true)
|
|
26
|
+
setActionText("Transferring..")
|
|
27
|
+
|
|
28
|
+
await transferCart()
|
|
29
|
+
} catch {
|
|
30
|
+
setActionText("Run transfer again")
|
|
31
|
+
setIsPending(false)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className="flex items-center justify-center small:p-4 p-2 text-center bg-orange-300 small:gap-2 gap-1 text-sm mt-2 text-orange-800">
|
|
37
|
+
<div className="flex flex-col small:flex-row small:gap-2 gap-1 items-center">
|
|
38
|
+
<span className="flex items-center gap-1">
|
|
39
|
+
<ExclamationCircleSolid className="inline" />
|
|
40
|
+
<T k="cart.transferFailed" />
|
|
41
|
+
</span>
|
|
42
|
+
|
|
43
|
+
<span>·</span>
|
|
44
|
+
|
|
45
|
+
<Button
|
|
46
|
+
variant="transparent"
|
|
47
|
+
className="hover:bg-transparent active:bg-transparent focus:bg-transparent disabled:text-orange-500 text-orange-950 p-0 bg-transparent"
|
|
48
|
+
size="base"
|
|
49
|
+
disabled={isPending}
|
|
50
|
+
onClick={handleSubmit}
|
|
51
|
+
>
|
|
52
|
+
{actionText}
|
|
53
|
+
</Button>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default CartMismatchBanner
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { T } from "@lib/boutique/i18n-client"
|
|
2
|
+
import { Heading } from "@medusajs/ui"
|
|
3
|
+
import LocalizedClientLink from "@modules/common/components/localized-client-link"
|
|
4
|
+
import React from "react"
|
|
5
|
+
|
|
6
|
+
const Help = () => {
|
|
7
|
+
return (
|
|
8
|
+
<div className="mt-6">
|
|
9
|
+
<Heading className="text-base-semi"><T k="order.help" /></Heading>
|
|
10
|
+
<div className="text-base-regular my-2">
|
|
11
|
+
<ul className="gap-y-2 flex flex-col">
|
|
12
|
+
<li>
|
|
13
|
+
<LocalizedClientLink href="/legal/contact"><T k="legal.contact" /></LocalizedClientLink>
|
|
14
|
+
</li>
|
|
15
|
+
<li>
|
|
16
|
+
<LocalizedClientLink href="/legal/returns">
|
|
17
|
+
<T k="order.returns" />
|
|
18
|
+
</LocalizedClientLink>
|
|
19
|
+
</li>
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default Help
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { HttpTypes } from "@medusajs/types"
|
|
2
|
+
import { Table, Text } from "@medusajs/ui"
|
|
3
|
+
|
|
4
|
+
import LineItemOptions from "@modules/common/components/line-item-options"
|
|
5
|
+
import LineItemPrice from "@modules/common/components/line-item-price"
|
|
6
|
+
import LineItemUnitPrice from "@modules/common/components/line-item-unit-price"
|
|
7
|
+
import Thumbnail from "@modules/products/components/thumbnail"
|
|
8
|
+
|
|
9
|
+
type ItemProps = {
|
|
10
|
+
item: HttpTypes.StoreCartLineItem | HttpTypes.StoreOrderLineItem
|
|
11
|
+
currencyCode: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Item = ({ item, currencyCode }: ItemProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<Table.Row className="w-full" data-testid="product-row">
|
|
17
|
+
<Table.Cell className="!pl-0 p-4 w-24">
|
|
18
|
+
<div className="flex w-16">
|
|
19
|
+
<Thumbnail thumbnail={item.thumbnail} size="square" />
|
|
20
|
+
</div>
|
|
21
|
+
</Table.Cell>
|
|
22
|
+
|
|
23
|
+
<Table.Cell className="text-left">
|
|
24
|
+
<Text
|
|
25
|
+
className="txt-medium-plus text-ui-fg-base"
|
|
26
|
+
data-testid="product-name"
|
|
27
|
+
>
|
|
28
|
+
{item.product_title}
|
|
29
|
+
</Text>
|
|
30
|
+
<LineItemOptions variant={item.variant} data-testid="product-variant" />
|
|
31
|
+
</Table.Cell>
|
|
32
|
+
|
|
33
|
+
<Table.Cell className="!pr-0">
|
|
34
|
+
<span className="!pr-0 flex flex-col items-end h-full justify-center">
|
|
35
|
+
<span className="flex gap-x-1 ">
|
|
36
|
+
<Text className="text-ui-fg-muted">
|
|
37
|
+
<span data-testid="product-quantity">{item.quantity}</span>x{" "}
|
|
38
|
+
</Text>
|
|
39
|
+
<LineItemUnitPrice
|
|
40
|
+
item={item}
|
|
41
|
+
style="tight"
|
|
42
|
+
currencyCode={currencyCode}
|
|
43
|
+
/>
|
|
44
|
+
</span>
|
|
45
|
+
|
|
46
|
+
<LineItemPrice
|
|
47
|
+
item={item}
|
|
48
|
+
style="tight"
|
|
49
|
+
currencyCode={currencyCode}
|
|
50
|
+
/>
|
|
51
|
+
</span>
|
|
52
|
+
</Table.Cell>
|
|
53
|
+
</Table.Row>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default Item
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import repeat from "@lib/util/repeat"
|
|
2
|
+
import { HttpTypes } from "@medusajs/types"
|
|
3
|
+
import { Table } from "@medusajs/ui"
|
|
4
|
+
|
|
5
|
+
import Divider from "@modules/common/components/divider"
|
|
6
|
+
import Item from "@modules/order/components/item"
|
|
7
|
+
import SkeletonLineItem from "@modules/skeletons/components/skeleton-line-item"
|
|
8
|
+
|
|
9
|
+
type ItemsProps = {
|
|
10
|
+
order: HttpTypes.StoreOrder
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Items = ({ order }: ItemsProps) => {
|
|
14
|
+
const items = order.items
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className="flex flex-col">
|
|
18
|
+
<Divider className="!mb-0" />
|
|
19
|
+
<Table>
|
|
20
|
+
<Table.Body data-testid="products-table">
|
|
21
|
+
{items?.length
|
|
22
|
+
? items
|
|
23
|
+
.sort((a, b) => {
|
|
24
|
+
return (a.created_at ?? "") > (b.created_at ?? "") ? -1 : 1
|
|
25
|
+
})
|
|
26
|
+
.map((item) => {
|
|
27
|
+
return (
|
|
28
|
+
<Item
|
|
29
|
+
key={item.id}
|
|
30
|
+
item={item}
|
|
31
|
+
currencyCode={order.currency_code}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
})
|
|
35
|
+
: repeat(5).map((i) => {
|
|
36
|
+
return <SkeletonLineItem key={i} />
|
|
37
|
+
})}
|
|
38
|
+
</Table.Body>
|
|
39
|
+
</Table>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default Items
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { resetOnboardingState } from "@lib/data/onboarding"
|
|
4
|
+
import { Button, Container, Text } from "@medusajs/ui"
|
|
5
|
+
|
|
6
|
+
const OnboardingCta = ({ orderId }: { orderId: string }) => {
|
|
7
|
+
return (
|
|
8
|
+
<Container className="max-w-4xl h-full bg-ui-bg-subtle w-full">
|
|
9
|
+
<div className="flex flex-col gap-y-4 center p-4 md:items-center">
|
|
10
|
+
<Text className="text-ui-fg-base text-xl">
|
|
11
|
+
Your test order was successfully created! 🎉
|
|
12
|
+
</Text>
|
|
13
|
+
<Text className="text-ui-fg-subtle text-small-regular">
|
|
14
|
+
You can now complete setting up your store in the admin.
|
|
15
|
+
</Text>
|
|
16
|
+
<Button
|
|
17
|
+
className="w-fit"
|
|
18
|
+
size="xlarge"
|
|
19
|
+
onClick={() => resetOnboardingState(orderId)}
|
|
20
|
+
>
|
|
21
|
+
Complete setup in admin
|
|
22
|
+
</Button>
|
|
23
|
+
</div>
|
|
24
|
+
</Container>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default OnboardingCta
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { T } from "@lib/boutique/i18n-client"
|
|
2
|
+
import { HttpTypes } from "@medusajs/types"
|
|
3
|
+
import { Text } from "@medusajs/ui"
|
|
4
|
+
|
|
5
|
+
type OrderDetailsProps = {
|
|
6
|
+
order: HttpTypes.StoreOrder
|
|
7
|
+
showStatus?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const OrderDetails = ({ order, showStatus }: OrderDetailsProps) => {
|
|
11
|
+
const formatStatus = (str: string) => {
|
|
12
|
+
const formatted = str.split("_").join(" ")
|
|
13
|
+
|
|
14
|
+
return formatted.slice(0, 1).toUpperCase() + formatted.slice(1)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div>
|
|
19
|
+
<Text>
|
|
20
|
+
<T k="order.emailSent" />{" "}
|
|
21
|
+
<span
|
|
22
|
+
className="text-ui-fg-medium-plus font-semibold"
|
|
23
|
+
data-testid="order-email"
|
|
24
|
+
>
|
|
25
|
+
{order.email}
|
|
26
|
+
</span>
|
|
27
|
+
.
|
|
28
|
+
</Text>
|
|
29
|
+
<Text className="mt-2">
|
|
30
|
+
<T k="order.date" />{" "}
|
|
31
|
+
<span data-testid="order-date">
|
|
32
|
+
{new Date(order.created_at).toLocaleDateString(undefined, { dateStyle: "long" })}
|
|
33
|
+
</span>
|
|
34
|
+
</Text>
|
|
35
|
+
<Text className="mt-2 text-ui-fg-interactive">
|
|
36
|
+
<T k="order.number" /> <span data-testid="order-id">{order.display_id}</span>
|
|
37
|
+
</Text>
|
|
38
|
+
|
|
39
|
+
<div className="flex items-center text-compact-small gap-x-4 mt-4">
|
|
40
|
+
{showStatus && (
|
|
41
|
+
<>
|
|
42
|
+
<Text>
|
|
43
|
+
<T k="order.status" />{" "}
|
|
44
|
+
<span className="text-ui-fg-subtle " data-testid="order-status">
|
|
45
|
+
{formatStatus(order.fulfillment_status)}
|
|
46
|
+
</span>
|
|
47
|
+
</Text>
|
|
48
|
+
<Text>
|
|
49
|
+
<T k="order.paymentStatus" />{" "}
|
|
50
|
+
<span
|
|
51
|
+
className="text-ui-fg-subtle "
|
|
52
|
+
sata-testid="order-payment-status"
|
|
53
|
+
>
|
|
54
|
+
{formatStatus(order.payment_status)}
|
|
55
|
+
</span>
|
|
56
|
+
</Text>
|
|
57
|
+
</>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default OrderDetails
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { T } from "@lib/boutique/i18n-client"
|
|
2
|
+
import { convertToLocale } from "@lib/util/money"
|
|
3
|
+
import { HttpTypes } from "@medusajs/types"
|
|
4
|
+
|
|
5
|
+
type OrderSummaryProps = {
|
|
6
|
+
order: HttpTypes.StoreOrder
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const OrderSummary = ({ order }: OrderSummaryProps) => {
|
|
10
|
+
const getAmount = (amount?: number | null) => {
|
|
11
|
+
if (!amount) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return convertToLocale({
|
|
16
|
+
amount,
|
|
17
|
+
currency_code: order.currency_code,
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div>
|
|
23
|
+
<h2 className="text-base-semi">Order Summary</h2>
|
|
24
|
+
<div className="text-small-regular text-ui-fg-base my-2">
|
|
25
|
+
<div className="flex items-center justify-between text-base-regular text-ui-fg-base mb-2">
|
|
26
|
+
<span><T k="cart.subtotal" /></span>
|
|
27
|
+
<span>{getAmount(order.subtotal)}</span>
|
|
28
|
+
</div>
|
|
29
|
+
<div className="flex flex-col gap-y-1">
|
|
30
|
+
{order.discount_total > 0 && (
|
|
31
|
+
<div className="flex items-center justify-between">
|
|
32
|
+
<span><T k="cart.discount" /></span>
|
|
33
|
+
<span>- {getAmount(order.discount_total)}</span>
|
|
34
|
+
</div>
|
|
35
|
+
)}
|
|
36
|
+
{order.gift_card_total > 0 && (
|
|
37
|
+
<div className="flex items-center justify-between">
|
|
38
|
+
<span><T k="cart.discount" /></span>
|
|
39
|
+
<span>- {getAmount(order.gift_card_total)}</span>
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
<div className="flex items-center justify-between">
|
|
43
|
+
<span><T k="cart.shipping" /></span>
|
|
44
|
+
<span>{getAmount(order.shipping_total)}</span>
|
|
45
|
+
</div>
|
|
46
|
+
<div className="flex items-center justify-between">
|
|
47
|
+
<span><T k="cart.taxes" /></span>
|
|
48
|
+
<span>{getAmount(order.tax_total)}</span>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div className="h-px w-full border-b border-gray-200 border-dashed my-4" />
|
|
52
|
+
<div className="flex items-center justify-between text-base-regular text-ui-fg-base mb-2">
|
|
53
|
+
<span><T k="cart.total" /></span>
|
|
54
|
+
<span>{getAmount(order.total)}</span>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default OrderSummary
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { T } from "@lib/boutique/i18n-client"
|
|
2
|
+
import { Container, Heading, Text } from "@medusajs/ui"
|
|
3
|
+
|
|
4
|
+
import { isStripeLike, paymentInfoMap } from "@lib/constants"
|
|
5
|
+
import Divider from "@modules/common/components/divider"
|
|
6
|
+
import { convertToLocale } from "@lib/util/money"
|
|
7
|
+
import { HttpTypes } from "@medusajs/types"
|
|
8
|
+
|
|
9
|
+
type PaymentDetailsProps = {
|
|
10
|
+
order: HttpTypes.StoreOrder
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const PaymentDetails = ({ order }: PaymentDetailsProps) => {
|
|
14
|
+
const payment = order.payment_collections?.[0].payments?.[0]
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
<Heading level="h2" className="flex flex-row text-3xl-regular my-6">
|
|
19
|
+
<T k="order.payment" />
|
|
20
|
+
</Heading>
|
|
21
|
+
<div>
|
|
22
|
+
{payment && (
|
|
23
|
+
<div className="flex items-start gap-x-1 w-full">
|
|
24
|
+
<div className="flex flex-col w-1/3">
|
|
25
|
+
<Text className="txt-medium-plus text-ui-fg-base mb-1">
|
|
26
|
+
<T k="order.paymentMethod" />
|
|
27
|
+
</Text>
|
|
28
|
+
<Text
|
|
29
|
+
className="txt-medium text-ui-fg-subtle"
|
|
30
|
+
data-testid="payment-method"
|
|
31
|
+
>
|
|
32
|
+
{paymentInfoMap[payment.provider_id].title}
|
|
33
|
+
</Text>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="flex flex-col w-2/3">
|
|
36
|
+
<Text className="txt-medium-plus text-ui-fg-base mb-1">
|
|
37
|
+
<T k="order.paymentDetails" />
|
|
38
|
+
</Text>
|
|
39
|
+
<div className="flex gap-2 txt-medium text-ui-fg-subtle items-center">
|
|
40
|
+
<Container className="flex items-center h-7 w-fit p-2 bg-ui-button-neutral-hover">
|
|
41
|
+
{paymentInfoMap[payment.provider_id].icon}
|
|
42
|
+
</Container>
|
|
43
|
+
<Text data-testid="payment-amount">
|
|
44
|
+
{isStripeLike(payment.provider_id) && payment.data?.card_last4
|
|
45
|
+
? `**** **** **** ${payment.data.card_last4}`
|
|
46
|
+
: `${convertToLocale({
|
|
47
|
+
amount: payment.amount,
|
|
48
|
+
currency_code: order.currency_code,
|
|
49
|
+
})} paid at ${new Date(
|
|
50
|
+
payment.created_at ?? ""
|
|
51
|
+
).toLocaleString()}`}
|
|
52
|
+
</Text>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<Divider className="mt-8" />
|
|
60
|
+
</div>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default PaymentDetails
|