@lockerverse/react 0.2.68 → 0.2.70

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 CHANGED
@@ -125,10 +125,12 @@ custom amounts, or multiple Products.
125
125
  ## Donate launcher
126
126
 
127
127
  `LockerverseDonateLauncher` turns an existing payment widget into a native
128
- React dialog. It reads the widget's products, descriptions, fixed prices, and
129
- custom-amount rules. Recurring Products open the same payment form in
130
- subscription mode. It then passes the visitor's selection to the same
131
- `LockerversePayment` checkout.
128
+ React dialog. The launcher selects its controls from each Product's existing
129
+ capabilities. Visitors can set quantities for fixed one-time Products and add
130
+ an inline amount for custom one-time Products. The launcher combines these
131
+ one-time choices in one checkout. Monthly and annual Products are exclusive:
132
+ the visitor selects one tier before the same `LockerversePayment` form opens in
133
+ subscription mode.
132
134
 
133
135
  ```tsx
134
136
  import { LockerverseDonateLauncher } from "@lockerverse/react/donate-launcher";
@@ -1,2 +1,2 @@
1
- import{array as e,email as t,minLength as n,nonEmpty as r,pipe as i,regex as a,safeParse as o,string as s,transform as c,trim as l}from"valibot";import{jsx as u,jsxs as d}from"react/jsx-runtime";const f=/^#([\da-f]{3}|[\da-f]{6})$/i,p=/^([\da-f]{3}|[\da-f]{6})$/i;function m(e){let t=e.trim();return p.test(t)?`#${t}`:t}function h(e){let t=f.exec(m(e));if(!t)return;let[,n]=t;if(!n)return;let r=n.length===3?Array.from(n,e=>`${e}${e}`).join(``):n;return[0,2,4].map(e=>Number.parseInt(r.slice(e,e+2),16))}function g([e,t,n]){let[r=0,i=0,a=0]=[e,t,n].map((e=0)=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function _(e){let t=h(e);if(!t)return;let n=g(t);return(n+.05)/.05>=1.05/(n+.05)?`#000`:`#fff`}function v(e){return Object.fromEntries(e.map(e=>[e.id,e.type===`checkboxes`||e.type===`multi_select`?[]:``]))}function y(e,t){return e.map(e=>{let n=t[e.id];return e.type===`checkboxes`||e.type===`multi_select`?{fieldId:e.id,value:Array.isArray(n)?n:[]}:{fieldId:e.id,value:typeof n==`string`?n:``}})}function b(t,a){let c={};for(let u of t){if(!u.required)continue;let t=`${u.label} is required.`,d=a[u.id],f=u.type===`checkboxes`||u.type===`multi_select`?o(i(e(s()),n(1,t)),d??[]):o(i(s(),l(),r(t)),typeof d==`string`?d:``);f.success||(c[u.id]=f.issues[0]?.message??t)}return c}function x({choiceClassName:e,errorClassName:t,errors:n,fields:r,idPrefix:i,onChange:a,values:o}){return r.map(r=>u(S,{choiceClassName:e,error:n[r.id],errorClassName:t,field:r,idPrefix:i,onChange:e=>a({...o,[r.id]:e}),value:o[r.id]},r.id))}function S(e){let{field:t,idPrefix:n}=e,r=`${n}-custom-${t.id}`,i=`${r}-error`,a={...e,controlId:r,errorId:i};switch(t.type){case`text`:case`textarea`:return u(w,{...a,field:t});case`select`:case`multi_select`:return u(T,{...a,field:t});case`radio`:case`checkboxes`:return u(E,{...a,field:t});default:return null}}function C({className:e,error:t,id:n}){return t?u(`span`,{className:e,id:n,role:`alert`,children:t}):null}function w({controlId:e,error:t,errorClassName:n,errorId:r,field:i,onChange:a,value:o}){let s={"aria-describedby":t?r:void 0,"aria-invalid":t?`true`:void 0,id:e,name:`custom:${i.id}`,onChange:e=>a(e.currentTarget.value),required:i.required,value:typeof o==`string`?o:``};return d(`label`,{htmlFor:e,children:[u(`span`,{children:i.label}),i.type===`textarea`?u(`textarea`,{...s}):u(`input`,{...s}),u(C,{className:n,error:t,id:r})]})}function T({controlId:e,error:t,errorClassName:n,errorId:r,field:i,onChange:a,value:o}){return d(`label`,{htmlFor:e,children:[u(`span`,{children:i.label}),d(`select`,{"aria-describedby":t?r:void 0,"aria-invalid":t?`true`:void 0,id:e,multiple:i.type===`multi_select`,name:`custom:${i.id}`,onChange:e=>a(i.type===`multi_select`?[...e.currentTarget.selectedOptions].map(e=>e.value):e.currentTarget.value),required:i.required,value:o??(i.type===`multi_select`?[]:``),children:[i.type===`select`?u(`option`,{value:``,children:`Select…`}):null,i.options.map(e=>u(`option`,{value:e.id,children:e.label},e.id))]}),u(C,{className:n,error:t,id:r})]})}function E({choiceClassName:e,controlId:t,error:n,errorClassName:r,errorId:i,field:a,onChange:o,value:s}){let c=Array.isArray(s)?s:[];return d(`fieldset`,{"aria-describedby":n?i:void 0,"aria-invalid":n?`true`:void 0,children:[u(`legend`,{children:a.label}),a.options.map((n,r)=>d(`label`,{className:e,children:[u(`input`,{checked:Array.isArray(s)?s.includes(n.id):s===n.id,id:`${t}-${r}`,name:`custom:${a.id}`,onChange:e=>{if(a.type===`radio`){o(n.id);return}o(e.currentTarget.checked?[...c,n.id]:c.filter(e=>e!==n.id))},required:a.required&&a.type===`radio`,type:a.type===`radio`?`radio`:`checkbox`,value:n.id}),u(`span`,{children:n.label})]},n.id)),u(C,{className:r,error:n,id:i})]})}const D=`Enter a valid email address.`,O=`Enter a valid phone number.`,k=/^(?:$|[^\s@]+@[^\s@]+\.[^\s@]+)$/,A=/^\+[1-9]\d{6,14}$/,j=/^(?:$|\+[1-9]\d{6,14})$/;function M(e){return e.trim().replace(/[().\s-]/g,``)}const N=i(s(),l(),a(k,D)),P=i(s(),l(),r(`Email is required.`),t(D)),F=i(s(),l(),c(M),a(j,O)),I=i(s(),l(),r(`Phone is required.`),c(M),a(A,O));export{I as a,v as c,m as d,P as i,b as l,N as n,x as o,F as r,y as s,M as t,_ as u};
1
+ import{array as e,email as t,minLength as n,nonEmpty as r,pipe as i,regex as a,safeParse as o,string as s,transform as c,trim as l}from"valibot";import{jsx as u,jsxs as d}from"react/jsx-runtime";const f=/^#([\da-f]{3}|[\da-f]{6})$/i,p=/^([\da-f]{3}|[\da-f]{6})$/i;function m(e){let t=e.trim();return p.test(t)?`#${t}`:t}function h(e){let t=f.exec(m(e));if(!t)return;let[,n]=t;if(!n)return;let r=n.length===3?Array.from(n,e=>`${e}${e}`).join(``):n;return[0,2,4].map(e=>Number.parseInt(r.slice(e,e+2),16))}function g([e,t,n]){let[r=0,i=0,a=0]=[e,t,n].map((e=0)=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function _(e){let t=h(e);if(!t)return;let n=g(t);return(n+.05)/.05>=1.05/(n+.05)?`#000`:`#fff`}function v(e){return Object.fromEntries(e.map(e=>[e.id,e.type===`checkboxes`||e.type===`multi_select`?[]:``]))}function y(e,t){return e.map(e=>{let n=t[e.id];return e.type===`checkboxes`||e.type===`multi_select`?{fieldId:e.id,value:Array.isArray(n)?n:[]}:{fieldId:e.id,value:typeof n==`string`?n:``}})}function b(t,a){let c={};for(let u of t){if(!u.required)continue;let t=`${u.label} is required.`,d=a[u.id],f=u.type===`checkboxes`||u.type===`multi_select`?o(i(e(s()),n(1,t)),d??[]):o(i(s(),l(),r(t)),typeof d==`string`?d:``);f.success||(c[u.id]=f.issues[0]?.message??t)}return c}function x({choiceClassName:e,errorClassName:t,errors:n,fields:r,idPrefix:i,onChange:a,values:o}){return r.map(r=>u(S,{choiceClassName:e,error:n[r.id],errorClassName:t,field:r,idPrefix:i,onChange:e=>a({...o,[r.id]:e}),value:o[r.id]},r.id))}function S(e){let{field:t,idPrefix:n}=e,r=`${n}-custom-${t.id}`,i=`${r}-error`,a={...e,controlId:r,errorId:i};switch(t.type){case`text`:case`textarea`:return u(w,{...a,field:t});case`select`:case`multi_select`:return u(T,{...a,field:t});case`radio`:case`checkboxes`:return u(E,{...a,field:t});default:return null}}function C({className:e,error:t,id:n}){return t?u(`span`,{className:e,id:n,role:`alert`,children:t}):null}function w({controlId:e,error:t,errorClassName:n,errorId:r,field:i,onChange:a,value:o}){let s={"aria-describedby":t?r:void 0,"aria-invalid":t?`true`:void 0,id:e,name:`custom:${i.id}`,onChange:e=>a(e.currentTarget.value),required:i.required,value:typeof o==`string`?o:``};return d(`label`,{htmlFor:e,children:[u(`span`,{children:i.label}),i.type===`textarea`?u(`textarea`,{...s}):u(`input`,{...s}),u(C,{className:n,error:t,id:r})]})}function T({controlId:e,error:t,errorClassName:n,errorId:r,field:i,onChange:a,value:o}){return d(`label`,{htmlFor:e,children:[u(`span`,{children:i.label}),d(`select`,{"aria-describedby":t?r:void 0,"aria-invalid":t?`true`:void 0,id:e,multiple:i.type===`multi_select`,name:`custom:${i.id}`,onChange:e=>a(i.type===`multi_select`?[...e.currentTarget.selectedOptions].map(e=>e.value):e.currentTarget.value),required:i.required,value:o??(i.type===`multi_select`?[]:``),children:[i.type===`select`?u(`option`,{value:``,children:`Select…`}):null,i.options.map(e=>u(`option`,{value:e.id,children:e.label},e.id))]}),u(C,{className:n,error:t,id:r})]})}function E({choiceClassName:e,controlId:t,error:n,errorClassName:r,errorId:i,field:a,onChange:o,value:s}){let c=Array.isArray(s)?s:[];return d(`fieldset`,{"aria-describedby":n?i:void 0,"aria-invalid":n?`true`:void 0,children:[u(`legend`,{children:a.label}),a.options.map((n,r)=>d(`label`,{className:e,children:[u(`input`,{checked:Array.isArray(s)?s.includes(n.id):s===n.id,id:`${t}-${r}`,name:`custom:${a.id}`,onChange:e=>{if(a.type===`radio`){o(n.id);return}o(e.currentTarget.checked?[...c,n.id]:c.filter(e=>e!==n.id))},required:a.required&&a.type===`radio`,type:a.type===`radio`?`radio`:`checkbox`,value:n.id}),u(`span`,{children:n.label})]},n.id)),u(C,{className:r,error:n,id:i})]})}function D({fieldCount:e,label:t,sectionCount:n=0,showCheckbox:r=!1}){return d(`div`,{className:`lockerverse-form-skeleton__loading`,children:[u(`span`,{className:`lockerverse-form-skeleton__sr-only`,role:`status`,children:t}),d(`div`,{"aria-hidden":`true`,className:`lockerverse-form-skeleton`,children:[d(`div`,{className:`lockerverse-form-skeleton__branding`,children:[u(`span`,{className:`lockerverse-form-skeleton__avatar`}),u(`span`,{className:`lockerverse-form-skeleton__community`})]}),u(`div`,{className:`lockerverse-form-skeleton__fields`,children:Array.from({length:e},(e,t)=>d(`div`,{className:`lockerverse-form-skeleton__field`,children:[u(`span`,{className:`lockerverse-form-skeleton__label`}),u(`span`,{className:`lockerverse-form-skeleton__input`})]},t))}),Array.from({length:n},(e,t)=>d(`div`,{className:`lockerverse-form-skeleton__section`,children:[u(`span`,{className:`lockerverse-form-skeleton__section-label`}),d(`div`,{className:`lockerverse-form-skeleton__section-content`,children:[u(`span`,{className:`lockerverse-form-skeleton__section-full`}),d(`div`,{className:`lockerverse-form-skeleton__section-grid`,children:[u(`span`,{className:`lockerverse-form-skeleton__section-half`}),u(`span`,{className:`lockerverse-form-skeleton__section-half`})]})]})]},t)),d(`div`,{className:`lockerverse-form-skeleton__actions`,children:[r?u(`span`,{className:`lockerverse-form-skeleton__check-line`}):null,u(`span`,{className:`lockerverse-form-skeleton__button`})]})]})]})}const O=`Enter a valid email address.`,k=`Enter a valid phone number.`,A=/^(?:$|[^\s@]+@[^\s@]+\.[^\s@]+)$/,j=/^\+[1-9]\d{6,14}$/,M=/^(?:$|\+[1-9]\d{6,14})$/;function N(e){return e.trim().replace(/[().\s-]/g,``)}const P=i(s(),l(),a(A,O)),F=i(s(),l(),r(`Email is required.`),t(O)),I=i(s(),l(),c(N),a(M,k)),L=i(s(),l(),r(`Phone is required.`),c(N),a(j,k));export{L as a,y as c,_ as d,m as f,F as i,v as l,P as n,D as o,I as r,x as s,N as t,b as u};
2
2
  //# sourceMappingURL=contact-validation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contact-validation.js","names":[],"sources":["../src/accent-contrast.ts","../src/custom-fields.tsx","../src/contact-validation.ts"],"sourcesContent":["const HEX_COLOR = /^#([\\da-f]{3}|[\\da-f]{6})$/i;\nconst UNPREFIXED_HEX_COLOR = /^([\\da-f]{3}|[\\da-f]{6})$/i;\n\nexport function normalizeAccentColor(color: string) {\n const trimmedColor = color.trim();\n return UNPREFIXED_HEX_COLOR.test(trimmedColor)\n ? `#${trimmedColor}`\n : trimmedColor;\n}\n\nfunction parseHexColor(color: string) {\n const match = HEX_COLOR.exec(normalizeAccentColor(color));\n if (!match) {\n return;\n }\n const [, value] = match;\n if (!value) {\n return;\n }\n const expanded =\n value.length === 3\n ? Array.from(value, (character) => `${character}${character}`).join(\"\")\n : value;\n return [0, 2, 4].map((offset) =>\n Number.parseInt(expanded.slice(offset, offset + 2), 16)\n );\n}\n\nfunction relativeLuminance([red, green, blue]: number[]) {\n const [linearRed = 0, linearGreen = 0, linearBlue = 0] = [\n red,\n green,\n blue,\n ].map((channel = 0) => {\n const normalized = channel / 255;\n return normalized <= 0.040_45\n ? normalized / 12.92\n : ((normalized + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * linearRed + 0.7152 * linearGreen + 0.0722 * linearBlue;\n}\n\nexport function getAccentContrast(color: string) {\n const parsed = parseHexColor(color);\n if (!parsed) {\n return;\n }\n const luminance = relativeLuminance(parsed);\n const blackContrast = (luminance + 0.05) / 0.05;\n const whiteContrast = 1.05 / (luminance + 0.05);\n return blackContrast >= whiteContrast ? \"#000\" : \"#fff\";\n}\n","import type {\n LockerverseCustomField,\n LockerverseCustomFieldAnswer,\n LockerverseMultiOptionCustomField,\n LockerverseSingleOptionCustomField,\n} from \"@lockerverse/sdk/checkout\";\nimport {\n array,\n minLength,\n nonEmpty,\n pipe,\n safeParse,\n string,\n trim,\n} from \"valibot\";\n\nexport type CustomFieldValues = Record<string, string | string[]>;\n\nexport function createCustomFieldValues(fields: LockerverseCustomField[]) {\n return Object.fromEntries(\n fields.map((field) => [\n field.id,\n field.type === \"checkboxes\" || field.type === \"multi_select\" ? [] : \"\",\n ])\n ) as CustomFieldValues;\n}\n\nexport function buildCustomFieldAnswers(\n fields: LockerverseCustomField[],\n values: CustomFieldValues\n): LockerverseCustomFieldAnswer[] {\n return fields.map((field): LockerverseCustomFieldAnswer => {\n const value = values[field.id];\n return field.type === \"checkboxes\" || field.type === \"multi_select\"\n ? { fieldId: field.id, value: Array.isArray(value) ? value : [] }\n : {\n fieldId: field.id,\n value: typeof value === \"string\" ? value : \"\",\n };\n });\n}\n\nexport function validateCustomFields(\n fields: LockerverseCustomField[],\n values: CustomFieldValues\n) {\n const errors: Record<string, string> = {};\n for (const field of fields) {\n if (!field.required) {\n continue;\n }\n const message = `${field.label} is required.`;\n const value = values[field.id];\n const result =\n field.type === \"checkboxes\" || field.type === \"multi_select\"\n ? safeParse(pipe(array(string()), minLength(1, message)), value ?? [])\n : safeParse(\n pipe(string(), trim(), nonEmpty(message)),\n typeof value === \"string\" ? value : \"\"\n );\n if (!result.success) {\n errors[field.id] = result.issues[0]?.message ?? message;\n }\n }\n return errors;\n}\n\nexport function CustomFields({\n choiceClassName,\n errorClassName,\n errors,\n fields,\n idPrefix,\n onChange,\n values,\n}: {\n choiceClassName: string;\n errorClassName: string;\n errors: Record<string, string>;\n fields: LockerverseCustomField[];\n idPrefix: string;\n onChange: (values: CustomFieldValues) => void;\n values: CustomFieldValues;\n}) {\n return fields.map((field) => (\n <CustomField\n choiceClassName={choiceClassName}\n error={errors[field.id]}\n errorClassName={errorClassName}\n field={field}\n idPrefix={idPrefix}\n key={field.id}\n onChange={(value) => onChange({ ...values, [field.id]: value })}\n value={values[field.id]}\n />\n ));\n}\n\ntype CustomFieldProps = {\n choiceClassName: string;\n error: string | undefined;\n errorClassName: string;\n field: LockerverseCustomField;\n idPrefix: string;\n onChange: (value: string | string[]) => void;\n value: string | string[] | undefined;\n};\n\nfunction CustomField(props: CustomFieldProps) {\n const { field, idPrefix } = props;\n const controlId = `${idPrefix}-custom-${field.id}`;\n const errorId = `${controlId}-error`;\n const controlProps = { ...props, controlId, errorId };\n switch (field.type) {\n case \"text\":\n case \"textarea\":\n return <TextCustomField {...controlProps} field={field} />;\n case \"select\":\n case \"multi_select\":\n return <SelectCustomField {...controlProps} field={field} />;\n case \"radio\":\n case \"checkboxes\":\n return <ChoiceCustomField {...controlProps} field={field} />;\n default:\n return null;\n }\n}\n\ntype ControlProps = CustomFieldProps & {\n controlId: string;\n errorId: string;\n};\n\nfunction FieldError({\n className,\n error,\n id,\n}: {\n className: string;\n error: string | undefined;\n id: string;\n}) {\n return error ? (\n <span className={className} id={id} role=\"alert\">\n {error}\n </span>\n ) : null;\n}\n\nfunction TextCustomField({\n controlId,\n error,\n errorClassName,\n errorId,\n field,\n onChange,\n value,\n}: ControlProps & {\n field: Extract<LockerverseCustomField, { type: \"text\" | \"textarea\" }>;\n}) {\n const commonProps = {\n \"aria-describedby\": error ? errorId : undefined,\n \"aria-invalid\": error ? (\"true\" as const) : undefined,\n id: controlId,\n name: `custom:${field.id}`,\n onChange: (\n event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>\n ) => onChange(event.currentTarget.value),\n required: field.required,\n value: typeof value === \"string\" ? value : \"\",\n };\n return (\n <label htmlFor={controlId}>\n <span>{field.label}</span>\n {field.type === \"textarea\" ? (\n <textarea {...commonProps} />\n ) : (\n <input {...commonProps} />\n )}\n <FieldError className={errorClassName} error={error} id={errorId} />\n </label>\n );\n}\n\nfunction SelectCustomField({\n controlId,\n error,\n errorClassName,\n errorId,\n field,\n onChange,\n value,\n}: ControlProps & {\n field: LockerverseMultiOptionCustomField | LockerverseSingleOptionCustomField;\n}) {\n return (\n <label htmlFor={controlId}>\n <span>{field.label}</span>\n <select\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? \"true\" : undefined}\n id={controlId}\n multiple={field.type === \"multi_select\"}\n name={`custom:${field.id}`}\n onChange={(event) =>\n onChange(\n field.type === \"multi_select\"\n ? [...event.currentTarget.selectedOptions].map(\n (option) => option.value\n )\n : event.currentTarget.value\n )\n }\n required={field.required}\n value={value ?? (field.type === \"multi_select\" ? [] : \"\")}\n >\n {field.type === \"select\" ? <option value=\"\">Select…</option> : null}\n {field.options.map((option) => (\n <option key={option.id} value={option.id}>\n {option.label}\n </option>\n ))}\n </select>\n <FieldError className={errorClassName} error={error} id={errorId} />\n </label>\n );\n}\n\nfunction ChoiceCustomField({\n choiceClassName,\n controlId,\n error,\n errorClassName,\n errorId,\n field,\n onChange,\n value,\n}: ControlProps & {\n field: LockerverseMultiOptionCustomField | LockerverseSingleOptionCustomField;\n}) {\n const selectedValues = Array.isArray(value) ? value : [];\n return (\n <fieldset\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? \"true\" : undefined}\n >\n <legend>{field.label}</legend>\n {field.options.map((option, index) => (\n <label className={choiceClassName} key={option.id}>\n <input\n checked={\n Array.isArray(value)\n ? value.includes(option.id)\n : value === option.id\n }\n id={`${controlId}-${index}`}\n name={`custom:${field.id}`}\n onChange={(event) => {\n if (field.type === \"radio\") {\n onChange(option.id);\n return;\n }\n onChange(\n event.currentTarget.checked\n ? [...selectedValues, option.id]\n : selectedValues.filter((id) => id !== option.id)\n );\n }}\n required={field.required && field.type === \"radio\"}\n type={field.type === \"radio\" ? \"radio\" : \"checkbox\"}\n value={option.id}\n />\n <span>{option.label}</span>\n </label>\n ))}\n <FieldError className={errorClassName} error={error} id={errorId} />\n </fieldset>\n );\n}\n","import { email, nonEmpty, pipe, regex, string, transform, trim } from \"valibot\";\n\nexport const EMAIL_REQUIRED_MESSAGE = \"Email is required.\";\nexport const EMAIL_INVALID_MESSAGE = \"Enter a valid email address.\";\nexport const PHONE_REQUIRED_MESSAGE = \"Phone is required.\";\nexport const PHONE_INVALID_MESSAGE = \"Enter a valid phone number.\";\n\nconst OPTIONAL_EMAIL_PATTERN = /^(?:$|[^\\s@]+@[^\\s@]+\\.[^\\s@]+)$/;\nconst INTERNATIONAL_PHONE_PATTERN = /^\\+[1-9]\\d{6,14}$/;\nconst OPTIONAL_INTERNATIONAL_PHONE_PATTERN = /^(?:$|\\+[1-9]\\d{6,14})$/;\n\nexport function normalizePhone(input: string) {\n return input.trim().replace(/[().\\s-]/g, \"\");\n}\n\nexport const optionalEmailSchema = pipe(\n string(),\n trim(),\n regex(OPTIONAL_EMAIL_PATTERN, EMAIL_INVALID_MESSAGE)\n);\n\nexport const requiredEmailSchema = pipe(\n string(),\n trim(),\n nonEmpty(EMAIL_REQUIRED_MESSAGE),\n email(EMAIL_INVALID_MESSAGE)\n);\n\nexport const optionalPhoneSchema = pipe(\n string(),\n trim(),\n transform(normalizePhone),\n regex(OPTIONAL_INTERNATIONAL_PHONE_PATTERN, PHONE_INVALID_MESSAGE)\n);\n\nexport const requiredPhoneSchema = pipe(\n string(),\n trim(),\n nonEmpty(PHONE_REQUIRED_MESSAGE),\n transform(normalizePhone),\n regex(INTERNATIONAL_PHONE_PATTERN, PHONE_INVALID_MESSAGE)\n);\n"],"mappings":"mMAAA,MAAM,EAAY,8BACZ,EAAuB,6BAE7B,SAAgB,EAAqB,EAAe,CAClD,IAAM,EAAe,EAAM,KAAK,EAChC,OAAO,EAAqB,KAAK,CAAY,EACzC,IAAI,IACJ,CACN,CAEA,SAAS,EAAc,EAAe,CACpC,IAAM,EAAQ,EAAU,KAAK,EAAqB,CAAK,CAAC,EACxD,GAAI,CAAC,EACH,OAEF,GAAM,EAAG,GAAS,EAClB,GAAI,CAAC,EACH,OAEF,IAAM,EACJ,EAAM,SAAW,EACb,MAAM,KAAK,EAAQ,GAAc,GAAG,IAAY,GAAW,CAAC,CAAC,KAAK,EAAE,EACpE,EACN,MAAO,CAAC,EAAG,EAAG,CAAC,CAAC,CAAC,IAAK,GACpB,OAAO,SAAS,EAAS,MAAM,EAAQ,EAAS,CAAC,EAAG,EAAE,CACxD,CACF,CAEA,SAAS,EAAkB,CAAC,EAAK,EAAO,GAAiB,CACvD,GAAM,CAAC,EAAY,EAAG,EAAc,EAAG,EAAa,GAAK,CACvD,EACA,EACA,CACF,CAAC,CAAC,KAAK,EAAU,IAAM,CACrB,IAAM,EAAa,EAAU,IAC7B,OAAO,GAAc,OACjB,EAAa,QACX,EAAa,MAAS,QAAU,GACxC,CAAC,EACD,MAAO,OAAS,EAAY,MAAS,EAAc,MAAS,CAC9D,CAEA,SAAgB,EAAkB,EAAe,CAC/C,IAAM,EAAS,EAAc,CAAK,EAClC,GAAI,CAAC,EACH,OAEF,IAAM,EAAY,EAAkB,CAAM,EAG1C,OAFuB,EAAY,KAAQ,KACrB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GAAI,EAAM,OAAS,QAAS,CAC1B,EAAS,EAAO,EAAE,EAClB,MACF,CACA,EACE,EAAM,cAAc,QAChB,CAAC,GAAG,EAAgB,EAAO,EAAE,EAC7B,EAAe,OAAQ,GAAO,IAAO,EAAO,EAAE,CACpD,CACF,EACA,SAAU,EAAM,UAAY,EAAM,OAAS,QAC3C,KAAM,EAAM,OAAS,QAAU,QAAU,WACzC,MAAO,EAAO,EACf,CAAA,EACD,EAAC,OAAD,CAAA,SAAO,EAAO,KAAY,CAAA,CACrB,CAzBiC,EAAA,EAAO,EAyBxC,CACR,EACD,EAAC,EAAD,CAAY,UAAW,EAAuB,QAAO,GAAI,CAAU,CAAA,CAC3D,GAEd,CCpRA,MACa,EAAwB,+BAExB,EAAwB,8BAE/B,EAAyB,mCACzB,EAA8B,oBAC9B,EAAuC,0BAE7C,SAAgB,EAAe,EAAe,CAC5C,OAAO,EAAM,KAAK,CAAC,CAAC,QAAQ,YAAa,EAAE,CAC7C,CAEA,MAAa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAM,EAAwB,CAAqB,CACrD,EAEa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAS,oBAAsB,EAC/B,EAAM,CAAqB,CAC7B,EAEa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAU,CAAc,EACxB,EAAM,EAAsC,CAAqB,CACnE,EAEa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAS,oBAAsB,EAC/B,EAAU,CAAc,EACxB,EAAM,EAA6B,CAAqB,CAC1D"}
