@lockerverse/sdk 0.2.43 → 0.2.45

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.
@@ -1,6 +1,6 @@
1
- import { A as LockerverseSdkOperation, C as LockerversePaymentResult, D as LockerverseProduct, E as LockerversePreparedCheckout, F as LockerverseWidgetFields, M as LockerverseSubmitPaymentInput, N as LockerverseTextCustomField, O as LockerverseSdkError, P as LockerverseWidgetConfiguration, S as LockerversePaymentOption, T as LockerversePaymentSubmission, _ as LockerverseCustomFieldAnswerValue, a as LockerverseCatalog, b as LockerverseMultiOptionCustomField, c as LockerverseCheckoutItem, d as LockerverseCheckoutPricingInput, f as LockerverseCheckoutPricingPolicy, g as LockerverseCustomFieldAnswer, h as LockerverseCustomField, i as LockerverseCalculateTotalInput, j as LockerverseSingleOptionCustomField, k as LockerverseSdkErrorCode, l as LockerverseCheckoutLineItem, m as LockerverseCommunityBranding, n as LOCKERVERSE_SDK_VERSION, o as LockerverseCheckoutAmounts, p as LockerverseCheckoutQuote, r as LockerverseAppliedDiscount, s as LockerverseCheckoutClient, t as CreateLockerverseWidgetOptions, u as LockerverseCheckoutPaymentConfiguration, v as LockerverseCustomFieldOption, w as LockerversePaymentStatus, x as LockerversePaymentConfiguration, y as LockerverseEnvironment } from "./types.js";
1
+ import { A as LockerverseProduct, C as LockerverseMultiOptionCustomField, D as LockerversePaymentStatus, E as LockerversePaymentResult, F as LockerverseSubmitPaymentInput, I as LockerverseTextCustomField, L as LockerverseWidgetConfiguration, M as LockerverseSdkErrorCode, N as LockerverseSdkOperation, O as LockerversePaymentSubmission, P as LockerverseSingleOptionCustomField, R as LockerverseWidgetFields, S as LockerverseEnvironment, T as LockerversePaymentOption, _ as LockerverseCommunityBranding, a as LockerverseCalculateTotalInput, b as LockerverseCustomFieldAnswerValue, c as LockerverseCheckoutBootstrap, d as LockerverseCheckoutLineItem, f as LockerverseCheckoutPaymentConfiguration, g as LockerverseCheckoutSelectionItem, h as LockerverseCheckoutQuote, i as LockerverseBootstrapCheckoutInput, j as LockerverseSdkError, k as LockerversePreparedCheckout, l as LockerverseCheckoutClient, m as LockerverseCheckoutPricingPolicy, n as LOCKERVERSE_SDK_VERSION, o as LockerverseCatalog, p as LockerverseCheckoutPricingInput, r as LockerverseAppliedDiscount, s as LockerverseCheckoutAmounts, t as CreateLockerverseWidgetOptions, u as LockerverseCheckoutItem, v as LockerverseCustomField, w as LockerversePaymentConfiguration, x as LockerverseCustomFieldOption, y as LockerverseCustomFieldAnswer } from "./types.js";
2
2
  //#region src/checkout-client.d.ts
3
3
  declare function createLockerverseCheckoutClient(options: CreateLockerverseWidgetOptions): LockerverseCheckoutClient;
4
4
  //#endregion
5
- export { CreateLockerverseWidgetOptions, LOCKERVERSE_SDK_VERSION, LockerverseAppliedDiscount, LockerverseCalculateTotalInput, LockerverseCatalog, LockerverseCheckoutAmounts, LockerverseCheckoutClient, LockerverseCheckoutItem, LockerverseCheckoutLineItem, LockerverseCheckoutPaymentConfiguration, LockerverseCheckoutPricingInput, LockerverseCheckoutPricingPolicy, LockerverseCheckoutQuote, LockerverseCommunityBranding, LockerverseCustomField, LockerverseCustomFieldAnswer, LockerverseCustomFieldAnswerValue, LockerverseCustomFieldOption, LockerverseEnvironment, LockerverseMultiOptionCustomField, LockerversePaymentConfiguration, LockerversePaymentOption, LockerversePaymentResult, LockerversePaymentStatus, LockerversePaymentSubmission, LockerversePreparedCheckout, LockerverseProduct, LockerverseSdkError, LockerverseSdkErrorCode, LockerverseSdkOperation, LockerverseSingleOptionCustomField, LockerverseSubmitPaymentInput, LockerverseTextCustomField, LockerverseWidgetConfiguration, LockerverseWidgetFields, createLockerverseCheckoutClient };
5
+ export { CreateLockerverseWidgetOptions, LOCKERVERSE_SDK_VERSION, LockerverseAppliedDiscount, LockerverseBootstrapCheckoutInput, LockerverseCalculateTotalInput, LockerverseCatalog, LockerverseCheckoutAmounts, LockerverseCheckoutBootstrap, LockerverseCheckoutClient, LockerverseCheckoutItem, LockerverseCheckoutLineItem, LockerverseCheckoutPaymentConfiguration, LockerverseCheckoutPricingInput, LockerverseCheckoutPricingPolicy, LockerverseCheckoutQuote, LockerverseCheckoutSelectionItem, LockerverseCommunityBranding, LockerverseCustomField, LockerverseCustomFieldAnswer, LockerverseCustomFieldAnswerValue, LockerverseCustomFieldOption, LockerverseEnvironment, LockerverseMultiOptionCustomField, LockerversePaymentConfiguration, LockerversePaymentOption, LockerversePaymentResult, LockerversePaymentStatus, LockerversePaymentSubmission, LockerversePreparedCheckout, LockerverseProduct, LockerverseSdkError, LockerverseSdkErrorCode, LockerverseSdkOperation, LockerverseSingleOptionCustomField, LockerverseSubmitPaymentInput, LockerverseTextCustomField, LockerverseWidgetConfiguration, LockerverseWidgetFields, createLockerverseCheckoutClient };
6
6
  //# sourceMappingURL=checkout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.d.ts","names":[],"sources":["../src/checkout-client.ts"],"mappings":";;iBA0CgB,gCACd,SAAS,iCACR"}
