@zappie/sdk 0.18.1 → 0.19.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @zappie/sdk
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b5b272b: `zappie check` has an `unused` step. It follows imports from what React Router and the Worker load and reports each file under `app/` that nothing imports (`unused/file`), each export no other file imports (`unused/export`) and each export only tests import (`unused/test-only`). They warn. Set `unused: { fail: true }` in `zappie.config.ts` to fail the step on them. `validateConfig` checks the new key.
8
+
9
+ The starter drops the copied `category-nav`, `menu-page` and `item-sheet.tsx` kit parts nothing used, and the exports only its own files read.
10
+
3
11
  ## 0.18.1
4
12
 
5
13
  ### Patch Changes
@@ -116,6 +116,11 @@ type ZappieSiteConfig = {
116
116
  */
117
117
  cataloguePath?: string;
118
118
  };
119
+ /** How `zappie check` treats unused files and exports. They warn unless `fail` is true. */
120
+ unused?: {
121
+ /** Fails the check when it finds an unused file or export. */
122
+ fail?: boolean;
123
+ };
119
124
  };
120
125
  /**
121
126
  * A configuration diagnostic with its field path, stable code, message and severity.
package/dist/debug.js CHANGED
@@ -1,2 +1,2 @@
1
- var VERSION=true?"0.18.1":"0.0.0-development";function installDebug(client){if(typeof window==="undefined"||client.mode!=="test"){return}const events=[];let quote;const emit=(name,detail)=>{const event={name,detail,at:new Date().toISOString()};events.push(event);window.dispatchEvent(new CustomEvent("zappie:event",{detail:event}))};globalThis.__zappieEmit=emit;window.__zappie={version:VERSION,store:client.config.store,async catalogue(){await client.cart.hydrate();const branch=(await client.store.get()).branches.find(value=>value.id===client.cart.getSnapshot().branchId);return{branch,menu:await client.menu.get({branch:branch.id})}},cart:Object.assign(()=>client.cart.getSnapshot(),{async inject(input){await client.cart.hydrate();if(input.lines.length>100||input.lines.some(line=>!Number.isInteger(line.quantity??1)||(line.quantity??1)<1||(line.quantity??1)>99)){throw new Error("Use up to 100 cart lines with whole quantities from 1 to 99.")}const snapshot=client.cart.getSnapshot();const value={v:1,menuVersion:client._internal.cartCatalogue().version,updatedAt:Date.now(),fulfilment:snapshot.fulfilment,promoCode:snapshot.promoCode,lines:input.lines.map((line,index)=>({...line,id:`debug_${index}`,name:line.itemId,quantity:line.quantity??1,choices:(line.choices??[]).map(choice=>({...choice,quantity:choice.quantity??1})),inputs:line.inputs??{},addedAt:new Date().toISOString()}))};const scope=client.config.cart?.storageScope;(client.config.storage??window.localStorage).setItem(`zappie:cart:v1:${client.config.store}:${snapshot.branchId}${scope?`:${scope}`:""}`,JSON.stringify(value))}}),quote:()=>quote,events};client.on("add_to_cart",detail=>emit("add_to_cart",detail));client.cart.subscribe(()=>{const state=client.cart.state;const next="quote"in state?state.quote:void 0;if(next&&next!==quote){quote=next;emit("quote",next)}})}export{installDebug};
1
+ var VERSION=true?"0.19.0":"0.0.0-development";function installDebug(client){if(typeof window==="undefined"||client.mode!=="test"){return}const events=[];let quote;const emit=(name,detail)=>{const event={name,detail,at:new Date().toISOString()};events.push(event);window.dispatchEvent(new CustomEvent("zappie:event",{detail:event}))};globalThis.__zappieEmit=emit;window.__zappie={version:VERSION,store:client.config.store,async catalogue(){await client.cart.hydrate();const branch=(await client.store.get()).branches.find(value=>value.id===client.cart.getSnapshot().branchId);return{branch,menu:await client.menu.get({branch:branch.id})}},cart:Object.assign(()=>client.cart.getSnapshot(),{async inject(input){await client.cart.hydrate();if(input.lines.length>100||input.lines.some(line=>!Number.isInteger(line.quantity??1)||(line.quantity??1)<1||(line.quantity??1)>99)){throw new Error("Use up to 100 cart lines with whole quantities from 1 to 99.")}const snapshot=client.cart.getSnapshot();const value={v:1,menuVersion:client._internal.cartCatalogue().version,updatedAt:Date.now(),fulfilment:snapshot.fulfilment,promoCode:snapshot.promoCode,lines:input.lines.map((line,index)=>({...line,id:`debug_${index}`,name:line.itemId,quantity:line.quantity??1,choices:(line.choices??[]).map(choice=>({...choice,quantity:choice.quantity??1})),inputs:line.inputs??{},addedAt:new Date().toISOString()}))};const scope=client.config.cart?.storageScope;(client.config.storage??window.localStorage).setItem(`zappie:cart:v1:${client.config.store}:${snapshot.branchId}${scope?`:${scope}`:""}`,JSON.stringify(value))}}),quote:()=>quote,events};client.on("add_to_cart",detail=>emit("add_to_cart",detail));client.cart.subscribe(()=>{const state=client.cart.state;const next="quote"in state?state.quote:void 0;if(next&&next!==quote){quote=next;emit("quote",next)}})}export{installDebug};
2
2
  //# sourceMappingURL=debug.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{ZappieCartError}from"./cart/errors.js";import{holdsForLater,isHeldQuote}from"./cart/held.js";import{previewItem}from"./cart/preview.js";import{estimateUnitPrice}from"./cart/price.js";import{resolveSourceMenu}from"./cart/source-menu.js";import{validateLine}from"./cart/validate.js";import{createZappie}from"./client.js";import{API_VERSION}from"./config.js";import{ZappieError,isZappieError}from"./errors.js";export*from"./models.js";import{format,money}from"./money.js";import{RestTransport}from"./transport/rest.js";var VERSION=true?"0.18.1":"0.0.0-development";export{API_VERSION,RestTransport,VERSION,ZappieCartError,ZappieError,createZappie,estimateUnitPrice,format,holdsForLater,isHeldQuote,isZappieError,money,previewItem,resolveSourceMenu,validateLine};
1
+ import{ZappieCartError}from"./cart/errors.js";import{holdsForLater,isHeldQuote}from"./cart/held.js";import{previewItem}from"./cart/preview.js";import{estimateUnitPrice}from"./cart/price.js";import{resolveSourceMenu}from"./cart/source-menu.js";import{validateLine}from"./cart/validate.js";import{createZappie}from"./client.js";import{API_VERSION}from"./config.js";import{ZappieError,isZappieError}from"./errors.js";export*from"./models.js";import{format,money}from"./money.js";import{RestTransport}from"./transport/rest.js";var VERSION=true?"0.19.0":"0.0.0-development";export{API_VERSION,RestTransport,VERSION,ZappieCartError,ZappieError,createZappie,estimateUnitPrice,format,holdsForLater,isHeldQuote,isZappieError,money,previewItem,resolveSourceMenu,validateLine};
2
2
  //# sourceMappingURL=index.js.map
@@ -814,6 +814,11 @@ type ZappieSiteConfig = {
814
814
  */