1
+ {"version":3,"file":"contact-validation.js","names":[],"sources":["../src/accent-contrast.ts","../src/custom-fields.tsx","../src/form-skeleton.tsx","../src/contact-validation.ts"],"sourcesContent":["const HEX_COLOR = /^#([\\da-f]{3}|[\\da-f]{6})$/i;\nconst UNPREFIXED_HEX_COLOR = /^([\\da-f]{3}|[\\da-f]{6})$/i;\n\nexport function normalizeAccentColor(color: string) {\n const trimmedColor = color.trim();\n return UNPREFIXED_HEX_COLOR.test(trimmedColor)\n ? `#${trimmedColor}`\n : trimmedColor;\n}\n\nfunction parseHexColor(color: string) {\n const match = HEX_COLOR.exec(normalizeAccentColor(color));\n if (!match) {\n return;\n }\n const [, value] = match;\n if (!value) {\n return;\n }\n const expanded =\n value.length === 3\n ? Array.from(value, (character) => `${character}${character}`).join(\"\")\n : value;\n return [0, 2, 4].map((offset) =>\n Number.parseInt(expanded.slice(offset, offset + 2), 16)\n );\n}\n\nfunction relativeLuminance([red, green, blue]: number[]) {\n const [linearRed = 0, linearGreen = 0, linearBlue = 0] = [\n red,\n green,\n blue,\n ].map((channel = 0) => {\n const normalized = channel / 255;\n return normalized <= 0.040_45\n ? normalized / 12.92\n : ((normalized + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * linearRed + 0.7152 * linearGreen + 0.0722 * linearBlue;\n}\n\nexport function getAccentContrast(color: string) {\n const parsed = parseHexColor(color);\n if (!parsed) {\n return;\n }\n const luminance = relativeLuminance(parsed);\n const blackContrast = (luminance + 0.05) / 0.05;\n const whiteContrast = 1.05 / (luminance + 0.05);\n return blackContrast >= whiteContrast ? \"#000\" : \"#fff\";\n}\n","import type {\n LockerverseCustomField,\n LockerverseCustomFieldAnswer,\n LockerverseMultiOptionCustomField,\n LockerverseSingleOptionCustomField,\n} from \"@lockerverse/sdk/checkout\";\nimport {\n array,\n minLength,\n nonEmpty,\n pipe,\n safeParse,\n string,\n trim,\n} from \"valibot\";\n\nexport type CustomFieldValues = Record<string, string | string[]>;\n\nexport function createCustomFieldValues(fields: LockerverseCustomField[]) {\n return Object.fromEntries(\n fields.map((field) => [\n field.id,\n field.type === \"checkboxes\" || field.type === \"multi_select\" ? [] : \"\",\n ])\n ) as CustomFieldValues;\n}\n\nexport function buildCustomFieldAnswers(\n fields: LockerverseCustomField[],\n values: CustomFieldValues\n): LockerverseCustomFieldAnswer[] {\n return fields.map((field): LockerverseCustomFieldAnswer => {\n const value = values[field.id];\n return field.type === \"checkboxes\" || field.type === \"multi_select\"\n ? { fieldId: field.id, value: Array.isArray(value) ? value : [] }\n : {\n fieldId: field.id,\n value: typeof value === \"string\" ? value : \"\",\n };\n });\n}\n\nexport function validateCustomFields(\n fields: LockerverseCustomField[],\n values: CustomFieldValues\n) {\n const errors: Record<string, string> = {};\n for (const field of fields) {\n if (!field.required) {\n continue;\n }\n const message = `${field.label} is required.`;\n const value = values[field.id];\n const result =\n field.type === \"checkboxes\" || field.type === \"multi_select\"\n ? safeParse(pipe(array(string()), minLength(1, message)), value ?? [])\n : safeParse(\n pipe(string(), trim(), nonEmpty(message)),\n typeof value === \"string\" ? value : \"\"\n );\n if (!result.success) {\n errors[field.id] = result.issues[0]?.message ?? message;\n }\n }\n return errors;\n}\n\nexport function CustomFields({\n choiceClassName,\n errorClassName,\n errors,\n fields,\n idPrefix,\n onChange,\n values,\n}: {\n choiceClassName: string;\n errorClassName: string;\n errors: Record<string, string>;\n fields: LockerverseCustomField[];\n idPrefix: string;\n onChange: (values: CustomFieldValues) => void;\n values: CustomFieldValues;\n}) {\n return fields.map((field) => (\n <CustomField\n choiceClassName={choiceClassName}\n error={errors[field.id]}\n errorClassName={errorClassName}\n field={field}\n idPrefix={idPrefix}\n key={field.id}\n onChange={(value) => onChange({ ...values, [field.id]: value })}\n value={values[field.id]}\n />\n ));\n}\n\ntype CustomFieldProps = {\n choiceClassName: string;\n error: string | undefined;\n errorClassName: string;\n field: LockerverseCustomField;\n idPrefix: string;\n onChange: (value: string | string[]) => void;\n value: string | string[] | undefined;\n};\n\nfunction CustomField(props: CustomFieldProps) {\n const { field, idPrefix } = props;\n const controlId = `${idPrefix}-custom-${field.id}`;\n const errorId = `${controlId}-error`;\n const controlProps = { ...props, controlId, errorId };\n switch (field.type) {\n case \"text\":\n case \"textarea\":\n return <TextCustomField {...controlProps} field={field} />;\n case \"select\":\n case \"multi_select\":\n return <SelectCustomField {...controlProps} field={field} />;\n case \"radio\":\n case \"checkboxes\":\n return <ChoiceCustomField {...controlProps} field={field} />;\n default:\n return null;\n }\n}\n\ntype ControlProps = CustomFieldProps & {\n controlId: string;\n errorId: string;\n};\n\nfunction FieldError({\n className,\n error,\n id,\n}: {\n className: string;\n error: string | undefined;\n id: string;\n}) {\n return error ? (\n <span className={className} id={id} role=\"alert\">\n {error}\n </span>\n ) : null;\n}\n\nfunction TextCustomField({\n controlId,\n error,\n errorClassName,\n errorId,\n field,\n onChange,\n value,\n}: ControlProps & {\n field: Extract<LockerverseCustomField, { type: \"text\" | \"textarea\" }>;\n}) {\n const commonProps = {\n \"aria-describedby\": error ? errorId : undefined,\n \"aria-invalid\": error ? (\"true\" as const) : undefined,\n id: controlId,\n name: `custom:${field.id}`,\n onChange: (\n event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>\n ) => onChange(event.currentTarget.value),\n required: field.required,\n value: typeof value === \"string\" ? value : \"\",\n };\n return (\n <label htmlFor={controlId}>\n <span>{field.label}</span>\n {field.type === \"textarea\" ? (\n <textarea {...commonProps} />\n ) : (\n <input {...commonProps} />\n )}\n <FieldError className={errorClassName} error={error} id={errorId} />\n </label>\n );\n}\n\nfunction SelectCustomField({\n controlId,\n error,\n errorClassName,\n errorId,\n field,\n onChange,\n value,\n}: ControlProps & {\n field: LockerverseMultiOptionCustomField | LockerverseSingleOptionCustomField;\n}) {\n return (\n <label htmlFor={controlId}>\n <span>{field.label}</span>\n <select\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? \"true\" : undefined}\n id={controlId}\n multiple={field.type === \"multi_select\"}\n name={`custom:${field.id}`}\n onChange={(event) =>\n onChange(\n field.type === \"multi_select\"\n ? [...event.currentTarget.selectedOptions].map(\n (option) => option.value\n )\n : event.currentTarget.value\n )\n }\n required={field.required}\n value={value ?? (field.type === \"multi_select\" ? [] : \"\")}\n >\n {field.type === \"select\" ? <option value=\"\">Select…</option> : null}\n {field.options.map((option) => (\n <option key={option.id} value={option.id}>\n {option.label}\n </option>\n ))}\n </select>\n <FieldError className={errorClassName} error={error} id={errorId} />\n </label>\n );\n}\n\nfunction ChoiceCustomField({\n choiceClassName,\n controlId,\n error,\n errorClassName,\n errorId,\n field,\n onChange,\n value,\n}: ControlProps & {\n field: LockerverseMultiOptionCustomField | LockerverseSingleOptionCustomField;\n}) {\n const selectedValues = Array.isArray(value) ? value : [];\n return (\n <fieldset\n aria-describedby={error ? errorId : undefined}\n aria-invalid={error ? \"true\" : undefined}\n >\n <legend>{field.label}</legend>\n {field.options.map((option, index) => (\n <label className={choiceClassName} key={option.id}>\n <input\n checked={\n Array.isArray(value)\n ? value.includes(option.id)\n : value === option.id\n }\n id={`${controlId}-${index}`}\n name={`custom:${field.id}`}\n onChange={(event) => {\n if (field.type === \"radio\") {\n onChange(option.id);\n return;\n }\n onChange(\n event.currentTarget.checked\n ? [...selectedValues, option.id]\n : selectedValues.filter((id) => id !== option.id)\n );\n }}\n required={field.required && field.type === \"radio\"}\n type={field.type === \"radio\" ? \"radio\" : \"checkbox\"}\n value={option.id}\n />\n <span>{option.label}</span>\n </label>\n ))}\n <FieldError className={errorClassName} error={error} id={errorId} />\n </fieldset>\n );\n}\n","export function FormSkeleton({\n fieldCount,\n label,\n sectionCount = 0,\n showCheckbox = false,\n}: {\n fieldCount: number;\n label: string;\n sectionCount?: number;\n showCheckbox?: boolean;\n}) {\n return (\n <div className=\"lockerverse-form-skeleton__loading\">\n <span className=\"lockerverse-form-skeleton__sr-only\" role=\"status\">\n {label}\n </span>\n <div aria-hidden=\"true\" className=\"lockerverse-form-skeleton\">\n <div className=\"lockerverse-form-skeleton__branding\">\n <span className=\"lockerverse-form-skeleton__avatar\" />\n <span className=\"lockerverse-form-skeleton__community\" />\n </div>\n <div className=\"lockerverse-form-skeleton__fields\">\n {Array.from({ length: fieldCount }, (_, index) => (\n <div className=\"lockerverse-form-skeleton__field\" key={index}>\n <span className=\"lockerverse-form-skeleton__label\" />\n <span className=\"lockerverse-form-skeleton__input\" />\n </div>\n ))}\n </div>\n {Array.from({ length: sectionCount }, (_, index) => (\n <div className=\"lockerverse-form-skeleton__section\" key={index}>\n <span className=\"lockerverse-form-skeleton__section-label\" />\n <div className=\"lockerverse-form-skeleton__section-content\">\n <span className=\"lockerverse-form-skeleton__section-full\" />\n <div className=\"lockerverse-form-skeleton__section-grid\">\n <span className=\"lockerverse-form-skeleton__section-half\" />\n <span className=\"lockerverse-form-skeleton__section-half\" />\n </div>\n </div>\n </div>\n ))}\n <div className=\"lockerverse-form-skeleton__actions\">\n {showCheckbox ? (\n <span className=\"lockerverse-form-skeleton__check-line\" />\n ) : null}\n <span className=\"lockerverse-form-skeleton__button\" />\n </div>\n </div>\n </div>\n );\n}\n","import { email, nonEmpty, pipe, regex, string, transform, trim } from \"valibot\";\n\nexport const EMAIL_REQUIRED_MESSAGE = \"Email is required.\";\nexport const EMAIL_INVALID_MESSAGE = \"Enter a valid email address.\";\nexport const PHONE_REQUIRED_MESSAGE = \"Phone is required.\";\nexport const PHONE_INVALID_MESSAGE = \"Enter a valid phone number.\";\n\nconst OPTIONAL_EMAIL_PATTERN = /^(?:$|[^\\s@]+@[^\\s@]+\\.[^\\s@]+)$/;\nconst INTERNATIONAL_PHONE_PATTERN = /^\\+[1-9]\\d{6,14}$/;\nconst OPTIONAL_INTERNATIONAL_PHONE_PATTERN = /^(?:$|\\+[1-9]\\d{6,14})$/;\n\nexport function normalizePhone(input: string) {\n return input.trim().replace(/[().\\s-]/g, \"\");\n}\n\nexport const optionalEmailSchema = pipe(\n string(),\n trim(),\n regex(OPTIONAL_EMAIL_PATTERN, EMAIL_INVALID_MESSAGE)\n);\n\nexport const requiredEmailSchema = pipe(\n string(),\n trim(),\n nonEmpty(EMAIL_REQUIRED_MESSAGE),\n email(EMAIL_INVALID_MESSAGE)\n);\n\nexport const optionalPhoneSchema = pipe(\n string(),\n trim(),\n transform(normalizePhone),\n regex(OPTIONAL_INTERNATIONAL_PHONE_PATTERN, PHONE_INVALID_MESSAGE)\n);\n\nexport const requiredPhoneSchema = pipe(\n string(),\n trim(),\n nonEmp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,yCAA2C,CAAA,CACxD,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CAToD,EAAA,CASpD,CACN,EACD,EAAC,MAAD,CAAK,UAAU,qCAAf,SAAA,CACG,EACC,EAAC,OAAD,CAAM,UAAU,uCAAyC,CAAA,EACvD,KACJ,EAAC,OAAD,CAAM,UAAU,mCAAqC,CAAA,CAClD,GACF,CACF,CAAA,CAAA,GAET,CChDA,MACa,EAAwB,+BAExB,EAAwB,8BAE/B,EAAyB,mCACzB,EAA8B,oBAC9B,EAAuC,0BAE7C,SAAgB,EAAe,EAAe,CAC5C,OAAO,EAAM,KAAK,CAAC,CAAC,QAAQ,YAAa,EAAE,CAC7C,CAEA,MAAa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAM,EAAwB,CAAqB,CACrD,EAEa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAS,oBAAsB,EAC/B,EAAM,CAAqB,CAC7B,EAEa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAU,CAAc,EACxB,EAAM,EAAsC,CAAqB,CACnE,EAEa,EAAsB,EACjC,EAAO,EACP,EAAK,EACL,EAAS,oBAAsB,EAC/B,EAAU,CAAc,EACxB,EAAM,EAA6B,CAAqB,CAC1D"}
@@ -0,0 +1,269 @@
1
+ .lockerverse-payment,
2
+ .lockerverse-signup {
3
+ --lockerverse-form-accent: var(--lockerverse-accent);
4
+ --lockerverse-form-border: var(--lockerverse-border);
5
+ --lockerverse-form-control: var(--lockerverse-control);
6
+ --lockerverse-form-muted: var(--lockerverse-muted);
7
+ --lockerverse-form-placeholder: var(--lockerverse-placeholder);
8
+ --lockerverse-form-radius: var(--lockerverse-radius);
9
+ --lockerverse-form-subtle: var(--lockerverse-subtle);
10
+ --lockerverse-form-text: var(--lockerverse-text);
11
+ }
12
+
13
+ .lockerverse-signup {
14
+ --lockerverse-form-accent: var(--lockerverse-signup-accent);
15
+ --lockerverse-form-border: var(--lockerverse-signup-border);
16
+ --lockerverse-form-control: var(--lockerverse-signup-control);
17
+ --lockerverse-form-muted: var(--lockerverse-signup-muted);
18
+ --lockerverse-form-placeholder: var(--lockerverse-signup-placeholder);
19
+ --lockerverse-form-radius: var(--lockerverse-signup-radius);
20
+ --lockerverse-form-subtle: var(--lockerverse-signup-subtle);
21
+ --lockerverse-form-text: var(--lockerverse-signup-text);
22
+ }
23
+
24
+ :is(.lockerverse-payment, .lockerverse-signup)
25
+ label:not(.lockerverse-payment__check-row),
26
+ :is(.lockerverse-payment, .lockerverse-signup) .lockerverse-payment__field,
27
+ :is(.lockerverse-payment, .lockerverse-signup) fieldset {
28
+ display: grid;
29
+ gap: 8px;
30
+ }
31
+
32
+ :is(.lockerverse-payment, .lockerverse-signup) label > span,
33
+ :is(.lockerverse-payment, .lockerverse-signup)
34
+ .lockerverse-payment__field
35
+ > span,
36
+ :is(.lockerverse-payment, .lockerverse-signup) legend {
37
+ font-size: 14px;
38
+ font-weight: 500;
39
+ line-height: 1.45;
40
+ color: color-mix(in srgb, var(--lockerverse-form-text) 82%, transparent);
41
+ }
42
+
43
+ :is(.lockerverse-payment, .lockerverse-signup) fieldset {
44
+ min-width: 0;
45
+ padding: 0;
46
+ margin: 0;
47
+ border: 0;
48
+ }
49
+
50
+ :is(.lockerverse-payment, .lockerverse-signup)
51
+ input:not([type="checkbox"]):not([type="radio"]),
52
+ :is(.lockerverse-payment, .lockerverse-signup) select,
53
+ :is(.lockerverse-payment, .lockerverse-signup) textarea {
54
+ width: 100%;
55
+ min-height: 48px;
56
+ padding: 11px 13px;
57
+ font: inherit;
58
+ font-size: 16px;
59
+ line-height: 1.5;
60
+ color: var(--lockerverse-form-text);
61
+ appearance: none;
62
+ outline: none;
63
+ background-color: var(--lockerverse-form-control);
64
+ border: 1px solid var(--lockerverse-form-border);
65
+ border-radius: var(--lockerverse-form-radius);
66
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 4%);
67
+ transition:
68
+ border-color 140ms ease,
69
+ box-shadow 140ms ease;
70
+ }
71
+
72
+ :is(.lockerverse-payment, .lockerverse-signup) select {
73
+ padding-right: 38px;
74
+ background-image:
75
+ linear-gradient(45deg, transparent 50%, currentcolor 50%),
76
+ linear-gradient(135deg, currentcolor 50%, transparent 50%);
77
+ background-repeat: no-repeat;
78
+ background-position:
79
+ calc(100% - 17px) calc(50% - 2px),
80
+ calc(100% - 12px) calc(50% - 2px);
81
+ background-size:
82
+ 5px 5px,
83
+ 5px 5px;
84
+ }
85
+
86
+ :is(.lockerverse-payment, .lockerverse-signup) textarea {
87
+ min-height: 112px;
88
+ padding-top: 12px;
89
+ resize: vertical;
90
+ }
91
+
92
+ :is(.lockerverse-payment, .lockerverse-signup) input::placeholder,
93
+ :is(.lockerverse-payment, .lockerverse-signup) textarea::placeholder {
94
+ color: var(--lockerverse-form-placeholder);
95
+ opacity: 1;
96
+ }
97
+
98
+ :is(.lockerverse-payment, .lockerverse-signup)
99
+ input:not([type="checkbox"]):not([type="radio"]):focus,
100
+ :is(.lockerverse-payment, .lockerverse-signup) select:focus,
101
+ :is(.lockerverse-payment, .lockerverse-signup) textarea:focus,
102
+ :is(.lockerverse-payment, .lockerverse-signup) button:focus {
103
+ outline: none;
104
+ border-color: var(--lockerverse-form-accent);
105
+ }
106
+
107
+ :is(.lockerverse-payment, .lockerverse-signup)
108
+ input:not([type="checkbox"]):not([type="radio"]):focus,
109
+ :is(.lockerverse-payment, .lockerverse-signup) select:focus,
110
+ :is(.lockerverse-payment, .lockerverse-signup) textarea:focus {
111
+ box-shadow: 0 0 0 1px var(--lockerverse-form-accent);
112
+ }
113
+
114
+ :is(.lockerverse-payment, .lockerverse-signup)
115
+ input:not([type="checkbox"]):not([type="radio"]):focus-visible,
116
+ :is(.lockerverse-payment, .lockerverse-signup) select:focus-visible,
117
+ :is(.lockerverse-payment, .lockerverse-signup) textarea:focus-visible,
118
+ :is(.lockerverse-payment, .lockerverse-signup) button:focus-visible {
119
+ box-shadow: 0 0 0 2px
120
+ color-mix(in srgb, var(--lockerverse-form-accent) 24%, transparent);
121
+ }
122
+
123
+ .lockerverse-form-skeleton__sr-only {
124
+ position: absolute;
125
+ width: 1px;
126
+ height: 1px;
127
+ padding: 0;
128
+ margin: -1px;
129
+ overflow: hidden;
130
+ white-space: nowrap;
131
+ border: 0;
132
+ clip: rect(0, 0, 0, 0);
133
+ }
134
+
135
+ .lockerverse-form-skeleton {
136
+ display: grid;
137
+ gap: 16px;
138
+ }
139
+
140
+ .lockerverse-form-skeleton__branding {
141
+ display: flex;
142
+ gap: 14px;
143
+ align-items: center;
144
+ }
145
+
146
+ .lockerverse-form-skeleton__avatar,
147
+ .lockerverse-form-skeleton__community,
148
+ .lockerverse-form-skeleton__label,
149
+ .lockerverse-form-skeleton__input,
150
+ .lockerverse-form-skeleton__section-label,
151
+ .lockerverse-form-skeleton__section-full,
152
+ .lockerverse-form-skeleton__section-half,
153
+ .lockerverse-form-skeleton__check-line,
154
+ .lockerverse-form-skeleton__button {
155
+ display: block;
156
+ background: color-mix(in srgb, var(--lockerverse-form-text) 8%, transparent);
157
+ animation: lockerverse-form-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
158
+ }
159
+
160
+ .lockerverse-form-skeleton__avatar {
161
+ flex: none;
162
+ width: 48px;
163
+ height: 48px;
164
+ border-radius: var(--lockerverse-form-radius);
165
+ }
166
+
167
+ .lockerverse-form-skeleton__community {
168
+ width: 176px;
169
+ height: 20px;
170
+ border-radius: 4px;
171
+ }
172
+
173
+ .lockerverse-form-skeleton__fields {
174
+ display: grid;
175
+ gap: 12px;
176
+ padding-top: 14px;
177
+ border-top: 1px solid var(--lockerverse-form-subtle);
178
+ }
179
+
180
+ .lockerverse-form-skeleton__field {
181
+ display: grid;
182
+ gap: 8px;
183
+ }
184
+
185
+ .lockerverse-form-skeleton__label {
186
+ width: 48px;
187
+ height: 16px;
188
+ border-radius: 4px;
189
+ }
190
+
191
+ .lockerverse-form-skeleton__input {
192
+ width: 100%;
193
+ height: 48px;
194
+ background: var(--lockerverse-form-control);
195
+ border: 1px solid var(--lockerverse-form-subtle);
196
+ border-radius: var(--lockerverse-form-radius);
197
+ }
198
+
199
+ .lockerverse-form-skeleton__section {
200
+ padding: 12px;
201
+ background: color-mix(
202
+ in srgb,
203
+ var(--lockerverse-form-text) 2.5%,
204
+ transparent
205
+ );
206
+ border: 1px solid var(--lockerverse-form-subtle);
207
+ border-radius: var(--lockerverse-form-radius);
208
+ }
209
+
210
+ .lockerverse-form-skeleton__section-label {
211
+ width: 144px;
212
+ height: 16px;
213
+ border-radius: 4px;
214
+ }
215
+
216
+ .lockerverse-form-skeleton__section-content {
217
+ display: grid;
218
+ gap: 8px;
219
+ margin-top: 12px;
220
+ }
221
+
222
+ .lockerverse-form-skeleton__section-full,
223
+ .lockerverse-form-skeleton__section-half {
224
+ height: 36px;
225
+ border-radius: 6px;
226
+ }
227
+
228
+ .lockerverse-form-skeleton__section-full {
229
+ background: color-mix(in srgb, var(--lockerverse-form-text) 6%, transparent);
230
+ }
231
+
232
+ .lockerverse-form-skeleton__section-grid {
233
+ display: grid;
234
+ grid-template-columns: repeat(2, minmax(0, 1fr));
235
+ gap: 8px;
236
+ }
237
+
238
+ .lockerverse-form-skeleton__section-half {
239
+ background: color-mix(
240
+ in srgb,
241
+ var(--lockerverse-form-text) 4.5%,
242
+ transparent
243
+ );
244
+ }
245
+
246
+ .lockerverse-form-skeleton__actions {
247
+ display: grid;
248
+ gap: 16px;
249
+ padding: 20px 0 4px;
250
+ }
251
+
252
+ .lockerverse-form-skeleton__check-line {
253
+ width: min(256px, 70%);
254
+ height: 20px;
255
+ border-radius: 4px;
256
+ }
257
+
258
+ .lockerverse-form-skeleton__button {
259
+ width: 100%;
260
+ height: 48px;
261
+ background: color-mix(in srgb, var(--lockerverse-form-text) 12%, transparent);
262
+ border-radius: var(--lockerverse-form-radius);
263
+ }
264
+
265
+ @keyframes lockerverse-form-pulse {
266
+ 50% {
267
+ opacity: 0.55;
268
+ }
269
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"lockerverse-donate-launcher.d.ts","names":[],"sources":["../src/lockerverse-donate-launcher.tsx"],"mappings":";;iBAkBgB,4BACd,aACA,aACG,gBACF,iDAA8B,IAAA"}
1
+ {"version":3,"file":"lockerverse-donate-launcher.d.ts","names":[],"sources":["../src/lockerverse-donate-launcher.tsx"],"mappings":";;iBAwjBgB,4BACd,aACA,aACG,gBACF,iDAA8B,IAAA"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./lockerverse-payment.js";import{Dialog as t}from"@base-ui/react/dialog";import{createLockerverseCheckoutClient as n}from"@lockerverse/sdk/checkout";import{useEffect as r,useId as i,useState as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";const c=new Intl.NumberFormat(`en-US`,{currency:`USD`,style:`currency`});function l({buttonLabel:l=`Donate`,position:u=`inline`,...d}){let f=i(),[p,m]=a(!1),[h,g]=a(null),[_,v]=a(null),[y,b]=a(null),[x,S]=a(``),[C,w]=a(!1),[T,E]=a(0),{apiBaseUrl:D,communitySlug:O,environment:k,fetch:A,onError:j,requestTimeoutMs:M,sentryDsn:N,widgetSlug:P}=d;r(()=>{if(!(p&&h===null))return;let e=!0;return n(d).load().then(t=>{e&&(g(t),w(!1))}).catch(()=>{e&&w(!0)}),()=>{e=!1}},[D,h,O,k,A,T,j,p,M,N,P]);let F=o(`p`,{role:`status`,children:`Loading donation options...`});return C&&(F=s(`div`,{role:`alert`,children:[o(`p`,{children:`Unable to load donation options.`}),o(`button`,{onClick:()=>{w(!1),E(e=>e+1)},type:`button`,children:`Retry`})]})),h&&(F=o(`div`,{className:`lockerverse-launcher__products`,children:h.products.map(e=>s(`button`,{className:`lockerverse-launcher__product`,onClick:()=>{if(e.pricingMode===`custom`){b(e);return}if(e.paymentOption!==`one-time`){v([{productSlug:e.slug}]);return}v([{productSlug:e.slug,quantity:e.minimumQuantity??1}])},type:`button`,children:[s(`span`,{className:`lockerverse-launcher__product-copy`,children:[o(`span`,{children:e.name}),e.description?o(`small`,{children:e.description}):null]}),e.amountCents===null?null:o(`strong`,{children:c.format(e.amountCents/100)})]},e.id))})),y&&(F=s(`form`,{className:`lockerverse-launcher__amount-form`,onSubmit:e=>{e.preventDefault(),v([{amountCents:Math.round(Number(x)*100),productSlug:y.slug}])},children:[o(`label`,{htmlFor:f,children:`Donation amount`}),o(`input`,{id:f,min:(y.minimumAmountCents??1)/100,name:`amount`,onChange:e=>S(e.target.value),required:!0,step:`0.01`,type:`number`,value:x}),o(`button`,{type:`submit`,children:`Continue`})]})),_&&(F=s(`div`,{className:`lockerverse-launcher__checkout`,children:[o(`button`,{className:`lockerverse-launcher__back`,onClick:()=>v(null),type:`button`,children:`Back`}),o(e,{...d,selection:_})]})),s(t.Root,{onOpenChange:m,open:p,children:[o(t.Trigger,{className:`lockerverse-launcher lockerverse-launcher--${u}`,"data-lockerverse-theme":d.theme??`dark`,style:d.style,children:l}),s(t.Portal,{children:[o(t.Backdrop,{className:`lockerverse-launcher__backdrop`}),o(t.Viewport,{className:`lockerverse-launcher__viewport`,children:s(t.Popup,{className:`lockerverse-launcher__dialog`,"data-lockerverse-theme":d.theme??`dark`,style:d.style,children:[o(t.Title,{className:`lockerverse-launcher__title`,children:h?.widget.title??h?.widget.name??`Donate`}),h?.widget.description?o(t.Description,{className:`lockerverse-launcher__description`,children:h.widget.description}):null,o(t.Close,{"aria-label":`Close donation dialog`,className:`lockerverse-launcher__close`,children:`Close`}),F]})})]})]})}export{l as t};
1
+ import{t as e}from"./lockerverse-payment.js";import{Dialog as t}from"@base-ui/react/dialog";import{createLockerverseCheckoutClient as n}from"@lockerverse/sdk/checkout";import{createElement as r,useEffect as i,useState as a}from"react";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";const l=new Intl.NumberFormat(`en-US`,{currency:`USD`,style:`currency`}),u=/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/,d=[1e3,2500,5e3,1e4];function f(e){if(!u.test(e))return null;let t=Math.round(Number(e)*100);return Number.isSafeInteger(t)&&t>0?t:null}function p(e,t){let n=``;return t===`monthly`&&(n=`/month`),t===`annually`&&(n=`/year`),`${l.format(e/100)}${n}`}function m({customAmounts:e,product:t,quantities:n,recurringProductId:r,setCustomAmounts:i,setQuantities:a,setRecurringProductId:o}){let u=n[t.id]??0;if(t.pricingMode===`fixed`&&t.paymentOption===`one-time`){let e=Math.min(t.maximumQuantity??1/0,t.inventoryQuantity??1/0);return c(`span`,{className:`lockerverse-launcher__quantity`,children:[s(`button`,{"aria-label":`Decrease ${t.name} quantity`,disabled:u===0,onClick:()=>{o(null),a(e=>{let n=e[t.id]??0,r=t.minimumQuantity??1;return{...e,[t.id]:n<=r?0:n-1}})},type:`button`,children:`−`}),s(`output`,{"aria-label":`${t.name} quantity`,children:u}),s(`button`,{"aria-label":`Increase ${t.name} quantity`,disabled:u>=e,onClick:()=>{o(null),a(e=>{let n=e[t.id]??0;return{...e,[t.id]:n===0?t.minimumQuantity??1:n+1}})},type:`button`,children:`+`})]})}return t.pricingMode===`custom`&&t.paymentOption===`one-time`?c(`span`,{className:`lockerverse-launcher__custom-amount`,children:[s(`span`,{"aria-hidden":`true`,children:`$`}),s(`input`,{"aria-label":`${t.name} amount`,min:(t.minimumAmountCents??1)/100,name:`amount-${t.slug}`,onChange:e=>{o(null),i(n=>({...n,[t.id]:e.target.value}))},placeholder:`0.00`,step:`0.01`,type:`number`,value:e[t.id]??``}),t.minimumAmountCents===null?null:c(`small`,{children:[`Minimum `,l.format(t.minimumAmountCents/100)]})]}):s(`button`,{"aria-label":`Select ${t.name}`,"aria-pressed":r===t.id,className:`lockerverse-launcher__select`,onClick:()=>{a({}),i({}),o(e=>e===t.id?null:t.id)},type:`button`,children:`Select`})}function h({variant:e=`default`,...t}){let{customAmounts:n,product:r,quantities:i,recurringProductId:a}=t,o=f(n[r.id]??``),l=a===r.id||r.paymentOption===`one-time`&&(r.pricingMode===`fixed`&&(i[r.id]??0)>0||r.pricingMode===`custom`&&o!==null&&(r.minimumAmountCents===null||o>=r.minimumAmountCents));return c(`article`,{className:`lockerverse-launcher__product lockerverse-launcher__product--${e}`,"data-selected":l||void 0,children:[c(`span`,{className:`lockerverse-launcher__product-copy`,children:[s(`strong`,{className:`lockerverse-launcher__product-name`,children:r.name}),r.description?s(`small`,{children:r.description}):null,r.amountCents===null?null:s(`span`,{className:`lockerverse-launcher__product-price`,children:p(r.amountCents,r.paymentOption)})]}),s(m,{...t})]})}function g({customAmounts:e,product:t,setCustomAmounts:n,setRecurringProductId:r}){let i=e[t.id]??``,a=f(i),o=d.filter(e=>t.minimumAmountCents===null||e>=t.minimumAmountCents),u=o.includes(a??0),p=e=>{r(null),n(n=>({...n,[t.id]:e}))};return s(`div`,{className:`lockerverse-launcher__donation-option`,children:c(`fieldset`,{className:`lockerverse-launcher__donation-choices`,children:[c(`legend`,{className:`lockerverse-launcher__sr-only`,children:[t.name,` amount`]}),s(`button`,{"aria-pressed":i===``,onClick:()=>p(``),type:`button`,children:`No thanks`}),o.map(e=>s(`button`,{"aria-pressed":a===e,onClick:()=>p(String(e/100)),type:`button`,children:l.format(e/100).replace(`.00`,``)},e)),s(`label`,{className:`lockerverse-launcher__donation-other`,"data-selected":i!==``&&!u||void 0,children:s(`input`,{"aria-label":`${t.name} amount`,min:(t.minimumAmountCents??1)/100,name:`amount-${t.slug}`,onChange:e=>p(e.target.value),placeholder:`Other $`,step:`0.01`,type:`number`,value:u?``:i})})]})})}function _({products:e,variant:t=`default`,...n}){return s(`div`,{className:`lockerverse-launcher__product-list`,children:e.map(e=>t===`donation`?r(g,{...n,key:e.id,product:e}):r(h,{...n,key:e.id,product:e,variant:t}))})}function v(e,t){let n=0,r=0;for(let i of t){let t=e.products.find(e=>e.slug===i.productSlug);if(t){if(`quantity`in i){n+=i.quantity,r+=(t.amountCents??0)*i.quantity;continue}n+=1,r+=`amountCents`in i?i.amountCents:t.amountCents??0}}return{amountCents:r,itemCount:n}}function y(){return s(`div`,{"aria-label":`Loading donation options`,className:`lockerverse-launcher__loading`,role:`status`,children:[0,1,2].map(e=>s(`span`,{"aria-hidden":`true`,className:`lockerverse-launcher__loading-row`},e))})}function b(e,t,n,r){if(r){let t=e.products.find(e=>e.id===r&&e.paymentOption!==`one-time`);return t?[{productSlug:t.slug}]:[]}return e.products.flatMap(e=>{let r=t[e.id]??0;if(e.pricingMode===`fixed`&&e.paymentOption===`one-time`&&r>0)return[{productSlug:e.slug,quantity:r}];let i=f(n[e.id]??``);return e.pricingMode===`custom`&&e.paymentOption===`one-time`&&i!==null&&(e.minimumAmountCents===null||i>=e.minimumAmountCents)?[{amountCents:i,productSlug:e.slug}]:[]})}function x({catalog:e,onContinue:t,...n}){let r=b(e,n.quantities,n.customAmounts,n.recurringProductId),i=v(e,r),a=e.products.filter(e=>e.paymentOption===`one-time`&&e.pricingMode===`custom`),o=e.products.filter(e=>!a.includes(e));return c(`form`,{className:`lockerverse-launcher__products`,onSubmit:e=>{e.preventDefault(),r.length>0&&t(r)},children:[o.length>0?s(`section`,{className:`lockerverse-launcher__section`,children:s(_,{...n,products:o})}):null,a.length>0?c(`section`,{className:`lockerverse-launcher__donation`,children:[c(`header`,{className:`lockerverse-launcher__section-header`,children:[s(`h3`,{children:`Add a donation`}),s(`p`,{children:`Choose an amount to add to this order.`})]}),s(_,{...n,products:a,variant:`donation`})]}):null,e.products.length>0?c(`footer`,{className:`lockerverse-launcher__footer`,children:[c(`p`,{"aria-live":`polite`,className:`lockerverse-launcher__summary`,children:[s(`span`,{children:i.itemCount===0?`No items selected`:`${i.itemCount} ${i.itemCount===1?`item`:`items`} selected`}),i.itemCount===0?null:s(`strong`,{children:l.format(i.amountCents/100)})]}),s(`button`,{className:`lockerverse-launcher__continue`,disabled:r.length===0,type:`submit`,children:`Continue`})]}):null]})}function S({onEdit:t,paymentProps:n,selection:r,style:i}){return c(`div`,{className:`lockerverse-launcher__checkout`,children:[s(`header`,{className:`lockerverse-launcher__checkout-toolbar`,children:s(`button`,{className:`lockerverse-launcher__back`,onClick:t,type:`button`,children:`Edit order`})}),s(e,{...n,selection:r,style:i})]})}function C({catalog:e,checkout:n}){return n?c(o,{children:[s(t.Title,{className:`lockerverse-launcher__sr-only`,children:`Checkout`}),s(t.Description,{className:`lockerverse-launcher__sr-only`,children:`Review the order and complete payment.`})]}):e?c(`header`,{className:`lockerverse-launcher__header`,children:[e.community?c(`div`,{className:`lockerverse-launcher__brand`,children:[e.community.imageUrl?s(`img`,{alt:`${e.community.name} logo`,height:`28`,src:e.community.imageUrl,width:`28`}):null,s(`span`,{children:e.community.name})]}):null,s(t.Title,{className:`lockerverse-launcher__title`,children:e.widget.title??e.widget.name}),s(t.Description,{className:`lockerverse-launcher__description`,children:e.widget.description??`Choose your options, then continue to checkout.`})]}):c(`header`,{className:`lockerverse-launcher__header`,children:[s(t.Title,{className:`lockerverse-launcher__title`,children:`Donate`}),s(t.Description,{className:`lockerverse-launcher__description`,children:`Choose your options, then continue to checkout.`})]})}function w({buttonLabel:e=`Donate`,position:r=`inline`,...o}){let[l,u]=a(!1),[d,f]=a(null),[p,m]=a(null),[h,g]=a({}),[_,v]=a({}),[b,w]=a(null),[T,E]=a(!1),[D,O]=a(0),{apiBaseUrl:k,communitySlug:A,environment:j,fetch:M,onError:N,requestTimeoutMs:P,sentryDsn:F,widgetSlug:I}=o,L={...d?.community?{"--lockerverse-accent":d.community.accentColor}:{},...o.style};i(()=>{if(!(l&&d===null))return;let e=!0;return n(o).load().then(t=>{e&&(f(t),E(!1))}).catch(()=>{e&&E(!0)}),()=>{e=!1}},[k,d,A,j,M,D,N,l,P,F,I]);let R=s(y,{});return T&&(R=c(`div`,{role:`alert`,children:[s(`p`,{children:`Unable to load donation options.`}),s(`button`,{onClick:()=>{E(!1),O(e=>e+1)},type:`button`,children:`Retry`})]})),d&&(R=s(x,{catalog:d,customAmounts:h,onContinue:m,quantities:_,recurringProductId:b,setCustomAmounts:g,setQuantities:v,setRecurringProductId:w})),p&&(R=s(S,{onEdit:()=>m(null),paymentProps:o,selection:p,style:L})),c(t.Root,{onOpenChange:u,open:l,children:[s(t.Trigger,{className:`lockerverse-launcher lockerverse-launcher--${r}`,"data-lockerverse-theme":o.theme??`dark`,style:L,children:e}),c(t.Portal,{children:[s(t.Backdrop,{className:`lockerverse-launcher__backdrop`}),s(t.Viewport,{className:`lockerverse-launcher__viewport`,children:c(t.Popup,{className:`lockerverse-launcher__dialog`,"data-lockerverse-theme":o.theme??`dark`,style:L,children:[s(C,{catalog:d,checkout:p!==null}),s(t.Close,{"aria-label":`Close donation dialog`,className:`lockerverse-launcher__close`,children:s(`span`,{"aria-hidden":`true`,children:`×`})}),R]})})]})]})}export{w as t};
2
2
  //# sourceMappingURL=lockerverse-donate-launcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lockerverse-donate-launcher.js","names":[],"sources":["../src/lockerverse-donate-launcher.tsx"],"sourcesContent":["import { Dialog } from \"@base-ui/react/dialog\";\nimport {\n createLockerverseCheckoutClient,\n type LockerverseCatalog,\n} from \"@lockerverse/sdk/checkout\";\nimport { type ReactNode, useEffect, useId, useState } from \"react\";\n\nimport { LockerversePayment } from \"./lockerverse-payment.tsx\";\nimport type {\n LockerverseDonateLauncherProps,\n LockerversePaymentSelectionItem,\n} from \"./types.ts\";\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n currency: \"USD\",\n style: \"currency\",\n});\n\nexport function LockerverseDonateLauncher({\n buttonLabel = \"Donate\",\n position = \"inline\",\n ...paymentProps\n}: LockerverseDonateLauncherProps) {\n const amountInputId = useId();\n const [open, setOpen] = useState(false);\n const [catalog, setCatalog] = useState<LockerverseCatalog | null>(null);\n const [selection, setSelection] = useState<\n LockerversePaymentSelectionItem[] | null\n >(null);\n const [customProduct, setCustomProduct] = useState<\n LockerverseCatalog[\"products\"][number] | null\n >(null);\n const [customAmount, setCustomAmount] = useState(\"\");\n const [loadError, setLoadError] = useState(false);\n const [loadRevision, setLoadRevision] = useState(0);\n const {\n apiBaseUrl,\n communitySlug,\n environment,\n fetch,\n onError,\n requestTimeoutMs,\n sentryDsn,\n widgetSlug,\n } = paymentProps;\n\n useEffect(() => {\n if (!(open && catalog === null)) {\n return;\n }\n let active = true;\n const client = createLockerverseCheckoutClient(paymentProps);\n client\n .load()\n .then((nextCatalog) => {\n if (active) {\n setCatalog(nextCatalog);\n setLoadError(false);\n }\n })\n .catch(() => {\n if (active) {\n setLoadError(true);\n }\n });\n return () => {\n active = false;\n };\n }, [\n apiBaseUrl,\n catalog,\n communitySlug,\n environment,\n fetch,\n loadRevision,\n onError,\n open,\n requestTimeoutMs,\n sentryDsn,\n widgetSlug,\n ]);\n\n let content: ReactNode = <p role=\"status\">Loading donation options...</p>;\n if (loadError) {\n content = (\n <div role=\"alert\">\n <p>Unable to load donation options.</p>\n <button\n onClick={() => {\n setLoadError(false);\n setLoadRevision((revision) => revision + 1);\n }}\n type=\"button\"\n >\n Retry\n </button>\n </div>\n );\n }\n if (catalog) {\n content = (\n <div className=\"lockerverse-launcher__products\">\n {catalog.products.map((product) => (\n <button\n className=\"lockerverse-launcher__product\"\n key={product.id}\n onClick={() => {\n if (product.pricingMode === \"custom\") {\n setCustomProduct(product);\n return;\n }\n if (product.paymentOption !== \"one-time\") {\n setSelection([{ productSlug: product.slug }]);\n return;\n }\n setSelection([\n {\n productSlug: product.slug,\n quantity: product.minimumQuantity ?? 1,\n },\n ]);\n }}\n type=\"button\"\n >\n <span className=\"lockerverse-launcher__product-copy\">\n <span>{product.name}</span>\n {product.description ? (\n <small>{product.description}</small>\n ) : null}\n </span>\n {product.amountCents === null ? null : (\n <strong>{usd.format(product.amountCents / 100)}</strong>\n )}\n </button>\n ))}\n </div>\n );\n }\n if (customProduct) {\n content = (\n <form\n className=\"lockerverse-launcher__amount-form\"\n onSubmit={(event) => {\n event.preventDefault();\n setSelection([\n {\n amountCents: Math.round(Number(customAmount) * 100),\n productSlug: customProduct.slug,\n },\n ]);\n }}\n >\n <label htmlFor={amountInputId}>Donation amount</label>\n <input\n id={amountInputId}\n min={(customProduct.minimumAmountCents ?? 1) / 100}\n name=\"amount\"\n onChange={(event) => setCustomAmount(event.target.value)}\n required\n step=\"0.01\"\n type=\"number\"\n value={customAmount}\n />\n <button type=\"submit\">Continue</button>\n </form>\n );\n }\n if (selection) {\n content = (\n <div className=\"lockerverse-launcher__checkout\">\n <button\n className=\"lockerverse-launcher__back\"\n onClick={() => setSelection(null)}\n type=\"button\"\n >\n Back\n </button>\n <LockerversePayment {...paymentProps} selection={selection} />\n </div>\n );\n }\n\n return (\n <Dialog.Root onOpenChange={setOpen} open={open}>\n <Dialog.Trigger\n className={`lockerverse-launcher lockerverse-launcher--${position}`}\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={paymentProps.style}\n >\n {buttonLabel}\n </Dialog.Trigger>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"lockerverse-launcher__backdrop\" />\n <Dialog.Viewport className=\"lockerverse-launcher__viewport\">\n <Dialog.Popup\n className=\"lockerverse-launcher__dialog\"\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={paymentProps.style}\n >\n <Dialog.Title className=\"lockerverse-launcher__title\">\n {catalog?.widget.title ?? catalog?.widget.name ?? \"Donate\"}\n </Dialog.Title>\n {catalog?.widget.description ? (\n <Dialog.Description className=\"lockerverse-launcher__description\">\n {catalog.widget.description}\n </Dialog.Description>\n ) : null}\n <Dialog.Close\n aria-label=\"Close donation dialog\"\n className=\"lockerverse-launcher__close\"\n >\n Close\n </Dialog.Close>\n {content}\n </Dialog.Popup>\n </Dialog.Viewport>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}\n"],"mappings":"qRAaA,MAAM,EAAM,IAAI,KAAK,aAAa,QAAS,CACzC,SAAU,MACV,MAAO,UACT,CAAC,EAED,SAAgB,EAA0B,CACxC,cAAc,SACd,WAAW,SACX,GAAG,GAC8B,CACjC,IAAM,EAAgB,EAAM,EACtB,CAAC,EAAM,GAAW,EAAS,EAAK,EAChC,CAAC,EAAS,GAAc,EAAoC,IAAI,EAChE,CAAC,EAAW,GA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SAAR,CAAiB,UAAU,gCAAkC,CAAA,EAC7D,EAAC,EAAO,SAAR,CAAiB,UAAU,iCACzB,SAAA,EAAC,EAAO,MAAR,CACE,UAAU,+BACV,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAAa,MAHtB,SAAA,CAKE,EAAC,EAAO,MAAR,CAAc,UAAU,8BACrB,SAAA,GAAS,OAAO,OAAS,GAAS,OAAO,MAAQ,QACtC,CAAA,EACb,GAAS,OAAO,YACf,EAAC,EAAO,YAAR,CAAoB,UAAU,oCAC3B,SAAA,EAAQ,OAAO,WACE,CAAA,EAClB,KACJ,EAAC,EAAO,MAAR,CACE,aAAW,wBACX,UAAU,8BACX,SAAA,OAEa,CAAA,EACb,CACW,GACC,CAAA,CACJ,CAAA,CAAA,CACJ,GAEjB"}
1
+ {"version":3,"file":"lockerverse-donate-launcher.js","names":[],"sources":["../src/lockerverse-donate-launcher.tsx"],"sourcesContent":["import { Dialog } from \"@base-ui/react/dialog\";\nimport {\n createLockerverseCheckoutClient,\n type LockerverseCatalog,\n type LockerverseProduct,\n} from \"@lockerverse/sdk/checkout\";\nimport {\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useEffect,\n useState,\n} from \"react\";\n\nimport { LockerversePayment } from \"./lockerverse-payment.tsx\";\nimport type {\n LockerverseDonateLauncherProps,\n LockerversePaymentSelectionItem,\n LockerversePaymentStyle,\n} from \"./types.ts\";\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n currency: \"USD\",\n style: \"currency\",\n});\nconst decimalAmountPattern = /^(?:0|[1-9]\\d*)(?:\\.\\d{1,2})?$/;\nconst suggestedDonationAmountsCents = [1000, 2500, 5000, 10_000];\n\nfunction parseAmountCents(value: string) {\n if (!decimalAmountPattern.test(value)) {\n return null;\n }\n const amountCents = Math.round(Number(value) * 100);\n return Number.isSafeInteger(amountCents) && amountCents > 0\n ? amountCents\n : null;\n}\n\nfunction formatProductPrice(\n amountCents: number,\n paymentOption: \"one-time\" | \"monthly\" | \"annually\"\n) {\n let cadence = \"\";\n if (paymentOption === \"monthly\") {\n cadence = \"/month\";\n }\n if (paymentOption === \"annually\") {\n cadence = \"/year\";\n }\n return `${usd.format(amountCents / 100)}${cadence}`;\n}\n\ntype LauncherProductControlProps = {\n customAmounts: Record<string, string>;\n product: LockerverseProduct;\n quantities: Record<string, number>;\n recurringProductId: string | null;\n setCustomAmounts: Dispatch<SetStateAction<Record<string, string>>>;\n setQuantities: Dispatch<SetStateAction<Record<string, number>>>;\n setRecurringProductId: Dispatch<SetStateAction<string | null>>;\n};\n\nfunction LauncherProductControl({\n customAmounts,\n product,\n quantities,\n recurringProductId,\n setCustomAmounts,\n setQuantities,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const quantity = quantities[product.id] ?? 0;\n if (product.pricingMode === \"fixed\" && product.paymentOption === \"one-time\") {\n const maximum = Math.min(\n product.maximumQuantity ?? Number.POSITIVE_INFINITY,\n product.inventoryQuantity ?? Number.POSITIVE_INFINITY\n );\n return (\n <span className=\"lockerverse-launcher__quantity\">\n <button\n aria-label={`Decrease ${product.name} quantity`}\n disabled={quantity === 0}\n onClick={() => {\n setRecurringProductId(null);\n setQuantities((current) => {\n const currentQuantity = current[product.id] ?? 0;\n const minimum = product.minimumQuantity ?? 1;\n return {\n ...current,\n [product.id]:\n currentQuantity <= minimum ? 0 : currentQuantity - 1,\n };\n });\n }}\n type=\"button\"\n >\n −\n </button>\n <output aria-label={`${product.name} quantity`}>{quantity}</output>\n <button\n aria-label={`Increase ${product.name} quantity`}\n disabled={quantity >= maximum}\n onClick={() => {\n setRecurringProductId(null);\n setQuantities((current) => {\n const currentQuantity = current[product.id] ?? 0;\n return {\n ...current,\n [product.id]:\n currentQuantity === 0\n ? (product.minimumQuantity ?? 1)\n : currentQuantity + 1,\n };\n });\n }}\n type=\"button\"\n >\n +\n </button>\n </span>\n );\n }\n\n if (\n product.pricingMode === \"custom\" &&\n product.paymentOption === \"one-time\"\n ) {\n return (\n <span className=\"lockerverse-launcher__custom-amount\">\n <span aria-hidden=\"true\">$</span>\n <input\n aria-label={`${product.name} amount`}\n min={(product.minimumAmountCents ?? 1) / 100}\n name={`amount-${product.slug}`}\n onChange={(event) => {\n setRecurringProductId(null);\n setCustomAmounts((current) => ({\n ...current,\n [product.id]: event.target.value,\n }));\n }}\n placeholder=\"0.00\"\n step=\"0.01\"\n type=\"number\"\n value={customAmounts[product.id] ?? \"\"}\n />\n {product.minimumAmountCents === null ? null : (\n <small>Minimum {usd.format(product.minimumAmountCents / 100)}</small>\n )}\n </span>\n );\n }\n\n return (\n <button\n aria-label={`Select ${product.name}`}\n aria-pressed={recurringProductId === product.id}\n className=\"lockerverse-launcher__select\"\n onClick={() => {\n setQuantities({});\n setCustomAmounts({});\n setRecurringProductId((current) =>\n current === product.id ? null : product.id\n );\n }}\n type=\"button\"\n >\n Select\n </button>\n );\n}\n\ntype LauncherProductOptionProps = LauncherProductControlProps & {\n variant?: \"default\" | \"donation\";\n};\n\nfunction LauncherProductOption({\n variant = \"default\",\n ...props\n}: LauncherProductOptionProps) {\n const { customAmounts, product, quantities, recurringProductId } = props;\n const customAmount = parseAmountCents(customAmounts[product.id] ?? \"\");\n const isSelected =\n recurringProductId === product.id ||\n (product.paymentOption === \"one-time\" &&\n ((product.pricingMode === \"fixed\" && (quantities[product.id] ?? 0) > 0) ||\n (product.pricingMode === \"custom\" &&\n customAmount !== null &&\n (product.minimumAmountCents === null ||\n customAmount >= product.minimumAmountCents))));\n return (\n <article\n className={`lockerverse-launcher__product lockerverse-launcher__product--${variant}`}\n data-selected={isSelected || undefined}\n >\n <span className=\"lockerverse-launcher__product-copy\">\n <strong className=\"lockerverse-launcher__product-name\">\n {product.name}\n </strong>\n {product.description ? <small>{product.description}</small> : null}\n {product.amountCents === null ? null : (\n <span className=\"lockerverse-launcher__product-price\">\n {formatProductPrice(product.amountCents, product.paymentOption)}\n </span>\n )}\n </span>\n <LauncherProductControl {...props} />\n </article>\n );\n}\n\nfunction LauncherDonationOption({\n customAmounts,\n product,\n setCustomAmounts,\n setRecurringProductId,\n}: LauncherProductControlProps) {\n const amount = customAmounts[product.id] ?? \"\";\n const amountCents = parseAmountCents(amount);\n const suggestions = suggestedDonationAmountsCents.filter(\n (suggestion) =>\n product.minimumAmountCents === null ||\n suggestion >= product.minimumAmountCents\n );\n const isSuggestedAmount = suggestions.includes(amountCents ?? 0);\n const setAmount = (value: string) => {\n setRecurringProductId(null);\n setCustomAmounts((current) => ({\n ...current,\n [product.id]: value,\n }));\n };\n\n return (\n <div className=\"lockerverse-launcher__donation-option\">\n <fieldset className=\"lockerverse-launcher__donation-choices\">\n <legend className=\"lockerverse-launcher__sr-only\">\n {product.name} amount\n </legend>\n <button\n aria-pressed={amount === \"\"}\n onClick={() => setAmount(\"\")}\n type=\"button\"\n >\n No thanks\n </button>\n {suggestions.map((suggestion) => (\n <button\n aria-pressed={amountCents === suggestion}\n key={suggestion}\n onClick={() => setAmount(String(suggestion / 100))}\n type=\"button\"\n >\n {usd.format(suggestion / 100).replace(\".00\", \"\")}\n </button>\n ))}\n <label\n className=\"lockerverse-launcher__donation-other\"\n data-selected={amount !== \"\" && !isSuggestedAmount ? true : undefined}\n >\n <input\n aria-label={`${product.name} amount`}\n min={(product.minimumAmountCents ?? 1) / 100}\n name={`amount-${product.slug}`}\n onChange={(event) => setAmount(event.target.value)}\n placeholder=\"Other $\"\n step=\"0.01\"\n type=\"number\"\n value={isSuggestedAmount ? \"\" : amount}\n />\n </label>\n </fieldset>\n </div>\n );\n}\n\ntype LauncherProductListProps = Omit<LauncherProductControlProps, \"product\"> & {\n products: LockerverseProduct[];\n variant?: LauncherProductOptionProps[\"variant\"];\n};\n\nfunction LauncherProductList({\n products,\n variant = \"default\",\n ...controlProps\n}: LauncherProductListProps) {\n return (\n <div className=\"lockerverse-launcher__product-list\">\n {products.map((product) =>\n variant === \"donation\" ? (\n <LauncherDonationOption\n {...controlProps}\n key={product.id}\n product={product}\n />\n ) : (\n <LauncherProductOption\n {...controlProps}\n key={product.id}\n product={product}\n variant={variant}\n />\n )\n )}\n </div>\n );\n}\n\nfunction getSelectionSummary(\n catalog: LockerverseCatalog,\n selection: LockerversePaymentSelectionItem[]\n) {\n let itemCount = 0;\n let amountCents = 0;\n for (const item of selection) {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!product) {\n continue;\n }\n if (\"quantity\" in item) {\n itemCount += item.quantity;\n amountCents += (product.amountCents ?? 0) * item.quantity;\n continue;\n }\n itemCount += 1;\n amountCents +=\n \"amountCents\" in item ? item.amountCents : (product.amountCents ?? 0);\n }\n return { amountCents, itemCount };\n}\n\nfunction LauncherLoading() {\n return (\n <div\n aria-label=\"Loading donation options\"\n className=\"lockerverse-launcher__loading\"\n role=\"status\"\n >\n {[0, 1, 2].map((item) => (\n <span\n aria-hidden=\"true\"\n className=\"lockerverse-launcher__loading-row\"\n key={item}\n />\n ))}\n </div>\n );\n}\n\nfunction createLauncherSelection(\n catalog: LockerverseCatalog,\n quantities: Record<string, number>,\n customAmounts: Record<string, string>,\n recurringProductId: string | null\n): LockerversePaymentSelectionItem[] {\n if (recurringProductId) {\n const product = catalog.products.find(\n (candidate) =>\n candidate.id === recurringProductId &&\n candidate.paymentOption !== \"one-time\"\n );\n return product ? [{ productSlug: product.slug }] : [];\n }\n\n return catalog.products.flatMap(\n (product): LockerversePaymentSelectionItem[] => {\n const quantity = quantities[product.id] ?? 0;\n if (\n product.pricingMode === \"fixed\" &&\n product.paymentOption === \"one-time\" &&\n quantity > 0\n ) {\n return [{ productSlug: product.slug, quantity }];\n }\n const amountCents = parseAmountCents(customAmounts[product.id] ?? \"\");\n if (\n product.pricingMode === \"custom\" &&\n product.paymentOption === \"one-time\" &&\n amountCents !== null &&\n (product.minimumAmountCents === null ||\n amountCents >= product.minimumAmountCents)\n ) {\n return [{ amountCents, productSlug: product.slug }];\n }\n return [];\n }\n );\n}\n\ntype LauncherSelectionStateProps = Omit<LauncherProductControlProps, \"product\">;\n\ntype LauncherCatalogProps = LauncherSelectionStateProps & {\n catalog: LockerverseCatalog;\n onContinue: (selection: LockerversePaymentSelectionItem[]) => void;\n};\n\nfunction LauncherCatalog({\n catalog,\n onContinue,\n ...selectionState\n}: LauncherCatalogProps) {\n const draftSelection = createLauncherSelection(\n catalog,\n selectionState.quantities,\n selectionState.customAmounts,\n selectionState.recurringProductId\n );\n const summary = getSelectionSummary(catalog, draftSelection);\n const donationProducts = catalog.products.filter(\n (product) =>\n product.paymentOption === \"one-time\" && product.pricingMode === \"custom\"\n );\n const orderProducts = catalog.products.filter(\n (product) => !donationProducts.includes(product)\n );\n\n return (\n <form\n className=\"lockerverse-launcher__products\"\n onSubmit={(event) => {\n event.preventDefault();\n if (draftSelection.length > 0) {\n onContinue(draftSelection);\n }\n }}\n >\n {orderProducts.length > 0 ? (\n <section className=\"lockerverse-launcher__section\">\n <LauncherProductList {...selectionState} products={orderProducts} />\n </section>\n ) : null}\n {donationProducts.length > 0 ? (\n <section className=\"lockerverse-launcher__donation\">\n <header className=\"lockerverse-launcher__section-header\">\n <h3>Add a donation</h3>\n <p>Choose an amount to add to this order.</p>\n </header>\n <LauncherProductList\n {...selectionState}\n products={donationProducts}\n variant=\"donation\"\n />\n </section>\n ) : null}\n {catalog.products.length > 0 ? (\n <footer className=\"lockerverse-launcher__footer\">\n <p aria-live=\"polite\" className=\"lockerverse-launcher__summary\">\n <span>\n {summary.itemCount === 0\n ? \"No items selected\"\n : `${summary.itemCount} ${summary.itemCount === 1 ? \"item\" : \"items\"} selected`}\n </span>\n {summary.itemCount === 0 ? null : (\n <strong>{usd.format(summary.amountCents / 100)}</strong>\n )}\n </p>\n <button\n className=\"lockerverse-launcher__continue\"\n disabled={draftSelection.length === 0}\n type=\"submit\"\n >\n Continue\n </button>\n </footer>\n ) : null}\n </form>\n );\n}\n\ntype LauncherPaymentProps = Omit<\n LockerverseDonateLauncherProps,\n \"buttonLabel\" | \"position\"\n>;\n\ntype LauncherCheckoutProps = {\n onEdit: () => void;\n paymentProps: LauncherPaymentProps;\n selection: LockerversePaymentSelectionItem[];\n style: LockerversePaymentStyle;\n};\n\nfunction LauncherCheckout({\n onEdit,\n paymentProps,\n selection,\n style,\n}: LauncherCheckoutProps) {\n return (\n <div className=\"lockerverse-launcher__checkout\">\n <header className=\"lockerverse-launcher__checkout-toolbar\">\n <button\n className=\"lockerverse-launcher__back\"\n onClick={onEdit}\n type=\"button\"\n >\n Edit order\n </button>\n </header>\n <LockerversePayment\n {...paymentProps}\n selection={selection}\n style={style}\n />\n </div>\n );\n}\n\nfunction LauncherDialogHeading({\n catalog,\n checkout,\n}: {\n catalog: LockerverseCatalog | null;\n checkout: boolean;\n}) {\n if (checkout) {\n return (\n <>\n <Dialog.Title className=\"lockerverse-launcher__sr-only\">\n Checkout\n </Dialog.Title>\n <Dialog.Description className=\"lockerverse-launcher__sr-only\">\n Review the order and complete payment.\n </Dialog.Description>\n </>\n );\n }\n\n if (!catalog) {\n return (\n <header className=\"lockerverse-launcher__header\">\n <Dialog.Title className=\"lockerverse-launcher__title\">\n Donate\n </Dialog.Title>\n <Dialog.Description className=\"lockerverse-launcher__description\">\n Choose your options, then continue to checkout.\n </Dialog.Description>\n </header>\n );\n }\n\n return (\n <header className=\"lockerverse-launcher__header\">\n {catalog.community ? (\n <div className=\"lockerverse-launcher__brand\">\n {catalog.community.imageUrl ? (\n <img\n alt={`${catalog.community.name} logo`}\n height=\"28\"\n src={catalog.community.imageUrl}\n width=\"28\"\n />\n ) : null}\n <span>{catalog.community.name}</span>\n </div>\n ) : null}\n <Dialog.Title className=\"lockerverse-launcher__title\">\n {catalog.widget.title ?? catalog.widget.name}\n </Dialog.Title>\n <Dialog.Description className=\"lockerverse-launcher__description\">\n {catalog.widget.description ??\n \"Choose your options, then continue to checkout.\"}\n </Dialog.Description>\n </header>\n );\n}\n\nexport function LockerverseDonateLauncher({\n buttonLabel = \"Donate\",\n position = \"inline\",\n ...paymentProps\n}: LockerverseDonateLauncherProps) {\n const [open, setOpen] = useState(false);\n const [catalog, setCatalog] = useState<LockerverseCatalog | null>(null);\n const [selection, setSelection] = useState<\n LockerversePaymentSelectionItem[] | null\n >(null);\n const [customAmounts, setCustomAmounts] = useState<Record<string, string>>(\n {}\n );\n const [quantities, setQuantities] = useState<Record<string, number>>({});\n const [recurringProductId, setRecurringProductId] = useState<string | null>(\n null\n );\n const [loadError, setLoadError] = useState(false);\n const [loadRevision, setLoadRevision] = useState(0);\n const {\n apiBaseUrl,\n communitySlug,\n environment,\n fetch,\n onError,\n requestTimeoutMs,\n sentryDsn,\n widgetSlug,\n } = paymentProps;\n const launcherStyle: LockerversePaymentStyle = {\n ...(catalog?.community\n ? { \"--lockerverse-accent\": catalog.community.accentColor }\n : {}),\n ...paymentProps.style,\n };\n\n useEffect(() => {\n if (!(open && catalog === null)) {\n return;\n }\n let active = true;\n const client = createLockerverseCheckoutClient(paymentProps);\n client\n .load()\n .then((nextCatalog) => {\n if (active) {\n setCatalog(nextCatalog);\n setLoadError(false);\n }\n })\n .catch(() => {\n if (active) {\n setLoadError(true);\n }\n });\n return () => {\n active = false;\n };\n }, [\n apiBaseUrl,\n catalog,\n communitySlug,\n environment,\n fetch,\n loadRevision,\n onError,\n open,\n requestTimeoutMs,\n sentryDsn,\n widgetSlug,\n ]);\n\n let content: ReactNode = <LauncherLoading />;\n if (loadError) {\n content = (\n <div role=\"alert\">\n <p>Unable to load donation options.</p>\n <button\n onClick={() => {\n setLoadError(false);\n setLoadRevision((revision) => revision + 1);\n }}\n type=\"button\"\n >\n Retry\n </button>\n </div>\n );\n }\n if (catalog) {\n content = (\n <LauncherCatalog\n catalog={catalog}\n customAmounts={customAmounts}\n onContinue={setSelection}\n quantities={quantities}\n recurringProductId={recurringProductId}\n setCustomAmounts={setCustomAmounts}\n setQuantities={setQuantities}\n setRecurringProductId={setRecurringProductId}\n />\n );\n }\n if (selection) {\n content = (\n <LauncherCheckout\n onEdit={() => setSelection(null)}\n paymentProps={paymentProps}\n selection={selection}\n style={launcherStyle}\n />\n );\n }\n\n return (\n <Dialog.Root onOpenChange={setOpen} open={open}>\n <Dialog.Trigger\n className={`lockerverse-launcher lockerverse-launcher--${position}`}\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n {buttonLabel}\n </Dialog.Trigger>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"lockerverse-launcher__backdrop\" />\n <Dialog.Viewport className=\"lockerverse-launcher__viewport\">\n <Dialog.Popup\n className=\"lockerverse-launcher__dialog\"\n data-lockerverse-theme={paymentProps.theme ?? \"dark\"}\n style={launcherStyle}\n >\n <LauncherDialogHeading\n catalog={catalog}\n checkout={selection !== null}\n />\n <Dialog.Close\n aria-label=\"Close donation dialog\"\n className=\"lockerverse-launcher__close\"\n >\n <span aria-hidden=\"true\">×</span>\n </Dialog.Close>\n {content}\n </Dialog.Popup>\n </Dialog.Viewport>\n </Dialog.Portal>\n </Dialog.Root>\n );\n}\n"],"mappings":"2SAqBA,MAAM,EAAM,IAAI,KAAK,aAAa,QAAS,CACzC,SAAU,MACV,MAAO,UACT,CAAC,EACK,EAAuB,iCACvB,EAAgC,CAAC,IAAM,KAAM,IAAM,GAAM,EAE/D,SAAS,EAAiB,EAAe,CACvC,GAAI,CAAC,EAAqB,KAAK,CAAK,EAClC,OAAO,KAET,IAAM,EAAc,KAAK,MAAM,OAAO,CAAK,EAAI,GAAG,EAClD,OAAO,OAAO,cAAc,CAAW,GAAK,EAAc,EACtD,EACA,IACN,CAEA,SAAS,EACP,EACA,EACA,CACA,IAAI,EAAU,GAOd,OANI,IAAkB,YACpB,EAAU,UAER,IAAkB,aACpB,EAAU,SAEL,GAAG,EAAI,OAAO,EAAc,GAAG,IAAI,GAC5C,CAYA,SAAS,EAAuB,CAC9B,gBACA,UACA,aACA,qBACA,mBACA,gBACA,yBAC8B,CAC9B,IAAM,EAAW,EAAW,EAAQ,KAAO,EAC3C,GAAI,EAAQ,cAAgB,SAAW,EAAQ,gBAAkB,WAAY,CAC3E,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A,KAAK,SACN,SAAA,OAEO,CAAA,CACL,KAGL,IACF,EACE,EAAC,EAAD,CACW,UACM,gBACf,WAAY,EACA,aACQ,qBACF,mBACH,gBACQ,uBACxB,CAAA,GAGD,IACF,EACE,EAAC,EAAD,CACE,WAAc,EAAa,IAAI,EACjB,eACH,YACX,MAAO,CACR,CAAA,GAKH,EAAC,EAAO,KAAR,CAAa,aAAc,EAAe,OAA1C,SAAA,CACE,EAAC,EAAO,QAAR,CACE,UAAW,8CAA8C,IACzD,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAEN,SAAA,CACa,CAAA,EAChB,EAAC,EAAO,OAAR,CAAA,SAAA,CACE,EAAC,EAAO,SAAR,CAAiB,UAAU,gCAAkC,CAAA,EAC7D,EAAC,EAAO,SAAR,CAAiB,UAAU,iCACzB,SAAA,EAAC,EAAO,MAAR,CACE,UAAU,+BACV,yBAAwB,EAAa,OAAS,OAC9C,MAAO,EAHT,SAAA,CAKE,EAAC,EAAD,CACW,UACT,SAAU,IAAc,IACzB,CAAA,EACD,EAAC,EAAO,MAAR,CACE,aAAW,wBACX,UAAU,8BAEV,SAAA,EAAC,OAAD,CAAM,cAAY,OAAO,SAAA,GAAO,CAAA,CACpB,CAAA,EACb,CACW,GACC,CAAA,CACJ,CAAA,CAAA,CACJ,GAEjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"lockerverse-payment.d.ts","names":[],"sources":["../src/lockerverse-payment.tsx"],"mappings":";;iBAuiCgB,qBACd,YACA,UACA,WACA,eACA,aACA,OACA,UACA,SACA,mBACA,yBACA,oBACA,kBACA,eACA,WACA,WACA,OACA,cACA,OACA,eACG,gBACF,0CAAuB,IAAA"}
1
+ {"version":3,"file":"lockerverse-payment.d.ts","names":[],"sources":["../src/lockerverse-payment.tsx"],"mappings":";;iBAggCgB,qBACd,YACA,UACA,WACA,eACA,aACA,OACA,UACA,SACA,mBACA,yBACA,oBACA,kBACA,eACA,WACA,WACA,OACA,cACA,OACA,eACG,gBACF,0CAAuB,IAAA"}