@getopenpay/openpay-js 0.5.17 → 0.5.19

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.
@@ -1,4 +1,4 @@
1
- import { R as qe } from "./index-DC5j54sB.js";
1
+ import { R as qe } from "./index-Dk9vjfYt.js";
2
2
  function xt(j) {
3
3
  return j === void 0 && (j = {}), typeof j.addEventListener == "function" && typeof j.removeEventListener == "function";
4
4
  }
package/dist/index.d.ts CHANGED
@@ -6,6 +6,16 @@ import { StripeLinkAuthenticationElement } from '@stripe/stripe-js';
6
6
  import { Subject } from 'rxjs';
7
7
  import { z } from 'zod';
8
8
 
9
+ declare type AffirmFlowCustomParams = {
10
+ processor?: PaymentProcessor;
11
+ useRedirectFlow?: boolean;
12
+ };
13
+
14
+ declare type AfterpayFlowCustomParams = {
15
+ processor?: PaymentProcessor;
16
+ useRedirectFlow?: boolean;
17
+ };
18
+
9
19
  declare type AirwallexACHFlowParams = {
10
20
  verificationMethod?: 'plaid' | 'micro_deposit';
11
21
  defaultFieldValues?: DefaultFieldValues;
@@ -265,6 +275,41 @@ declare type CustomInitParams = {
265
275
  onAuthenticationElementReady?: () => void;
266
276
  };
267
277
 
278
+ // For stripe klarna
279
+ stripeKlarna?: {
280
+ /**
281
+ * Additional payment data to be passed to stripe.confirmKlarnaPayment
282
+ * This will be merged with the billing details from the form
283
+ */
284
+ paymentData?: {
285
+ payment_method?: {
286
+ billing_details?: {
287
+ email?: string;
288
+ name?: string;
289
+ phone?: string;
290
+ address?: {
291
+ line1?: string;
292
+ line2?: string;
293
+ city?: string;
294
+ state?: string;
295
+ country?: string;
296
+ postal_code?: string;
297
+ };
298
+ };
299
+ };
300
+ return_url?: string;
301
+ setup_future_usage?: 'off_session' | 'on_session';
302
+ save_payment_method?: boolean;
303
+ };
304
+
305
+ /**
306
+ * Options to be passed to stripe.confirmKlarnaPayment
307
+ */
308
+ options?: {
309
+ handleActions?: boolean;
310
+ };
311
+ };
312
+
268
313
  googlePay?: {
269
314
  env: 'demo' | 'prod';
270
315
  doNotMountOnInit?: boolean;
@@ -509,6 +554,21 @@ declare type InitOjsFlowResult = {
509
554
  isAvailable: boolean;
510
555
  };
511
556
 
557
+ declare type InitStripeAffirmFlowResult = {
558
+ isAvailable: boolean;
559
+ startFlow: (customParams?: AffirmFlowCustomParams) => Promise<void>;
560
+ };
561
+
562
+ declare type InitStripeAfterpayFlowResult = {
563
+ isAvailable: boolean;
564
+ startFlow: (customParams?: AfterpayFlowCustomParams) => Promise<void>;
565
+ };
566
+
567
+ declare type InitStripeKlarnaFlowResult = {
568
+ isAvailable: boolean;
569
+ startFlow: (customParams?: KlarnaFlowCustomParams) => Promise<void>;
570
+ };
571
+
512
572
  declare type InitStripeLinkFlowResult =
513
573
  | {
514
574
  isAvailable: true;
@@ -538,6 +598,20 @@ declare type InitStripePrFlowSuccess = {
538
598
  startFlow: (provider: PaymentRequestProvider, params?: PaymentRequestStartParams) => Promise<void>;
539
599
  };
540
600
 
601
+ declare type KlarnaFlowCustomParams = {
602
+ /**
603
+ * In case of multiple processors available for Klarna, the processor setting will
604
+ * determine which processor to use.
605
+ * If `processor` is not set or is not available, the first available processor will be used
606
+ *
607
+ * **Note**: this processor choice is for the whole process of showing payment UI, verification and charging.
608
+ * It won't perform fallback processor charging when payment failed.
609
+ */
610
+ processor?: PaymentProcessor;
611
+ isAnonymous?: boolean;
612
+ useRedirectFlow?: boolean;
613
+ };
614
+
541
615
  declare const LoadedEventPayload = z.object({
542
616
  type: z.literal(EventType.enum.LOADED),
543
617
  sessionId: RequiredString,
@@ -778,6 +852,18 @@ declare const OjsFlows = {
778
852
  init: initStripeLinkFlow,
779
853
  run: runStripeLinkFlow,
780
854
  },
855
+ stripeKlarna: {
856
+ init: initStripeKlarnaFlow,
857
+ run: runStripeKlarnaFlow,
858
+ },
859
+ stripeAffirm: {
860
+ init: initStripeAffirmFlow,
861
+ run: runStripeAffirmFlow,
862
+ },
863
+ stripeAfterpay: {
864
+ init: initStripeAfterpayFlow,
865
+ run: runStripeAfterpayFlow,
866
+ },
781
867
 
782
868
  // Pockyt
783
869
  pockytPaypal: {
@@ -791,6 +877,12 @@ declare const OjsFlows = {
791
877
  run: runPaypalFlow,
792
878
  },
793
879
 
880
+ // Klarna
881
+ airwallexKlarna: {
882
+ init: initAirwallexKlarnaFlow,
883
+ run: runAirwallexKlarnaFlow,
884
+ },
885
+
794
886
  // Airwallex
795
887
  airwallexGooglePay: {
796
888
  init: initAirwallexGooglePayFlow,
@@ -898,6 +990,18 @@ export declare class OpenPayForm {
898
990
  publisher: LoadedOncePublisher<InitStripeLinkFlowResult>;
899
991
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
900
992
  };
993
+ readonly stripeKlarna: {
994
+ publisher: LoadedOncePublisher<InitStripeKlarnaFlowResult>;
995
+ initialize: (initParams: InitOjsFlowParams) => Promise<void>;
996
+ };
997
+ readonly stripeAffirm: {
998
+ publisher: LoadedOncePublisher<InitStripeAffirmFlowResult>;
999
+ initialize: (initParams: InitOjsFlowParams) => Promise<void>;
1000
+ };
1001
+ readonly stripeAfterpay: {
1002
+ publisher: LoadedOncePublisher<InitStripeAfterpayFlowResult>;
1003
+ initialize: (initParams: InitOjsFlowParams) => Promise<void>;
1004
+ };
901
1005
  readonly airwallexGooglePay: {
902
1006
  publisher: LoadedOncePublisher<InitGooglePayFlowResult>;
903
1007
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
@@ -918,6 +1022,14 @@ export declare class OpenPayForm {
918
1022
  }>;
919
1023
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
920
1024
  };
1025
+ readonly airwallexKlarna: {
1026
+ publisher: LoadedOncePublisher<{
1027
+ isLoading: boolean;
1028
+ isAvailable: boolean;
1029
+ startFlow: (customParams?: KlarnaFlowCustomParams) => Promise<void>;
1030
+ }>;
1031
+ initialize: (initParams: InitOjsFlowParams) => Promise<void>;
1032
+ };
921
1033
  readonly pockytPaypal: {
922
1034
  publisher: LoadedOncePublisher<{
923
1035
  isLoading: boolean;
@@ -1148,6 +1260,9 @@ declare type ProcessorSpecificSubmitSettings<T extends SubmitMethod = SubmitMeth
1148
1260
  [SubmitMethods.googlePay]: GooglePayFlowCustomParams;
1149
1261
  [SubmitMethods.loopCrypto]: LoopCryptoFlowCustomParams;
1150
1262
  [SubmitMethods.paypal]: PaypalFlowCustomParams;
1263
+ [SubmitMethods.klarna]: KlarnaFlowCustomParams;
1264
+ [SubmitMethods.affirm]: AffirmFlowCustomParams;
1265
+ [SubmitMethods.afterpay]: AfterpayFlowCustomParams;
1151
1266
  [SubmitMethods.stripeLink]: unknown;
1152
1267
  // TODO: The following methods are deprecated and will be removed in the future.
1153
1268
  // Use googlePay/applePay instead
@@ -1194,6 +1309,9 @@ export declare enum SubmitMethods {
1194
1309
  googlePay = 'google-pay',
1195
1310
  loopCrypto = 'loop-crypto',
1196
1311
  paypal = 'paypal',
1312
+ klarna = 'klarna',
1313
+ affirm = 'affirm',
1314
+ afterpay = 'afterpay',
1197
1315
  /**
1198
1316
  * This submit method only for Available payment methods.
1199
1317
  * Manual submission for StripeLink is not available
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { E as p, F as r, O as i, l as s } from "./index-DC5j54sB.js";
1
+ import { E as p, F as r, O as i, l as s } from "./index-Dk9vjfYt.js";
2
2
  import "penpal";
3
3
  import "uuid";
4
4
  import "zod";