@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.
Files changed (106) hide show
  1. package/README.md +3 -3
  2. package/package.json +231 -226
  3. package/src/api/auth.ts +1 -1
  4. package/src/api/carts.ts +5 -3
  5. package/src/api/checkout.ts +91 -40
  6. package/src/api/consent.ts +2 -2
  7. package/src/api/integrations.ts +4 -17
  8. package/src/api/regions.ts +1 -1
  9. package/src/cart-drawer/context.tsx +4 -4
  10. package/src/cart-drawer/cross-sell-carousel.tsx +1 -1
  11. package/src/cart-drawer/cross-sell-sidebar.tsx +1 -1
  12. package/src/cart-drawer/header.tsx +1 -1
  13. package/src/cart-drawer/item/index.tsx +2 -2
  14. package/src/cart-drawer/item/quantity.tsx +2 -2
  15. package/src/cart-drawer/item/upsell.tsx +3 -3
  16. package/src/cart-drawer/item/variant.tsx +2 -2
  17. package/src/cart-drawer/labels-bg.ts +2 -2
  18. package/src/cart-drawer/labels.ts +119 -119
  19. package/src/cart-drawer/summary-breakdown.tsx +197 -196
  20. package/src/cart-drawer/template.tsx +2 -2
  21. package/src/cart-drawer/tiered-progress.tsx +1 -1
  22. package/src/checkout/address-error-copy.ts +3 -3
  23. package/src/checkout/address-form.tsx +2 -2
  24. package/src/checkout/address-select.tsx +1 -1
  25. package/src/checkout/boxnow-locker-selector.tsx +3 -3
  26. package/src/checkout/checkout-client.tsx +15 -12
  27. package/src/checkout/company-details.tsx +1 -1
  28. package/src/checkout/compare-addresses.ts +1 -1
  29. package/src/checkout/discount-section.tsx +5 -5
  30. package/src/checkout/econt-office-selector.tsx +2 -2
  31. package/src/checkout/gift-card-section.tsx +2 -2
  32. package/src/checkout/index.ts +0 -1
  33. package/src/checkout/labels-bg.ts +2 -2
  34. package/src/checkout/labels.ts +263 -263
  35. package/src/checkout/line-item-card.tsx +2 -2
  36. package/src/checkout/order-summary.tsx +48 -48
  37. package/src/checkout/payment-button.tsx +4 -4
  38. package/src/checkout/payment-error-copy.ts +6 -6
  39. package/src/checkout/payment-method-list.tsx +93 -33
  40. package/src/checkout/payment-wrapper.tsx +8 -11
  41. package/src/checkout/promotion-error-copy.ts +2 -2
  42. package/src/checkout/shipping-method-list.tsx +2 -2
  43. package/src/checkout/stripe-wrapper.tsx +1 -1
  44. package/src/checkout/use-checkout-orchestration.ts +108 -98
  45. package/src/common/cart-button-client.tsx +1 -1
  46. package/src/common/cart-button.tsx +1 -1
  47. package/src/common/country-select.tsx +2 -2
  48. package/src/common/delete-button.tsx +1 -1
  49. package/src/common/index.ts +1 -1
  50. package/src/common/language-select.tsx +2 -2
  51. package/src/common/localized-link.tsx +1 -1
  52. package/src/lib/cart-helpers.ts +2 -2
  53. package/src/lib/cookie-names.ts +41 -0
  54. package/src/lib/get-product-price.ts +3 -3
  55. package/src/lib/payment-constants.ts +53 -66
  56. package/src/lib/store-api-error.ts +1 -1
  57. package/src/order/index.ts +1 -1
  58. package/src/order/labels-bg.ts +39 -39
  59. package/src/order/labels.ts +79 -79
  60. package/src/order/order-address-card.tsx +1 -1
  61. package/src/order/order-completed-template.tsx +20 -12
  62. package/src/order/order-confirmation-header.tsx +1 -1
  63. package/src/order/order-delivery-card.tsx +3 -3
  64. package/src/order/order-item.tsx +2 -2
  65. package/src/order/order-items-list.tsx +3 -3
  66. package/src/order/order-payment-card.tsx +27 -36
  67. package/src/order/order-timeline.tsx +2 -2
  68. package/src/order/order-totals.tsx +250 -245
  69. package/src/platform/identity.ts +18 -0
  70. package/src/platform/index.ts +8 -0
  71. package/src/platform/metadata.ts +26 -0
  72. package/src/platform/platform-init.tsx +46 -0
  73. package/src/products/image-gallery.tsx +1 -1
  74. package/src/products/mobile-actions.tsx +1 -1
  75. package/src/products/option-select.tsx +1 -1
  76. package/src/products/preview-price.tsx +1 -1
  77. package/src/products/product-actions.tsx +6 -6
  78. package/src/products/product-info.tsx +1 -1
  79. package/src/products/product-preview.tsx +1 -1
  80. package/src/products/product-price.tsx +2 -2
  81. package/src/products/product-tabs.tsx +1 -1
  82. package/src/products/purchase-options.tsx +1 -1
  83. package/src/products/related-products.tsx +3 -3
  84. package/src/products/variant-matching.ts +4 -4
  85. package/src/reviews-ui/labels.ts +1 -1
  86. package/src/reviews-ui/photo-upload.tsx +1 -1
  87. package/src/reviews-ui/review-list.tsx +1 -1
  88. package/src/reviews-ui/review-widget.tsx +1 -1
  89. package/src/reviews-ui/review-wizard.tsx +1 -1
  90. package/src/reviews-ui/wizard-state.ts +1 -1
  91. package/src/store/category-template.tsx +2 -2
  92. package/src/store/collection-template.tsx +2 -2
  93. package/src/store/labels.ts +2 -2
  94. package/src/store/paginated-products.tsx +1 -1
  95. package/src/store/search-params.ts +1 -1
  96. package/src/store/search-template.tsx +1 -1
  97. package/src/tracking/consent-banner.tsx +1 -1
  98. package/src/tracking/consent-init.tsx +1 -1
  99. package/src/tracking/consent.ts +6 -6
  100. package/src/tracking/fbq.ts +2 -2
  101. package/src/tracking/get-tracking-attribution.ts +1 -1
  102. package/src/tracking/get-tracking-config.ts +2 -2
  103. package/src/tracking/index.ts +2 -2
  104. package/src/tracking/meta-pixel.tsx +1 -1
  105. package/src/tracking/rybbit.tsx +1 -1
  106. package/src/tracking/types.ts +6 -6