1
+ {"version":3,"file":"checkout.d.ts","names":[],"sources":["../src/checkout-client.ts"],"mappings":";;iBAmDgB,gCACd,SAAS,iCACR"}
package/dist/checkout.js CHANGED
@@ -1,2 +1,2 @@
1
- import{A as e,C as t,D as n,E as r,M as i,O as a,S as o,T as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,i as h,j as g,k as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,v as ee,w as E,x as D,y as O}from"./transport.js";import{n as k,t as A}from"./types.js";const j={development:`pk_test_51O7FkjDHAhgRuLtFHdkXdIe8T5i7rOVaG9PCtDetK3UUVKojVUEKHmQacGzigf9mOX1wz3zSOKoYwFjRcTfML9PU00OjJko2lk`,production:`pk_live_51O7FkjDHAhgRuLtFlzLdxJrwo7F09WCKTlzT9lnBePjOGizWnuijkH9oCkoAddkmBT8ngIuqAPkDiHlPEAH4KXbz00Tm0DaPT4`};function M(e){let t=v(e,`widgetSlug`);return{...t,stripePublishableKey:j[t.environment],widgetSlug:t.resourceSlug,widgetSlugValue:t.resourceSlugValue}}const N=E(t(a({email:t(_()),includeServiceFee:t(p()),promoCode:t(_()),tipCents:t(d(0))}),{})),P=E(a({confirmationToken:x,customFieldAnswers:t(f(h)),email:_(),memberId:t(_()),merchSize:t(s([`XS`,`S`,`M`,`L`,`XL`,`XXL`,`XXXL`])),metadata:t(n(_(),_())),phone:t(_())})),F=g([a({amountCents:d(1),productId:x}),a({productId:x,quantity:d(1)})]),I=E(r(f(F),ee(1))),L=s([`one-time`,`monthly`,`annually`]),R=u(d(0)),z={description:w,id:x,inventoryQuantity:R,maxQuantity:R,minimumAmountCents:R,minQuantity:R,name:x,paymentOption:L},B=r(i(`pricingMode`,[o({...z,amountCents:d(0),pricingMode:m(`fixed`)}),o({...z,amountCents:R,pricingMode:m(`custom`)})]),S(({maxQuantity:e,minQuantity:t})=>e===null||t===null||t<=e)),V=o({acceptsDiscounts:t(p(),!1),id:x,product:B,productId:x,slug:x}),H=t(o({memberId:t(p(),!1),merchSize:t(p(),!1),phone:t(p(),!1),promoCode:t(p(),!1),serviceFee:t(p(),!1),shipping:t(p(),!1),tipping:t(p(),!1)}),{}),U=r(o({community:t(o({color:_(),name:x,thumbnail:_()})),config:t(o({customFields:l,fields:H})),description:w,id:t(_(),``),name:t(_(),`Lockerverse widget`),pricingPolicy:t(o({currency:t(m(`usd`),`usd`),serviceFeeRateBasisPoints:t(d(0),0)})),products:t(f(V),[]),showCommunityBranding:t(p(),!0),title:w}),e(e=>({...e,config:{customFields:e.config?.customFields??[],fields:{memberId:e.config?.fields?.memberId??!1,merchSize:e.config?.fields?.merchSize??!1,phone:e.config?.fields?.phone??!1,promoCode:e.config?.fields?.promoCode??!1,serviceFee:e.config?.fields?.serviceFee??!1,shipping:e.config?.fields?.shipping??!1,tipping:e.config?.fields?.tipping??!1}},pricingPolicy:e.pricingPolicy??{currency:`usd`,serviceFeeRateBasisPoints:0}}))),W=u(o({percentageOff:r(D(),y(),O(0),c(100)),source:s([`email_list`,`promo_code`])})),G=o({acceptsDiscounts:p(),listingId:x,listingSlug:x,paymentOption:L,pricingMode:s([`fixed`,`custom`]),productId:x,productName:x,quantity:d(1),subtotalCents:d(0),unitAmountCents:d(0)}),K=o({amountCents:d(0),appliedDiscount:W,connectedAccountId:u(x),discountableSubtotalCents:d(0),discountCents:d(0),lineItems:f(G),paymentOption:L,serviceFeeCents:d(0),subtotalCents:d(0),tipCents:d(0),totalCents:d(0)}),q=o({checkoutId:x,checkoutStatus:s([`action_required`,`failed`,`pending`,`success`]),clientSecret:u(_()),paymentReference:x,requiresAction:p(),status:u(_())}),J=E(K),Y=E(q),X=E(U);function Z(e){let{product:t}=e;return{acceptsDiscounts:e.acceptsDiscounts??!1,amountCents:t.amountCents,description:t.description??null,id:t.id,inventoryQuantity:t.inventoryQuantity,listingId:e.id,maximumQuantity:t.maxQuantity,minimumAmountCents:t.minimumAmountCents,minimumQuantity:t.minQuantity,name:t.name,paymentOption:t.paymentOption,pricingMode:t.pricingMode,slug:e.slug}}function te(e,t){let n=e.config?.fields??{};return{community:e.community?{accentColor:e.community.color,imageUrl:e.community.thumbnail,name:e.community.name}:null,payment:{currency:`usd`,publishableKey:t},pricingPolicy:{currency:`usd`,serviceFeeRateBasisPoints:e.pricingPolicy?.serviceFeeRateBasisPoints??0},products:(e.products??[]).map(Z),widget:{customFields:e.config?.customFields??[],description:e.description??null,fields:{memberId:n.memberId??!1,merchSize:n.merchSize??!1,phone:n.phone??!1,promoCode:n.promoCode??!1,serviceFee:n.serviceFee??!1,shipping:n.shipping??!1,tipping:n.tipping??!1},id:e.id??``,name:e.name??`Lockerverse widget`,showCommunityBranding:e.showCommunityBranding??!0,title:e.title??null}}}function ne(e){return $(e)}function re(e){return $(e)}function Q(e){return $(e)}function $(e){return C(structuredClone(e))}function ie(e){let{apiBaseUrl:t,communitySlug:n,communitySlugValue:r,environment:i,fetchImplementation:a,onError:o,requestTimeoutMs:s,sentryDsn:c,stripePublishableKey:l,widgetSlug:u,widgetSlugValue:d}=M(e),f=b({communitySlug:r,environment:i,getContext:()=>({widgetSlug:d}),onError:o,resourceContextName:`lockerverse_widget`,sentryDsn:c}),{requestJson:p}=T(a,f,s),m=`${t}/v2/community/${n}/payment-widgets/${u}/checkout`;function h(e,t,n=`invalid_selection`){throw f(new k({code:n,message:e,operation:t,reportable:!1}))}function g(e,t){return e instanceof k?e:new k({...t,reportable:!0})}function _(e,t,n=!1){let r=g(e,t),i=n&&(r.status===void 0||r.status>=500);throw f(i?new k({code:r.code,message:r.message,operation:r.operation,recoveryRecommended:!0,reportable:r.reportable,...r.status===void 0?{}:{status:r.status}}):r)}function v(e,t){let n;try{n=N(e)}catch{h(`Checkout pricing input is invalid.`,t)}let r=n.email?.trim().toLowerCase(),i=n.promoCode?.trim();return{...r?{email:r}:{},...n.includeServiceFee===void 0?{}:{includeServiceFee:n.includeServiceFee},...i?{promoCode:i}:{},...n.tipCents===void 0?{}:{tipCents:n.tipCents}}}function y(e){(!(e&&typeof e==`object`)||Array.isArray(e))&&h(`Checkout selection is invalid.`,`calculate_total`);let{items:t,...n}=e;try{return{items:I(t),pricing:v(n,`calculate_total`)}}catch(e){if(e instanceof k)throw e;h(`Checkout selection is invalid.`,`calculate_total`)}}function x(e){try{if(!(e&&typeof e==`object`)||Array.isArray(e))throw TypeError(`Invalid quote.`);let t=e;if(t.authoritative!==!0||t.paymentOption!==`one-time`||typeof t.paymentReference!=`string`||t.paymentReference.length===0||t.payment.currency!==`usd`||t.payment.publishableKey!==l)throw TypeError(`Invalid quote.`);let n=J({...t,connectedAccountId:t.payment.connectedAccountId});if(n.paymentOption!==`one-time`)throw TypeError(`Unsupported checkout cadence.`);let{connectedAccountId:r,paymentOption:i,...a}=n;return C({...a,authoritative:!0,payment:{connectedAccountId:r,currency:`usd`,publishableKey:l},paymentOption:`one-time`,paymentReference:t.paymentReference})}catch{h(`Lockerverse payment submission is invalid.`,`submit_payment`,`payment_submit_failed`)}}function S(e){try{if(!(e&&typeof e==`object`)||Array.isArray(e))throw TypeError(`Invalid payment input.`);let{checkout:t,submission:n}=e;if(!(t&&typeof t==`object`)||Array.isArray(t))throw TypeError(`Invalid prepared checkout.`);let r=t,i=I(r.items),a=v(r.pricing,`submit_payment`),o=x(r),s=P(n),c=s.email.trim().toLowerCase();return(!c||c!==a.email)&&h(`Payment email must match the current checkout quote.`,`submit_payment`),{items:i,pricing:a,quote:o,submission:{...s,email:c}}}catch(e){if(e instanceof k)throw e;h(`Lockerverse payment submission is invalid.`,`submit_payment`,`payment_submit_failed`)}}return{async calculateTotal(e){let{items:t,pricing:n}=y(e),r={code:`total_calculation_failed`,message:`Lockerverse returned an invalid checkout total.`,operation:`calculate_total`};try{let e=await p(`${m}/quote`,{body:JSON.stringify({...n,items:t}),headers:{"Content-Type":`application/json`},method:`POST`},J,{...r,message:`Unable to calculate the Lockerverse checkout total because the request failed.`,report:!1},{...r,report:!1});if(!e.ok)throw new k({...r,message:`Unable to calculate the Lockerverse checkout total (${e.response.status}).`,reportable:e.response.status>=500,status:e.response.status});if(e.value.paymentOption!==`one-time`)throw new k({...r,message:`Lockerverse returned an unsupported checkout cadence.`,reportable:!0});let{connectedAccountId:i,paymentOption:a,...o}=e.value;return re(C({...o,authoritative:!0,items:t,payment:{connectedAccountId:i,currency:`usd`,publishableKey:l},paymentOption:`one-time`,paymentReference:globalThis.crypto.randomUUID(),pricing:n}))}catch(e){_(e,r)}},async getPaymentStatus(e){(typeof e!=`string`||!e.trim())&&h(`Provide a payment reference to recover its status.`,`get_payment_status`);let t=e.trim(),n={code:`payment_status_failed`,message:`Lockerverse returned an invalid payment status.`,operation:`get_payment_status`};try{let e=await p(`${m}/${encodeURIComponent(t)}/status`,void 0,Y,{...n,message:`Unable to recover the Lockerverse payment status because the request failed.`,report:!1},{...n,report:!1});if(!e.ok)throw new k({...n,message:`Unable to recover the Lockerverse payment status (${e.response.status}).`,reportable:e.response.status>=500,status:e.response.status});if(e.value.paymentReference!==t)throw new k({...n,reportable:!0});return Q(e.value)}catch(e){_(e,n)}},async load(){let e={code:`widget_load_failed`,message:`Lockerverse returned an invalid widget catalog.`,operation:`load_widget`};try{let r=await p(`${t}/v2/community/${n}/payment-widgets/${u}`,void 0,X,{...e,message:`Unable to load Lockerverse widget because the request failed.`,report:!1},{...e,report:!1});if(!r.ok)throw new k({...e,message:`Unable to load Lockerverse widget (${r.response.status}).`,reportable:r.response.status>=500,status:r.response.status});return ne(C(te(r.value,l)))}catch(t){_(t,e)}},async submitPayment(e){let{items:t,pricing:n,quote:r,submission:i}=S(e),a={code:`payment_submit_failed`,message:`Lockerverse returned an invalid payment confirmation.`,operation:`submit_payment`};try{let e=await p(`${m}/confirm`,{body:JSON.stringify({confirmationToken:i.confirmationToken,customFieldAnswers:i.customFieldAnswers,email:i.email,expectedAmountCents:r.amountCents,expectedAppliedDiscount:r.appliedDiscount,expectedConnectedAccountId:r.payment.connectedAccountId,expectedDiscountableSubtotalCents:r.discountableSubtotalCents,expectedDiscountCents:r.discountCents,expectedServiceFeeCents:r.serviceFeeCents,expectedSubtotalCents:r.subtotalCents,expectedTipCents:r.tipCents,expectedTotalCents:r.totalCents,...n,items:t,memberId:i.memberId,merchSize:i.merchSize,metadata:i.metadata,paymentReference:r.paymentReference,phone:i.phone,quoteContractVersion:1}),headers:{"Content-Type":`application/json`},method:`POST`},Y,{...a,message:`Unable to submit the Lockerverse payment because the request failed.`,report:!1},{...a,report:!1});if(!e.ok)throw new k({...a,message:`Unable to submit the Lockerverse payment (${e.response.status}).`,reportable:e.response.status>=500,status:e.response.status});if(e.value.paymentReference!==r.paymentReference)throw new k({...a,reportable:!0});return Q(e.value)}catch(e){_(e,a,!0)}}}}export{A as LOCKERVERSE_SDK_VERSION,k as LockerverseSdkError,ie as createLockerverseCheckoutClient};
1
+ import{A as e,C as t,D as n,E as r,M as i,O as a,S as o,T as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,i as h,j as g,k as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,v as E,w as D,x as O,y as ee}from"./transport.js";import{n as k,t as A}from"./types.js";const te={development:`pk_test_51O7FkjDHAhgRuLtFHdkXdIe8T5i7rOVaG9PCtDetK3UUVKojVUEKHmQacGzigf9mOX1wz3zSOKoYwFjRcTfML9PU00OjJko2lk`,production:`pk_live_51O7FkjDHAhgRuLtFlzLdxJrwo7F09WCKTlzT9lnBePjOGizWnuijkH9oCkoAddkmBT8ngIuqAPkDiHlPEAH4KXbz00Tm0DaPT4`};function j(e){let t=v(e,`widgetSlug`);return{...t,stripePublishableKey:te[t.environment],widgetSlug:t.resourceSlug,widgetSlugValue:t.resourceSlugValue}}const M=D(t(a({email:t(_()),includeServiceFee:t(p()),promoCode:t(_()),tipCents:t(d(0))}),{})),N=D(a({confirmationToken:x,customFieldAnswers:t(f(h)),email:_(),memberId:t(_()),merchSize:t(s([`XS`,`S`,`M`,`L`,`XL`,`XXL`,`XXXL`])),metadata:t(n(_(),_())),phone:t(_())})),ne=g([a({amountCents:d(1),productId:x}),a({productId:x,quantity:d(1)})]),re=g([a({amountCents:d(1),productSlug:x}),a({productSlug:x,quantity:d(1)})]),P=D(r(f(ne),E(1))),ie=D(r(f(re),E(1))),F=s([`one-time`,`monthly`,`annually`]),I=u(d(0)),L={description:w,id:x,inventoryQuantity:I,maxQuantity:I,minimumAmountCents:I,minQuantity:I,name:x,paymentOption:F},R=r(i(`pricingMode`,[o({...L,amountCents:d(0),pricingMode:m(`fixed`)}),o({...L,amountCents:I,pricingMode:m(`custom`)})]),S(({maxQuantity:e,minQuantity:t})=>e===null||t===null||t<=e)),z=o({acceptsDiscounts:t(p(),!1),id:x,product:R,productId:x,slug:x}),B=t(o({memberId:t(p(),!1),merchSize:t(p(),!1),phone:t(p(),!1),promoCode:t(p(),!1),serviceFee:t(p(),!1),shipping:t(p(),!1),tipping:t(p(),!1)}),{}),V=r(o({community:t(o({color:_(),name:x,thumbnail:_()})),config:t(o({customFields:l,fields:B})),description:w,id:t(_(),``),name:t(_(),`Lockerverse widget`),pricingPolicy:t(o({currency:t(m(`usd`),`usd`),serviceFeeRateBasisPoints:t(d(0),0)})),products:t(f(z),[]),showCommunityBranding:t(p(),!0),title:w}),e(e=>({...e,config:{customFields:e.config?.customFields??[],fields:{memberId:e.config?.fields?.memberId??!1,merchSize:e.config?.fields?.merchSize??!1,phone:e.config?.fields?.phone??!1,promoCode:e.config?.fields?.promoCode??!1,serviceFee:e.config?.fields?.serviceFee??!1,shipping:e.config?.fields?.shipping??!1,tipping:e.config?.fields?.tipping??!1}},pricingPolicy:e.pricingPolicy??{currency:`usd`,serviceFeeRateBasisPoints:0}}))),H=u(o({percentageOff:r(O(),y(),ee(0),c(100)),source:s([`email_list`,`promo_code`])})),U=o({acceptsDiscounts:p(),listingId:x,listingSlug:x,paymentOption:F,pricingMode:s([`fixed`,`custom`]),productId:x,productName:x,quantity:d(1),subtotalCents:d(0),unitAmountCents:d(0)}),W=o({amountCents:d(0),appliedDiscount:H,connectedAccountId:u(x),discountableSubtotalCents:d(0),discountCents:d(0),lineItems:f(U),paymentOption:F,serviceFeeCents:d(0),subtotalCents:d(0),tipCents:d(0),totalCents:d(0)}),G=o({checkoutId:x,checkoutStatus:s([`action_required`,`failed`,`pending`,`success`]),clientSecret:u(_()),paymentReference:x,requiresAction:p(),status:u(_())}),K=o({catalog:V,quote:W}),q=D(W),J=D(K),Y=D(G),ae=D(V);function oe(e){let{product:t}=e;return{acceptsDiscounts:e.acceptsDiscounts??!1,amountCents:t.amountCents,description:t.description??null,id:t.id,inventoryQuantity:t.inventoryQuantity,listingId:e.id,maximumQuantity:t.maxQuantity,minimumAmountCents:t.minimumAmountCents,minimumQuantity:t.minQuantity,name:t.name,paymentOption:t.paymentOption,pricingMode:t.pricingMode,slug:e.slug}}function X(e,t){let n=e.config?.fields??{};return{community:e.community?{accentColor:e.community.color,imageUrl:e.community.thumbnail,name:e.community.name}:null,payment:{currency:`usd`,publishableKey:t},pricingPolicy:{currency:`usd`,serviceFeeRateBasisPoints:e.pricingPolicy?.serviceFeeRateBasisPoints??0},products:(e.products??[]).map(oe),widget:{customFields:e.config?.customFields??[],description:e.description??null,fields:{memberId:n.memberId??!1,merchSize:n.merchSize??!1,phone:n.phone??!1,promoCode:n.promoCode??!1,serviceFee:n.serviceFee??!1,shipping:n.shipping??!1,tipping:n.tipping??!1},id:e.id??``,name:e.name??`Lockerverse widget`,showCommunityBranding:e.showCommunityBranding??!0,title:e.title??null}}}function Z(e){return $(e)}function se(e){return $(e)}function Q(e){return $(e)}function $(e){return C(structuredClone(e))}function ce(e){let{apiBaseUrl:t,communitySlug:n,communitySlugValue:r,environment:i,fetchImplementation:a,onError:o,requestTimeoutMs:s,sentryDsn:c,stripePublishableKey:l,widgetSlug:u,widgetSlugValue:d}=j(e),f=b({communitySlug:r,environment:i,getContext:()=>({widgetSlug:d}),onError:o,resourceContextName:`lockerverse_widget`,sentryDsn:c}),{requestJson:p}=T(a,f,s),m=`${t}/v2/community/${n}/payment-widgets/${u}/checkout`;function h(e,t,n=`invalid_selection`){throw f(new k({code:n,message:e,operation:t,reportable:!1}))}function g(e,t){return e instanceof k?e:new k({...t,reportable:!0})}function _(e,t,n=!1){let r=g(e,t),i=n&&(r.status===void 0||r.status>=500);throw f(i?new k({code:r.code,message:r.message,operation:r.operation,recoveryRecommended:!0,reportable:r.reportable,...r.status===void 0?{}:{status:r.status}}):r)}function v(e,t){let n;try{n=M(e)}catch{h(`Checkout pricing input is invalid.`,t)}let r=n.email?.trim().toLowerCase(),i=n.promoCode?.trim();return{...r?{email:r}:{},...n.includeServiceFee===void 0?{}:{includeServiceFee:n.includeServiceFee},...i?{promoCode:i}:{},...n.tipCents===void 0?{}:{tipCents:n.tipCents}}}function y(e){(!(e&&typeof e==`object`)||Array.isArray(e))&&h(`Checkout selection is invalid.`,`bootstrap_checkout`);let{items:t,...n}=e;try{return{pricing:v(n,`bootstrap_checkout`),selection:ie(t)}}catch(e){if(e instanceof k)throw e;h(`Checkout selection is invalid.`,`bootstrap_checkout`)}}function x(e,t){return t.map(t=>{let n=e.products.find(e=>e.slug===t.productSlug);return n||h(`Selected Product is unavailable.`,`bootstrap_checkout`),`amountCents`in t?((n.pricingMode!==`custom`||n.minimumAmountCents!==null&&t.amountCents<n.minimumAmountCents)&&h(`Selected Product amount is invalid.`,`bootstrap_checkout`),{amountCents:t.amountCents,productId:n.id}):((n.pricingMode!==`fixed`||n.minimumQuantity!==null&&t.quantity<n.minimumQuantity||n.maximumQuantity!==null&&t.quantity>n.maximumQuantity||n.inventoryQuantity!==null&&t.quantity>n.inventoryQuantity)&&h(`Selected Product quantity is invalid.`,`bootstrap_checkout`),{productId:n.id,quantity:t.quantity})})}function S(e,t,n,r){if(e.paymentOption!==`one-time`)throw new k({...r,message:`Lockerverse returned an unsupported checkout cadence.`,reportable:!0});let{connectedAccountId:i,paymentOption:a,...o}=e;return se(C({...o,authoritative:!0,items:t,payment:{connectedAccountId:i,currency:`usd`,publishableKey:l},paymentOption:`one-time`,paymentReference:globalThis.crypto.randomUUID(),pricing:n}))}function w(e){(!(e&&typeof e==`object`)||Array.isArray(e))&&h(`Checkout selection is invalid.`,`calculate_total`);let{items:t,...n}=e;try{return{items:P(t),pricing:v(n,`calculate_total`)}}catch(e){if(e instanceof k)throw e;h(`Checkout selection is invalid.`,`calculate_total`)}}function E(e){try{if(!(e&&typeof e==`object`)||Array.isArray(e))throw TypeError(`Invalid quote.`);let t=e;if(t.authoritative!==!0||t.paymentOption!==`one-time`||typeof t.paymentReference!=`string`||t.paymentReference.length===0||t.payment.currency!==`usd`||t.payment.publishableKey!==l)throw TypeError(`Invalid quote.`);let n=q({...t,connectedAccountId:t.payment.connectedAccountId});if(n.paymentOption!==`one-time`)throw TypeError(`Unsupported checkout cadence.`);let{connectedAccountId:r,paymentOption:i,...a}=n;return C({...a,authoritative:!0,payment:{connectedAccountId:r,currency:`usd`,publishableKey:l},paymentOption:`one-time`,paymentReference:t.paymentReference})}catch{h(`Lockerverse payment submission is invalid.`,`submit_payment`,`payment_submit_failed`)}}function D(e){try{if(!(e&&typeof e==`object`)||Array.isArray(e))throw TypeError(`Invalid payment input.`);let{checkout:t,submission:n}=e;if(!(t&&typeof t==`object`)||Array.isArray(t))throw TypeError(`Invalid prepared checkout.`);let r=t,i=P(r.items),a=v(r.pricing,`submit_payment`),o=E(r),s=N(n),c=s.email.trim().toLowerCase();return(!c||c!==a.email)&&h(`Payment email must match the current checkout quote.`,`submit_payment`),{items:i,pricing:a,quote:o,submission:{...s,email:c}}}catch(e){if(e instanceof k)throw e;h(`Lockerverse payment submission is invalid.`,`submit_payment`,`payment_submit_failed`)}}return{async bootstrapCheckout(e){let{pricing:t,selection:n}=y(e),r={code:`checkout_bootstrap_failed`,message:`Lockerverse returned an invalid checkout bootstrap.`,operation:`bootstrap_checkout`};try{let e=await p(`${m}/bootstrap`,{body:JSON.stringify({...t,items:n}),headers:{"Content-Type":`application/json`},method:`POST`},J,{...r,message:`Unable to bootstrap the Lockerverse checkout because the request failed.`,report:!1},{...r,report:!1});if(!e.ok)throw new k({...r,message:`Unable to bootstrap the Lockerverse checkout (${e.response.status}).`,reportable:e.response.status>=500,status:e.response.status});let i=C(X(e.value.catalog,l)),a=x(i,n),o={...t,includeServiceFee:t.includeServiceFee??i.widget.fields.serviceFee};return C({catalog:Z(i),checkout:S(e.value.quote,a,o,r)})}catch(e){_(e,r)}},async calculateTotal(e){let{items:t,pricing:n}=w(e),r={code:`total_calculation_failed`,message:`Lockerverse returned an invalid checkout total.`,operation:`calculate_total`};try{let e=await p(`${m}/quote`,{body:JSON.stringify({...n,items:t}),headers:{"Content-Type":`application/json`},method:`POST`},q,{...r,message:`Unable to calculate the Lockerverse checkout total because the request failed.`,report:!1},{...r,report:!1});if(!e.ok)throw new k({...r,message:`Unable to calculate the Lockerverse checkout total (${e.response.status}).`,reportable:e.response.status>=500,status:e.response.status});return S(e.value,t,n,r)}catch(e){_(e,r)}},async getPaymentStatus(e){(typeof e!=`string`||!e.trim())&&h(`Provide a payment reference to recover its status.`,`get_payment_status`);let t=e.trim(),n={code:`payment_status_failed`,message:`Lockerverse returned an invalid payment status.`,operation:`get_payment_status`};try{let e=await p(`${m}/${encodeURIComponent(t)}/status`,void 0,Y,{...n,message:`Unable to recover the Lockerverse payment status because the request failed.`,report:!1},{...n,report:!1});if(!e.ok)throw new k({...n,message:`Unable to recover the Lockerverse payment status (${e.response.status}).`,reportable:e.response.status>=500,status:e.response.status});if(e.value.paymentReference!==t)throw new k({...n,reportable:!0});return Q(e.value)}catch(e){_(e,n)}},async load(){let e={code:`widget_load_failed`,message:`Lockerverse returned an invalid widget catalog.`,operation:`load_widget`};try{let r=await p(`${t}/v2/community/${n}/payment-widgets/${u}`,void 0,ae,{...e,message:`Unable to load Lockerverse widget because the request failed.`,report:!1},{...e,report:!1});if(!r.ok)throw new k({...e,message:`Unable to load Lockerverse widget (${r.response.status}).`,reportable:r.response.status>=500,status:r.response.status});return Z(C(X(r.value,l)))}catch(t){_(t,e)}},async submitPayment(e){let{items:t,pricing:n,quote:r,submission:i}=D(e),a={code:`payment_submit_failed`,message:`Lockerverse returned an invalid payment confirmation.`,operation:`submit_payment`};try{let e=await p(`${m}/confirm`,{body:JSON.stringify({confirmationToken:i.confirmationToken,customFieldAnswers:i.customFieldAnswers,email:i.email,expectedAmountCents:r.amountCents,expectedAppliedDiscount:r.appliedDiscount,expectedConnectedAccountId:r.payment.connectedAccountId,expectedDiscountableSubtotalCents:r.discountableSubtotalCents,expectedDiscountCents:r.discountCents,expectedServiceFeeCents:r.serviceFeeCents,expectedSubtotalCents:r.subtotalCents,expectedTipCents:r.tipCents,expectedTotalCents:r.totalCents,...n,items:t,memberId:i.memberId,merchSize:i.merchSize,metadata:i.metadata,paymentReference:r.paymentReference,phone:i.phone,quoteContractVersion:1}),headers:{"Content-Type":`application/json`},method:`POST`},Y,{...a,message:`Unable to submit the Lockerverse payment because the request failed.`,report:!1},{...a,report:!1});if(!e.ok)throw new k({...a,message:`Unable to submit the Lockerverse payment (${e.response.status}).`,reportable:e.response.status>=500,status:e.response.status});if(e.value.paymentReference!==r.paymentReference)throw new k({...a,reportable:!0});return Q(e.value)}catch(e){_(e,a,!0)}}}}export{A as LOCKERVERSE_SDK_VERSION,k as LockerverseSdkError,ce as createLockerverseCheckoutClient};
2
2
  //# sourceMappingURL=checkout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.js","names":[],"sources":["../src/checkout-environment.ts","../src/checkout-input-schemas.ts","../src/checkout-schemas.ts","../src/snapshots.ts","../src/checkout-client.ts"],"sourcesContent":["import { resolveResourceEnvironment } from \"./environment.ts\";\nimport type {\n CreateLockerverseWidgetOptions,\n LockerverseEnvironment,\n} from \"./types.ts\";\n\nconst STRIPE_PUBLISHABLE_KEYS: Record<LockerverseEnvironment, string> = {\n development:\n \"pk_test_51O7FkjDHAhgRuLtFHdkXdIe8T5i7rOVaG9PCtDetK3UUVKojVUEKHmQacGzigf9mOX1wz3zSOKoYwFjRcTfML9PU00OjJko2lk\",\n production:\n \"pk_live_51O7FkjDHAhgRuLtFlzLdxJrwo7F09WCKTlzT9lnBePjOGizWnuijkH9oCkoAddkmBT8ngIuqAPkDiHlPEAH4KXbz00Tm0DaPT4\",\n};\n\nexport function resolveWidgetEnvironment(\n options: CreateLockerverseWidgetOptions\n) {\n const runtime = resolveResourceEnvironment(options, \"widgetSlug\");\n return {\n ...runtime,\n stripePublishableKey: STRIPE_PUBLISHABLE_KEYS[runtime.environment],\n widgetSlug: runtime.resourceSlug,\n widgetSlugValue: runtime.resourceSlugValue,\n };\n}\n","import {\n array,\n boolean,\n minLength,\n optional,\n parser,\n picklist,\n pipe,\n record,\n strictObject,\n string,\n union,\n} from \"valibot\";\n\nimport {\n customFieldAnswerSchema,\n nonEmptyStringSchema,\n safeIntegerSchema,\n} from \"./schema-helpers.ts\";\n\nexport const parseCheckoutPricingInput = parser(\n optional(\n strictObject({\n email: optional(string()),\n includeServiceFee: optional(boolean()),\n promoCode: optional(string()),\n tipCents: optional(safeIntegerSchema(0)),\n }),\n {}\n )\n);\n\nexport const parsePaymentSubmission = parser(\n strictObject({\n confirmationToken: nonEmptyStringSchema,\n customFieldAnswers: optional(array(customFieldAnswerSchema)),\n email: string(),\n memberId: optional(string()),\n merchSize: optional(picklist([\"XS\", \"S\", \"M\", \"L\", \"XL\", \"XXL\", \"XXXL\"])),\n metadata: optional(record(string(), string())),\n phone: optional(string()),\n })\n);\n\nconst checkoutItemSchema = union([\n strictObject({\n amountCents: safeIntegerSchema(1),\n productId: nonEmptyStringSchema,\n }),\n strictObject({\n productId: nonEmptyStringSchema,\n quantity: safeIntegerSchema(1),\n }),\n]);\n\nexport const parseCheckoutItems = parser(\n pipe(array(checkoutItemSchema), minLength(1))\n);\n","import {\n array,\n boolean,\n check,\n finite,\n type InferOutput,\n literal,\n maxValue,\n minValue,\n nullable,\n number,\n object,\n optional,\n parser,\n picklist,\n pipe,\n string,\n transform,\n variant,\n} from \"valibot\";\n\nimport {\n customFieldsSchema,\n nonEmptyStringSchema,\n optionalNullableStringSchema,\n safeIntegerSchema,\n} from \"./schema-helpers.ts\";\n\nconst paymentOptionSchema = picklist([\"one-time\", \"monthly\", \"annually\"]);\nconst nullableNonNegativeIntegerSchema = nullable(safeIntegerSchema(0));\n\nconst productBaseEntries = {\n description: optionalNullableStringSchema,\n id: nonEmptyStringSchema,\n inventoryQuantity: nullableNonNegativeIntegerSchema,\n maxQuantity: nullableNonNegativeIntegerSchema,\n minimumAmountCents: nullableNonNegativeIntegerSchema,\n minQuantity: nullableNonNegativeIntegerSchema,\n name: nonEmptyStringSchema,\n paymentOption: paymentOptionSchema,\n};\n\nconst publicProductSchema = pipe(\n variant(\"pricingMode\", [\n object({\n ...productBaseEntries,\n amountCents: safeIntegerSchema(0),\n pricingMode: literal(\"fixed\"),\n }),\n object({\n ...productBaseEntries,\n amountCents: nullableNonNegativeIntegerSchema,\n pricingMode: literal(\"custom\"),\n }),\n ]),\n check(\n ({ maxQuantity, minQuantity }) =>\n maxQuantity === null || minQuantity === null || minQuantity <= maxQuantity\n )\n);\n\nconst productListingSchema = object({\n acceptsDiscounts: optional(boolean(), false),\n id: nonEmptyStringSchema,\n product: publicProductSchema,\n productId: nonEmptyStringSchema,\n slug: nonEmptyStringSchema,\n});\n\nconst widgetFieldsSchema = optional(\n object({\n memberId: optional(boolean(), false),\n merchSize: optional(boolean(), false),\n phone: optional(boolean(), false),\n promoCode: optional(boolean(), false),\n serviceFee: optional(boolean(), false),\n shipping: optional(boolean(), false),\n tipping: optional(boolean(), false),\n }),\n {}\n);\n\nexport const publicWidgetSchema = pipe(\n object({\n community: optional(\n object({\n color: string(),\n name: nonEmptyStringSchema,\n thumbnail: string(),\n })\n ),\n config: optional(\n object({\n customFields: customFieldsSchema,\n fields: widgetFieldsSchema,\n })\n ),\n description: optionalNullableStringSchema,\n id: optional(string(), \"\"),\n name: optional(string(), \"Lockerverse widget\"),\n pricingPolicy: optional(\n object({\n currency: optional(literal(\"usd\"), \"usd\"),\n serviceFeeRateBasisPoints: optional(safeIntegerSchema(0), 0),\n })\n ),\n products: optional(array(productListingSchema), []),\n showCommunityBranding: optional(boolean(), true),\n title: optionalNullableStringSchema,\n }),\n transform((widget) => ({\n ...widget,\n config: {\n customFields: widget.config?.customFields ?? [],\n fields: {\n memberId: widget.config?.fields?.memberId ?? false,\n merchSize: widget.config?.fields?.merchSize ?? false,\n phone: widget.config?.fields?.phone ?? false,\n promoCode: widget.config?.fields?.promoCode ?? false,\n serviceFee: widget.config?.fields?.serviceFee ?? false,\n shipping: widget.config?.fields?.shipping ?? false,\n tipping: widget.config?.fields?.tipping ?? false,\n },\n },\n pricingPolicy: widget.pricingPolicy ?? {\n currency: \"usd\" as const,\n serviceFeeRateBasisPoints: 0,\n },\n }))\n);\n\nconst appliedDiscountSchema = nullable(\n object({\n percentageOff: pipe(number(), finite(), minValue(0), maxValue(100)),\n source: picklist([\"email_list\", \"promo_code\"]),\n })\n);\n\nconst checkoutLineItemSchema = object({\n acceptsDiscounts: boolean(),\n listingId: nonEmptyStringSchema,\n listingSlug: nonEmptyStringSchema,\n paymentOption: paymentOptionSchema,\n pricingMode: picklist([\"fixed\", \"custom\"]),\n productId: nonEmptyStringSchema,\n productName: nonEmptyStringSchema,\n quantity: safeIntegerSchema(1),\n subtotalCents: safeIntegerSchema(0),\n unitAmountCents: safeIntegerSchema(0),\n});\n\nexport const checkoutQuoteSchema = object({\n amountCents: safeIntegerSchema(0),\n appliedDiscount: appliedDiscountSchema,\n connectedAccountId: nullable(nonEmptyStringSchema),\n discountableSubtotalCents: safeIntegerSchema(0),\n discountCents: safeIntegerSchema(0),\n lineItems: array(checkoutLineItemSchema),\n paymentOption: paymentOptionSchema,\n serviceFeeCents: safeIntegerSchema(0),\n subtotalCents: safeIntegerSchema(0),\n tipCents: safeIntegerSchema(0),\n totalCents: safeIntegerSchema(0),\n});\n\nexport const paymentResultSchema = object({\n checkoutId: nonEmptyStringSchema,\n checkoutStatus: picklist([\"action_required\", \"failed\", \"pending\", \"success\"]),\n clientSecret: nullable(string()),\n paymentReference: nonEmptyStringSchema,\n requiresAction: boolean(),\n status: nullable(string()),\n});\n\nexport type PublicCheckoutQuote = InferOutput<typeof checkoutQuoteSchema>;\nexport type PublicProductListing = InferOutput<typeof productListingSchema>;\nexport type PublicWidget = InferOutput<typeof publicWidgetSchema>;\n\nexport const parseCheckoutQuote = parser(checkoutQuoteSchema);\nexport const parsePaymentResult = parser(paymentResultSchema);\nexport const parsePublicWidget = parser(publicWidgetSchema);\n","import type { PublicProductListing, PublicWidget } from \"./checkout-schemas.ts\";\nimport { deepFreeze } from \"./deep-freeze.ts\";\nimport type {\n LockerverseCatalog,\n LockerversePaymentResult,\n LockerversePreparedCheckout,\n LockerverseProduct,\n} from \"./types.ts\";\n\nfunction mapProduct(listing: PublicProductListing): LockerverseProduct {\n const { product } = listing;\n\n return {\n acceptsDiscounts: listing.acceptsDiscounts ?? false,\n amountCents: product.amountCents,\n description: product.description ?? null,\n id: product.id,\n inventoryQuantity: product.inventoryQuantity,\n listingId: listing.id,\n maximumQuantity: product.maxQuantity,\n minimumAmountCents: product.minimumAmountCents,\n minimumQuantity: product.minQuantity,\n name: product.name,\n paymentOption: product.paymentOption,\n pricingMode: product.pricingMode,\n slug: listing.slug,\n };\n}\n\nexport function createCatalog(\n widget: PublicWidget,\n publishableKey: string\n): LockerverseCatalog {\n const fields = widget.config?.fields ?? {};\n\n return {\n community: widget.community\n ? {\n accentColor: widget.community.color,\n imageUrl: widget.community.thumbnail,\n name: widget.community.name,\n }\n : null,\n payment: {\n currency: \"usd\",\n publishableKey,\n },\n pricingPolicy: {\n currency: \"usd\",\n serviceFeeRateBasisPoints:\n widget.pricingPolicy?.serviceFeeRateBasisPoints ?? 0,\n },\n products: (widget.products ?? []).map(mapProduct),\n widget: {\n customFields: widget.config?.customFields ?? [],\n description: widget.description ?? null,\n fields: {\n memberId: fields.memberId ?? false,\n merchSize: fields.merchSize ?? false,\n phone: fields.phone ?? false,\n promoCode: fields.promoCode ?? false,\n serviceFee: fields.serviceFee ?? false,\n shipping: fields.shipping ?? false,\n tipping: fields.tipping ?? false,\n },\n id: widget.id ?? \"\",\n name: widget.name ?? \"Lockerverse widget\",\n showCommunityBranding: widget.showCommunityBranding ?? true,\n title: widget.title ?? null,\n },\n };\n}\n\nexport function cloneCatalog(catalog: LockerverseCatalog): LockerverseCatalog {\n return cloneSnapshot(catalog);\n}\n\nexport function clonePreparedCheckout(\n checkout: LockerversePreparedCheckout\n): LockerversePreparedCheckout {\n return cloneSnapshot(checkout);\n}\n\nexport function clonePaymentResult(\n paymentResult: LockerversePaymentResult\n): LockerversePaymentResult {\n return cloneSnapshot(paymentResult);\n}\n\nfunction cloneSnapshot<T>(value: T): T {\n return deepFreeze(structuredClone(value));\n}\n","import { resolveWidgetEnvironment } from \"./checkout-environment.ts\";\nimport {\n parseCheckoutItems,\n parseCheckoutPricingInput,\n parsePaymentSubmission,\n} from \"./checkout-input-schemas.ts\";\nimport {\n parseCheckoutQuote,\n parsePaymentResult,\n parsePublicWidget,\n} from \"./checkout-schemas.ts\";\nimport { deepFreeze } from \"./deep-freeze.ts\";\nimport { createSdkErrorReporter } from \"./error-reporting.ts\";\nimport {\n cloneCatalog,\n clonePaymentResult,\n clonePreparedCheckout,\n createCatalog,\n} from \"./snapshots.ts\";\nimport { createTransport } from \"./transport.ts\";\nimport {\n type CreateLockerverseWidgetOptions,\n type LockerverseCheckoutClient,\n type LockerverseCheckoutQuote,\n LockerverseSdkError,\n type LockerverseSdkOperation,\n} from \"./types.ts\";\n\ntype OperationErrorContext = {\n code:\n | \"payment_status_failed\"\n | \"payment_submit_failed\"\n | \"total_calculation_failed\"\n | \"widget_load_failed\";\n message: string;\n operation:\n | \"calculate_total\"\n | \"get_payment_status\"\n | \"load_widget\"\n | \"submit_payment\";\n};\n\nexport function createLockerverseCheckoutClient(\n options: CreateLockerverseWidgetOptions\n): LockerverseCheckoutClient {\n const {\n apiBaseUrl,\n communitySlug,\n communitySlugValue,\n environment,\n fetchImplementation,\n onError,\n requestTimeoutMs,\n sentryDsn,\n stripePublishableKey,\n widgetSlug,\n widgetSlugValue,\n } = resolveWidgetEnvironment(options);\n const reportError = createSdkErrorReporter({\n communitySlug: communitySlugValue,\n environment,\n getContext: () => ({ widgetSlug: widgetSlugValue }),\n onError,\n resourceContextName: \"lockerverse_widget\",\n sentryDsn,\n });\n const { requestJson } = createTransport(\n fetchImplementation,\n reportError,\n requestTimeoutMs\n );\n const checkoutBaseUrl = `${apiBaseUrl}/v2/community/${communitySlug}/payment-widgets/${widgetSlug}/checkout`;\n\n function invalidInput(\n message: string,\n operation: LockerverseSdkOperation,\n code: \"invalid_selection\" | \"payment_submit_failed\" = \"invalid_selection\"\n ): never {\n throw reportError(\n new LockerverseSdkError({\n code,\n message,\n operation,\n reportable: false,\n })\n );\n }\n\n function normalizeOperationError(\n error: unknown,\n context: OperationErrorContext\n ) {\n return error instanceof LockerverseSdkError\n ? error\n : new LockerverseSdkError({ ...context, reportable: true });\n }\n\n function failOperation(\n error: unknown,\n context: OperationErrorContext,\n recoveryMayBeRequired = false\n ): never {\n const normalized = normalizeOperationError(error, context);\n const recoveryRecommended =\n recoveryMayBeRequired &&\n (normalized.status === undefined || normalized.status >= 500);\n throw reportError(\n recoveryRecommended\n ? new LockerverseSdkError({\n code: normalized.code,\n message: normalized.message,\n operation: normalized.operation,\n recoveryRecommended: true,\n reportable: normalized.reportable,\n ...(normalized.status === undefined\n ? {}\n : { status: normalized.status }),\n })\n : normalized\n );\n }\n\n function normalizePricingInput(\n input: unknown,\n operation: \"calculate_total\" | \"submit_payment\"\n ) {\n let parsed: ReturnType<typeof parseCheckoutPricingInput>;\n try {\n parsed = parseCheckoutPricingInput(input);\n } catch {\n invalidInput(\"Checkout pricing input is invalid.\", operation);\n }\n const email = parsed.email?.trim().toLowerCase();\n const promoCode = parsed.promoCode?.trim();\n return {\n ...(email ? { email } : {}),\n ...(parsed.includeServiceFee === undefined\n ? {}\n : { includeServiceFee: parsed.includeServiceFee }),\n ...(promoCode ? { promoCode } : {}),\n ...(parsed.tipCents === undefined ? {} : { tipCents: parsed.tipCents }),\n };\n }\n\n function normalizeCalculateTotalInput(input: unknown) {\n if (!(input && typeof input === \"object\") || Array.isArray(input)) {\n invalidInput(\"Checkout selection is invalid.\", \"calculate_total\");\n }\n const { items, ...pricingInput } = input as Record<string, unknown>;\n try {\n return {\n items: parseCheckoutItems(items),\n pricing: normalizePricingInput(pricingInput, \"calculate_total\"),\n };\n } catch (error) {\n if (error instanceof LockerverseSdkError) {\n throw error;\n }\n invalidInput(\"Checkout selection is invalid.\", \"calculate_total\");\n }\n }\n\n function normalizeQuote(input: unknown) {\n try {\n if (!(input && typeof input === \"object\") || Array.isArray(input)) {\n throw new TypeError(\"Invalid quote.\");\n }\n const quoteInput = input as LockerverseCheckoutQuote;\n if (\n quoteInput.authoritative !== true ||\n quoteInput.paymentOption !== \"one-time\" ||\n typeof quoteInput.paymentReference !== \"string\" ||\n quoteInput.paymentReference.length === 0 ||\n quoteInput.payment.currency !== \"usd\" ||\n quoteInput.payment.publishableKey !== stripePublishableKey\n ) {\n throw new TypeError(\"Invalid quote.\");\n }\n const parsed = parseCheckoutQuote({\n ...quoteInput,\n connectedAccountId: quoteInput.payment.connectedAccountId,\n });\n if (parsed.paymentOption !== \"one-time\") {\n throw new TypeError(\"Unsupported checkout cadence.\");\n }\n const {\n connectedAccountId,\n paymentOption: _paymentOption,\n ...quote\n } = parsed;\n return deepFreeze({\n ...quote,\n authoritative: true as const,\n payment: {\n connectedAccountId,\n currency: \"usd\" as const,\n publishableKey: stripePublishableKey,\n },\n paymentOption: \"one-time\" as const,\n paymentReference: quoteInput.paymentReference,\n });\n } catch {\n invalidInput(\n \"Lockerverse payment submission is invalid.\",\n \"submit_payment\",\n \"payment_submit_failed\"\n );\n }\n }\n\n function normalizeSubmitPaymentInput(input: unknown) {\n try {\n if (!(input && typeof input === \"object\") || Array.isArray(input)) {\n throw new TypeError(\"Invalid payment input.\");\n }\n const { checkout, submission: submissionInput } = input as Record<\n string,\n unknown\n >;\n if (\n !(checkout && typeof checkout === \"object\") ||\n Array.isArray(checkout)\n ) {\n throw new TypeError(\"Invalid prepared checkout.\");\n }\n const checkoutInput = checkout as Record<string, unknown>;\n const items = parseCheckoutItems(checkoutInput.items);\n const pricing = normalizePricingInput(\n checkoutInput.pricing,\n \"submit_payment\"\n );\n const quote = normalizeQuote(checkoutInput);\n const submission = parsePaymentSubmission(submissionInput);\n const email = submission.email.trim().toLowerCase();\n if (!email || email !== pricing.email) {\n invalidInput(\n \"Payment email must match the current checkout quote.\",\n \"submit_payment\"\n );\n }\n return {\n items,\n pricing,\n quote,\n submission: { ...submission, email },\n };\n } catch (error) {\n if (error instanceof LockerverseSdkError) {\n throw error;\n }\n invalidInput(\n \"Lockerverse payment submission is invalid.\",\n \"submit_payment\",\n \"payment_submit_failed\"\n );\n }\n }\n\n return {\n async calculateTotal(input) {\n const { items, pricing } = normalizeCalculateTotalInput(input);\n const context = {\n code: \"total_calculation_failed\" as const,\n message: \"Lockerverse returned an invalid checkout total.\",\n operation: \"calculate_total\" as const,\n };\n try {\n const response = await requestJson(\n `${checkoutBaseUrl}/quote`,\n {\n body: JSON.stringify({ ...pricing, items }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n },\n parseCheckoutQuote,\n {\n ...context,\n message:\n \"Unable to calculate the Lockerverse checkout total because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to calculate the Lockerverse checkout total (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n if (response.value.paymentOption !== \"one-time\") {\n throw new LockerverseSdkError({\n ...context,\n message: \"Lockerverse returned an unsupported checkout cadence.\",\n reportable: true,\n });\n }\n const {\n connectedAccountId,\n paymentOption: _paymentOption,\n ...quote\n } = response.value;\n return clonePreparedCheckout(\n deepFreeze({\n ...quote,\n authoritative: true as const,\n items,\n payment: {\n connectedAccountId,\n currency: \"usd\" as const,\n publishableKey: stripePublishableKey,\n },\n paymentOption: \"one-time\" as const,\n paymentReference: globalThis.crypto.randomUUID(),\n pricing,\n })\n );\n } catch (error) {\n failOperation(error, context);\n }\n },\n async getPaymentStatus(paymentReference) {\n if (typeof paymentReference !== \"string\" || !paymentReference.trim()) {\n invalidInput(\n \"Provide a payment reference to recover its status.\",\n \"get_payment_status\"\n );\n }\n const normalizedReference = paymentReference.trim();\n const context = {\n code: \"payment_status_failed\" as const,\n message: \"Lockerverse returned an invalid payment status.\",\n operation: \"get_payment_status\" as const,\n };\n try {\n const response = await requestJson(\n `${checkoutBaseUrl}/${encodeURIComponent(normalizedReference)}/status`,\n undefined,\n parsePaymentResult,\n {\n ...context,\n message:\n \"Unable to recover the Lockerverse payment status because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to recover the Lockerverse payment status (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n if (response.value.paymentReference !== normalizedReference) {\n throw new LockerverseSdkError({ ...context, reportable: true });\n }\n return clonePaymentResult(response.value);\n } catch (error) {\n failOperation(error, context);\n }\n },\n async load() {\n const context = {\n code: \"widget_load_failed\" as const,\n message: \"Lockerverse returned an invalid widget catalog.\",\n operation: \"load_widget\" as const,\n };\n try {\n const response = await requestJson(\n `${apiBaseUrl}/v2/community/${communitySlug}/payment-widgets/${widgetSlug}`,\n undefined,\n parsePublicWidget,\n {\n ...context,\n message:\n \"Unable to load Lockerverse widget because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to load Lockerverse widget (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n return cloneCatalog(\n deepFreeze(createCatalog(response.value, stripePublishableKey))\n );\n } catch (error) {\n failOperation(error, context);\n }\n },\n async submitPayment(input) {\n const { items, pricing, quote, submission } =\n normalizeSubmitPaymentInput(input);\n const context = {\n code: \"payment_submit_failed\" as const,\n message: \"Lockerverse returned an invalid payment confirmation.\",\n operation: \"submit_payment\" as const,\n };\n try {\n const response = await requestJson(\n `${checkoutBaseUrl}/confirm`,\n {\n body: JSON.stringify({\n confirmationToken: submission.confirmationToken,\n customFieldAnswers: submission.customFieldAnswers,\n email: submission.email,\n expectedAmountCents: quote.amountCents,\n expectedAppliedDiscount: quote.appliedDiscount,\n expectedConnectedAccountId: quote.payment.connectedAccountId,\n expectedDiscountableSubtotalCents:\n quote.discountableSubtotalCents,\n expectedDiscountCents: quote.discountCents,\n expectedServiceFeeCents: quote.serviceFeeCents,\n expectedSubtotalCents: quote.subtotalCents,\n expectedTipCents: quote.tipCents,\n expectedTotalCents: quote.totalCents,\n ...pricing,\n items,\n memberId: submission.memberId,\n merchSize: submission.merchSize,\n metadata: submission.metadata,\n paymentReference: quote.paymentReference,\n phone: submission.phone,\n quoteContractVersion: 1,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n },\n parsePaymentResult,\n {\n ...context,\n message:\n \"Unable to submit the Lockerverse payment because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to submit the Lockerverse payment (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n if (response.value.paymentReference !== quote.paymentReference) {\n throw new LockerverseSdkError({ ...context, reportable: true });\n }\n return clonePaymentResult(response.value);\n } catch (error) {\n failOperation(error, context, true);\n }\n },\n };\n}\n"],"mappings":"qRAMA,MAAM,EAAkE,CACtE,YACE,8GACF,WACE,6GACJ,EAEA,SAAgB,EACd,EACA,CACA,IAAM,EAAU,EAA2B,EAAS,YAAY,EAChE,MAAO,CACL,GAAG,EACH,qBAAsB,EAAwB,EAAQ,aACtD,WAAY,EAAQ,aACpB,gBAAiB,EAAQ,iBAC3B,CACF,CCHA,MAAa,EAA4B,EACvC,EACE,EAAa,CACX,MAAO,EAAS,EAAO,CAAC,EACxB,kBAAmB,EAAS,EAAQ,CAAC,EACrC,UAAW,EAAS,EAAO,CAAC,EAC5B,SAAU,EAAS,EAAkB,CAAC,CAAC,CACzC,CAAC,EACD,CAAC,CACH,CACF,EAEa,EAAyB,EACpC,EAAa,CACX,kBAAmB,EACnB,mBAAoB,EAAS,EAAM,CAAuB,CAAC,EAC3D,MAAO,EAAO,EACd,SAAU,EAAS,EAAO,CAAC,EAC3B,UAAW,EAAS,EAAS,CAAC,KAAM,IAAK,IAAK,IAAK,KAAM,MAAO,MAAM,CAAC,CAAC,EACxE,SAAU,EAAS,EAAO,EAAO,EAAG,EAAO,CAAC,CAAC,EAC7C,MAAO,EAAS,EAAO,CAAC,CAC1B,CAAC,CACH,EAEM,EAAqB,EAAM,CAC/B,EAAa,CACX,YAAa,EAAkB,CAAC,EAChC,UAAW,CACb,CAAC,EACD,EAAa,CACX,UAAW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,wBAAyB,EAAM,gBAC/B,sBAAuB,EAAM,cAC7B,iBAAkB,EAAM,SACxB,mBAAoB,EAAM,WAC1B,GAAG,EACH,QACA,SAAU,EAAW,SACrB,UAAW,EAAW,UACtB,SAAU,EAAW,SACrB,iBAAkB,EAAM,iBACxB,MAAO,EAAW,MAClB,qBAAsB,CACxB,CAAC,EACD,QAAS,CAAE,eAAgB,kBAAmB,EAC9C,OAAQ,MACV,EACA,EACA,CACE,GAAG,EACH,QACE,uEACF,OAAQ,EACV,EACA,CAAE,GAAG,EAAS,OAAQ,EAAM,CAC9B,EACA,GAAI,CAAC,EAAS,GACZ,MAAM,IAAI,EAAoB,CAC5B,GAAG,EACH,QAAS,6CAA6C,EAAS,SAAS,OAAO,IAC/E,WAAY,EAAS,SAAS,QAAU,IACxC,OAAQ,EAAS,SAAS,MAC5B,CAAC,EAEH,GAAI,EAAS,MAAM,mBAAqB,EAAM,iBAC5C,MAAM,IAAI,EAAoB,CAAE,GAAG,EAAS,WAAY,EAAK,CAAC,EAEhE,OAAO,EAAmB,EAAS,KAAK,CAC1C,OAAS,EAAO,CACd,EAAc,EAAO,EAAS,EAAI,CACpC,CACF,CACF,CACF"}
