@brytdesigns/shopify-ajax-cart-api 1.0.43 → 3.0.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.
Files changed (35) hide show
  1. package/dist/effect/api/CartAdd.js +36 -9
  2. package/dist/effect/api/CartAdd.js.map +1 -1
  3. package/dist/effect/api/CartChange.js +32 -9
  4. package/dist/effect/api/CartChange.js.map +1 -1
  5. package/dist/effect/api/CartClear.js +26 -9
  6. package/dist/effect/api/CartClear.js.map +1 -1
  7. package/dist/effect/api/CartGet.js +35 -9
  8. package/dist/effect/api/CartGet.js.map +1 -1
  9. package/dist/effect/api/CartUpdate.js +31 -9
  10. package/dist/effect/api/CartUpdate.js.map +1 -1
  11. package/dist/effect/index.d.ts +1746 -899
  12. package/dist/effect/index.js +13 -13
  13. package/dist/effect/index.js.map +1 -1
  14. package/dist/effect/schema.js +970 -1059
  15. package/dist/effect/schema.js.map +1 -1
  16. package/dist/main/effect/api/CartAdd.js +36 -9
  17. package/dist/main/effect/api/CartAdd.js.map +1 -1
  18. package/dist/main/effect/api/CartChange.js +32 -9
  19. package/dist/main/effect/api/CartChange.js.map +1 -1
  20. package/dist/main/effect/api/CartClear.js +26 -9
  21. package/dist/main/effect/api/CartClear.js.map +1 -1
  22. package/dist/main/effect/api/CartGet.js +35 -9
  23. package/dist/main/effect/api/CartGet.js.map +1 -1
  24. package/dist/main/effect/api/CartUpdate.js +31 -9
  25. package/dist/main/effect/api/CartUpdate.js.map +1 -1
  26. package/dist/main/effect/index.js +13 -13
  27. package/dist/main/effect/index.js.map +1 -1
  28. package/dist/main/effect/schema.js +970 -1059
  29. package/dist/main/effect/schema.js.map +1 -1
  30. package/dist/main/index.d.ts +586 -1808
  31. package/dist/main/index.js +123 -235
  32. package/dist/main/index.js.map +1 -1
  33. package/package.json +11 -13
  34. package/dist/esm/index.js +0 -19525
  35. package/dist/esm/index.js.map +0 -1
@@ -1,173 +1,311 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import * as Schema from 'effect/Schema';
3
+ import { HttpClient } from 'effect/http';
4
+ import * as Layer from 'effect/Layer';
4
5
 
