@paydock/client-sdk 1.123.8 → 1.126.0-beta

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 (28) hide show
  1. package/bundles/index.cjs +177 -1665
  2. package/bundles/index.cjs.d.ts +24 -1
  3. package/bundles/index.mjs +177 -1665
  4. package/bundles/index.mjs.d.ts +24 -1
  5. package/bundles/types/api/api-base.d.ts +1 -1
  6. package/bundles/types/api/api-base.d.ts.map +1 -1
  7. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  8. package/bundles/types/checkout/instructions/index.d.ts +1 -1
  9. package/bundles/types/checkout/instructions/index.d.ts.map +1 -1
  10. package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts +19 -5
  11. package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts.map +1 -1
  12. package/bundles/types/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts +3 -4
  13. package/bundles/types/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts.map +1 -1
  14. package/bundles/types/checkout-button/zipmoney/zipmoney.config.d.ts +1 -0
  15. package/bundles/types/checkout-button/zipmoney/zipmoney.config.d.ts.map +1 -1
  16. package/bundles/types/checkout-button/zipmoney/zipmoney.runner.d.ts +0 -1
  17. package/bundles/types/checkout-button/zipmoney/zipmoney.runner.d.ts.map +1 -1
  18. package/bundles/types/index-cba.d.ts +33 -0
  19. package/bundles/types/index-cba.d.ts.map +1 -1
  20. package/bundles/types/index.d.ts +33 -0
  21. package/bundles/types/index.d.ts.map +1 -1
  22. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts +1 -0
  23. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -1
  24. package/bundles/widget.umd.js +177 -1665
  25. package/bundles/widget.umd.js.d.ts +24 -1
  26. package/bundles/widget.umd.js.min.d.ts +24 -1
  27. package/bundles/widget.umd.min.js +1 -1
  28. package/package.json +1 -1
@@ -958,7 +958,7 @@
958
958
  version: 'x-sdk-version',
959
959
  type: 'x-sdk-type'
960
960
  });
961
- SDK._version = 'v1.123.8';
961
+ SDK._version = '1.126.0-beta';
962
962
 
