commerce-kit 0.0.41 → 0.2.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.
package/dist/index.d.ts CHANGED
@@ -1,772 +1,6 @@
1
- import Stripe from 'stripe';
2
- import { z, TypeOf } from 'zod';
3
- import { CartMetadata, MappedCart } from './internal.js';
4
- export { MappedProduct, MappedShippingRate } from './internal.js';
5
-
6
- type Cart = NonNullable<Awaited<ReturnType<typeof cartGet>>>;
7
- type Order = NonNullable<Awaited<ReturnType<typeof orderGet>>>;
8
- declare function cartAdd({ productId, cartId }: {
9
- productId: string;
10
- cartId?: string;
11
- }): Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
12
- declare function cartUpdateQuantity({ productId, cartId, operation, clearTaxCalculation, }: {
13
- productId: string;
14
- cartId: string;
15
- operation: "INCREASE" | "DECREASE";
16
- clearTaxCalculation?: boolean;
17
- }): Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
18
- declare function cartGet(cartId: string): Promise<{
19
- cart: {
20
- metadata: {
21
- shippingRateId?: string | undefined;
22
- taxCalculationId?: string | undefined;
23
- taxCalculationExp?: string | undefined;
24
- taxId?: string | undefined;
25
- couponCode?: string | undefined;
26
- taxedAmount?: string | undefined;
27
- "billingAddress.city"?: string | undefined;
28
- "billingAddress.country"?: string | undefined;
29
- "billingAddress.line1"?: string | undefined;
30
- "billingAddress.line2"?: string | undefined;
31
- "billingAddress.name"?: string | undefined;
32
- "billingAddress.postalCode"?: string | undefined;
33
- "billingAddress.state"?: string | undefined;
34
- netAmount?: string | undefined;
35
- taxBreakdown0?: string | undefined;
36
- taxBreakdown1?: string | undefined;
37
- taxBreakdown2?: string | undefined;
38
- taxBreakdown3?: string | undefined;
39
- taxBreakdown4?: string | undefined;
40
- taxBreakdown5?: string | undefined;
41
- } & Record<string, string>;
42
- customer: Stripe.Customer | null;
43
- payment_method: Stripe.PaymentMethod | null;
44
- taxBreakdown: {
45
- taxType: Stripe.Tax.Calculation.TaxBreakdown.TaxRateDetails.TaxType | (string & {});
46
- taxPercentage: string;
47
- taxAmount: number;
48
- }[];
49
- id: string;
50
- object: "payment_intent";
51
- amount: number;
52
- amount_capturable: number;
53
- amount_details?: Stripe.PaymentIntent.AmountDetails;
54
- amount_received: number;
55
- application: string | Stripe.Application | null;
56
- application_fee_amount: number | null;
57
- automatic_payment_methods: Stripe.PaymentIntent.AutomaticPaymentMethods | null;
58
- canceled_at: number | null;
59
- cancellation_reason: Stripe.PaymentIntent.CancellationReason | null;
60
- capture_method: Stripe.PaymentIntent.CaptureMethod;
61
- client_secret: string | null;
62
- confirmation_method: Stripe.PaymentIntent.ConfirmationMethod;
63
- created: number;
64
- currency: string;
65
- description: string | null;
66
- excluded_payment_method_types: Array<Stripe.PaymentIntent.ExcludedPaymentMethodType> | null;
67
- last_payment_error: Stripe.PaymentIntent.LastPaymentError | null;
68
- latest_charge: string | Stripe.Charge | null;
69
- livemode: boolean;
70
- next_action: Stripe.PaymentIntent.NextAction | null;
71
- on_behalf_of: string | Stripe.Account | null;
72
- payment_method_configuration_details: Stripe.PaymentIntent.PaymentMethodConfigurationDetails | null;
73
- payment_method_options: Stripe.PaymentIntent.PaymentMethodOptions | null;
74
- payment_method_types: Array<string>;
75
- presentment_details?: Stripe.PaymentIntent.PresentmentDetails;
76
- processing: Stripe.PaymentIntent.Processing | null;
77
- receipt_email: string | null;
78
- review: string | Stripe.Review | null;
79
- setup_future_usage: Stripe.PaymentIntent.SetupFutureUsage | null;
80
- shipping: Stripe.PaymentIntent.Shipping | null;
81
- source: string | Stripe.CustomerSource | Stripe.DeletedCustomerSource | null;
82
- statement_descriptor: string | null;
83
- statement_descriptor_suffix: string | null;
84
- status: Stripe.PaymentIntent.Status;
85
- transfer_data: Stripe.PaymentIntent.TransferData | null;
86
- transfer_group: string | null;
87
- };
88
- lines: {
89
- product: {
90
- default_price: Stripe.Price;
91
- marketing_features: string[];
92
- metadata: {
93
- slug: string;
94
- stock: number;
95
- category?: string | undefined;
96
- order?: number | undefined;
97
- variant?: string | undefined;
98
- digitalAsset?: string | undefined;
99
- preview?: string | undefined;
100
- };
101
- id: string;
102
- object: "product";
103
- active: boolean;
104
- created: number;
105
- deleted?: void | undefined;
106
- description: string | null;
107
- images: Array<string>;
108
- livemode: boolean;
109
- name: string;
110
- package_dimensions: Stripe.Product.PackageDimensions | null;
111
- shippable: boolean | null;
112
- statement_descriptor?: string | null;
113
- tax_code: string | Stripe.TaxCode | null;
114
- type: Stripe.Product.Type;
115
- unit_label?: string | null;
116
- updated: number;
117
- url: string | null;
118
- };
119
- quantity: number;
120
- }[];
121
- shippingRate: Stripe.ShippingRate | null;
122
- } | null | undefined>;
123
- declare function cartCreate({ productId }?: {
124
- productId?: string;
125
- cartId?: string;
126
- }): Promise<Stripe.Response<Stripe.PaymentIntent>>;
127
- declare function cartAddOptimistic({ cart, add }: {
128
- cart?: Cart | null;
129
- add: string | undefined;
130
- }): Promise<{
131
- cart: {
132
- amount: number;
133
- metadata?: ({
134
- shippingRateId?: string | undefined;
135
- taxCalculationId?: string | undefined;
136
- taxCalculationExp?: string | undefined;
137
- taxId?: string | undefined;
138
- couponCode?: string | undefined;
139
- taxedAmount?: string | undefined;
140
- "billingAddress.city"?: string | undefined;
141
- "billingAddress.country"?: string | undefined;
142
- "billingAddress.line1"?: string | undefined;
143
- "billingAddress.line2"?: string | undefined;
144
- "billingAddress.name"?: string | undefined;
145
- "billingAddress.postalCode"?: string | undefined;
146
- "billingAddress.state"?: string | undefined;
147
- netAmount?: string | undefined;
148
- taxBreakdown0?: string | undefined;
149
- taxBreakdown1?: string | undefined;
150
- taxBreakdown2?: string | undefined;
151
- taxBreakdown3?: string | undefined;
152
- taxBreakdown4?: string | undefined;
153
- taxBreakdown5?: string | undefined;
154
- } & Record<string, string>) | undefined;
155
- customer?: Stripe.Customer | null | undefined;
156
- payment_method?: Stripe.PaymentMethod | null | undefined;
157
- taxBreakdown?: {
158
- taxType: Stripe.Tax.Calculation.TaxBreakdown.TaxRateDetails.TaxType | (string & {});
159
- taxPercentage: string;
160
- taxAmount: number;
161
- }[] | undefined;
162
- id?: string | undefined;
163
- object?: "payment_intent" | undefined;
164
- amount_capturable?: number | undefined;
165
- amount_details?: Stripe.PaymentIntent.AmountDetails;
166
- amount_received?: number | undefined;
167
- application?: string | Stripe.Application | null | undefined;
168
- application_fee_amount?: number | null | undefined;
169
- automatic_payment_methods?: Stripe.PaymentIntent.AutomaticPaymentMethods | null | undefined;
170
- canceled_at?: number | null | undefined;
171
- cancellation_reason?: Stripe.PaymentIntent.CancellationReason | null | undefined;
172
- capture_method?: Stripe.PaymentIntent.CaptureMethod | undefined;
173
- client_secret?: string | null | undefined;
174
- confirmation_method?: Stripe.PaymentIntent.ConfirmationMethod | undefined;
175
- created?: number | undefined;
176
- currency?: string | undefined;
177
- description?: string | null | undefined;
178
- excluded_payment_method_types?: Stripe.PaymentIntent.ExcludedPaymentMethodType[] | null | undefined;
179
- last_payment_error?: Stripe.PaymentIntent.LastPaymentError | null | undefined;
180
- latest_charge?: string | Stripe.Charge | null | undefined;
181
- livemode?: boolean | undefined;
182
- next_action?: Stripe.PaymentIntent.NextAction | null | undefined;
183
- on_behalf_of?: string | Stripe.Account | null | undefined;
184
- payment_method_configuration_details?: Stripe.PaymentIntent.PaymentMethodConfigurationDetails | null | undefined;
185
- payment_method_options?: Stripe.PaymentIntent.PaymentMethodOptions | null | undefined;
186
- payment_method_types?: string[] | undefined;
187
- presentment_details?: Stripe.PaymentIntent.PresentmentDetails;
188
- processing?: Stripe.PaymentIntent.Processing | null | undefined;
189
- receipt_email?: string | null | undefined;
190
- review?: string | Stripe.Review | null | undefined;
191
- setup_future_usage?: Stripe.PaymentIntent.SetupFutureUsage | null | undefined;
192
- shipping?: Stripe.PaymentIntent.Shipping | null | undefined;
193
- source?: string | Stripe.CustomerSource | Stripe.DeletedCustomerSource | null | undefined;
194
- statement_descriptor?: string | null | undefined;
195
- statement_descriptor_suffix?: string | null | undefined;
196
- status?: Stripe.PaymentIntent.Status | undefined;
197
- transfer_data?: Stripe.PaymentIntent.TransferData | null | undefined;
198
- transfer_group?: string | null | undefined;
199
- };
200
- lines: {
201
- product: {
202
- default_price: Stripe.Price;
203
- marketing_features: string[];
204
- metadata: {
205
- slug: string;
206
- stock: number;
207
- category?: string | undefined;
208
- order?: number | undefined;
209
- variant?: string | undefined;
210
- digitalAsset?: string | undefined;
211
- preview?: string | undefined;
212
- };
213
- id: string;
214
- object: "product";
215
- active: boolean;
216
- created: number;
217
- deleted?: void | undefined;
218
- description: string | null;
219
- images: Array<string>;
220
- livemode: boolean;
221
- name: string;
222
- package_dimensions: Stripe.Product.PackageDimensions | null;
223
- shippable: boolean | null;
224
- statement_descriptor?: string | null;
225
- tax_code: string | Stripe.TaxCode | null;
226
- type: Stripe.Product.Type;
227
- unit_label?: string | null;
228
- updated: number;
229
- url: string | null;
230
- };
231
- quantity: number;
232
- }[];
233
- shippingRate?: Stripe.ShippingRate | null | undefined;
234
- } | null | undefined>;
235
- declare function cartSetQuantity({ cartId, productId, quantity, }: {
236
- cartId: string;
237
- productId: string;
238
- quantity: number;
239
- }): Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
240
- declare function productGetById(id: string): Promise<{
241
- default_price: Stripe.Price;
242
- marketing_features: string[];
243
- metadata: {
244
- slug: string;
245
- stock: number;
246
- category?: string | undefined;
247
- order?: number | undefined;
248
- variant?: string | undefined;
249
- digitalAsset?: string | undefined;
250
- preview?: string | undefined;
251
- };
252
- id: string;
253
- object: "product";
254
- active: boolean;
255
- created: number;
256
- deleted?: void | undefined;
257
- description: string | null;
258
- images: Array<string>;
259
- livemode: boolean;
260
- name: string;
261
- package_dimensions: Stripe.Product.PackageDimensions | null;
262
- shippable: boolean | null;
263
- statement_descriptor?: string | null;
264
- tax_code: string | Stripe.TaxCode | null;
265
- type: Stripe.Product.Type;
266
- unit_label?: string | null;
267
- updated: number;
268
- url: string | null;
269
- } | null>;
270
- declare function productGet({ slug }: {
271
- slug: string;
272
- }): Promise<{
273
- default_price: Stripe.Price;
274
- marketing_features: string[];
275
- metadata: {
276
- slug: string;
277
- stock: number;
278
- category?: string | undefined;
279
- order?: number | undefined;
280
- variant?: string | undefined;
281
- digitalAsset?: string | undefined;
282
- preview?: string | undefined;
283
- };
284
- id: string;
285
- object: "product";
286
- active: boolean;
287
- created: number;
288
- deleted?: void | undefined;
289
- description: string | null;
290
- images: Array<string>;
291
- livemode: boolean;
292
- name: string;
293
- package_dimensions: Stripe.Product.PackageDimensions | null;
294
- shippable: boolean | null;
295
- statement_descriptor?: string | null;
296
- tax_code: string | Stripe.TaxCode | null;
297
- type: Stripe.Product.Type;
298
- unit_label?: string | null;
299
- updated: number;
300
- url: string | null;
301
- }[]>;
302
- declare function productBrowse(params: {
303
- first?: number;
304
- last?: number;
305
- offset?: number;
306
- filter?: {
307
- category?: string;
308
- };
309
- }): Promise<{
310
- default_price: Stripe.Price;
311
- marketing_features: string[];
312
- metadata: {
313
- slug: string;
314
- stock: number;
315
- category?: string | undefined;
316
- order?: number | undefined;
317
- variant?: string | undefined;
318
- digitalAsset?: string | undefined;
319
- preview?: string | undefined;
320
- };
321
- id: string;
322
- object: "product";
323
- active: boolean;
324
- created: number;
325
- deleted?: void | undefined;
326
- description: string | null;
327
- images: Array<string>;
328
- livemode: boolean;
329
- name: string;
330
- package_dimensions: Stripe.Product.PackageDimensions | null;
331
- shippable: boolean | null;
332
- statement_descriptor?: string | null;
333
- tax_code: string | Stripe.TaxCode | null;
334
- type: Stripe.Product.Type;
335
- unit_label?: string | null;
336
- updated: number;
337
- url: string | null;
338
- }[]>;
339
- declare function shippingBrowse(): Promise<Stripe.ShippingRate[]>;
340
- declare function shippingGet(id: string): Promise<Stripe.ShippingRate | null>;
341
- declare function categoryBrowse(): Promise<string[]>;
342
- declare function fileGet(id: string): Promise<Stripe.Response<Stripe.FileLink> | null>;
343
- declare function accountGet(): Promise<{
344
- account: (Stripe.Account & {
345
- lastResponse: {
346
- headers: {
347
- [key: string]: string;
348
- };
349
- requestId: string;
350
- statusCode: number;
351
- apiVersion?: string;
352
- idempotencyKey?: string;
353
- stripeAccount?: string;
354
- };
355
- }) | null;
356
- logo: null;
357
- } | {
358
- account: (Stripe.Account & {
359
- lastResponse: {
360
- headers: {
361
- [key: string]: string;
362
- };
363
- requestId: string;
364
- statusCode: number;
365
- apiVersion?: string;
366
- idempotencyKey?: string;
367
- stripeAccount?: string;
368
- };
369
- }) | null;
370
- logo: Stripe.File;
371
- } | null>;
372
- declare function orderGet(orderId: string): Promise<{
373
- order: {
374
- payment_method: Stripe.PaymentMethod | null;
375
- latest_charge: Stripe.Charge | null;
376
- taxBreakdown: {
377
- taxType: Stripe.Tax.Calculation.TaxBreakdown.TaxRateDetails.TaxType | (string & {});
378
- taxPercentage: string;
379
- taxAmount: number;
380
- }[];
381
- metadata: {
382
- shippingRateId?: string | undefined;
383
- taxCalculationId?: string | undefined;
384
- taxCalculationExp?: string | undefined;
385
- taxId?: string | undefined;
386
- couponCode?: string | undefined;
387
- taxedAmount?: string | undefined;
388
- "billingAddress.city"?: string | undefined;
389
- "billingAddress.country"?: string | undefined;
390
- "billingAddress.line1"?: string | undefined;
391
- "billingAddress.line2"?: string | undefined;
392
- "billingAddress.name"?: string | undefined;
393
- "billingAddress.postalCode"?: string | undefined;
394
- "billingAddress.state"?: string | undefined;
395
- netAmount?: string | undefined;
396
- taxBreakdown0?: string | undefined;
397
- taxBreakdown1?: string | undefined;
398
- taxBreakdown2?: string | undefined;
399
- taxBreakdown3?: string | undefined;
400
- taxBreakdown4?: string | undefined;
401
- taxBreakdown5?: string | undefined;
402
- } & Record<string, string>;
403
- id: string;
404
- object: "payment_intent";
405
- amount: number;
406
- amount_capturable: number;
407
- amount_details?: Stripe.PaymentIntent.AmountDetails;
408
- amount_received: number;
409
- application: string | Stripe.Application | null;
410
- application_fee_amount: number | null;
411
- automatic_payment_methods: Stripe.PaymentIntent.AutomaticPaymentMethods | null;
412
- canceled_at: number | null;
413
- cancellation_reason: Stripe.PaymentIntent.CancellationReason | null;
414
- capture_method: Stripe.PaymentIntent.CaptureMethod;
415
- client_secret: string | null;
416
- confirmation_method: Stripe.PaymentIntent.ConfirmationMethod;
417
- created: number;
418
- currency: string;
419
- customer: string | Stripe.Customer | Stripe.DeletedCustomer | null;
420
- description: string | null;
421
- excluded_payment_method_types: Array<Stripe.PaymentIntent.ExcludedPaymentMethodType> | null;
422
- last_payment_error: Stripe.PaymentIntent.LastPaymentError | null;
423
- livemode: boolean;
424
- next_action: Stripe.PaymentIntent.NextAction | null;
425
- on_behalf_of: string | Stripe.Account | null;
426
- payment_method_configuration_details: Stripe.PaymentIntent.PaymentMethodConfigurationDetails | null;
427
- payment_method_options: Stripe.PaymentIntent.PaymentMethodOptions | null;
428
- payment_method_types: Array<string>;
429
- presentment_details?: Stripe.PaymentIntent.PresentmentDetails;
430
- processing: Stripe.PaymentIntent.Processing | null;
431
- receipt_email: string | null;
432
- review: string | Stripe.Review | null;
433
- setup_future_usage: Stripe.PaymentIntent.SetupFutureUsage | null;
434
- shipping: Stripe.PaymentIntent.Shipping | null;
435
- source: string | Stripe.CustomerSource | Stripe.DeletedCustomerSource | null;
436
- statement_descriptor: string | null;
437
- statement_descriptor_suffix: string | null;
438
- status: Stripe.PaymentIntent.Status;
439
- transfer_data: Stripe.PaymentIntent.TransferData | null;
440
- transfer_group: string | null;
441
- };
442
- lines: {
443
- product: {
444
- default_price: Stripe.Price;
445
- marketing_features: string[];
446
- metadata: {
447
- slug: string;
448
- stock: number;
449
- category?: string | undefined;
450
- order?: number | undefined;
451
- variant?: string | undefined;
452
- digitalAsset?: string | undefined;
453
- preview?: string | undefined;
454
- };
455
- id: string;
456
- object: "product";
457
- active: boolean;
458
- created: number;
459
- deleted?: void | undefined;
460
- description: string | null;
461
- images: Array<string>;
462
- livemode: boolean;
463
- name: string;
464
- package_dimensions: Stripe.Product.PackageDimensions | null;
465
- shippable: boolean | null;
466
- statement_descriptor?: string | null;
467
- tax_code: string | Stripe.TaxCode | null;
468
- type: Stripe.Product.Type;
469
- unit_label?: string | null;
470
- updated: number;
471
- url: string | null;
472
- };
473
- quantity: number;
474
- }[];
475
- shippingRate: Stripe.ShippingRate | null;
476
- } | null>;
477
- declare const getProductsFromCart: (metadata: CartMetadata) => (readonly [productId: string, quantity: number])[];
478
- declare function getProductsFromMetadata(metadata: MappedCart["metadata"]): Promise<{
479
- product: {
480
- default_price: Stripe.Price;
481
- marketing_features: string[];
482
- metadata: {
483
- slug: string;
484
- stock: number;
485
- category?: string | undefined;
486
- order?: number | undefined;
487
- variant?: string | undefined;
488
- digitalAsset?: string | undefined;
489
- preview?: string | undefined;
490
- };
491
- id: string;
492
- object: "product";
493
- active: boolean;
494
- created: number;
495
- deleted?: void | undefined;
496
- description: string | null;
497
- images: Array<string>;
498
- livemode: boolean;
499
- name: string;
500
- package_dimensions: Stripe.Product.PackageDimensions | null;
501
- shippable: boolean | null;
502
- statement_descriptor?: string | null;
503
- tax_code: string | Stripe.TaxCode | null;
504
- type: Stripe.Product.Type;
505
- unit_label?: string | null;
506
- updated: number;
507
- url: string | null;
508
- } | null;
509
- quantity: number;
510
- }[]>;
511
- type ProductsFromMetadata = Awaited<ReturnType<typeof getProductsFromMetadata>>;
512
- declare const getCartWithProductsById: (cartId: string) => Promise<{
513
- cart: {
514
- metadata: {
515
- shippingRateId?: string | undefined;
516
- taxCalculationId?: string | undefined;
517
- taxCalculationExp?: string | undefined;
518
- taxId?: string | undefined;
519
- couponCode?: string | undefined;
520
- taxedAmount?: string | undefined;
521
- "billingAddress.city"?: string | undefined;
522
- "billingAddress.country"?: string | undefined;
523
- "billingAddress.line1"?: string | undefined;
524
- "billingAddress.line2"?: string | undefined;
525
- "billingAddress.name"?: string | undefined;
526
- "billingAddress.postalCode"?: string | undefined;
527
- "billingAddress.state"?: string | undefined;
528
- netAmount?: string | undefined;
529
- taxBreakdown0?: string | undefined;
530
- taxBreakdown1?: string | undefined;
531
- taxBreakdown2?: string | undefined;
532
- taxBreakdown3?: string | undefined;
533
- taxBreakdown4?: string | undefined;
534
- taxBreakdown5?: string | undefined;
535
- } & Record<string, string>;
536
- customer: Stripe.Customer | null;
537
- payment_method: Stripe.PaymentMethod | null;
538
- taxBreakdown: {
539
- taxType: Stripe.Tax.Calculation.TaxBreakdown.TaxRateDetails.TaxType | (string & {});
540
- taxPercentage: string;
541
- taxAmount: number;
542
- }[];
543
- id: string;
544
- object: "payment_intent";
545
- amount: number;
546
- amount_capturable: number;
547
- amount_details?: Stripe.PaymentIntent.AmountDetails;
548
- amount_received: number;
549
- application: string | Stripe.Application | null;
550
- application_fee_amount: number | null;
551
- automatic_payment_methods: Stripe.PaymentIntent.AutomaticPaymentMethods | null;
552
- canceled_at: number | null;
553
- cancellation_reason: Stripe.PaymentIntent.CancellationReason | null;
554
- capture_method: Stripe.PaymentIntent.CaptureMethod;
555
- client_secret: string | null;
556
- confirmation_method: Stripe.PaymentIntent.ConfirmationMethod;
557
- created: number;
558
- currency: string;
559
- description: string | null;
560
- excluded_payment_method_types: Array<Stripe.PaymentIntent.ExcludedPaymentMethodType> | null;
561
- last_payment_error: Stripe.PaymentIntent.LastPaymentError | null;
562
- latest_charge: string | Stripe.Charge | null;
563
- livemode: boolean;
564
- next_action: Stripe.PaymentIntent.NextAction | null;
565
- on_behalf_of: string | Stripe.Account | null;
566
- payment_method_configuration_details: Stripe.PaymentIntent.PaymentMethodConfigurationDetails | null;
567
- payment_method_options: Stripe.PaymentIntent.PaymentMethodOptions | null;
568
- payment_method_types: Array<string>;
569
- presentment_details?: Stripe.PaymentIntent.PresentmentDetails;
570
- processing: Stripe.PaymentIntent.Processing | null;
571
- receipt_email: string | null;
572
- review: string | Stripe.Review | null;
573
- setup_future_usage: Stripe.PaymentIntent.SetupFutureUsage | null;
574
- shipping: Stripe.PaymentIntent.Shipping | null;
575
- source: string | Stripe.CustomerSource | Stripe.DeletedCustomerSource | null;
576
- statement_descriptor: string | null;
577
- statement_descriptor_suffix: string | null;
578
- status: Stripe.PaymentIntent.Status;
579
- transfer_data: Stripe.PaymentIntent.TransferData | null;
580
- transfer_group: string | null;
581
- };
582
- lines: {
583
- product: {
584
- default_price: Stripe.Price;
585
- marketing_features: string[];
586
- metadata: {
587
- slug: string;
588
- stock: number;
589
- category?: string | undefined;
590
- order?: number | undefined;
591
- variant?: string | undefined;
592
- digitalAsset?: string | undefined;
593
- preview?: string | undefined;
594
- };
595
- id: string;
596
- object: "product";
597
- active: boolean;
598
- created: number;
599
- deleted?: void | undefined;
600
- description: string | null;
601
- images: Array<string>;
602
- livemode: boolean;
603
- name: string;
604
- package_dimensions: Stripe.Product.PackageDimensions | null;
605
- shippable: boolean | null;
606
- statement_descriptor?: string | null;
607
- tax_code: string | Stripe.TaxCode | null;
608
- type: Stripe.Product.Type;
609
- unit_label?: string | null;
610
- updated: number;
611
- url: string | null;
612
- };
613
- quantity: number;
614
- }[];
615
- shippingRate: Stripe.ShippingRate | null;
616
- } | null>;
617
- declare const calculateCartTotalNet: (cart: {
618
- cart: {
619
- amount: number;
620
- metadata?: {
621
- taxCalculationId?: string;
622
- };
623
- };
624
- lines: Array<{
625
- product: {
626
- default_price?: {
627
- unit_amount?: number | null;
628
- };
629
- };
630
- quantity: number;
631
- }>;
632
- shippingRate?: {
633
- fixed_amount?: {
634
- amount?: number;
635
- };
636
- } | null;
637
- }) => number;
638
- declare const getAddressSchema: (tr: {
639
- nameRequired: string;
640
- cityRequired: string;
641
- countryRequired: string;
642
- line1Required: string;
643
- postalCodeRequired: string;
644
- }) => z.ZodObject<{
645
- name: z.ZodString;
646
- city: z.ZodString;
647
- country: z.ZodString;
648
- line1: z.ZodString;
649
- line2: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
650
- postalCode: z.ZodString;
651
- state: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
652
- phone: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
653
- taxId: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
654
- email: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
655
- }, z.core.$strip>;
656
- type AddressSchema = TypeOf<ReturnType<typeof getAddressSchema>>;
657
- /**
658
- * @internal
659
- */
660
- declare const updatePaymentIntent: ({ paymentIntentId, data, customerOverride, clearTaxCalculation, }: {
661
- paymentIntentId: string;
662
- data: Stripe.PaymentIntentUpdateParams;
663
- customerOverride?: Stripe.Customer;
664
- clearTaxCalculation?: boolean;
665
- }) => Promise<Stripe.Response<Stripe.PaymentIntent>>;
666
- declare const calculateCartTotalPossiblyWithTax: (cart: {
667
- cart: {
668
- amount: number;
669
- metadata?: {
670
- taxCalculationId?: string;
671
- };
672
- };
673
- lines: Array<{
674
- product: {
675
- default_price?: {
676
- unit_amount?: number | null;
677
- };
678
- };
679
- quantity: number;
680
- }>;
681
- shippingRate?: {
682
- fixed_amount?: {
683
- amount?: number;
684
- };
685
- } | null;
686
- }) => number;
687
- declare const calculateCartTotalNetWithoutShipping: (cart: {
688
- cart: {
689
- amount: number;
690
- metadata?: {
691
- taxCalculationId?: string;
692
- };
693
- };
694
- lines: Array<{
695
- product: {
696
- default_price?: {
697
- unit_amount?: number | null;
698
- };
699
- };
700
- quantity: number;
701
- }>;
702
- shippingRate?: {
703
- fixed_amount?: {
704
- amount?: number;
705
- };
706
- } | null;
707
- }) => number;
708
- declare function cartChangeQuantity({ productId, cartId, operation, clearTaxCalculation, }: {
709
- productId: string;
710
- cartId: string;
711
- operation: "INCREASE" | "DECREASE";
712
- clearTaxCalculation?: boolean;
713
- }): Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
714
- declare const cartSaveEmail: ({ cartId, email }: {
715
- cartId: string;
716
- email: string;
717
- }) => Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
718
- declare const cartSaveTax: ({ cartId, taxId }: {
719
- cartId: string;
720
- taxId: string;
721
- }) => Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
722
- declare function cartSaveShipping({ cartId, shippingRateId, }: {
723
- cartId: string;
724
- shippingRateId: string;
725
- }): Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
726
- declare function cartSaveBillingAddress({ cartId, billingAddress, }: {
727
- cartId: string;
728
- billingAddress: AddressSchema;
729
- }): Promise<Stripe.Response<Stripe.PaymentIntent> | undefined>;
730
- declare function taxDefaultGet(): Promise<Stripe.Response<Stripe.Tax.Settings>>;
731
- declare function cartCount(metadata: CartMetadata): number;
732
- type Review = {
733
- id: string;
734
- store_id: string;
735
- product_id: string;
736
- created_at: string;
737
- updated_at: string;
738
- author: string;
739
- email: string;
740
- content: string;
741
- rating: number;
742
- };
743
- declare function productReviewBrowse(params: {
744
- productId: string;
745
- first?: number;
746
- last?: number;
747
- offset?: number;
748
- filter?: Record<string, never>;
749
- }): Promise<Review[] | null>;
750
- declare function productReviewAdd(params: {
751
- productId: string;
752
- author: string;
753
- email: string;
754
- content: string;
755
- rating: number;
756
- }): Promise<Record<string, any>[] | null>;
757
- declare const contextGet: () => Promise<{
758
- stripeAccount: string | undefined;
759
- storeId: string | undefined;
760
- secretKey: string | undefined;
761
- publishableKey: string | undefined;
762
- }>;
763
-
764
- declare const provider: ({ tags, revalidate, cache, tagPrefix, secretKey, }: {
765
- tags?: NextFetchRequestConfig["tags"];
766
- revalidate?: NextFetchRequestConfig["revalidate"];
767
- cache?: RequestInit["cache"];
768
- tagPrefix: string | undefined;
769
- secretKey: string | undefined;
770
- }) => Stripe;
771
-
772
- export { type AddressSchema, type Cart, MappedCart, type Order, type ProductsFromMetadata, accountGet, calculateCartTotalNet, calculateCartTotalNetWithoutShipping, calculateCartTotalPossiblyWithTax, cartAdd, cartAddOptimistic, cartChangeQuantity, cartCount, cartCreate, cartGet, cartSaveBillingAddress, cartSaveEmail, cartSaveShipping, cartSaveTax, cartSetQuantity, cartUpdateQuantity, categoryBrowse, contextGet, fileGet, getAddressSchema, getCartWithProductsById, getProductsFromCart, getProductsFromMetadata, orderGet, productBrowse, productGet, productGetById, productReviewAdd, productReviewBrowse, provider, shippingBrowse, shippingGet, taxDefaultGet, updatePaymentIntent };
1
+ export { formatMoney } from './currencies.js';
2
+ export { MappedCart, MappedProduct, MappedShippingRate } from './internal.js';
3
+ export { B as BaseProvider, C as Cart, a as CartAddParams, b as CartClearParams, c as CartGetParams, d as CartItem, e as CartUpdateParams, O as Order, f as OrderGetParams, g as OrderListParams, h as OrderListResult, P as Product, i as ProductBrowseParams, j as ProductBrowseResult, k as ProductGetParams, l as ProductSearchParams, m as ProductSearchResult, S as StripeProviderConfig, Y as YnsProviderConfig } from './provider-CvZe8Dqo.js';
4
+ export { Commerce } from './yns.js';
5
+ import 'stripe';
6
+ import 'zod';