815
815
  cataloguePath?: string;
816
816
  };
817
+ /** How `zappie check` treats unused files and exports. They warn unless `fail` is true. */
818
+ unused?: {
819
+ /** Fails the check when it finds an unused file or export. */
820
+ fail?: boolean;
821
+ };
817
822
  };
818
823
 
819
824
  /** Inputs for a storefront document's report-only security headers. */
@@ -1,2 +1,2 @@
1
- import{GLOBAL_PACKAGE_ALLOWLIST}from"./types.js";var record=value=>typeof value==="object"&&value!==null&&!Array.isArray(value);function distance(left,right){let row=Array.from({length:right.length+1},(_,index)=>index);for(let leftIndex=1;leftIndex<=left.length;leftIndex+=1){const next=[leftIndex];for(let rightIndex=1;rightIndex<=right.length;rightIndex+=1){next[rightIndex]=Math.min((next[rightIndex-1]??0)+1,(row[rightIndex]??0)+1,(row[rightIndex-1]??0)+(left[leftIndex-1]===right[rightIndex-1]?0:1))}row=next}return row[right.length]??Infinity}function unknownKeys(value,allowed,path,issue){for(const key of Object.keys(value)){if(allowed.includes(key)){continue}const closest=allowed.map(candidate=>({candidate,score:distance(key,candidate)})).sort((left,right)=>left.score-right.score)[0];const hint=closest&&closest.score<=2?closest.candidate:void 0;issue({path:path?`${path}.${key}`:key,code:"unknown_key",message:hint?`Unknown field "${key}". Rename it to "${hint}".`:`Unknown field "${key}". Remove it from the configuration.`,severity:"error"})}}var nonblank=value=>typeof value==="string"&&value.trim().length>0;var packageName=value=>value.length<=214&&/^(?:@[a-z0-9][a-z0-9._~-]*\/[a-z0-9][a-z0-9._~-]*|[a-z0-9][a-z0-9._~-]*)$/.test(value);var globallyAllowed=value=>GLOBAL_PACKAGE_ALLOWLIST.some(allowed=>allowed.endsWith("/*")?value.startsWith(allowed.slice(0,-1)):value===allowed);function hostname(value){const wildcard=value.startsWith("*.");const host=wildcard?value.slice(2):value;if(!host.includes(".")||/^\d+(?:\.\d+){3}$/.test(host)||host.length>253||host.includes("..")||wildcard&&/^(?:ac|co|com|edu|gov|net|org)\.[^.]+$/i.test(host)){return false}return host.split(".").every(label=>label.length>0&&label.length<=63&&/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(label))}export{globallyAllowed,hostname,nonblank,packageName,record,unknownKeys};
1
+ import{GLOBAL_PACKAGE_ALLOWLIST}from"./types.js";var record=value=>!!value&&typeof value==="object"&&!Array.isArray(value);function distance(left,right){let row=[...Array(right.length+1).keys()];for(let leftIndex=1;leftIndex<=left.length;leftIndex+=1){const next=[leftIndex];for(let rightIndex=1;rightIndex<=right.length;rightIndex+=1){next[rightIndex]=Math.min(next[rightIndex-1]+1,row[rightIndex]+1,row[rightIndex-1]+(left[leftIndex-1]===right[rightIndex-1]?0:1))}row=next}return row[right.length]}function unknownKeys(value,allowed,path,issue){for(const key of Object.keys(value)){if(allowed.includes(key)){continue}let hint;let best=3;for(const candidate of allowed){const score=distance(key,candidate);if(score<best){best=score;hint=candidate}}issue({path:path?`${path}.${key}`:key,code:"unknown_key",message:hint?`Unknown field "${key}". Rename it to "${hint}".`:`Unknown field "${key}". Remove it from the configuration.`,severity:"error"})}}var nonblank=value=>typeof value==="string"&&value.trim().length>0;var packageName=value=>value.length<=214&&/^(?:@[a-z0-9][a-z0-9._~-]*\/[a-z0-9][a-z0-9._~-]*|[a-z0-9][a-z0-9._~-]*)$/.test(value);var globallyAllowed=value=>GLOBAL_PACKAGE_ALLOWLIST.some(allowed=>allowed.endsWith("/*")?value.startsWith(allowed.slice(0,-1)):value===allowed);function hostname(value){const wildcard=value.startsWith("*.");const host=wildcard?value.slice(2):value;if(!host.includes(".")||/^\d+(?:\.\d+){3}$/.test(host)||host.length>253||wildcard&&/^(?:ac|co|com|edu|gov|net|org)\.[^.]+$/i.test(host)){return false}return host.split(".").every(label=>/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label))}export{globallyAllowed,hostname,nonblank,packageName,record,unknownKeys};
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": 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AAK,EAAG,CACpC,GAAI,QAAQ,SAAS,GAAG,EAAG,CACzB,QACF,CAEA,IAAI,KACJ,IAAI,KAAO,EACX,UAAW,aAAa,QAAS,CAC/B,MAAM,MAAQ,SAAS,IAAK,SAAS,EACrC,GAAI,MAAQ,KAAM,CAChB,KAAO,MACP,KAAO,SACT,CACF,CACA,MAAM,CACJ,KAAM,KAAO,GAAG,IAAI,IAAI,GAAG,GAAK,IAChC,KAAM,cACN,QAAS,KACL,kBAAkB,GAAG,oBAAoB,IAAI,KAC7C,kBAAkB,GAAG,uCACzB,SAAU,OACZ,CAAC,CACH,CACF,CAEO,IAAM,SAAY,OACvB,OAAO,QAAU,UAAY,MAAM,KAAK,EAAE,OAAS,EAE9C,IAAM,YAAe,OAC1B,MAAM,QAAU,KAChB,4EAA4E,KAC1E,KACF,EAEK,IAAM,gBAAmB,OAC9B,yBAAyB,KAAM,SAC7B,QAAQ,SAAS,IAAI,EACjB,MAAM,WAAW,QAAQ,MAAM,EAAG,EAAE,CAAC,EACrC,QAAU,OAChB,EAEK,SAAS,SAAS,MAAe,CACtC,MAAM,SAAW,MAAM,WAAW,IAAI,EACtC,MAAM,KAAO,SAAW,MAAM,MAAM,CAAC,EAAI,MACzC,GACE,CAAC,KAAK,SAAS,GAAG,GAClB,oBAAoB,KAAK,IAAI,GAC7B,KAAK,OAAS,KACb,UAAY,0CAA0C,KAAK,IAAI,EAChE,CACA,MAAO,MACT,CAEA,OAAO,KACJ,MAAM,GAAG,EACT,MAAO,OAAU,0CAA0C,KAAK,KAAK,CAAC,CAC3E",
5
5
  "names": []
