@getopenpay/openpay-js 0.5.16 → 0.5.18

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,8 +1,8 @@
1
- import { d as z } from "./diag-api-BaoBTidT.js";
2
- import { b as G, c as I, d as W, e as X, p as _, i as V, f as K, g as Q, j as C, m as $, k as J, _ as T } from "./url-CgnFZYDI.js";
3
- import { s as Y, i as Z, I as q } from "./utils-Dius2V8g.js";
4
- import { P as O, b as P, p as N, s as ee, g as te } from "./utils-BJ1UAbM8.js";
5
- import { t as x, a as p, S as re } from "./index-Dcezwdcs.js";
1
+ import { d as z } from "./diag-api-4fDcCqe-.js";
2
+ import { b as G, c as I, d as W, e as X, p as _, i as V, f as K, g as Q, j as C, m as $, k as J, _ as T } from "./url-Gcn3Oliy.js";
3
+ import { s as Y, i as Z, I as q } from "./utils-BKZjWoEw.js";
4
+ import { P as O, b as P, p as N, s as ee, g as te } from "./utils-BByPJY1j.js";
5
+ import { t as x, a as p, S as re } from "./index-CwJSDd4w.js";
6
6
  var y;
7
7
  (function(a) {
8
8
  a.COMPONENT = "component", a.HTTP_ERROR_NAME = "http.error_name", a.HTTP_STATUS_TEXT = "http.status_text";
@@ -1,8 +1,8 @@
1
- import { z as Ar, p as g, _ as X, s as Pr, l as Sr, j as Ir, q as vr, y as yr, dK as hr, h as gr, dL as mr, n as Cr, r as Nr, i as Mr, m as Ur, o as Br, t as br, u as Dr } from "./url-CgnFZYDI.js";
2
- import { i as G, s as Q, u as Xr } from "./suppress-tracing-Cu47NVB2.js";
3
- import { d as c } from "./diag-api-BaoBTidT.js";
1
+ import { z as Ar, p as g, _ as X, s as Pr, l as Sr, j as Ir, q as vr, y as yr, dK as hr, h as gr, dL as mr, n as Cr, r as Nr, i as Mr, m as Ur, o as Br, t as br, u as Dr } from "./url-Gcn3Oliy.js";
2
+ import { i as G, s as Q, u as Xr } from "./suppress-tracing-ACkm1ZSM.js";
3
+ import { d as c } from "./diag-api-4fDcCqe-.js";
4
4
  import { h as q, E as Gr } from "./ExportResult-BacsqwKA.js";
5
- import { f as u, t as N, i as k, T as M, c as wr, b as Vr, a as K } from "./index-Dcezwdcs.js";
5
+ import { f as u, t as N, i as k, T as M, c as wr, b as Vr, a as K } from "./index-CwJSDd4w.js";
6
6
  import { a as jr, bm as Hr } from "./sdk-info-ChuKu8zW.js";
7
7
  var l;
8
8
  (function(r) {
@@ -1,7 +1,7 @@
1
- import { R as u } from "./index-Dcezwdcs.js";
2
- import { B as c } from "./SimpleSpanProcessor-BtNzab2_.js";
3
- import { A as g, b as x, a as S, C as b, F as w, N as C, P, R as T, d as O, S as A, e as M, c as R, T as N } from "./SimpleSpanProcessor-BtNzab2_.js";
4
- import { P as E, a as F, b as j, g as k, h as W, p as I, s as D, c as G } from "./utils-BJ1UAbM8.js";
1
+ import { R as u } from "./index-CwJSDd4w.js";
2
+ import { B as c } from "./SimpleSpanProcessor-B_aR4wyQ.js";
3
+ import { A as g, b as x, a as S, C as b, F as w, N as C, P, R as T, d as O, S as A, e as M, c as R, T as N } from "./SimpleSpanProcessor-B_aR4wyQ.js";
4
+ import { P as E, a as F, b as j, g as k, h as W, p as I, s as D, c as G } from "./utils-BByPJY1j.js";
5
5
  var l = function(n, r) {
6
6
  var e = typeof Symbol == "function" && n[Symbol.iterator];
7
7
  if (!e) return n;
@@ -1,4 +1,4 @@
1
- import { d as diag } from "./diag-api-BaoBTidT.js";
1
+ import { d as diag } from "./diag-api-4fDcCqe-.js";
2
2
  import { E as ExportResultCode, h as hexToBinary } from "./ExportResult-BacsqwKA.js";
3
3
  import { c as commonjsGlobal } from "./_commonjsHelpers-CdLE1o9f.js";
4
4
  var OTLPExporterBase = (
@@ -1,4 +1,4 @@
1
- import { R as qe } from "./index-Dcezwdcs.js";
1
+ import { R as qe } from "./index-CwJSDd4w.js";
2
2
  function xt(j) {
3
3
  return j === void 0 && (j = {}), typeof j.addEventListener == "function" && typeof j.removeEventListener == "function";
4
4
  }
@@ -1,5 +1,5 @@
1
- import { c as M, t as p, i as P, T as o, b as D, d as b } from "./index-Dcezwdcs.js";
2
- import { i as A } from "./suppress-tracing-Cu47NVB2.js";
1
+ import { c as M, t as p, i as P, T as o, b as D, d as b } from "./index-CwJSDd4w.js";
2
+ import { i as A } from "./suppress-tracing-ACkm1ZSM.js";
3
3
  var l = M("OpenTelemetry Context Key B3 Debug Flag"), f = "b3", v = "x-b3-traceid", g = "x-b3-spanid", c = "x-b3-sampled", B = "x-b3-parentspanid", S = "x-b3-flags", F = /* @__PURE__ */ new Set([!0, "true", "True", "1", 1]), N = /* @__PURE__ */ new Set([!1, "false", "False", "0", 0]);
4
4
  function V(r) {
5
5
  return r === o.SAMPLED || r === o.NONE;
package/dist/index.d.ts CHANGED
@@ -258,6 +258,46 @@ declare type CustomInitParams = {
258
258
  * This is working with current version of Stripe element (v3). This is not guaranteed to work with future versions of Stripe element.
259
259
  */
260
260
  onAuthenticationStatusChange?: (isAuthenticated: boolean) => void;
261
+ /**
262
+ * This will be called once the `linkAuthenticationElement` is ready.
263
+ * This is just a wrapper for `linkAuthenticationElement.once('ready')`.
264
+ */
265
+ onAuthenticationElementReady?: () => void;
266
+ };
267
+
268
+ // For stripe klarna
269
+ stripeKlarna?: {
270
+ /**
271
+ * Additional payment data to be passed to stripe.confirmKlarnaPayment
272
+ * This will be merged with the billing details from the form
273
+ */
274
+ paymentData?: {
275
+ payment_method?: {
276
+ billing_details?: {
277
+ email?: string;
278
+ name?: string;
279
+ phone?: string;
280
+ address?: {
281
+ line1?: string;
282
+ line2?: string;
283
+ city?: string;
284
+ state?: string;
285
+ country?: string;
286
+ postal_code?: string;
287
+ };
288
+ };
289
+ };
290
+ return_url?: string;
291
+ setup_future_usage?: 'off_session' | 'on_session';
292
+ save_payment_method?: boolean;
293
+ };
294
+
295
+ /**
296
+ * Options to be passed to stripe.confirmKlarnaPayment
297
+ */
298
+ options?: {
299
+ handleActions?: boolean;
300
+ };
261
301
  };
262
302
 
263
303
  googlePay?: {
@@ -504,6 +544,11 @@ declare type InitOjsFlowResult = {
504
544
  isAvailable: boolean;
505
545
  };
506
546
 
547
+ declare type InitStripeKlarnaFlowResult = {
548
+ isAvailable: boolean;
549
+ startFlow: (customParams?: KlarnaFlowCustomParams) => Promise<void>;
550
+ };
551
+
507
552
  declare type InitStripeLinkFlowResult =
508
553
  | {
509
554
  isAvailable: true;
@@ -533,6 +578,20 @@ declare type InitStripePrFlowSuccess = {
533
578
  startFlow: (provider: PaymentRequestProvider, params?: PaymentRequestStartParams) => Promise<void>;
534
579
  };
535
580
 
581
+ declare type KlarnaFlowCustomParams = {
582
+ /**
583
+ * In case of multiple processors available for Klarna, the processor setting will
584
+ * determine which processor to use.
585
+ * If `processor` is not set or is not available, the first available processor will be used
586
+ *
587
+ * **Note**: this processor choice is for the whole process of showing payment UI, verification and charging.
588
+ * It won't perform fallback processor charging when payment failed.
589
+ */
590
+ processor?: PaymentProcessor;
591
+ isAnonymous?: boolean;
592
+ useRedirectFlow?: boolean;
593
+ };
594
+
536
595
  declare const LoadedEventPayload = z.object({
537
596
  type: z.literal(EventType.enum.LOADED),
538
597
  sessionId: RequiredString,
@@ -773,6 +832,10 @@ declare const OjsFlows = {
773
832
  init: initStripeLinkFlow,
774
833
  run: runStripeLinkFlow,
775
834
  },
835
+ stripeKlarna: {
836
+ init: initStripeKlarnaFlow,
837
+ run: runStripeKlarnaFlow,
838
+ },
776
839
 
777
840
  // Pockyt
778
841
  pockytPaypal: {
@@ -786,6 +849,12 @@ declare const OjsFlows = {
786
849
  run: runPaypalFlow,
787
850
  },
788
851
 
852
+ // Klarna
853
+ airwallexKlarna: {
854
+ init: initAirwallexKlarnaFlow,
855
+ run: runAirwallexKlarnaFlow,
856
+ },
857
+
789
858
  // Airwallex
790
859
  airwallexGooglePay: {
791
860
  init: initAirwallexGooglePayFlow,
@@ -893,6 +962,10 @@ export declare class OpenPayForm {
893
962
  publisher: LoadedOncePublisher<InitStripeLinkFlowResult>;
894
963
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
895
964
  };
965
+ readonly stripeKlarna: {
966
+ publisher: LoadedOncePublisher<InitStripeKlarnaFlowResult>;
967
+ initialize: (initParams: InitOjsFlowParams) => Promise<void>;
968
+ };
896
969
  readonly airwallexGooglePay: {
897
970
  publisher: LoadedOncePublisher<InitGooglePayFlowResult>;
898
971
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
@@ -913,6 +986,14 @@ export declare class OpenPayForm {
913
986
  }>;
914
987
  initialize: (initParams: InitOjsFlowParams) => Promise<void>;
915
988
  };
989
+ readonly airwallexKlarna: {
990
+ publisher: LoadedOncePublisher<{
991
+ isLoading: boolean;
992
+ isAvailable: boolean;
993
+ startFlow: (customParams?: KlarnaFlowCustomParams) => Promise<void>;
994
+ }>;
995
+ initialize: (initParams: InitOjsFlowParams) => Promise<void>;
996
+ };
916
997
  readonly pockytPaypal: {
917
998
  publisher: LoadedOncePublisher<{
918
999
  isLoading: boolean;
@@ -1143,6 +1224,7 @@ declare type ProcessorSpecificSubmitSettings<T extends SubmitMethod = SubmitMeth
1143
1224
  [SubmitMethods.googlePay]: GooglePayFlowCustomParams;
1144
1225
  [SubmitMethods.loopCrypto]: LoopCryptoFlowCustomParams;
1145
1226
  [SubmitMethods.paypal]: PaypalFlowCustomParams;
1227
+ [SubmitMethods.klarna]: KlarnaFlowCustomParams;
1146
1228
  [SubmitMethods.stripeLink]: unknown;
1147
1229
  // TODO: The following methods are deprecated and will be removed in the future.
1148
1230
  // Use googlePay/applePay instead
@@ -1189,6 +1271,7 @@ export declare enum SubmitMethods {
1189
1271
  googlePay = 'google-pay',
1190
1272
  loopCrypto = 'loop-crypto',
1191
1273
  paypal = 'paypal',
1274
+ klarna = 'klarna',
1192
1275
  /**
1193
1276
  * This submit method only for Available payment methods.
1194
1277
  * 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-Dcezwdcs.js";
1
+ import { E as p, F as r, O as i, l as s } from "./index-CwJSDd4w.js";
2
2
  import "penpal";
3
3
  import "uuid";
4
4
  import "zod";