@zappie/sdk 0.10.2 → 0.10.3
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/README.md +25 -0
- package/dist/{client-75aFOuQi.d.ts → client-Bn7nRoy3.d.ts} +7 -1
- package/dist/client.js +53 -49
- package/dist/client.js.map +1 -1
- 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/chosen-branch.js +20 -0
- package/dist/server/chosen-branch.js.map +1 -1
- package/dist/server/index.d.ts +47 -4
- package/dist/server/index.js +4 -0
- package/dist/server/index.js.map +1 -1
- package/dist/testing/index.d.ts +5 -2
- 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.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ad0e714: `@zappie/sdk/server` adds `loadStoreAndMenu(client, request, options)`. It reads the store and the menu of the branch a request is for, as `resolveBranch` picks it. When the link, the cookie or the fallback names the branch by ID (`br_…`), the menu read starts alongside the store read, so a server render waits for one round trip instead of two. The menu counts only once the store confirms that branch, with the same errors as `store.get` followed by `menu.get`. `requestedBranch(request, options)` returns the raw branch value a request names before you have the store.
|
|
8
|
+
|
|
3
9
|
## 0.10.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -169,6 +169,31 @@ checkout and sign-in overlays become routes. Unsupported legacy UI parameters
|
|
|
169
169
|
are dropped. Ad click IDs, `ref`, and every `utm_*` parameter retain their values.
|
|
170
170
|
Payment-return and printed QR routes retain their existing parameters.
|
|
171
171
|
|
|
172
|
+
### Store and menu in one round trip
|
|
173
|
+
|
|
174
|
+
`loadStoreAndMenu(client, request, options)` from `@zappie/sdk/server` reads
|
|
175
|
+
the store and the menu of the branch a request is for, as `resolveBranch`
|
|
176
|
+
picks it, and returns `{ store, branch, chosen, mustChoose, menu }`:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
import { loadStoreAndMenu } from "@zappie/sdk/server";
|
|
180
|
+
|
|
181
|
+
const { store, branch, chosen, mustChoose, menu } = await loadStoreAndMenu(
|
|
182
|
+
client,
|
|
183
|
+
request,
|
|
184
|
+
{ cookie: "site_branch", fallback: env.ZAPPIE_BRANCH },
|
|
185
|
+
);
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
When the link, the cookie or the fallback names the branch by ID (`br_…`),
|
|
189
|
+
the menu read starts alongside the store read, so the page waits for one round
|
|
190
|
+
trip instead of two. You get the menu once the store confirms that branch,
|
|
191
|
+
with the same errors as `store.get` followed by `menu.get`. A branch named by
|
|
192
|
+
slug reads the menu after the store, because the API takes branch IDs only.
|
|
193
|
+
Keep the branch ID in your branch cookie to get one round trip on every page
|
|
194
|
+
whose link doesn't name a branch. `requestedBranch(request, options)` returns
|
|
195
|
+
the raw value a request names, link first, before you have the store.
|
|
196
|
+
|
|
172
197
|
### Checkout defaults
|
|
173
198
|
|
|
174
199
|
`@zappie/sdk/checkout-defaults` fills in checkout contact details the way the
|
|
@@ -359,6 +359,9 @@ declare function buildClient(input: ZappieConfig, secret?: boolean): Readonly<{
|
|
|
359
359
|
cache: Cache;
|
|
360
360
|
emit: <E extends keyof ZappieEvents>(event: E, payload: ZappieEvents[E]) => void;
|
|
361
361
|
menuKey: (requested?: string) => string;
|
|
362
|
+
readMenu: (branchId: string, opts: MenuReadOptions & {
|
|
363
|
+
metadataOnly?: boolean;
|
|
364
|
+
}) => Promise<Menu>;
|
|
362
365
|
hydrateStore: (value: Store) => void;
|
|
363
366
|
};
|
|
364
367
|
}>;
|
|
@@ -393,9 +396,12 @@ declare function createZappie(config: ZappieConfig): Readonly<{
|
|
|
393
396
|
cache: Cache;
|
|
394
397
|
emit: <E extends keyof ZappieEvents>(event: E, payload: ZappieEvents[E]) => void;
|
|
395
398
|
menuKey: (requested?: string) => string;
|
|
399
|
+
readMenu: (branchId: string, opts: MenuReadOptions & {
|
|
400
|
+
metadataOnly?: boolean;
|
|
401
|
+
}) => Promise<Menu>;
|
|
396
402
|
hydrateStore: (value: Store) => void;
|
|
397
403
|
};
|
|
398
404
|
}>;
|
|
399
405
|
|
|
400
406
|
export { API_VERSION as A, Cache as C, createSelectedMenuReader as D, selectedMenu as F, selectedMenuKey as G, ZappieError as a, createZappie as o, isZappieError as p, CATALOGUE_MAX_AGE_MS as q, CATALOGUE_MAX_BYTES as r, catalogueDigest as u, validateConfig as v, catalogueKey as w, createCatalogueStorage as x, createSavedCatalogue as y };
|
|
401
|
-
export type { SelectedMenuTransport as B, ErrorDetails as E, MenuResource as M, RequestCtx as R, StorageLike as S, Transport as T, Zappie as Z, ZappieConfig as b, StoreResource as c, ZappieEvents as d,
|
|
407
|
+
export type { SelectedMenuTransport as B, ErrorDetails as E, MenuResource as M, RequestCtx as R, StorageLike as S, Transport as T, Zappie as Z, ZappieConfig as b, StoreResource as c, ZappieEvents as d, MenuReadOptions as e, ZappieErrorCode as f, MenuFulfilment as g, MenuResponse as h, SelectedMenuRequest as i, SelectedMenuResponse as j, SearchRequest as k, SearchPage as l, MenuVersion as m, ReadOptions as n, CatalogueScope as s, SavedCatalogue as t, SelectedMenu as z };
|
package/dist/client.js
CHANGED
|
@@ -58,6 +58,55 @@ function buildClient(input, secret = false) {
|
|
|
58
58
|
return selected ?? "default";
|
|
59
59
|
};
|
|
60
60
|
const menuKey = (requested) => `menu:${branchKey(requested)}`;
|
|
61
|
+
const readMenu = (branchId, opts) => cache.get(
|
|
62
|
+
`menu:${branchId}${opts.fulfilment ? `:${opts.fulfilment}` : ""}${opts.metadataOnly ? ":partial" : ""}`,
|
|
63
|
+
async (signal, entry) => {
|
|
64
|
+
const response = await transport.getMenu({
|
|
65
|
+
...ctx(signal),
|
|
66
|
+
branchId,
|
|
67
|
+
fulfilment: opts.fulfilment,
|
|
68
|
+
...opts.metadataOnly ? { metadataOnly: true } : {},
|
|
69
|
+
...entry.etag ? { ifNoneMatch: entry.etag } : {}
|
|
70
|
+
});
|
|
71
|
+
if ("notModified" in response) {
|
|
72
|
+
if (!entry.value) {
|
|
73
|
+
throw new ZappieError(
|
|
74
|
+
"server_error",
|
|
75
|
+
"Received 304 without a cached menu"
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
value: entry.value,
|
|
80
|
+
...response.etag ?? entry.etag ? { etag: response.etag ?? entry.etag } : {}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (!opts.metadataOnly && response.menu.completeness === "partial") {
|
|
84
|
+
throw new ZappieError(
|
|
85
|
+
"server_error",
|
|
86
|
+
"Partial catalogue cannot satisfy a complete read"
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
if (response.menu.branchId !== branchId) {
|
|
90
|
+
throw new ZappieError(
|
|
91
|
+
"server_error",
|
|
92
|
+
"Menu belongs to a different branch"
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
value: response.menu,
|
|
97
|
+
etag: response.etag ?? response.menu.version,
|
|
98
|
+
onStored: () => {
|
|
99
|
+
if (entry.value && entry.value.version !== response.menu.version) {
|
|
100
|
+
events.emit("menu:updated", {
|
|
101
|
+
branchId,
|
|
102
|
+
version: response.menu.version
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
opts.signal
|
|
109
|
+
);
|
|
61
110
|
const menu = {
|
|
62
111
|
async search(query, opts = {}) {
|
|
63
112
|
if (!transport.search) {
|
|
@@ -75,55 +124,9 @@ function buildClient(input, secret = false) {
|
|
|
75
124
|
});
|
|
76
125
|
},
|
|
77
126
|
async get(opts = {}) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
async (signal, entry) => {
|
|
82
|
-
const response = await transport.getMenu({
|
|
83
|
-
...ctx(signal),
|
|
84
|
-
branchId: branch.id,
|
|
85
|
-
fulfilment: opts.fulfilment,
|
|
86
|
-
...opts.metadataOnly ? { metadataOnly: true } : {},
|
|
87
|
-
...entry.etag ? { ifNoneMatch: entry.etag } : {}
|
|
88
|
-
});
|
|
89
|
-
if ("notModified" in response) {
|
|
90
|
-
if (!entry.value) {
|
|
91
|
-
throw new ZappieError(
|
|
92
|
-
"server_error",
|
|
93
|
-
"Received 304 without a cached menu"
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
value: entry.value,
|
|
98
|
-
...response.etag ?? entry.etag ? { etag: response.etag ?? entry.etag } : {}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (!opts.metadataOnly && response.menu.completeness === "partial") {
|
|
102
|
-
throw new ZappieError(
|
|
103
|
-
"server_error",
|
|
104
|
-
"Partial catalogue cannot satisfy a complete read"
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
if (response.menu.branchId !== branch.id) {
|
|
108
|
-
throw new ZappieError(
|
|
109
|
-
"server_error",
|
|
110
|
-
"Menu belongs to a different branch"
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
value: response.menu,
|
|
115
|
-
etag: response.etag ?? response.menu.version,
|
|
116
|
-
onStored: () => {
|
|
117
|
-
if (entry.value && entry.value.version !== response.menu.version) {
|
|
118
|
-
events.emit("menu:updated", {
|
|
119
|
-
branchId: branch.id,
|
|
120
|
-
version: response.menu.version
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
},
|
|
126
|
-
opts.signal
|
|
127
|
+
return readMenu(
|
|
128
|
+
resolveBranch(await store.get(opts), opts.branch).id,
|
|
129
|
+
opts
|
|
127
130
|
);
|
|
128
131
|
},
|
|
129
132
|
peek: (branch) => cache.snapshot(menuKey(branch)).value ?? cache.snapshot(`${menuKey(branch)}:partial`).value,
|
|
@@ -237,6 +240,7 @@ function buildClient(input, secret = false) {
|
|
|
237
240
|
cache,
|
|
238
241
|
emit: events.emit,
|
|
239
242
|
menuKey,
|
|
243
|
+
readMenu,
|
|
240
244
|
hydrateStore: (value) => cache.set("store", value)
|
|
241
245
|
}
|
|
242
246
|
});
|
package/dist/client.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/client.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AAEjC,SAAS,aAAa,sBAAsB;AAC5C,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AAEtB,SAAS,qBAAqB;AAE9B,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAgCvB,SAAS,YAAY,OAAqB,SAAS,OAAO;AAC/D,QAAM,OAAO,eAAe,OAAO,MAAM;AACzC,QAAM,SAAS,OAAO,OAAO;AAAA,IAC3B,GAAG;AAAA,IACH,SAAS,MAAM,WAAW;AAAA,IAC1B,WAAW,MAAM,aAAa;AAAA,EAChC,CAAC;AACD,QAAM,YACJ,MAAM,aACN,IAAI,cAAc;AAAA,IAChB,GAAI,MAAM,UAAU,EAAE,SAAS,MAAM,QAAQ,IAAI,CAAC;AAAA,IAClD,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC;AACH,QAAM,SAAS,cAAc;AAC7B,QAAM,QAAQ,IAAI,MAAM,CAAC,UAAU,OAAO,KAAK,SAAS,EAAE,MAAM,CAAC,CAAC;AAClE,QAAM,MAAM,CAAC,YAA0B;AAAA,IACrC,KAAK,OAAO;AAAA,IACZ,SAAS,OAAO;AAAA,IAChB,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;AAAA,EAC7B;AACA,QAAM,QAAuB;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A,IACA;AAAA,IACA;AAAA,IACA,IAAI,OAAO;AAAA,IACX,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,OAAO;AAAA,MACb;AAAA,MACA;AAAA,MACA,cAAc,CAAC,UAAiB,MAAM,IAAI,SAAS,KAAK;AAAA,IAC1D;AAAA,EACF,CAAC;AACH;AAEO,SAAS,aAAa,QAAsB;AACjD,QAAM,SAAS,YAAY,MAAM;AACjC,MAAI,OAAO,SAAS,UAAU,OAAO,WAAW,aAAa;AAC3D,SAAK,OAAO,YAAS,EAAE,KAAK,CAAC,EAAE,aAAa,MAAM,aAAa,MAAM,CAAC;AAAA,EACxE;AACA,SAAO;AACT;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/debug.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as ZappieError, T as Transport, R as RequestCtx,
|
|
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-Bn7nRoy3.js';
|
|
2
2
|
import { SelectedMenuRequest, SelectedMenuResponse } from './transport/selected-menu.js';
|
|
3
|
-
export { A as API_VERSION, E as ErrorDetails,
|
|
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-Bn7nRoy3.js';
|
|
4
4
|
import { g as CartIssue, b as CartLineInput, C as CartLine, Q as QuoteRequest, h as WireQuote } from './types-BzyzhqYz.js';
|
|
5
5
|
export { i as CartFix, c as CartFulfilment, e as CartIssueCode, d as CartModule, j as CartSnapshot, f as CartState, k as CartSyncAdapter, l as CartSyncDocument, D as DeliveryAddress, a as Quote, m as WireFix, W as WireFulfilment, n as WireIssue, o as WireLine, p as WireMoney } from './types-BzyzhqYz.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-C-kEg1Id.js';
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ZappieError, isZappieError } from "./errors.js";
|
|
|
10
10
|
export * from "./models.js";
|
|
11
11
|
import { format, money } from "./money.js";
|
|
12
12
|
import { RestTransport } from "./transport/rest.js";
|
|
13
|
-
var VERSION = true ? "0.10.
|
|
13
|
+
var VERSION = true ? "0.10.3" : "0.0.0-development";
|
|
14
14
|
export {
|
|
15
15
|
API_VERSION,
|
|
16
16
|
RestTransport,
|
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-Bn7nRoy3.js';
|
|
2
2
|
import '../models-C-kEg1Id.js';
|
|
3
3
|
import '../types-BzyzhqYz.js';
|
|
@@ -22,7 +22,27 @@ function resolveBranch(store, request, { cookie, fallback, param = "branch" }) {
|
|
|
22
22
|
mustChoose: !chosen && store.branches.length > 1
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
function requestedBranch(request, { cookie, fallback, param = "branch" }) {
|
|
26
|
+
return new URL(request.url).searchParams.get(param) || readCookie(request, cookie) || fallback || void 0;
|
|
27
|
+
}
|
|
28
|
+
var ignore = () => {
|
|
29
|
+
};
|
|
30
|
+
async function loadStoreAndMenu(client, request, options) {
|
|
31
|
+
const named = requestedBranch(request, options);
|
|
32
|
+
const early = named?.startsWith("br_") && !client.store.peek() ? client._internal.readMenu(named, {}) : void 0;
|
|
33
|
+
early?.catch(ignore);
|
|
34
|
+
const store = await client.store.get();
|
|
35
|
+
const resolved = resolveBranch(store, request, options);
|
|
36
|
+
const { branch } = resolved;
|
|
37
|
+
if (!branch) {
|
|
38
|
+
return { store, ...resolved, menu: void 0 };
|
|
39
|
+
}
|
|
40
|
+
const menu = await (early && branch.id === named ? early : client.menu.get({ branch: branch.id }));
|
|
41
|
+
return { store, ...resolved, menu };
|
|
42
|
+
}
|
|
25
43
|
export {
|
|
44
|
+
loadStoreAndMenu,
|
|
45
|
+
requestedBranch,
|
|
26
46
|
resolveBranch
|
|
27
47
|
};
|
|
28
48
|
//# sourceMappingURL=chosen-branch.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/server/chosen-branch.ts"],
|
|
4
|
-
"mappings": ";
|
|
4
|
+
"mappings": ";AA0BA,IAAM,OAAO,CAAC,OAAc,WAC1B,SACI,MAAM,SAAS,KAAK,CAAC,MAAM,EAAE,OAAO,UAAU,EAAE,SAAS,MAAM,IAC/D;AAEN,SAAS,WAAW,SAAkB,MAAc;AAClD,aAAW,SAAS,QAAQ,QAAQ,IAAI,QAAQ,KAAK,IAAI,MAAM,GAAG,GAAG;AACnE,UAAM,QAAQ,KAAK,QAAQ,GAAG;AAC9B,QAAI,QAAQ,KAAK,KAAK,MAAM,GAAG,KAAK,EAAE,KAAK,MAAM,MAAM;AACrD,UAAI;AACF,eAAO,mBAAmB,KAAK,MAAM,QAAQ,CAAC,EAAE,KAAK,CAAC;AAAA,MACxD,QAAQ;AACN,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAaO,SAAS,cACd,OACA,SACA,EAAE,QAAQ,UAAU,QAAQ,SAAS,GACrB;AAChB,QAAM,SACJ,KAAK,OAAO,IAAI,IAAI,QAAQ,GAAG,EAAE,aAAa,IAAI,KAAK,CAAC,KACxD,KAAK,OAAO,WAAW,SAAS,MAAM,CAAC;AACzC,QAAM,SACJ,UACA,KAAK,OAAO,QAAQ,KACpB,MAAM,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,KACtC,MAAM,SAAS,CAAC;AAClB,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,QAAQ,MAAM;AAAA,IACtB,YAAY,CAAC,UAAU,MAAM,SAAS,SAAS;AAAA,EACjD;AACF;AAaO,SAAS,gBACd,SACA,EAAE,QAAQ,UAAU,QAAQ,SAAS,GACjB;AACpB,SACE,IAAI,IAAI,QAAQ,GAAG,EAAE,aAAa,IAAI,KAAK,KAC3C,WAAW,SAAS,MAAM,KAC1B,YACA;AAEJ;AASA,IAAM,SAAS,MAAM;AAAC;AAuBtB,eAAsB,iBACpB,QACA,SACA,SACuB;AACvB,QAAM,QAAQ,gBAAgB,SAAS,OAAO;AAE9C,QAAM,QACJ,OAAO,WAAW,KAAK,KAAK,CAAC,OAAO,MAAM,KAAK,IAC3C,OAAO,UAAU,SAAS,OAAO,CAAC,CAAC,IACnC;AACN,SAAO,MAAM,MAAM;AACnB,QAAM,QAAQ,MAAM,OAAO,MAAM,IAAI;AACrC,QAAM,WAAW,cAAc,OAAO,SAAS,OAAO;AACtD,QAAM,EAAE,OAAO,IAAI;AACnB,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,OAAO,GAAG,UAAU,MAAM,OAAU;AAAA,EAC/C;AACA,QAAM,OAAO,OAAO,SAAS,OAAO,OAAO,QACvC,QACA,OAAO,KAAK,IAAI,EAAE,QAAQ,OAAO,GAAG,CAAC;AACzC,SAAO,EAAE,OAAO,GAAG,UAAU,KAAK;AACpC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Branch, Store, Menu, Formatters } from '../index.js';
|
|
2
|
-
import { C as Cache } from '../client-
|
|
3
|
-
import { ZappieError, ZappieConfig, Transport, StorageLike, StoreResource, MenuResource, ZappieEvents } from '../index.js';
|
|
2
|
+
import { C as Cache } from '../client-Bn7nRoy3.js';
|
|
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';
|
|
6
6
|
|
|
@@ -394,6 +394,46 @@ type ResolvedBranch = {
|
|
|
394
394
|
* @returns The branch to show, whether the shopper chose it, and whether to ask.
|
|
395
395
|
*/
|
|
396
396
|
declare function resolveBranch(store: Store, request: Request, { cookie, fallback, param }: ResolveBranchOptions): ResolvedBranch;
|
|
397
|
+
/**
|
|
398
|
+
* The branch a request names before you have the store: the link's query
|
|
399
|
+
* parameter, then the cookie, then the fallback, as `resolveBranch` tries
|
|
400
|
+
* them. It is the raw value, an ID or a slug, and may name no branch of the
|
|
401
|
+
* store. `loadStoreAndMenu` uses it to start the menu read alongside the
|
|
402
|
+
* store's when it is a branch ID (`br_…`).
|
|
403
|
+
*
|
|
404
|
+
* @param request - The incoming request.
|
|
405
|
+
* @param options - The site's branch cookie, and an optional fallback and query parameter.
|
|
406
|
+
* @returns The first branch value the request carries, or undefined.
|
|
407
|
+
*/
|
|
408
|
+
declare function requestedBranch(request: Request, { cookie, fallback, param }: ResolveBranchOptions): string | undefined;
|
|
409
|
+
/** The store, the branch a request shows and that branch's menu. */
|
|
410
|
+
type StoreAndMenu = ResolvedBranch & {
|
|
411
|
+
store: Store;
|
|
412
|
+
/** The branch's menu. Absent when the store has no branches. */
|
|
413
|
+
menu: Menu | undefined;
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* Read the store and the menu of the branch a request is for, as
|
|
417
|
+
* `resolveBranch` picks it. When the link, the cookie or the fallback names
|
|
418
|
+
* the branch by ID (`br_…`), the menu read starts alongside the store read,
|
|
419
|
+
* so a page render waits for one round trip instead of two. The menu counts
|
|
420
|
+
* only once the store confirms that branch, so you get the same menu and the
|
|
421
|
+
* same errors as `store.get` followed by `menu.get`. A branch named by slug,
|
|
422
|
+
* or none, reads the menu after the store, because the API takes branch IDs
|
|
423
|
+
* only.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* const { store, branch, chosen, mustChoose, menu } = await loadStoreAndMenu(client, request, {
|
|
427
|
+
* cookie: "site_branch",
|
|
428
|
+
* fallback: env.ZAPPIE_BRANCH,
|
|
429
|
+
* });
|
|
430
|
+
*
|
|
431
|
+
* @param client - A client created for the request.
|
|
432
|
+
* @param request - The incoming request.
|
|
433
|
+
* @param options - The site's branch cookie, and an optional fallback and query parameter.
|
|
434
|
+
* @returns The store, the branch to show, whether the shopper chose it, whether to ask, and the branch's menu.
|
|
435
|
+
*/
|
|
436
|
+
declare function loadStoreAndMenu(client: Zappie, request: Request, options: ResolveBranchOptions): Promise<StoreAndMenu>;
|
|
397
437
|
|
|
398
438
|
/**
|
|
399
439
|
* A branch catalogue as the edge keeps it: the SDK `Menu` that `menu.get()`
|
|
@@ -707,9 +747,12 @@ declare function createZappieServer({ secretKey, ...config }: ZappieServerConfig
|
|
|
707
747
|
cache: Cache;
|
|
708
748
|
emit: <E extends keyof ZappieEvents>(event: E, payload: ZappieEvents[E]) => void;
|
|
709
749
|
menuKey: (requested?: string) => string;
|
|
750
|
+
readMenu: (branchId: string, opts: MenuReadOptions & {
|
|
751
|
+
metadataOnly?: boolean;
|
|
752
|
+
}) => Promise<Menu>;
|
|
710
753
|
hydrateStore: (value: Store) => void;
|
|
711
754
|
};
|
|
712
755
|
}>;
|
|
713
756
|
|
|
714
|
-
export { STOREFRONT_QUERY_PARAMETERS, STOREFRONT_V1_QUERY_PARAMETERS, ZappieTokenError, ZappieWebhookSignatureError, applyAvailability, buildStorefrontUrl, canonicalJson, cookieSessionStore, createAvailabilityPatch, createMenuSnapshot, createPkce, createSecurityNonce, createStoreSnapshot, createTokenVerifier, createZappieServer, inlineScriptHashes, isMenuSnapshot, menuSnapshotFromPayload, openSealedValue, parseStorefrontUrl, randomToken, resolveBranch, sealValue, securityHeaders, signInRedirect, snapshotHash, snapshotKeys, storefrontRedirect, verifyWebhook };
|
|
715
|
-
export type { AvailabilityPatch, AvailabilityPatchInput, CookieSessionStoreOptions, EdgeSnapshotReader, IdTokenChecks, IdTokenClaims, MenuSnapshot, MenuSnapshotInput, MenuSnapshotPayloadInput, PkcePair, ResolveBranchOptions, ResolvedBranch, SealOptions, SealSecret, SecurityHeadersOptions, SessionData, SessionStore, SnapshotVersionRecord, StoreSnapshot, StorefrontInstallation, StorefrontPageState, StorefrontQuery, StorefrontRoute, StorefrontUrlInput, StorefrontUrlOptions, TokenAlgorithm, TokenClaims, TokenErrorReason, TokenVerifier, TokenVerifierOptions, VerifyTokenChecks, VerifyWebhookOptions, WebhookEvent, WebhookEventType, ZappieServerConfig };
|
|
757
|
+
export { STOREFRONT_QUERY_PARAMETERS, STOREFRONT_V1_QUERY_PARAMETERS, ZappieTokenError, ZappieWebhookSignatureError, applyAvailability, buildStorefrontUrl, canonicalJson, cookieSessionStore, createAvailabilityPatch, createMenuSnapshot, createPkce, createSecurityNonce, createStoreSnapshot, createTokenVerifier, createZappieServer, inlineScriptHashes, isMenuSnapshot, loadStoreAndMenu, menuSnapshotFromPayload, openSealedValue, parseStorefrontUrl, randomToken, requestedBranch, resolveBranch, sealValue, securityHeaders, signInRedirect, snapshotHash, snapshotKeys, storefrontRedirect, verifyWebhook };
|
|
758
|
+
export type { AvailabilityPatch, AvailabilityPatchInput, CookieSessionStoreOptions, EdgeSnapshotReader, IdTokenChecks, IdTokenClaims, MenuSnapshot, MenuSnapshotInput, MenuSnapshotPayloadInput, PkcePair, ResolveBranchOptions, ResolvedBranch, SealOptions, SealSecret, SecurityHeadersOptions, SessionData, SessionStore, SnapshotVersionRecord, StoreAndMenu, StoreSnapshot, StorefrontInstallation, StorefrontPageState, StorefrontQuery, StorefrontRoute, StorefrontUrlInput, StorefrontUrlOptions, TokenAlgorithm, TokenClaims, TokenErrorReason, TokenVerifier, TokenVerifierOptions, VerifyTokenChecks, VerifyWebhookOptions, WebhookEvent, WebhookEventType, ZappieServerConfig };
|
package/dist/server/index.js
CHANGED
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
cookieSessionStore
|
|
23
23
|
} from "./auth/session-store.js";
|
|
24
24
|
import {
|
|
25
|
+
loadStoreAndMenu,
|
|
26
|
+
requestedBranch,
|
|
25
27
|
resolveBranch
|
|
26
28
|
} from "./chosen-branch.js";
|
|
27
29
|
import {
|
|
@@ -70,10 +72,12 @@ export {
|
|
|
70
72
|
createZappieServer,
|
|
71
73
|
inlineScriptHashes,
|
|
72
74
|
isMenuSnapshot,
|
|
75
|
+
loadStoreAndMenu,
|
|
73
76
|
menuSnapshotFromPayload,
|
|
74
77
|
openSealedValue,
|
|
75
78
|
parseStorefrontUrl,
|
|
76
79
|
randomToken,
|
|
80
|
+
requestedBranch,
|
|
77
81
|
resolveBranch,
|
|
78
82
|
sealValue,
|
|
79
83
|
securityHeaders,
|
package/dist/server/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/server/index.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,mBAAmB;AAG5B,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OASK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,
|
|
4
|
+
"mappings": ";AAAA,SAAS,mBAAmB;AAG5B,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OASK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAQK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAUA,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,SAAO,YAAY,EAAE,GAAG,QAAQ,KAAK,UAAU,GAAG,IAAI;AACxD;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Cache } from '../client-
|
|
2
|
-
import { Transport, ZappieErrorCode, StorageLike, StoreResource, MenuResource, ZappieEvents } from '../index.js';
|
|
1
|
+
import { C as Cache } from '../client-Bn7nRoy3.js';
|
|
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';
|
|
5
5
|
import { CartModule, CartLineInput } from '../index.js';
|
|
@@ -45,6 +45,9 @@ declare function createMockZappie(input: MockFixtures, opts?: MockOptions): Read
|
|
|
45
45
|
cache: Cache;
|
|
46
46
|
emit: <E extends keyof ZappieEvents>(event: E, payload: ZappieEvents[E]) => void;
|
|
47
47
|
menuKey: (requested?: string) => string;
|
|
48
|
+
readMenu: (branchId: string, opts: MenuReadOptions & {
|
|
49
|
+
metadataOnly?: boolean;
|
|
50
|
+
}) => Promise<Menu>;
|
|
48
51
|
hydrateStore: (value: Store) => void;
|
|
49
52
|
};
|
|
50
53
|
}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { z as SelectedMenu,
|
|
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-Bn7nRoy3.js';
|
|
2
2
|
import '../models-C-kEg1Id.js';
|
|
3
3
|
import '../types-BzyzhqYz.js';
|