6
6
  }
@@ -1,2 +1,2 @@
1
- import{globallyAllowed,hostname,nonblank,packageName,record,unknownKeys}from"./helpers.js";import{analytics,budgets,nested}from"./sections.js";var rootKeys=["store","branches","theme","prerender","menu","packages","audit","outbound","security","budgets","readiness","analytics","verify"];function validateConfig(input){const issues=[];const issue=value=>issues.push(value);const error=(path,code,message)=>issue({path,code,message,severity:"error"});if(!record(input)){return{valid:false,issues:[{path:"$",code:"invalid_type",message:"Expected a configuration object. Export an object from zappie.config.ts.",severity:"error"}]}}unknownKeys(input,rootKeys,"",issue);if(!nonblank(input.store)){error("store",input.store===void 0?"missing_required":"invalid_type","Expected a non-empty storefront slug. Set store to the slug used by createZappie().")}theme(input.theme,error);stringList(input.branches,"branches",error,{nonempty:true,unique:true,slug:true});if(input.prerender!==void 0){issue({path:"prerender",code:"unused_setting",message:"Zappie hosting prerenders no page, so prerender does nothing. Remove it.",severity:"warning"})}nested(input.menu,"menu",["hiddenCategories"],issue,value=>{stringList(value.hiddenCategories,"menu.hiddenCategories",error)});nested(input.packages,"packages",["allow"],issue,value=>{const allow=stringList(value.allow,"packages.allow",error);allow?.forEach((name,index)=>{if(globallyAllowed(name)){issue({path:`packages.allow[${index}]`,code:"redundant_allowlist",message:`${name} is already globally allowed. Remove it from packages.allow.`,severity:"warning"})}else if(!packageName(name)){error(`packages.allow[${index}]`,"invalid_format","Expected a lowercase npm package name. Use a package name such as lucide-react or @scope/name.")}})});nested(input.outbound,"outbound",["allow"],issue,value=>{hostList(value.allow,"outbound.allow",error)});nested(input.security,"security",["csp","links"],issue,security=>{hostList(security.links,"security.links",error);nested(security.csp,"security.csp",["imgSrc","connectSrc","fontSrc","styleSrc","frameSrc"],issue,csp=>{for(const[name,value]of Object.entries(csp)){hostList(value,`security.csp.${name}`,error)}})});budgets(input.budgets,issue,error);nested(input.readiness,"readiness",["routeDiscovery"],issue,readiness=>{nested(readiness.routeDiscovery,"readiness.routeDiscovery",["optOut"],issue,routeDiscovery=>{nested(routeDiscovery.optOut,"readiness.routeDiscovery.optOut",["reason"],issue,optOut=>{if(!nonblank(optOut.reason)){error("readiness.routeDiscovery.optOut.reason","invalid_format","Expected a non-blank reason. Explain why the site disables initial route discovery.")}})})});analytics(input.analytics,issue,error);nested(input.verify,"verify",["startPath","cataloguePath"],issue,()=>{});return{valid:!issues.some(entry=>entry.severity==="error"),issues}}function theme(value,error){if(typeof value!=="string"){error("theme",value===void 0?"missing_required":"invalid_type","Expected a relative .json path. Set theme to a value such as ./theme.json.")}else if(!/\.json$/.test(value)||/^(?:[a-z][a-z\d+.-]*:|\/|\\)/i.test(value)||value.includes("\\")){error("theme","invalid_format","Expected a relative .json path. Use a value such as ./theme.json.")}}function stringList(value,path,error,options={}){if(value===void 0){return void 0}if(!Array.isArray(value)||value.some(entry=>typeof entry!=="string")){error(path,"invalid_type",`Expected an array of strings. Set ${path} to string values.`);return void 0}if(options.nonempty&&value.length===0){error(path,"invalid_format",`Expected at least one value. Add a value to ${path} or remove the field.`)}value.forEach((entry,index)=>{if(options.slug&&!nonblank(entry)){error(`${path}[${index}]`,"invalid_format","Expected a non-empty branch slug. Remove the empty value or use a branch slug.")}});if(options.unique&&new Set(value).size!==value.length){error(path,"duplicate",`Expected unique values. Remove duplicates from ${path}.`)}return value}function hostList(value,path,error){stringList(value,path,error)?.forEach((host,index)=>{if(!hostname(host)){error(`${path}[${index}]`,"invalid_format","Expected a hostname or leading *. subdomain pattern without a scheme, path, port or IP. Use a value such as api.example.com.")}})}export{validateConfig};
1
+ import{globallyAllowed,hostname,nonblank,packageName,record,unknownKeys}from"./helpers.js";import{analytics,budgets,nested}from"./sections.js";var rootKeys=["store","branches","theme","prerender","menu","packages","audit","outbound","security","budgets","readiness","analytics","verify","unused"];function validateConfig(input){const issues=[];const issue=value=>issues.push(value);const error=(path,code,message)=>issue({path,code,message,severity:"error"});if(!record(input)){return{valid:false,issues:[{path:"$",code:"invalid_type",message:"Expected a configuration object. Export an object from zappie.config.ts.",severity:"error"}]}}unknownKeys(input,rootKeys,"",issue);if(!nonblank(input.store)){error("store",input.store===void 0?"missing_required":"invalid_type","Expected a non-empty storefront slug. Set store to the slug used by createZappie().")}theme(input.theme,error);stringList(input.branches,"branches",error,{nonempty:true,unique:true,slug:true});if(input.prerender!==void 0){issue({path:"prerender",code:"unused_setting",message:"Zappie hosting prerenders no page, so prerender does nothing. Remove it.",severity:"warning"})}nested(input.menu,"menu",["hiddenCategories"],issue,value=>{stringList(value.hiddenCategories,"menu.hiddenCategories",error)});nested(input.packages,"packages",["allow"],issue,value=>{const allow=stringList(value.allow,"packages.allow",error);allow?.forEach((name,index)=>{if(globallyAllowed(name)){issue({path:`packages.allow[${index}]`,code:"redundant_allowlist",message:`${name} is already globally allowed. Remove it from packages.allow.`,severity:"warning"})}else if(!packageName(name)){error(`packages.allow[${index}]`,"invalid_format","Expected a lowercase npm package name. Use a package name such as lucide-react or @scope/name.")}})});nested(input.outbound,"outbound",["allow"],issue,value=>{hostList(value.allow,"outbound.allow",error)});nested(input.security,"security",["csp","links"],issue,security=>{hostList(security.links,"security.links",error);nested(security.csp,"security.csp",["imgSrc","connectSrc","fontSrc","styleSrc","frameSrc"],issue,csp=>{for(const[name,value]of Object.entries(csp)){hostList(value,`security.csp.${name}`,error)}})});budgets(input.budgets,issue,error);nested(input.readiness,"readiness",["routeDiscovery"],issue,readiness=>{nested(readiness.routeDiscovery,"readiness.routeDiscovery",["optOut"],issue,routeDiscovery=>{nested(routeDiscovery.optOut,"readiness.routeDiscovery.optOut",["reason"],issue,optOut=>{if(!nonblank(optOut.reason)){error("readiness.routeDiscovery.optOut.reason","invalid_format","Expected a non-blank reason. Explain why the site disables initial route discovery.")}})})});analytics(input.analytics,issue,error);nested(input.verify,"verify",["startPath","cataloguePath"],issue,()=>{});nested(input.unused,"unused",["fail"],issue,unused=>{if(unused.fail!==void 0&&typeof unused.fail!=="boolean"){error("unused.fail","invalid_type","Expected a boolean. Set unused.fail to true or remove it.")}});return{valid:!issues.some(entry=>entry.severity==="error"),issues}}function theme(value,error){if(typeof value!=="string"){error("theme",value===void 0?"missing_required":"invalid_type","Expected a relative .json path. Set theme to a value such as ./theme.json.")}else if(!/\.json$/.test(value)||/^(?:[a-z][a-z\d+.-]*:|\/|\\)/i.test(value)||value.includes("\\")){error("theme","invalid_format","Expected a relative .json path. Use a value such as ./theme.json.")}}function stringList(value,path,error,options={}){if(value===void 0){return void 0}if(!Array.isArray(value)||value.some(entry=>typeof entry!=="string")){error(path,"invalid_type",`Expected an array of strings. Set ${path} to string values.`);return void 0}if(options.nonempty&&value.length===0){error(path,"invalid_format",`Expected at least one value. Add a value to ${path} or remove the field.`)}value.forEach((entry,index)=>{if(options.slug&&!nonblank(entry)){error(`${path}[${index}]`,"invalid_format","Expected a non-empty branch slug. Remove the empty value or use a branch slug.")}});if(options.unique&&new Set(value).size!==value.length){error(path,"duplicate",`Expected unique values. Remove duplicates from ${path}.`)}return value}function hostList(value,path,error){stringList(value,path,error)?.forEach((host,index)=>{if(!hostname(host)){error(`${path}[${index}]`,"invalid_format","Expected a hostname or leading *. subdomain pattern without a scheme, path, port or IP. Use a value such as api.example.com.")}})}export{validateConfig};
2
2
  //# sourceMappingURL=validate.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/site-config/validate.ts"],