1
+ {"version":3,"file":"checkout.js","names":[],"sources":["../src/checkout-environment.ts","../src/checkout-input-schemas.ts","../src/checkout-schemas.ts","../src/snapshots.ts","../src/checkout-client.ts"],"sourcesContent":["import { resolveResourceEnvironment } from \"./environment.ts\";\nimport type {\n CreateLockerverseWidgetOptions,\n LockerverseEnvironment,\n} from \"./types.ts\";\n\nconst STRIPE_PUBLISHABLE_KEYS: Record<LockerverseEnvironment, string> = {\n development:\n \"pk_test_51O7FkjDHAhgRuLtFHdkXdIe8T5i7rOVaG9PCtDetK3UUVKojVUEKHmQacGzigf9mOX1wz3zSOKoYwFjRcTfML9PU00OjJko2lk\",\n production:\n \"pk_live_51O7FkjDHAhgRuLtFlzLdxJrwo7F09WCKTlzT9lnBePjOGizWnuijkH9oCkoAddkmBT8ngIuqAPkDiHlPEAH4KXbz00Tm0DaPT4\",\n};\n\nexport function resolveWidgetEnvironment(\n options: CreateLockerverseWidgetOptions\n) {\n const runtime = resolveResourceEnvironment(options, \"widgetSlug\");\n return {\n ...runtime,\n stripePublishableKey: STRIPE_PUBLISHABLE_KEYS[runtime.environment],\n widgetSlug: runtime.resourceSlug,\n widgetSlugValue: runtime.resourceSlugValue,\n };\n}\n","import {\n array,\n boolean,\n minLength,\n optional,\n parser,\n picklist,\n pipe,\n record,\n strictObject,\n string,\n union,\n} from \"valibot\";\n\nimport {\n customFieldAnswerSchema,\n nonEmptyStringSchema,\n safeIntegerSchema,\n} from \"./schema-helpers.ts\";\n\nexport const parseCheckoutPricingInput = parser(\n optional(\n strictObject({\n email: optional(string()),\n includeServiceFee: optional(boolean()),\n promoCode: optional(string()),\n tipCents: optional(safeIntegerSchema(0)),\n }),\n {}\n )\n);\n\nexport const parsePaymentSubmission = parser(\n strictObject({\n confirmationToken: nonEmptyStringSchema,\n customFieldAnswers: optional(array(customFieldAnswerSchema)),\n email: string(),\n memberId: optional(string()),\n merchSize: optional(picklist([\"XS\", \"S\", \"M\", \"L\", \"XL\", \"XXL\", \"XXXL\"])),\n metadata: optional(record(string(), string())),\n phone: optional(string()),\n })\n);\n\nconst checkoutItemSchema = union([\n strictObject({\n amountCents: safeIntegerSchema(1),\n productId: nonEmptyStringSchema,\n }),\n strictObject({\n productId: nonEmptyStringSchema,\n quantity: safeIntegerSchema(1),\n }),\n]);\n\nconst checkoutSelectionItemSchema = union([\n strictObject({\n amountCents: safeIntegerSchema(1),\n productSlug: nonEmptyStringSchema,\n }),\n strictObject({\n productSlug: nonEmptyStringSchema,\n quantity: safeIntegerSchema(1),\n }),\n]);\n\nexport const parseCheckoutItems = parser(\n pipe(array(checkoutItemSchema), minLength(1))\n);\n\nexport const parseCheckoutSelectionItems = parser(\n pipe(array(checkoutSelectionItemSchema), minLength(1))\n);\n","import {\n array,\n boolean,\n check,\n finite,\n type InferOutput,\n literal,\n maxValue,\n minValue,\n nullable,\n number,\n object,\n optional,\n parser,\n picklist,\n pipe,\n string,\n transform,\n variant,\n} from \"valibot\";\n\nimport {\n customFieldsSchema,\n nonEmptyStringSchema,\n optionalNullableStringSchema,\n safeIntegerSchema,\n} from \"./schema-helpers.ts\";\n\nconst paymentOptionSchema = picklist([\"one-time\", \"monthly\", \"annually\"]);\nconst nullableNonNegativeIntegerSchema = nullable(safeIntegerSchema(0));\n\nconst productBaseEntries = {\n description: optionalNullableStringSchema,\n id: nonEmptyStringSchema,\n inventoryQuantity: nullableNonNegativeIntegerSchema,\n maxQuantity: nullableNonNegativeIntegerSchema,\n minimumAmountCents: nullableNonNegativeIntegerSchema,\n minQuantity: nullableNonNegativeIntegerSchema,\n name: nonEmptyStringSchema,\n paymentOption: paymentOptionSchema,\n};\n\nconst publicProductSchema = pipe(\n variant(\"pricingMode\", [\n object({\n ...productBaseEntries,\n amountCents: safeIntegerSchema(0),\n pricingMode: literal(\"fixed\"),\n }),\n object({\n ...productBaseEntries,\n amountCents: nullableNonNegativeIntegerSchema,\n pricingMode: literal(\"custom\"),\n }),\n ]),\n check(\n ({ maxQuantity, minQuantity }) =>\n maxQuantity === null || minQuantity === null || minQuantity <= maxQuantity\n )\n);\n\nconst productListingSchema = object({\n acceptsDiscounts: optional(boolean(), false),\n id: nonEmptyStringSchema,\n product: publicProductSchema,\n productId: nonEmptyStringSchema,\n slug: nonEmptyStringSchema,\n});\n\nconst widgetFieldsSchema = optional(\n object({\n memberId: optional(boolean(), false),\n merchSize: optional(boolean(), false),\n phone: optional(boolean(), false),\n promoCode: optional(boolean(), false),\n serviceFee: optional(boolean(), false),\n shipping: optional(boolean(), false),\n tipping: optional(boolean(), false),\n }),\n {}\n);\n\nexport const publicWidgetSchema = pipe(\n object({\n community: optional(\n object({\n color: string(),\n name: nonEmptyStringSchema,\n thumbnail: string(),\n })\n ),\n config: optional(\n object({\n customFields: customFieldsSchema,\n fields: widgetFieldsSchema,\n })\n ),\n description: optionalNullableStringSchema,\n id: optional(string(), \"\"),\n name: optional(string(), \"Lockerverse widget\"),\n pricingPolicy: optional(\n object({\n currency: optional(literal(\"usd\"), \"usd\"),\n serviceFeeRateBasisPoints: optional(safeIntegerSchema(0), 0),\n })\n ),\n products: optional(array(productListingSchema), []),\n showCommunityBranding: optional(boolean(), true),\n title: optionalNullableStringSchema,\n }),\n transform((widget) => ({\n ...widget,\n config: {\n customFields: widget.config?.customFields ?? [],\n fields: {\n memberId: widget.config?.fields?.memberId ?? false,\n merchSize: widget.config?.fields?.merchSize ?? false,\n phone: widget.config?.fields?.phone ?? false,\n promoCode: widget.config?.fields?.promoCode ?? false,\n serviceFee: widget.config?.fields?.serviceFee ?? false,\n shipping: widget.config?.fields?.shipping ?? false,\n tipping: widget.config?.fields?.tipping ?? false,\n },\n },\n pricingPolicy: widget.pricingPolicy ?? {\n currency: \"usd\" as const,\n serviceFeeRateBasisPoints: 0,\n },\n }))\n);\n\nconst appliedDiscountSchema = nullable(\n object({\n percentageOff: pipe(number(), finite(), minValue(0), maxValue(100)),\n source: picklist([\"email_list\", \"promo_code\"]),\n })\n);\n\nconst checkoutLineItemSchema = object({\n acceptsDiscounts: boolean(),\n listingId: nonEmptyStringSchema,\n listingSlug: nonEmptyStringSchema,\n paymentOption: paymentOptionSchema,\n pricingMode: picklist([\"fixed\", \"custom\"]),\n productId: nonEmptyStringSchema,\n productName: nonEmptyStringSchema,\n quantity: safeIntegerSchema(1),\n subtotalCents: safeIntegerSchema(0),\n unitAmountCents: safeIntegerSchema(0),\n});\n\nexport const checkoutQuoteSchema = object({\n amountCents: safeIntegerSchema(0),\n appliedDiscount: appliedDiscountSchema,\n connectedAccountId: nullable(nonEmptyStringSchema),\n discountableSubtotalCents: safeIntegerSchema(0),\n discountCents: safeIntegerSchema(0),\n lineItems: array(checkoutLineItemSchema),\n paymentOption: paymentOptionSchema,\n serviceFeeCents: safeIntegerSchema(0),\n subtotalCents: safeIntegerSchema(0),\n tipCents: safeIntegerSchema(0),\n totalCents: safeIntegerSchema(0),\n});\n\nexport const paymentResultSchema = object({\n checkoutId: nonEmptyStringSchema,\n checkoutStatus: picklist([\"action_required\", \"failed\", \"pending\", \"success\"]),\n clientSecret: nullable(string()),\n paymentReference: nonEmptyStringSchema,\n requiresAction: boolean(),\n status: nullable(string()),\n});\n\nexport const checkoutBootstrapSchema = object({\n catalog: publicWidgetSchema,\n quote: checkoutQuoteSchema,\n});\n\nexport type PublicCheckoutQuote = InferOutput<typeof checkoutQuoteSchema>;\nexport type PublicProductListing = InferOutput<typeof productListingSchema>;\nexport type PublicWidget = InferOutput<typeof publicWidgetSchema>;\n\nexport const parseCheckoutQuote = parser(checkoutQuoteSchema);\nexport const parseCheckoutBootstrap = parser(checkoutBootstrapSchema);\nexport const parsePaymentResult = parser(paymentResultSchema);\nexport const parsePublicWidget = parser(publicWidgetSchema);\n","import type { PublicProductListing, PublicWidget } from \"./checkout-schemas.ts\";\nimport { deepFreeze } from \"./deep-freeze.ts\";\nimport type {\n LockerverseCatalog,\n LockerversePaymentResult,\n LockerversePreparedCheckout,\n LockerverseProduct,\n} from \"./types.ts\";\n\nfunction mapProduct(listing: PublicProductListing): LockerverseProduct {\n const { product } = listing;\n\n return {\n acceptsDiscounts: listing.acceptsDiscounts ?? false,\n amountCents: product.amountCents,\n description: product.description ?? null,\n id: product.id,\n inventoryQuantity: product.inventoryQuantity,\n listingId: listing.id,\n maximumQuantity: product.maxQuantity,\n minimumAmountCents: product.minimumAmountCents,\n minimumQuantity: product.minQuantity,\n name: product.name,\n paymentOption: product.paymentOption,\n pricingMode: product.pricingMode,\n slug: listing.slug,\n };\n}\n\nexport function createCatalog(\n widget: PublicWidget,\n publishableKey: string\n): LockerverseCatalog {\n const fields = widget.config?.fields ?? {};\n\n return {\n community: widget.community\n ? {\n accentColor: widget.community.color,\n imageUrl: widget.community.thumbnail,\n name: widget.community.name,\n }\n : null,\n payment: {\n currency: \"usd\",\n publishableKey,\n },\n pricingPolicy: {\n currency: \"usd\",\n serviceFeeRateBasisPoints:\n widget.pricingPolicy?.serviceFeeRateBasisPoints ?? 0,\n },\n products: (widget.products ?? []).map(mapProduct),\n widget: {\n customFields: widget.config?.customFields ?? [],\n description: widget.description ?? null,\n fields: {\n memberId: fields.memberId ?? false,\n merchSize: fields.merchSize ?? false,\n phone: fields.phone ?? false,\n promoCode: fields.promoCode ?? false,\n serviceFee: fields.serviceFee ?? false,\n shipping: fields.shipping ?? false,\n tipping: fields.tipping ?? false,\n },\n id: widget.id ?? \"\",\n name: widget.name ?? \"Lockerverse widget\",\n showCommunityBranding: widget.showCommunityBranding ?? true,\n title: widget.title ?? null,\n },\n };\n}\n\nexport function cloneCatalog(catalog: LockerverseCatalog): LockerverseCatalog {\n return cloneSnapshot(catalog);\n}\n\nexport function clonePreparedCheckout(\n checkout: LockerversePreparedCheckout\n): LockerversePreparedCheckout {\n return cloneSnapshot(checkout);\n}\n\nexport function clonePaymentResult(\n paymentResult: LockerversePaymentResult\n): LockerversePaymentResult {\n return cloneSnapshot(paymentResult);\n}\n\nfunction cloneSnapshot<T>(value: T): T {\n return deepFreeze(structuredClone(value));\n}\n","import { resolveWidgetEnvironment } from \"./checkout-environment.ts\";\nimport {\n parseCheckoutItems,\n parseCheckoutPricingInput,\n parseCheckoutSelectionItems,\n parsePaymentSubmission,\n} from \"./checkout-input-schemas.ts\";\nimport {\n parseCheckoutBootstrap,\n parseCheckoutQuote,\n parsePaymentResult,\n parsePublicWidget,\n} from \"./checkout-schemas.ts\";\nimport { deepFreeze } from \"./deep-freeze.ts\";\nimport { createSdkErrorReporter } from \"./error-reporting.ts\";\nimport {\n cloneCatalog,\n clonePaymentResult,\n clonePreparedCheckout,\n createCatalog,\n} from \"./snapshots.ts\";\nimport { createTransport } from \"./transport.ts\";\nimport {\n type CreateLockerverseWidgetOptions,\n type LockerverseCatalog,\n type LockerverseCheckoutClient,\n type LockerverseCheckoutItem,\n type LockerverseCheckoutPricingInput,\n type LockerverseCheckoutQuote,\n type LockerverseCheckoutSelectionItem,\n type LockerversePreparedCheckout,\n LockerverseSdkError,\n type LockerverseSdkOperation,\n} from \"./types.ts\";\n\ntype OperationErrorContext = {\n code:\n | \"checkout_bootstrap_failed\"\n | \"payment_status_failed\"\n | \"payment_submit_failed\"\n | \"total_calculation_failed\"\n | \"widget_load_failed\";\n message: string;\n operation:\n | \"bootstrap_checkout\"\n | \"calculate_total\"\n | \"get_payment_status\"\n | \"load_widget\"\n | \"submit_payment\";\n};\n\nexport function createLockerverseCheckoutClient(\n options: CreateLockerverseWidgetOptions\n): LockerverseCheckoutClient {\n const {\n apiBaseUrl,\n communitySlug,\n communitySlugValue,\n environment,\n fetchImplementation,\n onError,\n requestTimeoutMs,\n sentryDsn,\n stripePublishableKey,\n widgetSlug,\n widgetSlugValue,\n } = resolveWidgetEnvironment(options);\n const reportError = createSdkErrorReporter({\n communitySlug: communitySlugValue,\n environment,\n getContext: () => ({ widgetSlug: widgetSlugValue }),\n onError,\n resourceContextName: \"lockerverse_widget\",\n sentryDsn,\n });\n const { requestJson } = createTransport(\n fetchImplementation,\n reportError,\n requestTimeoutMs\n );\n const checkoutBaseUrl = `${apiBaseUrl}/v2/community/${communitySlug}/payment-widgets/${widgetSlug}/checkout`;\n\n function invalidInput(\n message: string,\n operation: LockerverseSdkOperation,\n code: \"invalid_selection\" | \"payment_submit_failed\" = \"invalid_selection\"\n ): never {\n throw reportError(\n new LockerverseSdkError({\n code,\n message,\n operation,\n reportable: false,\n })\n );\n }\n\n function normalizeOperationError(\n error: unknown,\n context: OperationErrorContext\n ) {\n return error instanceof LockerverseSdkError\n ? error\n : new LockerverseSdkError({ ...context, reportable: true });\n }\n\n function failOperation(\n error: unknown,\n context: OperationErrorContext,\n recoveryMayBeRequired = false\n ): never {\n const normalized = normalizeOperationError(error, context);\n const recoveryRecommended =\n recoveryMayBeRequired &&\n (normalized.status === undefined || normalized.status >= 500);\n throw reportError(\n recoveryRecommended\n ? new LockerverseSdkError({\n code: normalized.code,\n message: normalized.message,\n operation: normalized.operation,\n recoveryRecommended: true,\n reportable: normalized.reportable,\n ...(normalized.status === undefined\n ? {}\n : { status: normalized.status }),\n })\n : normalized\n );\n }\n\n function normalizePricingInput(\n input: unknown,\n operation: \"bootstrap_checkout\" | \"calculate_total\" | \"submit_payment\"\n ) {\n let parsed: ReturnType<typeof parseCheckoutPricingInput>;\n try {\n parsed = parseCheckoutPricingInput(input);\n } catch {\n invalidInput(\"Checkout pricing input is invalid.\", operation);\n }\n const email = parsed.email?.trim().toLowerCase();\n const promoCode = parsed.promoCode?.trim();\n return {\n ...(email ? { email } : {}),\n ...(parsed.includeServiceFee === undefined\n ? {}\n : { includeServiceFee: parsed.includeServiceFee }),\n ...(promoCode ? { promoCode } : {}),\n ...(parsed.tipCents === undefined ? {} : { tipCents: parsed.tipCents }),\n };\n }\n\n function normalizeBootstrapCheckoutInput(input: unknown) {\n if (!(input && typeof input === \"object\") || Array.isArray(input)) {\n invalidInput(\"Checkout selection is invalid.\", \"bootstrap_checkout\");\n }\n const { items, ...pricingInput } = input as Record<string, unknown>;\n try {\n return {\n pricing: normalizePricingInput(pricingInput, \"bootstrap_checkout\"),\n selection: parseCheckoutSelectionItems(items),\n };\n } catch (error) {\n if (error instanceof LockerverseSdkError) {\n throw error;\n }\n invalidInput(\"Checkout selection is invalid.\", \"bootstrap_checkout\");\n }\n }\n\n function createCheckoutItems(\n catalog: LockerverseCatalog,\n selection: LockerverseCheckoutSelectionItem[]\n ): LockerverseCheckoutItem[] {\n return selection.map((item) => {\n const product = catalog.products.find(\n (candidate) => candidate.slug === item.productSlug\n );\n if (!product) {\n invalidInput(\"Selected Product is unavailable.\", \"bootstrap_checkout\");\n }\n if (\"amountCents\" in item) {\n if (\n product.pricingMode !== \"custom\" ||\n (product.minimumAmountCents !== null &&\n item.amountCents < product.minimumAmountCents)\n ) {\n invalidInput(\n \"Selected Product amount is invalid.\",\n \"bootstrap_checkout\"\n );\n }\n return { amountCents: item.amountCents, productId: product.id };\n }\n if (\n product.pricingMode !== \"fixed\" ||\n (product.minimumQuantity !== null &&\n item.quantity < product.minimumQuantity) ||\n (product.maximumQuantity !== null &&\n item.quantity > product.maximumQuantity) ||\n (product.inventoryQuantity !== null &&\n item.quantity > product.inventoryQuantity)\n ) {\n invalidInput(\n \"Selected Product quantity is invalid.\",\n \"bootstrap_checkout\"\n );\n }\n return { productId: product.id, quantity: item.quantity };\n });\n }\n\n function createPreparedCheckout(\n quote: ReturnType<typeof parseCheckoutQuote>,\n items: LockerverseCheckoutItem[],\n pricing: LockerverseCheckoutPricingInput,\n context: OperationErrorContext\n ): LockerversePreparedCheckout {\n if (quote.paymentOption !== \"one-time\") {\n throw new LockerverseSdkError({\n ...context,\n message: \"Lockerverse returned an unsupported checkout cadence.\",\n reportable: true,\n });\n }\n const {\n connectedAccountId,\n paymentOption: _paymentOption,\n ...checkoutQuote\n } = quote;\n return clonePreparedCheckout(\n deepFreeze({\n ...checkoutQuote,\n authoritative: true as const,\n items,\n payment: {\n connectedAccountId,\n currency: \"usd\" as const,\n publishableKey: stripePublishableKey,\n },\n paymentOption: \"one-time\" as const,\n paymentReference: globalThis.crypto.randomUUID(),\n pricing,\n })\n );\n }\n\n function normalizeCalculateTotalInput(input: unknown) {\n if (!(input && typeof input === \"object\") || Array.isArray(input)) {\n invalidInput(\"Checkout selection is invalid.\", \"calculate_total\");\n }\n const { items, ...pricingInput } = input as Record<string, unknown>;\n try {\n return {\n items: parseCheckoutItems(items),\n pricing: normalizePricingInput(pricingInput, \"calculate_total\"),\n };\n } catch (error) {\n if (error instanceof LockerverseSdkError) {\n throw error;\n }\n invalidInput(\"Checkout selection is invalid.\", \"calculate_total\");\n }\n }\n\n function normalizeQuote(input: unknown) {\n try {\n if (!(input && typeof input === \"object\") || Array.isArray(input)) {\n throw new TypeError(\"Invalid quote.\");\n }\n const quoteInput = input as LockerverseCheckoutQuote;\n if (\n quoteInput.authoritative !== true ||\n quoteInput.paymentOption !== \"one-time\" ||\n typeof quoteInput.paymentReference !== \"string\" ||\n quoteInput.paymentReference.length === 0 ||\n quoteInput.payment.currency !== \"usd\" ||\n quoteInput.payment.publishableKey !== stripePublishableKey\n ) {\n throw new TypeError(\"Invalid quote.\");\n }\n const parsed = parseCheckoutQuote({\n ...quoteInput,\n connectedAccountId: quoteInput.payment.connectedAccountId,\n });\n if (parsed.paymentOption !== \"one-time\") {\n throw new TypeError(\"Unsupported checkout cadence.\");\n }\n const {\n connectedAccountId,\n paymentOption: _paymentOption,\n ...quote\n } = parsed;\n return deepFreeze({\n ...quote,\n authoritative: true as const,\n payment: {\n connectedAccountId,\n currency: \"usd\" as const,\n publishableKey: stripePublishableKey,\n },\n paymentOption: \"one-time\" as const,\n paymentReference: quoteInput.paymentReference,\n });\n } catch {\n invalidInput(\n \"Lockerverse payment submission is invalid.\",\n \"submit_payment\",\n \"payment_submit_failed\"\n );\n }\n }\n\n function normalizeSubmitPaymentInput(input: unknown) {\n try {\n if (!(input && typeof input === \"object\") || Array.isArray(input)) {\n throw new TypeError(\"Invalid payment input.\");\n }\n const { checkout, submission: submissionInput } = input as Record<\n string,\n unknown\n >;\n if (\n !(checkout && typeof checkout === \"object\") ||\n Array.isArray(checkout)\n ) {\n throw new TypeError(\"Invalid prepared checkout.\");\n }\n const checkoutInput = checkout as Record<string, unknown>;\n const items = parseCheckoutItems(checkoutInput.items);\n const pricing = normalizePricingInput(\n checkoutInput.pricing,\n \"submit_payment\"\n );\n const quote = normalizeQuote(checkoutInput);\n const submission = parsePaymentSubmission(submissionInput);\n const email = submission.email.trim().toLowerCase();\n if (!email || email !== pricing.email) {\n invalidInput(\n \"Payment email must match the current checkout quote.\",\n \"submit_payment\"\n );\n }\n return {\n items,\n pricing,\n quote,\n submission: { ...submission, email },\n };\n } catch (error) {\n if (error instanceof LockerverseSdkError) {\n throw error;\n }\n invalidInput(\n \"Lockerverse payment submission is invalid.\",\n \"submit_payment\",\n \"payment_submit_failed\"\n );\n }\n }\n\n return {\n async bootstrapCheckout(input) {\n const { pricing, selection } = normalizeBootstrapCheckoutInput(input);\n const context = {\n code: \"checkout_bootstrap_failed\" as const,\n message: \"Lockerverse returned an invalid checkout bootstrap.\",\n operation: \"bootstrap_checkout\" as const,\n };\n try {\n const response = await requestJson(\n `${checkoutBaseUrl}/bootstrap`,\n {\n body: JSON.stringify({ ...pricing, items: selection }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n },\n parseCheckoutBootstrap,\n {\n ...context,\n message:\n \"Unable to bootstrap the Lockerverse checkout because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to bootstrap the Lockerverse checkout (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n const catalog = deepFreeze(\n createCatalog(response.value.catalog, stripePublishableKey)\n );\n const checkoutItems = createCheckoutItems(catalog, selection);\n const checkoutPricing = {\n ...pricing,\n includeServiceFee:\n pricing.includeServiceFee ?? catalog.widget.fields.serviceFee,\n };\n return deepFreeze({\n catalog: cloneCatalog(catalog),\n checkout: createPreparedCheckout(\n response.value.quote,\n checkoutItems,\n checkoutPricing,\n context\n ),\n });\n } catch (error) {\n failOperation(error, context);\n }\n },\n async calculateTotal(input) {\n const { items, pricing } = normalizeCalculateTotalInput(input);\n const context = {\n code: \"total_calculation_failed\" as const,\n message: \"Lockerverse returned an invalid checkout total.\",\n operation: \"calculate_total\" as const,\n };\n try {\n const response = await requestJson(\n `${checkoutBaseUrl}/quote`,\n {\n body: JSON.stringify({ ...pricing, items }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n },\n parseCheckoutQuote,\n {\n ...context,\n message:\n \"Unable to calculate the Lockerverse checkout total because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to calculate the Lockerverse checkout total (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n return createPreparedCheckout(response.value, items, pricing, context);\n } catch (error) {\n failOperation(error, context);\n }\n },\n async getPaymentStatus(paymentReference) {\n if (typeof paymentReference !== \"string\" || !paymentReference.trim()) {\n invalidInput(\n \"Provide a payment reference to recover its status.\",\n \"get_payment_status\"\n );\n }\n const normalizedReference = paymentReference.trim();\n const context = {\n code: \"payment_status_failed\" as const,\n message: \"Lockerverse returned an invalid payment status.\",\n operation: \"get_payment_status\" as const,\n };\n try {\n const response = await requestJson(\n `${checkoutBaseUrl}/${encodeURIComponent(normalizedReference)}/status`,\n undefined,\n parsePaymentResult,\n {\n ...context,\n message:\n \"Unable to recover the Lockerverse payment status because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to recover the Lockerverse payment status (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n if (response.value.paymentReference !== normalizedReference) {\n throw new LockerverseSdkError({ ...context, reportable: true });\n }\n return clonePaymentResult(response.value);\n } catch (error) {\n failOperation(error, context);\n }\n },\n async load() {\n const context = {\n code: \"widget_load_failed\" as const,\n message: \"Lockerverse returned an invalid widget catalog.\",\n operation: \"load_widget\" as const,\n };\n try {\n const response = await requestJson(\n `${apiBaseUrl}/v2/community/${communitySlug}/payment-widgets/${widgetSlug}`,\n undefined,\n parsePublicWidget,\n {\n ...context,\n message:\n \"Unable to load Lockerverse widget because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to load Lockerverse widget (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n return cloneCatalog(\n deepFreeze(createCatalog(response.value, stripePublishableKey))\n );\n } catch (error) {\n failOperation(error, context);\n }\n },\n async submitPayment(input) {\n const { items, pricing, quote, submission } =\n normalizeSubmitPaymentInput(input);\n const context = {\n code: \"payment_submit_failed\" as const,\n message: \"Lockerverse returned an invalid payment confirmation.\",\n operation: \"submit_payment\" as const,\n };\n try {\n const response = await requestJson(\n `${checkoutBaseUrl}/confirm`,\n {\n body: JSON.stringify({\n confirmationToken: submission.confirmationToken,\n customFieldAnswers: submission.customFieldAnswers,\n email: submission.email,\n expectedAmountCents: quote.amountCents,\n expectedAppliedDiscount: quote.appliedDiscount,\n expectedConnectedAccountId: quote.payment.connectedAccountId,\n expectedDiscountableSubtotalCents:\n quote.discountableSubtotalCents,\n expectedDiscountCents: quote.discountCents,\n expectedServiceFeeCents: quote.serviceFeeCents,\n expectedSubtotalCents: quote.subtotalCents,\n expectedTipCents: quote.tipCents,\n expectedTotalCents: quote.totalCents,\n ...pricing,\n items,\n memberId: submission.memberId,\n merchSize: submission.merchSize,\n metadata: submission.metadata,\n paymentReference: quote.paymentReference,\n phone: submission.phone,\n quoteContractVersion: 1,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n },\n parsePaymentResult,\n {\n ...context,\n message:\n \"Unable to submit the Lockerverse payment because the request failed.\",\n report: false,\n },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n message: `Unable to submit the Lockerverse payment (${response.response.status}).`,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n if (response.value.paymentReference !== quote.paymentReference) {\n throw new LockerverseSdkError({ ...context, reportable: true });\n }\n return clonePaymentResult(response.value);\n } catch (error) {\n failOperation(error, context, true);\n }\n },\n };\n}\n"],"mappings":"qRAMA,MAAM,GAAkE,CACtE,YACE,8GACF,WACE,6GACJ,EAEA,SAAgB,EACd,EACA,CACA,IAAM,EAAU,EAA2B,EAAS,YAAY,EAChE,MAAO,CACL,GAAG,EACH,qBAAsB,GAAwB,EAAQ,aACtD,WAAY,EAAQ,aACpB,gBAAiB,EAAQ,iBAC3B,CACF,CCHA,MAAa,EAA4B,EACvC,EACE,EAAa,CACX,MAAO,EAAS,EAAO,CAAC,EACxB,kBAAmB,EAAS,EAAQ,CAAC,EACrC,UAAW,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B,UACnB,CACE,KAAM,KAAK,UAAU,CACnB,kBAAmB,EAAW,kBAC9B,mBAAoB,EAAW,mBAC/B,MAAO,EAAW,MAClB,oBAAqB,EAAM,YAC3B,wBAAyB,EAAM,gBAC/B,2BAA4B,EAAM,QAAQ,mBAC1C,kCACE,EAAM,0BACR,sBAAuB,EAAM,cAC7B,wBAAyB,EAAM,gBAC/B,sBAAuB,EAAM,cAC7B,iBAAkB,EAAM,SACxB,mBAAoB,EAAM,WAC1B,GAAG,EACH,QACA,SAAU,EAAW,SACrB,UAAW,EAAW,UACtB,SAAU,EAAW,SACrB,iBAAkB,EAAM,iBACxB,MAAO,EAAW,MAClB,qBAAsB,CACxB,CAAC,EACD,QAAS,CAAE,eAAgB,kBAAmB,EAC9C,OAAQ,MACV,EACA,EACA,CACE,GAAG,EACH,QACE,uEACF,OAAQ,EACV,EACA,CAAE,GAAG,EAAS,OAAQ,EAAM,CAC9B,EACA,GAAI,CAAC,EAAS,GACZ,MAAM,IAAI,EAAoB,CAC5B,GAAG,EACH,QAAS,6CAA6C,EAAS,SAAS,OAAO,IAC/E,WAAY,EAAS,SAAS,QAAU,IACxC,OAAQ,EAAS,SAAS,MAC5B,CAAC,EAEH,GAAI,EAAS,MAAM,mBAAqB,EAAM,iBAC5C,MAAM,IAAI,EAAoB,CAAE,GAAG,EAAS,WAAY,EAAK,CAAC,EAEhE,OAAO,EAAmB,EAAS,KAAK,CAC1C,OAAS,EAAO,CACd,EAAc,EAAO,EAAS,EAAI,CACpC,CACF,CACF,CACF"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as LockerverseSdkOperation, O as LockerverseSdkError, k as LockerverseSdkErrorCode, n as LOCKERVERSE_SDK_VERSION, y as LockerverseEnvironment } from "./types.js";
1
+ import { M as LockerverseSdkErrorCode, N as LockerverseSdkOperation, S as LockerverseEnvironment, j as LockerverseSdkError, n as LOCKERVERSE_SDK_VERSION } from "./types.js";
2
2
  export { LOCKERVERSE_SDK_VERSION, type LockerverseEnvironment, LockerverseSdkError, type LockerverseSdkErrorCode, type LockerverseSdkOperation };
