@cartbase/storefront 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +231 -226
- package/src/api/auth.ts +1 -1
- package/src/api/carts.ts +5 -3
- package/src/api/checkout.ts +91 -40
- package/src/api/consent.ts +2 -2
- package/src/api/integrations.ts +4 -17
- package/src/api/regions.ts +1 -1
- package/src/cart-drawer/context.tsx +4 -4
- package/src/cart-drawer/cross-sell-carousel.tsx +1 -1
- package/src/cart-drawer/cross-sell-sidebar.tsx +1 -1
- package/src/cart-drawer/header.tsx +1 -1
- package/src/cart-drawer/item/index.tsx +2 -2
- package/src/cart-drawer/item/quantity.tsx +2 -2
- package/src/cart-drawer/item/upsell.tsx +3 -3
- package/src/cart-drawer/item/variant.tsx +2 -2
- package/src/cart-drawer/labels-bg.ts +2 -2
- package/src/cart-drawer/labels.ts +119 -119
- package/src/cart-drawer/summary-breakdown.tsx +197 -196
- package/src/cart-drawer/template.tsx +2 -2
- package/src/cart-drawer/tiered-progress.tsx +1 -1
- package/src/checkout/address-error-copy.ts +3 -3
- package/src/checkout/address-form.tsx +2 -2
- package/src/checkout/address-select.tsx +1 -1
- package/src/checkout/boxnow-locker-selector.tsx +3 -3
- package/src/checkout/checkout-client.tsx +15 -12
- package/src/checkout/company-details.tsx +1 -1
- package/src/checkout/compare-addresses.ts +1 -1
- package/src/checkout/discount-section.tsx +5 -5
- package/src/checkout/econt-office-selector.tsx +2 -2
- package/src/checkout/gift-card-section.tsx +2 -2
- package/src/checkout/index.ts +0 -1
- package/src/checkout/labels-bg.ts +2 -2
- package/src/checkout/labels.ts +263 -263
- package/src/checkout/line-item-card.tsx +2 -2
- package/src/checkout/order-summary.tsx +48 -48
- package/src/checkout/payment-button.tsx +4 -4
- package/src/checkout/payment-error-copy.ts +6 -6
- package/src/checkout/payment-method-list.tsx +93 -33
- package/src/checkout/payment-wrapper.tsx +8 -11
- package/src/checkout/promotion-error-copy.ts +2 -2
- package/src/checkout/shipping-method-list.tsx +2 -2
- package/src/checkout/stripe-wrapper.tsx +1 -1
- package/src/checkout/use-checkout-orchestration.ts +108 -98
- package/src/common/cart-button-client.tsx +1 -1
- package/src/common/cart-button.tsx +1 -1
- package/src/common/country-select.tsx +2 -2
- package/src/common/delete-button.tsx +1 -1
- package/src/common/index.ts +1 -1
- package/src/common/language-select.tsx +2 -2
- package/src/common/localized-link.tsx +1 -1
- package/src/lib/cart-helpers.ts +2 -2
- package/src/lib/cookie-names.ts +41 -0
- package/src/lib/get-product-price.ts +3 -3
- package/src/lib/payment-constants.ts +53 -66
- package/src/lib/store-api-error.ts +1 -1
- package/src/order/index.ts +1 -1
- package/src/order/labels-bg.ts +39 -39
- package/src/order/labels.ts +79 -79
- package/src/order/order-address-card.tsx +1 -1
- package/src/order/order-completed-template.tsx +20 -12
- package/src/order/order-confirmation-header.tsx +1 -1
- package/src/order/order-delivery-card.tsx +3 -3
- package/src/order/order-item.tsx +2 -2
- package/src/order/order-items-list.tsx +3 -3
- package/src/order/order-payment-card.tsx +27 -36
- package/src/order/order-timeline.tsx +2 -2
- package/src/order/order-totals.tsx +250 -245
- package/src/platform/identity.ts +18 -0
- package/src/platform/index.ts +8 -0
- package/src/platform/metadata.ts +26 -0
- package/src/platform/platform-init.tsx +46 -0
- package/src/products/image-gallery.tsx +1 -1
- package/src/products/mobile-actions.tsx +1 -1
- package/src/products/option-select.tsx +1 -1
- package/src/products/preview-price.tsx +1 -1
- package/src/products/product-actions.tsx +6 -6
- package/src/products/product-info.tsx +1 -1
- package/src/products/product-preview.tsx +1 -1
- package/src/products/product-price.tsx +2 -2
- package/src/products/product-tabs.tsx +1 -1
- package/src/products/purchase-options.tsx +1 -1
- package/src/products/related-products.tsx +3 -3
- package/src/products/variant-matching.ts +4 -4
- package/src/reviews-ui/labels.ts +1 -1
- package/src/reviews-ui/photo-upload.tsx +1 -1
- package/src/reviews-ui/review-list.tsx +1 -1
- package/src/reviews-ui/review-widget.tsx +1 -1
- package/src/reviews-ui/review-wizard.tsx +1 -1
- package/src/reviews-ui/wizard-state.ts +1 -1
- package/src/store/category-template.tsx +2 -2
- package/src/store/collection-template.tsx +2 -2
- package/src/store/labels.ts +2 -2
- package/src/store/paginated-products.tsx +1 -1
- package/src/store/search-params.ts +1 -1
- package/src/store/search-template.tsx +1 -1
- package/src/tracking/consent-banner.tsx +1 -1
- package/src/tracking/consent-init.tsx +1 -1
- package/src/tracking/consent.ts +6 -6
- package/src/tracking/fbq.ts +2 -2
- package/src/tracking/get-tracking-attribution.ts +1 -1
- package/src/tracking/get-tracking-config.ts +2 -2
- package/src/tracking/index.ts +2 -2
- package/src/tracking/meta-pixel.tsx +1 -1
- package/src/tracking/rybbit.tsx +1 -1
- package/src/tracking/types.ts +6 -6
|
@@ -1,66 +1,53 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Payment
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{ title: string; icon: React.JSX.Element | null }
|
|
55
|
-
> = {
|
|
56
|
-
pp_stripe: { title: "Credit / debit card", icon: null },
|
|
57
|
-
pp_stripe_stripe: { title: "Credit / debit card", icon: null },
|
|
58
|
-
"pp_medusa-payments_default": { title: "Credit / debit card", icon: null },
|
|
59
|
-
"pp_stripe-ideal_stripe": { title: "iDeal", icon: null },
|
|
60
|
-
"pp_stripe-bancontact_stripe": { title: "Bancontact", icon: null },
|
|
61
|
-
pp_paypal_paypal: { title: "PayPal", icon: null },
|
|
62
|
-
pp_cod: { title: "Cash on delivery", icon: null },
|
|
63
|
-
pp_manual: { title: "Manual payment", icon: null },
|
|
64
|
-
// Retired legacy manual twin — historic orders only (payments-registry).
|
|
65
|
-
pp_system_default: { title: "Manual payment", icon: null },
|
|
66
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Payment tender helpers — identifier sniffing for store payment sessions.
|
|
3
|
+
*
|
|
4
|
+
* The Cartbase wire has exactly TWO tender shapes since the pp_* kill
|
|
5
|
+
* (20260811250000, no-payment-method-by-default card):
|
|
6
|
+
*
|
|
7
|
+
* - a PROCESSOR the merchant connected — `provider_id` (`pp_stripe`
|
|
8
|
+
* today; PayPal etc. as integrations land);
|
|
9
|
+
* - a merchant-operated PAYMENT METHOD — `payment_method_id` + `name` +
|
|
10
|
+
* `kind` (`manual` for Bank transfer / Pay in store, `cod` for the
|
|
11
|
+
* collection-on-delivery switch). Its session carries `provider_id`
|
|
12
|
+
* NULL; the merchant's NAME is the display everywhere.
|
|
13
|
+
*
|
|
14
|
+
* The dead ids (`pp_cod`, `pp_manual`, `pp_system_default`) are gone from
|
|
15
|
+
* the wire and from this module. The Medusa-era Stripe prefixes
|
|
16
|
+
* (`pp_stripe_*`, `pp_medusa-*`) are kept as fallbacks so components
|
|
17
|
+
* ported later keep working against either wire.
|
|
18
|
+
*
|
|
19
|
+
* Intentionally ships NO icons — stores render their own icons via their
|
|
20
|
+
* own icon set. The library stays free of icon-kit imports at this layer.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* True if the provider id is a Stripe-backed card payment provider.
|
|
25
|
+
* Cartbase's canonical ids first (`pp_stripe` / `stripe`), then the
|
|
26
|
+
* Medusa-era prefixes (`pp_stripe_*`, `pp_medusa-*`).
|
|
27
|
+
*/
|
|
28
|
+
export const isStripeLike = (providerId?: string | null): boolean => {
|
|
29
|
+
return Boolean(
|
|
30
|
+
providerId &&
|
|
31
|
+
(providerId === "pp_stripe" ||
|
|
32
|
+
providerId === "stripe" ||
|
|
33
|
+
providerId.startsWith("pp_stripe_") ||
|
|
34
|
+
providerId.startsWith("pp_medusa-"))
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** True if the provider id is PayPal. */
|
|
39
|
+
export const isPaypal = (providerId?: string | null): boolean => {
|
|
40
|
+
return Boolean(providerId?.startsWith("pp_paypal"))
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const paymentInfoMap: Record<
|
|
44
|
+
string,
|
|
45
|
+
{ title: string; icon: React.JSX.Element | null }
|
|
46
|
+
> = {
|
|
47
|
+
pp_stripe: { title: "Credit / debit card", icon: null },
|
|
48
|
+
pp_stripe_stripe: { title: "Credit / debit card", icon: null },
|
|
49
|
+
"pp_medusa-payments_default": { title: "Credit / debit card", icon: null },
|
|
50
|
+
"pp_stripe-ideal_stripe": { title: "iDeal", icon: null },
|
|
51
|
+
"pp_stripe-bancontact_stripe": { title: "Bancontact", icon: null },
|
|
52
|
+
pp_paypal_paypal: { title: "PayPal", icon: null },
|
|
53
|
+
}
|
|
@@ -6,7 +6,7 @@ import { StoreApiError } from "../api/types"
|
|
|
6
6
|
* Normalizes any error thrown by the `@cartbase/storefront` SDK layer into a
|
|
7
7
|
* clean, user-presentable `Error` whose message starts with a capital and
|
|
8
8
|
* ends with a period — the same normalization contract the Medusa-era
|
|
9
|
-
* helper enforced, adapted to the
|
|
9
|
+
* helper enforced, adapted to the Cartbase error contract (`StoreApiError`
|
|
10
10
|
* with `status` + `code` + raw `body`, see `../api/types`).
|
|
11
11
|
*
|
|
12
12
|
* Always throws — never returns. Use in `.catch()` chains:
|
package/src/order/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @cartbase/storefront/order — order confirmation + account order views.
|
|
3
|
-
* Ported from `@1click/ui/src/order` (v2.3.1) with
|
|
3
|
+
* Ported from `@1click/ui/src/order` (v2.3.1) with Cartbase data seams; see
|
|
4
4
|
* per-module JSDoc and docs/storefront/components.md for the contracts.
|
|
5
5
|
*/
|
|
6
6
|
export { OrderLabelsProvider, useOrderLabels } from "./context"
|
package/src/order/labels-bg.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import type { OrderLabels } from "./labels"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Bulgarian order labels — the Alenika/mindpages production copy, ported
|
|
5
|
-
* from `@1click/ui/src/order/labels-bg.ts` (v2.3.1) + `tracking`.
|
|
6
|
-
*/
|
|
7
|
-
export const bulgarianOrderLabels: OrderLabels = {
|
|
8
|
-
orderConfirmed: "Поръчката е потвърдена",
|
|
9
|
-
confirmationSent: "Изпратихме потвърждение на",
|
|
10
|
-
orderNumber: "Поръчка",
|
|
11
|
-
orderDate: "Дата",
|
|
12
|
-
summary: "Обобщение на поръчката",
|
|
13
|
-
subtotal: "Междинна сума",
|
|
14
|
-
shipping: "Доставка",
|
|
15
|
-
discount: "Отстъпка",
|
|
16
|
-
tax: "ДДС",
|
|
17
|
-
total: "Общо",
|
|
18
|
-
|
|
19
|
-
contactInfo: "Данни за контакт",
|
|
20
|
-
delivery: "Доставка",
|
|
21
|
-
paymentMethod: "Метод на плащане",
|
|
22
|
-
paymentMethodTitles: {
|
|
23
|
-
card: "Кредитна / дебитна карта",
|
|
24
|
-
cod: "Наложен платеж",
|
|
25
|
-
manual: "Друг начин на плащане",
|
|
26
|
-
paypal: "PayPal",
|
|
27
|
-
},
|
|
28
|
-
needHelp: "Имате нужда от помощ?",
|
|
29
|
-
contactUs: "Свържете се с нас",
|
|
30
|
-
returnsExchanges: "Връщания и замени",
|
|
31
|
-
orderPlaced: "Приета",
|
|
32
|
-
processing: "Обработка",
|
|
33
|
-
shipped: "Изпратена",
|
|
34
|
-
delivered: "Доставена",
|
|
35
|
-
free: "БЕЗПЛАТНА",
|
|
36
|
-
continueShopping: "Продължи пазаруването",
|
|
37
|
-
qty: "бр.",
|
|
38
|
-
tracking: "Проследяване",
|
|
39
|
-
}
|
|
1
|
+
import type { OrderLabels } from "./labels"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bulgarian order labels — the Alenika/mindpages production copy, ported
|
|
5
|
+
* from `@1click/ui/src/order/labels-bg.ts` (v2.3.1) + `tracking`.
|
|
6
|
+
*/
|
|
7
|
+
export const bulgarianOrderLabels: OrderLabels = {
|
|
8
|
+
orderConfirmed: "Поръчката е потвърдена",
|
|
9
|
+
confirmationSent: "Изпратихме потвърждение на",
|
|
10
|
+
orderNumber: "Поръчка",
|
|
11
|
+
orderDate: "Дата",
|
|
12
|
+
summary: "Обобщение на поръчката",
|
|
13
|
+
subtotal: "Междинна сума",
|
|
14
|
+
shipping: "Доставка",
|
|
15
|
+
discount: "Отстъпка",
|
|
16
|
+
tax: "ДДС",
|
|
17
|
+
total: "Общо",
|
|
18
|
+
paymentMethodFee: "Такса за плащане",
|
|
19
|
+
contactInfo: "Данни за контакт",
|
|
20
|
+
delivery: "Доставка",
|
|
21
|
+
paymentMethod: "Метод на плащане",
|
|
22
|
+
paymentMethodTitles: {
|
|
23
|
+
card: "Кредитна / дебитна карта",
|
|
24
|
+
cod: "Наложен платеж",
|
|
25
|
+
manual: "Друг начин на плащане",
|
|
26
|
+
paypal: "PayPal",
|
|
27
|
+
},
|
|
28
|
+
needHelp: "Имате нужда от помощ?",
|
|
29
|
+
contactUs: "Свържете се с нас",
|
|
30
|
+
returnsExchanges: "Връщания и замени",
|
|
31
|
+
orderPlaced: "Приета",
|
|
32
|
+
processing: "Обработка",
|
|
33
|
+
shipped: "Изпратена",
|
|
34
|
+
delivered: "Доставена",
|
|
35
|
+
free: "БЕЗПЛАТНА",
|
|
36
|
+
continueShopping: "Продължи пазаруването",
|
|
37
|
+
qty: "бр.",
|
|
38
|
+
tracking: "Проследяване",
|
|
39
|
+
}
|
package/src/order/labels.ts
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Order family label pack. Ported from `@1click/ui/src/order/labels.ts`
|
|
3
|
-
* (v2.3.1) unchanged, plus `tracking` — new in the
|
|
4
|
-
*
|
|
5
|
-
* (`StoreOrderDetail.fulfillments[].fulfillment.labels`) that
|
|
6
|
-
* `OrderDeliveryCard` now renders.
|
|
7
|
-
*/
|
|
8
|
-
export type OrderLabels = {
|
|
9
|
-
orderConfirmed: string
|
|
10
|
-
confirmationSent: string
|
|
11
|
-
orderNumber: string
|
|
12
|
-
orderDate: string
|
|
13
|
-
summary: string
|
|
14
|
-
subtotal: string
|
|
15
|
-
shipping: string
|
|
16
|
-
discount: string
|
|
17
|
-
tax: string
|
|
18
|
-
total: string
|
|
19
|
-
/** Default label for the cash-on-delivery fee row. Used as the third-
|
|
20
|
-
* level fallback when neither a per-store override nor the server's
|
|
21
|
-
* `
|
|
22
|
-
|
|
23
|
-
contactInfo: string
|
|
24
|
-
delivery: string
|
|
25
|
-
paymentMethod: string
|
|
26
|
-
paymentMethodTitles: {
|
|
27
|
-
card: string
|
|
28
|
-
cod: string
|
|
29
|
-
/** Offline manual payments (pp_manual) — NOT cash on delivery. */
|
|
30
|
-
manual: string
|
|
31
|
-
paypal: string
|
|
32
|
-
}
|
|
33
|
-
needHelp: string
|
|
34
|
-
contactUs: string
|
|
35
|
-
returnsExchanges: string
|
|
36
|
-
orderPlaced: string
|
|
37
|
-
processing: string
|
|
38
|
-
shipped: string
|
|
39
|
-
delivered: string
|
|
40
|
-
free: string
|
|
41
|
-
continueShopping: string
|
|
42
|
-
qty: string
|
|
43
|
-
/** Heading for the fulfillment tracking-numbers block (
|
|
44
|
-
tracking: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const defaultOrderLabels: OrderLabels = {
|
|
48
|
-
orderConfirmed: "Order confirmed",
|
|
49
|
-
confirmationSent: "We sent a confirmation to",
|
|
50
|
-
orderNumber: "Order",
|
|
51
|
-
orderDate: "Date",
|
|
52
|
-
summary: "Order summary",
|
|
53
|
-
subtotal: "Subtotal",
|
|
54
|
-
shipping: "Shipping",
|
|
55
|
-
discount: "Discount",
|
|
56
|
-
tax: "Tax",
|
|
57
|
-
total: "Total",
|
|
58
|
-
|
|
59
|
-
contactInfo: "Contact info",
|
|
60
|
-
delivery: "Delivery",
|
|
61
|
-
paymentMethod: "Payment method",
|
|
62
|
-
paymentMethodTitles: {
|
|
63
|
-
card: "Credit / debit card",
|
|
64
|
-
cod: "Cash on delivery",
|
|
65
|
-
manual: "Manual payment",
|
|
66
|
-
paypal: "PayPal",
|
|
67
|
-
},
|
|
68
|
-
needHelp: "Need help?",
|
|
69
|
-
contactUs: "Contact us",
|
|
70
|
-
returnsExchanges: "Returns & exchanges",
|
|
71
|
-
orderPlaced: "Placed",
|
|
72
|
-
processing: "Processing",
|
|
73
|
-
shipped: "Shipped",
|
|
74
|
-
delivered: "Delivered",
|
|
75
|
-
free: "FREE",
|
|
76
|
-
continueShopping: "Continue shopping",
|
|
77
|
-
qty: "qty.",
|
|
78
|
-
tracking: "Tracking",
|
|
79
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Order family label pack. Ported from `@1click/ui/src/order/labels.ts`
|
|
3
|
+
* (v2.3.1) unchanged, plus `tracking` — new in the Cartbase port because the
|
|
4
|
+
* Cartbase order surface exposes fulfillment tracking labels
|
|
5
|
+
* (`StoreOrderDetail.fulfillments[].fulfillment.labels`) that
|
|
6
|
+
* `OrderDeliveryCard` now renders.
|
|
7
|
+
*/
|
|
8
|
+
export type OrderLabels = {
|
|
9
|
+
orderConfirmed: string
|
|
10
|
+
confirmationSent: string
|
|
11
|
+
orderNumber: string
|
|
12
|
+
orderDate: string
|
|
13
|
+
summary: string
|
|
14
|
+
subtotal: string
|
|
15
|
+
shipping: string
|
|
16
|
+
discount: string
|
|
17
|
+
tax: string
|
|
18
|
+
total: string
|
|
19
|
+
/** Default label for the cash-on-delivery fee row. Used as the third-
|
|
20
|
+
* level fallback when neither a per-store override nor the server's
|
|
21
|
+
* `payment_method_fee_label` / fee line title is available. */
|
|
22
|
+
paymentMethodFee: string
|
|
23
|
+
contactInfo: string
|
|
24
|
+
delivery: string
|
|
25
|
+
paymentMethod: string
|
|
26
|
+
paymentMethodTitles: {
|
|
27
|
+
card: string
|
|
28
|
+
cod: string
|
|
29
|
+
/** Offline manual payments (pp_manual) — NOT cash on delivery. */
|
|
30
|
+
manual: string
|
|
31
|
+
paypal: string
|
|
32
|
+
}
|
|
33
|
+
needHelp: string
|
|
34
|
+
contactUs: string
|
|
35
|
+
returnsExchanges: string
|
|
36
|
+
orderPlaced: string
|
|
37
|
+
processing: string
|
|
38
|
+
shipped: string
|
|
39
|
+
delivered: string
|
|
40
|
+
free: string
|
|
41
|
+
continueShopping: string
|
|
42
|
+
qty: string
|
|
43
|
+
/** Heading for the fulfillment tracking-numbers block (Cartbase addition). */
|
|
44
|
+
tracking: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const defaultOrderLabels: OrderLabels = {
|
|
48
|
+
orderConfirmed: "Order confirmed",
|
|
49
|
+
confirmationSent: "We sent a confirmation to",
|
|
50
|
+
orderNumber: "Order",
|
|
51
|
+
orderDate: "Date",
|
|
52
|
+
summary: "Order summary",
|
|
53
|
+
subtotal: "Subtotal",
|
|
54
|
+
shipping: "Shipping",
|
|
55
|
+
discount: "Discount",
|
|
56
|
+
tax: "Tax",
|
|
57
|
+
total: "Total",
|
|
58
|
+
paymentMethodFee: "Payment method fee",
|
|
59
|
+
contactInfo: "Contact info",
|
|
60
|
+
delivery: "Delivery",
|
|
61
|
+
paymentMethod: "Payment method",
|
|
62
|
+
paymentMethodTitles: {
|
|
63
|
+
card: "Credit / debit card",
|
|
64
|
+
cod: "Cash on delivery",
|
|
65
|
+
manual: "Manual payment",
|
|
66
|
+
paypal: "PayPal",
|
|
67
|
+
},
|
|
68
|
+
needHelp: "Need help?",
|
|
69
|
+
contactUs: "Contact us",
|
|
70
|
+
returnsExchanges: "Returns & exchanges",
|
|
71
|
+
orderPlaced: "Placed",
|
|
72
|
+
processing: "Processing",
|
|
73
|
+
shipped: "Shipped",
|
|
74
|
+
delivered: "Delivered",
|
|
75
|
+
free: "FREE",
|
|
76
|
+
continueShopping: "Continue shopping",
|
|
77
|
+
qty: "qty.",
|
|
78
|
+
tracking: "Tracking",
|
|
79
|
+
}
|
|
@@ -3,7 +3,7 @@ import { defaultOrderLabels, type OrderLabels } from "./labels"
|
|
|
3
3
|
/**
|
|
4
4
|
* Contact-info card (name, phone, email). Ported from
|
|
5
5
|
* `@1click/ui/src/order/order-address-card.tsx` (v2.3.1); data seam:
|
|
6
|
-
* structural pick —
|
|
6
|
+
* structural pick — Cartbase's `StoreOrderDetail` (with its embedded
|
|
7
7
|
* `order_addresses` row) satisfies it directly.
|
|
8
8
|
*/
|
|
9
9
|
export interface OrderContactData {
|
|
@@ -25,11 +25,11 @@ import { OrderHelpSection } from "./order-help-section"
|
|
|
25
25
|
/**
|
|
26
26
|
* Full order-confirmation page. Ported from
|
|
27
27
|
* `@1click/ui/src/order/order-completed-template.tsx` (v2.3.1) with the
|
|
28
|
-
*
|
|
29
|
-
* with totals, order totals, shipping methods and payments —
|
|
28
|
+
* Cartbase data seam: Medusa's `StoreOrder` was one object carrying items
|
|
29
|
+
* with totals, order totals, shipping methods and payments — Cartbase splits
|
|
30
30
|
* those across surfaces, so the template takes them as separate props:
|
|
31
31
|
*
|
|
32
|
-
* - `order` —
|
|
32
|
+
* - `order` — Cartbase `StoreOrderDetail` (or any structural equivalent:
|
|
33
33
|
* id/display_id/email/created_at/currency_code/metadata/addresses/
|
|
34
34
|
* fulfillments). The fulfillment timeline is derived from
|
|
35
35
|
* `order.fulfillments` internally.
|
|
@@ -40,9 +40,12 @@ import { OrderHelpSection } from "./order-help-section"
|
|
|
40
40
|
* `order.items` via `displayItemFromOrderItem` (prefer passing
|
|
41
41
|
* cart-derived lines via `displayItemFromCartLine` right after checkout
|
|
42
42
|
* to keep server-computed per-line discounts).
|
|
43
|
-
* - `shippingMethod` / `paymentProviderId` / `
|
|
44
|
-
* checkout state (decorated cart /
|
|
45
|
-
* delivery and payment cards render
|
|
43
|
+
* - `shippingMethod` / `paymentProviderId` / `paymentMethodName` /
|
|
44
|
+
* `cardLast4` — from the checkout state (decorated cart /
|
|
45
|
+
* prepare-checkout response); the delivery and payment cards render
|
|
46
|
+
* only what they are given. A merchant-method order passes
|
|
47
|
+
* `paymentMethodName` (its merchant name — the display everywhere
|
|
48
|
+
* since the pp_* kill) and no provider id.
|
|
46
49
|
*
|
|
47
50
|
* The Purchase tracking trio (fbq/gtag/rybbit, deduped by
|
|
48
51
|
* `order.display_id`) stays APP-OWNED: fire it from the confirmation
|
|
@@ -61,6 +64,8 @@ type OrderCompletedTemplateProps = {
|
|
|
61
64
|
items?: OrderDisplayItem[]
|
|
62
65
|
shippingMethod?: ShippingMethodDisplay | null
|
|
63
66
|
paymentProviderId?: string | null
|
|
67
|
+
/** The merchant method's name — wins over any provider bucket. */
|
|
68
|
+
paymentMethodName?: string | null
|
|
64
69
|
cardLast4?: string | null
|
|
65
70
|
labels?: OrderLabels
|
|
66
71
|
locale?: string
|
|
@@ -69,11 +74,12 @@ type OrderCompletedTemplateProps = {
|
|
|
69
74
|
/** Href for the bottom "continue shopping" CTA (source hardcoded /store). */
|
|
70
75
|
storeHref?: string
|
|
71
76
|
/**
|
|
72
|
-
* Per-store override for the
|
|
73
|
-
*
|
|
74
|
-
* then the fee line's title, then the translated
|
|
77
|
+
* Per-store override for the method-fee row in the totals breakdown.
|
|
78
|
+
* Optional — falls back to the server's `payment_method_fee_label`,
|
|
79
|
+
* then the fee line's title, then the translated
|
|
80
|
+
* `labels.paymentMethodFee`.
|
|
75
81
|
*/
|
|
76
|
-
|
|
82
|
+
methodFeeLabel?: string
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
export function OrderCompletedTemplate({
|
|
@@ -82,13 +88,14 @@ export function OrderCompletedTemplate({
|
|
|
82
88
|
items,
|
|
83
89
|
shippingMethod,
|
|
84
90
|
paymentProviderId,
|
|
91
|
+
paymentMethodName,
|
|
85
92
|
cardLast4,
|
|
86
93
|
labels,
|
|
87
94
|
locale,
|
|
88
95
|
contactHref,
|
|
89
96
|
returnsHref,
|
|
90
97
|
storeHref = "/store",
|
|
91
|
-
|
|
98
|
+
methodFeeLabel,
|
|
92
99
|
}: OrderCompletedTemplateProps) {
|
|
93
100
|
const l = { ...defaultOrderLabels, ...labels }
|
|
94
101
|
const displayItems =
|
|
@@ -119,7 +126,7 @@ export function OrderCompletedTemplate({
|
|
|
119
126
|
currencyCode={order.currency_code}
|
|
120
127
|
items={displayItems}
|
|
121
128
|
labels={l}
|
|
122
|
-
|
|
129
|
+
methodFeeLabel={methodFeeLabel}
|
|
123
130
|
/>
|
|
124
131
|
</div>
|
|
125
132
|
</div>
|
|
@@ -134,6 +141,7 @@ export function OrderCompletedTemplate({
|
|
|
134
141
|
/>
|
|
135
142
|
<OrderPaymentCard
|
|
136
143
|
providerId={paymentProviderId}
|
|
144
|
+
methodName={paymentMethodName}
|
|
137
145
|
cardLast4={cardLast4}
|
|
138
146
|
labels={l}
|
|
139
147
|
/>
|
|
@@ -4,7 +4,7 @@ import { defaultOrderLabels, type OrderLabels } from "./labels"
|
|
|
4
4
|
/**
|
|
5
5
|
* Confirmation hero (check mark + order number + date). Ported from
|
|
6
6
|
* `@1click/ui/src/order/order-confirmation-header.tsx` (v2.3.1); data
|
|
7
|
-
* seam: structural pick instead of Medusa's `StoreOrder` — both
|
|
7
|
+
* seam: structural pick instead of Medusa's `StoreOrder` — both Cartbase's
|
|
8
8
|
* `StoreOrderDetail` and `completeCart()`'s `CompletedOrder` satisfy it.
|
|
9
9
|
*/
|
|
10
10
|
export interface OrderHeaderData {
|
|
@@ -5,17 +5,17 @@ import { defaultOrderLabels, type OrderLabels } from "./labels"
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Delivery card: pickup point / address, shipping method row, and — new in
|
|
8
|
-
* the
|
|
8
|
+
* the Cartbase port — the fulfillment tracking labels. Ported from
|
|
9
9
|
* `@1click/ui/src/order/order-delivery-card.tsx` (v2.3.1) with these seam
|
|
10
10
|
* translations:
|
|
11
11
|
*
|
|
12
|
-
* - Medusa's `order.shipping_methods[0]` embed does not exist on
|
|
12
|
+
* - Medusa's `order.shipping_methods[0]` embed does not exist on Cartbase's
|
|
13
13
|
* `StoreOrderDetail`; the method comes via the `shippingMethod` prop
|
|
14
14
|
* (structural — `api/carts` `CartShippingMethod` from the decorated
|
|
15
15
|
* cart on the confirmation page satisfies it; `data` still carries the
|
|
16
16
|
* fulfillment-option id used for the pickup detection below).
|
|
17
17
|
* - `order.fulfillments[].fulfillment.labels` (tracking_number /
|
|
18
|
-
* tracking_url) ARE on the
|
|
18
|
+
* tracking_url) ARE on the Cartbase surface (docs/storefront/orders.md);
|
|
19
19
|
* `pickTrackingLabels()` selects the renderable ones and the card shows
|
|
20
20
|
* them under a `labels.tracking` heading.
|
|
21
21
|
* - Pickup detection preserved verbatim: `metadata.econt_office_code` (the
|
package/src/order/order-item.tsx
CHANGED
|
@@ -6,10 +6,10 @@ import { defaultOrderLabels, type OrderLabels } from "./labels"
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Order line row. Ported from `@1click/ui/src/order/order-item.tsx`
|
|
9
|
-
* (v2.3.1) with the data seam translated to
|
|
9
|
+
* (v2.3.1) with the data seam translated to Cartbase:
|
|
10
10
|
*
|
|
11
11
|
* Medusa's `StoreOrderLineItem` carried per-line computed totals
|
|
12
|
-
* (`total` / `original_total`).
|
|
12
|
+
* (`total` / `original_total`). Cartbase's store order surface does NOT —
|
|
13
13
|
* `StoreOrderDetail.items` are version-pivot rows (`{quantity, line_item}`)
|
|
14
14
|
* whose embedded `order_line_items` row carries only `unit_price` (see
|
|
15
15
|
* docs/storefront/orders.md). The component therefore renders a normalized
|
|
@@ -5,7 +5,7 @@ import { defaultOrderLabels, type OrderLabels } from "./labels"
|
|
|
5
5
|
/**
|
|
6
6
|
* Order items list. Ported from `@1click/ui/src/order/order-items-list.tsx`
|
|
7
7
|
* (v2.3.1); data seam: takes normalized `OrderDisplayItem[]` (see
|
|
8
|
-
* `order-item.tsx` converters) + the currency, since
|
|
8
|
+
* `order-item.tsx` converters) + the currency, since Cartbase's
|
|
9
9
|
* `StoreOrderDetail` carries no order-level computed fields beyond
|
|
10
10
|
* `currency_code`.
|
|
11
11
|
*/
|
|
@@ -23,9 +23,9 @@ export function OrderItemsList({
|
|
|
23
23
|
const l = { ...defaultOrderLabels, ...labels }
|
|
24
24
|
// Render product lines only — backend-injected fee lines (legacy COD-fee
|
|
25
25
|
// line items tagged `metadata.is_cod_fee`) are hidden here and surfaced
|
|
26
|
-
// as a dedicated row in OrderTotals instead.
|
|
26
|
+
// as a dedicated row in OrderTotals instead. Cartbase's NATIVE COD fee is
|
|
27
27
|
// never a line item (order_summaries.totals.cod_fee_total), so on pure
|
|
28
|
-
//
|
|
28
|
+
// Cartbase data this filter is a no-op safety net.
|
|
29
29
|
const visible = (items || []).filter((i) => isProductLine(i))
|
|
30
30
|
|
|
31
31
|
return (
|