@payment-kit-js/vanilla 0.1.2 → 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.
Files changed (32) hide show
  1. package/README.md +20 -706
  2. package/dist/{connect-card-EaOlRbPS.d.mts → connect-card-C582hcWw.d.mts} +1 -3
  3. package/dist/connect-card-C582hcWw.d.mts.map +1 -0
  4. package/dist/{connect-tunnel-x-Ce423Pa2.d.mts → connect-tunnel-x-rLA6I_EO.d.mts} +1 -54
  5. package/dist/connect-tunnel-x-rLA6I_EO.d.mts.map +1 -0
  6. package/dist/index.d.mts +3 -5
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +26 -3
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/payment-methods/card.d.mts +3 -5
  11. package/dist/payment-methods/card.d.mts.map +1 -1
  12. package/dist/payment-methods/google-pay.d.mts +4 -6
  13. package/dist/payment-methods/google-pay.d.mts.map +1 -1
  14. package/dist/payment-methods/next-action-handlers.d.mts +0 -2
  15. package/dist/payment-methods/next-action-handlers.d.mts.map +1 -1
  16. package/dist/payment-methods/paypal.d.mts +3 -5
  17. package/dist/payment-methods/paypal.d.mts.map +1 -1
  18. package/dist/payment-methods/stripe-google-pay-adapter.d.mts +1 -1
  19. package/dist/penpal/connect-card.d.mts +1 -3
  20. package/dist/penpal/connect-tunnel-x.d.mts +1 -2
  21. package/dist/{stripe-google-pay-adapter-CkV5HWI-.d.mts → stripe-google-pay-adapter-DUUB46SG.d.mts} +1 -1
  22. package/dist/{stripe-google-pay-adapter-CkV5HWI-.d.mts.map → stripe-google-pay-adapter-DUUB46SG.d.mts.map} +1 -1
  23. package/dist/{types-6mOKdjCh.d.mts → types-WgbMhIYb.d.mts} +5 -5
  24. package/dist/types-WgbMhIYb.d.mts.map +1 -0
  25. package/package.json +4 -4
  26. package/dist/cardsetupintent-D2gBMj3e.d.mts +0 -35
  27. package/dist/cardsetupintent-D2gBMj3e.d.mts.map +0 -1
  28. package/dist/connect-card-EaOlRbPS.d.mts.map +0 -1
  29. package/dist/connect-tunnel-x-Ce423Pa2.d.mts.map +0 -1
  30. package/dist/publiccardcheckoutresponse-wxFCeVdO.d.mts +0 -40
  31. package/dist/publiccardcheckoutresponse-wxFCeVdO.d.mts.map +0 -1
  32. package/dist/types-6mOKdjCh.d.mts.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # @payment-kit-js/vanilla
2
2
 