package/dist/signup.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { O as LockerverseSdkError, _ as LockerverseCustomFieldAnswerValue, g as LockerverseCustomFieldAnswer, h as LockerverseCustomField, v as LockerverseCustomFieldOption, y as LockerverseEnvironment } from "./types.js";
1
+ import { S as LockerverseEnvironment, b as LockerverseCustomFieldAnswerValue, j as LockerverseSdkError, v as LockerverseCustomField, x as LockerverseCustomFieldOption, y as LockerverseCustomFieldAnswer } from "./types.js";
2
2
  //#region src/signup-types.d.ts
3
3
  type LockerverseSignupField = {
4
4
  enabled: boolean;
package/dist/types.d.ts CHANGED
@@ -84,8 +84,8 @@ type LockerverseWidgetConfiguration = {
84
84
  showCommunityBranding: boolean;
85
85
  title: string | null;
86
86
  };
87
- type LockerverseSdkErrorCode = "widget_load_failed" | "signup_load_failed" | "signup_submit_failed" | "total_calculation_failed" | "payment_submit_failed" | "payment_status_failed" | "invalid_selection";
88
- type LockerverseSdkOperation = "load_widget" | "load_signup" | "submit_signup" | "calculate_total" | "submit_payment" | "get_payment_status" | "update_selection";
87
+ type LockerverseSdkErrorCode = "checkout_bootstrap_failed" | "widget_load_failed" | "signup_load_failed" | "signup_submit_failed" | "total_calculation_failed" | "payment_submit_failed" | "payment_status_failed" | "invalid_selection";
88
+ type LockerverseSdkOperation = "bootstrap_checkout" | "load_widget" | "load_signup" | "submit_signup" | "calculate_total" | "submit_payment" | "get_payment_status" | "update_selection";
89
89
  declare class LockerverseSdkError extends Error {
90
90
  readonly code: LockerverseSdkErrorCode;
91
91
  readonly operation: LockerverseSdkOperation;
@@ -166,6 +166,16 @@ type LockerverseCheckoutItem = {
166
166
  productId: string;
167
167
  amountCents: number;
168
168
  };
169
+ type LockerverseCheckoutSelectionItem = {
170
+ productSlug: string;
171
+ quantity: number;
172
+ } | {
173
+ productSlug: string;
174
+ amountCents: number;
175
+ };
176
+ type LockerverseBootstrapCheckoutInput = LockerverseCheckoutPricingInput & {
177
+ items: LockerverseCheckoutSelectionItem[];
178
+ };
169
179
  type LockerverseCalculateTotalInput = LockerverseCheckoutPricingInput & {
170
180
  items: LockerverseCheckoutItem[];
171
181
  };
@@ -173,6 +183,10 @@ type LockerversePreparedCheckout = Readonly<LockerverseCheckoutQuote & {
173
183
  items: readonly LockerverseCheckoutItem[];
174
184
  pricing: Readonly<LockerverseCheckoutPricingInput>;
175
185
  }>;
186
+ type LockerverseCheckoutBootstrap = Readonly<{
187
+ catalog: LockerverseCatalog;
188
+ checkout: LockerversePreparedCheckout;
189
+ }>;
176
190
  type LockerverseSubmitPaymentInput = {
177
191
  checkout: LockerversePreparedCheckout;
178
192
  submission: LockerversePaymentSubmission;
@@ -193,11 +207,12 @@ type CreateLockerverseWidgetOptions = CreateLockerverseWidgetBaseOptions & ({
193
207
  environment?: "production";
194
208
  });
195
209
  type LockerverseCheckoutClient = {
210
+ bootstrapCheckout: (input: LockerverseBootstrapCheckoutInput) => Promise<LockerverseCheckoutBootstrap>;
196
211
  calculateTotal: (input: LockerverseCalculateTotalInput) => Promise<LockerversePreparedCheckout>;
197
212
  getPaymentStatus: (paymentReference: string) => Promise<LockerversePaymentResult>;
198
213
  load: () => Promise<LockerverseCatalog>;
199
214
  submitPayment: (input: LockerverseSubmitPaymentInput) => Promise<LockerversePaymentResult>;
200
215
  };
201
216
  //#endregion
202
- export { LockerverseSdkOperation as A, LockerversePaymentResult as C, LockerverseProduct as D, LockerversePreparedCheckout as E, LockerverseWidgetFields as F, LockerverseSubmitPaymentInput as M, LockerverseTextCustomField as N, LockerverseSdkError as O, LockerverseWidgetConfiguration as P, LockerversePaymentOption as S, LockerversePaymentSubmission as T, LockerverseCustomFieldAnswerValue as _, LockerverseCatalog as a, LockerverseMultiOptionCustomField as b, LockerverseCheckoutItem as c, LockerverseCheckoutPricingInput as d, LockerverseCheckoutPricingPolicy as f, LockerverseCustomFieldAnswer as g, LockerverseCustomField as h, LockerverseCalculateTotalInput as i, LockerverseSingleOptionCustomField as j, LockerverseSdkErrorCode as k, LockerverseCheckoutLineItem as l, LockerverseCommunityBranding as m, LOCKERVERSE_SDK_VERSION as n, LockerverseCheckoutAmounts as o, LockerverseCheckoutQuote as p, LockerverseAppliedDiscount as r, LockerverseCheckoutClient as s, CreateLockerverseWidgetOptions as t, LockerverseCheckoutPaymentConfiguration as u, LockerverseCustomFieldOption as v, LockerversePaymentStatus as w, LockerversePaymentConfiguration as x, LockerverseEnvironment as y };
217
+ export { LockerverseProduct as A, LockerverseMultiOptionCustomField as C, LockerversePaymentStatus as D, LockerversePaymentResult as E, LockerverseSubmitPaymentInput as F, LockerverseTextCustomField as I, LockerverseWidgetConfiguration as L, LockerverseSdkErrorCode as M, LockerverseSdkOperation as N, LockerversePaymentSubmission as O, LockerverseSingleOptionCustomField as P, LockerverseWidgetFields as R, LockerverseEnvironment as S, LockerversePaymentOption as T, LockerverseCommunityBranding as _, LockerverseCalculateTotalInput as a, LockerverseCustomFieldAnswerValue as b, LockerverseCheckoutBootstrap as c, LockerverseCheckoutLineItem as d, LockerverseCheckoutPaymentConfiguration as f, LockerverseCheckoutSelectionItem as g, LockerverseCheckoutQuote as h, LockerverseBootstrapCheckoutInput as i, LockerverseSdkError as j, LockerversePreparedCheckout as k, LockerverseCheckoutClient as l, LockerverseCheckoutPricingPolicy as m, LOCKERVERSE_SDK_VERSION as n, LockerverseCatalog as o, LockerverseCheckoutPricingInput as p, LockerverseAppliedDiscount as r, LockerverseCheckoutAmounts as s, CreateLockerverseWidgetOptions as t, LockerverseCheckoutItem as u, LockerverseCustomField as v, LockerversePaymentConfiguration as w, LockerverseCustomFieldOption as x, LockerverseCustomFieldAnswer as y };
203
218
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";KAEY;KACA;cAEC;KAED;EACV;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV,WAAW;EACX,SAAS;EACT,eAAe;EACf,UAAU;EACV,QAAQ;;KAGE;EACV;EACA;EACA;;KAGU;EACV;EACA;;KAGU;EACV;EACA;;KAGU,0CACV;EACE;;KAGQ;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EAAiC;EAAY;;KAEpD;EACH;EACA;EACA;;KAGU,6BAA6B;EACvC;;KAGU,qCAAqC;EAC/C,SAAS;EACT;;KAGU,oCAAoC;EAC9C,SAAS;EACT;;KAGU,yBACR,6BACA,qCACA;KAEQ,kCACV,cAAc,0BACZ,cAAc;KAEN,6BACV,cAAc,yBAAyB,0BACrC,cAAc;EACZ,SAAS;EAAa,OAAO,kCAAkC;;KAGzD;EACV,cAAc;EACd;EACA,QAAQ;EACR;EACA;EACA;EACA;;KAGU;KASA;cASC,4BAA4B;WAC9B,MAAM;WACN,WAAW;WACX;WACA;WACA;WACA;EAEG,cACV,MACA,SACA,WACA,YACA,qBACA;IAEA,MAAM;IACN;IACA,WAAW;IACX;IACA;IACA;;;KAaQ;EACV;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;;KAGU;EACV;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU,2BAA2B;EACrC,iBAAiB;EACjB;EACA;EACA,SAAS;EACT;EACA,WAAW;;KAGD;EACV;EACA;EACA;EACA;;KAGU;KAMA;EACV;EACA;EACA,gBAAgB;EAChB;EACA;EACA;;KAGU;EACV;EACA,qBAAqB;EACrB;EACA;EACA;EACA,WAAW;EACX;;KAGU;EACN;EAAmB;;EACnB;EAAmB;;KAEb,iCAAiC;EAC3C,OAAO;;KAGG,8BAA8B,SACxC;EACE,gBAAgB;EAChB,SAAS,SAAS;;KAIV;EACV,UAAU;EACV,YAAY;;KAGT;EACH;EACA,eAAe,WAAW;EAC1B,WAAW,OAAO;EAClB;EACA;EACA;;KAGU,iCACV;EAGQ;EACA,aAAa;;EAGb;EACA;;KAIE;EACV,iBACE,OAAO,mCACJ,QAAQ;EACb,mBACE,6BACG,QAAQ;EACb,YAAY,QAAQ;EACpB,gBACE,OAAO,kCACJ,QAAQ"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";KAEY;KACA;cAEC;KAED;EACV;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV,WAAW;EACX,SAAS;EACT,eAAe;EACf,UAAU;EACV,QAAQ;;KAGE;EACV;EACA;EACA;;KAGU;EACV;EACA;;KAGU;EACV;EACA;;KAGU,0CACV;EACE;;KAGQ;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EAAiC;EAAY;;KAEpD;EACH;EACA;EACA;;KAGU,6BAA6B;EACvC;;KAGU,qCAAqC;EAC/C,SAAS;EACT;;KAGU,oCAAoC;EAC9C,SAAS;EACT;;KAGU,yBACR,6BACA,qCACA;KAEQ,kCACV,cAAc,0BACZ,cAAc;KAEN,6BACV,cAAc,yBAAyB,0BACrC,cAAc;EACZ,SAAS;EAAa,OAAO,kCAAkC;;KAGzD;EACV,cAAc;EACd;EACA,QAAQ;EACR;EACA;EACA;EACA;;KAGU;KAUA;cAUC,4BAA4B;WAC9B,MAAM;WACN,WAAW;WACX;WACA;WACA;WACA;EAEG,cACV,MACA,SACA,WACA,YACA,qBACA;IAEA,MAAM;IACN;IACA,WAAW;IACX;IACA;IACA;;;KAaQ;EACV;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;;KAGU;EACV;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU,2BAA2B;EACrC,iBAAiB;EACjB;EACA;EACA,SAAS;EACT;EACA,WAAW;;KAGD;EACV;EACA;EACA;EACA;;KAGU;KAMA;EACV;EACA;EACA,gBAAgB;EAChB;EACA;EACA;;KAGU;EACV;EACA,qBAAqB;EACrB;EACA;EACA;EACA,WAAW;EACX;;KAGU;EACN;EAAmB;;EACnB;EAAmB;;KAEb;EACN;EAAqB;;EACrB;EAAqB;;KAEf,oCACV;EACE,OAAO;;KAGC,iCAAiC;EAC3C,OAAO;;KAGG,8BAA8B,SACxC;EACE,gBAAgB;EAChB,SAAS,SAAS;;KAIV,+BAA+B;EACzC,SAAS;EACT,UAAU;;KAGA;EACV,UAAU;EACV,YAAY;;KAGT;EACH;EACA,eAAe,WAAW;EAC1B,WAAW,OAAO;EAClB;EACA;EACA;;KAGU,iCACV;EAGQ;EACA,aAAa;;EAGb;EACA;;KAIE;EACV,oBACE,OAAO,sCACJ,QAAQ;EACb,iBACE,OAAO,mCACJ,QAAQ;EACb,mBACE,6BACG,QAAQ;EACb,YAAY,QAAQ;EACpB,gBACE,OAAO,kCACJ,QAAQ"}
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
- const e=`0.2.43`;var t=class extends Error{code;operation;reportable;recoveryRecommended;sdkVersion;status;constructor({code:t,message:n,operation:r,reportable:i,recoveryRecommended:a=!1,status:o}){super(n),this.name=`LockerverseSdkError`,this.code=t,this.operation=r,this.reportable=i,this.recoveryRecommended=a,this.sdkVersion=e,this.status=o}};export{t as n,e as t};
1
+ const e=`0.2.45`;var t=class extends Error{code;operation;reportable;recoveryRecommended;sdkVersion;status;constructor({code:t,message:n,operation:r,reportable:i,recoveryRecommended:a=!1,status:o}){super(n),this.name=`LockerverseSdkError`,this.code=t,this.operation=r,this.reportable=i,this.recoveryRecommended=a,this.sdkVersion=e,this.status=o}};export{t as n,e as t};
2
2
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["packageMetadata.version"],"sources":["../package.json","../src/types.ts"],"sourcesContent":["","import packageMetadata from \"../package.json\" with { type: \"json\" };\n\nexport type LockerversePaymentOption = \"one-time\" | \"monthly\" | \"annually\";\nexport type LockerverseEnvironment = \"development\" | \"production\";\n\nexport const LOCKERVERSE_SDK_VERSION = packageMetadata.version;\n\nexport type LockerverseProduct = {\n id: string;\n listingId: string;\n slug: string;\n name: string;\n description: string | null;\n pricingMode: \"fixed\" | \"custom\";\n paymentOption: LockerversePaymentOption;\n amountCents: number | null;\n minimumAmountCents: number | null;\n minimumQuantity: number | null;\n maximumQuantity: number | null;\n inventoryQuantity: number | null;\n acceptsDiscounts: boolean;\n};\n\nexport type LockerverseCatalog = {\n community: LockerverseCommunityBranding | null;\n payment: LockerversePaymentConfiguration;\n pricingPolicy: LockerverseCheckoutPricingPolicy;\n products: LockerverseProduct[];\n widget: LockerverseWidgetConfiguration;\n};\n\nexport type LockerverseCommunityBranding = {\n accentColor: string;\n imageUrl: string;\n name: string;\n};\n\nexport type LockerverseCheckoutPricingPolicy = {\n currency: \"usd\";\n serviceFeeRateBasisPoints: number;\n};\n\nexport type LockerversePaymentConfiguration = {\n currency: \"usd\";\n publishableKey: string;\n};\n\nexport type LockerverseCheckoutPaymentConfiguration =\n LockerversePaymentConfiguration & {\n connectedAccountId: string | null;\n };\n\nexport type LockerverseWidgetFields = {\n memberId: boolean;\n merchSize: boolean;\n phone: boolean;\n promoCode: boolean;\n serviceFee: boolean;\n shipping: boolean;\n tipping: boolean;\n};\n\nexport type LockerverseCustomFieldOption = { id: string; label: string };\n\ntype LockerverseCustomFieldBase = {\n id: string;\n label: string;\n required: boolean;\n};\n\nexport type LockerverseTextCustomField = LockerverseCustomFieldBase & {\n type: \"text\" | \"textarea\";\n};\n\nexport type LockerverseSingleOptionCustomField = LockerverseCustomFieldBase & {\n options: LockerverseCustomFieldOption[];\n type: \"radio\" | \"select\";\n};\n\nexport type LockerverseMultiOptionCustomField = LockerverseCustomFieldBase & {\n options: LockerverseCustomFieldOption[];\n type: \"checkboxes\" | \"multi_select\";\n};\n\nexport type LockerverseCustomField =\n | LockerverseTextCustomField\n | LockerverseSingleOptionCustomField\n | LockerverseMultiOptionCustomField;\n\nexport type LockerverseCustomFieldAnswerValue<\n Field extends LockerverseCustomField,\n> = Field extends LockerverseMultiOptionCustomField ? string[] : string;\n\nexport type LockerverseCustomFieldAnswer<\n Field extends LockerverseCustomField = LockerverseCustomField,\n> = Field extends LockerverseCustomField\n ? { fieldId: Field[\"id\"]; value: LockerverseCustomFieldAnswerValue<Field> }\n : never;\n\nexport type LockerverseWidgetConfiguration = {\n customFields: LockerverseCustomField[];\n description: string | null;\n fields: LockerverseWidgetFields;\n id: string;\n name: string;\n showCommunityBranding: boolean;\n title: string | null;\n};\n\nexport type LockerverseSdkErrorCode =\n | \"widget_load_failed\"\n | \"signup_load_failed\"\n | \"signup_submit_failed\"\n | \"total_calculation_failed\"\n | \"payment_submit_failed\"\n | \"payment_status_failed\"\n | \"invalid_selection\";\n\nexport type LockerverseSdkOperation =\n | \"load_widget\"\n | \"load_signup\"\n | \"submit_signup\"\n | \"calculate_total\"\n | \"submit_payment\"\n | \"get_payment_status\"\n | \"update_selection\";\n\nexport class LockerverseSdkError extends Error {\n readonly code: LockerverseSdkErrorCode;\n readonly operation: LockerverseSdkOperation;\n readonly reportable: boolean;\n readonly recoveryRecommended: boolean;\n readonly sdkVersion: string;\n readonly status: number | undefined;\n\n constructor({\n code,\n message,\n operation,\n reportable,\n recoveryRecommended = false,\n status,\n }: {\n code: LockerverseSdkErrorCode;\n message: string;\n operation: LockerverseSdkOperation;\n reportable: boolean;\n recoveryRecommended?: boolean;\n status?: number;\n }) {\n super(message);\n this.name = \"LockerverseSdkError\";\n this.code = code;\n this.operation = operation;\n this.reportable = reportable;\n this.recoveryRecommended = recoveryRecommended;\n this.sdkVersion = LOCKERVERSE_SDK_VERSION;\n this.status = status;\n }\n}\n\nexport type LockerverseCheckoutLineItem = {\n productId: string;\n productName: string;\n listingId: string;\n listingSlug: string;\n acceptsDiscounts: boolean;\n pricingMode: \"fixed\" | \"custom\";\n paymentOption: LockerversePaymentOption;\n quantity: number;\n unitAmountCents: number;\n subtotalCents: number;\n};\n\nexport type LockerverseAppliedDiscount = {\n percentageOff: number;\n source: \"email_list\" | \"promo_code\";\n};\n\nexport type LockerverseCheckoutAmounts = {\n amountCents: number;\n discountableSubtotalCents: number;\n discountCents: number;\n serviceFeeCents: number;\n subtotalCents: number;\n tipCents: number;\n totalCents: number;\n};\n\nexport type LockerverseCheckoutQuote = LockerverseCheckoutAmounts & {\n appliedDiscount: LockerverseAppliedDiscount | null;\n authoritative: true;\n paymentReference: string;\n payment: LockerverseCheckoutPaymentConfiguration;\n paymentOption: \"one-time\";\n lineItems: LockerverseCheckoutLineItem[];\n};\n\nexport type LockerverseCheckoutPricingInput = {\n email?: string;\n includeServiceFee?: boolean;\n promoCode?: string;\n tipCents?: number;\n};\n\nexport type LockerversePaymentStatus =\n | \"action_required\"\n | \"failed\"\n | \"pending\"\n | \"success\";\n\nexport type LockerversePaymentResult = {\n checkoutId: string;\n paymentReference: string;\n checkoutStatus: LockerversePaymentStatus;\n clientSecret: string | null;\n requiresAction: boolean;\n status: string | null;\n};\n\nexport type LockerversePaymentSubmission = {\n confirmationToken: string;\n customFieldAnswers?: LockerverseCustomFieldAnswer[];\n email: string;\n memberId?: string;\n merchSize?: \"XS\" | \"S\" | \"M\" | \"L\" | \"XL\" | \"XXL\" | \"XXXL\";\n metadata?: Record<string, string>;\n phone?: string;\n};\n\nexport type LockerverseCheckoutItem =\n | { productId: string; quantity: number }\n | { productId: string; amountCents: number };\n\nexport type LockerverseCalculateTotalInput = LockerverseCheckoutPricingInput & {\n items: LockerverseCheckoutItem[];\n};\n\nexport type LockerversePreparedCheckout = Readonly<\n LockerverseCheckoutQuote & {\n items: readonly LockerverseCheckoutItem[];\n pricing: Readonly<LockerverseCheckoutPricingInput>;\n }\n>;\n\nexport type LockerverseSubmitPaymentInput = {\n checkout: LockerversePreparedCheckout;\n submission: LockerversePaymentSubmission;\n};\n\ntype CreateLockerverseWidgetBaseOptions = {\n communitySlug: string;\n fetch?: typeof globalThis.fetch;\n onError?: (error: LockerverseSdkError) => void;\n requestTimeoutMs?: number;\n sentryDsn?: string | null;\n widgetSlug: string;\n};\n\nexport type CreateLockerverseWidgetOptions =\n CreateLockerverseWidgetBaseOptions &\n (\n | {\n apiBaseUrl: string;\n environment: LockerverseEnvironment;\n }\n | {\n apiBaseUrl?: undefined;\n environment?: \"production\";\n }\n );\n\nexport type LockerverseCheckoutClient = {\n calculateTotal: (\n input: LockerverseCalculateTotalInput\n ) => Promise<LockerversePreparedCheckout>;\n getPaymentStatus: (\n paymentReference: string\n ) => Promise<LockerversePaymentResult>;\n load: () => Promise<LockerverseCatalog>;\n submitPayment: (\n input: LockerverseSubmitPaymentInput\n ) => Promise<LockerversePaymentResult>;\n};\n"],"mappings":"ACKA,MAAa,EAA0BA,SA0HvC,IAAa,EAAb,cAAyC,KAAM,CAC7C,KACA,UACA,WACA,oBACA,WACA,OAEA,YAAY,CACV,OACA,UACA,YACA,aACA,sBAAsB,GACtB,UAQC,CACD,MAAM,CAAO,EACb,KAAK,KAAO,sBACZ,KAAK,KAAO,EACZ,KAAK,UAAY,EACjB,KAAK,WAAa,EAClB,KAAK,oBAAsB,EAC3B,KAAK,WAAa,EAClB,KAAK,OAAS,CAChB,CACF"}
1
+ {"version":3,"file":"types.js","names":["packageMetadata.version"],"sources":["../package.json","../src/types.ts"],"sourcesContent":["","import packageMetadata from \"../package.json\" with { type: \"json\" };\n\nexport type LockerversePaymentOption = \"one-time\" | \"monthly\" | \"annually\";\nexport type LockerverseEnvironment = \"development\" | \"production\";\n\nexport const LOCKERVERSE_SDK_VERSION = packageMetadata.version;\n\nexport type LockerverseProduct = {\n id: string;\n listingId: string;\n slug: string;\n name: string;\n description: string | null;\n pricingMode: \"fixed\" | \"custom\";\n paymentOption: LockerversePaymentOption;\n amountCents: number | null;\n minimumAmountCents: number | null;\n minimumQuantity: number | null;\n maximumQuantity: number | null;\n inventoryQuantity: number | null;\n acceptsDiscounts: boolean;\n};\n\nexport type LockerverseCatalog = {\n community: LockerverseCommunityBranding | null;\n payment: LockerversePaymentConfiguration;\n pricingPolicy: LockerverseCheckoutPricingPolicy;\n products: LockerverseProduct[];\n widget: LockerverseWidgetConfiguration;\n};\n\nexport type LockerverseCommunityBranding = {\n accentColor: string;\n imageUrl: string;\n name: string;\n};\n\nexport type LockerverseCheckoutPricingPolicy = {\n currency: \"usd\";\n serviceFeeRateBasisPoints: number;\n};\n\nexport type LockerversePaymentConfiguration = {\n currency: \"usd\";\n publishableKey: string;\n};\n\nexport type LockerverseCheckoutPaymentConfiguration =\n LockerversePaymentConfiguration & {\n connectedAccountId: string | null;\n };\n\nexport type LockerverseWidgetFields = {\n memberId: boolean;\n merchSize: boolean;\n phone: boolean;\n promoCode: boolean;\n serviceFee: boolean;\n shipping: boolean;\n tipping: boolean;\n};\n\nexport type LockerverseCustomFieldOption = { id: string; label: string };\n\ntype LockerverseCustomFieldBase = {\n id: string;\n label: string;\n required: boolean;\n};\n\nexport type LockerverseTextCustomField = LockerverseCustomFieldBase & {\n type: \"text\" | \"textarea\";\n};\n\nexport type LockerverseSingleOptionCustomField = LockerverseCustomFieldBase & {\n options: LockerverseCustomFieldOption[];\n type: \"radio\" | \"select\";\n};\n\nexport type LockerverseMultiOptionCustomField = LockerverseCustomFieldBase & {\n options: LockerverseCustomFieldOption[];\n type: \"checkboxes\" | \"multi_select\";\n};\n\nexport type LockerverseCustomField =\n | LockerverseTextCustomField\n | LockerverseSingleOptionCustomField\n | LockerverseMultiOptionCustomField;\n\nexport type LockerverseCustomFieldAnswerValue<\n Field extends LockerverseCustomField,\n> = Field extends LockerverseMultiOptionCustomField ? string[] : string;\n\nexport type LockerverseCustomFieldAnswer<\n Field extends LockerverseCustomField = LockerverseCustomField,\n> = Field extends LockerverseCustomField\n ? { fieldId: Field[\"id\"]; value: LockerverseCustomFieldAnswerValue<Field> }\n : never;\n\nexport type LockerverseWidgetConfiguration = {\n customFields: LockerverseCustomField[];\n description: string | null;\n fields: LockerverseWidgetFields;\n id: string;\n name: string;\n showCommunityBranding: boolean;\n title: string | null;\n};\n\nexport type LockerverseSdkErrorCode =\n | \"checkout_bootstrap_failed\"\n | \"widget_load_failed\"\n | \"signup_load_failed\"\n | \"signup_submit_failed\"\n | \"total_calculation_failed\"\n | \"payment_submit_failed\"\n | \"payment_status_failed\"\n | \"invalid_selection\";\n\nexport type LockerverseSdkOperation =\n | \"bootstrap_checkout\"\n | \"load_widget\"\n | \"load_signup\"\n | \"submit_signup\"\n | \"calculate_total\"\n | \"submit_payment\"\n | \"get_payment_status\"\n | \"update_selection\";\n\nexport class LockerverseSdkError extends Error {\n readonly code: LockerverseSdkErrorCode;\n readonly operation: LockerverseSdkOperation;\n readonly reportable: boolean;\n readonly recoveryRecommended: boolean;\n readonly sdkVersion: string;\n readonly status: number | undefined;\n\n constructor({\n code,\n message,\n operation,\n reportable,\n recoveryRecommended = false,\n status,\n }: {\n code: LockerverseSdkErrorCode;\n message: string;\n operation: LockerverseSdkOperation;\n reportable: boolean;\n recoveryRecommended?: boolean;\n status?: number;\n }) {\n super(message);\n this.name = \"LockerverseSdkError\";\n this.code = code;\n this.operation = operation;\n this.reportable = reportable;\n this.recoveryRecommended = recoveryRecommended;\n this.sdkVersion = LOCKERVERSE_SDK_VERSION;\n this.status = status;\n }\n}\n\nexport type LockerverseCheckoutLineItem = {\n productId: string;\n productName: string;\n listingId: string;\n listingSlug: string;\n acceptsDiscounts: boolean;\n pricingMode: \"fixed\" | \"custom\";\n paymentOption: LockerversePaymentOption;\n quantity: number;\n unitAmountCents: number;\n subtotalCents: number;\n};\n\nexport type LockerverseAppliedDiscount = {\n percentageOff: number;\n source: \"email_list\" | \"promo_code\";\n};\n\nexport type LockerverseCheckoutAmounts = {\n amountCents: number;\n discountableSubtotalCents: number;\n discountCents: number;\n serviceFeeCents: number;\n subtotalCents: number;\n tipCents: number;\n totalCents: number;\n};\n\nexport type LockerverseCheckoutQuote = LockerverseCheckoutAmounts & {\n appliedDiscount: LockerverseAppliedDiscount | null;\n authoritative: true;\n paymentReference: string;\n payment: LockerverseCheckoutPaymentConfiguration;\n paymentOption: \"one-time\";\n lineItems: LockerverseCheckoutLineItem[];\n};\n\nexport type LockerverseCheckoutPricingInput = {\n email?: string;\n includeServiceFee?: boolean;\n promoCode?: string;\n tipCents?: number;\n};\n\nexport type LockerversePaymentStatus =\n | \"action_required\"\n | \"failed\"\n | \"pending\"\n | \"success\";\n\nexport type LockerversePaymentResult = {\n checkoutId: string;\n paymentReference: string;\n checkoutStatus: LockerversePaymentStatus;\n clientSecret: string | null;\n requiresAction: boolean;\n status: string | null;\n};\n\nexport type LockerversePaymentSubmission = {\n confirmationToken: string;\n customFieldAnswers?: LockerverseCustomFieldAnswer[];\n email: string;\n memberId?: string;\n merchSize?: \"XS\" | \"S\" | \"M\" | \"L\" | \"XL\" | \"XXL\" | \"XXXL\";\n metadata?: Record<string, string>;\n phone?: string;\n};\n\nexport type LockerverseCheckoutItem =\n | { productId: string; quantity: number }\n | { productId: string; amountCents: number };\n\nexport type LockerverseCheckoutSelectionItem =\n | { productSlug: string; quantity: number }\n | { productSlug: string; amountCents: number };\n\nexport type LockerverseBootstrapCheckoutInput =\n LockerverseCheckoutPricingInput & {\n items: LockerverseCheckoutSelectionItem[];\n };\n\nexport type LockerverseCalculateTotalInput = LockerverseCheckoutPricingInput & {\n items: LockerverseCheckoutItem[];\n};\n\nexport type LockerversePreparedCheckout = Readonly<\n LockerverseCheckoutQuote & {\n items: readonly LockerverseCheckoutItem[];\n pricing: Readonly<LockerverseCheckoutPricingInput>;\n }\n>;\n\nexport type LockerverseCheckoutBootstrap = Readonly<{\n catalog: LockerverseCatalog;\n checkout: LockerversePreparedCheckout;\n}>;\n\nexport type LockerverseSubmitPaymentInput = {\n checkout: LockerversePreparedCheckout;\n submission: LockerversePaymentSubmission;\n};\n\ntype CreateLockerverseWidgetBaseOptions = {\n communitySlug: string;\n fetch?: typeof globalThis.fetch;\n onError?: (error: LockerverseSdkError) => void;\n requestTimeoutMs?: number;\n sentryDsn?: string | null;\n widgetSlug: string;\n};\n\nexport type CreateLockerverseWidgetOptions =\n CreateLockerverseWidgetBaseOptions &\n (\n | {\n apiBaseUrl: string;\n environment: LockerverseEnvironment;\n }\n | {\n apiBaseUrl?: undefined;\n environment?: \"production\";\n }\n );\n\nexport type LockerverseCheckoutClient = {\n bootstrapCheckout: (\n input: LockerverseBootstrapCheckoutInput\n ) => Promise<LockerverseCheckoutBootstrap>;\n calculateTotal: (\n input: LockerverseCalculateTotalInput\n ) => Promise<LockerversePreparedCheckout>;\n getPaymentStatus: (\n paymentReference: string\n ) => Promise<LockerversePaymentResult>;\n load: () => Promise<LockerverseCatalog>;\n submitPayment: (\n input: LockerverseSubmitPaymentInput\n ) => Promise<LockerversePaymentResult>;\n};\n"],"mappings":"ACKA,MAAa,EAA0BA,SA4HvC,IAAa,EAAb,cAAyC,KAAM,CAC7C,KACA,UACA,WACA,oBACA,WACA,OAEA,YAAY,CACV,OACA,UACA,YACA,aACA,sBAAsB,GACtB,UAQC,CACD,MAAM,CAAO,EACb,KAAK,KAAO,sBACZ,KAAK,KAAO,EACZ,KAAK,UAAY,EACjB,KAAK,WAAa,EAClB,KAAK,oBAAsB,EAC3B,KAAK,WAAa,EAClB,KAAK,OAAS,CAChB,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lockerverse/sdk",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Lockerverse/lockerverse-sdk.git",