963
963
  /******************************************************************************
964
964
  Copyright (c) Microsoft Corporation.
@@ -1235,7 +1235,7 @@
1235
1235
  }
1236
1236
  }
1237
1237
 
1238
- var config$1 = {
1238
+ var config = {
1239
1239
  onUnhandledError: null,
1240
1240
  onStoppedNotification: null,
1241
1241
  Promise: undefined,
@@ -1401,7 +1401,7 @@
1401
1401
  }
1402
1402
  else {
1403
1403
  var context_1;
1404
- if (_this && config$1.useDeprecatedNextContext) {
1404
+ if (_this && config.useDeprecatedNextContext) {
1405
1405
  context_1 = Object.create(observerOrNext);
1406
1406
  context_1.unsubscribe = function () { return _this.unsubscribe(); };
1407
1407
  partialObserver = {
@@ -1537,7 +1537,7 @@
1537
1537
  }());
1538
1538
  function getPromiseCtor(promiseCtor) {
1539
1539
  var _a;
1540
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$1.Promise) !== null && _a !== void 0 ? _a : Promise;
1540
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
1541
1541
  }
1542
1542
  function isObserver(value) {
1543
1543
  return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
@@ -6477,1559 +6477,11 @@
6477
6477
  return 'setRedirectUrl' in runner;
6478
6478
  }
6479
6479
 
6480
- !function t(e, n, r) {
6481
- function o(u, a) {
6482
- if (!n[u]) {
6483
- if (!e[u]) {
6484
- var c = "function" == typeof require && require;
6485
- if (!a && c) return c(u, !0);
6486
- if (i) return i(u, !0);
6487
- var s = Error("Cannot find module '" + u + "'");
6488
- throw s.code = "MODULE_NOT_FOUND", s;
6489
- }
6490
- var f = n[u] = {
6491
- exports: {}
6492
- };
6493
- e[u][0].call(f.exports, function (t) {
6494
- return o(e[u][1][t] || t);
6495
- }, f, f.exports, t, e, n, r);
6496
- }
6497
- return n[u].exports;
6498
- }
6499
- for (var i = "function" == typeof require && require, u = 0; u < r.length; u++) o(r[u]);
6500
- return o;
6501
- }({
6502
- 1: [function (t, e, n) {
6503
- function r() {
6504
- throw Error("setTimeout has not been defined");
6505
- }
6506
- function o() {
6507
- throw Error("clearTimeout has not been defined");
6508
- }
6509
- function i(t) {
6510
- if (f === setTimeout) return setTimeout(t, 0);
6511
- if ((f === r || !f) && setTimeout) return f = setTimeout, setTimeout(t, 0);
6512
- try {
6513
- return f(t, 0);
6514
- } catch (e) {
6515
- try {
6516
- return f.call(null, t, 0);
6517
- } catch (n) {
6518
- return f.call(this, t, 0);
6519
- }
6520
- }
6521
- }
6522
- function u() {
6523
- v && d && (v = !1, d.length ? h = d.concat(h) : y = -1, h.length && a());
6524
- }
6525
- function a() {
6526
- if (!v) {
6527
- var t = i(u);
6528
- v = !0;
6529
- for (var e = h.length; e;) {
6530
- for (d = h, h = []; ++y < e;) d && d[y].run();
6531
- y = -1, e = h.length;
6532
- }
6533
- d = null, v = !1, function t(e) {
6534
- if (l === clearTimeout) return clearTimeout(e);
6535
- if ((l === o || !l) && clearTimeout) return l = clearTimeout, clearTimeout(e);
6536
- try {
6537
- return l(e);
6538
- } catch (n) {
6539
- try {
6540
- return l.call(null, e);
6541
- } catch (r) {
6542
- return l.call(this, e);
6543
- }
6544
- }
6545
- }(t);
6546
- }
6547
- }
6548
- function c(t, e) {
6549
- this.fun = t, this.array = e;
6550
- }
6551
- function s() {}
6552
- var f,
6553
- l,
6554
- p = e.exports = {};
6555
- !function () {
6556
- try {
6557
- f = "function" == typeof setTimeout ? setTimeout : r;
6558
- } catch (t) {
6559
- f = r;
6560
- }
6561
- try {
6562
- l = "function" == typeof clearTimeout ? clearTimeout : o;
6563
- } catch (e) {
6564
- l = o;
6565
- }
6566
- }();
6567
- var d,
6568
- h = [],
6569
- v = !1,
6570
- y = -1;
6571
- p.nextTick = function (t) {
6572
- var e = Array(arguments.length - 1);
6573
- if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
6574
- h.push(new c(t, e)), 1 !== h.length || v || i(a);
6575
- }, c.prototype.run = function () {
6576
- this.fun.apply(null, this.array);
6577
- }, p.title = "browser", p.browser = !0, p.env = {}, p.argv = [], p.version = "", p.versions = {}, p.on = s, p.addListener = s, p.once = s, p.off = s, p.removeListener = s, p.removeAllListeners = s, p.emit = s, p.prependListener = s, p.prependOnceListener = s, p.listeners = function (t) {
6578
- return [];
6579
- }, p.binding = function (t) {
6580
- throw Error("process.binding is not supported");
6581
- }, p.cwd = function () {
6582
- return "/";
6583
- }, p.chdir = function (t) {
6584
- throw Error("process.chdir is not supported");
6585
- }, p.umask = function () {
6586
- return 0;
6587
- };
6588
- }, {}],
6589
- 2: [function (t, e, n) {
6590
- (function (t) {
6591
- !function (t) {
6592
-
6593
- if ("function" == typeof bootstrap) bootstrap("promise", t);else if ("object" == _typeof$1(n) && "object" == _typeof$1(e)) e.exports = t();else if ("function" == typeof define && define.amd) define(t);else if ("undefined" != typeof ses) {
6594
- if (!ses.ok()) return;
6595
- ses.makeQ = t;
6596
- } else {
6597
- if ("undefined" == typeof window && "undefined" == typeof self) throw Error("This environment was not anticipated by Q. Please file a bug.");
6598
- var r = "undefined" != typeof window ? window : self,
6599
- o = r.Q;
6600
- r.Q = t(), r.Q.noConflict = function () {
6601
- return r.Q = o, this;
6602
- };
6603
- }
6604
- }(function () {
6605
-
6606
- function e(t) {
6607
- return function () {
6608
- return M.apply(t, arguments);
6609
- };
6610
- }
6611
- function n(t, e) {
6612
- if (x && e.stack && "object" == _typeof$1(t) && null !== t && t.stack) {
6613
- for (var n = [], o = e; o; o = o.source) o.stack && (!t.__minimumStackCounter__ || t.__minimumStackCounter__ > o.stackCounter) && (U(t, "__minimumStackCounter__", {
6614
- value: o.stackCounter,
6615
- configurable: !0
6616
- }), n.unshift(o.stack));
6617
- n.unshift(t.stack), U(t, "stack", {
6618
- value: function t(e) {
6619
- for (var n = e.split("\n"), o = [], u = 0; u < n.length; ++u) {
6620
- var a = n[u];
6621
- i(a) || r(a) || !a || o.push(a);
6622
- }
6623
- return o.join("\n");
6624
- }(n.join("\n" + I + "\n")),
6625
- configurable: !0
6626
- });
6627
- }
6628
- }
6629
- function r(t) {
6630
- return -1 !== t.indexOf("(module.js:") || -1 !== t.indexOf("(node.js:");
6631
- }
6632
- function o(t) {
6633
- var e = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);
6634
- if (e) return [e[1], Number(e[2])];
6635
- var n = /at ([^ ]+):(\d+):(?:\d+)$/.exec(t);
6636
- if (n) return [n[1], Number(n[2])];
6637
- var r = /.*@(.+):(\d+)$/.exec(t);
6638
- return r ? [r[1], Number(r[2])] : void 0;
6639
- }
6640
- function i(t) {
6641
- var e = o(t);
6642
- if (!e) return !1;
6643
- var n = e[0],
6644
- r = e[1];
6645
- return n === j && r >= C && r <= Z;
6646
- }
6647
- function u() {
6648
- if (x) try {
6649
- throw Error();
6650
- } catch (t) {
6651
- var e = t.stack.split("\n"),
6652
- n = o(e[0].indexOf("@") > 0 ? e[1] : e[2]);
6653
- if (!n) return;
6654
- return j = n[0], n[1];
6655
- }
6656
- }
6657
- function a(t) {
6658
- var e, n;
6659
- return t instanceof l ? t : v(t) ? (e = t, n = c(), a.nextTick(function () {
6660
- try {
6661
- e.then(n.resolve, n.reject, n.notify);
6662
- } catch (t) {
6663
- n.reject(t);
6664
- }
6665
- }), n.promise) : $(t);
6666
- }
6667
- function c() {
6668
- function t(t) {
6669
- e = t, a.longStackSupport && x && (i.source = t), L(n, function (e, n) {
6670
- a.nextTick(function () {
6671
- t.promiseDispatch.apply(t, n);
6672
- });
6673
- }, void 0), n = void 0, r = void 0;
6674
- }
6675
- var e,
6676
- n = [],
6677
- r = [],
6678
- o = H(c.prototype),
6679
- i = H(l.prototype);
6680
- if (i.promiseDispatch = function (t, o, i) {
6681
- var u = P(arguments);
6682
- n ? (n.push(u), "when" === o && i[1] && r.push(i[1])) : a.nextTick(function () {
6683
- e.promiseDispatch.apply(e, u);
6684
- });
6685
- }, i.valueOf = function () {
6686
- if (n) return i;
6687
- var t = d(e);
6688
- return h(t) && (e = t), t;
6689
- }, i.inspect = function () {
6690
- return e ? e.inspect() : {
6691
- state: "pending"
6692
- };
6693
- }, a.longStackSupport && x) try {
6694
- throw Error();
6695
- } catch (u) {
6696
- i.stack = u.stack.substring(u.stack.indexOf("\n") + 1), i.stackCounter = N++;
6697
- }
6698
- return o.promise = i, o.resolve = function (n) {
6699
- e || t(a(n));
6700
- }, o.fulfill = function (n) {
6701
- e || t($(n));
6702
- }, o.reject = function (n) {
6703
- e || t(m(n));
6704
- }, o.notify = function (t) {
6705
- e || L(r, function (e, n) {
6706
- a.nextTick(function () {
6707
- n(t);
6708
- });
6709
- }, void 0);
6710
- }, o;
6711
- }
6712
- function s(t) {
6713
- if ("function" != typeof t) throw TypeError("resolver must be a function.");
6714
- var e = c();
6715
- try {
6716
- t(e.resolve, e.reject, e.notify);
6717
- } catch (n) {
6718
- e.reject(n);
6719
- }
6720
- return e.promise;
6721
- }
6722
- function f(t) {
6723
- return s(function (e, n) {
6724
- for (var r = 0, o = t.length; r < o; r++) a(t[r]).then(e, n);
6725
- });
6726
- }
6727
- function l(t, e, n) {
6728
- void 0 === e && (e = function e(t) {
6729
- return m(Error("Promise does not support operation: " + t));
6730
- }), void 0 === n && (n = function n() {
6731
- return {
6732
- state: "unknown"
6733
- };
6734
- });
6735
- var r = H(l.prototype);
6736
- if (r.promiseDispatch = function (n, o, i) {
6737
- var u;
6738
- try {
6739
- u = t[o] ? t[o].apply(r, i) : e.call(r, o, i);
6740
- } catch (a) {
6741
- u = m(a);
6742
- }
6743
- n && n(u);
6744
- }, r.inspect = n, n) {
6745
- var o = n();
6746
- "rejected" === o.state && (r.exception = o.reason), r.valueOf = function () {
6747
- var t = n();
6748
- return "pending" === t.state || "rejected" === t.state ? r : t.value;
6749
- };
6750
- }
6751
- return r;
6752
- }
6753
- function p(t, e, n, r) {
6754
- return a(t).then(e, n, r);
6755
- }
6756
- function d(t) {
6757
- if (h(t)) {
6758
- var e = t.inspect();
6759
- if ("fulfilled" === e.state) return e.value;
6760
- }
6761
- return t;
6762
- }
6763
- function h(t) {
6764
- return t instanceof l;
6765
- }
6766
- function v(t) {
6767
- var e;
6768
- return (e = t) === Object(e) && "function" == typeof t.then;
6769
- }
6770
- function y() {
6771
- Q.length = 0, F.length = 0, G || (G = !0);
6772
- }
6773
- function m(e) {
6774
- var n,
6775
- r,
6776
- o = l({
6777
- when: function when(n) {
6778
- return n && function e(n) {
6779
- if (G) {
6780
- var r = z(F, n);
6781
- -1 !== r && ("object" == _typeof$1(t) && "function" == typeof t.emit && a.nextTick.runAfter(function () {
6782
- var e = z(B, n);
6783
- -1 !== e && (t.emit("rejectionHandled", Q[r], n), B.splice(e, 1));
6784
- }), F.splice(r, 1), Q.splice(r, 1));
6785
- }
6786
- }(this), n ? n(e) : this;
6787
- }
6788
- }, function () {
6789
- return this;
6790
- }, function () {
6791
- return {
6792
- state: "rejected",
6793
- reason: e
6794
- };
6795
- });
6796
- return n = o, r = e, G && ("object" == _typeof$1(t) && "function" == typeof t.emit && a.nextTick.runAfter(function () {
6797
- -1 !== z(F, n) && (t.emit("unhandledRejection", r, n), B.push(n));
6798
- }), F.push(n), r && void 0 !== r.stack ? Q.push(r.stack) : Q.push("(no stack) " + r)), o;
6799
- }
6800
- function $(t) {
6801
- return l({
6802
- when: function when() {
6803
- return t;
6804
- },
6805
- get: function get(e) {
6806
- return t[e];
6807
- },
6808
- set: function set(e, n) {
6809
- t[e] = n;
6810
- },
6811
- "delete": function _delete(e) {
6812
- delete t[e];
6813
- },
6814
- post: function post(e, n) {
6815
- return null == e ? t.apply(void 0, n) : t[e].apply(t, n);
6816
- },
6817
- apply: function apply(e, n) {
6818
- return t.apply(e, n);
6819
- },
6820
- keys: function keys() {
6821
- return q(t);
6822
- }
6823
- }, void 0, function () {
6824
- return {
6825
- state: "fulfilled",
6826
- value: t
6827
- };
6828
- });
6829
- }
6830
- function g(t, e, n) {
6831
- return a(t).spread(e, n);
6832
- }
6833
- function b(t, e, n) {
6834
- return a(t).dispatch(e, n);
6835
- }
6836
- function k(t) {
6837
- return p(t, function (t) {
6838
- var e = 0,
6839
- n = c();
6840
- return L(t, function (r, o, i) {
6841
- var u;
6842
- h(o) && "fulfilled" === (u = o.inspect()).state ? t[i] = u.value : (++e, p(o, function (r) {
6843
- t[i] = r, 0 == --e && n.resolve(t);
6844
- }, n.reject, function (t) {
6845
- n.notify({
6846
- index: i,
6847
- value: t
6848
- });
6849
- }));
6850
- }, void 0), 0 === e && n.resolve(t), n.promise;
6851
- });
6852
- }
6853
- function _(t) {
6854
- if (0 === t.length) return a.resolve();
6855
- var e = a.defer(),
6856
- n = 0;
6857
- return L(t, function (r, o, i) {
6858
- var u = t[i];
6859
- n++, p(u, function t(n) {
6860
- e.resolve(n);
6861
- }, function t(r) {
6862
- 0 == --n && (r.message = "Q can't get fulfillment value from any promise, all promises were rejected. Last error message: " + r.message, e.reject(r));
6863
- }, function t(n) {
6864
- e.notify({
6865
- index: i,
6866
- value: n
6867
- });
6868
- });
6869
- }, void 0), e.promise;
6870
- }
6871
- function w(t) {
6872
- return p(t, function (t) {
6873
- return t = S(t, a), p(k(S(t, function (t) {
6874
- return p(t, R, R);
6875
- })), function () {
6876
- return t;
6877
- });
6878
- });
6879
- }
6880
- var x = !1;
6881
- try {
6882
- throw Error();
6883
- } catch (E) {
6884
- x = !!E.stack;
6885
- }
6886
- var j,
6887
- T,
6888
- C = u(),
6889
- R = function R() {},
6890
- O = function () {
6891
- function e() {
6892
- for (var t, e; r.next;) t = (r = r.next).task, r.task = void 0, (e = r.domain) && (r.domain = void 0, e.enter()), n(t, e);
6893
- for (; c.length;) n(t = c.pop());
6894
- i = !1;
6895
- }
6896
- function n(t, n) {
6897
- try {
6898
- t();
6899
- } catch (r) {
6900
- if (a) throw n && n.exit(), setTimeout(e, 0), n && n.enter(), r;
6901
- setTimeout(function () {
6902
- throw r;
6903
- }, 0);
6904
- }
6905
- n && n.exit();
6906
- }
6907
- var r = {
6908
- task: void 0,
6909
- next: null
6910
- },
6911
- o = r,
6912
- i = !1,
6913
- u = void 0,
6914
- a = !1,
6915
- c = [];
6916
- if (O = function O(e) {
6917
- o = o.next = {
6918
- task: e,
6919
- domain: a && t.domain,
6920
- next: null
6921
- }, i || (i = !0, u());
6922
- }, "object" == _typeof$1(t) && "[object process]" === t.toString() && t.nextTick) a = !0, u = function u() {
6923
- t.nextTick(e);
6924
- };else if ("function" == typeof setImmediate) u = "undefined" != typeof window ? setImmediate.bind(window, e) : function () {
6925
- setImmediate(e);
6926
- };else if ("undefined" != typeof MessageChannel) {
6927
- var s = new MessageChannel();
6928
- s.port1.onmessage = function () {
6929
- u = f, s.port1.onmessage = e, e();
6930
- };
6931
- var f = function f() {
6932
- s.port2.postMessage(0);
6933
- };
6934
- u = function u() {
6935
- setTimeout(e, 0), f();
6936
- };
6937
- } else u = function u() {
6938
- setTimeout(e, 0);
6939
- };
6940
- return O.runAfter = function (t) {
6941
- c.push(t), i || (i = !0, u());
6942
- }, O;
6943
- }(),
6944
- M = Function.call,
6945
- P = e(Array.prototype.slice),
6946
- L = e(Array.prototype.reduce || function (t, e) {
6947
- var n = 0,
6948
- r = this.length;
6949
- if (1 === arguments.length) for (;;) {
6950
- if (n in this) {
6951
- e = this[n++];
6952
- break;
6953
- }
6954
- if (++n >= r) throw TypeError();
6955
- }
6956
- for (; n < r; n++) n in this && (e = t(e, this[n], n));
6957
- return e;
6958
- }),
6959
- z = e(Array.prototype.indexOf || function (t) {
6960
- for (var e = 0; e < this.length; e++) if (this[e] === t) return e;
6961
- return -1;
6962
- }),
6963
- S = e(Array.prototype.map || function (t, e) {
6964
- var n = this,
6965
- r = [];
6966
- return L(n, function (o, i, u) {
6967
- r.push(t.call(e, i, u, n));
6968
- }, void 0), r;
6969
- }),
6970
- H = Object.create || function (t) {
6971
- function e() {}
6972
- return e.prototype = t, new e();
6973
- },
6974
- U = Object.defineProperty || function (t, e, n) {
6975
- return t[e] = n.value, t;
6976
- },
6977
- A = e(Object.prototype.hasOwnProperty),
6978
- q = Object.keys || function (t) {
6979
- var e = [];
6980
- for (var n in t) A(t, n) && e.push(n);
6981
- return e;
6982
- },
6983
- D = e(Object.prototype.toString);
6984
- T = "undefined" != typeof ReturnValue ? ReturnValue : function (t) {
6985
- this.value = t;
6986
- };
6987
- var I = "From previous event:";
6988
- a.resolve = a, a.nextTick = O, a.longStackSupport = !1;
6989
- var N = 1;
6990
- "object" == _typeof$1(t) && t && t.env && t.env.Q_DEBUG && (a.longStackSupport = !0), a.defer = c, c.prototype.makeNodeResolver = function () {
6991
- var t = this;
6992
- return function (e, n) {
6993
- e ? t.reject(e) : arguments.length > 2 ? t.resolve(P(arguments, 1)) : t.resolve(n);
6994
- };
6995
- }, a.Promise = s, a.promise = s, s.race = f, s.all = k, s.reject = m, s.resolve = a, a.passByCopy = function (t) {
6996
- return t;
6997
- }, l.prototype.passByCopy = function () {
6998
- return this;
6999
- }, a.join = function (t, e) {
7000
- return a(t).join(e);
7001
- }, l.prototype.join = function (t) {
7002
- return a([this, t]).spread(function (t, e) {
7003
- if (t === e) return t;
7004
- throw Error("Q can't join: not the same: " + t + " " + e);
7005
- });
7006
- }, a.race = f, l.prototype.race = function () {
7007
- return this.then(a.race);
7008
- }, a.makePromise = l, l.prototype.toString = function () {
7009
- return "[object Promise]";
7010
- }, l.prototype.then = function (t, e, r) {
7011
- var o = this,
7012
- i = c(),
7013
- u = !1;
7014
- return a.nextTick(function () {
7015
- o.promiseDispatch(function (e) {
7016
- u || (u = !0, i.resolve(function e(n) {
7017
- try {
7018
- return "function" == typeof t ? t(n) : n;
7019
- } catch (r) {
7020
- return m(r);
7021
- }
7022
- }(e)));
7023
- }, "when", [function (t) {
7024
- u || (u = !0, i.resolve(function t(r) {
7025
- if ("function" == typeof e) {
7026
- n(r, o);
7027
- try {
7028
- return e(r);
7029
- } catch (i) {
7030
- return m(i);
7031
- }
7032
- }
7033
- return m(r);
7034
- }(t)));
7035
- }]);
7036
- }), o.promiseDispatch(void 0, "when", [void 0, function (t) {
7037
- var e,
7038
- n,
7039
- o = !1;
7040
- try {
7041
- n = (e = t, "function" == typeof r ? r(e) : e);
7042
- } catch (u) {
7043
- if (o = !0, !a.onerror) throw u;
7044
- a.onerror(u);
7045
- }
7046
- o || i.notify(n);
7047
- }]), i.promise;
7048
- }, a.tap = function (t, e) {
7049
- return a(t).tap(e);
7050
- }, l.prototype.tap = function (t) {
7051
- return t = a(t), this.then(function (e) {
7052
- return t.fcall(e).thenResolve(e);
7053
- });
7054
- }, a.when = p, l.prototype.thenResolve = function (t) {
7055
- return this.then(function () {
7056
- return t;
7057
- });
7058
- }, a.thenResolve = function (t, e) {
7059
- return a(t).thenResolve(e);
7060
- }, l.prototype.thenReject = function (t) {
7061
- return this.then(function () {
7062
- throw t;
7063
- });
7064
- }, a.thenReject = function (t, e) {
7065
- return a(t).thenReject(e);
7066
- }, a.nearer = d, a.isPromise = h, a.isPromiseAlike = v, a.isPending = function t(e) {
7067
- return h(e) && "pending" === e.inspect().state;
7068
- }, l.prototype.isPending = function () {
7069
- return "pending" === this.inspect().state;
7070
- }, a.isFulfilled = function t(e) {
7071
- return !h(e) || "fulfilled" === e.inspect().state;
7072
- }, l.prototype.isFulfilled = function () {
7073
- return "fulfilled" === this.inspect().state;
7074
- }, a.isRejected = function t(e) {
7075
- return h(e) && "rejected" === e.inspect().state;
7076
- }, l.prototype.isRejected = function () {
7077
- return "rejected" === this.inspect().state;
7078
- };
7079
- var W,
7080
- Q = [],
7081
- F = [],
7082
- B = [],
7083
- G = !0;
7084
- a.resetUnhandledRejections = y, a.getUnhandledReasons = function () {
7085
- return Q.slice();
7086
- }, a.stopUnhandledRejectionTracking = function () {
7087
- y(), G = !1;
7088
- }, y(), a.reject = m, a.fulfill = $, a.master = function t(e) {
7089
- return l({
7090
- isDef: function isDef() {}
7091
- }, function (t, n) {
7092
- return b(e, t, n);
7093
- }, function () {
7094
- return a(e).inspect();
7095
- });
7096
- }, a.spread = g, l.prototype.spread = function (t, e) {
7097
- return this.all().then(function (e) {
7098
- return t.apply(void 0, e);
7099
- }, e);
7100
- }, a.async = function t(e) {
7101
- return function () {
7102
- function t(t, e) {
7103
- var i, u;
7104
- if ("undefined" == typeof StopIteration) {
7105
- try {
7106
- i = n[t](e);
7107
- } catch (c) {
7108
- return m(c);
7109
- }
7110
- return i.done ? a(i.value) : p(i.value, r, o);
7111
- }
7112
- try {
7113
- i = n[t](e);
7114
- } catch (s) {
7115
- return "[object StopIteration]" === D(u = s) || u instanceof T ? a(s.value) : m(s);
7116
- }
7117
- return p(i, r, o);
7118
- }
7119
- var n = e.apply(this, arguments),
7120
- r = t.bind(t, "next"),
7121
- o = t.bind(t, "throw");
7122
- return r();
7123
- };
7124
- }, a.spawn = function t(e) {
7125
- a.done(a.async(e)());
7126
- }, a["return"] = function t(e) {
7127
- throw new T(e);
7128
- }, a.promised = function t(e) {
7129
- return function () {
7130
- return g([this, k(arguments)], function (t, n) {
7131
- return e.apply(t, n);
7132
- });
7133
- };
7134
- }, a.dispatch = b, l.prototype.dispatch = function (t, e) {
7135
- var n = this,
7136
- r = c();
7137
- return a.nextTick(function () {
7138
- n.promiseDispatch(r.resolve, t, e);
7139
- }), r.promise;
7140
- }, a.get = function (t, e) {
7141
- return a(t).dispatch("get", [e]);
7142
- }, l.prototype.get = function (t) {
7143
- return this.dispatch("get", [t]);
7144
- }, a.set = function (t, e, n) {
7145
- return a(t).dispatch("set", [e, n]);
7146
- }, l.prototype.set = function (t, e) {
7147
- return this.dispatch("set", [t, e]);
7148
- }, a.del = a["delete"] = function (t, e) {
7149
- return a(t).dispatch("delete", [e]);
7150
- }, l.prototype.del = l.prototype["delete"] = function (t) {
7151
- return this.dispatch("delete", [t]);
7152
- }, a.mapply = a.post = function (t, e, n) {
7153
- return a(t).dispatch("post", [e, n]);
7154
- }, l.prototype.mapply = l.prototype.post = function (t, e) {
7155
- return this.dispatch("post", [t, e]);
7156
- }, a.send = a.mcall = a.invoke = function (t, e) {
7157
- return a(t).dispatch("post", [e, P(arguments, 2)]);
7158
- }, l.prototype.send = l.prototype.mcall = l.prototype.invoke = function (t) {
7159
- return this.dispatch("post", [t, P(arguments, 1)]);
7160
- }, a.fapply = function (t, e) {
7161
- return a(t).dispatch("apply", [void 0, e]);
7162
- }, l.prototype.fapply = function (t) {
7163
- return this.dispatch("apply", [void 0, t]);
7164
- }, a["try"] = a.fcall = function (t) {
7165
- return a(t).dispatch("apply", [void 0, P(arguments, 1)]);
7166
- }, l.prototype.fcall = function () {
7167
- return this.dispatch("apply", [void 0, P(arguments)]);
7168
- }, a.fbind = function (t) {
7169
- var e = a(t),
7170
- n = P(arguments, 1);
7171
- return function () {
7172
- return e.dispatch("apply", [this, n.concat(P(arguments))]);
7173
- };
7174
- }, l.prototype.fbind = function () {
7175
- var t = this,
7176
- e = P(arguments);
7177
- return function () {
7178
- return t.dispatch("apply", [this, e.concat(P(arguments))]);
7179
- };
7180
- }, a.keys = function (t) {
7181
- return a(t).dispatch("keys", []);
7182
- }, l.prototype.keys = function () {
7183
- return this.dispatch("keys", []);
7184
- }, a.all = k, l.prototype.all = function () {
7185
- return k(this);
7186
- }, a.any = _, l.prototype.any = function () {
7187
- return _(this);
7188
- }, a.allResolved = (W = w, function () {
7189
- return "undefined" != typeof console && "function" == typeof console.warn && console.warn("allResolved is deprecated, use allSettled instead.", Error("").stack), W.apply(W, arguments);
7190
- }), l.prototype.allResolved = function () {
7191
- return w(this);
7192
- }, a.allSettled = function t(e) {
7193
- return a(e).allSettled();
7194
- }, l.prototype.allSettled = function () {
7195
- return this.then(function (t) {
7196
- return k(S(t, function (t) {
7197
- function e() {
7198
- return t.inspect();
7199
- }
7200
- return (t = a(t)).then(e, e);
7201
- }));
7202
- });
7203
- }, a.fail = a["catch"] = function (t, e) {
7204
- return a(t).then(void 0, e);
7205
- }, l.prototype.fail = l.prototype["catch"] = function (t) {
7206
- return this.then(void 0, t);
7207
- }, a.progress = function t(e, n) {
7208
- return a(e).then(void 0, void 0, n);
7209
- }, l.prototype.progress = function (t) {
7210
- return this.then(void 0, void 0, t);
7211
- }, a.fin = a["finally"] = function (t, e) {
7212
- return a(t)["finally"](e);
7213
- }, l.prototype.fin = l.prototype["finally"] = function (t) {
7214
- if (!t || "function" != typeof t.apply) throw Error("Q can't apply finally callback");
7215
- return t = a(t), this.then(function (e) {
7216
- return t.fcall().then(function () {
7217
- return e;
7218
- });
7219
- }, function (e) {
7220
- return t.fcall().then(function () {
7221
- throw e;
7222
- });
7223
- });
7224
- }, a.done = function (t, e, n, r) {
7225
- return a(t).done(e, n, r);
7226
- }, l.prototype.done = function (e, r, o) {
7227
- var i = function i(t) {
7228
- a.nextTick(function () {
7229
- if (n(t, u), !a.onerror) throw t;
7230
- a.onerror(t);
7231
- });
7232
- },
7233
- u = e || r || o ? this.then(e, r, o) : this;
7234
- "object" == _typeof$1(t) && t && t.domain && (i = t.domain.bind(i)), u.then(void 0, i);
7235
- }, a.timeout = function (t, e, n) {
7236
- return a(t).timeout(e, n);
7237
- }, l.prototype.timeout = function (t, e) {
7238
- var n = c(),
7239
- r = setTimeout(function () {
7240
- e && "string" != typeof e || ((e = Error(e || "Timed out after " + t + " ms")).code = "ETIMEDOUT"), n.reject(e);
7241
- }, t);
7242
- return this.then(function (t) {
7243
- clearTimeout(r), n.resolve(t);
7244
- }, function (t) {
7245
- clearTimeout(r), n.reject(t);
7246
- }, n.notify), n.promise;
7247
- }, a.delay = function (t, e) {
7248
- return void 0 === e && (e = t, t = void 0), a(t).delay(e);
7249
- }, l.prototype.delay = function (t) {
7250
- return this.then(function (e) {
7251
- var n = c();
7252
- return setTimeout(function () {
7253
- n.resolve(e);
7254
- }, t), n.promise;
7255
- });
7256
- }, a.nfapply = function (t, e) {
7257
- return a(t).nfapply(e);
7258
- }, l.prototype.nfapply = function (t) {
7259
- var e = c(),
7260
- n = P(t);
7261
- return n.push(e.makeNodeResolver()), this.fapply(n).fail(e.reject), e.promise;
7262
- }, a.nfcall = function (t) {
7263
- var e = P(arguments, 1);
7264
- return a(t).nfapply(e);
7265
- }, l.prototype.nfcall = function () {
7266
- var t = P(arguments),
7267
- e = c();
7268
- return t.push(e.makeNodeResolver()), this.fapply(t).fail(e.reject), e.promise;
7269
- }, a.nfbind = a.denodeify = function (t) {
7270
- if (void 0 === t) throw Error("Q can't wrap an undefined function");
7271
- var e = P(arguments, 1);
7272
- return function () {
7273
- var n = e.concat(P(arguments)),
7274
- r = c();
7275
- return n.push(r.makeNodeResolver()), a(t).fapply(n).fail(r.reject), r.promise;
7276
- };
7277
- }, l.prototype.nfbind = l.prototype.denodeify = function () {
7278
- var t = P(arguments);
7279
- return t.unshift(this), a.denodeify.apply(void 0, t);
7280
- }, a.nbind = function (t, e) {
7281
- var n = P(arguments, 2);
7282
- return function () {
7283
- var r = n.concat(P(arguments)),
7284
- o = c();
7285
- return r.push(o.makeNodeResolver()), a(function n() {
7286
- return t.apply(e, arguments);
7287
- }).fapply(r).fail(o.reject), o.promise;
7288
- };
7289
- }, l.prototype.nbind = function () {
7290
- var t = P(arguments, 0);
7291
- return t.unshift(this), a.nbind.apply(void 0, t);
7292
- }, a.nmapply = a.npost = function (t, e, n) {
7293
- return a(t).npost(e, n);
7294
- }, l.prototype.nmapply = l.prototype.npost = function (t, e) {
7295
- var n = P(e || []),
7296
- r = c();
7297
- return n.push(r.makeNodeResolver()), this.dispatch("post", [t, n]).fail(r.reject), r.promise;
7298
- }, a.nsend = a.nmcall = a.ninvoke = function (t, e) {
7299
- var n = P(arguments, 2),
7300
- r = c();
7301
- return n.push(r.makeNodeResolver()), a(t).dispatch("post", [e, n]).fail(r.reject), r.promise;
7302
- }, l.prototype.nsend = l.prototype.nmcall = l.prototype.ninvoke = function (t) {
7303
- var e = P(arguments, 1),
7304
- n = c();
7305
- return e.push(n.makeNodeResolver()), this.dispatch("post", [t, e]).fail(n.reject), n.promise;
7306
- }, a.nodeify = function t(e, n) {
7307
- return a(e).nodeify(n);
7308
- }, l.prototype.nodeify = function (t) {
7309
- if (!t) return this;
7310
- this.then(function (e) {
7311
- a.nextTick(function () {
7312
- t(null, e);
7313
- });
7314
- }, function (e) {
7315
- a.nextTick(function () {
7316
- t(e);
7317
- });
7318
- });
7319
- }, a.noConflict = function () {
7320
- throw Error("Q.noConflict only works when Q is used as a global");
7321
- };
7322
- var Z = u();
7323
- return a;
7324
- });
7325
- }).call(this, t("_process"));
7326
- }, {
7327
- _process: 1
7328
- }],
7329
- 3: [function (t, e, n) {
7330
-
7331
- var r = function r(t) {
7332
- switch (_typeof$1(t)) {
7333
- case "string":
7334
- return t;
7335
- case "boolean":
7336
- return t ? "true" : "false";
7337
- case "number":
7338
- return isFinite(t) ? t : "";
7339
- default:
7340
- return "";
7341
- }
7342
- };
7343
- e.exports = function (t, e, n, o) {
7344
- return e = e || "&", n = n || "=", null === t && (t = void 0), "object" == _typeof$1(t) ? Object.keys(t).map(function (o) {
7345
- var i = encodeURIComponent(r(o)) + n;
7346
- return Array.isArray(t[o]) ? t[o].map(function (t) {
7347
- return i + encodeURIComponent(r(t));
7348
- }).join(e) : i + encodeURIComponent(r(t[o]));
7349
- }).join(e) : o ? encodeURIComponent(r(o)) + n + encodeURIComponent(r(t)) : "";
7350
- };
7351
- }, {}],
7352
- 4: [function (t, e, n) {
7353
-
7354
- function r(t) {
7355
- return t && t.__esModule ? t : {
7356
- "default": t
7357
- };
7358
- }
7359
- function o(t, e, n) {
7360
- return d["default"].information("zip:checkout:init"), v["default"].Promise(function (e, n) {
7361
- return t.onCheckout(e, n, {});
7362
- }).then(function (r) {
7363
- var o = r.redirect_uri || r.redirectUri || r.data && (r.data.redirect_uri || r.data.redirectUri);
7364
- if (!o) return d["default"].debug("zip:checkout:error", "Response does not contain redirectUri property"), n(r), void t.onError({
7365
- code: "checkout_error",
7366
- message: "The response does not contain the redirectUri property",
7367
- detail: r
7368
- });
7369
- d["default"].debug("zip:checkout:success", r), e({
7370
- redirectUri: o
7371
- });
7372
- })["catch"](function (e) {
7373
- d["default"].debug("zip:checkout:error", e), n(e), t.onError({
7374
- code: "checkout_error",
7375
- message: "Checkout response error",
7376
- detail: e
7377
- });
7378
- });
7379
- }
7380
- Object.defineProperty(n, "__esModule", {
7381
- value: !0
7382
- }), n.Checkout = void 0;
7383
- var i = function () {
7384
- function t(t, e) {
7385
- for (var n = 0; n < e.length; n++) {
7386
- var r = e[n];
7387
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7388
- }
7389
- }
7390
- return function (e, n, r) {
7391
- return n && t(e.prototype, n), r && t(e, r), e;
7392
- };
7393
- }(),
7394
- u = t("./modal"),
7395
- a = r(u),
7396
- c = t("./options"),
7397
- s = r(c),
7398
- f = t("./utility"),
7399
- l = r(f),
7400
- p = t("./console"),
7401
- d = r(p),
7402
- h = (t("./events"), t("q")),
7403
- v = r(h),
7404
- y = function () {
7405
- function t() {
7406
- !function t(e, n) {
7407
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7408
- }(this, t);
7409
- }
7410
- return i(t, null, [{
7411
- key: "init",
7412
- value: function value(t) {
7413
- if ("function" != typeof Object.assign && (Object.assign = function (t) {
7414
- if (null == t) throw TypeError("Cannot convert undefined or null to object");
7415
- t = Object(t);
7416
- for (var e = 1; e < arguments.length; e++) {
7417
- var n = arguments[e];
7418
- if (null != n) for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
7419
- }
7420
- return t;
7421
- }), t = _extends({}, s["default"], t), !this._validate(t)) {
7422
- var e, n;
7423
- return d["default"].setLevel(t.logLevel), t.redirect ? o(t, function (e) {
7424
- return t.redirectFn(e.redirectUri);
7425
- }) : (e = t, void ((n = new a["default"]()).onClose = e.onComplete.bind(e), n.build(), o(e, function (t) {
7426
- return n.setUri(t.redirectUri);
7427
- }, function (t) {
7428
- return n.close(!1);
7429
- })));
7430
- }
7431
- }
7432
- }, {
7433
- key: "attachButton",
7434
- value: function value(t, e) {
7435
- var n = document.querySelectorAll(t);
7436
- if (!n.length) return config.onError({
7437
- code: "attach_error",
7438
- message: "Cannot find button to attach zipMoney checkout"
7439
- });
7440
- for (var r = 0; r < n.length; r++) l["default"].addEventHandler(n[r], "click", function () {
7441
- return Zip.Checkout.init(e);
7442
- });
7443
- }
7444
- }, {
7445
- key: "_validate",
7446
- value: function value(t) {
7447
- return 0 > ["error", "information", "debug"].indexOf(t.logLevel.toLowerCase()) && (t.logLevel = "error"), 0 > ["standard", "express"].indexOf(t.request.toLowerCase()) && (t.request = "standard"), t.onComplete = t.onComplete || function () {}, t.onError = t.onError || function () {}, t.checkoutUri || t.onCheckout !== s["default"].onCheckout ? "express" === t.request ? t.onError({
7448
- code: "not_implemented",
7449
- message: "This feature is not yet implemented"
7450
- }) : t.redirect ? void 0 : t.onComplete !== s["default"].onComplete || t.redirectUri ? void 0 : t.onError({
7451
- code: "validation",
7452
- message: "if onComplete function is not specified then redirectUri must be specified"
7453
- }) : t.onError({
7454
- code: "validation",
7455
- message: "if onCheckout function is not specified then checkoutUri must be specified"
7456
- });
7457
- }
7458
- }]), t;
7459
- }();
7460
- n.Checkout = y;
7461
- }, {
7462
- "./console": 5,
7463
- "./events": 6,
7464
- "./modal": 8,
7465
- "./options": 9,
7466
- "./utility": 10,
7467
- q: 2
7468
- }],
7469
- 5: [function (t, e, n) {
7470
-
7471
- Object.defineProperty(n, "__esModule", {
7472
- value: !0
7473
- });
7474
- var r = "error";
7475
- n["default"] = {
7476
- error: function error() {
7477
- var t;
7478
- (t = window.console).log.apply(t, arguments);
7479
- },
7480
- information: function information() {
7481
- if ("error" !== r) {
7482
- var t;
7483
- (t = window.console).log.apply(t, arguments);
7484
- }
7485
- },
7486
- debug: function debug() {
7487
- if ("debug" === r) {
7488
- var t;
7489
- (t = window.console).log.apply(t, arguments);
7490
- }
7491
- },
7492
- setLevel: function setLevel(t) {
7493
- r = t;
7494
- }
7495
- };
7496
- }, {}],
7497
- 6: [function (t, e, n) {
7498
- (function (e) {
7499
-
7500
- Object.defineProperty(n, "__esModule", {
7501
- value: !0
7502
- }), n.EventListener = void 0;
7503
- var r,
7504
- o = function () {
7505
- function t(t, e) {
7506
- for (var n = 0; n < e.length; n++) {
7507
- var r = e[n];
7508
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7509
- }
7510
- }
7511
- return function (e, n, r) {
7512
- return n && t(e.prototype, n), r && t(e, r), e;
7513
- };
7514
- }();
7515
- if (((r = t("./utility")) && r.__esModule ? r : {
7516
- "default": r
7517
- })["default"].isIe) {
7518
- var i = function i(t, e) {
7519
- e = e || {
7520
- bubbles: !1,
7521
- cancelable: !1,
7522
- detail: void 0
7523
- };
7524
- var n = document.createEvent("CustomEvent");
7525
- return n.initCustomEvent(t, e.bubbles, e.cancelable, e.detail), n;
7526
- };
7527
- i.prototype = e.Event.prototype, e.CustomEvent = i;
7528
- }
7529
- var u = {},
7530
- a = n.EventListener = function () {
7531
- function t() {
7532
- !function t(e, n) {
7533
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7534
- }(this, t);
7535
- }
7536
- return o(t, null, [{
7537
- key: "constructor",
7538
- value: function value() {
7539
- u = {};
7540
- }
7541
- }, {
7542
- key: "on",
7543
- value: function value(t, e) {
7544
- u[t] = e;
7545
- }
7546
- }, {
7547
- key: "off",
7548
- value: function value(t) {
7549
- u[t] = null;
7550
- }
7551
- }]), t;
7552
- }();
7553
- a.Event = function (t, e) {
7554
- this.eventType = t, this.data = e || {};
7555
- }, a.Event.eventTypes = {
7556
- resize: "resize",
7557
- transition: "transition",
7558
- close: "close",
7559
- complete: "complete",
7560
- clear: "clear"
7561
- };
7562
- var c = window.addEventListener ? "addEventListener" : "attachEvent",
7563
- s = window[c];
7564
- s("attachEvent" == c ? "onmessage" : "message", function (t) {
7565
- var n, r;
7566
- t.data.zipmoney && (n = t.data.msg, r = new e.CustomEvent("zipmoney", {
7567
- detail: n
7568
- }), e.dispatchEvent(r));
7569
- }, !1), s("zipmoney", function (t) {
7570
- var e,
7571
- n = u[t.detail.eventType];
7572
- n ? n(t.detail.data || {}) : (e = t, console.log("Unexpected Event", e));
7573
- }, !1);
7574
- }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
7575
- }, {
7576
- "./utility": 10
7577
- }],
7578
- 7: [function (t, e, n) {
7579
- (function (e) {
7580
-
7581
- var n = t("./checkout"),
7582
- r = t("./events");
7583
- e.Zip = e.Zip || {}, e.Zip.Checkout = n.Checkout, e.zipMoneyEvent = r.EventListener.ZipEvent;
7584
- }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
7585
- }, {
7586
- "./checkout": 4,
7587
- "./events": 6
7588
- }],
7589
- 8: [function (t, e, n) {
7590
-
7591
- function r(t) {
7592
- return t && t.__esModule ? t : {
7593
- "default": t
7594
- };
7595
- }
7596
- function o() {
7597
- return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
7598
- }
7599
- function i() {
7600
- var t = document.body,
7601
- e = document.documentElement;
7602
- return Math.max(t.scrollHeight, t.offsetHeight, e.clientHeight, e.scrollHeight, e.offsetHeight);
7603
- }
7604
- function u(t) {
7605
- for (var e = document.querySelectorAll("html, body"), n = 0; n < e.length; n++) e[n].style.overflowY = t;
7606
- }
7607
- function a(t) {
7608
- var e = document.body.currentStyle || window.getComputedStyle(document.body),
7609
- n = document.body.offsetHeight,
7610
- r = parseInt(e.marginTop, 10) + parseInt(e.marginBottom, 10),
7611
- o = n + r - parseInt(e.height, 10);
7612
- document.body.style.height = t - o + "px";
7613
- }
7614
- Object.defineProperty(n, "__esModule", {
7615
- value: !0
7616
- });
7617
- var c = function () {
7618
- function t(t, e) {
7619
- for (var n = 0; n < e.length; n++) {
7620
- var r = e[n];
7621
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7622
- }
7623
- }
7624
- return function (e, n, r) {
7625
- return n && t(e.prototype, n), r && t(e, r), e;
7626
- };
7627
- }(),
7628
- s = t("./utility"),
7629
- f = r(s),
7630
- l = t("./events"),
7631
- p = t("./console"),
7632
- d = (r(p), {
7633
- iframeWidth: 400,
7634
- iframeMinWidth: 320,
7635
- iframeInitialHeight: 704,
7636
- iframeMinHeight: 600,
7637
- verticalMargin: 35
7638
- }),
7639
- h = ["resize", "transition", "close", "complete", "clear"],
7640
- v = "https://d3k1w8lx8mqizo.cloudfront.net/zm/",
7641
- y = function () {
7642
- function t() {
7643
- var e = this;
7644
- ((function t(e, n) {
7645
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7646
- }))(this, t), this._events = [], this._isMobile = f["default"].isMobileDevice(), h.forEach(function (t) {
7647
- return l.EventListener.on(l.EventListener.Event.eventTypes[t], e[t].bind(e));
7648
- });
7649
- }
7650
- return c(t, [{
7651
- key: "build",
7652
- value: function value() {
7653
- this._initialHtmlHeight = i(), window.scrollTo(0, 0);
7654
- var t = this._frame = (e = this._frameUri, n = this._isMobile, (r = document.createElement("iframe")).id = "zipmoney-iframe", r.frameborder = 0, _extends(r.style, {
7655
- padding: "0",
7656
- border: "none",
7657
- zIndex: "999999",
7658
- backgroundColor: "#FFF",
7659
- backgroundImage: "url(" + v + "spinner.gif)",
7660
- backgroundRepeat: "no-repeat",
7661
- backgroundPosition: "50% 50%"
7662
- }), n ? _extends(r.style, {
7663
- overflow: "scroll",
7664
- width: "100%",
7665
- height: "100%",
7666
- position: "absolute",
7667
- top: "0",
7668
- bottom: "0",
7669
- left: "0",
7670
- right: "0",
7671
- margin: "0"
7672
- }) : _extends(r.style, {
7673
- width: d.iframeWidth + "px",
7674
- minWidth: d.iframeMinWidth + "px",
7675
- height: d.iframeInitialHeight + "px",
7676
- margin: d.verticalMargin + "px auto 0 auto",
7677
- display: "table-row",
7678
- backgroundSize: "25%",
7679
- textAlign: "center",
7680
- boxShadow: "0px 0px 70px 0px rgb(0, 0, 0)"
7681
- }), r.src = e || "", r);
7682
- if (!this._isMobile) {
7683
- var e,
7684
- n,
7685
- r,
7686
- o,
7687
- c,
7688
- s = ((o = document.createElement("img")).src = v + "icon-close.png", _extends(o.style, {
7689
- width: "50px",
7690
- height: "50px",
7691
- position: "absolute",
7692
- top: "20px",
7693
- right: "20px",
7694
- cursor: "pointer"
7695
- }), o);
7696
- s.onclick = this.close.bind(this), this._overlay = ((c = document.createElement("div")).className = "zipmoney-overlay", _extends(c.style, {
7697
- position: "absolute",
7698
- left: "0",
7699
- top: "0",
7700
- display: "table-cell",
7701
- textAlign: "center",
7702
- verticalAlign: "middle",
7703
- background: "rgba(0, 0, 0, 0.75)",
7704
- zIndex: "10000",
7705
- height: "100%",
7706
- width: "100%"
7707
- }), c), this._overlay.appendChild(s), this._overlay.appendChild(this._frame), t = this._overlay;
7708
- }
7709
- document.body.appendChild(t), this._isMobile && a(this._frame.offsetHeight), u("auto"), this._startMonitoringWindowResize();
7710
- }
7711
- }, {
7712
- key: "setUri",
7713
- value: function value(t) {
7714
- this._frameUri = t, this._frame && (this._frame.src = t);
7715
- }
7716
- }, {
7717
- key: "resize",
7718
- value: function value(t) {
7719
- var e = this._isMobile ? 16 : 0,
7720
- t = t >= d.iframeMinHeight ? t : d.iframeMinHeight,
7721
- n = (t += e) + 2 * d.verticalMargin,
7722
- r = o();
7723
- this._frame.style.height = t + "px", this._overlay && (this._overlay.style.height = Math.max(r, this._initialHtmlHeight, n) + "px"), this._isMobile && a(t);
7724
- }
7725
- }, {
7726
- key: "transition",
7727
- value: function value() {
7728
- window.scroll(0, 0);
7729
- }
7730
- }, {
7731
- key: "close",
7732
- value: function value() {
7733
- var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
7734
- e = {
7735
- state: "cancelled"
7736
- };
7737
- this._events.length && (e = this._events.pop()), this._destroy(), this.onClose && t && this.onClose(e);
7738
- }
7739
- }, {
7740
- key: "complete",
7741
- value: function value(t) {
7742
- this._events.push(t);
7743
- }
7744
- }, {
7745
- key: "clear",
7746
- value: function value(t) {
7747
- this._events = [];
7748
- }
7749
- }, {
7750
- key: "_startMonitoringWindowResize",
7751
- value: function value() {
7752
- var t = this;
7753
- this._resizeHandler = f["default"].debounce(function () {
7754
- var e, n, r, u;
7755
- return e = t, n = o(), r = i(), u = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, void (e._overlay && (e._overlay.style.height = Math.max(n, r) + "px"), e._isMobile || u < d.iframeWidth ? e._frame.style.width = "100%" : e._frame.style.width = d.iframeWidth + "px");
7756
- }, 250), f["default"].addEventHandler(window, "resize", this._resizeHandler);
7757
- }
7758
- }, {
7759
- key: "_stopMonitoringWindowResize",
7760
- value: function value() {
7761
- f["default"].removeEventHandler(window, "resize", this._resizeHandler);
7762
- }
7763
- }, {
7764
- key: "_destroy",
7765
- value: function value() {
7766
- this._stopMonitoringWindowResize(), this._overlay ? document.body.removeChild(this._overlay) : document.body.removeChild(this._frame), this._isMobile && (document.body.style.height = "initial"), u("initial"), this._overlay = this._frame = null, h.forEach(function (t) {
7767
- return l.EventListener.off(l.EventListener.Event.eventTypes[t]);
7768
- });
7769
- }
7770
- }]), t;
7771
- }();
7772
- n["default"] = y;
7773
- }, {
7774
- "./console": 5,
7775
- "./events": 6,
7776
- "./utility": 10
7777
- }],
7778
- 9: [function (t, e, n) {
7779
-
7780
- function r(t) {
7781
- return t && t.__esModule ? t : {
7782
- "default": t
7783
- };
7784
- }
7785
- Object.defineProperty(n, "__esModule", {
7786
- value: !0
7787
- });
7788
- var o = t("./xr"),
7789
- i = r(o),
7790
- u = t("./console"),
7791
- a = r(u);
7792
- i["default"].configure({
7793
- headers: {
7794
- "X-Requested-With": "XMLHttpRequest"
7795
- }
7796
- }), n["default"] = {
7797
- request: "standard",
7798
- redirect: !1,
7799
- logLevel: "Error",
7800
- onCheckout: function onCheckout(t, e, n) {
7801
- i["default"].post(this.checkoutUri).then(function (e) {
7802
- return t(e.data);
7803
- })["catch"](e);
7804
- },
7805
- onShippingAddressChanged: function onShippingAddressChanged(t, e, n) {
7806
- i["default"].post(this.shippingUri).then(t)["catch"](e);
7807
- },
7808
- onComplete: function onComplete(t) {
7809
- if (a["default"].information("zip:completed", t), "cancelled" !== t.state) {
7810
- var e = t.checkoutId ? "&checkoutId=" + t.checkoutId : "";
7811
- this.redirectFn(this.redirectUri + "?result=" + t.state + e);
7812
- }
7813
- },
7814
- onError: function onError(t) {
7815
- a["default"].error(t);
7816
- },
7817
- redirectFn: function redirectFn(t) {
7818
- window.location.href = t;
7819
- }
7820
- };
7821
- }, {
7822
- "./console": 5,
7823
- "./xr": 11
7824
- }],
7825
- 10: [function (t, e, n) {
6480
+ var ZIPMONEY_PROXY_REDIRECT_URL = '/checkout/zipmoney/response';
6481
+ var ZIPMONEY_DEFAULT_SUSPENDED_URL = '/checkout/zipmoney/suspended';
6482
+ var ZIPMONEY_MESSAGE_SOURCE = 'zipmoney.checkout.paydock';
6483
+ var ZIPMONEY_CONTEXTUAL_LOADING_URL = '/checkout/zipmoney/loading';
7826
6484
 
7827
- Object.defineProperty(n, "__esModule", {
7828
- value: !0
7829
- });
7830
- var r = function () {
7831
- function t(t, e) {
7832
- for (var n = 0; n < e.length; n++) {
7833
- var r = e[n];
7834
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7835
- }
7836
- }
7837
- return function (e, n, r) {
7838
- return n && t(e.prototype, n), r && t(e, r), e;
7839
- };
7840
- }(),
7841
- o = function () {
7842
- function t() {
7843
- !function t(e, n) {
7844
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7845
- }(this, t);
7846
- }
7847
- return r(t, null, [{
7848
- key: "isIe",
7849
- value: function value() {
7850
- var t = -1,
7851
- e = window.navigator.userAgent,
7852
- n = e.indexOf("MSIE "),
7853
- r = e.indexOf("Trident/");
7854
- if (n > 0) t = parseInt(e.substring(n + 5, e.indexOf(".", n)), 10);else if (r > 0) {
7855
- var o = e.indexOf("rv:");
7856
- t = parseInt(e.substring(o + 3, e.indexOf(".", o)), 10);
7857
- }
7858
- return t > -1 ? t : void 0;
7859
- }
7860
- }, {
7861
- key: "isMobileDevice",
7862
- value: function value() {
7863
- var t = navigator.userAgent || navigator.vendor || window.opera;
7864
- return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4));
7865
- }
7866
- }, {
7867
- key: "debounce",
7868
- value: function value(t, e) {
7869
- var n;
7870
- return function () {
7871
- var r = this,
7872
- o = arguments,
7873
- i = function i() {
7874
- n = null, t.apply(r, o);
7875
- },
7876
- u = !n;
7877
- clearTimeout(n), n = setTimeout(i, e), u && t.apply(r, o);
7878
- };
7879
- }
7880
- }, {
7881
- key: "addEventHandler",
7882
- value: function value(t, e, n) {
7883
- t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent && t.attachEvent("on" + e, n);
7884
- }
7885
- }, {
7886
- key: "removeEventHandler",
7887
- value: function value(t, e, n) {
7888
- t.removeEventListener ? t.removeEventListener(e, n, !1) : t.detachEvent && t.detachEvent("on" + e, n);
7889
- }
7890
- }]), t;
7891
- }();
7892
- n["default"] = o;
7893
- }, {}],
7894
- 11: [function (t, e, n) {
7895
-
7896
- function r(t) {
7897
- return t && t.__esModule ? t : {
7898
- "default": t
7899
- };
7900
- }
7901
- function o(t, e) {
7902
- return {
7903
- status: t.status,
7904
- response: t.response,
7905
- data: e,
7906
- xhr: t
7907
- };
7908
- }
7909
- function i(t) {
7910
- for (var e = arguments.length, n = Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r];
7911
- for (var o in n) if ({}.hasOwnProperty.call(n, o)) {
7912
- var i = n[o];
7913
- if ("object" === (void 0 === i ? "undefined" : a(i))) for (var u in i) ({}).hasOwnProperty.call(i, u) && (t[u] = i[u]);
7914
- }
7915
- return t;
7916
- }
7917
- function u(t) {
7918
- var e, n;
7919
- return e = t, n = function n(e, _n) {
7920
- var r = i({}, h, v, t),
7921
- u = r.xmlHttpRequest();
7922
- for (var c in r.abort && t.abort(function () {
7923
- _n(o(u)), u.abort();
7924
- }), u.open(r.method, r.params ? r.url.split("?")[0] + "?" + (0, s["default"])(r.params) : r.url, !0), u.withCredentials = r.withCredentials, u.addEventListener(d.LOAD, function () {
7925
- if (u.status >= 200 && u.status < 300) {
7926
- var t = null;
7927
- u.responseText && (t = !0 === r.raw ? u.responseText : r.load(u.responseText)), e(o(u, t));
7928
- } else _n(o(u));
7929
- }), u.addEventListener(d.ABORT, function () {
7930
- return _n(o(u));
7931
- }), u.addEventListener(d.ERROR, function () {
7932
- return _n(o(u));
7933
- }), u.addEventListener(d.TIMEOUT, function () {
7934
- return _n(o(u));
7935
- }), r.headers) ({}).hasOwnProperty.call(r.headers, c) && u.setRequestHeader(c, r.headers[c]);
7936
- for (var f in r.events) ({}).hasOwnProperty.call(r.events, f) && u.addEventListener(f, r.events[f].bind(null, u), !1);
7937
- var l = "object" !== a(r.data) || r.raw ? r.data : r.dump(r.data);
7938
- void 0 !== l ? u.send(l) : u.send();
7939
- }, (e && e.promise ? e.promise : v.promise || h.promise)(n);
7940
- }
7941
- Object.defineProperty(n, "__esModule", {
7942
- value: !0
7943
- });
7944
- var a = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (t) {
7945
- return _typeof$1(t);
7946
- } : function (t) {
7947
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : _typeof$1(t);
7948
- },
7949
- c = t("querystring/encode"),
7950
- s = r(c),
7951
- f = t("q"),
7952
- l = r(f),
7953
- p = {
7954
- GET: "GET",
7955
- POST: "POST",
7956
- PUT: "PUT",
7957
- DELETE: "DELETE",
7958
- PATCH: "PATCH",
7959
- OPTIONS: "OPTIONS"
7960
- },
7961
- d = {
7962
- READY_STATE_CHANGE: "readystatechange",
7963
- LOAD_START: "loadstart",
7964
- PROGRESS: "progress",
7965
- ABORT: "abort",
7966
- ERROR: "error",
7967
- LOAD: "load",
7968
- TIMEOUT: "timeout",
7969
- LOAD_END: "loadend"
7970
- },
7971
- h = {
7972
- method: p.GET,
7973
- data: void 0,
7974
- headers: {
7975
- Accept: "application/json",
7976
- "Content-Type": "application/json"
7977
- },
7978
- dump: JSON.stringify,
7979
- load: JSON.parse,
7980
- xmlHttpRequest: function xmlHttpRequest() {
7981
- return new XMLHttpRequest();
7982
- },
7983
- promise: function promise(t) {
7984
- return l["default"].Promise(t);
7985
- },
7986
- withCredentials: !1
7987
- },
7988
- v = {};
7989
- u.assign = i, u.encode = s["default"], u.configure = function t(e) {
7990
- v = i({}, v, e);
7991
- }, u.Methods = p, u.Events = d, u.defaults = h, u.get = function (t, e, n) {
7992
- return u(i({
7993
- url: t,
7994
- method: p.GET,
7995
- params: e
7996
- }, n));
7997
- }, u.put = function (t, e, n) {
7998
- return u(i({
7999
- url: t,
8000
- method: p.PUT,
8001
- data: e
8002
- }, n));
8003
- }, u.post = function (t, e, n) {
8004
- return u(i({
8005
- url: t,
8006
- method: p.POST,
8007
- data: e
8008
- }, n));
8009
- }, u.patch = function (t, e, n) {
8010
- return u(i({
8011
- url: t,
8012
- method: p.PATCH,
8013
- data: e
8014
- }, n));
8015
- }, u.del = function (t, e) {
8016
- return u(i({
8017
- url: t,
8018
- method: p.DELETE
8019
- }, e));
8020
- }, u.options = function (t, e) {
8021
- return u(i({
8022
- url: t,
8023
- method: p.OPTIONS
8024
- }, e));
8025
- }, n["default"] = u;
8026
- }, {
8027
- q: 2,
8028
- "querystring/encode": 3
8029
- }]
8030
- }, {}, [7]);
8031
-
8032
- var ECHO_URI = '/v1/echo';
8033
6485
  var LOG_PREFIX$1 = '[CheckoutButton:Zipmoney]';
8034
6486
  var ZipmoneyRunner = /*#__PURE__*/function (_BaseRunner) {
8035
6487
  function ZipmoneyRunner() {
@@ -8046,29 +6498,26 @@
8046
6498
  _superPropGet(ZipmoneyRunner, "setEnv", this)([env, alias]);
8047
6499
  this.apiEnv.setEnv(env, alias);
8048
6500
  }
8049
- }, {
8050
- key: "getCheckoutUri",
8051
- value: function getCheckoutUri(redirectUri) {
8052
- return this.apiEnv.getConf().url + ECHO_URI + '?' + Url.serialize({
8053
- json_body: JSON.stringify({
8054
- redirect_uri: redirectUri
8055
- })
8056
- });
8057
- }
8058
6501
  }]);