3
- Vanilla JavaScript SDK for PaymentKit - A type-safe, framework-agnostic payment processing SDK supporting card payments, PayPal, and Google Pay.
3
+ Vanilla JavaScript SDK for PaymentKit. A type-safe, framework-agnostic payment processing library supporting card payments, PayPal, and Google Pay.
4
+
5
+ ## Documentation
6
+
7
+ For complete documentation, guides, and examples, visit:
8
+
9
+ **[PaymentKit.js Documentation](https://docs.paymentkit.com/guides/integration/paymentkit-js)**
4
10
 
5
11
  ## Installation
6
12
 
@@ -14,11 +20,9 @@ npm install @payment-kit-js/vanilla
14
20
  import PaymentKit from '@payment-kit-js/vanilla';
15
21
  import CardPaymentMethod from '@payment-kit-js/vanilla/payment-methods/card';
16
22
 
17
- // Initialize PaymentKit
18
23
  const paymentKit = PaymentKit({
19
- baseUrl: 'https://your-domain.com', // For loading iframes
20
- apiBaseUrl: 'https://api.domain.com', // For API calls (optional, defaults to baseUrl)
21
- secureToken: 'checkout_session_token', // From your backend
24
+ environment: 'production', // 'sandbox' or 'production'
25
+ secureToken: 'checkout_session_token',
22
26
  paymentMethods: [CardPaymentMethod]
23
27
  });
24
28
 
@@ -46,709 +50,19 @@ paymentKit.cleanup();
46
50
 
47
51
  ## Payment Methods
48
52
 
49
- ### Card Payments
50
-
51
- Secure PCI-compliant card payments using isolated iframes.
52
-
53
- #### Import
54
-
55
- ```typescript
56
- import CardPaymentMethod from '@payment-kit-js/vanilla/payment-methods/card';
57
- import type { CardInputType } from '@payment-kit-js/vanilla/payment-methods/card';
58
- ```
59
-
60
- #### Initialize
61
-
62
- ```typescript
63
- const paymentKit = PaymentKit({
64
- baseUrl: 'https://your-domain.com',
65
- secureToken: 'checkout_token',
66
- paymentMethods: [CardPaymentMethod]
67
- });
68
- ```
69
-
70
- #### Create Card Elements
71
-
72
- ```typescript
73
- // Card input types: 'card_pan' | 'card_exp' | 'card_cvc'
74
- const cardNumber = paymentKit.card.createElement('card_pan', {
75
- style: {
76
- height: '40px',
77
- fontSize: '16px',
78
- fontFamily: 'Arial, sans-serif',
79
- color: '#32325d',
80
- padding: '10px'
81
- },
82
- onLoaded: () => console.log('Card input loaded'),
83
- onFocusChange: (isFocused) => console.log('Focus:', isFocused)
84
- });
85
-
86
- // Mount to DOM
87
- const { unmount } = cardNumber.mount('#card-number-container');
88
-
89
- // Unmount when needed
90
- unmount();
91
- ```
92
-
93
- #### Submit Card Payment
94
-
95
- ```typescript
96
- paymentKit.submit({
97
- fields: {
98
- customer_name: 'John Doe',
99
- customer_email: 'john@example.com',
100
- customer_country: 'US',
101
- customer_zip_code: '10001'
102
- },
103
- paymentMethod: 'card',
104
- onSuccess: (result) => {
105
- // result: { id, checkoutAttemptId, checkoutSessionId, paymentIntentId, state }
106
- console.log('Payment successful:', result);
107
- },
108
- onError: (errors) => {
109
- // errors.card_pan, errors.card_exp, errors.card_cvc
110
- // errors.customer_name, errors.customer_email, etc.
111
- console.error('Payment failed:', errors);
112
- }
113
- });
114
- ```
115
-
116
- #### 3D Secure (3DS) Support
117
-
118
- Card payments automatically handle 3D Secure authentication:
119
-
120
- 1. Submit payment
121
- 2. If 3DS required, user is redirected to bank authentication page
122
- 3. After authentication, payment completes automatically
123
- 4. Success/error callback is triggered
124
-
125
- No additional code needed - it's built-in!
126
-
127
- ### PayPal
128
-
129
- PayPal payments using popup-based authentication flow.
130
-
131
- #### Import
132
-
133
- ```typescript
134
- import PayPalPaymentMethod from '@payment-kit-js/vanilla/payment-methods/paypal';
135
- import type { PayPalSubmitOptions } from '@payment-kit-js/vanilla/payment-methods/paypal';
136
- ```
137
-
138
- #### Initialize
139
-
140
- ```typescript
141
- const paymentKit = PaymentKit({
142
- baseUrl: 'https://your-domain.com',
143
- apiBaseUrl: 'https://api.domain.com',
144
- secureToken: 'checkout_token',
145
- paymentMethods: [PayPalPaymentMethod]
146
- });
147
- ```
148
-
149
- #### Submit PayPal Payment
150
-
151
- ```typescript
152
- paymentKit.submit({
153
- fields: {
154
- customer_name: 'John Doe',
155
- customer_email: 'john@example.com',
156
- customer_country: 'US',
157
- customer_zip_code: '10001'
158
- },
159
- paymentMethod: 'paypal',
160
- options: {
161
- processorId: 'proc_xxx', // Your PayPal processor ID
162
- customerInfo: {
163
- first_name: 'John',
164
- last_name: 'Doe'
165
- }
166
- },
167
- onSuccess: (result) => {
168
- console.log('PayPal payment approved:', result);
169
- },
170
- onError: (errors) => {
171
- if (errors.paypal?.includes('popup')) {
172
- alert('Please allow popups for PayPal payments');
173
- }
174
- console.error('PayPal error:', errors);
175
- }
176
- });
177
- ```
178
-
179
- **Important**: PayPal requires browser popups to be enabled. The SDK automatically:
180
- - Opens PayPal authentication popup
181
- - Polls for payment completion every 2 seconds
182
- - Closes popup after completion
183
- - Handles user cancellation
184
-
185
- ### Google Pay
186
-
187
- Google Pay payments using Stripe Payment Request API.
188
-
189
- #### Import
190
-
191
- ```typescript
192
- import GooglePayPaymentMethod from '@payment-kit-js/vanilla/payment-methods/google-pay';
193
- import type { GooglePaySubmitOptions } from '@payment-kit-js/vanilla/payment-methods/google-pay';
194
- ```
195
-
196
- #### Prerequisites
197
-
198
- Add Stripe.js to your HTML:
199
-
200
- ```html
201
- <script src="https://js.stripe.com/v3/"></script>
202
- ```
203
-
204
- #### Initialize
205
-
206
- ```typescript
207
- const paymentKit = PaymentKit({
208
- baseUrl: 'https://your-domain.com',
209
- apiBaseUrl: 'https://api.domain.com',
210
- secureToken: 'checkout_token',
211
- paymentMethods: [GooglePayPaymentMethod]
212
- });
213
- ```
214
-
215
- #### Submit Google Pay Payment
216
-
217
- ```typescript
218
- paymentKit.submit({
219
- fields: {
220
- customer_name: 'John Doe',
221
- customer_email: 'john@example.com',
222
- customer_country: 'US',
223
- customer_zip_code: '10001'
224
- },
225
- paymentMethod: 'google_pay',
226
- options: {
227
- processorId: 'proc_xxx', // Your Google Pay processor ID
228
- customerInfo: {
229
- first_name: 'John',
230
- last_name: 'Doe'
231
- }
232
- },
233
- onSuccess: (result) => {
234
- console.log('Google Pay success:', result);
235
- },
236
- onError: (errors) => {
237
- if (errors.google_pay === 'Google Pay not available on this device') {
238
- // Show alternative payment methods
239
- }
240
- console.error('Google Pay error:', errors);
241
- }
242
- });
243
- ```
244
-
245
- ## Multiple Payment Methods
246
-
247
- Enable multiple payment methods in a single instance:
248
-
249
- ```typescript
250
- import CardPaymentMethod from '@payment-kit-js/vanilla/payment-methods/card';
251
- import PayPalPaymentMethod from '@payment-kit-js/vanilla/payment-methods/paypal';
252
- import GooglePayPaymentMethod from '@payment-kit-js/vanilla/payment-methods/google-pay';
253
-
254
- const paymentKit = PaymentKit({
255
- baseUrl: 'https://your-domain.com',
256
- apiBaseUrl: 'https://api.domain.com',
257
- secureToken: 'checkout_token',
258
- paymentMethods: [CardPaymentMethod, PayPalPaymentMethod, GooglePayPaymentMethod]
259
- });
260
-
261
- // TypeScript knows all available methods
262
- paymentKit.card.createElement('card_pan'); // ✓
263
- paymentKit.submit({ paymentMethod: 'card', ... }); // ✓
264
- paymentKit.submit({ paymentMethod: 'paypal', ... }); // ✓
265
- paymentKit.submit({ paymentMethod: 'google_pay', ... }); // ✓
266
- ```
267
-
268
- ## API Reference
269
-
270
- ### `PaymentKit(config)`
271
-
272
- Initialize PaymentKit instance.
273
-
274
- **Parameters**:
275
-
276
- ```typescript
277
- {
278
- baseUrl: string; // URL for loading iframes (e.g., https://your-domain.com)
279
- apiBaseUrl?: string; // URL for API calls (defaults to baseUrl)
280
- secureToken: string; // Checkout session token from your backend
281
- paymentMethods: PaymentMethod[]; // Array of payment method handlers
282
- }
283
- ```
284
-
285
- **Returns**: Object with payment method APIs + `submit()` + `cleanup()`
286
-
287
- ### `submit(options)`
288
-
289
- Submit a payment using specified payment method.
290
-
291
- **Parameters**:
292
-
293
- ```typescript
294
- {
295
- fields: {
296
- customer_name: string;
297
- customer_email: string;
298
- customer_country: string;
299
- customer_zip_code: string;
300
- };
301
- paymentMethod: 'card' | 'paypal' | 'google_pay';
302
- options?: unknown; // Payment method specific options
303
- onSuccess: (result: { [key: string]: unknown }) => void;
304
- onError: (errors: PaymentKitErrors) => void;
305
- }
306
- ```
307
-
308
- ### `cleanup()`
309
-
310
- Clean up all resources (iframes, popups, connections). **Always call this** when unmounting or leaving checkout.
311
-
312
- ```typescript
313
- useEffect(() => {
314
- return () => {
315
- paymentKit.cleanup();
316
- };
317
- }, [paymentKit]);
318
- ```
319
-
320
- ### Card API
321
-
322
- #### `card.createElement(type, options)`
323
-
324
- Create a secure card input iframe.
325
-
326
- **Types**:
327
- - `'card_pan'` - Card number
328
- - `'card_exp'` - Expiration (MM/YY)
329
- - `'card_cvc'` - Security code
330
-
331
- **Options**:
332
-
333
- ```typescript
334
- {
335
- style?: Record<string, string>; // CSS properties
336
- onLoaded?: () => void;
337
- onFocusChange?: (isFocused: boolean) => void;
338
- }
339
- ```
340
-
341
- **Returns**: `{ mount: (selector: string) => { unmount: () => void } }`
342
-
343
- ## Types
344
-
345
- ### PaymentKitFields
346
-
347
- ```typescript
348
- type PaymentKitFields = {
349
- customer_name: string;
350
- customer_email: string;
351
- customer_country: string;
352
- customer_zip_code: string;
353
- };
354
- ```
355
-
356
- ### PaymentKitErrors
357
-
358
- ```typescript
359
- type PaymentKitErrors = {
360
- root?: string;
361
-
362
- // Card errors
363
- card_pan?: CardErrorCode;
364
- card_exp?: CardErrorCode;
365
- card_cvc?: CardErrorCode;
366
-
367
- // PayPal errors
368
- paypal?: string;
369
-
370
- // Google Pay errors
371
- google_pay?: string;
372
-
373
- // Field validation
374
- customer_name?: 'required' | 'invalid';
375
- customer_email?: 'required' | 'invalid';
376
- customer_country?: 'required' | 'invalid';
377
- customer_zip_code?: 'required' | 'invalid';
378
-
379
- // Processor
380
- processor_id?: string;
381
- };
382
- ```
383
-
384
- ### CardErrorCode
385
-
386
- ```typescript
387
- type CardErrorCode =
388
- | 'required'
389
- | 'invalid'
390
- | 'incomplete'
391
- | 'invalid_number'
392
- | 'invalid_expiry'
393
- | 'invalid_cvc';
394
- ```
395
-
396
- ## React Example
397
-
398
- ### PaymentKit Provider
399
-
400
- ```tsx
401
- import { createContext, useContext, useEffect, useState } from 'react';
402
- import PaymentKit from '@payment-kit-js/vanilla';
403
- import CardPaymentMethod from '@payment-kit-js/vanilla/payment-methods/card';
404
- import PayPalPaymentMethod from '@payment-kit-js/vanilla/payment-methods/paypal';
405
- import GooglePayPaymentMethod from '@payment-kit-js/vanilla/payment-methods/google-pay';
406
-
407
- type PaymentKitInstance = ReturnType<typeof PaymentKit<
408
- [typeof CardPaymentMethod, typeof PayPalPaymentMethod, typeof GooglePayPaymentMethod]
409
- >>;
410
-
411
- const PaymentKitContext = createContext<PaymentKitInstance | null>(null);
412
-
413
- export const usePaymentKit = () => {
414
- const pk = useContext(PaymentKitContext);
415
- if (!pk) throw new Error('PaymentKit not initialized');
416
- return pk;
417
- };
418
-
419
- export const PaymentKitProvider = ({
420
- children,
421
- secureToken
422
- }: {
423
- children: React.ReactNode;
424
- secureToken: string;
425
- }) => {
426
- const [paymentKit, setPaymentKit] = useState<PaymentKitInstance | null>(null);
427
-
428
- useEffect(() => {
429
- const pk = PaymentKit({
430
- baseUrl: 'https://your-domain.com',
431
- apiBaseUrl: 'https://api.domain.com',
432
- secureToken,
433
- paymentMethods: [CardPaymentMethod, PayPalPaymentMethod, GooglePayPaymentMethod]
434
- });
435
-
436
- setPaymentKit(pk);
437
- return () => pk.cleanup();
438
- }, [secureToken]);
439
-
440
- if (!paymentKit) return null;
441
-
442
- return (
443
- <PaymentKitContext.Provider value={paymentKit}>
444
- {children}
445
- </PaymentKitContext.Provider>
446
- );
447
- };
448
- ```
449
-
450
- ### Card Input Component
451
-
452
- ```tsx
453
- import { useEffect } from 'react';
454
- import { usePaymentKit } from './PaymentKitProvider';
455
- import type { CardInputType } from '@payment-kit-js/vanilla/payment-methods/card';
456
-
457
- export const CardInput = ({
458
- type,
459
- className
460
- }: {
461
- type: CardInputType;
462
- className?: string;
463
- }) => {
464
- const paymentKit = usePaymentKit();
465
-
466
- useEffect(() => {
467
- const element = paymentKit.card.createElement(type, {
468
- style: {
469
- height: '42px',
470
- fontSize: '16px',
471
- padding: '10px',
472
- border: '1px solid #e0e0e0',
473
- borderRadius: '4px'
474
- }
475
- });
476
-
477
- const { unmount } = element.mount(`#${type}`);
478
- return unmount;
479
- }, [type, paymentKit]);
480
-
481
- return <div id={type} className={className} />;
482
- };
483
- ```
484
-
485
- ### Payment Form
486
-
487
- ```tsx
488
- import { useState } from 'react';
489
- import { usePaymentKit } from './PaymentKitProvider';
490
- import { CardInput } from './CardInput';
491
-
492
- export const PaymentForm = () => {
493
- const paymentKit = usePaymentKit();
494
- const [loading, setLoading] = useState(false);
495
- const [values, setValues] = useState({
496
- customer_name: '',
497
- customer_email: '',
498
- customer_country: '',
499
- customer_zip_code: ''
500
- });
501
-
502
- const handleCardPayment = () => {
503
- setLoading(true);
504
- paymentKit.submit({
505
- fields: values,
506
- paymentMethod: 'card',
507
- onSuccess: (result) => {
508
- setLoading(false);
509
- console.log('Success:', result);
510
- },
511
- onError: (errors) => {
512
- setLoading(false);
513
- console.error('Error:', errors);
514
- }
515
- });
516
- };
517
-
518
- const handlePayPalPayment = () => {
519
- const [firstName, ...rest] = values.customer_name.split(' ');
520
- setLoading(true);
521
-
522
- paymentKit.submit({
523
- fields: values,
524
- paymentMethod: 'paypal',
525
- options: {
526
- processorId: 'proc_xxx',
527
- customerInfo: {
528
- first_name: firstName,
529
- last_name: rest.join(' ')
530
- }
531
- },
532
- onSuccess: (result) => {
533
- setLoading(false);
534
- console.log('PayPal success:', result);
535
- },
536
- onError: (errors) => {
537
- setLoading(false);
538
- console.error('PayPal error:', errors);
539
- }
540
- });
541
- };
542
-
543
- const handleGooglePayment = () => {
544
- const [firstName, ...rest] = values.customer_name.split(' ');
545
- setLoading(true);
546
-
547
- paymentKit.submit({
548
- fields: values,
549
- paymentMethod: 'google_pay',
550
- options: {
551
- processorId: 'proc_xxx',
552
- customerInfo: {
553
- first_name: firstName,
554
- last_name: rest.join(' ')
555
- }
556
- },
557
- onSuccess: (result) => {
558
- setLoading(false);
559
- console.log('Google Pay success:', result);
560
- },
561
- onError: (errors) => {
562
- setLoading(false);
563
- console.error('Google Pay error:', errors);
564
- }
565
- });
566
- };
567
-
568
- return (
569
- <form onSubmit={(e) => e.preventDefault()}>
570
- <input
571
- placeholder="Name"
572
- value={values.customer_name}
573
- onChange={(e) => setValues(prev => ({ ...prev, customer_name: e.target.value }))}
574
- />
575
- <input
576
- placeholder="Email"
577
- value={values.customer_email}
578
- onChange={(e) => setValues(prev => ({ ...prev, customer_email: e.target.value }))}
579
- />
580
- <input
581
- placeholder="Country"
582
- value={values.customer_country}
583
- onChange={(e) => setValues(prev => ({ ...prev, customer_country: e.target.value }))}
584
- />
585
- <input
586
- placeholder="Zip Code"
587
- value={values.customer_zip_code}
588
- onChange={(e) => setValues(prev => ({ ...prev, customer_zip_code: e.target.value }))}
589
- />
590
-
591
- <h3>Card Payment</h3>
592
- <CardInput type="card_pan" />
593
- <CardInput type="card_exp" />
594
- <CardInput type="card_cvc" />
595
- <button onClick={handleCardPayment} disabled={loading}>
596
- Pay with Card
597
- </button>
598
-
599
- <h3>Alternative Payments</h3>
600
- <button onClick={handlePayPalPayment} disabled={loading}>
601
- Pay with PayPal
602
- </button>
603
- <button onClick={handleGooglePayment} disabled={loading}>
604
- Pay with Google Pay
605
- </button>
606
- </form>
607
- );
608
- };
609
- ```
610
-
611
- ## Error Handling
612
-
613
- ### Validation Errors
614
-
615
- ```typescript
616
- paymentKit.submit({
617
- fields: values,
618
- paymentMethod: 'card',
619
- onError: (errors) => {
620
- if (errors.customer_email === 'required') {
621
- showError('Email is required');
622
- }
623
- if (errors.card_pan === 'invalid_number') {
624
- showError('Invalid card number');
625
- }
626
- },
627
- onSuccess: () => { /* ... */ }
628
- });
629
- ```
630
-
631
- ### Payment Method Specific Errors
632
-
633
- ```typescript
634
- // Card errors
635
- onError: (errors) => {
636
- if (errors.card_pan) console.error('Card number error');
637
- if (errors.card_exp) console.error('Expiry error');
638
- if (errors.card_cvc) console.error('CVC error');
639
- }
640
-
641
- // PayPal errors
642
- onError: (errors) => {
643
- if (errors.paypal?.includes('popup')) {
644
- alert('Please enable popups');
645
- }
646
- if (errors.paypal?.includes('cancelled')) {
647
- console.log('User cancelled PayPal');
648
- }
649
- }
650
-
651
- // Google Pay errors
652
- onError: (errors) => {
653
- if (errors.google_pay === 'Google Pay not available on this device') {
654
- // Hide Google Pay button
655
- }
656
- if (errors.google_pay?.includes('cancelled')) {
657
- console.log('User cancelled Google Pay');
658
- }
659
- }
660
- ```
661
-
662
- ## Best Practices
663
-
664
- ### 1. Always Cleanup
665
-
666
- ```typescript
667
- useEffect(() => {
668
- const pk = PaymentKit({ /* config */ });
669
- return () => pk.cleanup(); // Critical!
670
- }, []);
671
- ```
672
-
673
- ### 2. Handle Loading States
674
-
675
- ```typescript
676
- const [loading, setLoading] = useState(false);
677
-
678
- const handleSubmit = () => {
679
- setLoading(true);
680
- paymentKit.submit({
681
- // ...
682
- onSuccess: () => setLoading(false),
683
- onError: () => setLoading(false)
684
- });
685
- };
686
- ```
687
-
688
- ### 3. Validate Before Submit
689
-
690
- ```typescript
691
- const handleSubmit = () => {
692
- if (!values.customer_email || !values.customer_name) {
693
- setError('Please fill required fields');
694
- return;
695
- }
696
- paymentKit.submit({ /* ... */ });
697
- };
698
- ```
699
-
700
- ### 4. Provide Fallback for Unsupported Methods
701
-
702
- ```typescript
703
- // Check Google Pay availability
704
- paymentKit.submit({
705
- paymentMethod: 'google_pay',
706
- onError: (errors) => {
707
- if (errors.google_pay?.includes('not available')) {
708
- setShowGooglePay(false); // Hide button
709
- }
710
- }
711
- });
712
- ```
713
-
714
- ### 5. Type Safety with TypeScript
715
-
716
- ```typescript
717
- // Type the instance based on enabled payment methods
718
- type PaymentKitInstance = ReturnType<typeof PaymentKit<
719
- [typeof CardPaymentMethod, typeof PayPalPaymentMethod]
720
- >>;
721
-
722
- // TypeScript enforces correct payment method names
723
- paymentKit.submit({ paymentMethod: 'card' }); // ✓
724
- paymentKit.submit({ paymentMethod: 'stripe' }); // ✗ Type error
725
- ```
726
-
727
- ## Troubleshooting
728
-
729
- ### Card inputs not showing
730
-
731
- - Ensure DOM elements exist before mounting
732
- - Check `baseUrl` is accessible
733
- - Verify `secureToken` is valid
734
-
735
- ### PayPal popup blocked
736
-
737
- - Instruct users to allow popups
738
- - Check browser console for errors
739
- - Verify `apiBaseUrl` is correct
740
-
741
- ### Google Pay not available
742
-
743
- - Add Stripe.js script tag
744
- - Test on supported devices (Android Chrome, Safari on iOS)
745
- - Check `processorId` is valid
53
+ | Method | Import |
54
+ |--------|--------|
55
+ | Card | `@payment-kit-js/vanilla/payment-methods/card` |
56
+ | PayPal | `@payment-kit-js/vanilla/payment-methods/paypal` |
57
+ | Google Pay | `@payment-kit-js/vanilla/payment-methods/google-pay` |
746
58
 
747
- ### TypeScript errors
59
+ ## Configuration
748
60
 
749
- - Ensure proper typing of PaymentKit instance
750
- - Import types from correct paths
751
- - Use `ReturnType<typeof PaymentKit<[...]>>` pattern
61
+ | Parameter | Type | Description |
62
+ |-----------|------|-------------|
63
+ | `environment` | `string` | `'sandbox'` or `'production'` |
64
+ | `secureToken` | `string` | Checkout session token from your backend |
65
+ | `paymentMethods` | `array` | Array of payment method handlers to enable |
752
66
 
753
67
  ## License
754
68
 
@@ -1,5 +1,3 @@
1
- import { t as CardSetupIntent } from "./cardsetupintent-D2gBMj3e.mjs";
2
- import { t as PublicCardCheckoutResponse } from "./publiccardcheckoutresponse-wxFCeVdO.mjs";
3
1
  import { Connection } from "penpal";
4
2
 
5
3
  //#region src/penpal/connect-card.d.ts
@@ -22,4 +20,4 @@ declare const connectToCardIframe: (iframe: HTMLIFrameElement, methods: CardPare
22
20
  declare const connectToCardParent: (methods: CardIFrameMethods) => Connection<CardParentMethods>;
23
21
  //#endregion
24
22
  export { ParentConnection as a, IFrameConnection as i, CardInputType as n, connectToCardIframe as o, CheckoutResponse as r, connectToCardParent as s, CardErrorCode as t };
25
- //# sourceMappingURL=connect-card-EaOlRbPS.d.mts.map
23
+ //# sourceMappingURL=connect-card-C582hcWw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-card-C582hcWw.d.mts","names":[],"sources":["../src/penpal/connect-card.ts"],"sourcesContent":[],"mappings":";;;KAIK,iBAAA;EAAA,QAAA,EAAA,CAAA,iBAAiB,EAAA,MAAA,EAAA,GACqB,OADrB,CAC6B,eAD7B,GAAA;IAC6B,KAAA,EAA2B,aAA3B;EAA2B,CAAA,CAAA;EAAnC,UAAA,EAAA,GAAA,GACvB,OADuB,CACf,aADe,GAAA,SAAA,CAAA;CACf;KAGvB,iBAAA,GAHe;EAAO,QAAA,EAAA,GAAA,GAAA,IAAA;EAGtB,aAAA,EAAA,CAAA,SAAiB,EAAA,OAAA,EAAA,GAAA,IAAA;AAKtB,CAAA;AAEY,KAFA,aAAA,GAEa,UAAA,GAAA,UAAA,GAAA,UAAA;AAOb,KAPA,aAAA,GAOgB,SAAc,GAAA,UAAA,GAAX,eAAU,GAAA,sBAAA,GAAA,wBAAA;AAE7B,KAFA,gBAAA,GAAmB,UAEW,CAFA,iBAEX,CAAA;AAEnB,KAFA,gBAAA,GAAmB,UAEA,CAFW,iBAEX,CAAA;AAElB,KAFD,gBAAA,GAAmB,0BAI9B;AAF2C,cAA/B,mBAA+B,EAAA,CAAA,MAAA,EAAA,iBAAA,EAAA,OAAA,EAA4B,iBAA5B,EAAA,GAA6C,UAA7C,CAA6C,iBAA7C,CAAA;AAA4B,cAI3D,mBAJ2D,EAAA,CAAA,OAAA,EAI3B,iBAJ2B,EAAA,GAIV,UAJU,CAIV,iBAJU,CAAA"}
@@ -1,58 +1,5 @@
1
- import { t as CardSetupIntent } from "./cardsetupintent-D2gBMj3e.mjs";
2
1
  import { Connection } from "penpal";
3
2
 
4
- //#region ../../packages/sdk/esm/models/createcardsetupintentres.d.ts
5
- type CreateCardSetupIntentRes = {
6
- /**
7
- * The ID of the card setup intent
8
- */
9
- cardSetupIntentId: string;
10
- };
11
- //#endregion
12
- //#region ../../packages/sdk/esm/lib/retries.d.ts
13
- type BackoffStrategy = {
14
- initialInterval: number;
15
- maxInterval: number;
16
- exponent: number;
17
- maxElapsedTime: number;
18
- };
19
- type RetryConfig = {
20
- strategy: "none";
21
- } | {
22
- strategy: "backoff";
23
- backoff?: BackoffStrategy;
24
- retryConnectionErrors?: boolean;
25
- };
26
- //#endregion
27
- //#region ../../packages/sdk/esm/lib/sdks.d.ts
28
- type RequestOptions = {
29
- /**
30
- * Sets a timeout, in milliseconds, on HTTP requests made by an SDK method. If
31
- * `fetchOptions.signal` is set then it will take precedence over this option.
32
- */
33
- timeoutMs?: number;
34
- /**
35
- * Set or override a retry policy on HTTP calls.
36
- */
37
- retries?: RetryConfig;
38
- /**
39
- * Specifies the status codes which should be retried using the given retry policy.
40
- */
41
- retryCodes?: string[];
42
- /**
43
- * Overrides the base server URL that will be used by an operation.
44
- */
45
- serverURL?: string | URL;
46
- /**
47
- * @deprecated `fetchOptions` has been flattened into `RequestOptions`.
48
- *
49
- * Sets various request options on the `fetch` call made by an SDK method.
50
- *
51
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request}
52
- */
53
- fetchOptions?: Omit<RequestInit, "method" | "body">;
54
- } & Omit<RequestInit, "method" | "body">;
55
- //#endregion
56
3
  //#region src/penpal/connect-tunnel-x.d.ts
57
4
  type TunnelXIFrameMethods = {
58
5
  startPayment: () => void;
@@ -89,4 +36,4 @@ declare class TunnelXManager {
89
36
  }
90
37
  //#endregion
91
38
  export { connectToTunnelXParent as a, connectToTunnelXIframe as i, TunnelXManager as n, TunnelXParentConnection as r, TunnelXIFrameConnection as t };
92
- //# sourceMappingURL=connect-tunnel-x-Ce423Pa2.d.mts.map
39
+ //# sourceMappingURL=connect-tunnel-x-rLA6I_EO.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-tunnel-x-rLA6I_EO.d.mts","names":[],"sources":["../src/penpal/connect-tunnel-x.ts"],"sourcesContent":[],"mappings":";;;AAEyC,KAMpC,oBAAA,GAAoB;EAGE,YAAA,EAAA,GAAA,GAAA,IAAA;EAA2B,cAAA,EAAA,GAAA,GAAA,IAAA;EAEO,cAAA,EAAA,CAAA,MAAA,EAFlC,MAEkC,CAAA,MAAA,EAAA,MAAA,CAAA,EAAA,GAFP,OAEO,CAAA,OAAA,CAAA;EAAR,kBAAA,EAAA,GAAA,GAAA,IAAA;EACK,kBAAA,EAAA,CAAA,iBAAA,EAAA,MAAA,EAAA,GADL,OACK,CADG,eACH,CAAA;EAAR,qBAAA,EAAA,CAAA,WAAA,EAAA,MAAA,EAAA,GAAA,OAAA,CAAQ,wBAAR,CAAA;EACqB,mBAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,EAAA,OAAA,CAAA,EAAA,cAAA,EAAA,GAAmB,OAAnB,CAAA,OAAA,CAAA;CAAmB;KAGrF,oBAAA,GAAuB,MAHqE,CAAA,MAAA,EAAA,KAAA,CAAA;AAG5F,KAEO,uBAAA,GAA0B,UAFJ,CAEe,oBAFf,CAAA;AAEtB,KAEA,uBAAA,GAA0B,UAFW,CAEA,oBAFX,CAAA;AAE1B,cAEC,sBAFoC,EAAA,CAAA,MAAA,EAEF,iBAFT,EAAA,OAAU,EAE2B,oBAF3B,EAAA,GAE+C,UAF/C,CAE+C,oBAF/C,CAAA;AAEnC,cAIA,sBAFZ,EAAA,CAAA,OAAA,EAE+C,oBAF/C,EAAA,GAEmE,UAFnE,CAEmE,oBAFnE,CAAA;;;;;KAUI,oBAAA,GAZ0F;EAIlF,CAAA,UAAA,EAAA,MAAA,CAAA,EAAA,CAAA,MAEZ,EAAA,OAAA,EAAA,OAAA,CAAA,EAOmD,cAPnD,EAAA,GAOsE,OAPtE,CAAA,OAAA,CAAA;CAF+C;AAAoB,cAYvD,cAAA,CAZuD;EAAA,QAAA,UAAA;EAAA,QAAA,EAcjD,oBAdiD;EAQ/D,OAAA,0BAAoB,EAC2B,CAAA,UAAA,EAOK,uBAPqB,EAAA,GAOE,OAPF,CAOE,cAPF,CAAA;EAGjE,QAAA,WAAc,CAAA;EAER;;;;EAiBM,IAAA,eAAA,CAAA,CAAA,EAAA,oBAAA;EAAoB,OAAA,CAAA,CAAA,EAAA,IAAA"}
package/dist/index.d.mts CHANGED
@@ -1,8 +1,6 @@
1
- import "./cardsetupintent-D2gBMj3e.mjs";
2
- import "./connect-tunnel-x-Ce423Pa2.mjs";
3
- import "./publiccardcheckoutresponse-wxFCeVdO.mjs";
4
- import "./connect-card-EaOlRbPS.mjs";
5
- import { n as PaymentKitFields, t as PaymentKit$1 } from "./types-6mOKdjCh.mjs";
1
+ import "./connect-card-C582hcWw.mjs";
2
+ import "./connect-tunnel-x-rLA6I_EO.mjs";
3
+ import { n as PaymentKitFields, t as PaymentKit$1 } from "./types-WgbMhIYb.mjs";
6
4
 
7
5
  //#region src/index.d.ts
8
6
  declare const PaymentKit: PaymentKit$1;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;cAwBM,YAAY"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;cAyBM,YAAY"}
package/dist/index.mjs CHANGED
@@ -3,7 +3,29 @@ import { n as connectToTunnelXIframe } from "./connect-tunnel-x-BhVAej5Q.mjs";
3
3
  import { r as createCheckoutIFrame } from "./utils-h0dxplHy.mjs";
4
4
 
5
5
  //#region package.json
6
- var version = "0.1.2";
6
+ var version = "0.2.0";
7
+
8
+ //#endregion
9
+ //#region src/types.ts
10
+ const ENVIRONMENT_URLS = {
11
+ local: {
12
+ baseUrl: "http://localhost:9101",
13
+ apiBaseUrl: "http://localhost:9000"
14
+ },
15
+ sandbox: {
16
+ baseUrl: "https://staging.paymentkit.com/customer",
17
+ apiBaseUrl: "https://staging.paymentkit.com"
18
+ },
19
+ production: {
20
+ baseUrl: "https://paymentkit.com/customer",
21
+ apiBaseUrl: "https://paymentkit.com"
22
+ }
23
+ };
24
+ function getUrlsForEnvironment(environment) {
25
+ const urls = ENVIRONMENT_URLS[environment];
26
+ if (!urls) throw new Error(`Invalid environment: ${environment}. Must be one of: local, sandbox, production`);
27
+ return urls;
28
+ }
7
29
 
8
30
  //#endregion
9
31
  //#region src/index.ts
@@ -23,8 +45,9 @@ const createTunnelXConnection = (baseUrl, apiBaseUrl, token) => {
23
45
  connection
24
46
  };
25
47
  };
26
- const PaymentKit = ({ baseUrl, apiBaseUrl, secureToken, paymentMethods }) => {
27
- console.log(`[PaymentKit] v${version} initialized`);
48
+ const PaymentKit = ({ environment, secureToken, paymentMethods }) => {
49
+ const { baseUrl, apiBaseUrl } = getUrlsForEnvironment(environment);
50
+ console.log(`[PaymentKit] v${version} initialized (env: ${environment})`);
28
51
  const { connection: tunnelXConnection, unmount: unmountTunnelX } = createTunnelXConnection(baseUrl, apiBaseUrl, secureToken);
29
52
  const paymentKitStates = {
30
53
  baseUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["PaymentKit: PaymentKitType","PACKAGE_VERSION","externalFuncsMapByPm: ExternalFuncsMapByPm<PaymentMethods>","submit: PaymentKitReturnType[\"submit\"]"],"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@payment-kit-js/vanilla\",\n \"version\": \"0.1.2\",\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.mts\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": \"./dist/index.mjs\",\n \"./payment-methods/card\": \"./dist/payment-methods/card.mjs\",\n \"./payment-methods/google-pay\": \"./dist/payment-methods/google-pay.mjs\",\n \"./payment-methods/next-action-handlers\": \"./dist/payment-methods/next-action-handlers.mjs\",\n \"./payment-methods/paypal\": \"./dist/payment-methods/paypal.mjs\",\n \"./payment-methods/stripe-google-pay-adapter\": \"./dist/payment-methods/stripe-google-pay-adapter.mjs\",\n \"./penpal/connect-card\": \"./dist/penpal/connect-card.mjs\",\n \"./penpal/connect-tunnel-x\": \"./dist/penpal/connect-tunnel-x.mjs\",\n \"./package.json\": \"./package.json\"\n },\n \"license\": \"MIT\",\n \"description\": \"Vanilla package for PaymentKit\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"dev\": \"yarn tsdown --watch ./src\",\n \"build\": \"yarn tsdown\"\n },\n \"packageManager\": \"yarn@4.10.3\",\n \"dependencies\": {\n \"@stripe/stripe-js\": \"^5.5.0\",\n \"penpal\": \"^7.0.4\",\n \"valibot\": \"^1.1.0\"\n },\n \"devDependencies\": {\n \"@pkg/sdk\": \"workspace:*\",\n \"@pkg/tsconfig\": \"workspace:*\",\n \"tsdown\": \"^0.15.10\",\n \"typescript\": \"^5.9.3\"\n },\n \"stableVersion\": \"0.1.2\"\n}\n","import { version as PACKAGE_VERSION } from \"../package.json\";\nimport { connectToTunnelXIframe } from \"./penpal/connect-tunnel-x\";\nimport type { ExternalFuncsMapByPm, PaymentKitFields, PaymentKit as PaymentKitType } from \"./types\";\nimport { createCheckoutIFrame } from \"./utils\";\n\ntype PaymentKitReturnType = ReturnType<PaymentKitType>;\n\nconst createTunnelXConnection = (baseUrl: string, apiBaseUrl: string, token: string) => {\n const iframe = createCheckoutIFrame(\"tunnel-x\", baseUrl, {\n checkout_token: token,\n api_base_url: apiBaseUrl,\n });\n document.body.appendChild(iframe);\n\n const connection = connectToTunnelXIframe(iframe, {});\n\n const unmount = () => {\n connection.destroy();\n document.body.removeChild(iframe);\n };\n\n return { unmount, connection };\n};\n\nconst PaymentKit: PaymentKitType = ({ baseUrl, apiBaseUrl, secureToken, paymentMethods }) => {\n type PaymentMethods = typeof paymentMethods;\n\n // Log version for debugging\n console.log(`[PaymentKit] v${PACKAGE_VERSION} initialized`);\n\n const { connection: tunnelXConnection, unmount: unmountTunnelX } = createTunnelXConnection(\n baseUrl,\n apiBaseUrl,\n secureToken,\n );\n\n const paymentKitStates = {\n baseUrl,\n apiBaseUrl,\n secureToken,\n tunnelXConnection,\n };\n\n const pmInstances = paymentMethods.map((paymentMethod) => paymentMethod(paymentKitStates));\n\n const externalFuncsMapByPm: ExternalFuncsMapByPm<PaymentMethods> = pmInstances.reduce(\n (acc, { name, externalFuncs }) => {\n // @ts-expect-error - typecase this better in future\n acc[name] = externalFuncs;\n return acc;\n },\n {} as ExternalFuncsMapByPm<PaymentMethods>,\n );\n\n const submit: PaymentKitReturnType[\"submit\"] = ({\n paymentMethod: paymentMethodName,\n fields,\n options,\n onSuccess,\n onError,\n }) => {\n const paymentMethod = pmInstances.find(({ name }) => name === paymentMethodName);\n if (!paymentMethod) {\n onError({ root: \"payment_method_not_found\" });\n return;\n }\n paymentMethod.internalFuncs\n .submitPayment(fields, options)\n .then(({ data, errors }) => {\n errors ? onError(errors) : onSuccess(data);\n })\n .catch((e) => {\n console.error(\"PaymentKit:submit:catch\", e);\n\n // Try to extract error message from response\n if (e?.response?.data) {\n onError(e.response.data);\n } else if (e?.message) {\n onError({ root: e.message });\n } else {\n onError({ root: \"unknown_error\" });\n }\n });\n };\n\n const cleanup = () => {\n // Clean up all payment method instances\n for (const pm of pmInstances) {\n if (pm.internalFuncs.cleanup) {\n pm.internalFuncs.cleanup();\n }\n }\n unmountTunnelX();\n };\n\n return {\n submit,\n cleanup,\n ...externalFuncsMapByPm,\n };\n};\n\nexport type { PaymentKitFields };\n\nexport default PaymentKit;\n"],"mappings":";;;;;cAEa;;;;ACKb,MAAM,2BAA2B,SAAiB,YAAoB,UAAkB;CACtF,MAAM,SAAS,qBAAqB,YAAY,SAAS;EACvD,gBAAgB;EAChB,cAAc;EACf,CAAC;AACF,UAAS,KAAK,YAAY,OAAO;CAEjC,MAAM,aAAa,uBAAuB,QAAQ,EAAE,CAAC;CAErD,MAAM,gBAAgB;AACpB,aAAW,SAAS;AACpB,WAAS,KAAK,YAAY,OAAO;;AAGnC,QAAO;EAAE;EAAS;EAAY;;AAGhC,MAAMA,cAA8B,EAAE,SAAS,YAAY,aAAa,qBAAqB;AAI3F,SAAQ,IAAI,iBAAiBC,QAAgB,cAAc;CAE3D,MAAM,EAAE,YAAY,mBAAmB,SAAS,mBAAmB,wBACjE,SACA,YACA,YACD;CAED,MAAM,mBAAmB;EACvB;EACA;EACA;EACA;EACD;CAED,MAAM,cAAc,eAAe,KAAK,kBAAkB,cAAc,iBAAiB,CAAC;CAE1F,MAAMC,uBAA6D,YAAY,QAC5E,KAAK,EAAE,MAAM,oBAAoB;AAEhC,MAAI,QAAQ;AACZ,SAAO;IAET,EAAE,CACH;CAED,MAAMC,UAA0C,EAC9C,eAAe,mBACf,QACA,SACA,WACA,cACI;EACJ,MAAM,gBAAgB,YAAY,MAAM,EAAE,WAAW,SAAS,kBAAkB;AAChF,MAAI,CAAC,eAAe;AAClB,WAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC7C;;AAEF,gBAAc,cACX,cAAc,QAAQ,QAAQ,CAC9B,MAAM,EAAE,MAAM,aAAa;AAC1B,YAAS,QAAQ,OAAO,GAAG,UAAU,KAAK;IAC1C,CACD,OAAO,MAAM;AACZ,WAAQ,MAAM,2BAA2B,EAAE;AAG3C,OAAI,GAAG,UAAU,KACf,SAAQ,EAAE,SAAS,KAAK;YACf,GAAG,QACZ,SAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;OAE5B,SAAQ,EAAE,MAAM,iBAAiB,CAAC;IAEpC;;CAGN,MAAM,gBAAgB;AAEpB,OAAK,MAAM,MAAM,YACf,KAAI,GAAG,cAAc,QACnB,IAAG,cAAc,SAAS;AAG9B,kBAAgB;;AAGlB,QAAO;EACL;EACA;EACA,GAAG;EACJ;;AAKH,kBAAe"}
1
+ {"version":3,"file":"index.mjs","names":["ENVIRONMENT_URLS: Record<PaymentKitEnvironment, EnvironmentUrls>","PaymentKit: PaymentKitType","PACKAGE_VERSION","externalFuncsMapByPm: ExternalFuncsMapByPm<PaymentMethods>","submit: PaymentKitReturnType[\"submit\"]"],"sources":["../package.json","../src/types.ts","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@payment-kit-js/vanilla\",\n \"version\": \"0.2.0\",\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.mts\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": \"./dist/index.mjs\",\n \"./payment-methods/card\": \"./dist/payment-methods/card.mjs\",\n \"./payment-methods/google-pay\": \"./dist/payment-methods/google-pay.mjs\",\n \"./payment-methods/next-action-handlers\": \"./dist/payment-methods/next-action-handlers.mjs\",\n \"./payment-methods/paypal\": \"./dist/payment-methods/paypal.mjs\",\n \"./payment-methods/stripe-google-pay-adapter\": \"./dist/payment-methods/stripe-google-pay-adapter.mjs\",\n \"./penpal/connect-card\": \"./dist/penpal/connect-card.mjs\",\n \"./penpal/connect-tunnel-x\": \"./dist/penpal/connect-tunnel-x.mjs\",\n \"./package.json\": \"./package.json\"\n },\n \"license\": \"MIT\",\n \"description\": \"Vanilla package for PaymentKit\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"dev\": \"yarn tsdown --watch ./src\",\n \"build\": \"yarn tsdown\"\n },\n \"packageManager\": \"yarn@4.10.3\",\n \"dependencies\": {\n \"penpal\": \"^7.0.4\",\n \"valibot\": \"^1.1.0\"\n },\n \"devDependencies\": {\n \"@pkg/sdk\": \"workspace:*\",\n \"@pkg/tsconfig\": \"workspace:*\",\n \"@stripe/stripe-js\": \"^5.5.0\",\n \"tsdown\": \"^0.15.10\",\n \"typescript\": \"^5.9.3\"\n },\n \"stableVersion\": \"0.2.0\"\n}\n","import type { CardErrorCode } from \"./penpal/connect-card\";\nimport type { TunnelXIFrameConnection } from \"./penpal/connect-tunnel-x\";\n\nexport type PaymentKitEnvironment = \"local\" | \"sandbox\" | \"production\";\n\ntype EnvironmentUrls = {\n baseUrl: string;\n apiBaseUrl: string;\n};\n\n// TODO: Cleanup this after launch to only use SDK instead of plain fetch.\nconst ENVIRONMENT_URLS: Record<PaymentKitEnvironment, EnvironmentUrls> = {\n local: {\n baseUrl: \"http://localhost:9101\",\n apiBaseUrl: \"http://localhost:9000\",\n },\n sandbox: {\n baseUrl: \"https://staging.paymentkit.com/customer\",\n apiBaseUrl: \"https://staging.paymentkit.com\",\n },\n production: {\n baseUrl: \"https://paymentkit.com/customer\",\n apiBaseUrl: \"https://paymentkit.com\",\n },\n};\n\nexport function getUrlsForEnvironment(environment: string): EnvironmentUrls {\n const env = environment as PaymentKitEnvironment;\n const urls = ENVIRONMENT_URLS[env];\n if (!urls) {\n throw new Error(`Invalid environment: ${environment}. Must be one of: local, sandbox, production`);\n }\n return urls;\n}\n\ntype FormFieldNames = \"customer_name\" | \"customer_email\" | \"customer_country\" | \"customer_zip_code\";\n\nexport type FormErrorCodes = \"required\" | \"invalid\";\n\nexport type TInternalFuncs = {\n submitPayment: (\n fields: PaymentKitFields,\n options?: unknown,\n ) => Promise<{ data: { [key: string]: unknown }; errors?: never } | { data?: never; errors: PaymentKitErrors }>;\n cleanup?: () => void;\n};\n\nexport type PaymentKit = <T extends readonly PaymentMethod<unknown>[]>(options: {\n environment: string;\n secureToken: string;\n paymentMethods: T;\n}) => ExternalFuncsMapByPm<T> & {\n submit: PaymentKitSubmitHandler<T>;\n cleanup: () => void;\n};\n\ntype PaymentKitSubmitHandler<T extends readonly PaymentMethod<unknown>[]> = <\n N extends keyof ExternalFuncsMapByPm<T>,\n>(options: {\n fields: PaymentKitFields;\n paymentMethod: N;\n options?: unknown;\n onError: (error: PaymentKitErrors) => void;\n onSuccess: (data: { [key: string]: unknown }) => void;\n}) => void;\n\nexport type PaymentKitStates = {\n baseUrl: string;\n apiBaseUrl: string;\n secureToken: string;\n tunnelXConnection: TunnelXIFrameConnection;\n};\n\nexport type PaymentKitErrors = {\n root?: string;\n card_pan?: CardErrorCode;\n card_exp?: CardErrorCode;\n card_cvc?: CardErrorCode;\n paypal?: string;\n google_pay?: string;\n processor_id?: string;\n amount?: string;\n currency?: string;\n country?: string;\n} & { [key in FormFieldNames]?: FormErrorCodes | string };\n\nexport type PaymentKitFields = { [key in FormFieldNames]: string };\n\nexport type PaymentMethod<TExternalFuncs = unknown, TName = string> = (paymentKitStates: PaymentKitStates) => {\n name: TName;\n externalFuncs: TExternalFuncs;\n internalFuncs: TInternalFuncs;\n};\n\nexport type ExternalFuncsMapByPm<T extends readonly PaymentMethod<unknown>[]> = {\n [K in T[number] as ReturnType<K>[\"name\"]]: ReturnType<K>[\"externalFuncs\"];\n};\n","import { version as PACKAGE_VERSION } from \"../package.json\";\nimport { connectToTunnelXIframe } from \"./penpal/connect-tunnel-x\";\nimport type { ExternalFuncsMapByPm, PaymentKitFields, PaymentKit as PaymentKitType } from \"./types\";\nimport { getUrlsForEnvironment } from \"./types\";\nimport { createCheckoutIFrame } from \"./utils\";\n\ntype PaymentKitReturnType = ReturnType<PaymentKitType>;\n\nconst createTunnelXConnection = (baseUrl: string, apiBaseUrl: string, token: string) => {\n const iframe = createCheckoutIFrame(\"tunnel-x\", baseUrl, {\n checkout_token: token,\n api_base_url: apiBaseUrl,\n });\n document.body.appendChild(iframe);\n\n const connection = connectToTunnelXIframe(iframe, {});\n\n const unmount = () => {\n connection.destroy();\n document.body.removeChild(iframe);\n };\n\n return { unmount, connection };\n};\n\nconst PaymentKit: PaymentKitType = ({ environment, secureToken, paymentMethods }) => {\n type PaymentMethods = typeof paymentMethods;\n\n // Resolve URLs from environment\n const { baseUrl, apiBaseUrl } = getUrlsForEnvironment(environment);\n\n // Log version for debugging\n console.log(`[PaymentKit] v${PACKAGE_VERSION} initialized (env: ${environment})`);\n\n const { connection: tunnelXConnection, unmount: unmountTunnelX } = createTunnelXConnection(\n baseUrl,\n apiBaseUrl,\n secureToken,\n );\n\n const paymentKitStates = {\n baseUrl,\n apiBaseUrl,\n secureToken,\n tunnelXConnection,\n };\n\n const pmInstances = paymentMethods.map((paymentMethod) => paymentMethod(paymentKitStates));\n\n const externalFuncsMapByPm: ExternalFuncsMapByPm<PaymentMethods> = pmInstances.reduce(\n (acc, { name, externalFuncs }) => {\n // @ts-expect-error - typecase this better in future\n acc[name] = externalFuncs;\n return acc;\n },\n {} as ExternalFuncsMapByPm<PaymentMethods>,\n );\n\n const submit: PaymentKitReturnType[\"submit\"] = ({\n paymentMethod: paymentMethodName,\n fields,\n options,\n onSuccess,\n onError,\n }) => {\n const paymentMethod = pmInstances.find(({ name }) => name === paymentMethodName);\n if (!paymentMethod) {\n onError({ root: \"payment_method_not_found\" });\n return;\n }\n paymentMethod.internalFuncs\n .submitPayment(fields, options)\n .then(({ data, errors }) => {\n errors ? onError(errors) : onSuccess(data);\n })\n .catch((e) => {\n console.error(\"PaymentKit:submit:catch\", e);\n\n // Try to extract error message from response\n if (e?.response?.data) {\n onError(e.response.data);\n } else if (e?.message) {\n onError({ root: e.message });\n } else {\n onError({ root: \"unknown_error\" });\n }\n });\n };\n\n const cleanup = () => {\n // Clean up all payment method instances\n for (const pm of pmInstances) {\n if (pm.internalFuncs.cleanup) {\n pm.internalFuncs.cleanup();\n }\n }\n unmountTunnelX();\n };\n\n return {\n submit,\n cleanup,\n ...externalFuncsMapByPm,\n };\n};\n\nexport type { PaymentKitFields };\n\nexport default PaymentKit;\n"],"mappings":";;;;;cAEa;;;;ACSb,MAAMA,mBAAmE;CACvE,OAAO;EACL,SAAS;EACT,YAAY;EACb;CACD,SAAS;EACP,SAAS;EACT,YAAY;EACb;CACD,YAAY;EACV,SAAS;EACT,YAAY;EACb;CACF;AAED,SAAgB,sBAAsB,aAAsC;CAE1E,MAAM,OAAO,iBADD;AAEZ,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,wBAAwB,YAAY,8CAA8C;AAEpG,QAAO;;;;;ACxBT,MAAM,2BAA2B,SAAiB,YAAoB,UAAkB;CACtF,MAAM,SAAS,qBAAqB,YAAY,SAAS;EACvD,gBAAgB;EAChB,cAAc;EACf,CAAC;AACF,UAAS,KAAK,YAAY,OAAO;CAEjC,MAAM,aAAa,uBAAuB,QAAQ,EAAE,CAAC;CAErD,MAAM,gBAAgB;AACpB,aAAW,SAAS;AACpB,WAAS,KAAK,YAAY,OAAO;;AAGnC,QAAO;EAAE;EAAS;EAAY;;AAGhC,MAAMC,cAA8B,EAAE,aAAa,aAAa,qBAAqB;CAInF,MAAM,EAAE,SAAS,eAAe,sBAAsB,YAAY;AAGlE,SAAQ,IAAI,iBAAiBC,QAAgB,qBAAqB,YAAY,GAAG;CAEjF,MAAM,EAAE,YAAY,mBAAmB,SAAS,mBAAmB,wBACjE,SACA,YACA,YACD;CAED,MAAM,mBAAmB;EACvB;EACA;EACA;EACA;EACD;CAED,MAAM,cAAc,eAAe,KAAK,kBAAkB,cAAc,iBAAiB,CAAC;CAE1F,MAAMC,uBAA6D,YAAY,QAC5E,KAAK,EAAE,MAAM,oBAAoB;AAEhC,MAAI,QAAQ;AACZ,SAAO;IAET,EAAE,CACH;CAED,MAAMC,UAA0C,EAC9C,eAAe,mBACf,QACA,SACA,WACA,cACI;EACJ,MAAM,gBAAgB,YAAY,MAAM,EAAE,WAAW,SAAS,kBAAkB;AAChF,MAAI,CAAC,eAAe;AAClB,WAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC7C;;AAEF,gBAAc,cACX,cAAc,QAAQ,QAAQ,CAC9B,MAAM,EAAE,MAAM,aAAa;AAC1B,YAAS,QAAQ,OAAO,GAAG,UAAU,KAAK;IAC1C,CACD,OAAO,MAAM;AACZ,WAAQ,MAAM,2BAA2B,EAAE;AAG3C,OAAI,GAAG,UAAU,KACf,SAAQ,EAAE,SAAS,KAAK;YACf,GAAG,QACZ,SAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;OAE5B,SAAQ,EAAE,MAAM,iBAAiB,CAAC;IAEpC;;CAGN,MAAM,gBAAgB;AAEpB,OAAK,MAAM,MAAM,YACf,KAAI,GAAG,cAAc,QACnB,IAAG,cAAc,SAAS;AAG9B,kBAAgB;;AAGlB,QAAO;EACL;EACA;EACA,GAAG;EACJ;;AAKH,kBAAe"}
@@ -1,8 +1,6 @@
1
- import "../cardsetupintent-D2gBMj3e.mjs";
2
- import "../connect-tunnel-x-Ce423Pa2.mjs";
3
- import "../publiccardcheckoutresponse-wxFCeVdO.mjs";
4
- import { n as CardInputType$1, o as connectToCardIframe, r as CheckoutResponse$1 } from "../connect-card-EaOlRbPS.mjs";
5
- import { r as PaymentMethod } from "../types-6mOKdjCh.mjs";
1
+ import { n as CardInputType$1, o as connectToCardIframe, r as CheckoutResponse$1 } from "../connect-card-C582hcWw.mjs";
2
+ import "../connect-tunnel-x-rLA6I_EO.mjs";
3
+ import { r as PaymentMethod } from "../types-WgbMhIYb.mjs";
6
4
 
7
5
  //#region src/payment-methods/card.d.ts
8
6
  type CardInputType = CardInputType$1;
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.mts","names":[],"sources":["../../src/payment-methods/card.ts"],"sourcesContent":[],"mappings":";;;;;;;KAQY,aAAA,GAAgB;KAChB,gBAAA,GAAmB;KAgD1B,oBAAA,GAAuB,QAAQ,kBAAkB;UAC5C;;cA+MJ,mBAzM4D;EAxDtD,aAAA,EAAA,CAAa,IAAA,EAwDT,eAxDY,EAAmB,OAAA,EAwDD,oBAxDC,EAAA,GAAA;IACnC,KAAA,EAAA,CAAA,cAAgB,EAAA,MAAG,EAAA,GAAA;MAgD1B,OAAA,EAAA,GAAA,GAAoB,IAAA;IAA6B,CAAA;EAAlB,CAAA;CAAR,EAAA,MAAA,CAAA"}
1
+ {"version":3,"file":"card.d.mts","names":[],"sources":["../../src/payment-methods/card.ts"],"sourcesContent":[],"mappings":";;;;;KAQY,aAAA,GAAgB;KAChB,gBAAA,GAAmB;KAgD1B,oBAAA,GAAuB,QAAQ,kBAAkB;UAC5C;AAlDV,CAAA;AACA,cAgQM,iBAhQsB,EAuDsC,aAvDb,CAAA;EAgDhD,aAAA,EAAA,CAAA,IAAA,EAOW,eAPS,EAAA,OAAA,EAOqB,oBAPrB,EAAA,GAAA;IAA6B,KAAA,EAAA,CAAA,cAAA,EAAA,MAAA,EAAA,GAAA;MAAlB,OAAA,EAAA,GAAA,GAAA,IAAA;IAAR,CAAA;EAClB,CAAA;CAAM,EAAA,MAAA,CAAA"}
@@ -1,9 +1,7 @@
1
- import "../cardsetupintent-D2gBMj3e.mjs";
2
- import "../connect-tunnel-x-Ce423Pa2.mjs";
3
- import "../publiccardcheckoutresponse-wxFCeVdO.mjs";
4
- import "../connect-card-EaOlRbPS.mjs";
5
- import { r as PaymentMethod } from "../types-6mOKdjCh.mjs";
6
- import { n as GooglePayMockScenario } from "../stripe-google-pay-adapter-CkV5HWI-.mjs";
1
+ import "../connect-card-C582hcWw.mjs";
2
+ import "../connect-tunnel-x-rLA6I_EO.mjs";
3
+ import { r as PaymentMethod } from "../types-WgbMhIYb.mjs";
4
+ import { n as GooglePayMockScenario } from "../stripe-google-pay-adapter-DUUB46SG.mjs";
7
5
 
8
6
  //#region src/payment-methods/google-pay.d.ts
9
7
  type GooglePayCustomerInfo = {
@@ -1 +1 @@
1
- {"version":3,"file":"google-pay.d.mts","names":[],"sources":["../../src/payment-methods/google-pay.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAKY,qBAAA;;;;KAKA,qBAAA;;iBAEK;EAPL,cAAA,EAAA;IAKA,SAAA,CAAA,EAAA,MAAA;IAWA,WAAA,CAAA,EAAA;MASA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAwB;IAOxB,CAAA;IA8MN,kBAAA,CAAA,EASJ;;;;;;KAvOU,sBAAA;;;;;;;;KASA,wBAAA;;;;;;KAOA,sBAAA;;gBAEI;iBACC;;cA2MX,wBASJ"}
1
+ {"version":3,"file":"google-pay.d.mts","names":[],"sources":["../../src/payment-methods/google-pay.ts"],"sourcesContent":[],"mappings":";;;;;;KAKY,qBAAA;;;;KAKA,qBAAA;EALA,YAAA,EAAA,MAAA;EAKA,aAAA,EAEK,qBAAA;EASL,cAAA,EAAA;IASA,SAAA,CAAA,EAAA,MAAA;IAOA,WAAA,CAAA,EAAA;MA8MN,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OASJ;;;;;;;;KAvOU,sBAAA;;;;;;;;KASA,wBAAA;;;;;;KAOA,sBAAA;;gBAEI;iBACC;;cA2MX,wBASJ"}
@@ -1,5 +1,3 @@
1
- import { t as PublicCardCheckoutResponse } from "../publiccardcheckoutresponse-wxFCeVdO.mjs";
2
-
3
1
  //#region src/payment-methods/next-action-handlers.d.ts
4
2
 
5
3
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"next-action-handlers.d.mts","names":[],"sources":["../../src/payment-methods/next-action-handlers.ts"],"sourcesContent":[],"mappings":";;;;;;;KA6CY,gBAAA;;;;;;;;;;;;;cAgCC,+BACC,YAAY,8CACvB,QAAQ"}
1
+ {"version":3,"file":"next-action-handlers.d.mts","names":[],"sources":["../../src/payment-methods/next-action-handlers.ts"],"sourcesContent":[],"mappings":";;;;;KA6CY,gBAAA;;;;;;;;;;;;;cAgCC,+BACC,YAAY,8CACvB,QAAQ"}
@@ -1,8 +1,6 @@
1
- import "../cardsetupintent-D2gBMj3e.mjs";
2
- import "../connect-tunnel-x-Ce423Pa2.mjs";
3
- import "../publiccardcheckoutresponse-wxFCeVdO.mjs";
4
- import "../connect-card-EaOlRbPS.mjs";
5
- import { r as PaymentMethod } from "../types-6mOKdjCh.mjs";
1
+ import "../connect-card-C582hcWw.mjs";
2
+ import "../connect-tunnel-x-rLA6I_EO.mjs";
3
+ import { r as PaymentMethod } from "../types-WgbMhIYb.mjs";
6
4
 
7
5
  //#region src/payment-methods/paypal.d.ts
8
6
  type PayPalCustomerInfo = {
@@ -1 +1 @@
1
- {"version":3,"file":"paypal.d.mts","names":[],"sources":["../../src/payment-methods/paypal.ts"],"sourcesContent":[],"mappings":";;;;;;;KAIY,kBAAA;;;;KAKA,kBAAA;;iBAEK;EAPL,cAAA,EAAA;IAKA,SAAA,CAAA,EAAA,MAAkB;IAUlB,WAAA,CAAA,EAAA;MAMA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAoB,OAAA;IAOpB,CAAA;IAOA,kBAAmB,CAAA,EAAA;MA0JzB,CAAA,GAAA,EAAA,MAAA,CAAA,EAqBJ,OAAA;;;;KAnMU,mBAAA;;;;;KAMA,oBAAA;;;;;;KAOA,sBAAA;;;;;;KAOA,mBAAA;;gBAEI;;cAwJV,qBAqBJ"}
1
+ {"version":3,"file":"paypal.d.mts","names":[],"sources":["../../src/payment-methods/paypal.ts"],"sourcesContent":[],"mappings":";;;;;KAIY,kBAAA;;;;KAKA,kBAAA;EALA,YAAA,EAAA,MAAA;EAKA,aAAA,EAEK,kBAAA;EAQL,cAAA,EAAA;IAMA,SAAA,CAAA,EAAA,MAAA;IAOA,WAAA,CAAA,EAAA;MAOA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAmB,OAAA;IA0JzB,CAAA;;;;;;KA9KM,mBAAA;;;;;KAMA,oBAAA;;;;;;KAOA,sBAAA;;;;;;KAOA,mBAAA;;gBAEI;;cAwJV,qBAqBJ"}
@@ -1,2 +1,2 @@
1
- import { a as StripeGooglePayAdapter, i as ShowPaymentSheetResult, n as GooglePayMockScenario, r as PaymentRequestConfig, t as ConfirmResult } from "../stripe-google-pay-adapter-CkV5HWI-.mjs";
1
+ import { a as StripeGooglePayAdapter, i as ShowPaymentSheetResult, n as GooglePayMockScenario, r as PaymentRequestConfig, t as ConfirmResult } from "../stripe-google-pay-adapter-DUUB46SG.mjs";
2
2
  export { ConfirmResult, GooglePayMockScenario, PaymentRequestConfig, ShowPaymentSheetResult, StripeGooglePayAdapter };
@@ -1,4 +1,2 @@
1
- import "../cardsetupintent-D2gBMj3e.mjs";
2
- import "../publiccardcheckoutresponse-wxFCeVdO.mjs";
3
- import { a as ParentConnection, i as IFrameConnection, n as CardInputType, o as connectToCardIframe, r as CheckoutResponse, s as connectToCardParent, t as CardErrorCode } from "../connect-card-EaOlRbPS.mjs";
1
+ import { a as ParentConnection, i as IFrameConnection, n as CardInputType, o as connectToCardIframe, r as CheckoutResponse, s as connectToCardParent, t as CardErrorCode } from "../connect-card-C582hcWw.mjs";
4
2
  export { CardErrorCode, CardInputType, CheckoutResponse, IFrameConnection, ParentConnection, connectToCardIframe, connectToCardParent };
@@ -1,3 +1,2 @@
1
- import "../cardsetupintent-D2gBMj3e.mjs";
2
- import { a as connectToTunnelXParent, i as connectToTunnelXIframe, n as TunnelXManager, r as TunnelXParentConnection, t as TunnelXIFrameConnection } from "../connect-tunnel-x-Ce423Pa2.mjs";
1
+ import { a as connectToTunnelXParent, i as connectToTunnelXIframe, n as TunnelXManager, r as TunnelXParentConnection, t as TunnelXIFrameConnection } from "../connect-tunnel-x-rLA6I_EO.mjs";
3
2
  export { TunnelXIFrameConnection, TunnelXManager, TunnelXParentConnection, connectToTunnelXIframe, connectToTunnelXParent };
@@ -51,4 +51,4 @@ declare class StripeGooglePayAdapter {
51
51
  }
52
52
  //#endregion
53
53
  export { StripeGooglePayAdapter as a, ShowPaymentSheetResult as i, GooglePayMockScenario as n, PaymentRequestConfig as r, ConfirmResult as t };
54
- //# sourceMappingURL=stripe-google-pay-adapter-CkV5HWI-.d.mts.map
54
+ //# sourceMappingURL=stripe-google-pay-adapter-DUUB46SG.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripe-google-pay-adapter-CkV5HWI-.d.mts","names":[],"sources":["../src/payment-methods/stripe-google-pay-adapter.ts"],"sourcesContent":[],"mappings":";;;;;IAAqH,MAAA,CAAA,EAKxG,iBALwG;EAAA;;AAKvF,UAIb,oBAAA,CAJa;EAAA,OAAA,EAAA,MAAA;EAIb,QAAA,EAAA,MAAA;EAQL,KAAA,EAAA;IAKA,KAAA,EAAA,MAAa;IAEb,MAAA,EAAA,MAAA;EAMC,CAAA;EAKgB,gBAAA,EAAA,OAAA;EA0BE,iBAAA,EAAA,OAAA;;AAyCK,KArFxB,sBAAA,GAqFwB;EAAR,OAAA,EAAA,IAAA;EAqDqD,eAAA,EAAA,MAAA;EAAR,QAAA,EAAA,CAAA,MAAA,EAAA,SAAA,GAAA,MAAA,EAAA,GAAA,IAAA;CAAO,GAAA;;;;;;;KArIpE,aAAA;;;;;;aAEA,qBAAA;;;;;cAMC,sBAAA;;;;6BAKgB;;+BA0BE;oBAmBL;sBAsBE,QAAQ;mEAqDqC,QAAQ"}
1
+ {"version":3,"file":"stripe-google-pay-adapter-DUUB46SG.d.mts","names":[],"sources":["../src/payment-methods/stripe-google-pay-adapter.ts"],"sourcesContent":[],"mappings":";;;;;IAAqH,MAAA,CAAA,EAKxG,iBALwG;EAAA;;AAKvF,UAIb,oBAAA,CAJa;EAAA,OAAA,EAAA,MAAA;EAIb,QAAA,EAAA,MAAA;EAQL,KAAA,EAAA;IAKA,KAAA,EAAA,MAAa;IAEb,MAAA,EAAA,MAAA;EAMC,CAAA;EAKgB,gBAAA,EAAA,OAAA;EA0BE,iBAAA,EAAA,OAAA;;AAyCK,KArFxB,sBAAA,GAqFwB;EAAR,OAAA,EAAA,IAAA;EAqDqD,eAAA,EAAA,MAAA;EAAR,QAAA,EAAA,CAAA,MAAA,EAAA,SAAA,GAAA,MAAA,EAAA,GAAA,IAAA;CAAO,GAAA;;;;;;;KArIpE,aAAA;;;;;;aAEA,qBAAA;;;;;cAMC,sBAAA;;;;6BAKgB;;+BA0BE;oBAmBL;sBAsBE,QAAQ;mEAqDqC,QAAQ"}
@@ -1,7 +1,8 @@
1
- import { t as TunnelXIFrameConnection } from "./connect-tunnel-x-Ce423Pa2.mjs";
2
- import { t as CardErrorCode } from "./connect-card-EaOlRbPS.mjs";
1
+ import { t as CardErrorCode } from "./connect-card-C582hcWw.mjs";
2
+ import { t as TunnelXIFrameConnection } from "./connect-tunnel-x-rLA6I_EO.mjs";
3
3
 
4
4
  //#region src/types.d.ts
5
+
5
6
  type FormFieldNames = "customer_name" | "customer_email" | "customer_country" | "customer_zip_code";
6
7
  type FormErrorCodes = "required" | "invalid";
7
8
  type TInternalFuncs = {
@@ -17,8 +18,7 @@ type TInternalFuncs = {
17
18
  cleanup?: () => void;
18
19
  };
19
20
  type PaymentKit = <T extends readonly PaymentMethod<unknown>[]>(options: {
20
- baseUrl: string;
21
- apiBaseUrl: string;
21
+ environment: string;
22
22
  secureToken: string;
23
23
  paymentMethods: T;
24
24
  }) => ExternalFuncsMapByPm<T> & {
@@ -61,4 +61,4 @@ type PaymentMethod<TExternalFuncs = unknown, TName = string> = (paymentKitStates
61
61
  type ExternalFuncsMapByPm<T extends readonly PaymentMethod<unknown>[]> = { [K in T[number] as ReturnType<K>["name"]]: ReturnType<K>["externalFuncs"] };
62
62
  //#endregion
63
63
  export { PaymentKitFields as n, PaymentMethod as r, PaymentKit as t };
64
- //# sourceMappingURL=types-6mOKdjCh.d.mts.map
64
+ //# sourceMappingURL=types-WgbMhIYb.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-WgbMhIYb.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;KAmCK,cAAA,GAQyF,eAAA,GAAA,gBAAA,GAAA,kBAAA,GAAA,mBAAA;AAAvF,KANK,cAAA,GAML,UAAA,GAAA,SAAA;AAAO,KAJF,cAAA,GAIE;EAIF,aAAU,EAAA,CAAA,MAAA,EANV,gBAMU,EAAA,OAAA,CAAA,EAAA,OAAA,EAAA,GAJf,OAIe,CAAA;IAAuB,IAAA,EAAA;MAG3B,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;IACS,CAAA;IAArB,MAAA,CAAA,EAAA,KAAA;EAC4B,CAAA,GAAA;IAAxB,IAAA,CAAA,EAAA,KAAA;IAAuB,MAAA,EAT6D,gBAS7D;EAI5B,CAAA,CAAA;EAA2C,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;CACT;AAArB,KAVN,UAAA,GAUM,CAAA,UAAA,SAV2B,aAU3B,CAAA,OAAA,CAAA,EAAA,CAAA,CAAA,OAAA,EAAA;EAER,WAAA,EAAA,MAAA;EACO,WAAA,EAAA,MAAA;EAEE,cAAA,EAZD,CAYC;CAAgB,EAAA,GAX7B,oBAW6B,CAXR,CAWQ,CAAA,GAAA;EAIvB,MAAA,EAdF,uBAkBW,CAlBa,CAkBb,CAAA;EAGT,OAAA,EAAA,GAAA,GAAA,IAAgB;CAEf;KAnBR,uBAoBQ,CAAA,UAAA,SApBmC,aAoBnC,CAAA,OAAA,CAAA,EAAA,CAAA,GAAA,CAAA,UAAA,MAnBK,oBAmBL,CAnB0B,CAmB1B,CAAA,CAAA,CAAA,OAAA,EAAA;EACA,MAAA,EAlBH,gBAkBG;EAOC,aAAA,EAxBG,CAwBH;EAAkB,OAAA,CAAA,EAAA,OAAA;EAAc,OAAA,EAAA,CAAA,KAAA,EAtB3B,gBAsB2B,EAAA,GAAA,IAAA;EAElC,SAAA,EAAA,CAAA,IAAA,EAAA;IAEA,CAAA,GAAA,EAAA,MAAa,CAAA,EAAA,OAAA;EAAgE,CAAA,EAAA,GAAA,IAAA;CACjF,EAAA,GAAA,IAAA;AACS,KAxBL,gBAAA,GAwBK;EACA,OAAA,EAAA,MAAA;EAAc,UAAA,EAAA,MAAA;EAGnB,WAAA,EAAA,MAAA;EAAwC,iBAAA,EAxB/B,uBAwB+B;CAC5C;AAAwB,KAtBpB,gBAAA,GAsBoB;EAAX,IAAA,CAAA,EAAA,MAAA;EAAmC,QAAA,CAAA,EApB3C,aAoB2C;EAAX,QAAA,CAAA,EAnBhC,aAmBgC;EAAU,QAAA,CAAA,EAlB1C,aAkB0C;;;;;;;cAXzC,kBAAkB;KAEpB,gBAAA,aAA6B;KAE7B,6EAA6E;QACjF;iBACS;iBACA;;KAGL,wCAAwC,oCAC5C,aAAa,WAAW,aAAa,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payment-kit-js/vanilla",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "module": "./dist/index.mjs",
@@ -26,15 +26,15 @@
26
26
  },
27
27
  "packageManager": "yarn@4.10.3",
28
28
  "dependencies": {
29
- "@stripe/stripe-js": "^5.5.0",
30
29
  "penpal": "^7.0.4",
31
30
  "valibot": "^1.1.0"
32
31
  },
33
32
  "devDependencies": {
34
- "@pkg/sdk": "0.10.16",
33
+ "@pkg/sdk": "0.10.21",
35
34
  "@pkg/tsconfig": "0.0.0",
35
+ "@stripe/stripe-js": "^5.5.0",
36
36
  "tsdown": "^0.15.10",
37
37
  "typescript": "^5.9.3"
38
38
  },
39
- "stableVersion": "0.1.2"
39
+ "stableVersion": "0.2.0"
40
40
  }
@@ -1,35 +0,0 @@
1
- //#region ../../packages/sdk/esm/models/cardsetupintent.d.ts
2
-
3
- type CardSetupIntent = {
4
- /**
5
- * Card setup intent identifier
6
- */
7
- id: string;
8
- /**
9
- * Whether all card details have been collected
10
- */
11
- isCardAllSet: boolean;
12
- /**
13
- * Whether card PAN is set
14
- */
15
- isCardPanSet: boolean;
16
- /**
17
- * Whether card expiry is set
18
- */
19
- isCardExpSet: boolean;
20
- /**
21
- * Whether card CVC is set
22
- */
23
- isCardCvcSet: boolean;
24
- /**
25
- * When the card setup intent was created
26
- */
27
- createdAt: Date;
28
- /**
29
- * When the card setup intent was last updated
30
- */
31
- updatedAt: Date;
32
- };
33
- //#endregion
34
- export { CardSetupIntent as t };
35
- //# sourceMappingURL=cardsetupintent-D2gBMj3e.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cardsetupintent-D2gBMj3e.d.mts","names":["z","Result","SafeParseResult","SDKValidationError","CardSetupIntent","Date","CardSetupIntent$inboundSchema","ZodTypeDef","ZodType","cardSetupIntentFromJSON"],"sources":["../../../packages/sdk/esm/models/cardsetupintent.d.ts"],"sourcesContent":["import * as z from \"zod/v3\";\nimport { Result as SafeParseResult } from \"../types/fp.js\";\nimport { SDKValidationError } from \"./errors/sdkvalidationerror.js\";\nexport type CardSetupIntent = {\n /**\n * Card setup intent identifier\n */\n id: string;\n /**\n * Whether all card details have been collected\n */\n isCardAllSet: boolean;\n /**\n * Whether card PAN is set\n */\n isCardPanSet: boolean;\n /**\n * Whether card expiry is set\n */\n isCardExpSet: boolean;\n /**\n * Whether card CVC is set\n */\n isCardCvcSet: boolean;\n /**\n * When the card setup intent was created\n */\n createdAt: Date;\n /**\n * When the card setup intent was last updated\n */\n updatedAt: Date;\n};\n/** @internal */\nexport declare const CardSetupIntent$inboundSchema: z.ZodType<CardSetupIntent, z.ZodTypeDef, unknown>;\nexport declare function cardSetupIntentFromJSON(jsonString: string): SafeParseResult<CardSetupIntent, SDKValidationError>;\n//# sourceMappingURL=cardsetupintent.d.ts.map"],"mappings":";;KAGYI,eAAAA;;;;;;;;;;;;;;;;;;;;;;;;aAwBGC;;;;aAIAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect-card-EaOlRbPS.d.mts","names":[],"sources":["../src/penpal/connect-card.ts"],"sourcesContent":[],"mappings":";;;;;KAIK,iBAAA;2CACsC,QAAQ;WAA2B;EADzE,CAAA,CAAA;EAC8C,UAAA,EAAA,GAAA,GAC/B,OAD+B,CACvB,aADuB,GAAA,SAAA,CAAA;CAA2B;KAIzE,iBAAA,GAJsC;EACf,QAAA,EAAA,GAAA,GAAA,IAAA;EAAR,aAAA,EAAA,CAAA,SAAA,EAAA,OAAA,EAAA,GAAA,IAAA;CAAO;AAGtB,KAKO,aAAA,GALU,UAAA,GAAA,UAAA,GAAA,UAAA;AAKV,KAEA,aAAA,GAFa,SAAA,GAAA,UAAA,GAAA,eAAA,GAAA,sBAAA,GAAA,wBAAA;AAEb,KAOA,gBAAA,GAAmB,UAPN,CAOiB,iBAPjB,CAAA;AAOb,KAEA,gBAAA,GAAmB,UAFW,CAEA,iBAFX,CAAA;AAEnB,KAEA,gBAAA,GAAmB,0BAFA;AAEnB,cAEC,mBAFkB,EAAA,CAAA,MAAA,EAEa,iBAFa,EAAA,OAAA,EAEe,iBAFf,EAAA,GAEgC,UAFhC,CAEgC,iBAFhC,CAAA;AAE5C,cAIA,mBAFZ,EAAA,CAAA,OAAA,EAE4C,iBAF5C,EAAA,GAE6D,UAF7D,CAE6D,iBAF7D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect-tunnel-x-Ce423Pa2.d.mts","names":["z","Result","SafeParseResult","SDKValidationError","CreateCardSetupIntentRes","CreateCardSetupIntentRes$inboundSchema","ZodTypeDef","ZodType","createCardSetupIntentResFromJSON","BackoffStrategy","RetryConfig","PermanentError","Error","TemporaryError","Response","retry","Promise","SDKHooks","HookContext","ConnectionError","InvalidRequestError","RequestAbortedError","RequestTimeoutError","UnexpectedClientError","Result","SDKOptions","RetryConfig","SecurityState","RequestOptions","URL","RequestInit","Omit","RequestConfig","HeadersInit","ClientSDK","Request","Response","Promise"],"sources":["../../../packages/sdk/esm/models/createcardsetupintentres.d.ts","../../../packages/sdk/esm/lib/retries.d.ts","../../../packages/sdk/esm/lib/sdks.d.ts","../src/penpal/connect-tunnel-x.ts"],"sourcesContent":["import * as z from \"zod/v3\";\nimport { Result as SafeParseResult } from \"../types/fp.js\";\nimport { SDKValidationError } from \"./errors/sdkvalidationerror.js\";\nexport type CreateCardSetupIntentRes = {\n /**\n * The ID of the card setup intent\n */\n cardSetupIntentId: string;\n};\n/** @internal */\nexport declare const CreateCardSetupIntentRes$inboundSchema: z.ZodType<CreateCardSetupIntentRes, z.ZodTypeDef, unknown>;\nexport declare function createCardSetupIntentResFromJSON(jsonString: string): SafeParseResult<CreateCardSetupIntentRes, SDKValidationError>;\n//# sourceMappingURL=createcardsetupintentres.d.ts.map","export type BackoffStrategy = {\n initialInterval: number;\n maxInterval: number;\n exponent: number;\n maxElapsedTime: number;\n};\nexport type RetryConfig = {\n strategy: \"none\";\n} | {\n strategy: \"backoff\";\n backoff?: BackoffStrategy;\n retryConnectionErrors?: boolean;\n};\n/**\n * PermanentError is an error that is not recoverable. Throwing this error will\n * cause a retry loop to terminate.\n */\nexport declare class PermanentError extends Error {\n /** The underlying cause of the error. */\n readonly cause: unknown;\n constructor(message: string, options?: {\n cause?: unknown;\n });\n}\n/**\n * TemporaryError is an error is used to signal that an HTTP request can be\n * retried as part of a retry loop. If retry attempts are exhausted and this\n * error is thrown, the response will be returned to the caller.\n */\nexport declare class TemporaryError extends Error {\n response: Response;\n constructor(message: string, response: Response);\n}\nexport declare function retry(fetchFn: () => Promise<Response>, options: {\n config: RetryConfig;\n statusCodes: string[];\n}): Promise<Response>;\n//# sourceMappingURL=retries.d.ts.map","import { SDKHooks } from \"../hooks/hooks.js\";\nimport { HookContext } from \"../hooks/types.js\";\nimport { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from \"../models/errors/httpclienterrors.js\";\nimport { Result } from \"../types/fp.js\";\nimport { SDKOptions } from \"./config.js\";\nimport { RetryConfig } from \"./retries.js\";\nimport { SecurityState } from \"./security.js\";\nexport type RequestOptions = {\n /**\n * Sets a timeout, in milliseconds, on HTTP requests made by an SDK method. If\n * `fetchOptions.signal` is set then it will take precedence over this option.\n */\n timeoutMs?: number;\n /**\n * Set or override a retry policy on HTTP calls.\n */\n retries?: RetryConfig;\n /**\n * Specifies the status codes which should be retried using the given retry policy.\n */\n retryCodes?: string[];\n /**\n * Overrides the base server URL that will be used by an operation.\n */\n serverURL?: string | URL;\n /**\n * @deprecated `fetchOptions` has been flattened into `RequestOptions`.\n *\n * Sets various request options on the `fetch` call made by an SDK method.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request}\n */\n fetchOptions?: Omit<RequestInit, \"method\" | \"body\">;\n} & Omit<RequestInit, \"method\" | \"body\">;\ntype RequestConfig = {\n method: string;\n path: string;\n baseURL?: string | URL | undefined;\n query?: string;\n body?: RequestInit[\"body\"];\n headers?: HeadersInit;\n security?: SecurityState | null;\n uaHeader?: string;\n userAgent?: string | undefined;\n timeoutMs?: number;\n};\nexport declare class ClientSDK {\n #private;\n readonly _baseURL: URL | null;\n readonly _options: SDKOptions & {\n hooks?: SDKHooks;\n };\n constructor(options: SDKOptions);\n _createRequest(context: HookContext, conf: RequestConfig, options?: RequestOptions): Result<Request, InvalidRequestError | UnexpectedClientError>;\n _do(request: Request, options: {\n context: HookContext;\n errorCodes: number | string | (number | string)[];\n retryConfig: RetryConfig;\n retryCodes: string[];\n }): Promise<Result<Response, RequestAbortedError | RequestTimeoutError | ConnectionError | UnexpectedClientError>>;\n}\nexport {};\n//# sourceMappingURL=sdks.d.ts.map"],"mappings":";;;;KAGYI,wBAAAA;EAAAA;;;;ACHZ,CAAA;;;KAAYK,eAAAA;;;;EDGAL,cAAAA,EAAAA,MAAAA;;KCGAM,WAAAA;;AANZ,CAAA,GAAYD;EAMAC,QAAAA,EAAAA,SAAW;YAITD;;;;;KCHFmB,cAAAA;EDPAnB;AAMZ;;;;ECCYmB;;;EAyBYE,OAAAA,CAAAA,EAhBVJ,WAgBUI;EAALC;;;EACX,UAAA,CAAA,EAAA,MAAA,EAAA;;;;ECzBH,SAAA,CAAA,EAAA,MAAA,GDgBoBF,GChBA;EAGE;;;;;;;EAI+D,YAAA,CAAA,EDiBvEE,ICjBuE,CDiBlED,WCjBkE,EAAA,QAAA,GAAA,MAAA,CAAA;CAAO,GDkB7FC,IClB6F,CDkBxFD,WClBwF,EAAA,QAAA,GAAA,MAAA,CAAA;;;KAP5F,oBAAA;EHLO1B,YAAAA,EAAAA,GAAAA,GAAAA,IAAAA;;2BGQe,2BAA2B;;EFX1CK,kBAAe,EAAA,CAAA,iBAAA,EAAA,MAAA,EAAA,GEa0B,OFb1B,CEakC,eFblC,CAAA;EAMfC,qBAAW,EAAA,CAAA,WAITD,EAAAA,MAAAA,EAAe,GEIqB,OFJrB,CEI6B,wBFJ7B,CAAA;uEEK0C,mBAAmB;;KAGrF,oBAAA,GAAuB;ADXhBmB,KCaA,uBAAA,GAA0B,UDbZ,CCauB,oBDbvB,CAAA;AASZF,KCMF,uBAAA,GAA0B,UDNxBA,CCMmC,oBDNnCA,CAAAA;AAQWG,cCAZ,sBDAYA,EAAAA,CAAAA,MAAAA,ECAsB,iBDAtBA,EAAAA,OAAAA,ECAkD,oBDAlDA,EAAAA,GCAsE,UDAtEA,CCAsE,oBDAtEA,CAAAA;AAQDC,cCJX,sBDIWA,EAAAA,CAAAA,OAAAA,ECJwB,oBDIxBA,EAAAA,GCJ4C,UDI5CA,CCJ4C,oBDI5CA,CAAAA;;;;;KCInB,oBAAA;oDAC+C,mBAAmB;;AA7BlE,cAgCQ,cAAA,CAhCY;EAGE,QAAA,UAAA;EAA2B,QAAA,EA+BnC,oBA/BmC;EAEO,OAAA,0BAAA,EAAA,CAAA,UAAA,EA+BJ,uBA/BI,EAAA,GA+BmB,OA/BnB,CA+BmB,cA/BnB,CAAA;EAAR,QAAA,WAAA,CAAA;EACK;;;;EACuC,IAAA,eAAA,CAAA,CAAA,EA4CxE,oBA5CwE;EAG5F,OAAA,CAAA,CAAA,EAAA,IAAA;AAEL"}
@@ -1,40 +0,0 @@
1
- //#region ../../packages/sdk/esm/models/stripe3dsaction.d.ts
2
-
3
- /**
4
- * Stripe 3DS authentication via Stripe.js SDK.
5
- *
6
- * @remarks
7
- *
8
- * Frontend should use stripe.confirmCardPayment(client_secret) to display
9
- * the 3DS authentication modal.
10
- */
11
- type Stripe3dsAction = {
12
- type: "stripe_3ds";
13
- /**
14
- * PaymentIntent client secret
15
- */
16
- clientSecret: string;
17
- /**
18
- * Stripe publishable key
19
- */
20
- stripePk: string;
21
- };
22
- //#endregion
23
- //#region ../../packages/sdk/esm/models/publiccardcheckoutresponse.d.ts
24
- /**
25
- * Public response model for card checkout - uses external IDs only.
26
- */
27
- type PublicCardCheckoutResponse = {
28
- id: string;
29
- checkoutAttemptId: string;
30
- checkoutSessionId: string;
31
- paymentIntentId: string;
32
- subscriptionId?: string | null | undefined;
33
- invoiceId?: string | null | undefined;
34
- state: string;
35
- errorMessage?: string | null | undefined;
36
- nextAction?: Stripe3dsAction | null | undefined;
37
- };
38
- //#endregion
39
- export { PublicCardCheckoutResponse as t };
40
- //# sourceMappingURL=publiccardcheckoutresponse-wxFCeVdO.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publiccardcheckoutresponse-wxFCeVdO.d.mts","names":["z","Result","SafeParseResult","SDKValidationError","Stripe3dsAction","Stripe3dsAction$inboundSchema","ZodTypeDef","ZodType","stripe3dsActionFromJSON","z","Result","SafeParseResult","SDKValidationError","Stripe3dsAction","NextAction","PublicCardCheckoutResponse","NextAction$inboundSchema","ZodTypeDef","ZodType","nextActionFromJSON","PublicCardCheckoutResponse$inboundSchema","publicCardCheckoutResponseFromJSON"],"sources":["../../../packages/sdk/esm/models/stripe3dsaction.d.ts","../../../packages/sdk/esm/models/publiccardcheckoutresponse.d.ts"],"sourcesContent":["import * as z from \"zod/v3\";\nimport { Result as SafeParseResult } from \"../types/fp.js\";\nimport { SDKValidationError } from \"./errors/sdkvalidationerror.js\";\n/**\n * Stripe 3DS authentication via Stripe.js SDK.\n *\n * @remarks\n *\n * Frontend should use stripe.confirmCardPayment(client_secret) to display\n * the 3DS authentication modal.\n */\nexport type Stripe3dsAction = {\n type: \"stripe_3ds\";\n /**\n * PaymentIntent client secret\n */\n clientSecret: string;\n /**\n * Stripe publishable key\n */\n stripePk: string;\n};\n/** @internal */\nexport declare const Stripe3dsAction$inboundSchema: z.ZodType<Stripe3dsAction, z.ZodTypeDef, unknown>;\nexport declare function stripe3dsActionFromJSON(jsonString: string): SafeParseResult<Stripe3dsAction, SDKValidationError>;\n//# sourceMappingURL=stripe3dsaction.d.ts.map","import * as z from \"zod/v3\";\nimport { Result as SafeParseResult } from \"../types/fp.js\";\nimport { SDKValidationError } from \"./errors/sdkvalidationerror.js\";\nimport { Stripe3dsAction } from \"./stripe3dsaction.js\";\nexport type NextAction = Stripe3dsAction;\n/**\n * Public response model for card checkout - uses external IDs only.\n */\nexport type PublicCardCheckoutResponse = {\n id: string;\n checkoutAttemptId: string;\n checkoutSessionId: string;\n paymentIntentId: string;\n subscriptionId?: string | null | undefined;\n invoiceId?: string | null | undefined;\n state: string;\n errorMessage?: string | null | undefined;\n nextAction?: Stripe3dsAction | null | undefined;\n};\n/** @internal */\nexport declare const NextAction$inboundSchema: z.ZodType<NextAction, z.ZodTypeDef, unknown>;\nexport declare function nextActionFromJSON(jsonString: string): SafeParseResult<NextAction, SDKValidationError>;\n/** @internal */\nexport declare const PublicCardCheckoutResponse$inboundSchema: z.ZodType<PublicCardCheckoutResponse, z.ZodTypeDef, unknown>;\nexport declare function publicCardCheckoutResponseFromJSON(jsonString: string): SafeParseResult<PublicCardCheckoutResponse, SDKValidationError>;\n//# sourceMappingURL=publiccardcheckoutresponse.d.ts.map"],"mappings":";;;;ACQA;;;;;;KDGYI,eAAAA;;;;;;;;;;;;;ACHZ;;;KAAYW,0BAAAA;;;;;;;;;eASKF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-6mOKdjCh.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;KAGK,cAAA;KAEO,cAAA;AAFP,KAIO,cAAA,GAJO;EAEP,aAAA,EAAA,CAAA,MAAc,EAId,gBAJc,EAAA,OAAA,CAAA,EAAA,OAAA,EAAA,GAMnB,OANmB,CAAA;IAEd,IAAA,EAAA;MAEA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;IAEkF,CAAA;IAAvF,MAAA,CAAA,EAAA,KAAA;EAAO,CAAA,GAAA;IAIF,IAAA,CAAA,EAAA,KAAU;IAAuB,MAAA,EAJiD,gBAIjD;EAK3B,CAAA,CAAA;EACS,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;CAArB;AAC4B,KAPtB,UAAA,GAOsB,CAAA,UAAA,SAPW,aAOX,CAAA,OAAA,CAAA,EAAA,CAAA,CAAA,OAAA,EAAA;EAAxB,OAAA,EAAA,MAAA;EAAuB,UAAA,EAAA,MAAA;EAI5B,WAAA,EAAA,MAAA;EAA2C,cAAA,EAN9B,CAM8B;CACT,EAAA,GANjC,oBAMiC,CANZ,CAMY,CAAA,GAAA;EAArB,MAAA,EALR,uBAKQ,CALgB,CAKhB,CAAA;EAER,OAAA,EAAA,GAAA,GAAA,IAAA;CACO;KAJZ,uBAMc,CAAA,UAAA,SAN6B,aAM7B,CAAA,OAAA,CAAA,EAAA,CAAA,GAAA,CAAA,UAAA,MALD,oBAKC,CALoB,CAKpB,CAAA,CAAA,CAAA,OAAA,EAAA;EAAgB,MAAA,EAHzB,gBAGyB;EAIvB,aAAA,EANK,CAML;EAOA,OAAA,CAAA,EAAA,OAAA;EAEC,OAAA,EAAA,CAAA,KAAA,EAbM,gBAaN,EAAA,GAAA,IAAA;EACA,SAAA,EAAA,CAAA,IAAA,EAAA;IACA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAOC,CAAA,EAAA,GAAA,IAAA;CAAkB,EAAA,GAAA,IAAA;AAAc,KAlBlC,gBAAA,GAkBkC;EAElC,OAAA,EAAA,MAAA;EAEA,UAAA,EAAA,MAAa;EAAgE,WAAA,EAAA,MAAA;EACjF,iBAAA,EAnBa,uBAmBb;CACS;AACA,KAlBL,gBAAA,GAkBK;EAAc,IAAA,CAAA,EAAA,MAAA;EAGnB,QAAA,CAAA,EAnBC,aAmBmB;EAAoB,QAAA,CAAA,EAlBvC,aAkBuC;EAC5C,QAAA,CAAA,EAlBK,aAkBL;EAAwB,MAAA,CAAA,EAAA,MAAA;EAAX,UAAA,CAAA,EAAA,MAAA;EAAmC,YAAA,CAAA,EAAA,MAAA;EAAX,MAAA,CAAA,EAAA,MAAA;EAAU,QAAA,CAAA,EAAA,MAAA;;cAXzC,kBAAkB;KAEpB,gBAAA,aAA6B;KAE7B,6EAA6E;QACjF;iBACS;iBACA;;KAGL,wCAAwC,oCAC5C,aAAa,WAAW,aAAa,WAAW"}