5
- export type CartAddInput = Schema.Schema.Encoded<typeof CartAddInput>;
6
- declare const CartAddInput: Schema.extend<Schema.Struct<{
7
- items: Schema.Array$<Schema.Struct<{
8
- id: Schema.Union<[
9
- typeof Schema.Number,
10
- typeof Schema.NumberFromString,
11
- typeof Schema.String
12
- ]>;
13
- quantity: Schema.optionalWith<typeof Schema.Number, {
14
- default: () => number;
15
- }>;
16
- properties: Schema.optionalWith<Schema.Record$<typeof Schema.String, Schema.Union<[
17
- typeof Schema.Null,
18
- typeof Schema.String,
19
- typeof Schema.Boolean,
20
- typeof Schema.Number
21
- ]>>, {
22
- default: () => {};
23
- }>;
24
- selling_plan: Schema.optional<Schema.Union<[
25
- typeof Schema.Number,
26
- typeof Schema.NumberFromString,
27
- typeof Schema.String
28
- ]>>;
29
- }>>;
30
- }>, Schema.Struct<{
31
- sections: Schema.optional<Schema.transform<Schema.Array$<typeof Schema.String>, typeof Schema.String>>;
32
- sections_url: Schema.optional<typeof Schema.String>;
33
- }>>;
34
- export type CartUpdateInput = Schema.Schema.Encoded<typeof CartUpdateInput>;
35
- declare const CartUpdateInput: Schema.extend<Schema.Struct<{
36
- updates: Schema.optional<Schema.Union<[
37
- Schema.Record$<typeof Schema.String, typeof Schema.Number>,
38
- Schema.Array$<typeof Schema.Number>
39
- ]>>;
40
- note: Schema.optional<Schema.NullOr<typeof Schema.String>>;
41
- attributes: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[
42
- typeof Schema.Null,
43
- typeof Schema.String,
44
- typeof Schema.Boolean,
45
- typeof Schema.Number
46
- ]>>>;
47
- discount: Schema.optional<Schema.transform<Schema.Array$<typeof Schema.String>, typeof Schema.String>>;
48
- }>, Schema.Struct<{
49
- sections: Schema.optional<Schema.transform<Schema.Array$<typeof Schema.String>, typeof Schema.String>>;
50
- sections_url: Schema.optional<typeof Schema.String>;
51
- }>>;
52
- export type CartChangeInput = Schema.Schema.Encoded<typeof CartChangeInput>;
53
- declare const CartChangeInput: Schema.Union<[
54
- Schema.extend<Schema.Struct<{
55
- id: typeof Schema.String;
56
- }>, Schema.extend<Schema.Struct<{
57
- quantity: Schema.optional<typeof Schema.Number>;
58
- properties: Schema.optional<Schema.Record$<typeof Schema.String, Schema.NullOr<typeof Schema.String>>>;
59
- selling_plan: Schema.optional<Schema.NullOr<Schema.Union<[
60
- typeof Schema.Number,
61
- typeof Schema.NumberFromString,
62
- typeof Schema.String
63
- ]>>>;
64
- }>, Schema.Struct<{
65
- sections: Schema.optional<Schema.transform<Schema.Array$<typeof Schema.String>, typeof Schema.String>>;
66
- sections_url: Schema.optional<typeof Schema.String>;
67
- }>>>,
68
- Schema.extend<Schema.Struct<{
69
- line: typeof Schema.Number;
70
- }>, Schema.extend<Schema.Struct<{
71
- quantity: Schema.optional<typeof Schema.Number>;
72
- properties: Schema.optional<Schema.Record$<typeof Schema.String, Schema.NullOr<typeof Schema.String>>>;
73
- selling_plan: Schema.optional<Schema.NullOr<Schema.Union<[
74
- typeof Schema.Number,
75
- typeof Schema.NumberFromString,
76
- typeof Schema.String
77
- ]>>>;
78
- }>, Schema.Struct<{
79
- sections: Schema.optional<Schema.transform<Schema.Array$<typeof Schema.String>, typeof Schema.String>>;
80
- sections_url: Schema.optional<typeof Schema.String>;
81
- }>>>
82
- ]>;
83
- export type CartClearInput = Schema.Schema.Encoded<typeof CartClearInput>;
84
- declare const CartClearInput: Schema.Struct<{
85
- sections: Schema.optional<Schema.transform<Schema.Array$<typeof Schema.String>, typeof Schema.String>>;
86
- sections_url: Schema.optional<typeof Schema.String>;
87
- }>;
88
- export type CartGetInput = Schema.Schema.Encoded<typeof CartClearInput>;
89
- declare const CartGetInput: Schema.Struct<{
90
- sections: Schema.optional<Schema.transform<Schema.Array$<typeof Schema.String>, typeof Schema.String>>;
91
- sections_url: Schema.optional<typeof Schema.String>;
92
- }>;
93
- export type AddInput = CartAddInput;
94
- export type ChangeInput = CartChangeInput;
95
- export type ClearInput = CartClearInput;
96
- export type GetInput = CartGetInput;
97
- export type UpdateInput = CartUpdateInput;
98
- declare namespace add {
99
- type Input = AddInput;
6
+ export declare namespace createAjaxCartClient {
7
+ type Options = {
8
+ debug?: boolean;
9
+ /**
10
+ * Replaces the HTTP layer.
11
+ *
12
+ * The default is `AjaxClient.layer`, which is `fetch`. Overriding it is
13
+ * the only way to exercise this client without a network - the
14
+ * alternative was spying on the `layer` export, which tests how the
15
+ * module is wired rather than what it sends.
16
+ */
17
+ httpClient?: Layer.Layer<HttpClient.HttpClient>;
18
+ };
19
+ type RequestOptions = {
20
+ signal?: AbortSignal;
21
+ headers?: Record<string, string>;
22
+ };
100
23
  }
101
- declare const add: (input?: ({
24
+ /**
25
+ * Validates the input cart object against the defined CartOutput schema.
26
+ *
27
+ * @param cart - The unknown cart object to be validated.
28
+ * @returns The validated cart, or throws if it does not match the schema.
29
+ */
30
+ export declare const validateCart: (cart: unknown) => {
31
+ readonly token: string;
32
+ readonly note: string | null;
33
+ readonly attributes: {
34
+ readonly [x: string]: string | number | boolean | null;
35
+ };
36
+ readonly discounts: readonly {
37
+ readonly amount: number;
38
+ readonly title: string;
39
+ }[];
40
+ readonly discount_codes: readonly {
41
+ readonly code: string;
42
+ readonly applicable: boolean;
43
+ }[];
44
+ readonly original_total_price: number;
45
+ readonly total_price: number;
46
+ readonly total_discount: number;
47
+ readonly total_weight: number;
48
+ readonly item_count: number;
102
49
  readonly items: readonly {
50
+ readonly title: string;
51
+ readonly key: string;
52
+ readonly url: string;
53
+ readonly image: string | null;
54
+ readonly price: number;
103
55
  readonly id: string | number;
104
- readonly selling_plan?: string | number | undefined;
105
- readonly properties?: {
56
+ readonly selling_plan_allocation: {
57
+ readonly price_adjustments: readonly {
58
+ readonly position: number;
59
+ readonly price: number;
60
+ }[];
61
+ readonly price: number;
62
+ readonly compare_at_price: number;
63
+ readonly per_delivery_price: number;
64
+ readonly selling_plan: {
65
+ readonly id: string | number;
66
+ readonly name: string;
67
+ readonly description: string | null;
68
+ readonly options: readonly {
69
+ readonly name: string;
70
+ readonly position: number;
71
+ readonly value: string;
72
+ }[];
73
+ readonly recurring_deliveries: boolean;
74
+ readonly fixed_selling_plan: boolean;
75
+ readonly price_adjustments: readonly {
76
+ readonly order_count: number | null;
77
+ readonly position: number;
78
+ readonly value: string | number;
79
+ readonly value_type: "fixed_amount" | "percentage" | "price";
80
+ }[];
81
+ };
82
+ } | null;
83
+ readonly variant_options: readonly string[];
84
+ readonly discounts: readonly {
85
+ readonly amount: number;
86
+ readonly title: string;
87
+ }[];
88
+ readonly sku: string | null;
89
+ readonly product_type: string | null;
90
+ readonly product_description: string | null;
91
+ readonly variant_title: string | null;
92
+ readonly options_with_values: readonly {
93
+ readonly name: string;
94
+ readonly value: string;
95
+ }[];
96
+ readonly line_level_discount_allocations: readonly {
97
+ readonly amount: number;
98
+ readonly discount_application: {
99
+ readonly target_selection: "all" | "entitled" | "explicit";
100
+ readonly target_type: "line_item" | "shipping_line";
101
+ readonly title: string;
102
+ readonly total_allocated_amount: number;
103
+ readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
104
+ readonly value: number;
105
+ readonly value_type: "fixed_amount" | "percentage";
106
+ readonly description: string | null;
107
+ };
108
+ }[];
109
+ readonly has_components: boolean;
110
+ readonly properties: {
111
+ readonly [x: string]: string | number | boolean | null;
112
+ };
113
+ readonly quantity: number;
114
+ readonly variant_id: string | number;
115
+ readonly original_price: number;
116
+ readonly discounted_price: number;
117
+ readonly line_price: number;
118
+ readonly original_line_price: number;
119
+ readonly total_discount: number;
120
+ readonly grams: number;
121
+ readonly vendor: string;
122
+ readonly taxable: boolean;
123
+ readonly product_id: string | number;
124
+ readonly product_has_only_default_variant: boolean;
125
+ readonly gift_card: boolean;
126
+ readonly final_line_price: number;
127
+ readonly final_price: number;
128
+ readonly featured_image: {
129
+ readonly aspect_ratio: number | null;
130
+ readonly alt: string | null;
131
+ readonly height: number | null;
132
+ readonly url: string | null;
133
+ readonly width: number | null;
134
+ };
135
+ readonly handle: string;
136
+ readonly requires_shipping: boolean;
137
+ readonly product_title: string;
138
+ readonly line_level_total_discount: number;
139
+ readonly properties_array: readonly {
140
+ readonly key: string;
141
+ readonly value: string | number | boolean | null;
142
+ }[];
143
+ readonly private_properties: {
144
+ readonly [x: string]: string | number | boolean | null;
145
+ };
146
+ readonly private_properties_array: readonly {
147
+ readonly key: string;
148
+ readonly value: string | number | boolean | null;
149
+ }[];
150
+ readonly public_properties: {
106
151
  readonly [x: string]: string | number | boolean | null;
152
+ };
153
+ readonly public_properties_array: readonly {
154
+ readonly key: string;
155
+ readonly value: string | number | boolean | null;
156
+ }[];
157
+ readonly quantity_rule?: {
158
+ readonly min: number;
159
+ readonly max: number | null;
160
+ readonly increment: number;
107
161
  } | undefined;
108
- readonly quantity?: number | undefined;
162
+ readonly unit_price_measurement?: {
163
+ readonly measured_type: "volume" | "weight" | "dimension";
164
+ readonly quantity_unit: string;
165
+ readonly quantity_value: number;
166
+ readonly reference_unit: string;
167
+ readonly reference_value: number;
168
+ } | undefined;
169
+ readonly unit_price?: number | undefined;
170
+ }[];
171
+ readonly requires_shipping: boolean;
172
+ readonly currency: string;
173
+ readonly items_subtotal_price: number;
174
+ readonly cart_level_discount_applications: readonly {
175
+ readonly target_selection: "all" | "entitled" | "explicit";
176
+ readonly target_type: "line_item" | "shipping_line";
177
+ readonly title: string;
178
+ readonly total_allocated_amount: number;
179
+ readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
180
+ readonly value: number;
181
+ readonly value_type: "fixed_amount" | "percentage";
182
+ readonly description: string | null;
183
+ }[];
184
+ readonly attributes_array: readonly {
185
+ readonly key: string;
186
+ readonly value: string | number | boolean | null;
187
+ }[];
188
+ readonly private_attributes: {
189
+ readonly [x: string]: string | number | boolean | null;
190
+ };
191
+ readonly private_attributes_array: readonly {
192
+ readonly key: string;
193
+ readonly value: string | number | boolean | null;
194
+ }[];
195
+ readonly public_attributes: {
196
+ readonly [x: string]: string | number | boolean | null;
197
+ };
198
+ readonly public_attributes_array: readonly {
199
+ readonly key: string;
200
+ readonly value: string | number | boolean | null;
109
201
  }[];
110
- } & {
111
- readonly sections?: readonly string[] | undefined;
112
- readonly sections_url?: string | undefined;
113
- }) | undefined, options?: {
114
- headers?: Record<string, string>;
115
- }) => import("effect/Effect").Effect<{
116
- readonly data?: undefined;
117
- readonly error?: {
118
- status: number;
119
- message: string;
120
- description?: string;
121
- } | undefined;
122
- } | {
123
- readonly data?: {
124
- readonly items: readonly ({
202
+ };
203
+ /**
204
+ * Creates an instance of the Ajax Cart API client.
205
+ *
206
+ * Each method resolves to the decoded cart and **rejects** on failure. There is
207
+ * no `{ data, error }` envelope: a non-200 rejects with
208
+ * `AjaxResponseError`, and transport, encode and decode failures reject with
209
+ * Effect's own tagged errors.
210
+ *
211
+ * @param options - Optional settings.
212
+ * @param options.debug - Enables request logging. Default `false`.
213
+ *
214
+ * @example
215
+ * ```typescript
216
+ * const api = createAjaxCartApi({ debug: true });
217
+ *
218
+ * try {
219
+ * const cart = await api.add({ items: [{ id: 123, quantity: 2 }] });
220
+ * console.log("Cart updated:", cart);
221
+ * } catch (error) {
222
+ * if (error instanceof AjaxResponseError) {
223
+ * console.error(error.status, error.route);
224
+ * }
225
+ * }
226
+ * ```
227
+ */
228
+ export declare const createAjaxCartApi: ({ debug, httpClient, }?: createAjaxCartClient.Options) => {
229
+ /**
230
+ * Adds items to the cart.
231
+ *
232
+ * @param input - The items to add.
233
+ * @param options - An `AbortSignal` to cancel with, and custom headers.
234
+ * @returns A Promise resolving to the updated cart.
235
+ */
236
+ add: (input?: {
237
+ readonly items: readonly {
238
+ readonly id: string | number;
239
+ readonly selling_plan?: string | number | undefined;
240
+ readonly properties?: {
241
+ readonly [x: string]: string | number | boolean | null;
242
+ } | undefined;
243
+ readonly quantity?: number | undefined;
244
+ }[];
245
+ readonly sections?: readonly string[] | undefined;
246
+ readonly sections_url?: string | undefined;
247
+ } | undefined, options?: createAjaxCartClient.RequestOptions) => Promise<{
248
+ readonly items: readonly {
125
249
  readonly title: string;
126
250
  readonly key: string;
127
251
  readonly url: string;
128
252
  readonly image: string | null;
129
- readonly quantity_rule?: {
130
- readonly min: number;
131
- readonly max: number | null;
132
- readonly increment: number;
133
- } | undefined;
134
253
  readonly price: number;
135
254
  readonly id: string | number;
136
255
  readonly selling_plan_allocation: {
137
- readonly price: number;
138
256
  readonly price_adjustments: readonly {
139
257
  readonly position: number;
140
258
  readonly price: number;
141
259
  }[];
260
+ readonly price: number;
261
+ readonly compare_at_price: number;
262
+ readonly per_delivery_price: number;
142
263
  readonly selling_plan: {
143
- readonly description: string | null;
144
- readonly name: string;
145
264
  readonly id: string | number;
265
+ readonly name: string;
266
+ readonly description: string | null;
146
267
  readonly options: readonly {
147
- readonly value: string;
148
268
  readonly name: string;
149
269
  readonly position: number;
270
+ readonly value: string;
150
271
  }[];
151
272
  readonly recurring_deliveries: boolean;
152
273
  readonly fixed_selling_plan: boolean;
153
274
  readonly price_adjustments: readonly {
275
+ readonly order_count: number | null;
276
+ readonly position: number;
154
277
  readonly value: string | number;
155
278
  readonly value_type: "fixed_amount" | "percentage" | "price";
156
- readonly position: number;
157
- readonly order_count: number | null;
158
279
  }[];
159
280
  };
160
- readonly compare_at_price: number;
161
- readonly per_delivery_price: number;
162
281
  } | null;
163
- readonly unit_price_measurement?: {
164
- readonly measured_type: "volume" | "weight" | "dimension";
165
- readonly quantity_unit: string;
166
- readonly quantity_value: number;
167
- readonly reference_unit: string;
168
- readonly reference_value: number;
169
- } | undefined;
170
282
  readonly variant_options: readonly string[];
283
+ readonly discounts: readonly {
284
+ readonly amount: number;
285
+ readonly title: string;
286
+ }[];
287
+ readonly sku: string | null;
288
+ readonly product_type: string | null;
289
+ readonly product_description: string | null;
290
+ readonly variant_title: string | null;
291
+ readonly options_with_values: readonly {
292
+ readonly name: string;
293
+ readonly value: string;
294
+ }[];
295
+ readonly line_level_discount_allocations: readonly {
296
+ readonly amount: number;
297
+ readonly discount_application: {
298
+ readonly target_selection: "all" | "entitled" | "explicit";
299
+ readonly target_type: "line_item" | "shipping_line";
300
+ readonly title: string;
301
+ readonly total_allocated_amount: number;
302
+ readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
303
+ readonly value: number;
304
+ readonly value_type: "fixed_amount" | "percentage";
305
+ readonly description: string | null;
306
+ };
307
+ }[];
308
+ readonly has_components: boolean;
171
309
  readonly properties: {
172
310
  readonly [x: string]: string | number | boolean | null;
173
311
  };
@@ -178,11 +316,6 @@ declare const add: (input?: ({
178
316
  readonly line_price: number;
179
317
  readonly original_line_price: number;
180
318
  readonly total_discount: number;
181
- readonly discounts: readonly {
182
- readonly title: string;
183
- readonly amount: number;
184
- }[];
185
- readonly sku: string | null;
186
319
  readonly grams: number;
187
320
  readonly vendor: string;
188
321
  readonly taxable: boolean;
@@ -200,31 +333,8 @@ declare const add: (input?: ({
200
333
  };
201
334
  readonly handle: string;
202
335
  readonly requires_shipping: boolean;
203
- readonly product_type: string | null;
204
336
  readonly product_title: string;
205
- readonly product_description: string | null;
206
- readonly variant_title: string | null;
207
- readonly options_with_values: readonly {
208
- readonly value: string;
209
- readonly name: string;
210
- }[];
211
- readonly line_level_discount_allocations: readonly {
212
- readonly discount_application: {
213
- readonly title: string;
214
- readonly description: string | null;
215
- readonly value: number;
216
- readonly target_selection: "all" | "entitled" | "explicit";
217
- readonly target_type: "line_item" | "shipping_line";
218
- readonly total_allocated_amount: number;
219
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
220
- readonly value_type: "fixed_amount" | "percentage";
221
- };
222
- readonly amount: number;
223
- }[];
224
337
  readonly line_level_total_discount: number;
225
- readonly has_components: boolean;
226
- readonly unit_price?: number | undefined;
227
- } & {
228
338
  readonly properties_array: readonly {
229
339
  readonly key: string;
230
340
  readonly value: string | number | boolean | null;
@@ -243,116 +353,126 @@ declare const add: (input?: ({
243
353
  readonly key: string;
244
354
  readonly value: string | number | boolean | null;
245
355
  }[];
246
- })[];
247
- } | undefined;
248
- readonly error?: {
249
- status: number;
250
- message: string;
251
- description?: string;
252
- } | undefined;
253
- }, Error, import("@effect/platform/HttpClient").HttpClient>;
254
- declare namespace change {
255
- type Input = ChangeInput;
256
- }
257
- declare const change: (input?: ({
258
- readonly id: string;
259
- } & {
260
- readonly selling_plan?: string | number | null | undefined;
261
- readonly properties?: {
262
- readonly [x: string]: string | null;
263
- } | undefined;
264
- readonly quantity?: number | undefined;
265
- } & {
266
- readonly sections?: readonly string[] | undefined;
267
- readonly sections_url?: string | undefined;
268
- }) | ({
269
- readonly line: number;
270
- } & {
271
- readonly selling_plan?: string | number | null | undefined;
272
- readonly properties?: {
273
- readonly [x: string]: string | null;
274
- } | undefined;
275
- readonly quantity?: number | undefined;
276
- } & {
277
- readonly sections?: readonly string[] | undefined;
278
- readonly sections_url?: string | undefined;
279
- }) | undefined, options?: {
280
- headers?: Record<string, string>;
281
- }) => import("effect/Effect").Effect<{
282
- readonly data?: undefined;
283
- readonly error?: {
284
- status: number;
285
- message: string;
286
- description?: string;
287
- } | undefined;
288
- } | {
289
- readonly data?: ({
356
+ readonly quantity_rule?: {
357
+ readonly min: number;
358
+ readonly max: number | null;
359
+ readonly increment: number;
360
+ } | undefined;
361
+ readonly unit_price_measurement?: {
362
+ readonly measured_type: "volume" | "weight" | "dimension";
363
+ readonly quantity_unit: string;
364
+ readonly quantity_value: number;
365
+ readonly reference_unit: string;
366
+ readonly reference_value: number;
367
+ } | undefined;
368
+ readonly unit_price?: number | undefined;
369
+ }[];
370
+ }>;
371
+ /**
372
+ * Updates the quantity, properties or selling plan of one cart line.
373
+ *
374
+ * @param input - The line to change, by `id` or `line`.
375
+ * @param options - An `AbortSignal` to cancel with, and custom headers.
376
+ * @returns A Promise resolving to the updated cart.
377
+ */
378
+ change: (input?: {
379
+ readonly id: string;
380
+ readonly selling_plan?: string | number | null | undefined;
381
+ readonly properties?: {
382
+ readonly [x: string]: string | null;
383
+ } | undefined;
384
+ readonly quantity?: number | undefined;
385
+ readonly sections?: readonly string[] | undefined;
386
+ readonly sections_url?: string | undefined;
387
+ } | {
388
+ readonly line: number;
389
+ readonly selling_plan?: string | number | null | undefined;
390
+ readonly properties?: {
391
+ readonly [x: string]: string | null;
392
+ } | undefined;
393
+ readonly quantity?: number | undefined;
394
+ readonly sections?: readonly string[] | undefined;
395
+ readonly sections_url?: string | undefined;
396
+ } | undefined, options?: createAjaxCartClient.RequestOptions) => Promise<{
397
+ readonly token: string;
398
+ readonly note: string | null;
290
399
  readonly attributes: {
291
400
  readonly [x: string]: string | number | boolean | null;
292
401
  };
293
- readonly total_discount: number;
294
402
  readonly discounts: readonly {
295
- readonly title: string;
296
403
  readonly amount: number;
404
+ readonly title: string;
297
405
  }[];
298
- readonly requires_shipping: boolean;
299
- readonly token: string;
300
- readonly note: string | null;
301
406
  readonly discount_codes: readonly {
302
407
  readonly code: string;
303
408
  readonly applicable: boolean;
304
409
  }[];
305
410
  readonly original_total_price: number;
306
411
  readonly total_price: number;
412
+ readonly total_discount: number;
307
413
  readonly total_weight: number;
308
414
  readonly item_count: number;
309
- readonly items: readonly ({
415
+ readonly items: readonly {
310
416
  readonly title: string;
311
417
  readonly key: string;
312
418
  readonly url: string;
313
419
  readonly image: string | null;
314
- readonly quantity_rule?: {
315
- readonly min: number;
316
- readonly max: number | null;
317
- readonly increment: number;
318
- } | undefined;
319
420
  readonly price: number;
320
421
  readonly id: string | number;
321
422
  readonly selling_plan_allocation: {
322
- readonly price: number;
323
423
  readonly price_adjustments: readonly {
324
424
  readonly position: number;
325
425
  readonly price: number;
326
426
  }[];
427
+ readonly price: number;
428
+ readonly compare_at_price: number;
429
+ readonly per_delivery_price: number;
327
430
  readonly selling_plan: {
328
- readonly description: string | null;
329
- readonly name: string;
330
431
  readonly id: string | number;
432
+ readonly name: string;
433
+ readonly description: string | null;
331
434
  readonly options: readonly {
332
- readonly value: string;
333
435
  readonly name: string;
334
436
  readonly position: number;
437
+ readonly value: string;
335
438
  }[];
336
439
  readonly recurring_deliveries: boolean;
337
440
  readonly fixed_selling_plan: boolean;
338
441
  readonly price_adjustments: readonly {
442
+ readonly order_count: number | null;
443
+ readonly position: number;
339
444
  readonly value: string | number;
340
445
  readonly value_type: "fixed_amount" | "percentage" | "price";
341
- readonly position: number;
342
- readonly order_count: number | null;
343
446
  }[];
344
447
  };
345
- readonly compare_at_price: number;
346
- readonly per_delivery_price: number;
347
448
  } | null;
348
- readonly unit_price_measurement?: {
349
- readonly measured_type: "volume" | "weight" | "dimension";
350
- readonly quantity_unit: string;
351
- readonly quantity_value: number;
352
- readonly reference_unit: string;
353
- readonly reference_value: number;
354
- } | undefined;
355
449
  readonly variant_options: readonly string[];
450
+ readonly discounts: readonly {
451
+ readonly amount: number;
452
+ readonly title: string;
453
+ }[];
454
+ readonly sku: string | null;
455
+ readonly product_type: string | null;
456
+ readonly product_description: string | null;
457
+ readonly variant_title: string | null;
458
+ readonly options_with_values: readonly {
459
+ readonly name: string;
460
+ readonly value: string;
461
+ }[];
462
+ readonly line_level_discount_allocations: readonly {
463
+ readonly amount: number;
464
+ readonly discount_application: {
465
+ readonly target_selection: "all" | "entitled" | "explicit";
466
+ readonly target_type: "line_item" | "shipping_line";
467
+ readonly title: string;
468
+ readonly total_allocated_amount: number;
469
+ readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
470
+ readonly value: number;
471
+ readonly value_type: "fixed_amount" | "percentage";
472
+ readonly description: string | null;
473
+ };
474
+ }[];
475
+ readonly has_components: boolean;
356
476
  readonly properties: {
357
477
  readonly [x: string]: string | number | boolean | null;
358
478
  };
@@ -363,11 +483,6 @@ declare const change: (input?: ({
363
483
  readonly line_price: number;
364
484
  readonly original_line_price: number;
365
485
  readonly total_discount: number;
366
- readonly discounts: readonly {
367
- readonly title: string;
368
- readonly amount: number;
369
- }[];
370
- readonly sku: string | null;
371
486
  readonly grams: number;
372
487
  readonly vendor: string;
373
488
  readonly taxable: boolean;
@@ -385,31 +500,8 @@ declare const change: (input?: ({
385
500
  };
386
501
  readonly handle: string;
387
502
  readonly requires_shipping: boolean;
388
- readonly product_type: string | null;
389
503
  readonly product_title: string;
390
- readonly product_description: string | null;
391
- readonly variant_title: string | null;
392
- readonly options_with_values: readonly {
393
- readonly value: string;
394
- readonly name: string;
395
- }[];
396
- readonly line_level_discount_allocations: readonly {
397
- readonly discount_application: {
398
- readonly title: string;
399
- readonly description: string | null;
400
- readonly value: number;
401
- readonly target_selection: "all" | "entitled" | "explicit";
402
- readonly target_type: "line_item" | "shipping_line";
403
- readonly total_allocated_amount: number;
404
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
405
- readonly value_type: "fixed_amount" | "percentage";
406
- };
407
- readonly amount: number;
408
- }[];
409
504
  readonly line_level_total_discount: number;
410
- readonly has_components: boolean;
411
- readonly unit_price?: number | undefined;
412
- } & {
413
505
  readonly properties_array: readonly {
414
506
  readonly key: string;
415
507
  readonly value: string | number | boolean | null;
@@ -428,20 +520,33 @@ declare const change: (input?: ({
428
520
  readonly key: string;
429
521
  readonly value: string | number | boolean | null;
430
522
  }[];
431
- })[];
523
+ readonly quantity_rule?: {
524
+ readonly min: number;
525
+ readonly max: number | null;
526
+ readonly increment: number;
527
+ } | undefined;
528
+ readonly unit_price_measurement?: {
529
+ readonly measured_type: "volume" | "weight" | "dimension";
530
+ readonly quantity_unit: string;
531
+ readonly quantity_value: number;
532
+ readonly reference_unit: string;
533
+ readonly reference_value: number;
534
+ } | undefined;
535
+ readonly unit_price?: number | undefined;
536
+ }[];
537
+ readonly requires_shipping: boolean;
432
538
  readonly currency: string;
433
539
  readonly items_subtotal_price: number;
434
540
  readonly cart_level_discount_applications: readonly {
435
- readonly title: string;
436
- readonly description: string | null;
437
- readonly value: number;
438
541
  readonly target_selection: "all" | "entitled" | "explicit";
439
542
  readonly target_type: "line_item" | "shipping_line";
543
+ readonly title: string;
440
544
  readonly total_allocated_amount: number;
441
545
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
546
+ readonly value: number;
442
547
  readonly value_type: "fixed_amount" | "percentage";
548
+ readonly description: string | null;
443
549
  }[];
444
- } & {
445
550
  readonly attributes_array: readonly {
446
551
  readonly key: string;
447
552
  readonly value: string | number | boolean | null;
@@ -460,96 +565,97 @@ declare const change: (input?: ({
460
565
  readonly key: string;
461
566
  readonly value: string | number | boolean | null;
462
567
  }[];
463
- }) | undefined;
464
- readonly error?: {
465
- status: number;
466
- message: string;
467
- description?: string;
468
- } | undefined;
469
- }, Error, import("@effect/platform/HttpClient").HttpClient>;
470
- declare namespace clear {
471
- type Input = ClearInput;
472
- }
473
- declare const clear: (input?: {
474
- readonly sections?: readonly string[] | undefined;
475
- readonly sections_url?: string | undefined;
476
- } | undefined, options?: {
477
- headers?: Record<string, string>;
478
- }) => import("effect/Effect").Effect<{
479
- readonly data?: undefined;
480
- readonly error?: {
481
- status: number;
482
- message: string;
483
- description?: string;
484
- } | undefined;
485
- } | {
486
- readonly data?: ({
568
+ }>;
569
+ /**
570
+ * Removes everything from the cart.
571
+ *
572
+ * @param input - Carries the `sections` to re-render.
573
+ * @param options - An `AbortSignal` to cancel with, and custom headers.
574
+ * @returns A Promise resolving to the emptied cart.
575
+ */
576
+ clear: (input?: {
577
+ readonly sections?: readonly string[] | undefined;
578
+ readonly sections_url?: string | undefined;
579
+ } | undefined, options?: createAjaxCartClient.RequestOptions) => Promise<{
580
+ readonly token: string;
581
+ readonly note: string | null;
487
582
  readonly attributes: {
488
583
  readonly [x: string]: string | number | boolean | null;
489
584
  };
490
- readonly total_discount: number;
491
585
  readonly discounts: readonly {
492
- readonly title: string;
493
586
  readonly amount: number;
587
+ readonly title: string;
494
588
  }[];
495
- readonly requires_shipping: boolean;
496
- readonly token: string;
497
- readonly note: string | null;
498
589
  readonly discount_codes: readonly {
499
590
  readonly code: string;
500
591
  readonly applicable: boolean;
501
592
  }[];
502
593
  readonly original_total_price: number;
503
594
  readonly total_price: number;
595
+ readonly total_discount: number;
504
596
  readonly total_weight: number;
505
597
  readonly item_count: number;
506
- readonly items: readonly ({
598
+ readonly items: readonly {
507
599
  readonly title: string;
508
600
  readonly key: string;
509
601
  readonly url: string;
510
602
  readonly image: string | null;
511
- readonly quantity_rule?: {
512
- readonly min: number;
513
- readonly max: number | null;
514
- readonly increment: number;
515
- } | undefined;
516
603
  readonly price: number;
517
604
  readonly id: string | number;
518
605
  readonly selling_plan_allocation: {
519
- readonly price: number;
520
606
  readonly price_adjustments: readonly {
521
607
  readonly position: number;
522
608
  readonly price: number;
523
609
  }[];
610
+ readonly price: number;
611
+ readonly compare_at_price: number;
612
+ readonly per_delivery_price: number;
524
613
  readonly selling_plan: {
525
- readonly description: string | null;
526
- readonly name: string;
527
614
  readonly id: string | number;
615
+ readonly name: string;
616
+ readonly description: string | null;
528
617
  readonly options: readonly {
529
- readonly value: string;
530
618
  readonly name: string;
531
619
  readonly position: number;
620
+ readonly value: string;
532
621
  }[];
533
622
  readonly recurring_deliveries: boolean;
534
623
  readonly fixed_selling_plan: boolean;
535
624
  readonly price_adjustments: readonly {
625
+ readonly order_count: number | null;
626
+ readonly position: number;
536
627
  readonly value: string | number;
537
628
  readonly value_type: "fixed_amount" | "percentage" | "price";
538
- readonly position: number;
539
- readonly order_count: number | null;
540
629
  }[];
541
630
  };
542
- readonly compare_at_price: number;
543
- readonly per_delivery_price: number;
544
631
  } | null;
545
- readonly unit_price_measurement?: {
546
- readonly measured_type: "volume" | "weight" | "dimension";
547
- readonly quantity_unit: string;
548
- readonly quantity_value: number;
549
- readonly reference_unit: string;
550
- readonly reference_value: number;
551
- } | undefined;
552
632
  readonly variant_options: readonly string[];
633
+ readonly discounts: readonly {
634
+ readonly amount: number;
635
+ readonly title: string;
636
+ }[];
637
+ readonly sku: string | null;
638
+ readonly product_type: string | null;
639
+ readonly product_description: string | null;
640
+ readonly variant_title: string | null;
641
+ readonly options_with_values: readonly {
642
+ readonly name: string;
643
+ readonly value: string;
644
+ }[];
645
+ readonly line_level_discount_allocations: readonly {
646
+ readonly amount: number;
647
+ readonly discount_application: {
648
+ readonly target_selection: "all" | "entitled" | "explicit";
649
+ readonly target_type: "line_item" | "shipping_line";
650
+ readonly title: string;
651
+ readonly total_allocated_amount: number;
652
+ readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
653
+ readonly value: number;
654
+ readonly value_type: "fixed_amount" | "percentage";
655
+ readonly description: string | null;
656
+ };
657
+ }[];
658
+ readonly has_components: boolean;
553
659
  readonly properties: {
554
660
  readonly [x: string]: string | number | boolean | null;
555
661
  };
@@ -560,11 +666,6 @@ declare const clear: (input?: {
560
666
  readonly line_price: number;
561
667
  readonly original_line_price: number;
562
668
  readonly total_discount: number;
563
- readonly discounts: readonly {
564
- readonly title: string;
565
- readonly amount: number;
566
- }[];
567
- readonly sku: string | null;
568
669
  readonly grams: number;
569
670
  readonly vendor: string;
570
671
  readonly taxable: boolean;
@@ -582,31 +683,8 @@ declare const clear: (input?: {
582
683
  };
583
684
  readonly handle: string;
584
685
  readonly requires_shipping: boolean;
585
- readonly product_type: string | null;
586
686
  readonly product_title: string;
587
- readonly product_description: string | null;
588
- readonly variant_title: string | null;
589
- readonly options_with_values: readonly {
590
- readonly value: string;
591
- readonly name: string;
592
- }[];
593
- readonly line_level_discount_allocations: readonly {
594
- readonly discount_application: {
595
- readonly title: string;
596
- readonly description: string | null;
597
- readonly value: number;
598
- readonly target_selection: "all" | "entitled" | "explicit";
599
- readonly target_type: "line_item" | "shipping_line";
600
- readonly total_allocated_amount: number;
601
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
602
- readonly value_type: "fixed_amount" | "percentage";
603
- };
604
- readonly amount: number;
605
- }[];
606
687
  readonly line_level_total_discount: number;
607
- readonly has_components: boolean;
608
- readonly unit_price?: number | undefined;
609
- } & {
610
688
  readonly properties_array: readonly {
611
689
  readonly key: string;
612
690
  readonly value: string | number | boolean | null;
@@ -625,20 +703,33 @@ declare const clear: (input?: {
625
703
  readonly key: string;
626
704
  readonly value: string | number | boolean | null;
627
705
  }[];
628
- })[];
706
+ readonly quantity_rule?: {
707
+ readonly min: number;
708
+ readonly max: number | null;
709
+ readonly increment: number;
710
+ } | undefined;
711
+ readonly unit_price_measurement?: {
712
+ readonly measured_type: "volume" | "weight" | "dimension";
713
+ readonly quantity_unit: string;
714
+ readonly quantity_value: number;
715
+ readonly reference_unit: string;
716
+ readonly reference_value: number;
717
+ } | undefined;
718
+ readonly unit_price?: number | undefined;
719
+ }[];
720
+ readonly requires_shipping: boolean;
629
721
  readonly currency: string;
630
722
  readonly items_subtotal_price: number;
631
723
  readonly cart_level_discount_applications: readonly {
632
- readonly title: string;
633
- readonly description: string | null;
634
- readonly value: number;
635
724
  readonly target_selection: "all" | "entitled" | "explicit";
636
725
  readonly target_type: "line_item" | "shipping_line";
726
+ readonly title: string;
637
727
  readonly total_allocated_amount: number;
638
728
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
729
+ readonly value: number;
639
730
  readonly value_type: "fixed_amount" | "percentage";
731
+ readonly description: string | null;
640
732
  }[];
641
- } & {
642
733
  readonly attributes_array: readonly {
643
734
  readonly key: string;
644
735
  readonly value: string | number | boolean | null;
@@ -657,96 +748,97 @@ declare const clear: (input?: {
657
748
  readonly key: string;
658
749
  readonly value: string | number | boolean | null;
659
750
  }[];
660
- }) | undefined;
661
- readonly error?: {
662
- status: number;
663
- message: string;
664
- description?: string;
665
- } | undefined;
666
- }, Error, import("@effect/platform/HttpClient").HttpClient>;
667
- declare namespace get {
668
- type Input = GetInput;
669
- }
670
- declare const get: (input?: {
671
- readonly sections?: readonly string[] | undefined;
672
- readonly sections_url?: string | undefined;
673
- } | undefined, options?: {
674
- headers?: Record<string, string>;
675
- }) => import("effect/Effect").Effect<{
676
- readonly data?: undefined;
677
- readonly error?: {
678
- status: number;
679
- message: string;
680
- description?: string;
681
- } | undefined;
682
- } | {
683
- readonly data?: ({
751
+ }>;
752
+ /**
753
+ * Reads the current cart.
754
+ *
755
+ * @param input - Carries the `sections` to re-render.
756
+ * @param options - An `AbortSignal` to cancel with, and custom headers.
757
+ * @returns A Promise resolving to the cart.
758
+ */
759
+ get: (input?: {
760
+ readonly sections?: readonly string[] | undefined;
761
+ readonly sections_url?: string | undefined;
762
+ } | undefined, options?: createAjaxCartClient.RequestOptions) => Promise<{
763
+ readonly token: string;
764
+ readonly note: string | null;
684
765
  readonly attributes: {
685
766
  readonly [x: string]: string | number | boolean | null;
686
767
  };
687
- readonly total_discount: number;
688
768
  readonly discounts: readonly {
689
- readonly title: string;
690
769
  readonly amount: number;
770
+ readonly title: string;
691
771
  }[];
692
- readonly requires_shipping: boolean;
693
- readonly token: string;
694
- readonly note: string | null;
695
772
  readonly discount_codes: readonly {
696
773
  readonly code: string;
697
774
  readonly applicable: boolean;
698
775
  }[];
699
776
  readonly original_total_price: number;
700
777
  readonly total_price: number;
778
+ readonly total_discount: number;
701
779
  readonly total_weight: number;
702
780
  readonly item_count: number;
703
- readonly items: readonly ({
781
+ readonly items: readonly {
704
782
  readonly title: string;
705
783
  readonly key: string;
706
784
  readonly url: string;
707
785
  readonly image: string | null;
708
- readonly quantity_rule?: {
709
- readonly min: number;
710
- readonly max: number | null;
711
- readonly increment: number;
712
- } | undefined;
713
786
  readonly price: number;
714
787
  readonly id: string | number;
715
788
  readonly selling_plan_allocation: {
716
- readonly price: number;
717
789
  readonly price_adjustments: readonly {
718
790
  readonly position: number;
719
791
  readonly price: number;
720
792
  }[];
793
+ readonly price: number;
794
+ readonly compare_at_price: number;
795
+ readonly per_delivery_price: number;
721
796
  readonly selling_plan: {
722
- readonly description: string | null;
723
- readonly name: string;
724
797
  readonly id: string | number;
798
+ readonly name: string;
799
+ readonly description: string | null;
725
800
  readonly options: readonly {
726
- readonly value: string;
727
801
  readonly name: string;
728
802
  readonly position: number;
803
+ readonly value: string;
729
804
  }[];
730
805
  readonly recurring_deliveries: boolean;
731
806
  readonly fixed_selling_plan: boolean;
732
807
  readonly price_adjustments: readonly {
808
+ readonly order_count: number | null;
809
+ readonly position: number;
733
810
  readonly value: string | number;
734
811
  readonly value_type: "fixed_amount" | "percentage" | "price";
735
- readonly position: number;
736
- readonly order_count: number | null;
737
812
  }[];
738
813
  };
739
- readonly compare_at_price: number;
740
- readonly per_delivery_price: number;
741
814
  } | null;
742
- readonly unit_price_measurement?: {
743
- readonly measured_type: "volume" | "weight" | "dimension";
744
- readonly quantity_unit: string;
745
- readonly quantity_value: number;
746
- readonly reference_unit: string;
747
- readonly reference_value: number;
748
- } | undefined;
749
815
  readonly variant_options: readonly string[];
816
+ readonly discounts: readonly {
817
+ readonly amount: number;
818
+ readonly title: string;
819
+ }[];
820
+ readonly sku: string | null;
821
+ readonly product_type: string | null;
822
+ readonly product_description: string | null;
823
+ readonly variant_title: string | null;
824
+ readonly options_with_values: readonly {
825
+ readonly name: string;
826
+ readonly value: string;
827
+ }[];
828
+ readonly line_level_discount_allocations: readonly {
829
+ readonly amount: number;
830
+ readonly discount_application: {
831
+ readonly target_selection: "all" | "entitled" | "explicit";
832
+ readonly target_type: "line_item" | "shipping_line";
833
+ readonly title: string;
834
+ readonly total_allocated_amount: number;
835
+ readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
836
+ readonly value: number;
837
+ readonly value_type: "fixed_amount" | "percentage";
838
+ readonly description: string | null;
839
+ };
840
+ }[];
841
+ readonly has_components: boolean;
750
842
  readonly properties: {
751
843
  readonly [x: string]: string | number | boolean | null;
752
844
  };
@@ -757,11 +849,6 @@ declare const get: (input?: {
757
849
  readonly line_price: number;
758
850
  readonly original_line_price: number;
759
851
  readonly total_discount: number;
760
- readonly discounts: readonly {
761
- readonly title: string;
762
- readonly amount: number;
763
- }[];
764
- readonly sku: string | null;
765
852
  readonly grams: number;
766
853
  readonly vendor: string;
767
854
  readonly taxable: boolean;
@@ -779,31 +866,8 @@ declare const get: (input?: {
779
866
  };
780
867
  readonly handle: string;
781
868
  readonly requires_shipping: boolean;
782
- readonly product_type: string | null;
783
869
  readonly product_title: string;
784
- readonly product_description: string | null;
785
- readonly variant_title: string | null;
786
- readonly options_with_values: readonly {
787
- readonly value: string;
788
- readonly name: string;
789
- }[];
790
- readonly line_level_discount_allocations: readonly {
791
- readonly discount_application: {
792
- readonly title: string;
793
- readonly description: string | null;
794
- readonly value: number;
795
- readonly target_selection: "all" | "entitled" | "explicit";
796
- readonly target_type: "line_item" | "shipping_line";
797
- readonly total_allocated_amount: number;
798
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
799
- readonly value_type: "fixed_amount" | "percentage";
800
- };
801
- readonly amount: number;
802
- }[];
803
870
  readonly line_level_total_discount: number;
804
- readonly has_components: boolean;
805
- readonly unit_price?: number | undefined;
806
- } & {
807
871
  readonly properties_array: readonly {
808
872
  readonly key: string;
809
873
  readonly value: string | number | boolean | null;
@@ -822,20 +886,33 @@ declare const get: (input?: {
822
886
  readonly key: string;
823
887
  readonly value: string | number | boolean | null;
824
888
  }[];
825
- })[];
889
+ readonly quantity_rule?: {
890
+ readonly min: number;
891
+ readonly max: number | null;
892
+ readonly increment: number;
893
+ } | undefined;
894
+ readonly unit_price_measurement?: {
895
+ readonly measured_type: "volume" | "weight" | "dimension";
896
+ readonly quantity_unit: string;
897
+ readonly quantity_value: number;
898
+ readonly reference_unit: string;
899
+ readonly reference_value: number;
900
+ } | undefined;
901
+ readonly unit_price?: number | undefined;
902
+ }[];
903
+ readonly requires_shipping: boolean;
826
904
  readonly currency: string;
827
905
  readonly items_subtotal_price: number;
828
906
  readonly cart_level_discount_applications: readonly {
829
- readonly title: string;
830
- readonly description: string | null;
831
- readonly value: number;
832
907
  readonly target_selection: "all" | "entitled" | "explicit";
833
908
  readonly target_type: "line_item" | "shipping_line";
909
+ readonly title: string;
834
910
  readonly total_allocated_amount: number;
835
911
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
912
+ readonly value: number;
836
913
  readonly value_type: "fixed_amount" | "percentage";
914
+ readonly description: string | null;
837
915
  }[];
838
- } & {
839
916
  readonly attributes_array: readonly {
840
917
  readonly key: string;
841
918
  readonly value: string | number | boolean | null;
@@ -854,105 +931,105 @@ declare const get: (input?: {
854
931
  readonly key: string;
855
932
  readonly value: string | number | boolean | null;
856
933
  }[];
857
- }) | undefined;
858
- readonly error?: {
859
- status: number;
860
- message: string;
861
- description?: string;
862
- } | undefined;
863
- }, Error, import("@effect/platform/HttpClient").HttpClient>;
864
- declare namespace update {
865
- type Input = UpdateInput;
866
- }
867
- declare const update: (input?: ({
868
- readonly attributes?: {
869
- readonly [x: string]: string | number | boolean | null;
870
- } | undefined;
871
- readonly discount?: readonly string[] | undefined;
872
- readonly note?: string | null | undefined;
873
- readonly updates?: {
874
- readonly [x: string]: number;
875
- } | readonly number[] | undefined;
876
- } & {
877
- readonly sections?: readonly string[] | undefined;
878
- readonly sections_url?: string | undefined;
879
- }) | undefined, options?: {
880
- headers?: Record<string, string>;
881
- }) => import("effect/Effect").Effect<{
882
- readonly data?: undefined;
883
- readonly error?: {
884
- status: number;
885
- message: string;
886
- description?: string;
887
- } | undefined;
888
- } | {
889
- readonly data?: ({
934
+ }>;
935
+ /**
936
+ * Updates cart-level data - notes, attributes, discount codes.
937
+ *
938
+ * @param input - The cart-level changes to apply.
939
+ * @param options - An `AbortSignal` to cancel with, and custom headers.
940
+ * @returns A Promise resolving to the updated cart.
941
+ */
942
+ update: (input?: {
943
+ readonly attributes?: {
944
+ readonly [x: string]: string | number | boolean | null;
945
+ } | undefined;
946
+ readonly discount?: readonly string[] | undefined;
947
+ readonly note?: string | null | undefined;
948
+ readonly sections?: readonly string[] | undefined;
949
+ readonly sections_url?: string | undefined;
950
+ readonly updates?: readonly number[] | {
951
+ readonly [x: string]: number;
952
+ } | undefined;
953
+ } | undefined, options?: createAjaxCartClient.RequestOptions) => Promise<{
954
+ readonly token: string;
955
+ readonly note: string | null;
890
956
  readonly attributes: {
891
957
  readonly [x: string]: string | number | boolean | null;
892
958
  };
893
- readonly total_discount: number;
894
959
  readonly discounts: readonly {
895
- readonly title: string;
896
960
  readonly amount: number;
961
+ readonly title: string;
897
962
  }[];
898
- readonly requires_shipping: boolean;
899
- readonly token: string;
900
- readonly note: string | null;
901
963
  readonly discount_codes: readonly {
902
964
  readonly code: string;
903
965
  readonly applicable: boolean;
904
966
  }[];
905
967
  readonly original_total_price: number;
906
968
  readonly total_price: number;
969
+ readonly total_discount: number;
907
970
  readonly total_weight: number;
908
971
  readonly item_count: number;
909
- readonly items: readonly ({
972
+ readonly items: readonly {
910
973
  readonly title: string;
911
974
  readonly key: string;
912
975
  readonly url: string;
913
976
  readonly image: string | null;
914
- readonly quantity_rule?: {
915
- readonly min: number;
916
- readonly max: number | null;
917
- readonly increment: number;
918
- } | undefined;
919
977
  readonly price: number;
920
978
  readonly id: string | number;
921
979
  readonly selling_plan_allocation: {
922
- readonly price: number;
923
980
  readonly price_adjustments: readonly {
924
981
  readonly position: number;
925
982
  readonly price: number;
926
983
  }[];
984
+ readonly price: number;
985
+ readonly compare_at_price: number;
986
+ readonly per_delivery_price: number;
927
987
  readonly selling_plan: {
928
- readonly description: string | null;
929
- readonly name: string;
930
988
  readonly id: string | number;
989
+ readonly name: string;
990
+ readonly description: string | null;
931
991
  readonly options: readonly {
932
- readonly value: string;
933
992
  readonly name: string;
934
993
  readonly position: number;
994
+ readonly value: string;
935
995
  }[];
936
996
  readonly recurring_deliveries: boolean;
937
997
  readonly fixed_selling_plan: boolean;
938
998
  readonly price_adjustments: readonly {
999
+ readonly order_count: number | null;
1000
+ readonly position: number;
939
1001
  readonly value: string | number;
940
1002
  readonly value_type: "fixed_amount" | "percentage" | "price";
941
- readonly position: number;
942
- readonly order_count: number | null;
943
1003
  }[];
944
1004
  };
945
- readonly compare_at_price: number;
946
- readonly per_delivery_price: number;
947
1005
  } | null;
948
- readonly unit_price_measurement?: {
949
- readonly measured_type: "volume" | "weight" | "dimension";
950
- readonly quantity_unit: string;
951
- readonly quantity_value: number;
952
- readonly reference_unit: string;
953
- readonly reference_value: number;
954
- } | undefined;
955
1006
  readonly variant_options: readonly string[];
1007
+ readonly discounts: readonly {
1008
+ readonly amount: number;
1009
+ readonly title: string;
1010
+ }[];
1011
+ readonly sku: string | null;
1012
+ readonly product_type: string | null;
1013
+ readonly product_description: string | null;
1014
+ readonly variant_title: string | null;
1015
+ readonly options_with_values: readonly {
1016
+ readonly name: string;
1017
+ readonly value: string;
1018
+ }[];
1019
+ readonly line_level_discount_allocations: readonly {
1020
+ readonly amount: number;
1021
+ readonly discount_application: {
1022
+ readonly target_selection: "all" | "entitled" | "explicit";
1023
+ readonly target_type: "line_item" | "shipping_line";
1024
+ readonly title: string;
1025
+ readonly total_allocated_amount: number;
1026
+ readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1027
+ readonly value: number;
1028
+ readonly value_type: "fixed_amount" | "percentage";
1029
+ readonly description: string | null;
1030
+ };
1031
+ }[];
1032
+ readonly has_components: boolean;
956
1033
  readonly properties: {
957
1034
  readonly [x: string]: string | number | boolean | null;
958
1035
  };
@@ -963,11 +1040,6 @@ declare const update: (input?: ({
963
1040
  readonly line_price: number;
964
1041
  readonly original_line_price: number;
965
1042
  readonly total_discount: number;
966
- readonly discounts: readonly {
967
- readonly title: string;
968
- readonly amount: number;
969
- }[];
970
- readonly sku: string | null;
971
1043
  readonly grams: number;
972
1044
  readonly vendor: string;
973
1045
  readonly taxable: boolean;
@@ -985,31 +1057,8 @@ declare const update: (input?: ({
985
1057
  };
986
1058
  readonly handle: string;
987
1059
  readonly requires_shipping: boolean;
988
- readonly product_type: string | null;
989
1060
  readonly product_title: string;
990
- readonly product_description: string | null;
991
- readonly variant_title: string | null;
992
- readonly options_with_values: readonly {
993
- readonly value: string;
994
- readonly name: string;
995
- }[];
996
- readonly line_level_discount_allocations: readonly {
997
- readonly discount_application: {
998
- readonly title: string;
999
- readonly description: string | null;
1000
- readonly value: number;
1001
- readonly target_selection: "all" | "entitled" | "explicit";
1002
- readonly target_type: "line_item" | "shipping_line";
1003
- readonly total_allocated_amount: number;
1004
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1005
- readonly value_type: "fixed_amount" | "percentage";
1006
- };
1007
- readonly amount: number;
1008
- }[];
1009
1061
  readonly line_level_total_discount: number;
1010
- readonly has_components: boolean;
1011
- readonly unit_price?: number | undefined;
1012
- } & {
1013
1062
  readonly properties_array: readonly {
1014
1063
  readonly key: string;
1015
1064
  readonly value: string | number | boolean | null;
@@ -1028,20 +1077,33 @@ declare const update: (input?: ({
1028
1077
  readonly key: string;
1029
1078
  readonly value: string | number | boolean | null;
1030
1079
  }[];
1031
- })[];
1080
+ readonly quantity_rule?: {
1081
+ readonly min: number;
1082
+ readonly max: number | null;
1083
+ readonly increment: number;
1084
+ } | undefined;
1085
+ readonly unit_price_measurement?: {
1086
+ readonly measured_type: "volume" | "weight" | "dimension";
1087
+ readonly quantity_unit: string;
1088
+ readonly quantity_value: number;
1089
+ readonly reference_unit: string;
1090
+ readonly reference_value: number;
1091
+ } | undefined;
1092
+ readonly unit_price?: number | undefined;
1093
+ }[];
1094
+ readonly requires_shipping: boolean;
1032
1095
  readonly currency: string;
1033
1096
  readonly items_subtotal_price: number;
1034
1097
  readonly cart_level_discount_applications: readonly {
1035
- readonly title: string;
1036
- readonly description: string | null;
1037
- readonly value: number;
1038
1098
  readonly target_selection: "all" | "entitled" | "explicit";
1039
1099
  readonly target_type: "line_item" | "shipping_line";
1100
+ readonly title: string;
1040
1101
  readonly total_allocated_amount: number;
1041
1102
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1103
+ readonly value: number;
1042
1104
  readonly value_type: "fixed_amount" | "percentage";
1105
+ readonly description: string | null;
1043
1106
  }[];
1044
- } & {
1045
1107
  readonly attributes_array: readonly {
1046
1108
  readonly key: string;
1047
1109
  readonly value: string | number | boolean | null;
@@ -1060,1290 +1122,6 @@ declare const update: (input?: ({
1060
1122
  readonly key: string;
1061
1123
  readonly value: string | number | boolean | null;
1062
1124
  }[];
1063
- }) | undefined;
1064
- readonly error?: {
1065
- status: number;
1066
- message: string;
1067
- description?: string;
1068
- } | undefined;
1069
- }, Error, import("@effect/platform/HttpClient").HttpClient>;
1070
- export declare namespace createAjaxCartClient {
1071
- type Options = {
1072
- debug?: boolean;
1073
- };
1074
- type RequestOptions = {
1075
- signal?: AbortSignal;
1076
- headers?: Record<string, string>;
1077
- };
1078
- }
1079
- /**
1080
- * Validates the input cart object against the defined CartOutput schema.
1081
- *
1082
- * @remarks
1083
- * This function is used to ensure that the provided cart object adheres to the expected structure.
1084
- * It uses the `Effect.runSync` function to decode the unknown cart object using the `Schema.decodeUnknown` function.
1085
- *
1086
- * @param cart - The unknown cart object to be validated.
1087
- * @returns The validated cart object if it matches the CartOutput schema, or throws an error if it doesn't.
1088
- *
1089
- * @example
1090
- * ```typescript
1091
- * const cartData = {
1092
- * id: "1234567890",
1093
- * items: [
1094
- * {
1095
- * id: "9876543210",
1096
- * quantity: 2,
1097
- * variantId: "variant-123",
1098
- * // ... other item properties
1099
- * },
1100
- * // ... other cart items
1101
- * ],
1102
- * // ... other cart properties
1103
- * };
1104
- *
1105
- * try {
1106
- * const validatedCart = validateCart(cartData);
1107
- * console.log("Cart is valid:", validatedCart);
1108
- * } catch (error) {
1109
- * console.error("Cart validation failed:", error);
1110
- * }
1111
- * ```
1112
- */ export declare const validateCart: (cart: unknown) => {
1113
- readonly attributes: {
1114
- readonly [x: string]: string | number | boolean | null;
1115
- };
1116
- readonly total_discount: number;
1117
- readonly discounts: readonly {
1118
- readonly title: string;
1119
- readonly amount: number;
1120
- }[];
1121
- readonly requires_shipping: boolean;
1122
- readonly token: string;
1123
- readonly note: string | null;
1124
- readonly discount_codes: readonly {
1125
- readonly code: string;
1126
- readonly applicable: boolean;
1127
- }[];
1128
- readonly original_total_price: number;
1129
- readonly total_price: number;
1130
- readonly total_weight: number;
1131
- readonly item_count: number;
1132
- readonly items: readonly ({
1133
- readonly title: string;
1134
- readonly key: string;
1135
- readonly url: string;
1136
- readonly image: string | null;
1137
- readonly quantity_rule?: {
1138
- readonly min: number;
1139
- readonly max: number | null;
1140
- readonly increment: number;
1141
- } | undefined;
1142
- readonly price: number;
1143
- readonly id: string | number;
1144
- readonly selling_plan_allocation: {
1145
- readonly price: number;
1146
- readonly price_adjustments: readonly {
1147
- readonly position: number;
1148
- readonly price: number;
1149
- }[];
1150
- readonly selling_plan: {
1151
- readonly description: string | null;
1152
- readonly name: string;
1153
- readonly id: string | number;
1154
- readonly options: readonly {
1155
- readonly value: string;
1156
- readonly name: string;
1157
- readonly position: number;
1158
- }[];
1159
- readonly recurring_deliveries: boolean;
1160
- readonly fixed_selling_plan: boolean;
1161
- readonly price_adjustments: readonly {
1162
- readonly value: string | number;
1163
- readonly value_type: "fixed_amount" | "percentage" | "price";
1164
- readonly position: number;
1165
- readonly order_count: number | null;
1166
- }[];
1167
- };
1168
- readonly compare_at_price: number;
1169
- readonly per_delivery_price: number;
1170
- } | null;
1171
- readonly unit_price_measurement?: {
1172
- readonly measured_type: "volume" | "weight" | "dimension";
1173
- readonly quantity_unit: string;
1174
- readonly quantity_value: number;
1175
- readonly reference_unit: string;
1176
- readonly reference_value: number;
1177
- } | undefined;
1178
- readonly variant_options: readonly string[];
1179
- readonly properties: {
1180
- readonly [x: string]: string | number | boolean | null;
1181
- };
1182
- readonly quantity: number;
1183
- readonly variant_id: string | number;
1184
- readonly original_price: number;
1185
- readonly discounted_price: number;
1186
- readonly line_price: number;
1187
- readonly original_line_price: number;
1188
- readonly total_discount: number;
1189
- readonly discounts: readonly {
1190
- readonly title: string;
1191
- readonly amount: number;
1192
- }[];
1193
- readonly sku: string | null;
1194
- readonly grams: number;
1195
- readonly vendor: string;
1196
- readonly taxable: boolean;
1197
- readonly product_id: string | number;
1198
- readonly product_has_only_default_variant: boolean;
1199
- readonly gift_card: boolean;
1200
- readonly final_line_price: number;
1201
- readonly final_price: number;
1202
- readonly featured_image: {
1203
- readonly aspect_ratio: number | null;
1204
- readonly alt: string | null;
1205
- readonly height: number | null;
1206
- readonly url: string | null;
1207
- readonly width: number | null;
1208
- };
1209
- readonly handle: string;
1210
- readonly requires_shipping: boolean;
1211
- readonly product_type: string | null;
1212
- readonly product_title: string;
1213
- readonly product_description: string | null;
1214
- readonly variant_title: string | null;
1215
- readonly options_with_values: readonly {
1216
- readonly value: string;
1217
- readonly name: string;
1218
- }[];
1219
- readonly line_level_discount_allocations: readonly {
1220
- readonly discount_application: {
1221
- readonly title: string;
1222
- readonly description: string | null;
1223
- readonly value: number;
1224
- readonly target_selection: "all" | "entitled" | "explicit";
1225
- readonly target_type: "line_item" | "shipping_line";
1226
- readonly total_allocated_amount: number;
1227
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1228
- readonly value_type: "fixed_amount" | "percentage";
1229
- };
1230
- readonly amount: number;
1231
- }[];
1232
- readonly line_level_total_discount: number;
1233
- readonly has_components: boolean;
1234
- readonly unit_price?: number | undefined;
1235
- } & {
1236
- readonly properties_array: readonly {
1237
- readonly key: string;
1238
- readonly value: string | number | boolean | null;
1239
- }[];
1240
- readonly private_properties: {
1241
- readonly [x: string]: string | number | boolean | null;
1242
- };
1243
- readonly private_properties_array: readonly {
1244
- readonly key: string;
1245
- readonly value: string | number | boolean | null;
1246
- }[];
1247
- readonly public_properties: {
1248
- readonly [x: string]: string | number | boolean | null;
1249
- };
1250
- readonly public_properties_array: readonly {
1251
- readonly key: string;
1252
- readonly value: string | number | boolean | null;
1253
- }[];
1254
- })[];
1255
- readonly currency: string;
1256
- readonly items_subtotal_price: number;
1257
- readonly cart_level_discount_applications: readonly {
1258
- readonly title: string;
1259
- readonly description: string | null;
1260
- readonly value: number;
1261
- readonly target_selection: "all" | "entitled" | "explicit";
1262
- readonly target_type: "line_item" | "shipping_line";
1263
- readonly total_allocated_amount: number;
1264
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1265
- readonly value_type: "fixed_amount" | "percentage";
1266
- }[];
1267
- } & {
1268
- readonly attributes_array: readonly {
1269
- readonly key: string;
1270
- readonly value: string | number | boolean | null;
1271
- }[];
1272
- readonly private_attributes: {
1273
- readonly [x: string]: string | number | boolean | null;
1274
- };
1275
- readonly private_attributes_array: readonly {
1276
- readonly key: string;
1277
- readonly value: string | number | boolean | null;
1278
- }[];
1279
- readonly public_attributes: {
1280
- readonly [x: string]: string | number | boolean | null;
1281
- };
1282
- readonly public_attributes_array: readonly {
1283
- readonly key: string;
1284
- readonly value: string | number | boolean | null;
1285
- }[];
1286
- };
1287
- /**
1288
- * Creates an instance of the Ajax Cart API client with optional debugging capabilities.
1289
- *
1290
- * @remarks
1291
- * This function initializes the Ajax Cart API client with the provided options.
1292
- * It sets up the necessary layers for logging and AJAX requests based on the debug flag.
1293
- *
1294
- * @param options - An optional object containing debug flag.
1295
- * @param options.debug - A boolean indicating whether to enable debugging. Default is false.
1296
- *
1297
- * @returns An object containing the Ajax Cart API methods: add, change, clear, get, and update.
1298
- *
1299
- * @example
1300
- * ```typescript
1301
- * const ajaxCartApi = createAjaxCartApi({ debug: true });
1302
- *
1303
- * // Use the Ajax Cart API methods
1304
- * ajaxCartApi.add({ productId: "123", quantity: 2 })
1305
- * .then((response) => {
1306
- * console.log("Cart updated:", response);
1307
- * })
1308
- * .catch((error) => {
1309
- * console.error("Failed to update cart:", error);
1310
- * });
1311
- * ```
1312
- */
1313
- export declare const createAjaxCartApi: ({ debug }: {
1314
- debug?: boolean | undefined;
1315
- }) => {
1316
- /**
1317
- * Adds a product to the cart.
1318
- *
1319
- * @param input - The input object containing the product ID and quantity to be added.
1320
- * @param options - An optional object containing request options.
1321
- * @param options.signal - An AbortSignal object to abort the request.
1322
- * @param options.headers - Custom headers to be sent with the request.
1323
- *
1324
- * @returns A Promise that resolves to the updated cart object.
1325
- *
1326
- * @example
1327
- * ```typescript
1328
- * const ajaxCartApi = createAjaxCartApi({ debug: true });
1329
- *
1330
- * ajaxCartApi.add({ productId: "123", quantity: 2 })
1331
- * .then((response) => {
1332
- * console.log("Cart updated:", response);
1333
- * })
1334
- * .catch((error) => {
1335
- * console.error("Failed to update cart:", error);
1336
- * });
1337
- * ```
1338
- */
1339
- add: (input: add.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
1340
- readonly data?: undefined;
1341
- readonly error?: {
1342
- status: number;
1343
- message: string;
1344
- description?: string;
1345
- } | undefined;
1346
- } | {
1347
- readonly data?: {
1348
- readonly items: readonly ({
1349
- readonly title: string;
1350
- readonly key: string;
1351
- readonly url: string;
1352
- readonly image: string | null;
1353
- readonly quantity_rule?: {
1354
- readonly min: number;
1355
- readonly max: number | null;
1356
- readonly increment: number;
1357
- } | undefined;
1358
- readonly price: number;
1359
- readonly id: string | number;
1360
- readonly selling_plan_allocation: {
1361
- readonly price: number;
1362
- readonly price_adjustments: readonly {
1363
- readonly position: number;
1364
- readonly price: number;
1365
- }[];
1366
- readonly selling_plan: {
1367
- readonly description: string | null;
1368
- readonly name: string;
1369
- readonly id: string | number;
1370
- readonly options: readonly {
1371
- readonly value: string;
1372
- readonly name: string;
1373
- readonly position: number;
1374
- }[];
1375
- readonly recurring_deliveries: boolean;
1376
- readonly fixed_selling_plan: boolean;
1377
- readonly price_adjustments: readonly {
1378
- readonly value: string | number;
1379
- readonly value_type: "fixed_amount" | "percentage" | "price";
1380
- readonly position: number;
1381
- readonly order_count: number | null;
1382
- }[];
1383
- };
1384
- readonly compare_at_price: number;
1385
- readonly per_delivery_price: number;
1386
- } | null;
1387
- readonly unit_price_measurement?: {
1388
- readonly measured_type: "volume" | "weight" | "dimension";
1389
- readonly quantity_unit: string;
1390
- readonly quantity_value: number;
1391
- readonly reference_unit: string;
1392
- readonly reference_value: number;
1393
- } | undefined;
1394
- readonly variant_options: readonly string[];
1395
- readonly properties: {
1396
- readonly [x: string]: string | number | boolean | null;
1397
- };
1398
- readonly quantity: number;
1399
- readonly variant_id: string | number;
1400
- readonly original_price: number;
1401
- readonly discounted_price: number;
1402
- readonly line_price: number;
1403
- readonly original_line_price: number;
1404
- readonly total_discount: number;
1405
- readonly discounts: readonly {
1406
- readonly title: string;
1407
- readonly amount: number;
1408
- }[];
1409
- readonly sku: string | null;
1410
- readonly grams: number;
1411
- readonly vendor: string;
1412
- readonly taxable: boolean;
1413
- readonly product_id: string | number;
1414
- readonly product_has_only_default_variant: boolean;
1415
- readonly gift_card: boolean;
1416
- readonly final_line_price: number;
1417
- readonly final_price: number;
1418
- readonly featured_image: {
1419
- readonly aspect_ratio: number | null;
1420
- readonly alt: string | null;
1421
- readonly height: number | null;
1422
- readonly url: string | null;
1423
- readonly width: number | null;
1424
- };
1425
- readonly handle: string;
1426
- readonly requires_shipping: boolean;
1427
- readonly product_type: string | null;
1428
- readonly product_title: string;
1429
- readonly product_description: string | null;
1430
- readonly variant_title: string | null;
1431
- readonly options_with_values: readonly {
1432
- readonly value: string;
1433
- readonly name: string;
1434
- }[];
1435
- readonly line_level_discount_allocations: readonly {
1436
- readonly discount_application: {
1437
- readonly title: string;
1438
- readonly description: string | null;
1439
- readonly value: number;
1440
- readonly target_selection: "all" | "entitled" | "explicit";
1441
- readonly target_type: "line_item" | "shipping_line";
1442
- readonly total_allocated_amount: number;
1443
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1444
- readonly value_type: "fixed_amount" | "percentage";
1445
- };
1446
- readonly amount: number;
1447
- }[];
1448
- readonly line_level_total_discount: number;
1449
- readonly has_components: boolean;
1450
- readonly unit_price?: number | undefined;
1451
- } & {
1452
- readonly properties_array: readonly {
1453
- readonly key: string;
1454
- readonly value: string | number | boolean | null;
1455
- }[];
1456
- readonly private_properties: {
1457
- readonly [x: string]: string | number | boolean | null;
1458
- };
1459
- readonly private_properties_array: readonly {
1460
- readonly key: string;
1461
- readonly value: string | number | boolean | null;
1462
- }[];
1463
- readonly public_properties: {
1464
- readonly [x: string]: string | number | boolean | null;
1465
- };
1466
- readonly public_properties_array: readonly {
1467
- readonly key: string;
1468
- readonly value: string | number | boolean | null;
1469
- }[];
1470
- })[];
1471
- } | undefined;
1472
- readonly error?: {
1473
- status: number;
1474
- message: string;
1475
- description?: string;
1476
- } | undefined;
1477
- }>;
1478
- /**
1479
- * Updates the quantity, attributes, or selling plan of a specific item in the cart.
1480
- *
1481
- * @remarks
1482
- * This function sends a request to update the quantity, attributes, or selling plan of a specific item in the cart.
1483
- * It uses the provided input object to specify the item ID and the new quantity, attributes, or selling plan.
1484
- * The function also accepts optional request options, such as an AbortSignal for cancellation.
1485
- *
1486
- * @param input - The input object containing the item ID and the new quantity.
1487
- * @param options - An optional object containing request options.
1488
- * @param options.signal - An AbortSignal object to abort the request.
1489
- * @param options.headers - Custom headers to be sent with the request.
1490
- *
1491
- * @returns A Promise that resolves to the updated cart object.
1492
- *
1493
- * @example
1494
- * ```typescript
1495
- * const ajaxCartApi = createAjaxCartApi({ debug: true });
1496
- *
1497
- * ajaxCartApi.change({ itemId: "9876543210", quantity: 3 })
1498
- * .then((response) => {
1499
- * console.log("Cart updated:", response);
1500
- * })
1501
- * .catch((error) => {
1502
- * console.error("Failed to update cart:", error);
1503
- * });
1504
- * ```
1505
- */
1506
- change: (input: change.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
1507
- readonly data?: undefined;
1508
- readonly error?: {
1509
- status: number;
1510
- message: string;
1511
- description?: string;
1512
- } | undefined;
1513
- } | {
1514
- readonly data?: ({
1515
- readonly attributes: {
1516
- readonly [x: string]: string | number | boolean | null;
1517
- };
1518
- readonly total_discount: number;
1519
- readonly discounts: readonly {
1520
- readonly title: string;
1521
- readonly amount: number;
1522
- }[];
1523
- readonly requires_shipping: boolean;
1524
- readonly token: string;
1525
- readonly note: string | null;
1526
- readonly discount_codes: readonly {
1527
- readonly code: string;
1528
- readonly applicable: boolean;
1529
- }[];
1530
- readonly original_total_price: number;
1531
- readonly total_price: number;
1532
- readonly total_weight: number;
1533
- readonly item_count: number;
1534
- readonly items: readonly ({
1535
- readonly title: string;
1536
- readonly key: string;
1537
- readonly url: string;
1538
- readonly image: string | null;
1539
- readonly quantity_rule?: {
1540
- readonly min: number;
1541
- readonly max: number | null;
1542
- readonly increment: number;
1543
- } | undefined;
1544
- readonly price: number;
1545
- readonly id: string | number;
1546
- readonly selling_plan_allocation: {
1547
- readonly price: number;
1548
- readonly price_adjustments: readonly {
1549
- readonly position: number;
1550
- readonly price: number;
1551
- }[];
1552
- readonly selling_plan: {
1553
- readonly description: string | null;
1554
- readonly name: string;
1555
- readonly id: string | number;
1556
- readonly options: readonly {
1557
- readonly value: string;
1558
- readonly name: string;
1559
- readonly position: number;
1560
- }[];
1561
- readonly recurring_deliveries: boolean;
1562
- readonly fixed_selling_plan: boolean;
1563
- readonly price_adjustments: readonly {
1564
- readonly value: string | number;
1565
- readonly value_type: "fixed_amount" | "percentage" | "price";
1566
- readonly position: number;
1567
- readonly order_count: number | null;
1568
- }[];
1569
- };
1570
- readonly compare_at_price: number;
1571
- readonly per_delivery_price: number;
1572
- } | null;
1573
- readonly unit_price_measurement?: {
1574
- readonly measured_type: "volume" | "weight" | "dimension";
1575
- readonly quantity_unit: string;
1576
- readonly quantity_value: number;
1577
- readonly reference_unit: string;
1578
- readonly reference_value: number;
1579
- } | undefined;
1580
- readonly variant_options: readonly string[];
1581
- readonly properties: {
1582
- readonly [x: string]: string | number | boolean | null;
1583
- };
1584
- readonly quantity: number;
1585
- readonly variant_id: string | number;
1586
- readonly original_price: number;
1587
- readonly discounted_price: number;
1588
- readonly line_price: number;
1589
- readonly original_line_price: number;
1590
- readonly total_discount: number;
1591
- readonly discounts: readonly {
1592
- readonly title: string;
1593
- readonly amount: number;
1594
- }[];
1595
- readonly sku: string | null;
1596
- readonly grams: number;
1597
- readonly vendor: string;
1598
- readonly taxable: boolean;
1599
- readonly product_id: string | number;
1600
- readonly product_has_only_default_variant: boolean;
1601
- readonly gift_card: boolean;
1602
- readonly final_line_price: number;
1603
- readonly final_price: number;
1604
- readonly featured_image: {
1605
- readonly aspect_ratio: number | null;
1606
- readonly alt: string | null;
1607
- readonly height: number | null;
1608
- readonly url: string | null;
1609
- readonly width: number | null;
1610
- };
1611
- readonly handle: string;
1612
- readonly requires_shipping: boolean;
1613
- readonly product_type: string | null;
1614
- readonly product_title: string;
1615
- readonly product_description: string | null;
1616
- readonly variant_title: string | null;
1617
- readonly options_with_values: readonly {
1618
- readonly value: string;
1619
- readonly name: string;
1620
- }[];
1621
- readonly line_level_discount_allocations: readonly {
1622
- readonly discount_application: {
1623
- readonly title: string;
1624
- readonly description: string | null;
1625
- readonly value: number;
1626
- readonly target_selection: "all" | "entitled" | "explicit";
1627
- readonly target_type: "line_item" | "shipping_line";
1628
- readonly total_allocated_amount: number;
1629
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1630
- readonly value_type: "fixed_amount" | "percentage";
1631
- };
1632
- readonly amount: number;
1633
- }[];
1634
- readonly line_level_total_discount: number;
1635
- readonly has_components: boolean;
1636
- readonly unit_price?: number | undefined;
1637
- } & {
1638
- readonly properties_array: readonly {
1639
- readonly key: string;
1640
- readonly value: string | number | boolean | null;
1641
- }[];
1642
- readonly private_properties: {
1643
- readonly [x: string]: string | number | boolean | null;
1644
- };
1645
- readonly private_properties_array: readonly {
1646
- readonly key: string;
1647
- readonly value: string | number | boolean | null;
1648
- }[];
1649
- readonly public_properties: {
1650
- readonly [x: string]: string | number | boolean | null;
1651
- };
1652
- readonly public_properties_array: readonly {
1653
- readonly key: string;
1654
- readonly value: string | number | boolean | null;
1655
- }[];
1656
- })[];
1657
- readonly currency: string;
1658
- readonly items_subtotal_price: number;
1659
- readonly cart_level_discount_applications: readonly {
1660
- readonly title: string;
1661
- readonly description: string | null;
1662
- readonly value: number;
1663
- readonly target_selection: "all" | "entitled" | "explicit";
1664
- readonly target_type: "line_item" | "shipping_line";
1665
- readonly total_allocated_amount: number;
1666
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1667
- readonly value_type: "fixed_amount" | "percentage";
1668
- }[];
1669
- } & {
1670
- readonly attributes_array: readonly {
1671
- readonly key: string;
1672
- readonly value: string | number | boolean | null;
1673
- }[];
1674
- readonly private_attributes: {
1675
- readonly [x: string]: string | number | boolean | null;
1676
- };
1677
- readonly private_attributes_array: readonly {
1678
- readonly key: string;
1679
- readonly value: string | number | boolean | null;
1680
- }[];
1681
- readonly public_attributes: {
1682
- readonly [x: string]: string | number | boolean | null;
1683
- };
1684
- readonly public_attributes_array: readonly {
1685
- readonly key: string;
1686
- readonly value: string | number | boolean | null;
1687
- }[];
1688
- }) | undefined;
1689
- readonly error?: {
1690
- status: number;
1691
- message: string;
1692
- description?: string;
1693
- } | undefined;
1694
- }>;
1695
- /**
1696
- * Clears the entire cart.
1697
- *
1698
- * This function sends a request to clear the entire cart. It does not require any input parameters.
1699
- * The function accepts optional request options, such as an AbortSignal for cancellation.
1700
- *
1701
- * @param input - An optional input object containing request options.
1702
- * @param input.signal - An AbortSignal object to abort the request.
1703
- * @param input.headers - Custom headers to be sent with the request.
1704
- *
1705
- * @returns A Promise that resolves to an empty object upon successful cart clearance.
1706
- *
1707
- * @example
1708
- * ```typescript
1709
- * const ajaxCartApi = createAjaxCartApi({ debug: true });
1710
- *
1711
- * ajaxCartApi.clear()
1712
- * .then(() => {
1713
- * console.log("Cart cleared successfully");
1714
- * })
1715
- * .catch((error) => {
1716
- * console.error("Failed to clear cart:", error);
1717
- * });
1718
- * ```
1719
- */
1720
- clear: (input: clear.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
1721
- readonly data?: undefined;
1722
- readonly error?: {
1723
- status: number;
1724
- message: string;
1725
- description?: string;
1726
- } | undefined;
1727
- } | {
1728
- readonly data?: ({
1729
- readonly attributes: {
1730
- readonly [x: string]: string | number | boolean | null;
1731
- };
1732
- readonly total_discount: number;
1733
- readonly discounts: readonly {
1734
- readonly title: string;
1735
- readonly amount: number;
1736
- }[];
1737
- readonly requires_shipping: boolean;
1738
- readonly token: string;
1739
- readonly note: string | null;
1740
- readonly discount_codes: readonly {
1741
- readonly code: string;
1742
- readonly applicable: boolean;
1743
- }[];
1744
- readonly original_total_price: number;
1745
- readonly total_price: number;
1746
- readonly total_weight: number;
1747
- readonly item_count: number;
1748
- readonly items: readonly ({
1749
- readonly title: string;
1750
- readonly key: string;
1751
- readonly url: string;
1752
- readonly image: string | null;
1753
- readonly quantity_rule?: {
1754
- readonly min: number;
1755
- readonly max: number | null;
1756
- readonly increment: number;
1757
- } | undefined;
1758
- readonly price: number;
1759
- readonly id: string | number;
1760
- readonly selling_plan_allocation: {
1761
- readonly price: number;
1762
- readonly price_adjustments: readonly {
1763
- readonly position: number;
1764
- readonly price: number;
1765
- }[];
1766
- readonly selling_plan: {
1767
- readonly description: string | null;
1768
- readonly name: string;
1769
- readonly id: string | number;
1770
- readonly options: readonly {
1771
- readonly value: string;
1772
- readonly name: string;
1773
- readonly position: number;
1774
- }[];
1775
- readonly recurring_deliveries: boolean;
1776
- readonly fixed_selling_plan: boolean;
1777
- readonly price_adjustments: readonly {
1778
- readonly value: string | number;
1779
- readonly value_type: "fixed_amount" | "percentage" | "price";
1780
- readonly position: number;
1781
- readonly order_count: number | null;
1782
- }[];
1783
- };
1784
- readonly compare_at_price: number;
1785
- readonly per_delivery_price: number;
1786
- } | null;
1787
- readonly unit_price_measurement?: {
1788
- readonly measured_type: "volume" | "weight" | "dimension";
1789
- readonly quantity_unit: string;
1790
- readonly quantity_value: number;
1791
- readonly reference_unit: string;
1792
- readonly reference_value: number;
1793
- } | undefined;
1794
- readonly variant_options: readonly string[];
1795
- readonly properties: {
1796
- readonly [x: string]: string | number | boolean | null;
1797
- };
1798
- readonly quantity: number;
1799
- readonly variant_id: string | number;
1800
- readonly original_price: number;
1801
- readonly discounted_price: number;
1802
- readonly line_price: number;
1803
- readonly original_line_price: number;
1804
- readonly total_discount: number;
1805
- readonly discounts: readonly {
1806
- readonly title: string;
1807
- readonly amount: number;
1808
- }[];
1809
- readonly sku: string | null;
1810
- readonly grams: number;
1811
- readonly vendor: string;
1812
- readonly taxable: boolean;
1813
- readonly product_id: string | number;
1814
- readonly product_has_only_default_variant: boolean;
1815
- readonly gift_card: boolean;
1816
- readonly final_line_price: number;
1817
- readonly final_price: number;
1818
- readonly featured_image: {
1819
- readonly aspect_ratio: number | null;
1820
- readonly alt: string | null;
1821
- readonly height: number | null;
1822
- readonly url: string | null;
1823
- readonly width: number | null;
1824
- };
1825
- readonly handle: string;
1826
- readonly requires_shipping: boolean;
1827
- readonly product_type: string | null;
1828
- readonly product_title: string;
1829
- readonly product_description: string | null;
1830
- readonly variant_title: string | null;
1831
- readonly options_with_values: readonly {
1832
- readonly value: string;
1833
- readonly name: string;
1834
- }[];
1835
- readonly line_level_discount_allocations: readonly {
1836
- readonly discount_application: {
1837
- readonly title: string;
1838
- readonly description: string | null;
1839
- readonly value: number;
1840
- readonly target_selection: "all" | "entitled" | "explicit";
1841
- readonly target_type: "line_item" | "shipping_line";
1842
- readonly total_allocated_amount: number;
1843
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1844
- readonly value_type: "fixed_amount" | "percentage";
1845
- };
1846
- readonly amount: number;
1847
- }[];
1848
- readonly line_level_total_discount: number;
1849
- readonly has_components: boolean;
1850
- readonly unit_price?: number | undefined;
1851
- } & {
1852
- readonly properties_array: readonly {
1853
- readonly key: string;
1854
- readonly value: string | number | boolean | null;
1855
- }[];
1856
- readonly private_properties: {
1857
- readonly [x: string]: string | number | boolean | null;
1858
- };
1859
- readonly private_properties_array: readonly {
1860
- readonly key: string;
1861
- readonly value: string | number | boolean | null;
1862
- }[];
1863
- readonly public_properties: {
1864
- readonly [x: string]: string | number | boolean | null;
1865
- };
1866
- readonly public_properties_array: readonly {
1867
- readonly key: string;
1868
- readonly value: string | number | boolean | null;
1869
- }[];
1870
- })[];
1871
- readonly currency: string;
1872
- readonly items_subtotal_price: number;
1873
- readonly cart_level_discount_applications: readonly {
1874
- readonly title: string;
1875
- readonly description: string | null;
1876
- readonly value: number;
1877
- readonly target_selection: "all" | "entitled" | "explicit";
1878
- readonly target_type: "line_item" | "shipping_line";
1879
- readonly total_allocated_amount: number;
1880
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1881
- readonly value_type: "fixed_amount" | "percentage";
1882
- }[];
1883
- } & {
1884
- readonly attributes_array: readonly {
1885
- readonly key: string;
1886
- readonly value: string | number | boolean | null;
1887
- }[];
1888
- readonly private_attributes: {
1889
- readonly [x: string]: string | number | boolean | null;
1890
- };
1891
- readonly private_attributes_array: readonly {
1892
- readonly key: string;
1893
- readonly value: string | number | boolean | null;
1894
- }[];
1895
- readonly public_attributes: {
1896
- readonly [x: string]: string | number | boolean | null;
1897
- };
1898
- readonly public_attributes_array: readonly {
1899
- readonly key: string;
1900
- readonly value: string | number | boolean | null;
1901
- }[];
1902
- }) | undefined;
1903
- readonly error?: {
1904
- status: number;
1905
- message: string;
1906
- description?: string;
1907
- } | undefined;
1908
- }>;
1909
- /**
1910
- * Retrieves the current state of the cart.
1911
- *
1912
- * This function sends a request to retrieve the current state of the cart.
1913
- * It does not require any input parameters.
1914
- * The function accepts optional request options, such as an AbortSignal for cancellation.
1915
- *
1916
- * @param input - An optional input object containing request options.
1917
- * @param input.signal - An AbortSignal object to abort the request.
1918
- * @param input.headers - Custom headers to be sent with the request.
1919
- *
1920
- * @returns A Promise that resolves to the current cart object.
1921
- *
1922
- * @example
1923
- * ```typescript
1924
- * const ajaxCartApi = createAjaxCartApi({ debug: true });
1925
- *
1926
- * ajaxCartApi.get()
1927
- * .then((response) => {
1928
- * console.log("Current cart:", response);
1929
- * })
1930
- * .catch((error) => {
1931
- * console.error("Failed to retrieve cart:", error);
1932
- * });
1933
- * ```
1934
- */
1935
- get: (input: get.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
1936
- readonly data?: undefined;
1937
- readonly error?: {
1938
- status: number;
1939
- message: string;
1940
- description?: string;
1941
- } | undefined;
1942
- } | {
1943
- readonly data?: ({
1944
- readonly attributes: {
1945
- readonly [x: string]: string | number | boolean | null;
1946
- };
1947
- readonly total_discount: number;
1948
- readonly discounts: readonly {
1949
- readonly title: string;
1950
- readonly amount: number;
1951
- }[];
1952
- readonly requires_shipping: boolean;
1953
- readonly token: string;
1954
- readonly note: string | null;
1955
- readonly discount_codes: readonly {
1956
- readonly code: string;
1957
- readonly applicable: boolean;
1958
- }[];
1959
- readonly original_total_price: number;
1960
- readonly total_price: number;
1961
- readonly total_weight: number;
1962
- readonly item_count: number;
1963
- readonly items: readonly ({
1964
- readonly title: string;
1965
- readonly key: string;
1966
- readonly url: string;
1967
- readonly image: string | null;
1968
- readonly quantity_rule?: {
1969
- readonly min: number;
1970
- readonly max: number | null;
1971
- readonly increment: number;
1972
- } | undefined;
1973
- readonly price: number;
1974
- readonly id: string | number;
1975
- readonly selling_plan_allocation: {
1976
- readonly price: number;
1977
- readonly price_adjustments: readonly {
1978
- readonly position: number;
1979
- readonly price: number;
1980
- }[];
1981
- readonly selling_plan: {
1982
- readonly description: string | null;
1983
- readonly name: string;
1984
- readonly id: string | number;
1985
- readonly options: readonly {
1986
- readonly value: string;
1987
- readonly name: string;
1988
- readonly position: number;
1989
- }[];
1990
- readonly recurring_deliveries: boolean;
1991
- readonly fixed_selling_plan: boolean;
1992
- readonly price_adjustments: readonly {
1993
- readonly value: string | number;
1994
- readonly value_type: "fixed_amount" | "percentage" | "price";
1995
- readonly position: number;
1996
- readonly order_count: number | null;
1997
- }[];
1998
- };
1999
- readonly compare_at_price: number;
2000
- readonly per_delivery_price: number;
2001
- } | null;
2002
- readonly unit_price_measurement?: {
2003
- readonly measured_type: "volume" | "weight" | "dimension";
2004
- readonly quantity_unit: string;
2005
- readonly quantity_value: number;
2006
- readonly reference_unit: string;
2007
- readonly reference_value: number;
2008
- } | undefined;
2009
- readonly variant_options: readonly string[];
2010
- readonly properties: {
2011
- readonly [x: string]: string | number | boolean | null;
2012
- };
2013
- readonly quantity: number;
2014
- readonly variant_id: string | number;
2015
- readonly original_price: number;
2016
- readonly discounted_price: number;
2017
- readonly line_price: number;
2018
- readonly original_line_price: number;
2019
- readonly total_discount: number;
2020
- readonly discounts: readonly {
2021
- readonly title: string;
2022
- readonly amount: number;
2023
- }[];
2024
- readonly sku: string | null;
2025
- readonly grams: number;
2026
- readonly vendor: string;
2027
- readonly taxable: boolean;
2028
- readonly product_id: string | number;
2029
- readonly product_has_only_default_variant: boolean;
2030
- readonly gift_card: boolean;
2031
- readonly final_line_price: number;
2032
- readonly final_price: number;
2033
- readonly featured_image: {
2034
- readonly aspect_ratio: number | null;
2035
- readonly alt: string | null;
2036
- readonly height: number | null;
2037
- readonly url: string | null;
2038
- readonly width: number | null;
2039
- };
2040
- readonly handle: string;
2041
- readonly requires_shipping: boolean;
2042
- readonly product_type: string | null;
2043
- readonly product_title: string;
2044
- readonly product_description: string | null;
2045
- readonly variant_title: string | null;
2046
- readonly options_with_values: readonly {
2047
- readonly value: string;
2048
- readonly name: string;
2049
- }[];
2050
- readonly line_level_discount_allocations: readonly {
2051
- readonly discount_application: {
2052
- readonly title: string;
2053
- readonly description: string | null;
2054
- readonly value: number;
2055
- readonly target_selection: "all" | "entitled" | "explicit";
2056
- readonly target_type: "line_item" | "shipping_line";
2057
- readonly total_allocated_amount: number;
2058
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
2059
- readonly value_type: "fixed_amount" | "percentage";
2060
- };
2061
- readonly amount: number;
2062
- }[];
2063
- readonly line_level_total_discount: number;
2064
- readonly has_components: boolean;
2065
- readonly unit_price?: number | undefined;
2066
- } & {
2067
- readonly properties_array: readonly {
2068
- readonly key: string;
2069
- readonly value: string | number | boolean | null;
2070
- }[];
2071
- readonly private_properties: {
2072
- readonly [x: string]: string | number | boolean | null;
2073
- };
2074
- readonly private_properties_array: readonly {
2075
- readonly key: string;
2076
- readonly value: string | number | boolean | null;
2077
- }[];
2078
- readonly public_properties: {
2079
- readonly [x: string]: string | number | boolean | null;
2080
- };
2081
- readonly public_properties_array: readonly {
2082
- readonly key: string;
2083
- readonly value: string | number | boolean | null;
2084
- }[];
2085
- })[];
2086
- readonly currency: string;
2087
- readonly items_subtotal_price: number;
2088
- readonly cart_level_discount_applications: readonly {
2089
- readonly title: string;
2090
- readonly description: string | null;
2091
- readonly value: number;
2092
- readonly target_selection: "all" | "entitled" | "explicit";
2093
- readonly target_type: "line_item" | "shipping_line";
2094
- readonly total_allocated_amount: number;
2095
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
2096
- readonly value_type: "fixed_amount" | "percentage";
2097
- }[];
2098
- } & {
2099
- readonly attributes_array: readonly {
2100
- readonly key: string;
2101
- readonly value: string | number | boolean | null;
2102
- }[];
2103
- readonly private_attributes: {
2104
- readonly [x: string]: string | number | boolean | null;
2105
- };
2106
- readonly private_attributes_array: readonly {
2107
- readonly key: string;
2108
- readonly value: string | number | boolean | null;
2109
- }[];
2110
- readonly public_attributes: {
2111
- readonly [x: string]: string | number | boolean | null;
2112
- };
2113
- readonly public_attributes_array: readonly {
2114
- readonly key: string;
2115
- readonly value: string | number | boolean | null;
2116
- }[];
2117
- }) | undefined;
2118
- readonly error?: {
2119
- status: number;
2120
- message: string;
2121
- description?: string;
2122
- } | undefined;
2123
- }>;
2124
- /**
2125
- * Updates the cart with the provided input data.
2126
- *
2127
- * This function sends a request to update any cart level data (discount codes, notes, attributes, etc...).
2128
- * It uses the provided input object to specify the changes to be made to the cart.
2129
- * The function also accepts optional request options, such as an AbortSignal for cancellation.
2130
- *
2131
- * @param input - The input object containing the changes to be made to the cart.
2132
- * @param options - An optional object containing request options.
2133
- * @param options.signal - An AbortSignal object to abort the request.
2134
- * @param options.headers - Custom headers to be sent with the request.
2135
- *
2136
- * @returns A Promise that resolves to the updated cart object.
2137
- *
2138
- * @example
2139
- * ```typescript
2140
- * const ajaxCartApi = createAjaxCartApi({ debug: true });
2141
- *
2142
- * ajaxCartApi.update({
2143
- * updates: { 1231231: 2, 1231230: 0 },
2144
- * note: "This is a note",
2145
- * attributes: {
2146
- * "public_key": "Public value",
2147
- * "_private_key": "Private value"
2148
- * },
2149
- * discount: ["hello","world"]
2150
- * })
2151
- * .then((response) => {
2152
- * console.log("Cart updated:", response);
2153
- * })
2154
- * .catch((error) => {
2155
- * console.error("Failed to update cart:", error);
2156
- * });
2157
- * ```
2158
- */
2159
- update: (input: update.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
2160
- readonly data?: undefined;
2161
- readonly error?: {
2162
- status: number;
2163
- message: string;
2164
- description?: string;
2165
- } | undefined;
2166
- } | {
2167
- readonly data?: ({
2168
- readonly attributes: {
2169
- readonly [x: string]: string | number | boolean | null;
2170
- };
2171
- readonly total_discount: number;
2172
- readonly discounts: readonly {
2173
- readonly title: string;
2174
- readonly amount: number;
2175
- }[];
2176
- readonly requires_shipping: boolean;
2177
- readonly token: string;
2178
- readonly note: string | null;
2179
- readonly discount_codes: readonly {
2180
- readonly code: string;
2181
- readonly applicable: boolean;
2182
- }[];
2183
- readonly original_total_price: number;
2184
- readonly total_price: number;
2185
- readonly total_weight: number;
2186
- readonly item_count: number;
2187
- readonly items: readonly ({
2188
- readonly title: string;
2189
- readonly key: string;
2190
- readonly url: string;
2191
- readonly image: string | null;
2192
- readonly quantity_rule?: {
2193
- readonly min: number;
2194
- readonly max: number | null;
2195
- readonly increment: number;
2196
- } | undefined;
2197
- readonly price: number;
2198
- readonly id: string | number;
2199
- readonly selling_plan_allocation: {
2200
- readonly price: number;
2201
- readonly price_adjustments: readonly {
2202
- readonly position: number;
2203
- readonly price: number;
2204
- }[];
2205
- readonly selling_plan: {
2206
- readonly description: string | null;
2207
- readonly name: string;
2208
- readonly id: string | number;
2209
- readonly options: readonly {
2210
- readonly value: string;
2211
- readonly name: string;
2212
- readonly position: number;
2213
- }[];
2214
- readonly recurring_deliveries: boolean;
2215
- readonly fixed_selling_plan: boolean;
2216
- readonly price_adjustments: readonly {
2217
- readonly value: string | number;
2218
- readonly value_type: "fixed_amount" | "percentage" | "price";
2219
- readonly position: number;
2220
- readonly order_count: number | null;
2221
- }[];
2222
- };
2223
- readonly compare_at_price: number;
2224
- readonly per_delivery_price: number;
2225
- } | null;
2226
- readonly unit_price_measurement?: {
2227
- readonly measured_type: "volume" | "weight" | "dimension";
2228
- readonly quantity_unit: string;
2229
- readonly quantity_value: number;
2230
- readonly reference_unit: string;
2231
- readonly reference_value: number;
2232
- } | undefined;
2233
- readonly variant_options: readonly string[];
2234
- readonly properties: {
2235
- readonly [x: string]: string | number | boolean | null;
2236
- };
2237
- readonly quantity: number;
2238
- readonly variant_id: string | number;
2239
- readonly original_price: number;
2240
- readonly discounted_price: number;
2241
- readonly line_price: number;
2242
- readonly original_line_price: number;
2243
- readonly total_discount: number;
2244
- readonly discounts: readonly {
2245
- readonly title: string;
2246
- readonly amount: number;
2247
- }[];
2248
- readonly sku: string | null;
2249
- readonly grams: number;
2250
- readonly vendor: string;
2251
- readonly taxable: boolean;
2252
- readonly product_id: string | number;
2253
- readonly product_has_only_default_variant: boolean;
2254
- readonly gift_card: boolean;
2255
- readonly final_line_price: number;
2256
- readonly final_price: number;
2257
- readonly featured_image: {
2258
- readonly aspect_ratio: number | null;
2259
- readonly alt: string | null;
2260
- readonly height: number | null;
2261
- readonly url: string | null;
2262
- readonly width: number | null;
2263
- };
2264
- readonly handle: string;
2265
- readonly requires_shipping: boolean;
2266
- readonly product_type: string | null;
2267
- readonly product_title: string;
2268
- readonly product_description: string | null;
2269
- readonly variant_title: string | null;
2270
- readonly options_with_values: readonly {
2271
- readonly value: string;
2272
- readonly name: string;
2273
- }[];
2274
- readonly line_level_discount_allocations: readonly {
2275
- readonly discount_application: {
2276
- readonly title: string;
2277
- readonly description: string | null;
2278
- readonly value: number;
2279
- readonly target_selection: "all" | "entitled" | "explicit";
2280
- readonly target_type: "line_item" | "shipping_line";
2281
- readonly total_allocated_amount: number;
2282
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
2283
- readonly value_type: "fixed_amount" | "percentage";
2284
- };
2285
- readonly amount: number;
2286
- }[];
2287
- readonly line_level_total_discount: number;
2288
- readonly has_components: boolean;
2289
- readonly unit_price?: number | undefined;
2290
- } & {
2291
- readonly properties_array: readonly {
2292
- readonly key: string;
2293
- readonly value: string | number | boolean | null;
2294
- }[];
2295
- readonly private_properties: {
2296
- readonly [x: string]: string | number | boolean | null;
2297
- };
2298
- readonly private_properties_array: readonly {
2299
- readonly key: string;
2300
- readonly value: string | number | boolean | null;
2301
- }[];
2302
- readonly public_properties: {
2303
- readonly [x: string]: string | number | boolean | null;
2304
- };
2305
- readonly public_properties_array: readonly {
2306
- readonly key: string;
2307
- readonly value: string | number | boolean | null;
2308
- }[];
2309
- })[];
2310
- readonly currency: string;
2311
- readonly items_subtotal_price: number;
2312
- readonly cart_level_discount_applications: readonly {
2313
- readonly title: string;
2314
- readonly description: string | null;
2315
- readonly value: number;
2316
- readonly target_selection: "all" | "entitled" | "explicit";
2317
- readonly target_type: "line_item" | "shipping_line";
2318
- readonly total_allocated_amount: number;
2319
- readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
2320
- readonly value_type: "fixed_amount" | "percentage";
2321
- }[];
2322
- } & {
2323
- readonly attributes_array: readonly {
2324
- readonly key: string;
2325
- readonly value: string | number | boolean | null;
2326
- }[];
2327
- readonly private_attributes: {
2328
- readonly [x: string]: string | number | boolean | null;
2329
- };
2330
- readonly private_attributes_array: readonly {
2331
- readonly key: string;
2332
- readonly value: string | number | boolean | null;
2333
- }[];
2334
- readonly public_attributes: {
2335
- readonly [x: string]: string | number | boolean | null;
2336
- };
2337
- readonly public_attributes_array: readonly {
2338
- readonly key: string;
2339
- readonly value: string | number | boolean | null;
2340
- }[];
2341
- }) | undefined;
2342
- readonly error?: {
2343
- status: number;
2344
- message: string;
2345
- description?: string;
2346
- } | undefined;
2347
1125
  }>;
2348
1126
  };
2349
1127