@zappie/sdk 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/{client-B8lItidz.d.ts → client-CW_OWZ0l.d.ts} +1 -1
- package/dist/config/index.d.ts +8 -4
- package/dist/debug.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/persist/catalogue.d.ts +1 -1
- package/dist/server/index.d.ts +7 -4
- package/dist/testing/index.d.ts +1 -1
- package/dist/transport/selected-menu.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @zappie/sdk
|
|
2
2
|
|
|
3
|
+
## 0.29.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 529f284: Verify's hint for an error a check has no code for now says what such a failure means and where to look: the report's message, the check's screenshot and `verify.trace.zip` in the artifacts folder. A check that is not released yet says so and that verify skips it, and the reset step no longer names an internal plan. Each eslint-plugin-zappie option now describes itself in its schema, with its default, and the rule docs end without a semicolon. The SDK's budget docs give each budget's unit, in KiB, and its default. The SDK and verify call the store's identifier the business tag, as the dashboard does, and the starter README's verify example uses the real storefront API address.
|
|
8
|
+
|
|
3
9
|
## 0.29.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -330,7 +330,7 @@ interface StorageLike {
|
|
|
330
330
|
/** Settings for your storefront client. Each client keeps its own credentials and caches. */
|
|
331
331
|
type ZappieConfig = {
|
|
332
332
|
/**
|
|
333
|
-
*
|
|
333
|
+
* Your business tag, as the dashboard shows it under Settings, Business. The SDK names saved carts and caches by it and never sends
|
|
334
334
|
* it: the API finds the store from your key. Required.
|
|
335
335
|
*/
|
|
336
336
|
store: string;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default site budgets: 200
|
|
2
|
+
* Default site budgets: 200 KiB gzipped JavaScript, 50 KiB gzipped CSS, 2500 ms LCP and 3000 ms until the first product card is tappable.
|
|
3
|
+
* A KiB is 1,024 bytes.
|
|
3
4
|
*/
|
|
4
5
|
declare const DEFAULT_BUDGETS: {
|
|
5
6
|
readonly jsKbGz: 200;
|
|
@@ -17,7 +18,7 @@ type RouteCssBudget = number | Record<string, number>;
|
|
|
17
18
|
* The store, theme and optional build policies you export from zappie.config.ts.
|
|
18
19
|
*/
|
|
19
20
|
type ZappieSiteConfig = {
|
|
20
|
-
/**
|
|
21
|
+
/** Your business tag, the same one you pass to `createZappie()`. Find it in the dashboard under Settings, Business. Required and non-empty. */
|
|
21
22
|
store: string;
|
|
22
23
|
/** Branch slugs for this site. When set, it needs at least one non-empty slug, each listed once. */
|
|
23
24
|
branches?: string[];
|
|
@@ -70,11 +71,13 @@ type ZappieSiteConfig = {
|
|
|
70
71
|
};
|
|
71
72
|
/** Each budget left out uses DEFAULT_BUDGETS. */
|
|
72
73
|
budgets?: {
|
|
74
|
+
/** The gzipped JavaScript, in KiB, each route loads with the client entry. Default: 200. */
|
|
73
75
|
jsKbGz?: number;
|
|
74
|
-
/** Every client stylesheet together, gzipped, in KiB. `zappie check` enforces it only while `routeCssKbGz` is unset. */
|
|
76
|
+
/** Every client stylesheet together, gzipped, in KiB. Default: 50. `zappie check` enforces it only while `routeCssKbGz` is unset. */
|
|
75
77
|
cssKbGz?: number;
|
|
78
|
+
/** The menu's largest contentful paint budget, in milliseconds. Default: 2500. `zappie verify` fails a menu over 2500 ms whatever this says. */
|
|
76
79
|
lcpMs?: number;
|
|
77
|
-
/** V15's limit for the first product card to become tappable. Values below 3000 use 3000. */
|
|
80
|
+
/** V15's limit, in milliseconds, for the first product card to become tappable. Default: 3000. Values below 3000 use 3000. */
|
|
78
81
|
tappableMs?: number;
|
|
79
82
|
/**
|
|
80
83
|
* The gzipped CSS, in KiB, a route may load on its first load: the shared base plus that route's own stylesheets.
|
|
@@ -95,6 +98,7 @@ type ZappieSiteConfig = {
|
|
|
95
98
|
* `zappie verify` fails. Unset, verify warns above 50 percent and never fails.
|
|
96
99
|
*/
|
|
97
100
|
unusedCssPercent?: number;
|
|
101
|
+
/** Why a budget is above its default. Without a reason, a raised budget is a config error. With one, it is a warning. */
|
|
98
102
|
override?: {
|
|
99
103
|
reason: string;
|
|
100
104
|
};
|
package/dist/debug.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VERSION=true?"0.29.
|
|
1
|
+
var VERSION=true?"0.29.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};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as ZappieError, T as Transport, R as RequestCtx, g as MenuFulfilment, h as MenuResponse, k as SearchRequest, l as SearchPage, m as MenuVersion } from './client-
|
|
1
|
+
import { a as ZappieError, T as Transport, R as RequestCtx, g as MenuFulfilment, h as MenuResponse, k as SearchRequest, l as SearchPage, m as MenuVersion } from './client-CW_OWZ0l.js';
|
|
2
2
|
import { SelectedMenuRequest, SelectedMenuResponse } from './transport/selected-menu.js';
|
|
3
|
-
export { A as API_VERSION, E as ErrorDetails, e as MenuReadOptions, M as MenuResource, n as ReadOptions, S as StorageLike, c as StoreResource, Z as Zappie, b as ZappieClientOptions, b as ZappieConfig, f as ZappieErrorCode, d as ZappieEvents, o as createZappie, p as isZappieError } from './client-
|
|
3
|
+
export { A as API_VERSION, E as ErrorDetails, e as MenuReadOptions, M as MenuResource, n as ReadOptions, S as StorageLike, c as StoreResource, Z as Zappie, b as ZappieClientOptions, b as ZappieConfig, f as ZappieErrorCode, d as ZappieEvents, o as createZappie, p as isZappieError } from './client-CW_OWZ0l.js';
|
|
4
4
|
import { g as CartIssue, a as Quote, b as CartLineInput, C as CartLine, Q as QuoteRequest, i as WireQuote } from './types-CuPaBf6k.js';
|
|
5
5
|
export { A as AppliedPerk, j as CartFix, c as CartFulfilment, e as CartIssueCode, d as CartModule, k as CartSnapshot, f as CartState, l as CartSyncAdapter, m as CartSyncDocument, n as CheckoutCustomer, D as DeliveryAddress, P as PendingFulfilment, o as WireFix, W as WireFulfilment, p as WireIssue, q as WireLine, h as WireMoney } from './types-CuPaBf6k.js';
|
|
6
6
|
import { I as Item, O as OptionGroup, M as Money, a as Menu, B as Branch, S as Store, C as CategoryPage } from './models-C77LjkK8.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,withDefaultMenu}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.29.
|
|
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,withDefaultMenu}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.29.1":"0.0.0-development";export{API_VERSION,RestTransport,VERSION,ZappieCartError,ZappieError,createZappie,estimateUnitPrice,format,holdsForLater,isHeldQuote,isZappieError,money,previewItem,resolveSourceMenu,validateLine,withDefaultMenu};
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { q as CATALOGUE_MAX_AGE_MS, r as CATALOGUE_MAX_BYTES, s as CatalogueScope, t as SavedCatalogue, u as catalogueDigest, w as catalogueKey, x as createCatalogueStorage, y as createSavedCatalogue } from '../client-
|
|
1
|
+
export { q as CATALOGUE_MAX_AGE_MS, r as CATALOGUE_MAX_BYTES, s as CatalogueScope, t as SavedCatalogue, u as catalogueDigest, w as catalogueKey, x as createCatalogueStorage, y as createSavedCatalogue } from '../client-CW_OWZ0l.js';
|
|
2
2
|
import '../models-C77LjkK8.js';
|
|
3
3
|
import '../types-CuPaBf6k.js';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Branch, Store, Menu, Item, Formatters } from '../index.js';
|
|
2
|
-
import { C as Cache } from '../client-
|
|
2
|
+
import { C as Cache } from '../client-CW_OWZ0l.js';
|
|
3
3
|
import { ZappieError, Zappie, ZappieConfig, Transport, StorageLike, StoreResource, MenuResource, ZappieEvents, MenuReadOptions } from '../index.js';
|
|
4
4
|
export { VERSION } from '../index.js';
|
|
5
5
|
import { CartModule, CartLineInput } from '../index.js';
|
|
@@ -975,7 +975,7 @@ type RouteCssBudget = number | Record<string, number>;
|
|
|
975
975
|
* The store, theme and optional build policies you export from zappie.config.ts.
|
|
976
976
|
*/
|
|
977
977
|
type ZappieSiteConfig = {
|
|
978
|
-
/**
|
|
978
|
+
/** Your business tag, the same one you pass to `createZappie()`. Find it in the dashboard under Settings, Business. Required and non-empty. */
|
|
979
979
|
store: string;
|
|
980
980
|
/** Branch slugs for this site. When set, it needs at least one non-empty slug, each listed once. */
|
|
981
981
|
branches?: string[];
|
|
@@ -1028,11 +1028,13 @@ type ZappieSiteConfig = {
|
|
|
1028
1028
|
};
|
|
1029
1029
|
/** Each budget left out uses DEFAULT_BUDGETS. */
|
|
1030
1030
|
budgets?: {
|
|
1031
|
+
/** The gzipped JavaScript, in KiB, each route loads with the client entry. Default: 200. */
|
|
1031
1032
|
jsKbGz?: number;
|
|
1032
|
-
/** Every client stylesheet together, gzipped, in KiB. `zappie check` enforces it only while `routeCssKbGz` is unset. */
|
|
1033
|
+
/** Every client stylesheet together, gzipped, in KiB. Default: 50. `zappie check` enforces it only while `routeCssKbGz` is unset. */
|
|
1033
1034
|
cssKbGz?: number;
|
|
1035
|
+
/** The menu's largest contentful paint budget, in milliseconds. Default: 2500. `zappie verify` fails a menu over 2500 ms whatever this says. */
|
|
1034
1036
|
lcpMs?: number;
|
|
1035
|
-
/** V15's limit for the first product card to become tappable. Values below 3000 use 3000. */
|
|
1037
|
+
/** V15's limit, in milliseconds, for the first product card to become tappable. Default: 3000. Values below 3000 use 3000. */
|
|
1036
1038
|
tappableMs?: number;
|
|
1037
1039
|
/**
|
|
1038
1040
|
* The gzipped CSS, in KiB, a route may load on its first load: the shared base plus that route's own stylesheets.
|
|
@@ -1053,6 +1055,7 @@ type ZappieSiteConfig = {
|
|
|
1053
1055
|
* `zappie verify` fails. Unset, verify warns above 50 percent and never fails.
|
|
1054
1056
|
*/
|
|
1055
1057
|
unusedCssPercent?: number;
|
|
1058
|
+
/** Why a budget is above its default. Without a reason, a raised budget is a config error. With one, it is a warning. */
|
|
1056
1059
|
override?: {
|
|
1057
1060
|
reason: string;
|
|
1058
1061
|
};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Cache } from '../client-
|
|
1
|
+
import { C as Cache } from '../client-CW_OWZ0l.js';
|
|
2
2
|
import { Transport, ZappieErrorCode, StorageLike, StoreResource, MenuResource, ZappieEvents, MenuReadOptions } from '../index.js';
|
|
3
3
|
import { Store, Menu, Formatters } from '../index.js';
|
|
4
4
|
export { VERSION } from '../index.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { z as SelectedMenu, i as SelectedMenuRequest, j as SelectedMenuResponse, B as SelectedMenuTransport, D as createSelectedMenuReader, F as selectedMenu, G as selectedMenuKey } from '../client-
|
|
1
|
+
export { z as SelectedMenu, i as SelectedMenuRequest, j as SelectedMenuResponse, B as SelectedMenuTransport, D as createSelectedMenuReader, F as selectedMenu, G as selectedMenuKey } from '../client-CW_OWZ0l.js';
|
|
2
2
|
import '../models-C77LjkK8.js';
|
|
3
3
|
import '../types-CuPaBf6k.js';
|