@montonio/montonio-js 1.1.7 → 1.1.8-prelive.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.
@@ -90,7 +90,7 @@ class ie {
90
90
  try {
91
91
  const i = {
92
92
  Accept: "application/json",
93
- "X-Montonio-Js-Version": "1.1.7"
93
+ "X-Montonio-Js-Version": "1.1.8-prelive.0"
94
94
  };
95
95
  r && (i["Content-Type"] = "application/json");
96
96
  const c = {
@@ -3362,13 +3362,13 @@ class Mt {
3362
3362
  this.context = t, this.logPrefix = "MONTONIO-JS";
3363
3363
  }
3364
3364
  info(t, n) {
3365
- console.log(`${this.logPrefix}, ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.info(t, { context: this.context, ...n });
3365
+ console.log(`${this.logPrefix} - ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.info(t, { context: this.context, ...n });
3366
3366
  }
3367
3367
  warn(t, n) {
3368
- console.warn(`${this.logPrefix}, ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.warn(t, { context: this.context, ...n });
3368
+ console.warn(`${this.logPrefix} - ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.warn(t, { context: this.context, ...n });
3369
3369
  }
3370
- error(t, n) {
3371
- console.error(`${this.logPrefix}, ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.error(t, { context: this.context, ...n });
3370
+ error(t, n, r) {
3371
+ console.error(`${this.logPrefix} - ${this.context}: ${t}`, n), Z.logger.error(t, { context: this.context, ...r }, n instanceof Error ? n : void 0);
3372
3372
  }
3373
3373
  }
3374
3374
  class ue {
@@ -3389,7 +3389,7 @@ class ue {
3389
3389
  try {
3390
3390
  Z.setGlobalContextProperty("sessionUuid", n), this.logger.info(`Updated sessionUuid to [${n}]`, { sessionUuid: n });
3391
3391
  } catch (r) {
3392
- this.logger.error(`Error updating sessionUuid to [${n}]`, { error: r });
3392
+ this.logger.error(`Error updating sessionUuid to [${n}]`, r);
3393
3393
  }
3394
3394
  return;
3395
3395
  }
@@ -3400,7 +3400,7 @@ class ue {
3400
3400
  site: "datadoghq.eu",
3401
3401
  env: t === Oe.PRODUCTION ? "live-production" : "live-sandbox",
3402
3402
  service: "montonio-js",
3403
- version: "1.1.7",
3403
+ version: "1.1.8-prelive.0",
3404
3404
  silentMultipleInit: !0,
3405
3405
  forwardErrorsToLogs: !1,
3406
3406
  forwardConsoleLogs: []
@@ -3499,17 +3499,17 @@ class ir {
3499
3499
  try {
3500
3500
  return i.getContentWindow() === t.source;
3501
3501
  } catch (c) {
3502
- return this.logger.error("Failed to resolve contentWindow for source", { error: c }), !1;
3502
+ return this.logger.error("Failed to resolve contentWindow object for Iframe", c, { event: t }), !1;
3503
3503
  }
3504
3504
  })))
3505
3505
  try {
3506
3506
  r.handler(n);
3507
3507
  } catch (i) {
3508
- this.logger.error("Error in message handler", { error: i });
3508
+ this.logger.error("Error in message handler", i);
3509
3509
  }
3510
3510
  });
3511
3511
  } catch (n) {
3512
- this.logger.error("Error processing iframe message", { error: n });
3512
+ this.logger.error("Error processing iframe message", n);
3513
3513
  }
3514
3514
  });
3515
3515
  }
@@ -3679,7 +3679,7 @@ class Lc extends ar {
3679
3679
  }
3680
3680
  class kc extends ar {
3681
3681
  constructor(t) {
3682
- super(), this.isValid = !1, this.logger = new Mt("MontonioCheckout"), this.paymentAuth = null, this.options = t, this.environment = t.environment || Oe.PRODUCTION, ue.instance.initialize(this.environment, this.options.sessionUuid), this.logger.info("Checkout created", t), Ic(t);
3682
+ super(), this.isValid = !1, this.logger = new Mt("MontonioCheckout"), this.paymentAuth = null, this.options = t, this.environment = t.environment || Oe.PRODUCTION, ue.instance.initialize(this.environment, this.options.sessionUuid), this.logger.info("New checkout instance created", { options: t }), Ic(t);
3683
3683
  }
3684
3684
  /**
3685
3685
  * Mount the checkout to the DOM
@@ -3694,7 +3694,7 @@ class kc extends ar {
3694
3694
  mountElement: this.mountElement
3695
3695
  }), this.iframe.mount(), await this.messagingService.waitForMessage(_.CHECKOUT_PAYMENT_COMPONENT_READY, this.iframe), this.setUpListeners(), this.loaded = !0, this.logger.info(`Successfully mounted checkout to [${t}]`), !0;
3696
3696
  } catch (n) {
3697
- throw this.logger.error(`Error mounting checkout to [${t}]`, { error: n }), this.cleanup(), n;
3697
+ throw this.logger.error(`Error mounting checkout to [${t}]`, n), this.cleanup(), n;
3698
3698
  }
3699
3699
  }
3700
3700
  /**
@@ -3702,7 +3702,7 @@ class kc extends ar {
3702
3702
  * @param options - Updatable options
3703
3703
  */
3704
3704
  updateOptions(t) {
3705
- if (this.logger.info("Updating checkout options", t), !this.loaded)
3705
+ if (this.logger.info("Updating checkout options", { options: t }), !this.loaded)
3706
3706
  throw new $t();
3707
3707
  xc(t), t.locale !== void 0 && (this.options.locale = t.locale, this.messagingService.postMessage(this.iframe, {
3708
3708
  name: _.CHECKOUT_CHANGE_LOCALE,
@@ -3768,7 +3768,7 @@ class kc extends ar {
3768
3768
  */
3769
3769
  setUpPaymentCompletedListener() {
3770
3770
  this.messagingService.subscribe(_.CHECKOUT_PAYMENT_COMPLETED, async (t) => {
3771
- this.logger.info("Checkout payment completed", t), this.cleanupPaymentAuth();
3771
+ this.logger.info("Checkout payment completed", { event: t }), this.cleanupPaymentAuth();
3772
3772
  try {
3773
3773
  const n = await this.getPaymentResult(t.payload.paymentIntentUuid);
3774
3774
  this.handlePaymentSuccess(n);
@@ -3793,7 +3793,7 @@ class kc extends ar {
3793
3793
  */
3794
3794
  setUpValidationListener() {
3795
3795
  this.messagingService.subscribe(_.CHECKOUT_VALIDATE_FIELDS_RESULT, (t) => {
3796
- this.logger.info("Checkout validate fields result", t), t.payload.isValid || this.handlePaymentError(new Ft());
3796
+ this.logger.info("Checkout validate fields result", { event: t }), t.payload.isValid || this.handlePaymentError(new Ft());
3797
3797
  }, this.iframe);
3798
3798
  }
3799
3799
  /**
@@ -3802,7 +3802,7 @@ class kc extends ar {
3802
3802
  setUpPaymentAuthListener() {
3803
3803
  this.messagingService.subscribe(_.CHECKOUT_START_PAYMENT_AUTH, async (t) => {
3804
3804
  try {
3805
- this.logger.info("Payment auth started", t), this.paymentAuth = new Lc({
3805
+ this.logger.info("Payment auth started", { event: t }), this.paymentAuth = new Lc({
3806
3806
  paymentAuthData: t.payload.paymentAuthData
3807
3807
  }), await this.paymentAuth.initialize();
3808
3808
  const n = this.paymentAuth.iframe;
@@ -3830,7 +3830,7 @@ class kc extends ar {
3830
3830
  paymentStatus: c.paymentStatus
3831
3831
  };
3832
3832
  } catch (c) {
3833
- this.logger.error(`Error fetching return URL from [${r}]`, { error: c });
3833
+ this.logger.error(`Error fetching return URL from [${r}]`, c);
3834
3834
  }
3835
3835
  i < o && await new Promise((c) => setTimeout(c, s));
3836
3836
  }
@@ -3846,19 +3846,19 @@ class kc extends ar {
3846
3846
  * Handle payment success - calls the onSuccess callback
3847
3847
  */
3848
3848
  handlePaymentSuccess(t) {
3849
- this.options.onSuccess(t), this.logger.info("Triggered onSuccess callback", t);
3849
+ this.options.onSuccess(t), this.logger.info("Triggered onSuccess callback", { params: t });
3850
3850
  }
3851
3851
  /**
3852
3852
  * Handle payment error - calls the onError callback
3853
3853
  */
3854
3854
  handlePaymentError(t) {
3855
- this.options.onError(t), this.logger.warn("Triggered onError callback", { error: t });
3855
+ this.options.onError(t), this.logger.info("Triggered onError callback", { error: t });
3856
3856
  }
3857
3857
  /**
3858
3858
  * Handle action required - calls the optional onActionRequired callback
3859
3859
  */
3860
3860
  handleActionRequired(t) {
3861
- this.options.onActionRequired && (this.options.onActionRequired(t), this.logger.info("Triggered onActionRequired callback", t));
3861
+ this.options.onActionRequired && (this.options.onActionRequired(t), this.logger.info("Triggered onActionRequired callback", { params: t }));
3862
3862
  }
3863
3863
  }
3864
3864
  export {