8059
6502
  }(BaseRunner);
8060
6503
 
8061
- var ZIPMONEY_PROXY_REDIRECT_URL = '/checkout/zipmoney/response';
8062
- var ZIPMONEY_DEFAULT_SUSPENDED_URL = '/checkout/zipmoney/suspended';
8063
- var ZIPMONEY_MESSAGE_SOURCE = 'zipmoney.checkout.paydock';
8064
-
6504
+ var ZIPMONEY_STATE;
6505
+ (function (ZIPMONEY_STATE) {
6506
+ ZIPMONEY_STATE["APPROVED"] = "approved";
6507
+ ZIPMONEY_STATE["DECLINED"] = "declined";
6508
+ ZIPMONEY_STATE["CANCELLED"] = "cancelled";
6509
+ ZIPMONEY_STATE["REFERRED"] = "referred";
6510
+ })(ZIPMONEY_STATE || (ZIPMONEY_STATE = {}));
8065
6511
  var ZipmoneyContextualRunner = /*#__PURE__*/function (_ContextualRunner) {
8066
6512
  function ZipmoneyContextualRunner() {
8067
6513
  var _this;
8068
6514
  _classCallCheck(this, ZipmoneyContextualRunner);
8069
6515
  _this = _callSuper(this, ZipmoneyContextualRunner);
8070
6516
  _this.runs = false;
6517
+ _this.widgetId = Uuid.generate();
6518
+ _this.checkoutTab = null;
8071
6519
  _this.eventEmitter = new EventEmitter();
6520
+ _this.event = new IFrameEvent(window);
8072
6521
  return _this;
8073
6522
  }
8074
6523
  _inherits(ZipmoneyContextualRunner, _ContextualRunner);
@@ -8077,6 +6526,9 @@
8077
6526
  value: function run() {
8078
6527
  this.runs = true;
8079
6528
  this.background.initLoader();
6529
+ this.checkoutTab = window.open(this.getLoadingUrl(), '_blank');
6530
+ this.checkInterval = this.setCloseTabInterval();
6531
+ this.setCompleteCheckoutListener();
8080
6532
  }
8081
6533
  }, {
8082
6534
  key: "isRunning",
@@ -8086,24 +6538,19 @@
8086
6538
  }, {
8087
6539
  key: "next",
8088
6540
  value: function next(checkoutData) {
8089
- var _this2 = this;
8090
- this.background.clear();
6541
+ var _a;
8091
6542
  this.checkout = checkoutData;
8092
- var checkoutUri = this.getCheckoutUri(this.checkout.link);
8093
- Zip.Checkout.init({
8094
- checkoutUri: checkoutUri,
8095
- onComplete: function onComplete(args) {
8096
- return _this2.eventHandler(args);
8097
- },
8098
- onError: function onError(args) {
8099
- return _this2.eventHandler(args);
8100
- }
8101
- });
6543
+ (_a = this.checkoutTab) === null || _a === void 0 ? void 0 : _a.location.replace(checkoutData.link);
8102
6544
  }
8103
6545
  }, {
8104
6546
  key: "getSuccessRedirectUri",
8105
6547
  value: function getSuccessRedirectUri() {
8106
- return this.suspendedRedirectUri ? this.suspendedRedirectUri : this.widgetEnv.getConf().url + String(ZIPMONEY_DEFAULT_SUSPENDED_URL);
6548
+ var base = this.widgetEnv.getConf().url;
6549
+ var path = String(ZIPMONEY_DEFAULT_SUSPENDED_URL);
6550
+ var url = new URL(path, base);
6551
+ url.searchParams.set('widgetId', this.widgetId);
6552
+ url.searchParams.set('domain', window.location.origin);
6553
+ return url.toString();
8107
6554
  }
8108
6555
  }, {
8109
6556
  key: "getErrorRedirectUri",
@@ -8116,46 +6563,50 @@
8116
6563
  _superPropGet(ZipmoneyContextualRunner, "stop", this)([]);
8117
6564
  this.runs = false;
8118
6565
  var element = document.querySelector('.zipmoney-overlay');
8119
- if (element) element.remove();
6566
+ if (element) {
6567
+ element.remove();
6568
+ }
6569
+ if (this.checkoutTab && !this.checkoutTab.closed) {
6570
+ clearInterval(this.checkInterval);
6571
+ this.checkoutTab.close();
6572
+ }
8120
6573
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8121
6574
  }
