@lockerverse/react 0.2.223-dev.1 → 0.2.224-dev.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/MIGRATIONS.md +10 -0
- package/dist/booking-payment.d.ts.map +1 -1
- package/dist/booking-payment.js +1 -1
- package/dist/booking-payment.js.map +1 -1
- package/guides/auctions.md +1 -1
- package/guides/bookings.md +1 -1
- package/guides/events.md +1 -1
- package/guides/integration.md +1 -1
- package/guides/payment-widgets.md +1 -1
- package/guides/signup.md +1 -1
- package/package.json +2 -2
package/MIGRATIONS.md
CHANGED
|
@@ -4,6 +4,16 @@ This file ships in both @lockerverse/sdk and @lockerverse/react. Use the copy in
|
|
|
4
4
|
the target installed release. This is an agent-run procedure, not an install
|
|
5
5
|
script. Installing a package does not edit host code or guarantee these steps ran.
|
|
6
6
|
|
|
7
|
+
## 0.2.224-dev.1 — clearer booking payment messages
|
|
8
|
+
|
|
9
|
+
- **Affected:** the optional React booking payment component.
|
|
10
|
+
- **Automatic:** card loading and payment result messages use customer language.
|
|
11
|
+
Payment locks and saved-booking recovery are unchanged.
|
|
12
|
+
- **Required:** update the matching SDK/React pair and deploy the host. No API or
|
|
13
|
+
prop changes are needed. Other consumers need no integration edits.
|
|
14
|
+
- **Check:** a card loading error asks the customer to reload and check the booking
|
|
15
|
+
before another payment.
|
|
16
|
+
|
|
7
17
|
## 0.2.223-dev.1 — optional bookings
|
|
8
18
|
|
|
9
19
|
- No change is required for existing checkout, signup, auction or event consumers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking-payment.d.ts","names":[],"sources":["../src/booking-payment.tsx"],"mappings":";;;KAaY;EACV;EACA;EACA;EACA,YACE,8BACG,QAAQ,6BAA6B;EAC1C;EACA;EACA;EACA,cAAc;;;
|
|
1
|
+
{"version":3,"file":"booking-payment.d.ts","names":[],"sources":["../src/booking-payment.tsx"],"mappings":";;;KAaY;EACV;EACA;EACA;EACA,YACE,8BACG,QAAQ,6BAA6B;EAC1C;EACA;EACA;EACA,cAAc;;;iBA0EA,0BACd,OAAO,iDAA8B,IAAA"}
|
package/dist/booking-payment.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useEffect as e,useRef as t,useState as n}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{Elements as a,PaymentElement as o,useElements as s,useStripe as c}from"@stripe/react-stripe-js";import{loadStripe as l}from"@stripe/stripe-js/pure/index.js";const u=/^pk_(?:test|live)_/;function d(e){let a=c(),l=s(),u=t(!1),d=t(!1),[f,p]=n(!1),[m,h]=n(!1),[g,_]=n(``);async function v(){if(!(!(a&&l&&m)||e.disabled||u.current||d.current)){u.current=!0,p(!0),_(``);try{if((await l.submit()).error){_(`Check your card details.`);return}let t=await a.createConfirmationToken({elements:l});if(t.error||!t.confirmationToken){_(`Card details could not be confirmed. No payment was submitted.`);return}d.current=!0,await e.onConfirm(t.confirmationToken.id)}catch{_(`
|
|
1
|
+
import{useEffect as e,useRef as t,useState as n}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{Elements as a,PaymentElement as o,useElements as s,useStripe as c}from"@stripe/react-stripe-js";import{loadStripe as l}from"@stripe/stripe-js/pure/index.js";const u=/^pk_(?:test|live)_/;function d(e){let a=c(),l=s(),u=t(!1),d=t(!1),[f,p]=n(!1),[m,h]=n(!1),[g,_]=n(``);async function v(){if(!(!(a&&l&&m)||e.disabled||u.current||d.current)){u.current=!0,p(!0),_(``);try{if((await l.submit()).error){_(`Check your card details.`);return}let t=await a.createConfirmationToken({elements:l});if(t.error||!t.confirmationToken){_(`Card details could not be confirmed. No payment was submitted.`);return}d.current=!0,await e.onConfirm(t.confirmationToken.id)}catch{_(`We could not confirm the result. Check your booking status before trying to pay again.`)}finally{u.current=!1,p(!1)}}}return i(`div`,{className:e.className,children:[r(o,{onLoadError:()=>{h(!1),_(`Card entry could not load. Reload the page to check your booking before trying to pay again.`)},onReady:()=>h(!0),options:{wallets:{applePay:`never`,googlePay:`never`}}}),!(m||g)&&r(`p`,{role:`status`,children:`Loading secure card entry…`}),g&&r(`p`,{role:`alert`,children:g}),r(`button`,{className:e.buttonClassName,disabled:!m||f||d.current||e.disabled,onClick:v,type:`button`,children:f?`Checking payment…`:e.buttonLabel??`Pay and book`})]})}function f(t){let[i,o]=n(null),[s,c]=n(!1),f=`${t.publishableKey}:${t.amountCents}:${t.currency}`,[p]=n(f);if(f!==p)throw Error(`Remount booking payment when its confirmed payment configuration changes.`);if(!(u.test(t.publishableKey)&&Number.isSafeInteger(t.amountCents))||t.amountCents<=0||t.currency!==`USD`)throw TypeError(`A valid server-provided booking payment configuration is required.`);return e(()=>{let e=!0;return l(t.publishableKey).then(t=>{e&&(o(t),c(!t))}).catch(()=>{e&&c(!0)}),()=>{e=!1}},[t.publishableKey]),s?r(`p`,{role:`alert`,children:`Secure card entry could not load. Reload the page to check your booking before trying to pay again.`}):i?r(a,{options:{allowedPaymentMethodTypes:[`card`],amount:t.amountCents,currency:`usd`,mode:`payment`,setupFutureUsage:`off_session`},stripe:i,children:r(d,{...t})}):r(`p`,{role:`status`,children:`Loading secure card entry…`})}export{f as LockerverseBookingPayment};
|
|
2
2
|
//# sourceMappingURL=booking-payment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking-payment.js","names":[],"sources":["../src/booking-payment.tsx"],"sourcesContent":["import type { LockerverseBookingAttempt } from \"@lockerverse/sdk/bookings\";\nimport {\n Elements,\n PaymentElement,\n useElements,\n useStripe,\n} from \"@stripe/react-stripe-js\";\nimport type { Stripe } from \"@stripe/stripe-js\";\nimport { loadStripe } from \"@stripe/stripe-js/pure\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\n\nconst publishableKeyPattern = /^pk_(?:test|live)_/;\n\nexport type LockerverseBookingPaymentProps = {\n publishableKey: string;\n amountCents: number;\n currency: \"USD\";\n onConfirm: (\n confirmationToken: string\n ) => Promise<LockerverseBookingAttempt> | Promise<void>;\n disabled?: boolean;\n className?: string;\n buttonClassName?: string;\n buttonLabel?: ReactNode;\n};\n\nfunction BookingCardForm(props: LockerverseBookingPaymentProps) {\n const stripe = useStripe();\n const elements = useElements();\n const submitting = useRef(false);\n const sentToBackend = useRef(false);\n const [busy, setBusy] = useState(false);\n const [ready, setReady] = useState(false);\n const [error, setError] = useState(\"\");\n async function submit() {\n if (\n !(stripe && elements && ready) ||\n props.disabled ||\n submitting.current ||\n sentToBackend.current\n ) {\n return;\n }\n submitting.current = true;\n setBusy(true);\n setError(\"\");\n try {\n const submitted = await elements.submit();\n if (submitted.error) {\n setError(\"Check your card details.\");\n return;\n }\n const result = await stripe.createConfirmationToken({ elements });\n if (result.error || !result.confirmationToken) {\n setError(\n \"Card details could not be confirmed. No payment was submitted.\"\n );\n return;\n }\n sentToBackend.current = true;\n await props.onConfirm(result.confirmationToken.id);\n } catch {\n setError(\"
|
|
1
|
+
{"version":3,"file":"booking-payment.js","names":[],"sources":["../src/booking-payment.tsx"],"sourcesContent":["import type { LockerverseBookingAttempt } from \"@lockerverse/sdk/bookings\";\nimport {\n Elements,\n PaymentElement,\n useElements,\n useStripe,\n} from \"@stripe/react-stripe-js\";\nimport type { Stripe } from \"@stripe/stripe-js\";\nimport { loadStripe } from \"@stripe/stripe-js/pure\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\n\nconst publishableKeyPattern = /^pk_(?:test|live)_/;\n\nexport type LockerverseBookingPaymentProps = {\n publishableKey: string;\n amountCents: number;\n currency: \"USD\";\n onConfirm: (\n confirmationToken: string\n ) => Promise<LockerverseBookingAttempt> | Promise<void>;\n disabled?: boolean;\n className?: string;\n buttonClassName?: string;\n buttonLabel?: ReactNode;\n};\n\nfunction BookingCardForm(props: LockerverseBookingPaymentProps) {\n const stripe = useStripe();\n const elements = useElements();\n const submitting = useRef(false);\n const sentToBackend = useRef(false);\n const [busy, setBusy] = useState(false);\n const [ready, setReady] = useState(false);\n const [error, setError] = useState(\"\");\n async function submit() {\n if (\n !(stripe && elements && ready) ||\n props.disabled ||\n submitting.current ||\n sentToBackend.current\n ) {\n return;\n }\n submitting.current = true;\n setBusy(true);\n setError(\"\");\n try {\n const submitted = await elements.submit();\n if (submitted.error) {\n setError(\"Check your card details.\");\n return;\n }\n const result = await stripe.createConfirmationToken({ elements });\n if (result.error || !result.confirmationToken) {\n setError(\n \"Card details could not be confirmed. No payment was submitted.\"\n );\n return;\n }\n sentToBackend.current = true;\n await props.onConfirm(result.confirmationToken.id);\n } catch {\n setError(\n \"We could not confirm the result. Check your booking status before trying to pay again.\"\n );\n } finally {\n submitting.current = false;\n setBusy(false);\n }\n }\n return (\n <div className={props.className}>\n <PaymentElement\n onLoadError={() => {\n setReady(false);\n setError(\n \"Card entry could not load. Reload the page to check your booking before trying to pay again.\"\n );\n }}\n onReady={() => setReady(true)}\n options={{ wallets: { applePay: \"never\", googlePay: \"never\" } }}\n />\n {!(ready || error) && <p role=\"status\">Loading secure card entry…</p>}\n {error && <p role=\"alert\">{error}</p>}\n <button\n className={props.buttonClassName}\n disabled={!ready || busy || sentToBackend.current || props.disabled}\n onClick={submit}\n type=\"button\"\n >\n {busy ? \"Checking payment…\" : (props.buttonLabel ?? \"Pay and book\")}\n </button>\n </div>\n );\n}\n\n/** Import this entry only when the recovered attempt is ready for card entry. */\nexport function LockerverseBookingPayment(\n props: LockerverseBookingPaymentProps\n) {\n const [stripe, setStripe] = useState<Stripe | null>(null);\n const [failed, setFailed] = useState(false);\n const identity = `${props.publishableKey}:${props.amountCents}:${props.currency}`;\n const [initialIdentity] = useState(identity);\n if (identity !== initialIdentity) {\n throw new Error(\n \"Remount booking payment when its confirmed payment configuration changes.\"\n );\n }\n if (\n !(\n publishableKeyPattern.test(props.publishableKey) &&\n Number.isSafeInteger(props.amountCents)\n ) ||\n props.amountCents <= 0 ||\n props.currency !== \"USD\"\n ) {\n throw new TypeError(\n \"A valid server-provided booking payment configuration is required.\"\n );\n }\n useEffect(() => {\n let active = true;\n loadStripe(props.publishableKey)\n .then((result) => {\n if (active) {\n setStripe(result);\n setFailed(!result);\n }\n })\n .catch(() => {\n if (active) {\n setFailed(true);\n }\n });\n return () => {\n active = false;\n };\n }, [props.publishableKey]);\n if (failed) {\n return (\n <p role=\"alert\">\n Secure card entry could not load. Reload the page to check your booking\n before trying to pay again.\n </p>\n );\n }\n if (!stripe) {\n return <p role=\"status\">Loading secure card entry…</p>;\n }\n return (\n <Elements\n options={{\n allowedPaymentMethodTypes: [\"card\"],\n amount: props.amountCents,\n currency: \"usd\",\n mode: \"payment\",\n setupFutureUsage: \"off_session\",\n }}\n stripe={stripe}\n >\n <BookingCardForm {...props} />\n </Elements>\n );\n}\n"],"mappings":"kRAWA,MAAM,EAAwB,qBAe9B,SAAS,EAAgB,EAAuC,CAC9D,IAAM,EAAS,EAAU,EACnB,EAAW,EAAY,EACvB,EAAa,EAAO,EAAK,EACzB,EAAgB,EAAO,EAAK,EAC5B,CAAC,EAAM,GAAW,EAAS,EAAK,EAChC,CAAC,EAAO,GAAY,EAAS,EAAK,EAClC,CAAC,EAAO,GAAY,EAAS,EAAE,EACrC,eAAe,GAAS,CAEpB,OAAE,GAAU,GAAY,IACxB,EAAM,UACN,EAAW,SACX,EAAc,SAMhB,CAFA,EAAW,QAAU,GACrB,EAAQ,EAAI,EACZ,EAAS,EAAE,EACX,GAAI,CAEF,IAAI,MADoB,EAAS,OAAO,EAAA,CAC1B,MAAO,CACnB,EAAS,0BAA0B,EACnC,MACF,CACA,IAAM,EAAS,MAAM,EAAO,wBAAwB,CAAE,UAAS,CAAC,EAChE,GAAI,EAAO,OAAS,CAAC,EAAO,kBAAmB,CAC7C,EACE,gEACF,EACA,MACF,CACA,EAAc,QAAU,GACxB,MAAM,EAAM,UAAU,EAAO,kBAAkB,EAAE,CACnD,MAAQ,CACN,EACE,wFACF,CACF,QAAU,CACR,EAAW,QAAU,GACrB,EAAQ,EAAK,CACf,CAvBW,CAwBb,CACA,OACE,EAAC,MAAD,CAAK,UAAW,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AC,MAAM,EAClC,OAAQ,EAAM,YACd,SAAU,MACV,KAAM,UACN,iBAAkB,aACpB,EACQ,SAER,SAAA,EAAC,EAAD,CAAiB,GAAI,CAAQ,CAAA,CACrB,CAAA,EAdH,EAAC,IAAD,CAAG,KAAK,SAAS,SAAA,4BAA6B,CAAA,CAgBzD"}
|
package/guides/auctions.md
CHANGED
package/guides/bookings.md
CHANGED
package/guides/events.md
CHANGED
package/guides/integration.md
CHANGED
package/guides/signup.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lockerverse/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.224-dev.1",
|
|
4
4
|
"description": "Tree-shakable React payment and signup UI for Lockerverse",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"embla-carousel-react": "8.6.0",
|
|
147
147
|
"lucide-react": "0.536.0",
|
|
148
148
|
"valibot": "1.4.2",
|
|
149
|
-
"@lockerverse/sdk": "0.2.
|
|
149
|
+
"@lockerverse/sdk": "0.2.224-dev.1"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
152
|
"@size-limit/file": "13.0.3",
|