@paynext/sdk 0.0.90 → 0.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -320,7 +320,7 @@ let Zi = class {
320
320
  })
321
321
  }));
322
322
  const p = yield this.apple.availability();
323
- this.isAvailable = !0, console.log("Apple Pay availability", p), this.isAvailable || console.error("Apple Pay is not available", p), i && this.apple.on("error", i), o && this.apple.on("cancel", o), this.onReady = a;
323
+ this.isAvailable = p === "available", console.log("Apple Pay availability", p), this.isAvailable || i == null || i(new Error(`Apple Pay is not supported on this device: ${p}`)), i && this.apple.on("error", i), o && this.apple.on("cancel", o), this.onReady = a;
324
324
  });
325
325
  }
326
326
  render(t) {
@@ -4332,7 +4332,8 @@ class al {
4332
4332
  clientId: e.paypal_info.client_id,
4333
4333
  environment: e.paypal_info.environment || "sandbox",
4334
4334
  vault: !0,
4335
- locale: Gc(this.config.state.translate.locale())
4335
+ locale: Gc(this.config.state.translate.locale()),
4336
+ intent: "tokenize"
4336
4337
  }), !this.paypal.isLoaded())
4337
4338
  return !1;
4338
4339
  } catch (c) {
@@ -4631,7 +4632,7 @@ class vl {
4631
4632
  try {
4632
4633
  if (yield this.applePay.init({
4633
4634
  onError: (i) => {
4634
- this.events.error.emit(i), this.attempted.delete(q.APPLE_PAY);
4635
+ this.events.error.emit(i), t == null || t.remove(), this.attempted.delete(q.APPLE_PAY);
4635
4636
  },
4636
4637
  onCancel: () => {
4637
4638
  this.events.cancel.emit(), this.attempted.delete(q.APPLE_PAY);
@@ -4700,7 +4701,7 @@ class vl {
4700
4701
  try {
4701
4702
  if (yield this.googlePay.init({
4702
4703
  onError: (i) => {
4703
- this.events.error.emit(i), this.attempted.delete(q.GOOGLE_PAY);
4704
+ this.events.error.emit(i), t == null || t.remove(), this.attempted.delete(q.GOOGLE_PAY);
4704
4705
  },
4705
4706
  onCancel: () => {
4706
4707
  this.events.cancel.emit(), this.attempted.delete(q.GOOGLE_PAY);
@@ -4769,7 +4770,9 @@ class vl {
4769
4770
  try {
4770
4771
  const a = this.paypal.render();
4771
4772
  if (t == null || t.appendChild(a), yield this.paypal.init({
4772
- onError: (s) => this.events.error.emit(s),
4773
+ onError: (s) => {
4774
+ this.events.error.emit(s), t == null || t.remove();
4775
+ },
4773
4776
  onCancel: () => this.events.cancel.emit(),
4774
4777
  onSuccess: (s) => {
4775
4778
  this.events.success.emit({ paypalId: s, type: "paypal" });
@@ -4822,7 +4825,9 @@ class vl {
4822
4825
  this.isBraintreeReady = !1;
4823
4826
  try {
4824
4827
  if (yield this.braintree.init({
4825
- onError: (i) => this.events.error.emit(i),
4828
+ onError: (i) => {
4829
+ this.events.error.emit(i), t == null || t.remove();
4830
+ },
4826
4831
  onCancel: () => this.events.cancel.emit(),
4827
4832
  onSuccess: (i) => {
4828
4833
  this.events.success.emit({ nonce: i == null ? void 0 : i.nonce, type: "venmo" });
@@ -4884,7 +4889,8 @@ class vl {
4884
4889
  });
4885
4890
  });
4886
4891
  }
4887
- waitForElementVisible(t, e = 150) {
4892
+ // wait for element visible
4893
+ waitForElementVisible(t, e = 350) {
4888
4894
  return !t || !(t instanceof HTMLElement) ? Promise.resolve() : new Promise((r) => {
4889
4895
  const a = performance.now(), i = () => {
4890
4896
  const s = t.getBoundingClientRect();
@@ -8027,7 +8033,7 @@ class Au {
8027
8033
  }), o = (a = (r = this.paypal).Buttons) == null ? void 0 : a.call(r, s);
8028
8034
  if (!o)
8029
8035
  throw new Error("PayPal Buttons instance is null");
8030
- console.log("PayPalService: Buttons instance created, calling render()..."), yield o.render(t);
8036
+ yield o.render(t);
8031
8037
  }
8032
8038
  });
8033
8039
  }