@@ -1,66 +1,53 @@
1
- /**
2
- * Payment provider helpers — identifier sniffing for store payment sessions.
3
- *
4
- * Ported from `@1click/ui/src/lib/payment-constants.ts` (v2.3.1) and
5
- * translated to the barter provider-id seam (code truth:
6
- * `src/lib/stripe/providers.ts isStripeProviderId` matches exactly
7
- * `"pp_stripe" | "stripe"`; the accepted checkout ids are
8
- * `pp_stripe | pp_cod | pp_manual` — docs/contracts/store-api.md).
9
- * `pp_system_default` is the RETIRED legacy manual twin (payments-registry
10
- * card): no longer provisioned, hidden from merchants, kept here only so
11
- * historic orders keep rendering. The Medusa-era prefixes (`pp_stripe_*`,
12
- * `pp_medusa-*`) are kept as fallbacks so components ported later keep
13
- * working against either wire.
14
- *
15
- * Intentionally ships NO icons stores render their own icons via their
16
- * own icon set. The library stays free of icon-kit imports at this layer.
17
- */
18
-
19
- /**
20
- * True if the provider id is a Stripe-backed card payment provider.
21
- * Barter's canonical ids first (`pp_stripe` / `stripe`), then the
22
- * Medusa-era prefixes (`pp_stripe_*`, `pp_medusa-*`).
23
- */
24
- export const isStripeLike = (providerId?: string): boolean => {
25
- return Boolean(
26
- providerId &&
27
- (providerId === "pp_stripe" ||
28
- providerId === "stripe" ||
29
- providerId.startsWith("pp_stripe_") ||
30
- providerId.startsWith("pp_medusa-"))
31
- )
32
- }
33
-
34
- /** True if the provider id is PayPal. */
35
- export const isPaypal = (providerId?: string): boolean => {
36
- return Boolean(providerId?.startsWith("pp_paypal"))
37
- }
38
-
39
- /**
40
- * True if the provider id is an offline/manual provider: `pp_manual` (the
41
- * id checkout actually charges — payments-registry card) with the retired
42
- * `pp_system_default*` legacy twin as fallback for historic orders. COD is
43
- * NOT manual — `pp_cod` has its own id and its own fee flow.
44
- */
45
- export const isManual = (providerId?: string): boolean => {
46
- return Boolean(
47
- providerId &&
48
- (providerId === "pp_manual" || providerId.startsWith("pp_system_default"))
49
- )
50
- }
51
-
52
- export const paymentInfoMap: Record<
53
- string,
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 barter error contract (`StoreApiError`
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:
@@ -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 barter data seams; see
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"
@@ -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
- codFee: "Такса наложен платеж",
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
+ }
@@ -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 barter port because the
4
- * barter 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
- * `cod_fee_label` / fee line title is available. */
22
- codFee: 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 (barter 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
- codFee: "Cash on delivery 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
- }
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 — barter's `StoreOrderDetail` (with its embedded
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
- * barter data seam: Medusa's `StoreOrder` was one object carrying items
29
- * with totals, order totals, shipping methods and payments — barter splits
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` — barter `StoreOrderDetail` (or any structural equivalent:
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` / `cardLast4` — from the
44
- * checkout state (decorated cart / prepare-checkout response); the
45
- * delivery and payment cards render only what they are given.
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 cash-on-delivery fee row in the totals
73
- * breakdown. Optional — falls back to the server's `cod_fee_label`,
74
- * then the fee line's title, then the translated `labels.codFee`.
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
- codFeeLabel?: string
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
- codFeeLabel,
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
- codFeeLabel={codFeeLabel}
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 barter's
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 barter port — the fulfillment tracking labels. Ported from
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 barter's
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 barter surface (docs/storefront/orders.md);
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
@@ -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 barter:
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`). Barter's store order surface does NOT —
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 barter's
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. barter's NATIVE COD fee is
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
- // barter data this filter is a no-op safety net.
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 (