commerce-kit 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.d.ts CHANGED
@@ -26,9 +26,9 @@ declare const configSchema: z.ZodObject<{
26
26
  alt: string;
27
27
  }>;
28
28
  }, "strip", z.ZodTypeAny, {
29
+ description: string;
29
30
  show: boolean;
30
31
  title: string;
31
- description: string;
32
32
  button: {
33
33
  path: string;
34
34
  label: string;
@@ -38,9 +38,9 @@ declare const configSchema: z.ZodObject<{
38
38
  alt: string;
39
39
  };
40
40
  }, {
41
+ description: string;
41
42
  show: boolean;
42
43
  title: string;
43
- description: string;
44
44
  button: {
45
45
  path: string;
46
46
  label: string;
@@ -169,9 +169,9 @@ declare const configSchema: z.ZodObject<{
169
169
  }>>;
170
170
  }, "strip", z.ZodTypeAny, {
171
171
  hero: {
172
+ description: string;
172
173
  show: boolean;
173
174
  title: string;
174
- description: string;
175
175
  button: {
176
176
  path: string;
177
177
  label: string;
@@ -214,9 +214,9 @@ declare const configSchema: z.ZodObject<{
214
214
  }>;
215
215
  }, {
216
216
  hero: {
217
+ description: string;
217
218
  show: boolean;
218
219
  title: string;
219
- description: string;
220
220
  button: {
221
221
  path: string;
222
222
  label: string;
package/dist/index.d.ts CHANGED
@@ -728,6 +728,7 @@ declare const contextGet: () => Promise<{
728
728
  stripeAccount: string | undefined;
729
729
  storeId: string | undefined;
730
730
  secretKey: string | undefined;
731
+ publishableKey: string | undefined;
731
732
  config: Config;
732
733
  }>;
733
734
 
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ function hello() {
23
23
  console.log('Hello world!');
24
24
  }
25
25
  \`\`\`
26
- `}}},e={stripeAccount:void 0,storeId:void 0,secretKey:void 0,config:t},n=await global?.__ynsFindStripeAccount?.();return n?{...n,config:n.config??t}:e};import"server-only";import tt from"stripe";import"server-only";var pt=process.env.STRIPE_SECRET_KEY,Z=process.env.STRIPE_CURRENCY;if(!Z)throw new Error("Missing STRIPE_CURRENCY");var x={StripeSecretKey:pt,StripeCurrency:Z};var b={DEBUG:0,LOG:1,WARN:2,ERROR:3},lt="LOG",mt=process.env.LOG_LEVEL&&process.env.LOG_LEVEL in b?process.env.LOG_LEVEL:lt,A=b[mt],u={time(t){A>b.DEBUG||console.time(t)},timeEnd(t){A>b.DEBUG||console.timeEnd(t)},log(...t){A>b.LOG||console.log(...t)},dir(t,e){A>b.LOG||console.dir(t,e)},warn(...t){A>b.WARN||console.warn(...t)},error(...t){A>b.ERROR||console.error(...t)}};var ft=(t,e)=>!t||!e?t:[...t,`prefix-${e}`,...t.map(n=>`${e}-${n}`)],m=({tags:t,revalidate:e,cache:n,tagPrefix:a,secretKey:i})=>{let r=i??x.StripeSecretKey;if(!r)throw new Error("Missing `secretKey` parameter and `STRIPE_SECRET_KEY` env variable.");u.log(`Using Stripe secret key from ${i?"parameter":"env"}.`);let o=ft(t,a);return new tt(r,{typescript:!0,apiVersion:"2024-06-20",httpClient:tt.createFetchHttpClient((h,d)=>fetch(h,{...d,cache:n??d?.cache,next:{tags:o??d?.next?.tags,revalidate:e??d?.next?.revalidate}})),appInfo:{name:"Commerce SDK",version:"beta",url:"https://yournextstore.com",partner_id:"CONS-003378"}})};var C=t=>t.filter(Boolean),w={accountGetById:{tags:({accountId:t})=>C(["account",t&&`account-${t}`]),revalidate:()=>{}},cartGetById:{tags:({cartId:t})=>C(["cart",`cart-${t}`]),revalidate:()=>{}},createTaxCalculation:{tags:({cartId:t})=>C(["tax-calculations",`tax-calculations-${t}`]),revalidate:()=>{}},fileGetById:{tags:({fileId:t})=>C(["files",`file-${t}`]),revalidate:()=>{}},orderGetById:{tags:({orderId:t})=>C(["order",`order-${t}`]),revalidate:()=>{}},productBrowse:{tags:({category:t})=>C(["product",t&&`category-${t}`]),revalidate:()=>{}},productGetById:{tags:({productId:t})=>C(["product",`product-${t}`]),revalidate:()=>{}},productGetBySlug:{tags:({productSlug:t})=>C(["product",`product-${t}`]),revalidate:()=>{}},shippingBrowse:{tags:()=>C(["shipping"]),revalidate:()=>{}},shippingGetById:{tags:({shippingId:t})=>C(["shipping",`shipping-${t}`]),revalidate:()=>{}},taxDefaultGet:{tags:()=>C(["tax-settings"]),revalidate:()=>{}}};import{neon as gt}from"@neondatabase/serverless";var E;process.env.DATABASE_URL&&(E=gt(process.env.DATABASE_URL));var F=1e3;function se({productId:t,cartId:e}){return e?ht({cartId:e,productId:t,operation:"INCREASE",clearTaxCalculation:!0}):yt({productId:t})}async function ht({productId:t,cartId:e,operation:n,clearTaxCalculation:a}){let[i,r]=await Promise.all([k(t),ot(e)]);if(!i)throw new Error(`Product not found: ${t}`);if(!r)throw new Error(`Cart not found: ${e}`);if(x.StripeCurrency.toLowerCase()!==i.default_price.currency.toLowerCase())throw new Error(`Product currency ${i.default_price.currency} does not match cart currency ${x.StripeCurrency}`);let o=r.cart.metadata??{},d=N(o[t])+(n==="INCREASE"?1:-1);d<=0?o[t]="":o[t]=d.toString();let g=_t(r)+(i.default_price.unit_amount??0);try{return await T({paymentIntentId:e,data:{metadata:o,amount:g||F},clearTaxCalculation:a})}catch(l){u.error(l)}finally{I(`cart-${e}`)}}async function $(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.cartGetById.tags({cartId:t}),cache:"force-cache"});try{let r=await i.paymentIntents.retrieve(t,{expand:["payment_method"]},{stripeAccount:e});if(at.includes(r.status)){let o=Y(r);if(!o)return null;let s=await Q(o.metadata),{metadata:{shippingRateId:h}}=o,d=h&&await L(h);return{cart:o,lines:s.map(({product:g,quantity:l})=>g?{product:g,quantity:l}:null).filter(Boolean),shippingRate:d||null}}}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function yt({productId:t}={}){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,cache:"no-cache"});try{let r=t?await k(t):null;return await i.paymentIntents.create({currency:x.StripeCurrency,amount:r?.default_price.unit_amount||F,automatic_payment_methods:{enabled:!0},metadata:{...r&&{[r.id]:"1"}}},{stripeAccount:e})}catch(r){throw u.error(r),r}}async function ce({cart:t,add:e}){if(!e)return t;let n=await k(e);if(!n)return u.warn(`Product not found: ${e}`),t;let i=(t?.lines.find(o=>o.product.id===e)?t.lines:[...t?.lines??[],{product:n,quantity:0}]).map(o=>o.product.id===e?{...o,quantity:o.quantity+1}:o),r=t?K(t)+(n.default_price.unit_amount??0):n.default_price.unit_amount??0;return{...t,cart:{...t?.cart,amount:r},lines:i}}async function ue({cartId:t,productId:e,quantity:n}){let[a,i]=await Promise.all([nt(e),$(t)]);if(!a)throw new Error(`Product not found: ${e}`);if(!i)throw new Error(`Cart not found: ${t}`);if(x.StripeCurrency?.toLowerCase()!==a.default_price.currency.toLowerCase())throw new Error(`Product currency ${a.default_price.currency} does not match cart currency ${x.StripeCurrency}`);let r=i.cart.metadata??{};n<=0?r[e]="":r[e]=n.toString();let o=K(i)+(a.default_price.unit_amount??0);try{return await T({paymentIntentId:t,data:{metadata:r,amount:o||F}})}catch(s){u.error(s)}finally{I(`cart-${t}`),et("/cart"),et("/cart-overlay")}}async function nt(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.productGetById.tags({productId:t}),cache:"force-cache"});try{let r=await i.products.retrieve(t,{expand:["default_price"]},{stripeAccount:e});return G(r)}catch(r){if(r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function de({slug:t}){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),r=await m({secretKey:a,tagPrefix:n,tags:w.productGetBySlug.tags({productSlug:t}),cache:"force-cache"}).products.search({query:j({active:!0,'metadata["slug"]':t}),expand:["data.default_price"]},{stripeAccount:e});if(r.data.length>1&&r.data.some(o=>!o.metadata.variant))throw new Error(`Multiple products found with the same slug (${t}) but no variant set.`);return q(M(r).filter(W))}async function xt(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p();if(t.filter?.category){let i=t.filter?.category,o=await m({secretKey:a,tagPrefix:n,tags:w.productBrowse.tags({category:i}),cache:"force-cache"}).products.search({limit:100,query:j({active:!0,'metadata["category"]':i}),expand:["data.default_price"]},{stripeAccount:e});return q(D(M(o)).filter(W).slice(t.offset,t.first))}else{let r=await m({secretKey:a,tagPrefix:n,tags:w.productBrowse.tags({}),cache:"force-cache"}).products.list({limit:100,active:!0,expand:["data.default_price"]},{stripeAccount:e});return q(D(M(r)).filter(W).slice(t.offset,t.first))}}async function pe(){let{stripeAccount:t,storeId:e,secretKey:n}=await p(),i=await m({secretKey:n,tagPrefix:e,tags:w.shippingBrowse.tags(),cache:"force-cache"}).shippingRates.list({active:!0},{stripeAccount:t});return z(i)}async function L(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.shippingGetById.tags({shippingId:t}),cache:"force-cache"});try{let r=await i.shippingRates.retrieve(t,{},{stripeAccount:e});return r}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function le(){let e=(await xt({first:100})).map(a=>a.metadata.category).filter(Boolean),n=new Set(e);return Array.from(n)}async function me(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.fileGetById.tags({fileId:t}),cache:"force-cache"});try{return await i.fileLinks.create({file:t},{stripeAccount:e})}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function fe(){let{stripeAccount:t,storeId:e,secretKey:n}=await p(),a=m({secretKey:n,tagPrefix:e,tags:w.accountGetById.tags({}),cache:"force-cache"});try{let[i,r]=await V(a.accounts.retrieve({expand:["settings.branding.logo"]},{stripeAccount:t})),o=r?.settings?.branding.logo??null;return!o||typeof o=="string"?{account:r,logo:null}:{account:r,logo:o}}catch(i){if(u.error(i),i instanceof v.errors.StripeError&&i.code==="resource_missing")return null;throw i}}async function wt(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.orderGetById.tags({orderId:t}),cache:"force-cache"});try{let r=await i.paymentIntents.retrieve(t,{expand:["payment_method","latest_charge"]},{stripeAccount:e});return X(r)}catch(r){if(r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function ge(t){let e=await wt(t);if(!e)return null;let n=it(e.metadata),a=await Promise.all(n.map(async([o,s])=>({product:await k(o),quantity:s}))),{metadata:{shippingRateId:i}}=e,r=i&&await L(i);return{order:e,lines:a.map(({product:o,quantity:s})=>o?{product:o,quantity:s}:null).filter(Boolean),shippingRate:r||null}}var k=async t=>{let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.productGetById.tags({productId:t}),cache:"force-cache"});try{let r=await i.products.retrieve(t,{expand:["default_price"]},{stripeAccount:e});return G(r)}catch(r){if(r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}},at=["requires_action","requires_confirmation","requires_capture","requires_payment_method"],it=t=>Object.entries(t??{}).filter(([e])=>e.startsWith("prod_")).map(([e,n])=>[e,N(n)]).filter(([,e])=>e&&Number.isFinite(e)&&e>0),Ct=async t=>{let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.cartGetById.tags({cartId:t}),cache:"force-cache"});try{let r=await i.paymentIntents.retrieve(t,{expand:["payment_method"]},{stripeAccount:e});if(at.includes(r.status))return Y(r)}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}};async function Q(t){let e=it(t);return await Promise.all(e.map(async([a,i])=>({product:await k(a),quantity:i})))}var ot=async t=>{let e=await Ct(t);if(!e)return null;let n=await Q(e.metadata),{metadata:{shippingRateId:a}}=e,i=a&&await L(a);return{cart:e,lines:n.map(({product:r,quantity:o})=>r?{product:r,quantity:o}:null).filter(Boolean),shippingRate:i||null}},_t=t=>t?t.cart.metadata?.taxCalculationId?t.cart.amount:(t.shippingRate?.fixed_amount?.amount??0)+t.lines.reduce((e,{product:n,quantity:a})=>e+(n.default_price?.unit_amount??0)*a,0):0,St=["billingAddress.country","billingAddress.postalCode","billingAddress.state","taxId","shippingRateId"];function bt({oldCart:t,data:e,mergedMetadata:n,lines:a}){if(!process.env.ENABLE_STRIPE_TAX)return!1;let i=Date.now(),r=n.taxCalculationExp?Number.parseInt(n.taxCalculationExp)*1e3:null;if(!r||i>=r)return!0;let o=t.cart.metadata.netAmount||t.cart.amount,s=e.amount,h=St.some(y=>!n[y]&&!t.cart.metadata[y]?!1:n[y]!==t.cart.metadata[y]),d=a.length!==t.lines.length||a.some(y=>{let R=t.lines.find(f=>f.product.id===y.product?.id);return y.product?.default_price.unit_amount!==R?.product.default_price.unit_amount||y.quantity!==R?.quantity});return s&&o!==s||h||d}var he=t=>_.object({name:_.string({required_error:t.nameRequired}).min(1,t.nameRequired),city:_.string({required_error:t.cityRequired}).min(1,t.cityRequired),country:_.string({required_error:t.countryRequired}).min(1,t.countryRequired),line1:_.string({required_error:t.line1Required}).min(1,t.line1Required),line2:_.string().optional().nullable().default(""),postalCode:_.string({required_error:t.postalCodeRequired}).min(1,t.postalCodeRequired),state:_.string().optional().nullable().default(""),phone:_.string().optional().nullable().default(""),taxId:_.string().optional().nullable().default("")}),vt=async({lineItems:t,billingAddress:e,cartId:n,shippingRateId:a,taxId:i})=>{if(!process.env.ENABLE_STRIPE_TAX)return null;let{stripeAccount:r,storeId:o,secretKey:s}=await p(),h=m({secretKey:s,tagPrefix:o,tags:w.createTaxCalculation.tags({cartId:n}),cache:"force-cache"});if(!e?.country)return null;let d=a?await L(a):null,g=typeof d?.tax_code=="string"?d.tax_code:d?.tax_code?.id,l=await Pt(),y=x.StripeCurrency==="usd"||x.StripeCurrency==="cad"?"exclusive":"inclusive",R=l.defaults.tax_behavior==="inferred_by_currency"?y:l.defaults.tax_behavior??y;l.defaults.tax_behavior||u.warn(`Tax behavior not set in Stripe settings. Inferring from currency ${x.StripeCurrency}: ${y}.`),u.time("createTaxCalculation ${cartId}");let f=await h.tax.calculations.create({expand:["line_items"],line_items:t.map(P=>({...P,tax_behavior:P.tax_behavior??R})),currency:x.StripeCurrency,shipping_cost:d?.active&&d?.fixed_amount?{amount:d.fixed_amount.amount,tax_behavior:d.tax_behavior==="inclusive"?"inclusive":d.tax_behavior==="exclusive"?"exclusive":R,tax_code:g??l.defaults.tax_code??void 0}:void 0,customer_details:{tax_ids:i?[{type:"eu_vat",value:i}]:void 0,address_source:"billing",address:{country:e.country,city:e?.city,line1:e?.line1,line2:e?.line2,postal_code:e?.postalCode,state:e?.state}}},{stripeAccount:r});return u.timeEnd("createTaxCalculation ${cartId}"),f},rt={taxBreakdown0:"",taxBreakdown1:"",taxBreakdown2:"",taxBreakdown3:"",taxBreakdown4:"",taxBreakdown5:""},T=async({paymentIntentId:t,data:e,clearTaxCalculation:n})=>{let{stripeAccount:a,storeId:i,secretKey:r}=await p(),o=await ot(t);S(o,`Cart not found: ${t}`);let s=O.parse({...o.cart.metadata,...e.metadata});u.time("getProductsFromMetadata");let h=await Q(s);u.timeEnd("getProductsFromMetadata");let g=!n&&bt({oldCart:o,data:e,mergedMetadata:s,lines:h})?await vt({cartId:t,taxId:s.taxId??null,shippingRateId:s.shippingRateId??null,billingAddress:{country:s["billingAddress.country"]??"",city:s["billingAddress.city"]??"",line1:s["billingAddress.line1"]??"",line2:s["billingAddress.line2"]??"",name:s["billingAddress.name"]??"",postalCode:s["billingAddress.postalCode"]??"",state:s["billingAddress.state"]??""},lineItems:h.map(({product:f,quantity:P})=>{if(f?.default_price.unit_amount)return{product:f.id,reference:[f.metadata.slug,f.metadata.variant].filter(Boolean).join("-"),quantity:P,amount:f.default_price.unit_amount*P,tax_behavior:f.default_price.tax_behavior==="exclusive"?"exclusive":f.default_price.tax_behavior==="inclusive"?"inclusive":void 0,tax_code:f.tax_code?typeof f.tax_code=="string"?f.tax_code:f.tax_code.id:void 0}}).filter(Boolean)}):null,l=e.amount?e.amount.toString():null;if(g){let f=Object.fromEntries(g.tax_breakdown.map(B=>({taxType:B.tax_rate_details.tax_type,taxPercentage:B.tax_rate_details.percentage_decimal,taxAmount:B.amount})).map((B,ct)=>[`taxBreakdown${ct}`,JSON.stringify(B)])),P=m({secretKey:r,tagPrefix:i,cache:"no-cache"});u.time(`paymentIntents.update ${t}`);let st=await P.paymentIntents.update(t,{...e,amount:g.amount_total,metadata:{...s,...l&&{netAmount:l},...rt,...f,taxCalculationId:g.id,taxCalculationExp:g?.expires_at}},{stripeAccount:a});return u.timeEnd(`paymentIntents.update ${t}`),st}let y=m({secretKey:r,tagPrefix:i,cache:"no-cache"});u.time(`paymentIntents.update ${t}`);let R=await y.paymentIntents.update(t,{...e,metadata:{...s,...l&&{netAmount:l},...n&&{...rt,taxCalculationId:"",taxCalculationExp:""}}},{stripeAccount:a});return u.timeEnd(`paymentIntents.update ${t}`),R},K=t=>t?t.cart.metadata?.taxCalculationId?t.cart.amount:(t.shippingRate?.fixed_amount?.amount??0)+Rt(t):0,Rt=t=>t?t.lines.reduce((e,{product:n,quantity:a})=>e+(n.default_price?.unit_amount??0)*a,0):0;async function ye({productId:t,cartId:e,operation:n,clearTaxCalculation:a}){let[i,r]=await Promise.all([nt(t),$(e)]);if(!i)throw new Error(`Product not found: ${t}`);if(!r)throw new Error(`Cart not found: ${e}`);if(x.StripeCurrency?.toLowerCase()!==i.default_price.currency.toLowerCase())throw new Error(`Product currency ${i.default_price.currency} does not match cart currency ${x.StripeCurrency}`);let o=r.cart.metadata??{},d=N(o[t])+(n==="INCREASE"?1:-1);d<=0?o[t]="":o[t]=d.toString();let g=K(r)+(i.default_price.unit_amount??0);try{return await T({paymentIntentId:e,data:{metadata:o,amount:g||F},clearTaxCalculation:a})}catch(l){u.error(l)}finally{I(`cart-${e}`)}}var xe=async({cartId:t,taxId:e})=>{let n=await $(t);if(!n)throw new Error(`Cart not found: ${t}`);try{return await T({paymentIntentId:t,data:{metadata:{...n.cart.metadata,taxId:e}}})}catch(a){u.error(a)}finally{I(`cart-${t}`)}};async function we({cartId:t,shippingRateId:e}){let n=await $(t);if(!n)throw new Error(`Cart not found: ${t}`);u.time(`cartSaveShipping ${t}`);let a=await L(e);if(u.timeEnd(`cartSaveShipping ${t}`),!a)throw new Error(`Shipping rate not found: ${e}`);try{u.time(`updatePaymentIntent ${t}`);let i=await T({paymentIntentId:t,data:{metadata:{...n.cart.metadata,shippingRateId:e},amount:K({...n,shippingRate:a})}});return u.timeEnd(`updatePaymentIntent ${t}`),i}catch(i){u.error(i)}finally{I(`cart-${t}`)}}async function Ce({cartId:t,billingAddress:e}){if(!await $(t))throw new Error(`Cart not found: ${t}`);try{return await T({paymentIntentId:t,data:{metadata:{"billingAddress.name":e.name,"billingAddress.phone":e.phone,"billingAddress.city":e.city,"billingAddress.country":e.country,"billingAddress.line1":e.line1,"billingAddress.line2":e.line2??"","billingAddress.postalCode":e.postalCode,"billingAddress.state":e.state??""}}})}catch(a){u.error(a)}finally{I(`cart-${t}`)}}async function Pt(){let{stripeAccount:t,storeId:e,secretKey:n}=await p();return await m({secretKey:n,tagPrefix:e,tags:["tax-settings"],cache:"force-cache"}).tax.settings.retrieve({},{stripeAccount:t})}function _e(t){return Object.entries(t??{}).filter(([e])=>e.startsWith("prod_")).map(([e,n])=>[e,N(n)]).filter(([,e])=>e&&Number.isFinite(e)&&e>0).length}async function Se(t){if(!E)return null;let{storeId:e}=await p();return await E`
26
+ `}}},e={stripeAccount:void 0,storeId:void 0,secretKey:void 0,publishableKey:void 0,config:t},n=await global?.__ynsFindStripeAccount?.();return n?{...n,config:n.config??t}:e};import"server-only";import tt from"stripe";import"server-only";var pt=process.env.STRIPE_SECRET_KEY,Z=process.env.STRIPE_CURRENCY;if(!Z)throw new Error("Missing STRIPE_CURRENCY");var x={StripeSecretKey:pt,StripeCurrency:Z};var b={DEBUG:0,LOG:1,WARN:2,ERROR:3},lt="LOG",mt=process.env.LOG_LEVEL&&process.env.LOG_LEVEL in b?process.env.LOG_LEVEL:lt,A=b[mt],u={time(t){A>b.DEBUG||console.time(t)},timeEnd(t){A>b.DEBUG||console.timeEnd(t)},log(...t){A>b.LOG||console.log(...t)},dir(t,e){A>b.LOG||console.dir(t,e)},warn(...t){A>b.WARN||console.warn(...t)},error(...t){A>b.ERROR||console.error(...t)}};var ft=(t,e)=>!t||!e?t:[...t,`prefix-${e}`,...t.map(n=>`${e}-${n}`)],m=({tags:t,revalidate:e,cache:n,tagPrefix:a,secretKey:i})=>{let r=i??x.StripeSecretKey;if(!r)throw new Error("Missing `secretKey` parameter and `STRIPE_SECRET_KEY` env variable.");u.log(`Using Stripe secret key from ${i?"parameter":"env"}.`);let o=ft(t,a);return new tt(r,{typescript:!0,apiVersion:"2024-06-20",httpClient:tt.createFetchHttpClient((h,d)=>fetch(h,{...d,cache:n??d?.cache,next:{tags:o??d?.next?.tags,revalidate:e??d?.next?.revalidate}})),appInfo:{name:"Commerce SDK",version:"beta",url:"https://yournextstore.com",partner_id:"CONS-003378"}})};var C=t=>t.filter(Boolean),w={accountGetById:{tags:({accountId:t})=>C(["account",t&&`account-${t}`]),revalidate:()=>{}},cartGetById:{tags:({cartId:t})=>C(["cart",`cart-${t}`]),revalidate:()=>{}},createTaxCalculation:{tags:({cartId:t})=>C(["tax-calculations",`tax-calculations-${t}`]),revalidate:()=>{}},fileGetById:{tags:({fileId:t})=>C(["files",`file-${t}`]),revalidate:()=>{}},orderGetById:{tags:({orderId:t})=>C(["order",`order-${t}`]),revalidate:()=>{}},productBrowse:{tags:({category:t})=>C(["product",t&&`category-${t}`]),revalidate:()=>{}},productGetById:{tags:({productId:t})=>C(["product",`product-${t}`]),revalidate:()=>{}},productGetBySlug:{tags:({productSlug:t})=>C(["product",`product-${t}`]),revalidate:()=>{}},shippingBrowse:{tags:()=>C(["shipping"]),revalidate:()=>{}},shippingGetById:{tags:({shippingId:t})=>C(["shipping",`shipping-${t}`]),revalidate:()=>{}},taxDefaultGet:{tags:()=>C(["tax-settings"]),revalidate:()=>{}}};import{neon as gt}from"@neondatabase/serverless";var E;process.env.DATABASE_URL&&(E=gt(process.env.DATABASE_URL));var K=1e3;function se({productId:t,cartId:e}){return e?ht({cartId:e,productId:t,operation:"INCREASE",clearTaxCalculation:!0}):yt({productId:t})}async function ht({productId:t,cartId:e,operation:n,clearTaxCalculation:a}){let[i,r]=await Promise.all([k(t),ot(e)]);if(!i)throw new Error(`Product not found: ${t}`);if(!r)throw new Error(`Cart not found: ${e}`);if(x.StripeCurrency.toLowerCase()!==i.default_price.currency.toLowerCase())throw new Error(`Product currency ${i.default_price.currency} does not match cart currency ${x.StripeCurrency}`);let o=r.cart.metadata??{},d=N(o[t])+(n==="INCREASE"?1:-1);d<=0?o[t]="":o[t]=d.toString();let g=_t(r)+(i.default_price.unit_amount??0);try{return await T({paymentIntentId:e,data:{metadata:o,amount:g||K},clearTaxCalculation:a})}catch(l){u.error(l)}finally{I(`cart-${e}`)}}async function $(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.cartGetById.tags({cartId:t}),cache:"force-cache"});try{let r=await i.paymentIntents.retrieve(t,{expand:["payment_method"]},{stripeAccount:e});if(at.includes(r.status)){let o=Y(r);if(!o)return null;let s=await Q(o.metadata),{metadata:{shippingRateId:h}}=o,d=h&&await L(h);return{cart:o,lines:s.map(({product:g,quantity:l})=>g?{product:g,quantity:l}:null).filter(Boolean),shippingRate:d||null}}}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function yt({productId:t}={}){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,cache:"no-cache"});try{let r=t?await k(t):null;return await i.paymentIntents.create({currency:x.StripeCurrency,amount:r?.default_price.unit_amount||K,automatic_payment_methods:{enabled:!0},metadata:{...r&&{[r.id]:"1"}}},{stripeAccount:e})}catch(r){throw u.error(r),r}}async function ce({cart:t,add:e}){if(!e)return t;let n=await k(e);if(!n)return u.warn(`Product not found: ${e}`),t;let i=(t?.lines.find(o=>o.product.id===e)?t.lines:[...t?.lines??[],{product:n,quantity:0}]).map(o=>o.product.id===e?{...o,quantity:o.quantity+1}:o),r=t?F(t)+(n.default_price.unit_amount??0):n.default_price.unit_amount??0;return{...t,cart:{...t?.cart,amount:r},lines:i}}async function ue({cartId:t,productId:e,quantity:n}){let[a,i]=await Promise.all([nt(e),$(t)]);if(!a)throw new Error(`Product not found: ${e}`);if(!i)throw new Error(`Cart not found: ${t}`);if(x.StripeCurrency?.toLowerCase()!==a.default_price.currency.toLowerCase())throw new Error(`Product currency ${a.default_price.currency} does not match cart currency ${x.StripeCurrency}`);let r=i.cart.metadata??{};n<=0?r[e]="":r[e]=n.toString();let o=F(i)+(a.default_price.unit_amount??0);try{return await T({paymentIntentId:t,data:{metadata:r,amount:o||K}})}catch(s){u.error(s)}finally{I(`cart-${t}`),et("/cart"),et("/cart-overlay")}}async function nt(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.productGetById.tags({productId:t}),cache:"force-cache"});try{let r=await i.products.retrieve(t,{expand:["default_price"]},{stripeAccount:e});return G(r)}catch(r){if(r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function de({slug:t}){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),r=await m({secretKey:a,tagPrefix:n,tags:w.productGetBySlug.tags({productSlug:t}),cache:"force-cache"}).products.search({query:j({active:!0,'metadata["slug"]':t}),expand:["data.default_price"]},{stripeAccount:e});if(r.data.length>1&&r.data.some(o=>!o.metadata.variant))throw new Error(`Multiple products found with the same slug (${t}) but no variant set.`);return q(M(r).filter(W))}async function xt(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p();if(t.filter?.category){let i=t.filter?.category,o=await m({secretKey:a,tagPrefix:n,tags:w.productBrowse.tags({category:i}),cache:"force-cache"}).products.search({limit:100,query:j({active:!0,'metadata["category"]':i}),expand:["data.default_price"]},{stripeAccount:e});return q(D(M(o)).filter(W).slice(t.offset,t.first))}else{let r=await m({secretKey:a,tagPrefix:n,tags:w.productBrowse.tags({}),cache:"force-cache"}).products.list({limit:100,active:!0,expand:["data.default_price"]},{stripeAccount:e});return q(D(M(r)).filter(W).slice(t.offset,t.first))}}async function pe(){let{stripeAccount:t,storeId:e,secretKey:n}=await p(),i=await m({secretKey:n,tagPrefix:e,tags:w.shippingBrowse.tags(),cache:"force-cache"}).shippingRates.list({active:!0},{stripeAccount:t});return z(i)}async function L(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.shippingGetById.tags({shippingId:t}),cache:"force-cache"});try{let r=await i.shippingRates.retrieve(t,{},{stripeAccount:e});return r}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function le(){let e=(await xt({first:100})).map(a=>a.metadata.category).filter(Boolean),n=new Set(e);return Array.from(n)}async function me(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.fileGetById.tags({fileId:t}),cache:"force-cache"});try{return await i.fileLinks.create({file:t},{stripeAccount:e})}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function fe(){let{stripeAccount:t,storeId:e,secretKey:n}=await p(),a=m({secretKey:n,tagPrefix:e,tags:w.accountGetById.tags({}),cache:"force-cache"});try{let[i,r]=await V(a.accounts.retrieve({expand:["settings.branding.logo"]},{stripeAccount:t})),o=r?.settings?.branding.logo??null;return!o||typeof o=="string"?{account:r,logo:null}:{account:r,logo:o}}catch(i){if(u.error(i),i instanceof v.errors.StripeError&&i.code==="resource_missing")return null;throw i}}async function wt(t){let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.orderGetById.tags({orderId:t}),cache:"force-cache"});try{let r=await i.paymentIntents.retrieve(t,{expand:["payment_method","latest_charge"]},{stripeAccount:e});return X(r)}catch(r){if(r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}}async function ge(t){let e=await wt(t);if(!e)return null;let n=it(e.metadata),a=await Promise.all(n.map(async([o,s])=>({product:await k(o),quantity:s}))),{metadata:{shippingRateId:i}}=e,r=i&&await L(i);return{order:e,lines:a.map(({product:o,quantity:s})=>o?{product:o,quantity:s}:null).filter(Boolean),shippingRate:r||null}}var k=async t=>{let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.productGetById.tags({productId:t}),cache:"force-cache"});try{let r=await i.products.retrieve(t,{expand:["default_price"]},{stripeAccount:e});return G(r)}catch(r){if(r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}},at=["requires_action","requires_confirmation","requires_capture","requires_payment_method"],it=t=>Object.entries(t??{}).filter(([e])=>e.startsWith("prod_")).map(([e,n])=>[e,N(n)]).filter(([,e])=>e&&Number.isFinite(e)&&e>0),Ct=async t=>{let{stripeAccount:e,storeId:n,secretKey:a}=await p(),i=m({secretKey:a,tagPrefix:n,tags:w.cartGetById.tags({cartId:t}),cache:"force-cache"});try{let r=await i.paymentIntents.retrieve(t,{expand:["payment_method"]},{stripeAccount:e});if(at.includes(r.status))return Y(r)}catch(r){if(u.error(r),r instanceof v.errors.StripeError&&r.code==="resource_missing")return null;throw r}};async function Q(t){let e=it(t);return await Promise.all(e.map(async([a,i])=>({product:await k(a),quantity:i})))}var ot=async t=>{let e=await Ct(t);if(!e)return null;let n=await Q(e.metadata),{metadata:{shippingRateId:a}}=e,i=a&&await L(a);return{cart:e,lines:n.map(({product:r,quantity:o})=>r?{product:r,quantity:o}:null).filter(Boolean),shippingRate:i||null}},_t=t=>t?t.cart.metadata?.taxCalculationId?t.cart.amount:(t.shippingRate?.fixed_amount?.amount??0)+t.lines.reduce((e,{product:n,quantity:a})=>e+(n.default_price?.unit_amount??0)*a,0):0,St=["billingAddress.country","billingAddress.postalCode","billingAddress.state","taxId","shippingRateId"];function bt({oldCart:t,data:e,mergedMetadata:n,lines:a}){if(!process.env.ENABLE_STRIPE_TAX)return!1;let i=Date.now(),r=n.taxCalculationExp?Number.parseInt(n.taxCalculationExp)*1e3:null;if(!r||i>=r)return!0;let o=t.cart.metadata.netAmount||t.cart.amount,s=e.amount,h=St.some(y=>!n[y]&&!t.cart.metadata[y]?!1:n[y]!==t.cart.metadata[y]),d=a.length!==t.lines.length||a.some(y=>{let R=t.lines.find(f=>f.product.id===y.product?.id);return y.product?.default_price.unit_amount!==R?.product.default_price.unit_amount||y.quantity!==R?.quantity});return s&&o!==s||h||d}var he=t=>_.object({name:_.string({required_error:t.nameRequired}).min(1,t.nameRequired),city:_.string({required_error:t.cityRequired}).min(1,t.cityRequired),country:_.string({required_error:t.countryRequired}).min(1,t.countryRequired),line1:_.string({required_error:t.line1Required}).min(1,t.line1Required),line2:_.string().optional().nullable().default(""),postalCode:_.string({required_error:t.postalCodeRequired}).min(1,t.postalCodeRequired),state:_.string().optional().nullable().default(""),phone:_.string().optional().nullable().default(""),taxId:_.string().optional().nullable().default("")}),vt=async({lineItems:t,billingAddress:e,cartId:n,shippingRateId:a,taxId:i})=>{if(!process.env.ENABLE_STRIPE_TAX)return null;let{stripeAccount:r,storeId:o,secretKey:s}=await p(),h=m({secretKey:s,tagPrefix:o,tags:w.createTaxCalculation.tags({cartId:n}),cache:"force-cache"});if(!e?.country)return null;let d=a?await L(a):null,g=typeof d?.tax_code=="string"?d.tax_code:d?.tax_code?.id,l=await Pt(),y=x.StripeCurrency==="usd"||x.StripeCurrency==="cad"?"exclusive":"inclusive",R=l.defaults.tax_behavior==="inferred_by_currency"?y:l.defaults.tax_behavior??y;l.defaults.tax_behavior||u.warn(`Tax behavior not set in Stripe settings. Inferring from currency ${x.StripeCurrency}: ${y}.`),u.time("createTaxCalculation ${cartId}");let f=await h.tax.calculations.create({expand:["line_items"],line_items:t.map(P=>({...P,tax_behavior:P.tax_behavior??R})),currency:x.StripeCurrency,shipping_cost:d?.active&&d?.fixed_amount?{amount:d.fixed_amount.amount,tax_behavior:d.tax_behavior==="inclusive"?"inclusive":d.tax_behavior==="exclusive"?"exclusive":R,tax_code:g??l.defaults.tax_code??void 0}:void 0,customer_details:{tax_ids:i?[{type:"eu_vat",value:i}]:void 0,address_source:"billing",address:{country:e.country,city:e?.city,line1:e?.line1,line2:e?.line2,postal_code:e?.postalCode,state:e?.state}}},{stripeAccount:r});return u.timeEnd("createTaxCalculation ${cartId}"),f},rt={taxBreakdown0:"",taxBreakdown1:"",taxBreakdown2:"",taxBreakdown3:"",taxBreakdown4:"",taxBreakdown5:""},T=async({paymentIntentId:t,data:e,clearTaxCalculation:n})=>{let{stripeAccount:a,storeId:i,secretKey:r}=await p(),o=await ot(t);S(o,`Cart not found: ${t}`);let s=O.parse({...o.cart.metadata,...e.metadata});u.time("getProductsFromMetadata");let h=await Q(s);u.timeEnd("getProductsFromMetadata");let g=!n&&bt({oldCart:o,data:e,mergedMetadata:s,lines:h})?await vt({cartId:t,taxId:s.taxId??null,shippingRateId:s.shippingRateId??null,billingAddress:{country:s["billingAddress.country"]??"",city:s["billingAddress.city"]??"",line1:s["billingAddress.line1"]??"",line2:s["billingAddress.line2"]??"",name:s["billingAddress.name"]??"",postalCode:s["billingAddress.postalCode"]??"",state:s["billingAddress.state"]??""},lineItems:h.map(({product:f,quantity:P})=>{if(f?.default_price.unit_amount)return{product:f.id,reference:[f.metadata.slug,f.metadata.variant].filter(Boolean).join("-"),quantity:P,amount:f.default_price.unit_amount*P,tax_behavior:f.default_price.tax_behavior==="exclusive"?"exclusive":f.default_price.tax_behavior==="inclusive"?"inclusive":void 0,tax_code:f.tax_code?typeof f.tax_code=="string"?f.tax_code:f.tax_code.id:void 0}}).filter(Boolean)}):null,l=e.amount?e.amount.toString():null;if(g){let f=Object.fromEntries(g.tax_breakdown.map(B=>({taxType:B.tax_rate_details.tax_type,taxPercentage:B.tax_rate_details.percentage_decimal,taxAmount:B.amount})).map((B,ct)=>[`taxBreakdown${ct}`,JSON.stringify(B)])),P=m({secretKey:r,tagPrefix:i,cache:"no-cache"});u.time(`paymentIntents.update ${t}`);let st=await P.paymentIntents.update(t,{...e,amount:g.amount_total,metadata:{...s,...l&&{netAmount:l},...rt,...f,taxCalculationId:g.id,taxCalculationExp:g?.expires_at}},{stripeAccount:a});return u.timeEnd(`paymentIntents.update ${t}`),st}let y=m({secretKey:r,tagPrefix:i,cache:"no-cache"});u.time(`paymentIntents.update ${t}`);let R=await y.paymentIntents.update(t,{...e,metadata:{...s,...l&&{netAmount:l},...n&&{...rt,taxCalculationId:"",taxCalculationExp:""}}},{stripeAccount:a});return u.timeEnd(`paymentIntents.update ${t}`),R},F=t=>t?t.cart.metadata?.taxCalculationId?t.cart.amount:(t.shippingRate?.fixed_amount?.amount??0)+Rt(t):0,Rt=t=>t?t.lines.reduce((e,{product:n,quantity:a})=>e+(n.default_price?.unit_amount??0)*a,0):0;async function ye({productId:t,cartId:e,operation:n,clearTaxCalculation:a}){let[i,r]=await Promise.all([nt(t),$(e)]);if(!i)throw new Error(`Product not found: ${t}`);if(!r)throw new Error(`Cart not found: ${e}`);if(x.StripeCurrency?.toLowerCase()!==i.default_price.currency.toLowerCase())throw new Error(`Product currency ${i.default_price.currency} does not match cart currency ${x.StripeCurrency}`);let o=r.cart.metadata??{},d=N(o[t])+(n==="INCREASE"?1:-1);d<=0?o[t]="":o[t]=d.toString();let g=F(r)+(i.default_price.unit_amount??0);try{return await T({paymentIntentId:e,data:{metadata:o,amount:g||K},clearTaxCalculation:a})}catch(l){u.error(l)}finally{I(`cart-${e}`)}}var xe=async({cartId:t,taxId:e})=>{let n=await $(t);if(!n)throw new Error(`Cart not found: ${t}`);try{return await T({paymentIntentId:t,data:{metadata:{...n.cart.metadata,taxId:e}}})}catch(a){u.error(a)}finally{I(`cart-${t}`)}};async function we({cartId:t,shippingRateId:e}){let n=await $(t);if(!n)throw new Error(`Cart not found: ${t}`);u.time(`cartSaveShipping ${t}`);let a=await L(e);if(u.timeEnd(`cartSaveShipping ${t}`),!a)throw new Error(`Shipping rate not found: ${e}`);try{u.time(`updatePaymentIntent ${t}`);let i=await T({paymentIntentId:t,data:{metadata:{...n.cart.metadata,shippingRateId:e},amount:F({...n,shippingRate:a})}});return u.timeEnd(`updatePaymentIntent ${t}`),i}catch(i){u.error(i)}finally{I(`cart-${t}`)}}async function Ce({cartId:t,billingAddress:e}){if(!await $(t))throw new Error(`Cart not found: ${t}`);try{return await T({paymentIntentId:t,data:{metadata:{"billingAddress.name":e.name,"billingAddress.phone":e.phone,"billingAddress.city":e.city,"billingAddress.country":e.country,"billingAddress.line1":e.line1,"billingAddress.line2":e.line2??"","billingAddress.postalCode":e.postalCode,"billingAddress.state":e.state??""}}})}catch(a){u.error(a)}finally{I(`cart-${t}`)}}async function Pt(){let{stripeAccount:t,storeId:e,secretKey:n}=await p();return await m({secretKey:n,tagPrefix:e,tags:["tax-settings"],cache:"force-cache"}).tax.settings.retrieve({},{stripeAccount:t})}function _e(t){return Object.entries(t??{}).filter(([e])=>e.startsWith("prod_")).map(([e,n])=>[e,N(n)]).filter(([,e])=>e&&Number.isFinite(e)&&e>0).length}async function Se(t){if(!E)return null;let{storeId:e}=await p();return await E`
27
27
  select * from reviews
28
28
  where product_id = ${t.productId} and store_id = ${e}
29
29
  order by created_at desc
@@ -32,4 +32,4 @@ function hello() {
32
32
  `}async function be(t){if(!E)return null;let{storeId:e}=await p();return await E`
33
33
  insert into reviews (store_id, product_id, author, email, content, rating, created_at, updated_at)
34
34
  values (${e}, ${t.productId}, ${t.author}, ${t.email}, ${t.content}, ${t.rating}, now(), now())
35
- `}var ve=p;export{fe as accountGet,_t as calculateCartTotalNet,Rt as calculateCartTotalNetWithoutShipping,K as calculateCartTotalPossiblyWithTax,se as cartAdd,ce as cartAddOptimistic,ye as cartChangeQuantity,_e as cartCount,yt as cartCreate,$ as cartGet,Ce as cartSaveBillingAddress,we as cartSaveShipping,xe as cartSaveTax,ue as cartSetQuantity,ht as cartUpdateQuantity,le as categoryBrowse,ve as contextGet,me as fileGet,he as getAddressSchema,ot as getCartWithProductsById,it as getProductsFromCart,ge as orderGet,xt as productBrowse,de as productGet,nt as productGetById,be as productReviewAdd,Se as productReviewBrowse,m as provider,pe as shippingBrowse,L as shippingGet,Pt as taxDefaultGet};
35
+ `}var ve=p;export{fe as accountGet,_t as calculateCartTotalNet,Rt as calculateCartTotalNetWithoutShipping,F as calculateCartTotalPossiblyWithTax,se as cartAdd,ce as cartAddOptimistic,ye as cartChangeQuantity,_e as cartCount,yt as cartCreate,$ as cartGet,Ce as cartSaveBillingAddress,we as cartSaveShipping,xe as cartSaveTax,ue as cartSetQuantity,ht as cartUpdateQuantity,le as categoryBrowse,ve as contextGet,me as fileGet,he as getAddressSchema,ot as getCartWithProductsById,it as getProductsFromCart,ge as orderGet,xt as productBrowse,de as productGet,nt as productGetById,be as productReviewAdd,Se as productReviewBrowse,m as provider,pe as shippingBrowse,L as shippingGet,Pt as taxDefaultGet};
package/dist/yns.d.ts CHANGED
@@ -5,12 +5,14 @@ type YnsFindStripeAccountResult = {
5
5
  stripeAccount: string | undefined;
6
6
  storeId: string | undefined;
7
7
  secretKey: string | undefined;
8
+ publishableKey: string | undefined;
8
9
  config: Config | undefined;
9
10
  };
10
11
  type YnsContextResult = {
11
12
  stripeAccount: string | undefined;
12
13
  storeId: string | undefined;
13
14
  secretKey: string | undefined;
15
+ publishableKey: string | undefined;
14
16
  config: Config;
15
17
  };
16
18
  declare global {
package/dist/yns.js CHANGED
@@ -23,4 +23,4 @@ function hello() {
23
23
  console.log('Hello world!');
24
24
  }
25
25
  \`\`\`
26
- `}}},n={stripeAccount:void 0,storeId:void 0,secretKey:void 0,config:t},e=await global?.__ynsFindStripeAccount?.();return e?{...e,config:e.config??t}:n};export{o as getYnsContext};
26
+ `}}},n={stripeAccount:void 0,storeId:void 0,secretKey:void 0,publishableKey:void 0,config:t},e=await global?.__ynsFindStripeAccount?.();return e?{...e,config:e.config??t}:n};export{o as getYnsContext};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "commerce-kit",
4
- "version": "0.0.19",
4
+ "version": "0.0.20",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
7
7
  "keywords": [