@composable-os/pack-offers 0.0.0-stage → 0.1.0-beta.16

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/index.js ADDED
@@ -0,0 +1,316 @@
1
+ // Offers (stage 34, step 5): money off, as records. A **discount** says what is off (a percentage,
2
+ // an amount, or a set price), on what (drop-in classes, event tickets, passes, courses, shop
3
+ // goods), for whom (anyone, signed-in customers, members, new customers, an organisation, a tag),
4
+ // when, and how often; it applies by a **promo code** the buyer types (one shared word, or a batch
5
+ // of single-use codes) or **by itself** (a member's price, a customer rate). The pack's records are
6
+ // discounts and codes; the word "offer" alone is not used for them (CONTEXT.md).
7
+ //
8
+ // Everything that is a rule is the host's, declared here as the `discount` behaviour (ADR 0693):
9
+ // - the host reads a live discount when it prices an order (`priceOrder`), works out the order's
10
+ // one deal (the better of the code and every price that applies by itself, a tie to the
11
+ // automatic one), keeps the limits in the order's batch, and gives a buyer one answer for every
12
+ // code that does not apply. Nothing here computes a price, a percentage or who qualifies;
13
+ // - a discount is made in `draft` and moved live only through this pack's tools, which a person
14
+ // calls or approves (`activateDiscount`, `personApproves`, `offers:manage`); pausing and ending
15
+ // it likewise. Any change to a live discount by an assistant, an MCP client, an automation or
16
+ // extension code waits for a person (the host's, ADR 0693);
17
+ // - single-use codes are kept as their hash (`codes.hashed`, ADR 0699): the host hashes what a
18
+ // buyer types and looks it up by its index; nobody who reads a record, the audit log or a
19
+ // query over the views can see a code. A batch's codes are shown once, to the person who makes
20
+ // them (`generateCodes`, `humanOnly`); any other write of a code waits for a person (the host's);
21
+ // - discounts and codes are staff records: nothing of them is public or a customer's. A buyer
22
+ // learns of a discount only through the host's `discount.check`, `order.quote` and the order's
23
+ // deal.
24
+ // The tools in tools.ts compose the host's operations and hold no rule of their own.
25
+ import { defineExtension } from "@composable-os/sdk";
26
+ import { offersDashboards } from "./dashboards.js";
27
+ import { activateDiscount, changeDiscount, codeBatches, DISCOUNT_STATES, DISCOUNT_WHO_OPTIONS, discounts, draftDiscount, endDiscount, generateCodes, pauseDiscount, SOLD_OBJECTS, voidBatch, voidCodes, } from "./tools.js";
28
+ export default defineExtension({
29
+ id: "offers",
30
+ version: "0.1.0",
31
+ contractVersion: 1,
32
+ label: "Offers",
33
+ description: "Discounts the host applies when it prices an order: promo codes for a campaign, batches of " +
34
+ "single-use codes, members' prices and customer rates, each with its dates, limits and who " +
35
+ "it is for, made live by a person.",
36
+ permissions: {
37
+ // query.sql: the discounts' uses and what they gave (rec_discount_use, rec_order_adjustment)
38
+ // for the staff lists and the dashboard.
39
+ operations: ["query.sql"],
40
+ modules: ["ops"],
41
+ },
42
+ objects: {
43
+ discount: {
44
+ label: "Discount",
45
+ plural: "Discounts",
46
+ icon: "percent",
47
+ titleField: "name",
48
+ description: "Money off: a percentage, an amount or a set price, on what it covers, for whom, when " +
49
+ "and how often. Applied by a promo code or by itself (a member's price). Made as a draft " +
50
+ "and made live by a person.",
51
+ navigation: "main",
52
+ navigationOrder: 30,
53
+ fields: {
54
+ name: {
55
+ type: "text",
56
+ label: "Name",
57
+ required: true,
58
+ description: "What staff and the buyer's order call it (January sale, Members' drop-in).",
59
+ },
60
+ note: { type: "longText", label: "Note", description: "Why it exists, for staff." },
61
+ kind: {
62
+ type: "select",
63
+ label: "What is off",
64
+ required: true,
65
+ default: "percent",
66
+ options: [
67
+ { value: "percent", label: "A percentage off" },
68
+ { value: "amount", label: "An amount off the order" },
69
+ { value: "price", label: "A set price for each" },
70
+ ],
71
+ },
72
+ percent: {
73
+ type: "number",
74
+ label: "Percentage off",
75
+ description: "For a percentage: 1 to 100. Rounded down on each line by the host.",
76
+ min: 1,
77
+ max: 100,
78
+ },
79
+ amount: {
80
+ type: "currency",
81
+ label: "Amount",
82
+ description: "For an amount off: the money off the order, spread over what it covers. For a set " +
83
+ "price: what each one costs (never more than its own price).",
84
+ min: 0,
85
+ },
86
+ automatic: {
87
+ type: "boolean",
88
+ label: "Applies by itself",
89
+ default: false,
90
+ description: "On: it applies with no code to everyone it is for (a member's price, a customer " +
91
+ "rate). Off: only with a code.",
92
+ },
93
+ code: {
94
+ type: "text",
95
+ label: "Promo code",
96
+ description: "One word anyone may type (JANUARY26), at least 6 letters or digits. Kept in capitals " +
97
+ "without spaces; no two discounts share one. For single-use codes, make a batch.",
98
+ },
99
+ who: {
100
+ type: "select",
101
+ label: "Who it is for",
102
+ default: "anyone",
103
+ options: DISCOUNT_WHO_OPTIONS,
104
+ description: "Anyone includes a guest. Every other choice needs a buyer who signed in (or staff " +
105
+ "buying for a person): a guest never gets it.",
106
+ },
107
+ organisations: {
108
+ type: "relation",
109
+ label: "Organisations",
110
+ to: "organisation",
111
+ many: true,
112
+ description: "For an organisation's people: a customer rate.",
113
+ },
114
+ tag: { type: "text", label: "Tag", description: "For people with this tag." },
115
+ appliesTo: {
116
+ type: "multiSelect",
117
+ label: "Applies to",
118
+ options: SOLD_OBJECTS,
119
+ description: "What it takes money off. Empty: everything but postage.",
120
+ },
121
+ from: { type: "date", label: "From", description: "From the start of this day (UTC)." },
122
+ until: { type: "date", label: "Until", description: "To the end of this day (UTC)." },
123
+ totalUses: {
124
+ type: "number",
125
+ label: "Uses in total",
126
+ description: "The most orders it may be used on, across everyone. Empty: no limit.",
127
+ min: 1,
128
+ step: 1,
129
+ },
130
+ perPerson: {
131
+ type: "number",
132
+ label: "Uses per person",
133
+ description: "The most orders one person may use it on (addresses with a +tag count as one). A " +
134
+ "guest never gets a discount with this limit. Empty: no limit.",
135
+ min: 1,
136
+ step: 1,
137
+ },
138
+ minSpend: {
139
+ type: "currency",
140
+ label: "Minimum spend",
141
+ description: "The least what it covers must cost on the order. Empty: none.",
142
+ min: 0,
143
+ },
144
+ state: {
145
+ type: "select",
146
+ label: "State",
147
+ default: "draft",
148
+ track: "timeline",
149
+ options: DISCOUNT_STATES,
150
+ },
151
+ },
152
+ states: {
153
+ field: "state",
154
+ initial: "draft",
155
+ // Every move is a person's, through a tool a person calls or approves (ADR 0693): an
156
+ // assistant's request waits. Paused and back changes nothing a buyer is charged but is
157
+ // the same person's decision.
158
+ moves: [
159
+ {
160
+ from: ["draft", "paused"],
161
+ to: "active",
162
+ by: ["host"],
163
+ tools: ["activateDiscount"],
164
+ },
165
+ { from: "active", to: "paused", by: ["host"], tools: ["pauseDiscount"] },
166
+ {
167
+ from: ["draft", "active", "paused"],
168
+ to: "ended",
169
+ by: ["host"],
170
+ tools: ["endDiscount"],
171
+ final: true,
172
+ },
173
+ ],
174
+ },
175
+ discount: {
176
+ kind: "kind",
177
+ percent: "percent",
178
+ amount: "amount",
179
+ live: ["active"],
180
+ automatic: "automatic",
181
+ code: "code",
182
+ codes: {
183
+ object: "code",
184
+ discount: "discount",
185
+ word: "word",
186
+ uses: "uses",
187
+ active: "active",
188
+ hashed: true,
189
+ },
190
+ who: "who",
191
+ organisations: "organisations",
192
+ tag: "tag",
193
+ objects: "appliesTo",
194
+ from: "from",
195
+ until: "until",
196
+ totalUses: "totalUses",
197
+ perPerson: "perPerson",
198
+ minSpend: "minSpend",
199
+ },
200
+ indexes: [["state"], ["automatic", "state"]],
201
+ },
202
+ code: {
203
+ label: "Single-use code",
204
+ plural: "Single-use codes",
205
+ icon: "ticket",
206
+ titleField: "label",
207
+ description: "One of a batch of codes made for a discount, each good for a set number of orders (one, " +
208
+ "by default). Kept as its hash: the codes are shown once, to the person who makes them.",
209
+ navigation: "none",
210
+ fields: {
211
+ label: {
212
+ type: "text",
213
+ label: "Label",
214
+ readOnly: true,
215
+ description: "The batch and the code's number in it.",
216
+ },
217
+ discount: {
218
+ type: "relation",
219
+ label: "Discount",
220
+ to: "offers.discount",
221
+ readOnly: true,
222
+ },
223
+ batch: { type: "text", label: "Batch", readOnly: true },
224
+ word: {
225
+ type: "text",
226
+ label: "Code (its hash)",
227
+ readOnly: true,
228
+ description: "What the host keeps of the code: its hash, never the code.",
229
+ },
230
+ uses: {
231
+ type: "number",
232
+ label: "Orders per code",
233
+ readOnly: true,
234
+ min: 1,
235
+ step: 1,
236
+ description: "The most orders this code may be used on.",
237
+ },
238
+ active: {
239
+ type: "boolean",
240
+ label: "Works",
241
+ default: true,
242
+ description: "Off: the code is void. Switched off by voidBatch, voidCodes or a person.",
243
+ },
244
+ madeBy: { type: "text", label: "Made by", readOnly: true },
245
+ },
246
+ indexes: [["discount", "batch"]],
247
+ },
248
+ },
249
+ views: {
250
+ liveDiscounts: {
251
+ label: "Live",
252
+ object: "offers.discount",
253
+ filter: { field: "state", op: "eq", value: "active" },
254
+ sort: { field: "name", direction: "asc" },
255
+ columns: ["name", "kind", "percent", "amount", "code", "automatic", "who", "until"],
256
+ },
257
+ draftDiscounts: {
258
+ label: "Drafts",
259
+ object: "offers.discount",
260
+ filter: { field: "state", op: "eq", value: "draft" },
261
+ sort: { field: "createdAt", direction: "desc" },
262
+ columns: ["name", "kind", "percent", "amount", "code", "automatic", "who", "createdAt"],
263
+ },
264
+ memberPrices: {
265
+ label: "Members' prices and customer rates",
266
+ object: "offers.discount",
267
+ filter: {
268
+ and: [
269
+ { field: "automatic", op: "eq", value: true },
270
+ { field: "state", op: "in", value: ["draft", "active", "paused"] },
271
+ ],
272
+ },
273
+ sort: { field: "name", direction: "asc" },
274
+ columns: ["name", "who", "kind", "percent", "amount", "appliesTo", "state"],
275
+ },
276
+ promoCodes: {
277
+ label: "Promo codes",
278
+ object: "offers.discount",
279
+ filter: {
280
+ and: [
281
+ { field: "code", op: "is_not_null" },
282
+ { field: "state", op: "in", value: ["draft", "active", "paused"] },
283
+ ],
284
+ },
285
+ sort: { field: "name", direction: "asc" },
286
+ columns: ["name", "code", "kind", "percent", "amount", "from", "until", "state"],
287
+ },
288
+ },
289
+ dashboards: offersDashboards,
290
+ recordTabs: {
291
+ discountCodes: {
292
+ label: "Single-use codes",
293
+ on: "offers.discount",
294
+ view: {
295
+ type: "table",
296
+ object: "offers.code",
297
+ relation: "discount",
298
+ columns: ["label", "batch", "uses", "active", "madeBy", "createdAt"],
299
+ sort: { field: "createdAt", direction: "desc" },
300
+ },
301
+ order: 10,
302
+ },
303
+ },
304
+ tools: {
305
+ discounts,
306
+ codeBatches,
307
+ draftDiscount,
308
+ changeDiscount,
309
+ activateDiscount,
310
+ pauseDiscount,
311
+ endDiscount,
312
+ generateCodes,
313
+ voidBatch,
314
+ voidCodes,
315
+ },
316
+ });
@@ -0,0 +1,285 @@
1
+ import { z } from "@composable-os/sdk";
2
+ export declare const DISCOUNT = "offers.discount";
3
+ export declare const CODE = "offers.code";
4
+ /** What a discount may cover: the objects the shipped packs sell, one at a time. */
5
+ export declare const SOLD_OBJECTS: readonly [{
6
+ readonly value: "bookings.booking";
7
+ readonly label: "Drop-in classes";
8
+ }, {
9
+ readonly value: "ticketing.tickettype";
10
+ readonly label: "Event tickets";
11
+ }, {
12
+ readonly value: "memberships.passtype";
13
+ readonly label: "Class passes";
14
+ }, {
15
+ readonly value: "courses.course";
16
+ readonly label: "Courses";
17
+ }, {
18
+ readonly value: "courses.bundle";
19
+ readonly label: "Course bundles";
20
+ }, {
21
+ readonly value: "shop.variant";
22
+ readonly label: "Shop goods";
23
+ }];
24
+ /** Who a discount is for, as the host's `discount.who` knows them (DISCOUNT_WHO in the SDK). */
25
+ export declare const DISCOUNT_WHO_OPTIONS: readonly [{
26
+ readonly value: "anyone";
27
+ readonly label: "Anyone, guests included";
28
+ }, {
29
+ readonly value: "signed_in";
30
+ readonly label: "Signed-in customers";
31
+ }, {
32
+ readonly value: "members";
33
+ readonly label: "Members (a live membership)";
34
+ }, {
35
+ readonly value: "new_customers";
36
+ readonly label: "New customers";
37
+ }, {
38
+ readonly value: "organisation";
39
+ readonly label: "People of an organisation";
40
+ }, {
41
+ readonly value: "tag";
42
+ readonly label: "People with a tag";
43
+ }];
44
+ export declare const DISCOUNT_STATES: readonly [{
45
+ readonly value: "draft";
46
+ readonly label: "Draft";
47
+ }, {
48
+ readonly value: "active";
49
+ readonly label: "Live";
50
+ }, {
51
+ readonly value: "paused";
52
+ readonly label: "Paused";
53
+ }, {
54
+ readonly value: "ended";
55
+ readonly label: "Ended";
56
+ }];
57
+ /** The most single-use codes one call makes, and how many are written per host call. */
58
+ export declare const BATCH_MAX = 500;
59
+ export declare const WRITE_CHUNK = 50;
60
+ /** The most codes one call of voidCodes switches off. */
61
+ export declare const VOID_MAX = 200;
62
+ /** A record as record.get and record.list return it. */
63
+ export interface HostRecord {
64
+ id: string;
65
+ title: string | null;
66
+ values: Record<string, unknown>;
67
+ }
68
+ export declare const DISCOUNTS_LIMIT = 100;
69
+ export declare const discounts: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
70
+ state: z.ZodOptional<z.ZodEnum<{
71
+ draft: "draft";
72
+ active: "active";
73
+ paused: "paused";
74
+ ended: "ended";
75
+ }>>;
76
+ automatic: z.ZodOptional<z.ZodBoolean>;
77
+ }, z.core.$strip>, z.ZodObject<{
78
+ discounts: z.ZodArray<z.ZodObject<{
79
+ id: z.ZodString;
80
+ name: z.ZodNullable<z.ZodString>;
81
+ state: z.ZodNullable<z.ZodString>;
82
+ kind: z.ZodNullable<z.ZodString>;
83
+ percent: z.ZodNullable<z.ZodNumber>;
84
+ amount: z.ZodNullable<z.ZodNumber>;
85
+ automatic: z.ZodBoolean;
86
+ code: z.ZodNullable<z.ZodString>;
87
+ who: z.ZodNullable<z.ZodString>;
88
+ appliesTo: z.ZodArray<z.ZodString>;
89
+ from: z.ZodNullable<z.ZodString>;
90
+ until: z.ZodNullable<z.ZodString>;
91
+ totalUses: z.ZodNullable<z.ZodNumber>;
92
+ perPerson: z.ZodNullable<z.ZodNumber>;
93
+ minSpend: z.ZodNullable<z.ZodNumber>;
94
+ used: z.ZodNumber;
95
+ held: z.ZodNumber;
96
+ given: z.ZodNumber;
97
+ }, z.core.$strip>>;
98
+ truncated: z.ZodBoolean;
99
+ }, z.core.$strip>>;
100
+ export declare const codeBatches: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
101
+ discountId: z.ZodString;
102
+ }, z.core.$strip>, z.ZodObject<{
103
+ batches: z.ZodArray<z.ZodObject<{
104
+ batch: z.ZodNullable<z.ZodString>;
105
+ made: z.ZodNumber;
106
+ working: z.ZodNumber;
107
+ used: z.ZodNumber;
108
+ usesPerCode: z.ZodNullable<z.ZodNumber>;
109
+ madeBy: z.ZodNullable<z.ZodString>;
110
+ madeAt: z.ZodNullable<z.ZodString>;
111
+ }, z.core.$strip>>;
112
+ }, z.core.$strip>>;
113
+ export declare const draftDiscount: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
114
+ name: z.ZodString;
115
+ kind: z.ZodEnum<{
116
+ percent: "percent";
117
+ amount: "amount";
118
+ price: "price";
119
+ }>;
120
+ percent: z.ZodOptional<z.ZodNumber>;
121
+ amount: z.ZodOptional<z.ZodNumber>;
122
+ automatic: z.ZodOptional<z.ZodBoolean>;
123
+ code: z.ZodOptional<z.ZodString>;
124
+ who: z.ZodOptional<z.ZodEnum<{
125
+ [x: string]: string;
126
+ }>>;
127
+ organisations: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ tag: z.ZodOptional<z.ZodString>;
129
+ appliesTo: z.ZodOptional<z.ZodArray<z.ZodEnum<{
130
+ [x: string]: string;
131
+ }>>>;
132
+ from: z.ZodOptional<z.ZodString>;
133
+ until: z.ZodOptional<z.ZodString>;
134
+ totalUses: z.ZodOptional<z.ZodNumber>;
135
+ perPerson: z.ZodOptional<z.ZodNumber>;
136
+ minSpend: z.ZodOptional<z.ZodNumber>;
137
+ note: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strip>, z.ZodObject<{
139
+ id: z.ZodString;
140
+ name: z.ZodNullable<z.ZodString>;
141
+ state: z.ZodNullable<z.ZodString>;
142
+ kind: z.ZodNullable<z.ZodString>;
143
+ percent: z.ZodNullable<z.ZodNumber>;
144
+ amount: z.ZodNullable<z.ZodNumber>;
145
+ automatic: z.ZodBoolean;
146
+ code: z.ZodNullable<z.ZodString>;
147
+ who: z.ZodNullable<z.ZodString>;
148
+ appliesTo: z.ZodArray<z.ZodString>;
149
+ from: z.ZodNullable<z.ZodString>;
150
+ until: z.ZodNullable<z.ZodString>;
151
+ totalUses: z.ZodNullable<z.ZodNumber>;
152
+ perPerson: z.ZodNullable<z.ZodNumber>;
153
+ minSpend: z.ZodNullable<z.ZodNumber>;
154
+ open: z.ZodObject<{
155
+ object: z.ZodString;
156
+ id: z.ZodString;
157
+ }, z.core.$strip>;
158
+ }, z.core.$strip>>;
159
+ export declare const changeDiscount: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
160
+ discountId: z.ZodString;
161
+ name: z.ZodOptional<z.ZodString>;
162
+ kind: z.ZodOptional<z.ZodEnum<{
163
+ percent: "percent";
164
+ amount: "amount";
165
+ price: "price";
166
+ }>>;
167
+ percent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
168
+ amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
169
+ automatic: z.ZodOptional<z.ZodBoolean>;
170
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ who: z.ZodOptional<z.ZodEnum<{
172
+ [x: string]: string;
173
+ }>>;
174
+ organisations: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
175
+ tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
176
+ appliesTo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
177
+ [x: string]: string;
178
+ }>>>>;
179
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
+ totalUses: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
182
+ perPerson: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
183
+ minSpend: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
184
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
185
+ }, z.core.$strip>, z.ZodObject<{
186
+ id: z.ZodString;
187
+ name: z.ZodNullable<z.ZodString>;
188
+ state: z.ZodNullable<z.ZodString>;
189
+ kind: z.ZodNullable<z.ZodString>;
190
+ percent: z.ZodNullable<z.ZodNumber>;
191
+ amount: z.ZodNullable<z.ZodNumber>;
192
+ automatic: z.ZodBoolean;
193
+ code: z.ZodNullable<z.ZodString>;
194
+ who: z.ZodNullable<z.ZodString>;
195
+ appliesTo: z.ZodArray<z.ZodString>;
196
+ from: z.ZodNullable<z.ZodString>;
197
+ until: z.ZodNullable<z.ZodString>;
198
+ totalUses: z.ZodNullable<z.ZodNumber>;
199
+ perPerson: z.ZodNullable<z.ZodNumber>;
200
+ minSpend: z.ZodNullable<z.ZodNumber>;
201
+ }, z.core.$strip>>;
202
+ export declare const activateDiscount: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
203
+ discountId: z.ZodString;
204
+ }, z.core.$strip>, z.ZodObject<{
205
+ id: z.ZodString;
206
+ name: z.ZodNullable<z.ZodString>;
207
+ state: z.ZodNullable<z.ZodString>;
208
+ kind: z.ZodNullable<z.ZodString>;
209
+ percent: z.ZodNullable<z.ZodNumber>;
210
+ amount: z.ZodNullable<z.ZodNumber>;
211
+ automatic: z.ZodBoolean;
212
+ code: z.ZodNullable<z.ZodString>;
213
+ who: z.ZodNullable<z.ZodString>;
214
+ appliesTo: z.ZodArray<z.ZodString>;
215
+ from: z.ZodNullable<z.ZodString>;
216
+ until: z.ZodNullable<z.ZodString>;
217
+ totalUses: z.ZodNullable<z.ZodNumber>;
218
+ perPerson: z.ZodNullable<z.ZodNumber>;
219
+ minSpend: z.ZodNullable<z.ZodNumber>;
220
+ }, z.core.$strip>>;
221
+ export declare const pauseDiscount: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
222
+ discountId: z.ZodString;
223
+ }, z.core.$strip>, z.ZodObject<{
224
+ id: z.ZodString;
225
+ name: z.ZodNullable<z.ZodString>;
226
+ state: z.ZodNullable<z.ZodString>;
227
+ kind: z.ZodNullable<z.ZodString>;
228
+ percent: z.ZodNullable<z.ZodNumber>;
229
+ amount: z.ZodNullable<z.ZodNumber>;
230
+ automatic: z.ZodBoolean;
231
+ code: z.ZodNullable<z.ZodString>;
232
+ who: z.ZodNullable<z.ZodString>;
233
+ appliesTo: z.ZodArray<z.ZodString>;
234
+ from: z.ZodNullable<z.ZodString>;
235
+ until: z.ZodNullable<z.ZodString>;
236
+ totalUses: z.ZodNullable<z.ZodNumber>;
237
+ perPerson: z.ZodNullable<z.ZodNumber>;
238
+ minSpend: z.ZodNullable<z.ZodNumber>;
239
+ }, z.core.$strip>>;
240
+ export declare const endDiscount: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
241
+ discountId: z.ZodString;
242
+ }, z.core.$strip>, z.ZodObject<{
243
+ id: z.ZodString;
244
+ name: z.ZodNullable<z.ZodString>;
245
+ state: z.ZodNullable<z.ZodString>;
246
+ kind: z.ZodNullable<z.ZodString>;
247
+ percent: z.ZodNullable<z.ZodNumber>;
248
+ amount: z.ZodNullable<z.ZodNumber>;
249
+ automatic: z.ZodBoolean;
250
+ code: z.ZodNullable<z.ZodString>;
251
+ who: z.ZodNullable<z.ZodString>;
252
+ appliesTo: z.ZodArray<z.ZodString>;
253
+ from: z.ZodNullable<z.ZodString>;
254
+ until: z.ZodNullable<z.ZodString>;
255
+ totalUses: z.ZodNullable<z.ZodNumber>;
256
+ perPerson: z.ZodNullable<z.ZodNumber>;
257
+ minSpend: z.ZodNullable<z.ZodNumber>;
258
+ }, z.core.$strip>>;
259
+ export declare const generateCodes: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
260
+ discountId: z.ZodString;
261
+ count: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
262
+ usesPerCode: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
263
+ batch: z.ZodOptional<z.ZodString>;
264
+ }, z.core.$strip>, z.ZodObject<{
265
+ discountId: z.ZodString;
266
+ batch: z.ZodString;
267
+ made: z.ZodNumber;
268
+ complete: z.ZodBoolean;
269
+ problem: z.ZodNullable<z.ZodString>;
270
+ codes: z.ZodArray<z.ZodString>;
271
+ }, z.core.$strip>>;
272
+ export declare const voidBatch: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
273
+ discountId: z.ZodString;
274
+ batch: z.ZodString;
275
+ }, z.core.$strip>, z.ZodObject<{
276
+ voided: z.ZodNumber;
277
+ remaining: z.ZodNumber;
278
+ }, z.core.$strip>>;
279
+ export declare const voidCodes: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
280
+ discountId: z.ZodString;
281
+ codes: z.ZodArray<z.ZodString>;
282
+ }, z.core.$strip>, z.ZodObject<{
283
+ voided: z.ZodNumber;
284
+ remaining: z.ZodNumber;
285
+ }, z.core.$strip>>;