@salifbiaye/create-boutique 0.2.1 → 0.2.3
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/package.json +1 -1
- package/templates/storefront/locales/en.json +4 -1
- package/templates/storefront/locales/fr.json +4 -1
- package/templates/storefront/src/modules/account/components/order-card/index.tsx +2 -1
- package/templates/storefront/src/modules/checkout/components/payment/index.tsx +14 -0
- package/templates/storefront/src/modules/checkout/components/payment-wrapper/index.tsx +1 -1
- package/templates/storefront/src/modules/checkout/templates/checkout-form/index.tsx +6 -1
- package/templates/storefront/src/modules/common/components/line-item-options/index.tsx +2 -1
- package/templates/storefront/src/modules/common/components/local-date/index.tsx +9 -0
- package/templates/storefront/src/modules/order/components/order-details/index.tsx +2 -1
- package/templates/storefront/src/modules/order/components/shipping-details/index.tsx +1 -1
- package/templates/storefront/src/styles/ub/forms.css +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salifbiaye/create-boutique",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Usine à Boutiques : génère un projet complet (backend Medusa + une boutique Next.js par campagne) prêt pour docker compose",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": { "type": "git", "url": "git+https://github.com/salifbiaye/create-boutique.git" },
|
|
@@ -302,5 +302,8 @@
|
|
|
302
302
|
"account.keepShopping": "Shop the deals",
|
|
303
303
|
"account.profileDone": "Profile completed",
|
|
304
304
|
"account.completeProfile": "Complete your profile (phone, billing address) to check out faster.",
|
|
305
|
-
"nav.menu": "Menu"
|
|
305
|
+
"nav.menu": "Menu",
|
|
306
|
+
"cart.variant": "Variant:",
|
|
307
|
+
"checkout.testMode.title": "Demo store: no real payment",
|
|
308
|
+
"checkout.testMode.text": "Card payments are in test mode: you will not be charged. Use the test card below with any future expiry date (e.g. 12/34) and any CVC (e.g. 123)."
|
|
306
309
|
}
|
|
@@ -302,5 +302,8 @@
|
|
|
302
302
|
"account.keepShopping": "Voir les offres",
|
|
303
303
|
"account.profileDone": "Profil complété",
|
|
304
304
|
"account.completeProfile": "Complétez votre profil (téléphone, adresse de facturation) pour commander plus vite.",
|
|
305
|
-
"nav.menu": "Menu"
|
|
305
|
+
"nav.menu": "Menu",
|
|
306
|
+
"cart.variant": "Variante :",
|
|
307
|
+
"checkout.testMode.title": "Boutique de démonstration : aucun paiement réel",
|
|
308
|
+
"checkout.testMode.text": "Le paiement par carte est en mode test : aucune somme ne sera débitée. Utilisez la carte de test ci-dessous, avec une date d'expiration future (ex. 12/34) et n'importe quel code (ex. 123)."
|
|
306
309
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { T } from "@lib/boutique/i18n-client"
|
|
2
|
+
import LocalDate from "@modules/common/components/local-date"
|
|
2
3
|
import { Button } from "@medusajs/ui"
|
|
3
4
|
import { useMemo } from "react"
|
|
4
5
|
|
|
@@ -31,7 +32,7 @@ const OrderCard = ({ order }: OrderCardProps) => {
|
|
|
31
32
|
</div>
|
|
32
33
|
<div className="flex items-center divide-x divide-gray-200 text-small-regular text-ui-fg-base">
|
|
33
34
|
<span className="pr-2" data-testid="order-created-at">
|
|
34
|
-
{
|
|
35
|
+
<LocalDate iso={order.created_at} style="medium" />
|
|
35
36
|
</span>
|
|
36
37
|
<span className="px-2" data-testid="order-amount">
|
|
37
38
|
{convertToLocale({
|
|
@@ -19,9 +19,12 @@ import { useCallback, useEffect, useState } from "react"
|
|
|
19
19
|
const Payment = ({
|
|
20
20
|
cart,
|
|
21
21
|
availablePaymentMethods,
|
|
22
|
+
testMode = false,
|
|
22
23
|
}: {
|
|
23
24
|
cart: any
|
|
24
25
|
availablePaymentMethods: any[]
|
|
26
|
+
/** Clé Stripe de test : affiche la carte de test à utiliser (aucun paiement réel) */
|
|
27
|
+
testMode?: boolean
|
|
25
28
|
}) => {
|
|
26
29
|
const activeSession = cart.payment_collection?.payment_sessions?.find(
|
|
27
30
|
(paymentSession: any) => paymentSession.status === "pending"
|
|
@@ -137,6 +140,17 @@ const Payment = ({
|
|
|
137
140
|
</div>
|
|
138
141
|
<div>
|
|
139
142
|
<div className={isOpen ? "block" : "hidden"}>
|
|
143
|
+
{testMode && (
|
|
144
|
+
<div className="ub-testpay" role="note" data-testid="stripe-test-mode">
|
|
145
|
+
<b>
|
|
146
|
+
<T k="checkout.testMode.title" />
|
|
147
|
+
</b>
|
|
148
|
+
<span>
|
|
149
|
+
<T k="checkout.testMode.text" />
|
|
150
|
+
</span>
|
|
151
|
+
<code>4242 4242 4242 4242</code>
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
140
154
|
{!paidByGiftcard && availablePaymentMethods?.length && (
|
|
141
155
|
<>
|
|
142
156
|
<RadioGroup
|
|
@@ -14,7 +14,7 @@ type PaymentWrapperProps = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const PaymentWrapper: React.FC<PaymentWrapperProps> = ({ cart, stripeKey, children }) => {
|
|
17
|
-
const stripePromise = useMemo(() => (stripeKey ? loadStripe(stripeKey) : null), [stripeKey])
|
|
17
|
+
const stripePromise = useMemo(() => (stripeKey ? loadStripe(stripeKey, { developerTools: { assistant: { enabled: false } } }) : null), [stripeKey])
|
|
18
18
|
|
|
19
19
|
const paymentSession = cart.payment_collection?.payment_sessions?.find(
|
|
20
20
|
(s) => s.status === "pending"
|
|
@@ -30,7 +30,12 @@ export default async function CheckoutForm({
|
|
|
30
30
|
|
|
31
31
|
<Shipping cart={cart} availableShippingMethods={shippingMethods} />
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
{/* Clé Stripe de test : bandeau « aucun paiement réel » + carte de test (disparaît avec une clé pk_live_) */}
|
|
34
|
+
<Payment
|
|
35
|
+
cart={cart}
|
|
36
|
+
availablePaymentMethods={paymentMethods}
|
|
37
|
+
testMode={!!process.env.STRIPE_PUBLISHABLE_KEY?.startsWith("pk_test_")}
|
|
38
|
+
/>
|
|
34
39
|
|
|
35
40
|
<Review cart={cart} />
|
|
36
41
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { T } from "@lib/boutique/i18n-client"
|
|
1
2
|
import { HttpTypes } from "@medusajs/types"
|
|
2
3
|
import { Text } from "@medusajs/ui"
|
|
3
4
|
|
|
@@ -18,7 +19,7 @@ const LineItemOptions = ({
|
|
|
18
19
|
data-value={dataValue}
|
|
19
20
|
className="inline-block txt-medium text-ui-fg-subtle w-full overflow-hidden text-ellipsis"
|
|
20
21
|
>
|
|
21
|
-
|
|
22
|
+
<T k="cart.variant" /> {variant?.title}
|
|
22
23
|
</Text>
|
|
23
24
|
)
|
|
24
25
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useLocale } from "@lib/boutique/i18n-client"
|
|
4
|
+
|
|
5
|
+
/** Date formatée dans la langue et le pays de la boutique (ex. « 29 septembre 2026 » en fr-FR). */
|
|
6
|
+
export default function LocalDate({ iso, style = "long" }: { iso: string | Date; style?: "long" | "medium" | "short" }) {
|
|
7
|
+
const locale = useLocale()
|
|
8
|
+
return <>{new Date(iso).toLocaleDateString(locale, { dateStyle: style })}</>
|
|
9
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { T } from "@lib/boutique/i18n-client"
|
|
2
|
+
import LocalDate from "@modules/common/components/local-date"
|
|
2
3
|
import { HttpTypes } from "@medusajs/types"
|
|
3
4
|
import { Text } from "@medusajs/ui"
|
|
4
5
|
|
|
@@ -29,7 +30,7 @@ const OrderDetails = ({ order, showStatus }: OrderDetailsProps) => {
|
|
|
29
30
|
<Text className="mt-2">
|
|
30
31
|
<T k="order.date" />{" "}
|
|
31
32
|
<span data-testid="order-date">
|
|
32
|
-
{
|
|
33
|
+
<LocalDate iso={order.created_at} />
|
|
33
34
|
</span>
|
|
34
35
|
</Text>
|
|
35
36
|
<Text className="mt-2 text-ui-fg-interactive">
|
|
@@ -55,7 +55,7 @@ const ShippingDetails = ({ order }: ShippingDetailsProps) => {
|
|
|
55
55
|
className="flex flex-col w-1/3"
|
|
56
56
|
data-testid="shipping-method-summary"
|
|
57
57
|
>
|
|
58
|
-
<Text className="txt-medium-plus text-ui-fg-base mb-1"
|
|
58
|
+
<Text className="txt-medium-plus text-ui-fg-base mb-1"><T k="order.method" /></Text>
|
|
59
59
|
<Text className="txt-medium text-ui-fg-subtle">
|
|
60
60
|
{(order as any).shipping_methods[0]?.name} (
|
|
61
61
|
{convertToLocale({
|
|
@@ -59,3 +59,29 @@
|
|
|
59
59
|
pointer-events: none;
|
|
60
60
|
}
|
|
61
61
|
.ub-phone[data-invalid] .ub-phone__field input { border-color: var(--sale); }
|
|
62
|
+
|
|
63
|
+
/* Paiement en mode test (clé Stripe pk_test_) : carte de test à utiliser, aucun débit réel */
|
|
64
|
+
.ub-testpay {
|
|
65
|
+
display: grid;
|
|
66
|
+
gap: 6px;
|
|
67
|
+
margin-bottom: var(--space-4);
|
|
68
|
+
padding: var(--space-4);
|
|
69
|
+
border: 1px dashed var(--primary);
|
|
70
|
+
border-radius: var(--ub-r-card);
|
|
71
|
+
background: color-mix(in srgb, var(--primary) 10%, transparent);
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
line-height: 21px;
|
|
74
|
+
}
|
|
75
|
+
.ub-testpay b { font-size: 15px; }
|
|
76
|
+
.ub-testpay span { color: var(--ink-muted); }
|
|
77
|
+
.ub-testpay code {
|
|
78
|
+
justify-self: start;
|
|
79
|
+
margin-top: 4px;
|
|
80
|
+
padding: 6px 12px;
|
|
81
|
+
border-radius: var(--radius-sm);
|
|
82
|
+
background: var(--ink);
|
|
83
|
+
color: var(--bg);
|
|
84
|
+
font: 700 15px/20px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
85
|
+
letter-spacing: 0.06em;
|
|
86
|
+
user-select: all;
|
|
87
|
+
}
|