8122
6575
  }, {
8123
6576
  key: "onStop",
8124
6577
  value: function onStop(cb) {
8125
- var _this3 = this;
6578
+ var _this2 = this;
8126
6579
  this.eventEmitter.subscribe(RUNNER_EVENT.CLOSE, function () {
8127
- _this3.background.clear();
6580
+ _this2.background.clear();
8128
6581
  cb();
8129
6582
  });
8130
6583
  }
8131
6584
  }, {
8132
6585
  key: "onCheckout",
8133
6586
  value: function onCheckout(event, cb) {
8134
- var _this4 = this;
6587
+ var _this3 = this;
8135
6588
  this.eventEmitter.subscribe(event, function () {
8136
- cb(_this4.checkout);
6589
+ cb(_this3.checkout);
8137
6590
  });
8138
6591
  }
8139
6592
  }, {
8140
6593
  key: "eventHandler",
8141
6594
  value: function eventHandler(args) {
8142
6595
  this.runs = false;
8143
- // Ambient enum Zip prevents migration from typescript & babel to swc
8144
- // https://www.npmjs.com/package/@rollup/plugin-swc
8145
- // https://swc.rs/docs/migrating-from-tsc
6596
+ this.background.clear();
8146
6597
  switch (args.state) {
8147
- case "approved" /* Zip.ZIPMONEY_STATE.APPROVED */:
6598
+ case ZIPMONEY_STATE.APPROVED:
8148
6599
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8149
6600
  this.eventEmitter.emit(RUNNER_EVENT.SUCCESS);
8150
6601
  break;
8151
- case "declined" /* Zip.ZIPMONEY_STATE.DECLINED */:
6602
+ case ZIPMONEY_STATE.DECLINED:
8152
6603
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8153
6604
  this.eventEmitter.emit(RUNNER_EVENT.DECLINED);
8154
6605
  break;
8155
- case "cancelled" /* Zip.ZIPMONEY_STATE.CANCELLED */:
6606
+ case ZIPMONEY_STATE.CANCELLED:
8156
6607
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8157
6608
  break;
8158
- case "referred" /* Zip.ZIPMONEY_STATE.REFERRED */:
6609
+ case ZIPMONEY_STATE.REFERRED:
8159
6610
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8160
6611
  this.eventEmitter.emit(RUNNER_EVENT.REFERRED);
8161
6612
  break;
@@ -8164,6 +6615,41 @@
8164
6615
  break;
8165
6616
  }
8166
6617
  }
6618
+ }, {
6619
+ key: "setCloseTabInterval",
6620
+ value: function setCloseTabInterval() {
6621
+ var _this4 = this;
6622
+ var checkInterval = setInterval(function () {
6623
+ var _a;
6624
+ if ((_a = _this4.checkoutTab) === null || _a === void 0 ? void 0 : _a.closed) {
6625
+ clearInterval(checkInterval);
6626
+ _this4.event.clear();
6627
+ _this4.stop();
6628
+ }
6629
+ }, 500);
6630
+ return checkInterval;
6631
+ }
6632
+ }, {
6633
+ key: "setCompleteCheckoutListener",
6634
+ value: function setCompleteCheckoutListener() {
6635
+ var _this5 = this;
6636
+ this.event.on(EVENT$4.FINISH, this.widgetId, function (event) {
6637
+ _this5.event.clear();
6638
+ clearInterval(_this5.checkInterval);
6639
+ if (_this5.checkoutTab && !_this5.checkoutTab.closed) {
6640
+ _this5.checkoutTab.close();
6641
+ }
6642
+ _this5.eventHandler(event);
6643
+ });
6644
+ }
6645
+ }, {
6646
+ key: "getLoadingUrl",
6647
+ value: function getLoadingUrl() {
6648
+ var base = this.widgetEnv.getConf().url;
6649
+ var path = String(ZIPMONEY_CONTEXTUAL_LOADING_URL);
6650
+ var url = new URL(path, base);
6651
+ return url.toString();
6652
+ }
8167
6653
  }]);
