@zappie/sdk 0.1.19 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @zappie/sdk
2
2
 
3
+ ## 0.1.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 050600e: `@zappie/sdk/testing` ships without a source map. It is test-only code, and its 22.7 KB map filled the package's size budget.
8
+ - 050600e: Add `@zappie/sdk/vite` with `zappieSource()`, the Vite plugin that marks each element under `app/` with `data-zappie-source` (file and line) and `data-zappie-component` for Studio's region selector. It runs only on `vite dev` with `previewHost`, the `ZAPPIE_PREVIEW_HOST` Studio sets, so no build carries the attributes. It needs Vite 8, an optional peer, and adds no dependency.
9
+
3
10
  ## 0.1.19
4
11
 
5
12
  ### Patch Changes
package/dist/debug.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/debug.ts
2
- var VERSION = true ? "0.1.19" : "0.0.0-development";
2
+ var VERSION = true ? "0.1.20" : "0.0.0-development";
3
3
  function installDebug(client) {
4
4
  if (typeof window === "undefined" || client.mode !== "test") {
5
5
  return;
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.1.19" : "0.0.0-development";
13
+ var VERSION = true ? "0.1.20" : "0.0.0-development";
14
14
  export {
15
15
  API_VERSION,
16
16
  RestTransport,
@@ -448,4 +448,3 @@ export {
448
448
  createMockZappie,
449
449
  fixtures
450
450
  };
451
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,41 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /** The attribute that names the file and line rendering an element, in dev only. */
4
+ declare const SOURCE_ATTRIBUTE = "data-zappie-source";
5
+ /** The attribute that names the function component holding an element, in dev only. */
6
+ declare const COMPONENT_ATTRIBUTE = "data-zappie-component";
7
+ /** The options {@link zappieSource} takes. */
8
+ type ZappieSourceOptions = {
9
+ /** The draft host Studio serves the dev server behind, from `ZAPPIE_PREVIEW_HOST`. Without it the plugin is off. */
10
+ previewHost: string | undefined;
11
+ };
12
+ /** A file {@link markSource} marked: its new code and a source map back to the saved file. */
13
+ type MarkedSource = {
14
+ code: string;
15
+ map: {
16
+ version: 3;
17
+ sources: string[];
18
+ names: string[];
19
+ mappings: string;
20
+ };
21
+ };
22
+ /**
23
+ * Mark each intrinsic JSX element under `app/` with the file and line that render it, and the component that holds it,
24
+ * so the Studio preview can tell Zee where a region the merchant selected lives. It runs only on the Studio dev server:
25
+ * `vite dev` with `previewHost`, the `ZAPPIE_PREVIEW_HOST` that Studio sets, given. `vite build` never runs it, so no
26
+ * source path reaches a published site.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { zappieSource } from "@zappie/sdk/vite";
31
+ *
32
+ * export default defineConfig({
33
+ * plugins: [zappieSource({ previewHost: process.env.ZAPPIE_PREVIEW_HOST }), reactRouter()],
34
+ * });
35
+ * ```
36
+ */
37
+ declare function zappieSource({ previewHost }: ZappieSourceOptions): Plugin;
38
+ /** Add source and component attributes to the intrinsic elements of one saved `.tsx` or `.jsx` file. */
39
+ declare function markSource(code: string, file: string): MarkedSource | null;
40
+
41
+ export { COMPONENT_ATTRIBUTE, type MarkedSource, SOURCE_ATTRIBUTE, type ZappieSourceOptions, markSource, zappieSource };
@@ -0,0 +1,154 @@
1
+ // src/vite/index.ts
2
+ import { parseSync } from "vite";
3
+ var SOURCE_ATTRIBUTE = "data-zappie-source";
4
+ var COMPONENT_ATTRIBUTE = "data-zappie-component";
5
+ function zappieSource({ previewHost }) {
6
+ let root = "";
7
+ return {
8
+ name: "zappie-source",
9
+ enforce: "pre",
10
+ apply: (_config, { command }) => command === "serve" && Boolean(previewHost),
11
+ configResolved(config) {
12
+ root = config.root;
13
+ },
14
+ transform: {
15
+ filter: { id: /\.[jt]sx$/ },
16
+ handler(code, id) {
17
+ if (!id.startsWith(`${root}/`)) {
18
+ return null;
19
+ }
20
+ const file = id.slice(root.length + 1);
21
+ if (!file.startsWith("app/") || file.includes("node_modules/")) {
22
+ return null;
23
+ }
24
+ return markSource(code, file);
25
+ }
26
+ }
27
+ };
28
+ }
29
+ function markSource(code, file) {
30
+ if (!/^[\x21-\x7e]+$/.test(file)) {
31
+ return null;
32
+ }
33
+ const escaped = file.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;");
34
+ const parsed = parseSync(file, code);
35
+ if (parsed.errors.length > 0) {
36
+ return null;
37
+ }
38
+ const lineStarts = [0];
39
+ for (let index = code.indexOf("\n"); index !== -1; index = code.indexOf("\n", index + 1)) {
40
+ lineStarts.push(index + 1);
41
+ }
42
+ const lineOf = (offset) => {
43
+ let low = 0;
44
+ let high = lineStarts.length - 1;
45
+ while (low < high) {
46
+ const middle = low + high + 1 >> 1;
47
+ if (lineStarts[middle] <= offset) {
48
+ low = middle;
49
+ } else {
50
+ high = middle - 1;
51
+ }
52
+ }
53
+ return low;
54
+ };
55
+ const inserts = [];
56
+ const visit = (value, component) => {
57
+ if (!value || typeof value !== "object") {
58
+ return;
59
+ }
60
+ if (Array.isArray(value)) {
61
+ for (const entry of value) {
62
+ visit(entry, component);
63
+ }
64
+ return;
65
+ }
66
+ const node = value;
67
+ const named = componentName(node) ?? component;
68
+ if (node.type === "JSXOpeningElement") {
69
+ const name = node.name;
70
+ const attributes = node.attributes;
71
+ if (name.type === "JSXIdentifier" && typeof name.name === "string" && /^[a-z]/.test(name.name) && !attributes.some(
72
+ (attribute) => attribute.name?.name === SOURCE_ATTRIBUTE
73
+ )) {
74
+ const component2 = named ? ` ${COMPONENT_ATTRIBUTE}="${named}"` : "";
75
+ inserts.push([
76
+ name.end,
77
+ ` ${SOURCE_ATTRIBUTE}="${escaped}:${lineOf(node.start) + 1}"${component2}`
78
+ ]);
79
+ }
80
+ }
81
+ for (const key in node) {
82
+ if (key !== "type" && key !== "start" && key !== "end") {
83
+ visit(node[key], named);
84
+ }
85
+ }
86
+ };
87
+ visit(parsed.program, void 0);
88
+ if (inserts.length === 0) {
89
+ return null;
90
+ }
91
+ inserts.sort((a, b) => a[0] - b[0]);
92
+ let output = "";
93
+ let from = 0;
94
+ const lines = lineStarts.map(
95
+ () => [[0, 0]]
96
+ );
97
+ const added = lineStarts.map(() => 0);
98
+ for (const [offset, text] of inserts) {
99
+ output += code.slice(from, offset) + text;
100
+ from = offset;
101
+ const line = lineOf(offset);
102
+ const column = offset - lineStarts[line];
103
+ added[line] += text.length;
104
+ lines[line].push([column + added[line], column]);
105
+ }
106
+ output += code.slice(from);
107
+ let previousLine = 0;
108
+ let previousColumn = 0;
109
+ const mappings = lines.map((segments, line) => {
110
+ let previousGenerated = 0;
111
+ return segments.map(([generated, original]) => {
112
+ const encoded = vlq(generated - previousGenerated) + "A" + vlq(line - previousLine) + vlq(original - previousColumn);
113
+ previousGenerated = generated;
114
+ previousLine = line;
115
+ previousColumn = original;
116
+ return encoded;
117
+ }).join(",");
118
+ }).join(";");
119
+ return {
120
+ code: output,
121
+ map: { version: 3, sources: [file], names: [], mappings }
122
+ };
123
+ }
124
+ var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
125
+ function vlq(value) {
126
+ let rest = value < 0 ? -value << 1 | 1 : value << 1;
127
+ let encoded = "";
128
+ do {
129
+ let digit = rest & 31;
130
+ rest >>>= 5;
131
+ if (rest > 0) {
132
+ digit |= 32;
133
+ }
134
+ encoded += BASE64[digit];
135
+ } while (rest > 0);
136
+ return encoded;
137
+ }
138
+ function componentName(node) {
139
+ const id = node.id ?? void 0;
140
+ const capitalised = (name) => typeof name === "string" && /^[A-Z]/.test(name) ? name : void 0;
141
+ if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression") {
142
+ return capitalised(id?.name);
143
+ }
144
+ if (node.type === "VariableDeclarator" && id?.type === "Identifier") {
145
+ return capitalised(id.name);
146
+ }
147
+ return void 0;
148
+ }
149
+ export {
150
+ COMPONENT_ATTRIBUTE,
151
+ SOURCE_ATTRIBUTE,
152
+ markSource,
153
+ zappieSource
154
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappie/sdk",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Typed, framework-agnostic client for Zappie menus, carts, checkout, auth and events.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -93,6 +93,10 @@
93
93
  "types": "./dist/studio/index.d.ts",
94
94
  "import": "./dist/studio/index.js"
95
95
  },
96
+ "./vite": {
97
+ "types": "./dist/vite/index.d.ts",
98
+ "import": "./dist/vite/index.js"
99
+ },
96
100
  "./persist/catalogue": {
97
101
  "types": "./dist/persist/catalogue.d.ts",
98
102
  "import": "./dist/persist/catalogue.js"
@@ -115,11 +119,15 @@
115
119
  "CHANGELOG.md"
116
120
  ],
117
121
  "peerDependencies": {
118
- "react": "^18.2.0 || ^19.0.0"
122
+ "react": "^18.2.0 || ^19.0.0",
123
+ "vite": "^8.0.0"
119
124
  },
120
125
  "peerDependenciesMeta": {
121
126
  "react": {
122
127
  "optional": true
128
+ },
129
+ "vite": {
130
+ "optional": true
123
131
  }
124
132
  },
125
133
  "repository": {
@@ -132,8 +140,11 @@
132
140
  "bugs": {
133
141
  "url": "https://github.com/zappie/storefront-packages/issues"
134
142
  },
143
+ "devDependencies": {
144
+ "vite": "8.3.4"
145
+ },
135
146
  "scripts": {
136
- "build": "tsup && tsup --config tsup.checkout.config.ts && tsup --config tsup.checkout-defaults.config.ts && tsup --config tsup.customer.config.ts && tsup --config tsup.places.config.ts && tsup --config tsup.url.config.ts && tsup --config tsup.redirect.config.ts && tsup --config tsup.visits.config.ts && tsup --config tsup.pricing.config.ts && tsup --config tsup.site-config.config.ts && tsup --config tsup.template.config.ts && node ../../scripts/release-packages/build-modules.mjs --unmapped=studio/index.js",
147
+ "build": "tsup && tsup --config tsup.checkout.config.ts && tsup --config tsup.checkout-defaults.config.ts && tsup --config tsup.customer.config.ts && tsup --config tsup.places.config.ts && tsup --config tsup.url.config.ts && tsup --config tsup.redirect.config.ts && tsup --config tsup.visits.config.ts && tsup --config tsup.pricing.config.ts && tsup --config tsup.site-config.config.ts && tsup --config tsup.template.config.ts && node ../../scripts/release-packages/build-modules.mjs --unmapped=studio/index.js --unmapped=testing/index.js --unmapped=vite/index.js",
137
148
  "test": "vitest run --root ../.. packages/sdk/test",
138
149
  "size": "node ../../scripts/release-packages/size-sdk.mjs && size-limit"
139
150
  }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/testing/index.ts"],
4
- "sourcesContent": ["import { estimateUnitPrice } from \"../cart/price\";\nimport type { WireQuote } from \"../cart/types\";\nimport { validateLine } from \"../cart/validate\";\nimport { createZappie } from \"../client\";\nimport type { ZappieErrorCode } from \"../errors\";\nimport { ZappieError } from \"../errors\";\nimport { delay, throwIfAborted } from \"../internal/abort\";\nimport { multiplyMoney } from \"../internal/money-math\";\nimport type { Menu, Store } from \"../models\";\nimport { money } from \"../money\";\nimport type { RequestCtx, Transport } from \"../transport/types\";\nexport { VERSION } from \"../index\";\n/** Store and branch menus supplied to the deterministic mock transport. */\nexport type MockFixtures = { store: Store; menus: Record<string, Menu> };\n/** Mock timing and per-operation failures. */\nexport type MockOptions = {\n latencyMs?: number;\n failWith?: Partial<Record<keyof Transport, ZappieErrorCode>>;\n};\n/** Create an isolated in-memory SDK client without making network requests. */\nexport function createMockZappie(input: MockFixtures, opts: MockOptions = {}) {\n const fixtures = structuredClone(input);\n const before = async (method: keyof Transport, ctx: RequestCtx) => {\n throwIfAborted(ctx.signal);\n if (opts.latencyMs) {\n await delay(opts.latencyMs, ctx.signal);\n }\n const code = opts.failWith?.[method];\n if (code) {\n throw new ZappieError(code, `Mock ${method} failure`);\n }\n };\n const menu = (id: string) => {\n const value = fixtures.menus[id];\n if (!value) {\n throw new ZappieError(\"branch_not_found\", \"No fixture for this branch\");\n }\n return structuredClone(value);\n };\n const transport: Transport = {\n async quote(ctx, body): Promise<WireQuote> {\n await before(\"quote\", ctx);\n const value = menu(body.branch_id);\n const branch = fixtures.store.branches.find(\n (b) => b.id === body.branch_id,\n )!;\n const issues: WireQuote[\"issues\"] = [];\n const lines = body.lines.map((line) => {\n const item = value.items[line.item_id];\n const input = {\n itemId: line.item_id,\n ...(line.menu_id !== undefined ? { menuId: line.menu_id } : {}),\n quantity: line.quantity,\n choices: line.options.map((c) => ({\n groupId: c.group_id,\n choiceId: c.choice_id,\n quantity: c.quantity,\n })),\n inputs: line.inputs,\n ...(line.variant_id ? { variantId: line.variant_id } : {}),\n };\n const invalid = validateLine(item, input, { menu: value, branch });\n issues.push(\n ...invalid.map((i) => ({\n code: i.code,\n severity: i.severity,\n message: i.message,\n line_id: line.line_id,\n ...(i.groupId ? { group_id: i.groupId } : {}),\n fixes: [],\n })),\n );\n const price =\n item && !invalid.length\n ? estimateUnitPrice(item, input)\n : money(0, fixtures.store.currency);\n return {\n line_id: line.line_id,\n unit_price: {\n amount_minor: price.amountMinor,\n currency: price.currency,\n },\n line_total: {\n amount_minor: multiplyMoney(price, line.quantity).amountMinor,\n currency: price.currency,\n },\n };\n });\n const subtotal = {\n amount_minor: lines.reduce((n, l) => n + l.line_total.amount_minor, 0),\n currency: fixtures.store.currency,\n };\n return {\n branch_id: body.branch_id,\n lines,\n subtotal,\n total: subtotal,\n charges: [],\n discounts: [],\n issues,\n can_checkout: !issues.some((issue) => issue.severity === \"blocking\"),\n checkout: issues.some((issue) => issue.severity === \"blocking\")\n ? { ready: false, reason: \"issues\" }\n : { ready: true },\n menu_version: value.version,\n expires_at: new Date(Date.now() + 300_000).toISOString(),\n };\n },\n async getStore(ctx) {\n await before(\"getStore\", ctx);\n return structuredClone(fixtures.store);\n },\n async getMenu(ctx) {\n await before(\"getMenu\", ctx);\n const value = menu(ctx.branchId);\n return ctx.ifNoneMatch === value.version\n ? { notModified: true }\n : { menu: value, etag: value.version };\n },\n async getMenuVersion(ctx) {\n await before(\"getMenuVersion\", ctx);\n const value = menu(ctx.branchId);\n return { version: value.version, availabilityHash: value.version };\n },\n async getItem(ctx) {\n await before(\"getItem\", ctx);\n const value = menu(ctx.branchId).items[ctx.itemId];\n if (!value) {\n throw new ZappieError(\"item_not_found\", \"Item not found\");\n }\n return value;\n },\n };\n return createZappie({\n store: fixtures.store.slug,\n key: \"pk_test_fixture\",\n transport,\n });\n}\nconst fulfilment = {\n pickup: true,\n delivery: true,\n dineIn: false,\n scheduling: false,\n};\nconst store: Store = {\n id: \"biz_fixture\",\n slug: \"default-store\",\n name: \"Default storefront\",\n currency: \"NGN\",\n timezone: \"Africa/Lagos\",\n brand: {},\n fulfilment,\n paymentMethods: [\"card\"],\n branches: [\n {\n id: \"br_fixture\",\n slug: \"main\",\n name: \"Main\",\n openingTimes: [{ day: 1, opens: \"08:00\", closes: \"22:00\" }],\n isOpen: true,\n fulfilment,\n },\n ],\n};\nconst menu: Menu = {\n id: \"menu_fixture\",\n branchId: \"br_fixture\",\n name: \"Menu\",\n version: \"fixture-v1\",\n categories: [{ id: \"cat_fixture\", name: \"Food\", itemIds: [\"item_fixture\"] }],\n items: {\n item_fixture: {\n id: \"item_fixture\",\n name: \"Lunch\",\n images: [],\n price: money(650000, \"NGN\"),\n isAvailable: true,\n quantity: { min: 1, step: 1 },\n variants: [\n {\n id: \"variant_fixture\",\n attributeChoices: {},\n price: money(650000, \"NGN\"),\n isAvailable: true,\n },\n ],\n optionGroups: [],\n tags: [],\n },\n },\n};\nconst ngn = (amountMinor: number) => money(amountMinor, \"NGN\");\nconst templateStore: Store = {\n id: \"biz_template\",\n slug: \"default-template\",\n name: \"Default template\",\n description: \"A public storefront fixture for template authors.\",\n templateSettings: {\n accent: \"#175c3a\",\n headerPhoto: \"https://example.com/default-template-cover.png\",\n },\n currency: \"NGN\",\n timezone: \"Africa/Lagos\",\n brand: {\n logoUrl: \"https://example.com/default-template-logo.png\",\n coverImageUrl: \"https://example.com/default-template-cover.png\",\n },\n fulfilment: { pickup: true, delivery: true, dineIn: true, scheduling: true },\n paymentMethods: [\"card\", \"bank_transfer\", \"wallet\"],\n branches: [\n {\n id: \"br_template_main\",\n slug: \"main\",\n name: \"Main\",\n timezone: \"Africa/Lagos\",\n address: \"1 Example Street, Lagos\",\n phone: \"+234 800 000 0000\",\n pickupAddress: {\n placeId: \"place_template_main\",\n coordinates: { lat: 6.5244, lng: 3.3792 },\n },\n socialLinks: [\n { type: \"INSTAGRAM\", url: \"https://instagram.com/default-template\" },\n { type: \"WEBSITE\", url: \"https://example.com\" },\n ],\n openingTimes: [1, 2, 3, 4, 5].map((day) => ({\n day: day as 1 | 2 | 3 | 4 | 5,\n opens: \"08:00\",\n closes: \"22:00\",\n })),\n isOpen: true,\n isDefault: true,\n fulfilment: {\n pickup: true,\n delivery: true,\n dineIn: true,\n scheduling: true,\n },\n minimumOrder: ngn(200000),\n },\n {\n id: \"br_template_island\",\n slug: \"island\",\n name: \"Island\",\n timezone: \"Africa/Lagos\",\n openingTimes: [{ day: 6, opens: \"10:00\", closes: \"18:00\" }],\n specialHours: [{ date: \"2026-12-25\", closed: true }],\n isOpen: false,\n closedUntil: \"2026-12-26T10:00:00+01:00\",\n fulfilment: {\n pickup: false,\n delivery: true,\n dineIn: false,\n scheduling: false,\n },\n },\n ],\n};\nconst templateMenu: Menu = {\n id: \"menu_template\",\n branchId: \"br_template_main\",\n name: \"All day\",\n version: \"template-v1\",\n categories: [\n {\n id: \"cat_popular\",\n name: \"Popular\",\n itemIds: [\"item_jollof\", \"item_zobo\"],\n },\n { id: \"cat_mains\", name: \"Mains\", itemIds: [\"item_jollof\"] },\n {\n id: \"cat_drinks\",\n name: \"Drinks and desserts\",\n itemIds: [\"item_zobo\", \"item_cake\"],\n },\n ],\n items: {\n item_jollof: {\n id: \"item_jollof\",\n name: \"Jollof rice\",\n description: \"Smoky party jollof.\",\n images: [],\n price: ngn(450000),\n isAvailable: true,\n quantity: { min: 1, max: 10, step: 1 },\n variants: [\n {\n id: \"variant_jollof\",\n attributeChoices: {},\n price: ngn(450000),\n isAvailable: true,\n },\n ],\n optionGroups: [\n {\n id: \"grp_protein\",\n name: \"Protein\",\n kind: \"select\",\n required: true,\n selection: { min: 1, max: 1 },\n isAttribute: false,\n choices: [\n {\n id: \"opt_chicken\",\n name: \"Chicken\",\n price: ngn(0),\n isAvailable: true,\n },\n {\n id: \"opt_beef\",\n name: \"Beef\",\n price: ngn(50000),\n isAvailable: true,\n },\n {\n id: \"opt_fish\",\n name: \"Fish\",\n price: ngn(80000),\n isAvailable: false,\n },\n ],\n },\n {\n id: \"grp_sauce\",\n name: \"Sauce\",\n helpText: \"Required with chicken.\",\n kind: \"select\",\n required: false,\n selection: { min: 0, max: 1 },\n isAttribute: false,\n choices: [\n {\n id: \"opt_pepper\",\n name: \"Pepper sauce\",\n price: ngn(0),\n isAvailable: true,\n },\n {\n id: \"opt_stew\",\n name: \"Stew\",\n price: ngn(20000),\n isAvailable: true,\n },\n ],\n conditions: [\n {\n groupId: \"grp_protein\",\n choiceIds: [\"opt_chicken\"],\n match: \"any\",\n setRequired: true,\n setMin: 1,\n },\n ],\n },\n {\n id: \"grp_extras\",\n name: \"Extras\",\n kind: \"select\",\n required: false,\n selection: { min: 0, max: 3 },\n isAttribute: false,\n choices: [\n {\n id: \"opt_plantain\",\n name: \"Plantain\",\n price: ngn(30000),\n isAvailable: true,\n quantity: { min: 1, max: 3 },\n },\n {\n id: \"opt_egg\",\n name: \"Boiled egg\",\n price: ngn(15000),\n isAvailable: true,\n },\n ],\n },\n {\n id: \"grp_note\",\n name: \"Note for the kitchen\",\n kind: \"text\",\n required: false,\n selection: { min: 0 },\n isAttribute: false,\n choices: [],\n input: { maxLength: 140, placeholder: \"No onions, please\" },\n },\n ],\n tags: [\"popular\"],\n },\n item_zobo: {\n id: \"item_zobo\",\n name: \"Zobo\",\n images: [],\n price: ngn(120000),\n isAvailable: true,\n quantity: { min: 1, step: 1 },\n variants: [\n {\n id: \"variant_zobo_small\",\n attributeChoices: { grp_size: \"opt_small\" },\n price: ngn(120000),\n isAvailable: true,\n },\n {\n id: \"variant_zobo_large\",\n attributeChoices: { grp_size: \"opt_large\" },\n price: ngn(200000),\n isAvailable: false,\n },\n ],\n optionGroups: [\n {\n id: \"grp_size\",\n name: \"Size\",\n kind: \"select\",\n required: true,\n selection: { min: 1, max: 1 },\n isAttribute: true,\n choices: [\n {\n id: \"opt_small\",\n name: \"Small\",\n price: ngn(0),\n isAvailable: true,\n },\n {\n id: \"opt_large\",\n name: \"Large\",\n price: ngn(0),\n isAvailable: false,\n },\n ],\n },\n ],\n tags: [],\n },\n item_cake: {\n id: \"item_cake\",\n name: \"Chocolate cake\",\n images: [],\n price: ngn(350000),\n compareAtPrice: ngn(400000),\n isAvailable: false,\n quantity: { min: 1, step: 1 },\n variants: [\n {\n id: \"variant_cake\",\n attributeChoices: {},\n price: ngn(350000),\n isAvailable: false,\n },\n ],\n optionGroups: [],\n tags: [],\n },\n },\n};\n/**\n * Sample data with no merchant IDs or photos. `minimal` has one plain item.\n * `defaultTemplate` covers several branches, shared category membership, required and\n * conditional options, per-choice quantities, text input and attribute variants.\n */\nexport const fixtures = {\n minimal: { store, menu },\n defaultTemplate: { store: templateStore, menu: templateMenu },\n};\n"],
5
- "mappings": ";AAAA,SAAS,yBAAyB;AAElC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAE7B,SAAS,mBAAmB;AAC5B,SAAS,OAAO,sBAAsB;AACtC,SAAS,qBAAqB;AAE9B,SAAS,aAAa;AAEtB,SAAS,eAAe;AASjB,SAAS,iBAAiB,OAAqB,OAAoB,CAAC,GAAG;AAC5E,QAAMA,YAAW,gBAAgB,KAAK;AACtC,QAAM,SAAS,OAAO,QAAyB,QAAoB;AACjE,mBAAe,IAAI,MAAM;AACzB,QAAI,KAAK,WAAW;AAClB,YAAM,MAAM,KAAK,WAAW,IAAI,MAAM;AAAA,IACxC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