4
- "mappings": "AAAA,OACE,gBACA,SACA,SACA,YACA,OACA,gBACK,eACP,OAAS,UAAW,QAAS,WAAc,gBAG3C,IAAM,SAAW,CACf,QACA,WACA,QACA,YACA,OACA,WACA,QACA,WACA,WACA,UACA,YACA,YACA,QACF,EASO,SAAS,eAAe,MAAkC,CAC/D,MAAM,OAAwB,CAAC,EAC/B,MAAM,MAAS,OAAuB,OAAO,KAAK,KAAK,EACvD,MAAM,MAAQ,CAAC,KAAc,KAA2B,UACtD,MAAM,CAAE,KAAM,KAAM,QAAS,SAAU,OAAQ,CAAC,EAClD,GAAI,CAAC,OAAO,KAAK,EAAG,CAClB,MAAO,CACL,MAAO,MACP,OAAQ,CACN,CACE,KAAM,IACN,KAAM,eACN,QACE,2EACF,SAAU,OACZ,CACF,CACF,CACF,CACA,YAAY,MAAO,SAAU,GAAI,KAAK,EACtC,GAAI,CAAC,SAAS,MAAM,KAAK,EAAG,CAC1B,MACE,QACA,MAAM,QAAU,OAAY,mBAAqB,eACjD,qFACF,CACF,CACA,MAAM,MAAM,MAAO,KAAK,EACx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AI,IAAI,KAAK,IAChB,iBACA,8HACF,CACF,CACF,CAAC,CACH",
5
5
  "names": []
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappie/sdk",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "Typed, framework-agnostic client for Zappie menus, carts, checkout, auth and events.",
5
5
  "type": "module",
6
6
  "sideEffects": [