8168
6654
  }(ContextualRunner(ZipmoneyRunner));
8169
6655
 
@@ -8280,11 +6766,7 @@
8280
6766
  data: widgetSessionData
8281
6767
  }, {
8282
6768
  onSuccess: function onSuccess() {
8283
- var checkoutUri = _this2.getCheckoutUri(checkout.link);
8284
- Zip.Checkout.init({
8285
- checkoutUri: checkoutUri,
8286
- redirect: true
8287
- });
6769
+ window.location.href = checkout.link;
8288
6770
  },
8289
6771
  onError: function onError() {
8290
6772
  console.error('Error initializing Zip Checkout');
@@ -13497,6 +11979,7 @@
13497
11979
  _this.gatewayName = gatewayName;
13498
11980
  _this.eventEmitter = eventEmitter;
13499
11981
  _this.processingButtonClick = false;
11982
+ _this.isProcessingAuthorization = false;
13500
11983
  _this.parseUpdateData = function (data) {
13501
11984
  var _a, _b, _c, _d, _e, _f;
13502
11985
  var shippingOption = (_b = (_a = _this.meta) === null || _a === void 0 ? void 0 : _a.shipping_options) === null || _b === void 0 ? void 0 : _b.find(function (o) {
@@ -13571,6 +12054,7 @@
13571
12054
  key: "load",
13572
12055
  value: function load(container) {
13573
12056
  var _this2 = this;
12057
+ this.processingButtonClick = false;
13574
12058
  if (!window.Promise) {
13575
12059
  // Given that this library does not rely in any polyfill for promises, and this integration depends on them, we early return if Promises are not supported for the browser (like I.E. 11).
13576
12060
  this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
@@ -13698,7 +12182,10 @@
13698
12182
  key: "onGooglePayButtonClicked",
13699
12183
  value: function onGooglePayButtonClicked() {
13700
12184
  var _this4 = this;
13701
- if (this.processingButtonClick) return;
12185
+ if (this.processingButtonClick) {
12186
+ console.warn("Google Pay button clicked while processing.");
12187
+ return;
12188
+ }
13702
12189
  this.processingButtonClick = true;
13703
12190
  this.handleMerchantOnButtonClickEvent().then(function () {
13704
12191
  _this4.loadPaymentData()["finally"](function () {
@@ -13741,6 +12228,7 @@
13741
12228
  case 0:
13742
12229
  return _context2.abrupt("return", this.paymentsClient.loadPaymentData(this.createPaymentDataRequest())["catch"](function (err) {
13743
12230
  _this6.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
12231
+ _this6.processingButtonClick = false;
13744
12232
  console.error('Error while loading payment data', err);
13745
12233
  throw err;
13746
12234
  }));
@@ -13768,74 +12256,92 @@
13768
12256
  var shippingContactFirstName = (_p = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _p === void 0 ? void 0 : _p.name;
13769
12257
  var shippingContactEmail = paymentData === null || paymentData === void 0 ? void 0 : paymentData.email;
13770
12258
  var shippingContactPhone = (_q = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _q === void 0 ? void 0 : _q.phoneNumber;
13771
- return new Promise(function (resolve) {
13772
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
13773
- return _this7.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
13774
- data: _extends({
13775
- customer: {
13776
- payment_source: _extends(_extends(_extends(_extends({
13777
- wallet_type: WALLET_TYPE.GOOGLE,
13778
- // card_name: paymentData.shippingAddress?.name, // TODO: Do we want to use this value? Point 2 at https://paydock.atlassian.net/browse/P2-7209?focusedCommentId=60202
13779
- type: paymentData.paymentMethodData.type,
13780
- card_scheme: (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.cardNetwork
13781
- }, billingAddressLine1 && {
13782
- address_line1: billingAddressLine1
13783
- }), billingAddressLine2 && {
13784
- address_line2: billingAddressLine2
13785
- }), billingAddressLine2 && {
13786
- address_line2: billingAddressLine2
12259
+ var onPaymentAuthorizedResponse = new Promise(function (resolve) {
12260
+ var emitPaymentEvent = function emitPaymentEvent() {
12261
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
12262
+ _this7.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
12263
+ data: _extends({
12264
+ customer: {
12265
+ payment_source: _extends(_extends(_extends({
12266
+ wallet_type: WALLET_TYPE.GOOGLE,
12267
+ type: paymentData.paymentMethodData.type,
12268
+ card_scheme: (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.cardNetwork
12269
+ }, billingAddressLine1 && {
12270
+ address_line1: billingAddressLine1
12271
+ }), billingAddressLine2 && {
12272
+ address_line2: billingAddressLine2
12273
+ }), {
12274
+ address_country: (_e = (_d = (_c = paymentData.paymentMethodData) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.billingAddress) === null || _e === void 0 ? void 0 : _e.countryCode,
12275
+ address_city: (_h = (_g = (_f = paymentData.paymentMethodData) === null || _f === void 0 ? void 0 : _f.info) === null || _g === void 0 ? void 0 : _g.billingAddress) === null || _h === void 0 ? void 0 : _h.locality,
12276
+ address_postcode: (_l = (_k = (_j = paymentData.paymentMethodData) === null || _j === void 0 ? void 0 : _j.info) === null || _k === void 0 ? void 0 : _k.billingAddress) === null || _l === void 0 ? void 0 : _l.postalCode,
12277
+ address_state: (_p = (_o = (_m = paymentData.paymentMethodData) === null || _m === void 0 ? void 0 : _m.info) === null || _o === void 0 ? void 0 : _o.billingAddress) === null || _p === void 0 ? void 0 : _p.administrativeArea,
12278
+ ref_token: paymentData.paymentMethodData.tokenizationData.token
12279
+ })
12280
+ }
12281
+ }, _this7.isShippingRequired() && {
12282
+ shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && {
12283
+ method: shippingOptionMethod
12284
+ }), _this7.hasShippingOptions() && {
12285
+ options: _this7.meta.shipping_options
12286
+ }), shippingAddressLine1 && {
12287
+ address_line1: shippingAddressLine1
12288
+ }), shippingAddressLine2 && {
12289
+ address_line2: shippingAddressLine2
12290
+ }), shippingAddressCountry && {
12291
+ address_country: shippingAddressCountry
12292
+ }), shippingAddressCity && {
12293
+ address_city: shippingAddressCity
12294
+ }), shippingAddressPostCode && {
12295
+ address_postcode: shippingAddressPostCode
12296
+ }), shippingAddressState && {
12297
+ address_state: shippingAddressState
13787
12298
  }), {
13788
- address_country: (_e = (_d = (_c = paymentData.paymentMethodData) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.billingAddress) === null || _e === void 0 ? void 0 : _e.countryCode,
13789
- address_city: (_h = (_g = (_f = paymentData.paymentMethodData) === null || _f === void 0 ? void 0 : _f.info) === null || _g === void 0 ? void 0 : _g.billingAddress) === null || _h === void 0 ? void 0 : _h.locality,
13790
- address_postcode: (_l = (_k = (_j = paymentData.paymentMethodData) === null || _j === void 0 ? void 0 : _j.info) === null || _k === void 0 ? void 0 : _k.billingAddress) === null || _l === void 0 ? void 0 : _l.postalCode,
13791
- address_state: (_p = (_o = (_m = paymentData.paymentMethodData) === null || _m === void 0 ? void 0 : _m.info) === null || _o === void 0 ? void 0 : _o.billingAddress) === null || _p === void 0 ? void 0 : _p.administrativeArea,
13792
- ref_token: paymentData.paymentMethodData.tokenizationData.token
12299
+ contact: _extends(_extends(_extends({}, shippingContactFirstName && {
12300
+ first_name: shippingContactFirstName
12301
+ }), shippingContactEmail && {
12302
+ email: shippingContactEmail
12303
+ }), shippingContactPhone && {
12304
+ phone: shippingContactPhone
12305
+ })
13793
12306
  })
12307
+ }),
12308
+ onSuccess: function onSuccess() {
12309
+ _this7.processingButtonClick = false;
12310
+ _this7.isProcessingAuthorization = false;
12311
+ resolve({
12312
+ transactionState: 'SUCCESS'
12313
+ });
12314
+ },
12315
+ onError: function onError(error) {
12316
+ _this7.processingButtonClick = false;
12317
+ _this7.isProcessingAuthorization = false;
12318
+ resolve({
12319
+ transactionState: 'ERROR',
12320
+ error: {
12321
+ intent: 'PAYMENT_AUTHORIZATION',
12322
+ message: (error === null || error === void 0 ? void 0 : error.message) || 'Error processing payment',
12323
+ reason: 'PAYMENT_DATA_INVALID'
12324
+ }
12325
+ });
13794
12326
  }
13795
- }, _this7.isShippingRequired() && {
13796
- shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && {
13797
- method: shippingOptionMethod
13798
- }), _this7.hasShippingOptions() && {
13799
- options: _this7.meta.shipping_options
13800
- }), shippingAddressLine1 && {
13801
- address_line1: shippingAddressLine1
13802
- }), shippingAddressLine2 && {
13803
- address_line2: shippingAddressLine2
13804
- }), shippingAddressCountry && {
13805
- address_country: shippingAddressCountry
13806
- }), shippingAddressCity && {
13807
- address_city: shippingAddressCity
13808
- }), shippingAddressPostCode && {
13809
- address_postcode: shippingAddressPostCode
13810
- }), shippingAddressState && {
13811
- address_state: shippingAddressState
13812
- }), {
13813
- contact: _extends(_extends(_extends({}, shippingContactFirstName && {
13814
- first_name: shippingContactFirstName
13815
- }), shippingContactEmail && {
13816
- email: shippingContactEmail
13817
- }), shippingContactPhone && {
13818
- phone: shippingContactPhone
13819
- })
13820
- })
13821
- }),
13822
- onSuccess: function onSuccess() {
13823
- return resolve({
13824
- transactionState: 'SUCCESS'
13825
- });
13826
- },
13827
- onError: function onError(error) {
13828
- return resolve({
13829
- transactionState: 'ERROR',
13830
- error: {
13831
- intent: 'PAYMENT_AUTHORIZATION',
13832
- message: (error === null || error === void 0 ? void 0 : error.message) || 'Error processing payment',
13833
- reason: 'PAYMENT_DATA_INVALID'
13834
- }
13835
- });
13836
- }
13837
- });
12327
+ });
12328
+ };
12329
+ if (_this7.isProcessingAuthorization) {
12330
+ console.warn("Duplicate payment authorization detected. Ignoring.");
12331
+ resolve({
12332
+ transactionState: 'ERROR',
12333
+ error: {
12334
+ intent: 'PAYMENT_AUTHORIZATION',
12335
+ message: 'Another payment authorization is already in progress',
12336
+ reason: 'OTHER_ERROR'
12337
+ }
12338
+ });
12339
+ } else {
12340
+ _this7.isProcessingAuthorization = true;
12341
+ emitPaymentEvent();
12342
+ }
13838
12343
  });
12344
+ return onPaymentAuthorizedResponse;
13839
12345
  }
13840
12346
  }, {
13841
12347
  key: "onPaymentDataChanged",
@@ -18499,6 +17005,9 @@
18499
17005
  switch (version) {
18500
17006
  case 1:
18501
17007
  return new InstructionModuleV1();
17008
+ case 2:
17009
+ //Note this is using V1 instructions for now
17010
+ return new InstructionModuleV1();
18502
17011
  default:
18503
17012
  return null;
18504
17013
  }
@@ -18635,7 +17144,8 @@
18635
17144
  this.checkoutApi.callback({
18636
17145
  event: 'callback.generic.ready',
18637
17146
  payload: {
18638
- platform: 'web'
17147
+ platform: 'web',
17148
+ sdk_version: this.api.ctx.sdkVersion
18639
17149
  }
18640
17150
  }).then(function () {
18641
17151
  return Spinner.hide();
@@ -20454,6 +18964,8 @@
20454
18964
  }]);
20455
18965
  }();
20456
18966
 
18967
+ window.postMessage("PAYDOCK_PAYMENTS_WIDGET_LOADED");
18968
+
20457
18969
  class Timer {
20458
18970
  constructor(opts, ms) {
20459
18971
  if (!opts.onEnd) throw new Error('onEnd handler is required');