@paydock/client-sdk 1.124.1 → 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.
package/bundles/index.mjs CHANGED
@@ -952,7 +952,7 @@ SDK.headerKeys = Object.freeze({
952
952
  version: 'x-sdk-version',
953
953
  type: 'x-sdk-type'
954
954
  });
955
- SDK._version = 'v1.124.1';
955
+ SDK._version = '1.126.0-beta';
956
956
 
957
957
  /******************************************************************************
958
958
  Copyright (c) Microsoft Corporation.
@@ -1229,7 +1229,7 @@ function execFinalizer(finalizer) {
1229
1229
  }
1230
1230
  }
1231
1231
 
1232
- var config$1 = {
1232
+ var config = {
1233
1233
  onUnhandledError: null,
1234
1234
  onStoppedNotification: null,
1235
1235
  Promise: undefined,
@@ -1395,7 +1395,7 @@ var SafeSubscriber = (function (_super) {
1395
1395
  }
1396
1396
  else {
1397
1397
  var context_1;
1398
- if (_this && config$1.useDeprecatedNextContext) {
1398
+ if (_this && config.useDeprecatedNextContext) {
1399
1399
  context_1 = Object.create(observerOrNext);
1400
1400
  context_1.unsubscribe = function () { return _this.unsubscribe(); };
1401
1401
  partialObserver = {
@@ -1531,7 +1531,7 @@ var Observable = (function () {
1531
1531
  }());
1532
1532
  function getPromiseCtor(promiseCtor) {
1533
1533
  var _a;
1534
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$1.Promise) !== null && _a !== void 0 ? _a : Promise;
1534
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
1535
1535
  }
1536
1536
  function isObserver(value) {
1537
1537
  return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
@@ -6471,1559 +6471,11 @@ function isRedirectRunner(runner) {
6471
6471
  return 'setRedirectUrl' in runner;
6472
6472
  }
6473
6473
 
6474
- !function t(e, n, r) {
6475
- function o(u, a) {
6476
- if (!n[u]) {
6477
- if (!e[u]) {
6478
- var c = "function" == typeof require && require;
6479
- if (!a && c) return c(u, !0);
6480
- if (i) return i(u, !0);
6481
- var s = Error("Cannot find module '" + u + "'");
6482
- throw s.code = "MODULE_NOT_FOUND", s;
6483
- }
6484
- var f = n[u] = {
6485
- exports: {}
6486
- };
6487
- e[u][0].call(f.exports, function (t) {
6488
- return o(e[u][1][t] || t);
6489
- }, f, f.exports, t, e, n, r);
6490
- }
6491
- return n[u].exports;
6492
- }
6493
- for (var i = "function" == typeof require && require, u = 0; u < r.length; u++) o(r[u]);
6494
- return o;
6495
- }({
6496
- 1: [function (t, e, n) {
6497
- function r() {
6498
- throw Error("setTimeout has not been defined");
6499
- }
6500
- function o() {
6501
- throw Error("clearTimeout has not been defined");
6502
- }
6503
- function i(t) {
6504
- if (f === setTimeout) return setTimeout(t, 0);
6505
- if ((f === r || !f) && setTimeout) return f = setTimeout, setTimeout(t, 0);
6506
- try {
6507
- return f(t, 0);
6508
- } catch (e) {
6509
- try {
6510
- return f.call(null, t, 0);
6511
- } catch (n) {
6512
- return f.call(this, t, 0);
6513
- }
6514
- }
6515
- }
6516
- function u() {
6517
- v && d && (v = !1, d.length ? h = d.concat(h) : y = -1, h.length && a());
6518
- }
6519
- function a() {
6520
- if (!v) {
6521
- var t = i(u);
6522
- v = !0;
6523
- for (var e = h.length; e;) {
6524
- for (d = h, h = []; ++y < e;) d && d[y].run();
6525
- y = -1, e = h.length;
6526
- }
6527
- d = null, v = !1, function t(e) {
6528
- if (l === clearTimeout) return clearTimeout(e);
6529
- if ((l === o || !l) && clearTimeout) return l = clearTimeout, clearTimeout(e);
6530
- try {
6531
- return l(e);
6532
- } catch (n) {
6533
- try {
6534
- return l.call(null, e);
6535
- } catch (r) {
6536
- return l.call(this, e);
6537
- }
6538
- }
6539
- }(t);
6540
- }
6541
- }
6542
- function c(t, e) {
6543
- this.fun = t, this.array = e;
6544
- }
6545
- function s() {}
6546
- var f,
6547
- l,
6548
- p = e.exports = {};
6549
- !function () {
6550
- try {
6551
- f = "function" == typeof setTimeout ? setTimeout : r;
6552
- } catch (t) {
6553
- f = r;
6554
- }
6555
- try {
6556
- l = "function" == typeof clearTimeout ? clearTimeout : o;
6557
- } catch (e) {
6558
- l = o;
6559
- }
6560
- }();
6561
- var d,
6562
- h = [],
6563
- v = !1,
6564
- y = -1;
6565
- p.nextTick = function (t) {
6566
- var e = Array(arguments.length - 1);
6567
- if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
6568
- h.push(new c(t, e)), 1 !== h.length || v || i(a);
6569
- }, c.prototype.run = function () {
6570
- this.fun.apply(null, this.array);
6571
- }, 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) {
6572
- return [];
6573
- }, p.binding = function (t) {
6574
- throw Error("process.binding is not supported");
6575
- }, p.cwd = function () {
6576
- return "/";
6577
- }, p.chdir = function (t) {
6578
- throw Error("process.chdir is not supported");
6579
- }, p.umask = function () {
6580
- return 0;
6581
- };
6582
- }, {}],
6583
- 2: [function (t, e, n) {
6584
- (function (t) {
6585
- !function (t) {
6586
-
6587
- 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) {
6588
- if (!ses.ok()) return;
6589
- ses.makeQ = t;
6590
- } else {
6591
- if ("undefined" == typeof window && "undefined" == typeof self) throw Error("This environment was not anticipated by Q. Please file a bug.");
6592
- var r = "undefined" != typeof window ? window : self,
6593
- o = r.Q;
6594
- r.Q = t(), r.Q.noConflict = function () {
6595
- return r.Q = o, this;
6596
- };
6597
- }
6598
- }(function () {
6599
-
6600
- function e(t) {
6601
- return function () {
6602
- return M.apply(t, arguments);
6603
- };
6604
- }
6605
- function n(t, e) {
6606
- if (x && e.stack && "object" == _typeof$1(t) && null !== t && t.stack) {
6607
- for (var n = [], o = e; o; o = o.source) o.stack && (!t.__minimumStackCounter__ || t.__minimumStackCounter__ > o.stackCounter) && (U(t, "__minimumStackCounter__", {
6608
- value: o.stackCounter,
6609
- configurable: !0
6610
- }), n.unshift(o.stack));
6611
- n.unshift(t.stack), U(t, "stack", {
6612
- value: function t(e) {
6613
- for (var n = e.split("\n"), o = [], u = 0; u < n.length; ++u) {
6614
- var a = n[u];
6615
- i(a) || r(a) || !a || o.push(a);
6616
- }
6617
- return o.join("\n");
6618
- }(n.join("\n" + I + "\n")),
6619
- configurable: !0
6620
- });
6621
- }
6622
- }
6623
- function r(t) {
6624
- return -1 !== t.indexOf("(module.js:") || -1 !== t.indexOf("(node.js:");
6625
- }
6626
- function o(t) {
6627
- var e = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);
6628
- if (e) return [e[1], Number(e[2])];
6629
- var n = /at ([^ ]+):(\d+):(?:\d+)$/.exec(t);
6630
- if (n) return [n[1], Number(n[2])];
6631
- var r = /.*@(.+):(\d+)$/.exec(t);
6632
- return r ? [r[1], Number(r[2])] : void 0;
6633
- }
6634
- function i(t) {
6635
- var e = o(t);
6636
- if (!e) return !1;
6637
- var n = e[0],
6638
- r = e[1];
6639
- return n === j && r >= C && r <= Z;
6640
- }
6641
- function u() {
6642
- if (x) try {
6643
- throw Error();
6644
- } catch (t) {
6645
- var e = t.stack.split("\n"),
6646
- n = o(e[0].indexOf("@") > 0 ? e[1] : e[2]);
6647
- if (!n) return;
6648
- return j = n[0], n[1];
6649
- }
6650
- }
6651
- function a(t) {
6652
- var e, n;
6653
- return t instanceof l ? t : v(t) ? (e = t, n = c(), a.nextTick(function () {
6654
- try {
6655
- e.then(n.resolve, n.reject, n.notify);
6656
- } catch (t) {
6657
- n.reject(t);
6658
- }
6659
- }), n.promise) : $(t);
6660
- }
6661
- function c() {
6662
- function t(t) {
6663
- e = t, a.longStackSupport && x && (i.source = t), L(n, function (e, n) {
6664
- a.nextTick(function () {
6665
- t.promiseDispatch.apply(t, n);
6666
- });
6667
- }, void 0), n = void 0, r = void 0;
6668
- }
6669
- var e,
6670
- n = [],
6671
- r = [],
6672
- o = H(c.prototype),
6673
- i = H(l.prototype);
6674
- if (i.promiseDispatch = function (t, o, i) {
6675
- var u = P(arguments);
6676
- n ? (n.push(u), "when" === o && i[1] && r.push(i[1])) : a.nextTick(function () {
6677
- e.promiseDispatch.apply(e, u);
6678
- });
6679
- }, i.valueOf = function () {
6680
- if (n) return i;
6681
- var t = d(e);
6682
- return h(t) && (e = t), t;
6683
- }, i.inspect = function () {
6684
- return e ? e.inspect() : {
6685
- state: "pending"
6686
- };
6687
- }, a.longStackSupport && x) try {
6688
- throw Error();
6689
- } catch (u) {
6690
- i.stack = u.stack.substring(u.stack.indexOf("\n") + 1), i.stackCounter = N++;
6691
- }
6692
- return o.promise = i, o.resolve = function (n) {
6693
- e || t(a(n));
6694
- }, o.fulfill = function (n) {
6695
- e || t($(n));
6696
- }, o.reject = function (n) {
6697
- e || t(m(n));
6698
- }, o.notify = function (t) {
6699
- e || L(r, function (e, n) {
6700
- a.nextTick(function () {
6701
- n(t);
6702
- });
6703
- }, void 0);
6704
- }, o;
6705
- }
6706
- function s(t) {
6707
- if ("function" != typeof t) throw TypeError("resolver must be a function.");
6708
- var e = c();
6709
- try {
6710
- t(e.resolve, e.reject, e.notify);
6711
- } catch (n) {
6712
- e.reject(n);
6713
- }
6714
- return e.promise;
6715
- }
6716
- function f(t) {
6717
- return s(function (e, n) {
6718
- for (var r = 0, o = t.length; r < o; r++) a(t[r]).then(e, n);
6719
- });
6720
- }
6721
- function l(t, e, n) {
6722
- void 0 === e && (e = function e(t) {
6723
- return m(Error("Promise does not support operation: " + t));
6724
- }), void 0 === n && (n = function n() {
6725
- return {
6726
- state: "unknown"
6727
- };
6728
- });
6729
- var r = H(l.prototype);
6730
- if (r.promiseDispatch = function (n, o, i) {
6731
- var u;
6732
- try {
6733
- u = t[o] ? t[o].apply(r, i) : e.call(r, o, i);
6734
- } catch (a) {
6735
- u = m(a);
6736
- }
6737
- n && n(u);
6738
- }, r.inspect = n, n) {
6739
- var o = n();
6740
- "rejected" === o.state && (r.exception = o.reason), r.valueOf = function () {
6741
- var t = n();
6742
- return "pending" === t.state || "rejected" === t.state ? r : t.value;
6743
- };
6744
- }
6745
- return r;
6746
- }
6747
- function p(t, e, n, r) {
6748
- return a(t).then(e, n, r);
6749
- }
6750
- function d(t) {
6751
- if (h(t)) {
6752
- var e = t.inspect();
6753
- if ("fulfilled" === e.state) return e.value;
6754
- }
6755
- return t;
6756
- }
6757
- function h(t) {
6758
- return t instanceof l;
6759
- }
6760
- function v(t) {
6761
- var e;
6762
- return (e = t) === Object(e) && "function" == typeof t.then;
6763
- }
6764
- function y() {
6765
- Q.length = 0, F.length = 0, G || (G = !0);
6766
- }
6767
- function m(e) {
6768
- var n,
6769
- r,
6770
- o = l({
6771
- when: function when(n) {
6772
- return n && function e(n) {
6773
- if (G) {
6774
- var r = z(F, n);
6775
- -1 !== r && ("object" == _typeof$1(t) && "function" == typeof t.emit && a.nextTick.runAfter(function () {
6776
- var e = z(B, n);
6777
- -1 !== e && (t.emit("rejectionHandled", Q[r], n), B.splice(e, 1));
6778
- }), F.splice(r, 1), Q.splice(r, 1));
6779
- }
6780
- }(this), n ? n(e) : this;
6781
- }
6782
- }, function () {
6783
- return this;
6784
- }, function () {
6785
- return {
6786
- state: "rejected",
6787
- reason: e
6788
- };
6789
- });
6790
- return n = o, r = e, G && ("object" == _typeof$1(t) && "function" == typeof t.emit && a.nextTick.runAfter(function () {
6791
- -1 !== z(F, n) && (t.emit("unhandledRejection", r, n), B.push(n));
6792
- }), F.push(n), r && void 0 !== r.stack ? Q.push(r.stack) : Q.push("(no stack) " + r)), o;
6793
- }
6794
- function $(t) {
6795
- return l({
6796
- when: function when() {
6797
- return t;
6798
- },
6799
- get: function get(e) {
6800
- return t[e];
6801
- },
6802
- set: function set(e, n) {
6803
- t[e] = n;
6804
- },
6805
- "delete": function _delete(e) {
6806
- delete t[e];
6807
- },
6808
- post: function post(e, n) {
6809
- return null == e ? t.apply(void 0, n) : t[e].apply(t, n);
6810
- },
6811
- apply: function apply(e, n) {
6812
- return t.apply(e, n);
6813
- },
6814
- keys: function keys() {
6815
- return q(t);
6816
- }
6817
- }, void 0, function () {
6818
- return {
6819
- state: "fulfilled",
6820
- value: t
6821
- };
6822
- });
6823
- }
6824
- function g(t, e, n) {
6825
- return a(t).spread(e, n);
6826
- }
6827
- function b(t, e, n) {
6828
- return a(t).dispatch(e, n);
6829
- }
6830
- function k(t) {
6831
- return p(t, function (t) {
6832
- var e = 0,
6833
- n = c();
6834
- return L(t, function (r, o, i) {
6835
- var u;
6836
- h(o) && "fulfilled" === (u = o.inspect()).state ? t[i] = u.value : (++e, p(o, function (r) {
6837
- t[i] = r, 0 == --e && n.resolve(t);
6838
- }, n.reject, function (t) {
6839
- n.notify({
6840
- index: i,
6841
- value: t
6842
- });
6843
- }));
6844
- }, void 0), 0 === e && n.resolve(t), n.promise;
6845
- });
6846
- }
6847
- function _(t) {
6848
- if (0 === t.length) return a.resolve();
6849
- var e = a.defer(),
6850
- n = 0;
6851
- return L(t, function (r, o, i) {
6852
- var u = t[i];
6853
- n++, p(u, function t(n) {
6854
- e.resolve(n);
6855
- }, function t(r) {
6856
- 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));
6857
- }, function t(n) {
6858
- e.notify({
6859
- index: i,
6860
- value: n
6861
- });
6862
- });
6863
- }, void 0), e.promise;
6864
- }
6865
- function w(t) {
6866
- return p(t, function (t) {
6867
- return t = S(t, a), p(k(S(t, function (t) {
6868
- return p(t, R, R);
6869
- })), function () {
6870
- return t;
6871
- });
6872
- });
6873
- }
6874
- var x = !1;
6875
- try {
6876
- throw Error();
6877
- } catch (E) {
6878
- x = !!E.stack;
6879
- }
6880
- var j,
6881
- T,
6882
- C = u(),
6883
- R = function R() {},
6884
- O = function () {
6885
- function e() {
6886
- 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);
6887
- for (; c.length;) n(t = c.pop());
6888
- i = !1;
6889
- }
6890
- function n(t, n) {
6891
- try {
6892
- t();
6893
- } catch (r) {
6894
- if (a) throw n && n.exit(), setTimeout(e, 0), n && n.enter(), r;
6895
- setTimeout(function () {
6896
- throw r;
6897
- }, 0);
6898
- }
6899
- n && n.exit();
6900
- }
6901
- var r = {
6902
- task: void 0,
6903
- next: null
6904
- },
6905
- o = r,
6906
- i = !1,
6907
- u = void 0,
6908
- a = !1,
6909
- c = [];
6910
- if (O = function O(e) {
6911
- o = o.next = {
6912
- task: e,
6913
- domain: a && t.domain,
6914
- next: null
6915
- }, i || (i = !0, u());
6916
- }, "object" == _typeof$1(t) && "[object process]" === t.toString() && t.nextTick) a = !0, u = function u() {
6917
- t.nextTick(e);
6918
- };else if ("function" == typeof setImmediate) u = "undefined" != typeof window ? setImmediate.bind(window, e) : function () {
6919
- setImmediate(e);
6920
- };else if ("undefined" != typeof MessageChannel) {
6921
- var s = new MessageChannel();
6922
- s.port1.onmessage = function () {
6923
- u = f, s.port1.onmessage = e, e();
6924
- };
6925
- var f = function f() {
6926
- s.port2.postMessage(0);
6927
- };
6928
- u = function u() {
6929
- setTimeout(e, 0), f();
6930
- };
6931
- } else u = function u() {
6932
- setTimeout(e, 0);
6933
- };
6934
- return O.runAfter = function (t) {
6935
- c.push(t), i || (i = !0, u());
6936
- }, O;
6937
- }(),
6938
- M = Function.call,
6939
- P = e(Array.prototype.slice),
6940
- L = e(Array.prototype.reduce || function (t, e) {
6941
- var n = 0,
6942
- r = this.length;
6943
- if (1 === arguments.length) for (;;) {
6944
- if (n in this) {
6945
- e = this[n++];
6946
- break;
6947
- }
6948
- if (++n >= r) throw TypeError();
6949
- }
6950
- for (; n < r; n++) n in this && (e = t(e, this[n], n));
6951
- return e;
6952
- }),
6953
- z = e(Array.prototype.indexOf || function (t) {
6954
- for (var e = 0; e < this.length; e++) if (this[e] === t) return e;
6955
- return -1;
6956
- }),
6957
- S = e(Array.prototype.map || function (t, e) {
6958
- var n = this,
6959
- r = [];
6960
- return L(n, function (o, i, u) {
6961
- r.push(t.call(e, i, u, n));
6962
- }, void 0), r;
6963
- }),
6964
- H = Object.create || function (t) {
6965
- function e() {}
6966
- return e.prototype = t, new e();
6967
- },
6968
- U = Object.defineProperty || function (t, e, n) {
6969
- return t[e] = n.value, t;
6970
- },
6971
- A = e(Object.prototype.hasOwnProperty),
6972
- q = Object.keys || function (t) {
6973
- var e = [];
6974
- for (var n in t) A(t, n) && e.push(n);
6975
- return e;
6976
- },
6977
- D = e(Object.prototype.toString);
6978
- T = "undefined" != typeof ReturnValue ? ReturnValue : function (t) {
6979
- this.value = t;
6980
- };
6981
- var I = "From previous event:";
6982
- a.resolve = a, a.nextTick = O, a.longStackSupport = !1;
6983
- var N = 1;
6984
- "object" == _typeof$1(t) && t && t.env && t.env.Q_DEBUG && (a.longStackSupport = !0), a.defer = c, c.prototype.makeNodeResolver = function () {
6985
- var t = this;
6986
- return function (e, n) {
6987
- e ? t.reject(e) : arguments.length > 2 ? t.resolve(P(arguments, 1)) : t.resolve(n);
6988
- };
6989
- }, a.Promise = s, a.promise = s, s.race = f, s.all = k, s.reject = m, s.resolve = a, a.passByCopy = function (t) {
6990
- return t;
6991
- }, l.prototype.passByCopy = function () {
6992
- return this;
6993
- }, a.join = function (t, e) {
6994
- return a(t).join(e);
6995
- }, l.prototype.join = function (t) {
6996
- return a([this, t]).spread(function (t, e) {
6997
- if (t === e) return t;
6998
- throw Error("Q can't join: not the same: " + t + " " + e);
6999
- });
7000
- }, a.race = f, l.prototype.race = function () {
7001
- return this.then(a.race);
7002
- }, a.makePromise = l, l.prototype.toString = function () {
7003
- return "[object Promise]";
7004
- }, l.prototype.then = function (t, e, r) {
7005
- var o = this,
7006
- i = c(),
7007
- u = !1;
7008
- return a.nextTick(function () {
7009
- o.promiseDispatch(function (e) {
7010
- u || (u = !0, i.resolve(function e(n) {
7011
- try {
7012
- return "function" == typeof t ? t(n) : n;
7013
- } catch (r) {
7014
- return m(r);
7015
- }
7016
- }(e)));
7017
- }, "when", [function (t) {
7018
- u || (u = !0, i.resolve(function t(r) {
7019
- if ("function" == typeof e) {
7020
- n(r, o);
7021
- try {
7022
- return e(r);
7023
- } catch (i) {
7024
- return m(i);
7025
- }
7026
- }
7027
- return m(r);
7028
- }(t)));
7029
- }]);
7030
- }), o.promiseDispatch(void 0, "when", [void 0, function (t) {
7031
- var e,
7032
- n,
7033
- o = !1;
7034
- try {
7035
- n = (e = t, "function" == typeof r ? r(e) : e);
7036
- } catch (u) {
7037
- if (o = !0, !a.onerror) throw u;
7038
- a.onerror(u);
7039
- }
7040
- o || i.notify(n);
7041
- }]), i.promise;
7042
- }, a.tap = function (t, e) {
7043
- return a(t).tap(e);
7044
- }, l.prototype.tap = function (t) {
7045
- return t = a(t), this.then(function (e) {
7046
- return t.fcall(e).thenResolve(e);
7047
- });
7048
- }, a.when = p, l.prototype.thenResolve = function (t) {
7049
- return this.then(function () {
7050
- return t;
7051
- });
7052
- }, a.thenResolve = function (t, e) {
7053
- return a(t).thenResolve(e);
7054
- }, l.prototype.thenReject = function (t) {
7055
- return this.then(function () {
7056
- throw t;
7057
- });
7058
- }, a.thenReject = function (t, e) {
7059
- return a(t).thenReject(e);
7060
- }, a.nearer = d, a.isPromise = h, a.isPromiseAlike = v, a.isPending = function t(e) {
7061
- return h(e) && "pending" === e.inspect().state;
7062
- }, l.prototype.isPending = function () {
7063
- return "pending" === this.inspect().state;
7064
- }, a.isFulfilled = function t(e) {
7065
- return !h(e) || "fulfilled" === e.inspect().state;
7066
- }, l.prototype.isFulfilled = function () {
7067
- return "fulfilled" === this.inspect().state;
7068
- }, a.isRejected = function t(e) {
7069
- return h(e) && "rejected" === e.inspect().state;
7070
- }, l.prototype.isRejected = function () {
7071
- return "rejected" === this.inspect().state;
7072
- };
7073
- var W,
7074
- Q = [],
7075
- F = [],
7076
- B = [],
7077
- G = !0;
7078
- a.resetUnhandledRejections = y, a.getUnhandledReasons = function () {
7079
- return Q.slice();
7080
- }, a.stopUnhandledRejectionTracking = function () {
7081
- y(), G = !1;
7082
- }, y(), a.reject = m, a.fulfill = $, a.master = function t(e) {
7083
- return l({
7084
- isDef: function isDef() {}
7085
- }, function (t, n) {
7086
- return b(e, t, n);
7087
- }, function () {
7088
- return a(e).inspect();
7089
- });
7090
- }, a.spread = g, l.prototype.spread = function (t, e) {
7091
- return this.all().then(function (e) {
7092
- return t.apply(void 0, e);
7093
- }, e);
7094
- }, a.async = function t(e) {
7095
- return function () {
7096
- function t(t, e) {
7097
- var i, u;
7098
- if ("undefined" == typeof StopIteration) {
7099
- try {
7100
- i = n[t](e);
7101
- } catch (c) {
7102
- return m(c);
7103
- }
7104
- return i.done ? a(i.value) : p(i.value, r, o);
7105
- }
7106
- try {
7107
- i = n[t](e);
7108
- } catch (s) {
7109
- return "[object StopIteration]" === D(u = s) || u instanceof T ? a(s.value) : m(s);
7110
- }
7111
- return p(i, r, o);
7112
- }
7113
- var n = e.apply(this, arguments),
7114
- r = t.bind(t, "next"),
7115
- o = t.bind(t, "throw");
7116
- return r();
7117
- };
7118
- }, a.spawn = function t(e) {
7119
- a.done(a.async(e)());
7120
- }, a["return"] = function t(e) {
7121
- throw new T(e);
7122
- }, a.promised = function t(e) {
7123
- return function () {
7124
- return g([this, k(arguments)], function (t, n) {
7125
- return e.apply(t, n);
7126
- });
7127
- };
7128
- }, a.dispatch = b, l.prototype.dispatch = function (t, e) {
7129
- var n = this,
7130
- r = c();
7131
- return a.nextTick(function () {
7132
- n.promiseDispatch(r.resolve, t, e);
7133
- }), r.promise;
7134
- }, a.get = function (t, e) {
7135
- return a(t).dispatch("get", [e]);
7136
- }, l.prototype.get = function (t) {
7137
- return this.dispatch("get", [t]);
7138
- }, a.set = function (t, e, n) {
7139
- return a(t).dispatch("set", [e, n]);
7140
- }, l.prototype.set = function (t, e) {
7141
- return this.dispatch("set", [t, e]);
7142
- }, a.del = a["delete"] = function (t, e) {
7143
- return a(t).dispatch("delete", [e]);
7144
- }, l.prototype.del = l.prototype["delete"] = function (t) {
7145
- return this.dispatch("delete", [t]);
7146
- }, a.mapply = a.post = function (t, e, n) {
7147
- return a(t).dispatch("post", [e, n]);
7148
- }, l.prototype.mapply = l.prototype.post = function (t, e) {
7149
- return this.dispatch("post", [t, e]);
7150
- }, a.send = a.mcall = a.invoke = function (t, e) {
7151
- return a(t).dispatch("post", [e, P(arguments, 2)]);
7152
- }, l.prototype.send = l.prototype.mcall = l.prototype.invoke = function (t) {
7153
- return this.dispatch("post", [t, P(arguments, 1)]);
7154
- }, a.fapply = function (t, e) {
7155
- return a(t).dispatch("apply", [void 0, e]);
7156
- }, l.prototype.fapply = function (t) {
7157
- return this.dispatch("apply", [void 0, t]);
7158
- }, a["try"] = a.fcall = function (t) {
7159
- return a(t).dispatch("apply", [void 0, P(arguments, 1)]);
7160
- }, l.prototype.fcall = function () {
7161
- return this.dispatch("apply", [void 0, P(arguments)]);
7162
- }, a.fbind = function (t) {
7163
- var e = a(t),
7164
- n = P(arguments, 1);
7165
- return function () {
7166
- return e.dispatch("apply", [this, n.concat(P(arguments))]);
7167
- };
7168
- }, l.prototype.fbind = function () {
7169
- var t = this,
7170
- e = P(arguments);
7171
- return function () {
7172
- return t.dispatch("apply", [this, e.concat(P(arguments))]);
7173
- };
7174
- }, a.keys = function (t) {
7175
- return a(t).dispatch("keys", []);
7176
- }, l.prototype.keys = function () {
7177
- return this.dispatch("keys", []);
7178
- }, a.all = k, l.prototype.all = function () {
7179
- return k(this);
7180
- }, a.any = _, l.prototype.any = function () {
7181
- return _(this);
7182
- }, a.allResolved = (W = w, function () {
7183
- return "undefined" != typeof console && "function" == typeof console.warn && console.warn("allResolved is deprecated, use allSettled instead.", Error("").stack), W.apply(W, arguments);
7184
- }), l.prototype.allResolved = function () {
7185
- return w(this);
7186
- }, a.allSettled = function t(e) {
7187
- return a(e).allSettled();
7188
- }, l.prototype.allSettled = function () {
7189
- return this.then(function (t) {
7190
- return k(S(t, function (t) {
7191
- function e() {
7192
- return t.inspect();
7193
- }
7194
- return (t = a(t)).then(e, e);
7195
- }));
7196
- });
7197
- }, a.fail = a["catch"] = function (t, e) {
7198
- return a(t).then(void 0, e);
7199
- }, l.prototype.fail = l.prototype["catch"] = function (t) {
7200
- return this.then(void 0, t);
7201
- }, a.progress = function t(e, n) {
7202
- return a(e).then(void 0, void 0, n);
7203
- }, l.prototype.progress = function (t) {
7204
- return this.then(void 0, void 0, t);
7205
- }, a.fin = a["finally"] = function (t, e) {
7206
- return a(t)["finally"](e);
7207
- }, l.prototype.fin = l.prototype["finally"] = function (t) {
7208
- if (!t || "function" != typeof t.apply) throw Error("Q can't apply finally callback");
7209
- return t = a(t), this.then(function (e) {
7210
- return t.fcall().then(function () {
7211
- return e;
7212
- });
7213
- }, function (e) {
7214
- return t.fcall().then(function () {
7215
- throw e;
7216
- });
7217
- });
7218
- }, a.done = function (t, e, n, r) {
7219
- return a(t).done(e, n, r);
7220
- }, l.prototype.done = function (e, r, o) {
7221
- var i = function i(t) {
7222
- a.nextTick(function () {
7223
- if (n(t, u), !a.onerror) throw t;
7224
- a.onerror(t);
7225
- });
7226
- },
7227
- u = e || r || o ? this.then(e, r, o) : this;
7228
- "object" == _typeof$1(t) && t && t.domain && (i = t.domain.bind(i)), u.then(void 0, i);
7229
- }, a.timeout = function (t, e, n) {
7230
- return a(t).timeout(e, n);
7231
- }, l.prototype.timeout = function (t, e) {
7232
- var n = c(),
7233
- r = setTimeout(function () {
7234
- e && "string" != typeof e || ((e = Error(e || "Timed out after " + t + " ms")).code = "ETIMEDOUT"), n.reject(e);
7235
- }, t);
7236
- return this.then(function (t) {
7237
- clearTimeout(r), n.resolve(t);
7238
- }, function (t) {
7239
- clearTimeout(r), n.reject(t);
7240
- }, n.notify), n.promise;
7241
- }, a.delay = function (t, e) {
7242
- return void 0 === e && (e = t, t = void 0), a(t).delay(e);
7243
- }, l.prototype.delay = function (t) {
7244
- return this.then(function (e) {
7245
- var n = c();
7246
- return setTimeout(function () {
7247
- n.resolve(e);
7248
- }, t), n.promise;
7249
- });
7250
- }, a.nfapply = function (t, e) {
7251
- return a(t).nfapply(e);
7252
- }, l.prototype.nfapply = function (t) {
7253
- var e = c(),
7254
- n = P(t);
7255
- return n.push(e.makeNodeResolver()), this.fapply(n).fail(e.reject), e.promise;
7256
- }, a.nfcall = function (t) {
7257
- var e = P(arguments, 1);
7258
- return a(t).nfapply(e);
7259
- }, l.prototype.nfcall = function () {
7260
- var t = P(arguments),
7261
- e = c();
7262
- return t.push(e.makeNodeResolver()), this.fapply(t).fail(e.reject), e.promise;
7263
- }, a.nfbind = a.denodeify = function (t) {
7264
- if (void 0 === t) throw Error("Q can't wrap an undefined function");
7265
- var e = P(arguments, 1);
7266
- return function () {
7267
- var n = e.concat(P(arguments)),
7268
- r = c();
7269
- return n.push(r.makeNodeResolver()), a(t).fapply(n).fail(r.reject), r.promise;
7270
- };
7271
- }, l.prototype.nfbind = l.prototype.denodeify = function () {
7272
- var t = P(arguments);
7273
- return t.unshift(this), a.denodeify.apply(void 0, t);
7274
- }, a.nbind = function (t, e) {
7275
- var n = P(arguments, 2);
7276
- return function () {
7277
- var r = n.concat(P(arguments)),
7278
- o = c();
7279
- return r.push(o.makeNodeResolver()), a(function n() {
7280
- return t.apply(e, arguments);
7281
- }).fapply(r).fail(o.reject), o.promise;
7282
- };
7283
- }, l.prototype.nbind = function () {
7284
- var t = P(arguments, 0);
7285
- return t.unshift(this), a.nbind.apply(void 0, t);
7286
- }, a.nmapply = a.npost = function (t, e, n) {
7287
- return a(t).npost(e, n);
7288
- }, l.prototype.nmapply = l.prototype.npost = function (t, e) {
7289
- var n = P(e || []),
7290
- r = c();
7291
- return n.push(r.makeNodeResolver()), this.dispatch("post", [t, n]).fail(r.reject), r.promise;
7292
- }, a.nsend = a.nmcall = a.ninvoke = function (t, e) {
7293
- var n = P(arguments, 2),
7294
- r = c();
7295
- return n.push(r.makeNodeResolver()), a(t).dispatch("post", [e, n]).fail(r.reject), r.promise;
7296
- }, l.prototype.nsend = l.prototype.nmcall = l.prototype.ninvoke = function (t) {
7297
- var e = P(arguments, 1),
7298
- n = c();
7299
- return e.push(n.makeNodeResolver()), this.dispatch("post", [t, e]).fail(n.reject), n.promise;
7300
- }, a.nodeify = function t(e, n) {
7301
- return a(e).nodeify(n);
7302
- }, l.prototype.nodeify = function (t) {
7303
- if (!t) return this;
7304
- this.then(function (e) {
7305
- a.nextTick(function () {
7306
- t(null, e);
7307
- });
7308
- }, function (e) {
7309
- a.nextTick(function () {
7310
- t(e);
7311
- });
7312
- });
7313
- }, a.noConflict = function () {
7314
- throw Error("Q.noConflict only works when Q is used as a global");
7315
- };
7316
- var Z = u();
7317
- return a;
7318
- });
7319
- }).call(this, t("_process"));
7320
- }, {
7321
- _process: 1
7322
- }],
7323
- 3: [function (t, e, n) {
7324
-
7325
- var r = function r(t) {
7326
- switch (_typeof$1(t)) {
7327
- case "string":
7328
- return t;
7329
- case "boolean":
7330
- return t ? "true" : "false";
7331
- case "number":
7332
- return isFinite(t) ? t : "";
7333
- default:
7334
- return "";
7335
- }
7336
- };
7337
- e.exports = function (t, e, n, o) {
7338
- return e = e || "&", n = n || "=", null === t && (t = void 0), "object" == _typeof$1(t) ? Object.keys(t).map(function (o) {
7339
- var i = encodeURIComponent(r(o)) + n;
7340
- return Array.isArray(t[o]) ? t[o].map(function (t) {
7341
- return i + encodeURIComponent(r(t));
7342
- }).join(e) : i + encodeURIComponent(r(t[o]));
7343
- }).join(e) : o ? encodeURIComponent(r(o)) + n + encodeURIComponent(r(t)) : "";
7344
- };
7345
- }, {}],
7346
- 4: [function (t, e, n) {
7347
-
7348
- function r(t) {
7349
- return t && t.__esModule ? t : {
7350
- "default": t
7351
- };
7352
- }
7353
- function o(t, e, n) {
7354
- return d["default"].information("zip:checkout:init"), v["default"].Promise(function (e, n) {
7355
- return t.onCheckout(e, n, {});
7356
- }).then(function (r) {
7357
- var o = r.redirect_uri || r.redirectUri || r.data && (r.data.redirect_uri || r.data.redirectUri);
7358
- if (!o) return d["default"].debug("zip:checkout:error", "Response does not contain redirectUri property"), n(r), void t.onError({
7359
- code: "checkout_error",
7360
- message: "The response does not contain the redirectUri property",
7361
- detail: r
7362
- });
7363
- d["default"].debug("zip:checkout:success", r), e({
7364
- redirectUri: o
7365
- });
7366
- })["catch"](function (e) {
7367
- d["default"].debug("zip:checkout:error", e), n(e), t.onError({
7368
- code: "checkout_error",
7369
- message: "Checkout response error",
7370
- detail: e
7371
- });
7372
- });
7373
- }
7374
- Object.defineProperty(n, "__esModule", {
7375
- value: !0
7376
- }), n.Checkout = void 0;
7377
- var i = function () {
7378
- function t(t, e) {
7379
- for (var n = 0; n < e.length; n++) {
7380
- var r = e[n];
7381
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7382
- }
7383
- }
7384
- return function (e, n, r) {
7385
- return n && t(e.prototype, n), r && t(e, r), e;
7386
- };
7387
- }(),
7388
- u = t("./modal"),
7389
- a = r(u),
7390
- c = t("./options"),
7391
- s = r(c),
7392
- f = t("./utility"),
7393
- l = r(f),
7394
- p = t("./console"),
7395
- d = r(p),
7396
- h = (t("./events"), t("q")),
7397
- v = r(h),
7398
- y = function () {
7399
- function t() {
7400
- !function t(e, n) {
7401
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7402
- }(this, t);
7403
- }
7404
- return i(t, null, [{
7405
- key: "init",
7406
- value: function value(t) {
7407
- if ("function" != typeof Object.assign && (Object.assign = function (t) {
7408
- if (null == t) throw TypeError("Cannot convert undefined or null to object");
7409
- t = Object(t);
7410
- for (var e = 1; e < arguments.length; e++) {
7411
- var n = arguments[e];
7412
- if (null != n) for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
7413
- }
7414
- return t;
7415
- }), t = _extends({}, s["default"], t), !this._validate(t)) {
7416
- var e, n;
7417
- return d["default"].setLevel(t.logLevel), t.redirect ? o(t, function (e) {
7418
- return t.redirectFn(e.redirectUri);
7419
- }) : (e = t, void ((n = new a["default"]()).onClose = e.onComplete.bind(e), n.build(), o(e, function (t) {
7420
- return n.setUri(t.redirectUri);
7421
- }, function (t) {
7422
- return n.close(!1);
7423
- })));
7424
- }
7425
- }
7426
- }, {
7427
- key: "attachButton",
7428
- value: function value(t, e) {
7429
- var n = document.querySelectorAll(t);
7430
- if (!n.length) return config.onError({
7431
- code: "attach_error",
7432
- message: "Cannot find button to attach zipMoney checkout"
7433
- });
7434
- for (var r = 0; r < n.length; r++) l["default"].addEventHandler(n[r], "click", function () {
7435
- return Zip.Checkout.init(e);
7436
- });
7437
- }
7438
- }, {
7439
- key: "_validate",
7440
- value: function value(t) {
7441
- 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({
7442
- code: "not_implemented",
7443
- message: "This feature is not yet implemented"
7444
- }) : t.redirect ? void 0 : t.onComplete !== s["default"].onComplete || t.redirectUri ? void 0 : t.onError({
7445
- code: "validation",
7446
- message: "if onComplete function is not specified then redirectUri must be specified"
7447
- }) : t.onError({
7448
- code: "validation",
7449
- message: "if onCheckout function is not specified then checkoutUri must be specified"
7450
- });
7451
- }
7452
- }]), t;
7453
- }();
7454
- n.Checkout = y;
7455
- }, {
7456
- "./console": 5,
7457
- "./events": 6,
7458
- "./modal": 8,
7459
- "./options": 9,
7460
- "./utility": 10,
7461
- q: 2
7462
- }],
7463
- 5: [function (t, e, n) {
7464
-
7465
- Object.defineProperty(n, "__esModule", {
7466
- value: !0
7467
- });
7468
- var r = "error";
7469
- n["default"] = {
7470
- error: function error() {
7471
- var t;
7472
- (t = window.console).log.apply(t, arguments);
7473
- },
7474
- information: function information() {
7475
- if ("error" !== r) {
7476
- var t;
7477
- (t = window.console).log.apply(t, arguments);
7478
- }
7479
- },
7480
- debug: function debug() {
7481
- if ("debug" === r) {
7482
- var t;
7483
- (t = window.console).log.apply(t, arguments);
7484
- }
7485
- },
7486
- setLevel: function setLevel(t) {
7487
- r = t;
7488
- }
7489
- };
7490
- }, {}],
7491
- 6: [function (t, e, n) {
7492
- (function (e) {
7493
-
7494
- Object.defineProperty(n, "__esModule", {
7495
- value: !0
7496
- }), n.EventListener = void 0;
7497
- var r,
7498
- o = function () {
7499
- function t(t, e) {
7500
- for (var n = 0; n < e.length; n++) {
7501
- var r = e[n];
7502
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7503
- }
7504
- }
7505
- return function (e, n, r) {
7506
- return n && t(e.prototype, n), r && t(e, r), e;
7507
- };
7508
- }();
7509
- if (((r = t("./utility")) && r.__esModule ? r : {
7510
- "default": r
7511
- })["default"].isIe) {
7512
- var i = function i(t, e) {
7513
- e = e || {
7514
- bubbles: !1,
7515
- cancelable: !1,
7516
- detail: void 0
7517
- };
7518
- var n = document.createEvent("CustomEvent");
7519
- return n.initCustomEvent(t, e.bubbles, e.cancelable, e.detail), n;
7520
- };
7521
- i.prototype = e.Event.prototype, e.CustomEvent = i;
7522
- }
7523
- var u = {},
7524
- a = n.EventListener = function () {
7525
- function t() {
7526
- !function t(e, n) {
7527
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7528
- }(this, t);
7529
- }
7530
- return o(t, null, [{
7531
- key: "constructor",
7532
- value: function value() {
7533
- u = {};
7534
- }
7535
- }, {
7536
- key: "on",
7537
- value: function value(t, e) {
7538
- u[t] = e;
7539
- }
7540
- }, {
7541
- key: "off",
7542
- value: function value(t) {
7543
- u[t] = null;
7544
- }
7545
- }]), t;
7546
- }();
7547
- a.Event = function (t, e) {
7548
- this.eventType = t, this.data = e || {};
7549
- }, a.Event.eventTypes = {
7550
- resize: "resize",
7551
- transition: "transition",
7552
- close: "close",
7553
- complete: "complete",
7554
- clear: "clear"
7555
- };
7556
- var c = window.addEventListener ? "addEventListener" : "attachEvent",
7557
- s = window[c];
7558
- s("attachEvent" == c ? "onmessage" : "message", function (t) {
7559
- var n, r;
7560
- t.data.zipmoney && (n = t.data.msg, r = new e.CustomEvent("zipmoney", {
7561
- detail: n
7562
- }), e.dispatchEvent(r));
7563
- }, !1), s("zipmoney", function (t) {
7564
- var e,
7565
- n = u[t.detail.eventType];
7566
- n ? n(t.detail.data || {}) : (e = t, console.log("Unexpected Event", e));
7567
- }, !1);
7568
- }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
7569
- }, {
7570
- "./utility": 10
7571
- }],
7572
- 7: [function (t, e, n) {
7573
- (function (e) {
7574
-
7575
- var n = t("./checkout"),
7576
- r = t("./events");
7577
- e.Zip = e.Zip || {}, e.Zip.Checkout = n.Checkout, e.zipMoneyEvent = r.EventListener.ZipEvent;
7578
- }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
7579
- }, {
7580
- "./checkout": 4,
7581
- "./events": 6
7582
- }],
7583
- 8: [function (t, e, n) {
7584
-
7585
- function r(t) {
7586
- return t && t.__esModule ? t : {
7587
- "default": t
7588
- };
7589
- }
7590
- function o() {
7591
- return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
7592
- }
7593
- function i() {
7594
- var t = document.body,
7595
- e = document.documentElement;
7596
- return Math.max(t.scrollHeight, t.offsetHeight, e.clientHeight, e.scrollHeight, e.offsetHeight);
7597
- }
7598
- function u(t) {
7599
- for (var e = document.querySelectorAll("html, body"), n = 0; n < e.length; n++) e[n].style.overflowY = t;
7600
- }
7601
- function a(t) {
7602
- var e = document.body.currentStyle || window.getComputedStyle(document.body),
7603
- n = document.body.offsetHeight,
7604
- r = parseInt(e.marginTop, 10) + parseInt(e.marginBottom, 10),
7605
- o = n + r - parseInt(e.height, 10);
7606
- document.body.style.height = t - o + "px";
7607
- }
7608
- Object.defineProperty(n, "__esModule", {
7609
- value: !0
7610
- });
7611
- var c = function () {
7612
- function t(t, e) {
7613
- for (var n = 0; n < e.length; n++) {
7614
- var r = e[n];
7615
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7616
- }
7617
- }
7618
- return function (e, n, r) {
7619
- return n && t(e.prototype, n), r && t(e, r), e;
7620
- };
7621
- }(),
7622
- s = t("./utility"),
7623
- f = r(s),
7624
- l = t("./events"),
7625
- p = t("./console"),
7626
- d = (r(p), {
7627
- iframeWidth: 400,
7628
- iframeMinWidth: 320,
7629
- iframeInitialHeight: 704,
7630
- iframeMinHeight: 600,
7631
- verticalMargin: 35
7632
- }),
7633
- h = ["resize", "transition", "close", "complete", "clear"],
7634
- v = "https://d3k1w8lx8mqizo.cloudfront.net/zm/",
7635
- y = function () {
7636
- function t() {
7637
- var e = this;
7638
- ((function t(e, n) {
7639
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7640
- }))(this, t), this._events = [], this._isMobile = f["default"].isMobileDevice(), h.forEach(function (t) {
7641
- return l.EventListener.on(l.EventListener.Event.eventTypes[t], e[t].bind(e));
7642
- });
7643
- }
7644
- return c(t, [{
7645
- key: "build",
7646
- value: function value() {
7647
- this._initialHtmlHeight = i(), window.scrollTo(0, 0);
7648
- var t = this._frame = (e = this._frameUri, n = this._isMobile, (r = document.createElement("iframe")).id = "zipmoney-iframe", r.frameborder = 0, _extends(r.style, {
7649
- padding: "0",
7650
- border: "none",
7651
- zIndex: "999999",
7652
- backgroundColor: "#FFF",
7653
- backgroundImage: "url(" + v + "spinner.gif)",
7654
- backgroundRepeat: "no-repeat",
7655
- backgroundPosition: "50% 50%"
7656
- }), n ? _extends(r.style, {
7657
- overflow: "scroll",
7658
- width: "100%",
7659
- height: "100%",
7660
- position: "absolute",
7661
- top: "0",
7662
- bottom: "0",
7663
- left: "0",
7664
- right: "0",
7665
- margin: "0"
7666
- }) : _extends(r.style, {
7667
- width: d.iframeWidth + "px",
7668
- minWidth: d.iframeMinWidth + "px",
7669
- height: d.iframeInitialHeight + "px",
7670
- margin: d.verticalMargin + "px auto 0 auto",
7671
- display: "table-row",
7672
- backgroundSize: "25%",
7673
- textAlign: "center",
7674
- boxShadow: "0px 0px 70px 0px rgb(0, 0, 0)"
7675
- }), r.src = e || "", r);
7676
- if (!this._isMobile) {
7677
- var e,
7678
- n,
7679
- r,
7680
- o,
7681
- c,
7682
- s = ((o = document.createElement("img")).src = v + "icon-close.png", _extends(o.style, {
7683
- width: "50px",
7684
- height: "50px",
7685
- position: "absolute",
7686
- top: "20px",
7687
- right: "20px",
7688
- cursor: "pointer"
7689
- }), o);
7690
- s.onclick = this.close.bind(this), this._overlay = ((c = document.createElement("div")).className = "zipmoney-overlay", _extends(c.style, {
7691
- position: "absolute",
7692
- left: "0",
7693
- top: "0",
7694
- display: "table-cell",
7695
- textAlign: "center",
7696
- verticalAlign: "middle",
7697
- background: "rgba(0, 0, 0, 0.75)",
7698
- zIndex: "10000",
7699
- height: "100%",
7700
- width: "100%"
7701
- }), c), this._overlay.appendChild(s), this._overlay.appendChild(this._frame), t = this._overlay;
7702
- }
7703
- document.body.appendChild(t), this._isMobile && a(this._frame.offsetHeight), u("auto"), this._startMonitoringWindowResize();
7704
- }
7705
- }, {
7706
- key: "setUri",
7707
- value: function value(t) {
7708
- this._frameUri = t, this._frame && (this._frame.src = t);
7709
- }
7710
- }, {
7711
- key: "resize",
7712
- value: function value(t) {
7713
- var e = this._isMobile ? 16 : 0,
7714
- t = t >= d.iframeMinHeight ? t : d.iframeMinHeight,
7715
- n = (t += e) + 2 * d.verticalMargin,
7716
- r = o();
7717
- this._frame.style.height = t + "px", this._overlay && (this._overlay.style.height = Math.max(r, this._initialHtmlHeight, n) + "px"), this._isMobile && a(t);
7718
- }
7719
- }, {
7720
- key: "transition",
7721
- value: function value() {
7722
- window.scroll(0, 0);
7723
- }
7724
- }, {
7725
- key: "close",
7726
- value: function value() {
7727
- var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
7728
- e = {
7729
- state: "cancelled"
7730
- };
7731
- this._events.length && (e = this._events.pop()), this._destroy(), this.onClose && t && this.onClose(e);
7732
- }
7733
- }, {
7734
- key: "complete",
7735
- value: function value(t) {
7736
- this._events.push(t);
7737
- }
7738
- }, {
7739
- key: "clear",
7740
- value: function value(t) {
7741
- this._events = [];
7742
- }
7743
- }, {
7744
- key: "_startMonitoringWindowResize",
7745
- value: function value() {
7746
- var t = this;
7747
- this._resizeHandler = f["default"].debounce(function () {
7748
- var e, n, r, u;
7749
- 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");
7750
- }, 250), f["default"].addEventHandler(window, "resize", this._resizeHandler);
7751
- }
7752
- }, {
7753
- key: "_stopMonitoringWindowResize",
7754
- value: function value() {
7755
- f["default"].removeEventHandler(window, "resize", this._resizeHandler);
7756
- }
7757
- }, {
7758
- key: "_destroy",
7759
- value: function value() {
7760
- 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) {
7761
- return l.EventListener.off(l.EventListener.Event.eventTypes[t]);
7762
- });
7763
- }
7764
- }]), t;
7765
- }();
7766
- n["default"] = y;
7767
- }, {
7768
- "./console": 5,
7769
- "./events": 6,
7770
- "./utility": 10
7771
- }],
7772
- 9: [function (t, e, n) {
7773
-
7774
- function r(t) {
7775
- return t && t.__esModule ? t : {
7776
- "default": t
7777
- };
7778
- }
7779
- Object.defineProperty(n, "__esModule", {
7780
- value: !0
7781
- });
7782
- var o = t("./xr"),
7783
- i = r(o),
7784
- u = t("./console"),
7785
- a = r(u);
7786
- i["default"].configure({
7787
- headers: {
7788
- "X-Requested-With": "XMLHttpRequest"
7789
- }
7790
- }), n["default"] = {
7791
- request: "standard",
7792
- redirect: !1,
7793
- logLevel: "Error",
7794
- onCheckout: function onCheckout(t, e, n) {
7795
- i["default"].post(this.checkoutUri).then(function (e) {
7796
- return t(e.data);
7797
- })["catch"](e);
7798
- },
7799
- onShippingAddressChanged: function onShippingAddressChanged(t, e, n) {
7800
- i["default"].post(this.shippingUri).then(t)["catch"](e);
7801
- },
7802
- onComplete: function onComplete(t) {
7803
- if (a["default"].information("zip:completed", t), "cancelled" !== t.state) {
7804
- var e = t.checkoutId ? "&checkoutId=" + t.checkoutId : "";
7805
- this.redirectFn(this.redirectUri + "?result=" + t.state + e);
7806
- }
7807
- },
7808
- onError: function onError(t) {
7809
- a["default"].error(t);
7810
- },
7811
- redirectFn: function redirectFn(t) {
7812
- window.location.href = t;
7813
- }
7814
- };
7815
- }, {
7816
- "./console": 5,
7817
- "./xr": 11
7818
- }],
7819
- 10: [function (t, e, n) {
6474
+ var ZIPMONEY_PROXY_REDIRECT_URL = '/checkout/zipmoney/response';
6475
+ var ZIPMONEY_DEFAULT_SUSPENDED_URL = '/checkout/zipmoney/suspended';
6476
+ var ZIPMONEY_MESSAGE_SOURCE = 'zipmoney.checkout.paydock';
6477
+ var ZIPMONEY_CONTEXTUAL_LOADING_URL = '/checkout/zipmoney/loading';
7820
6478
 
7821
- Object.defineProperty(n, "__esModule", {
7822
- value: !0
7823
- });
7824
- var r = function () {
7825
- function t(t, e) {
7826
- for (var n = 0; n < e.length; n++) {
7827
- var r = e[n];
7828
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r);
7829
- }
7830
- }
7831
- return function (e, n, r) {
7832
- return n && t(e.prototype, n), r && t(e, r), e;
7833
- };
7834
- }(),
7835
- o = function () {
7836
- function t() {
7837
- !function t(e, n) {
7838
- if (!(e instanceof n)) throw TypeError("Cannot call a class as a function");
7839
- }(this, t);
7840
- }
7841
- return r(t, null, [{
7842
- key: "isIe",
7843
- value: function value() {
7844
- var t = -1,
7845
- e = window.navigator.userAgent,
7846
- n = e.indexOf("MSIE "),
7847
- r = e.indexOf("Trident/");
7848
- if (n > 0) t = parseInt(e.substring(n + 5, e.indexOf(".", n)), 10);else if (r > 0) {
7849
- var o = e.indexOf("rv:");
7850
- t = parseInt(e.substring(o + 3, e.indexOf(".", o)), 10);
7851
- }
7852
- return t > -1 ? t : void 0;
7853
- }
7854
- }, {
7855
- key: "isMobileDevice",
7856
- value: function value() {
7857
- var t = navigator.userAgent || navigator.vendor || window.opera;
7858
- 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));
7859
- }
7860
- }, {
7861
- key: "debounce",
7862
- value: function value(t, e) {
7863
- var n;
7864
- return function () {
7865
- var r = this,
7866
- o = arguments,
7867
- i = function i() {
7868
- n = null, t.apply(r, o);
7869
- },
7870
- u = !n;
7871
- clearTimeout(n), n = setTimeout(i, e), u && t.apply(r, o);
7872
- };
7873
- }
7874
- }, {
7875
- key: "addEventHandler",
7876
- value: function value(t, e, n) {
7877
- t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent && t.attachEvent("on" + e, n);
7878
- }
7879
- }, {
7880
- key: "removeEventHandler",
7881
- value: function value(t, e, n) {
7882
- t.removeEventListener ? t.removeEventListener(e, n, !1) : t.detachEvent && t.detachEvent("on" + e, n);
7883
- }
7884
- }]), t;
7885
- }();
7886
- n["default"] = o;
7887
- }, {}],
7888
- 11: [function (t, e, n) {
7889
-
7890
- function r(t) {
7891
- return t && t.__esModule ? t : {
7892
- "default": t
7893
- };
7894
- }
7895
- function o(t, e) {
7896
- return {
7897
- status: t.status,
7898
- response: t.response,
7899
- data: e,
7900
- xhr: t
7901
- };
7902
- }
7903
- function i(t) {
7904
- for (var e = arguments.length, n = Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r];
7905
- for (var o in n) if ({}.hasOwnProperty.call(n, o)) {
7906
- var i = n[o];
7907
- if ("object" === (void 0 === i ? "undefined" : a(i))) for (var u in i) ({}).hasOwnProperty.call(i, u) && (t[u] = i[u]);
7908
- }
7909
- return t;
7910
- }
7911
- function u(t) {
7912
- var e, n;
7913
- return e = t, n = function n(e, _n) {
7914
- var r = i({}, h, v, t),
7915
- u = r.xmlHttpRequest();
7916
- for (var c in r.abort && t.abort(function () {
7917
- _n(o(u)), u.abort();
7918
- }), 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 () {
7919
- if (u.status >= 200 && u.status < 300) {
7920
- var t = null;
7921
- u.responseText && (t = !0 === r.raw ? u.responseText : r.load(u.responseText)), e(o(u, t));
7922
- } else _n(o(u));
7923
- }), u.addEventListener(d.ABORT, function () {
7924
- return _n(o(u));
7925
- }), u.addEventListener(d.ERROR, function () {
7926
- return _n(o(u));
7927
- }), u.addEventListener(d.TIMEOUT, function () {
7928
- return _n(o(u));
7929
- }), r.headers) ({}).hasOwnProperty.call(r.headers, c) && u.setRequestHeader(c, r.headers[c]);
7930
- for (var f in r.events) ({}).hasOwnProperty.call(r.events, f) && u.addEventListener(f, r.events[f].bind(null, u), !1);
7931
- var l = "object" !== a(r.data) || r.raw ? r.data : r.dump(r.data);
7932
- void 0 !== l ? u.send(l) : u.send();
7933
- }, (e && e.promise ? e.promise : v.promise || h.promise)(n);
7934
- }
7935
- Object.defineProperty(n, "__esModule", {
7936
- value: !0
7937
- });
7938
- var a = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (t) {
7939
- return _typeof$1(t);
7940
- } : function (t) {
7941
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : _typeof$1(t);
7942
- },
7943
- c = t("querystring/encode"),
7944
- s = r(c),
7945
- f = t("q"),
7946
- l = r(f),
7947
- p = {
7948
- GET: "GET",
7949
- POST: "POST",
7950
- PUT: "PUT",
7951
- DELETE: "DELETE",
7952
- PATCH: "PATCH",
7953
- OPTIONS: "OPTIONS"
7954
- },
7955
- d = {
7956
- READY_STATE_CHANGE: "readystatechange",
7957
- LOAD_START: "loadstart",
7958
- PROGRESS: "progress",
7959
- ABORT: "abort",
7960
- ERROR: "error",
7961
- LOAD: "load",
7962
- TIMEOUT: "timeout",
7963
- LOAD_END: "loadend"
7964
- },
7965
- h = {
7966
- method: p.GET,
7967
- data: void 0,
7968
- headers: {
7969
- Accept: "application/json",
7970
- "Content-Type": "application/json"
7971
- },
7972
- dump: JSON.stringify,
7973
- load: JSON.parse,
7974
- xmlHttpRequest: function xmlHttpRequest() {
7975
- return new XMLHttpRequest();
7976
- },
7977
- promise: function promise(t) {
7978
- return l["default"].Promise(t);
7979
- },
7980
- withCredentials: !1
7981
- },
7982
- v = {};
7983
- u.assign = i, u.encode = s["default"], u.configure = function t(e) {
7984
- v = i({}, v, e);
7985
- }, u.Methods = p, u.Events = d, u.defaults = h, u.get = function (t, e, n) {
7986
- return u(i({
7987
- url: t,
7988
- method: p.GET,
7989
- params: e
7990
- }, n));
7991
- }, u.put = function (t, e, n) {
7992
- return u(i({
7993
- url: t,
7994
- method: p.PUT,
7995
- data: e
7996
- }, n));
7997
- }, u.post = function (t, e, n) {
7998
- return u(i({
7999
- url: t,
8000
- method: p.POST,
8001
- data: e
8002
- }, n));
8003
- }, u.patch = function (t, e, n) {
8004
- return u(i({
8005
- url: t,
8006
- method: p.PATCH,
8007
- data: e
8008
- }, n));
8009
- }, u.del = function (t, e) {
8010
- return u(i({
8011
- url: t,
8012
- method: p.DELETE
8013
- }, e));
8014
- }, u.options = function (t, e) {
8015
- return u(i({
8016
- url: t,
8017
- method: p.OPTIONS
8018
- }, e));
8019
- }, n["default"] = u;
8020
- }, {
8021
- q: 2,
8022
- "querystring/encode": 3
8023
- }]
8024
- }, {}, [7]);
8025
-
8026
- var ECHO_URI = '/v1/echo';
8027
6479
  var LOG_PREFIX$1 = '[CheckoutButton:Zipmoney]';
8028
6480
  var ZipmoneyRunner = /*#__PURE__*/function (_BaseRunner) {
8029
6481
  function ZipmoneyRunner() {
@@ -8040,29 +6492,26 @@ var ZipmoneyRunner = /*#__PURE__*/function (_BaseRunner) {
8040
6492
  _superPropGet(ZipmoneyRunner, "setEnv", this)([env, alias]);
8041
6493
  this.apiEnv.setEnv(env, alias);
8042
6494
  }
8043
- }, {
8044
- key: "getCheckoutUri",
8045
- value: function getCheckoutUri(redirectUri) {
8046
- return this.apiEnv.getConf().url + ECHO_URI + '?' + Url.serialize({
8047
- json_body: JSON.stringify({
8048
- redirect_uri: redirectUri
8049
- })
8050
- });
8051
- }
8052
6495
  }]);
8053
6496
  }(BaseRunner);
8054
6497
 
8055
- var ZIPMONEY_PROXY_REDIRECT_URL = '/checkout/zipmoney/response';
8056
- var ZIPMONEY_DEFAULT_SUSPENDED_URL = '/checkout/zipmoney/suspended';
8057
- var ZIPMONEY_MESSAGE_SOURCE = 'zipmoney.checkout.paydock';
8058
-
6498
+ var ZIPMONEY_STATE;
6499
+ (function (ZIPMONEY_STATE) {
6500
+ ZIPMONEY_STATE["APPROVED"] = "approved";
6501
+ ZIPMONEY_STATE["DECLINED"] = "declined";
6502
+ ZIPMONEY_STATE["CANCELLED"] = "cancelled";
6503
+ ZIPMONEY_STATE["REFERRED"] = "referred";
6504
+ })(ZIPMONEY_STATE || (ZIPMONEY_STATE = {}));
8059
6505
  var ZipmoneyContextualRunner = /*#__PURE__*/function (_ContextualRunner) {
8060
6506
  function ZipmoneyContextualRunner() {
8061
6507
  var _this;
8062
6508
  _classCallCheck(this, ZipmoneyContextualRunner);
8063
6509
  _this = _callSuper(this, ZipmoneyContextualRunner);
8064
6510
  _this.runs = false;
6511
+ _this.widgetId = Uuid.generate();
6512
+ _this.checkoutTab = null;
8065
6513
  _this.eventEmitter = new EventEmitter();
6514
+ _this.event = new IFrameEvent(window);
8066
6515
  return _this;
8067
6516
  }
8068
6517
  _inherits(ZipmoneyContextualRunner, _ContextualRunner);
@@ -8071,6 +6520,9 @@ var ZipmoneyContextualRunner = /*#__PURE__*/function (_ContextualRunner) {
8071
6520
  value: function run() {
8072
6521
  this.runs = true;
8073
6522
  this.background.initLoader();
6523
+ this.checkoutTab = window.open(this.getLoadingUrl(), '_blank');
6524
+ this.checkInterval = this.setCloseTabInterval();
6525
+ this.setCompleteCheckoutListener();
8074
6526
  }
8075
6527
  }, {
8076
6528
  key: "isRunning",
@@ -8080,24 +6532,19 @@ var ZipmoneyContextualRunner = /*#__PURE__*/function (_ContextualRunner) {
8080
6532
  }, {
8081
6533
  key: "next",
8082
6534
  value: function next(checkoutData) {
8083
- var _this2 = this;
8084
- this.background.clear();
6535
+ var _a;
8085
6536
  this.checkout = checkoutData;
8086
- var checkoutUri = this.getCheckoutUri(this.checkout.link);
8087
- Zip.Checkout.init({
8088
- checkoutUri: checkoutUri,
8089
- onComplete: function onComplete(args) {
8090
- return _this2.eventHandler(args);
8091
- },
8092
- onError: function onError(args) {
8093
- return _this2.eventHandler(args);
8094
- }
8095
- });
6537
+ (_a = this.checkoutTab) === null || _a === void 0 ? void 0 : _a.location.replace(checkoutData.link);
8096
6538
  }
8097
6539
  }, {
8098
6540
  key: "getSuccessRedirectUri",
8099
6541
  value: function getSuccessRedirectUri() {
8100
- return this.suspendedRedirectUri ? this.suspendedRedirectUri : this.widgetEnv.getConf().url + String(ZIPMONEY_DEFAULT_SUSPENDED_URL);
6542
+ var base = this.widgetEnv.getConf().url;
6543
+ var path = String(ZIPMONEY_DEFAULT_SUSPENDED_URL);
6544
+ var url = new URL(path, base);
6545
+ url.searchParams.set('widgetId', this.widgetId);
6546
+ url.searchParams.set('domain', window.location.origin);
6547
+ return url.toString();
8101
6548
  }
8102
6549
  }, {
8103
6550
  key: "getErrorRedirectUri",
@@ -8110,46 +6557,50 @@ var ZipmoneyContextualRunner = /*#__PURE__*/function (_ContextualRunner) {
8110
6557
  _superPropGet(ZipmoneyContextualRunner, "stop", this)([]);
8111
6558
  this.runs = false;
8112
6559
  var element = document.querySelector('.zipmoney-overlay');
8113
- if (element) element.remove();
6560
+ if (element) {
6561
+ element.remove();
6562
+ }
6563
+ if (this.checkoutTab && !this.checkoutTab.closed) {
6564
+ clearInterval(this.checkInterval);
6565
+ this.checkoutTab.close();
6566
+ }
8114
6567
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8115
6568
  }
8116
6569
  }, {
8117
6570
  key: "onStop",
8118
6571
  value: function onStop(cb) {
8119
- var _this3 = this;
6572
+ var _this2 = this;
8120
6573
  this.eventEmitter.subscribe(RUNNER_EVENT.CLOSE, function () {
8121
- _this3.background.clear();
6574
+ _this2.background.clear();
8122
6575
  cb();
8123
6576
  });
8124
6577
  }
8125
6578
  }, {
8126
6579
  key: "onCheckout",
8127
6580
  value: function onCheckout(event, cb) {
8128
- var _this4 = this;
6581
+ var _this3 = this;
8129
6582
  this.eventEmitter.subscribe(event, function () {
8130
- cb(_this4.checkout);
6583
+ cb(_this3.checkout);
8131
6584
  });
8132
6585
  }
8133
6586
  }, {
8134
6587
  key: "eventHandler",
8135
6588
  value: function eventHandler(args) {
8136
6589
  this.runs = false;
8137
- // Ambient enum Zip prevents migration from typescript & babel to swc
8138
- // https://www.npmjs.com/package/@rollup/plugin-swc
8139
- // https://swc.rs/docs/migrating-from-tsc
6590
+ this.background.clear();
8140
6591
  switch (args.state) {
8141
- case "approved" /* Zip.ZIPMONEY_STATE.APPROVED */:
6592
+ case ZIPMONEY_STATE.APPROVED:
8142
6593
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8143
6594
  this.eventEmitter.emit(RUNNER_EVENT.SUCCESS);
8144
6595
  break;
8145
- case "declined" /* Zip.ZIPMONEY_STATE.DECLINED */:
6596
+ case ZIPMONEY_STATE.DECLINED:
8146
6597
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8147
6598
  this.eventEmitter.emit(RUNNER_EVENT.DECLINED);
8148
6599
  break;
8149
- case "cancelled" /* Zip.ZIPMONEY_STATE.CANCELLED */:
6600
+ case ZIPMONEY_STATE.CANCELLED:
8150
6601
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8151
6602
  break;
8152
- case "referred" /* Zip.ZIPMONEY_STATE.REFERRED */:
6603
+ case ZIPMONEY_STATE.REFERRED:
8153
6604
  this.eventEmitter.emit(RUNNER_EVENT.CLOSE);
8154
6605
  this.eventEmitter.emit(RUNNER_EVENT.REFERRED);
8155
6606
  break;
@@ -8158,6 +6609,41 @@ var ZipmoneyContextualRunner = /*#__PURE__*/function (_ContextualRunner) {
8158
6609
  break;
8159
6610
  }
8160
6611
  }
6612
+ }, {
6613
+ key: "setCloseTabInterval",
6614
+ value: function setCloseTabInterval() {
6615
+ var _this4 = this;
6616
+ var checkInterval = setInterval(function () {
6617
+ var _a;
6618
+ if ((_a = _this4.checkoutTab) === null || _a === void 0 ? void 0 : _a.closed) {
6619
+ clearInterval(checkInterval);
6620
+ _this4.event.clear();
6621
+ _this4.stop();
6622
+ }
6623
+ }, 500);
6624
+ return checkInterval;
6625
+ }
6626
+ }, {
6627
+ key: "setCompleteCheckoutListener",
6628
+ value: function setCompleteCheckoutListener() {
6629
+ var _this5 = this;
6630
+ this.event.on(EVENT$4.FINISH, this.widgetId, function (event) {
6631
+ _this5.event.clear();
6632
+ clearInterval(_this5.checkInterval);
6633
+ if (_this5.checkoutTab && !_this5.checkoutTab.closed) {
6634
+ _this5.checkoutTab.close();
6635
+ }
6636
+ _this5.eventHandler(event);
6637
+ });
6638
+ }
6639
+ }, {
6640
+ key: "getLoadingUrl",
6641
+ value: function getLoadingUrl() {
6642
+ var base = this.widgetEnv.getConf().url;
6643
+ var path = String(ZIPMONEY_CONTEXTUAL_LOADING_URL);
6644
+ var url = new URL(path, base);
6645
+ return url.toString();
6646
+ }
8161
6647
  }]);
8162
6648
  }(ContextualRunner(ZipmoneyRunner));
8163
6649
 
@@ -8274,11 +6760,7 @@ var ZipmoneyRedirectRunner = /*#__PURE__*/function (_RedirectRunner) {
8274
6760
  data: widgetSessionData
8275
6761
  }, {
8276
6762
  onSuccess: function onSuccess() {
8277
- var checkoutUri = _this2.getCheckoutUri(checkout.link);
8278
- Zip.Checkout.init({
8279
- checkoutUri: checkoutUri,
8280
- redirect: true
8281
- });
6763
+ window.location.href = checkout.link;
8282
6764
  },
8283
6765
  onError: function onError() {
8284
6766
  console.error('Error initializing Zip Checkout');
@@ -13491,6 +11973,7 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
13491
11973
  _this.gatewayName = gatewayName;
13492
11974
  _this.eventEmitter = eventEmitter;
13493
11975
  _this.processingButtonClick = false;
11976
+ _this.isProcessingAuthorization = false;
13494
11977
  _this.parseUpdateData = function (data) {
13495
11978
  var _a, _b, _c, _d, _e, _f;
13496
11979
  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) {
@@ -13565,6 +12048,7 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
13565
12048
  key: "load",
13566
12049
  value: function load(container) {
13567
12050
  var _this2 = this;
12051
+ this.processingButtonClick = false;
13568
12052
  if (!window.Promise) {
13569
12053
  // 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).
13570
12054
  this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
@@ -13692,7 +12176,10 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
13692
12176
  key: "onGooglePayButtonClicked",
13693
12177
  value: function onGooglePayButtonClicked() {
13694
12178
  var _this4 = this;
13695
- if (this.processingButtonClick) return;
12179
+ if (this.processingButtonClick) {
12180
+ console.warn("Google Pay button clicked while processing.");
12181
+ return;
12182
+ }
13696
12183
  this.processingButtonClick = true;
13697
12184
  this.handleMerchantOnButtonClickEvent().then(function () {
13698
12185
  _this4.loadPaymentData()["finally"](function () {
@@ -13735,6 +12222,7 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
13735
12222
  case 0:
13736
12223
  return _context2.abrupt("return", this.paymentsClient.loadPaymentData(this.createPaymentDataRequest())["catch"](function (err) {
13737
12224
  _this6.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
12225
+ _this6.processingButtonClick = false;
13738
12226
  console.error('Error while loading payment data', err);
13739
12227
  throw err;
13740
12228
  }));
@@ -13762,74 +12250,92 @@ var GoogleWalletService = /*#__PURE__*/function (_WalletService) {
13762
12250
  var shippingContactFirstName = (_p = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _p === void 0 ? void 0 : _p.name;
13763
12251
  var shippingContactEmail = paymentData === null || paymentData === void 0 ? void 0 : paymentData.email;
13764
12252
  var shippingContactPhone = (_q = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _q === void 0 ? void 0 : _q.phoneNumber;
13765
- return new Promise(function (resolve) {
13766
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
13767
- return _this7.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
13768
- data: _extends({
13769
- customer: {
13770
- payment_source: _extends(_extends(_extends(_extends({
13771
- wallet_type: WALLET_TYPE.GOOGLE,
13772
- // 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
13773
- type: paymentData.paymentMethodData.type,
13774
- card_scheme: (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.cardNetwork
13775
- }, billingAddressLine1 && {
13776
- address_line1: billingAddressLine1
13777
- }), billingAddressLine2 && {
13778
- address_line2: billingAddressLine2
13779
- }), billingAddressLine2 && {
13780
- address_line2: billingAddressLine2
12253
+ var onPaymentAuthorizedResponse = new Promise(function (resolve) {
12254
+ var emitPaymentEvent = function emitPaymentEvent() {
12255
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
12256
+ _this7.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
12257
+ data: _extends({
12258
+ customer: {
12259
+ payment_source: _extends(_extends(_extends({
12260
+ wallet_type: WALLET_TYPE.GOOGLE,
12261
+ type: paymentData.paymentMethodData.type,
12262
+ card_scheme: (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.cardNetwork
12263
+ }, billingAddressLine1 && {
12264
+ address_line1: billingAddressLine1
12265
+ }), billingAddressLine2 && {
12266
+ address_line2: billingAddressLine2
12267
+ }), {
12268
+ 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,
12269
+ 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,
12270
+ 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,
12271
+ 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,
12272
+ ref_token: paymentData.paymentMethodData.tokenizationData.token
12273
+ })
12274
+ }
12275
+ }, _this7.isShippingRequired() && {
12276
+ shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && {
12277
+ method: shippingOptionMethod
12278
+ }), _this7.hasShippingOptions() && {
12279
+ options: _this7.meta.shipping_options
12280
+ }), shippingAddressLine1 && {
12281
+ address_line1: shippingAddressLine1
12282
+ }), shippingAddressLine2 && {
12283
+ address_line2: shippingAddressLine2
12284
+ }), shippingAddressCountry && {
12285
+ address_country: shippingAddressCountry
12286
+ }), shippingAddressCity && {
12287
+ address_city: shippingAddressCity
12288
+ }), shippingAddressPostCode && {
12289
+ address_postcode: shippingAddressPostCode
12290
+ }), shippingAddressState && {
12291
+ address_state: shippingAddressState
13781
12292
  }), {
13782
- 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,
13783
- 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,
13784
- 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,
13785
- 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,
13786
- ref_token: paymentData.paymentMethodData.tokenizationData.token
12293
+ contact: _extends(_extends(_extends({}, shippingContactFirstName && {
12294
+ first_name: shippingContactFirstName
12295
+ }), shippingContactEmail && {
12296
+ email: shippingContactEmail
12297
+ }), shippingContactPhone && {
12298
+ phone: shippingContactPhone
12299
+ })
13787
12300
  })
12301
+ }),
12302
+ onSuccess: function onSuccess() {
12303
+ _this7.processingButtonClick = false;
12304
+ _this7.isProcessingAuthorization = false;
12305
+ resolve({
12306
+ transactionState: 'SUCCESS'
12307
+ });
12308
+ },
12309
+ onError: function onError(error) {
12310
+ _this7.processingButtonClick = false;
12311
+ _this7.isProcessingAuthorization = false;
12312
+ resolve({
12313
+ transactionState: 'ERROR',
12314
+ error: {
12315
+ intent: 'PAYMENT_AUTHORIZATION',
12316
+ message: (error === null || error === void 0 ? void 0 : error.message) || 'Error processing payment',
12317
+ reason: 'PAYMENT_DATA_INVALID'
12318
+ }
12319
+ });
13788
12320
  }
13789
- }, _this7.isShippingRequired() && {
13790
- shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && {
13791
- method: shippingOptionMethod
13792
- }), _this7.hasShippingOptions() && {
13793
- options: _this7.meta.shipping_options
13794
- }), shippingAddressLine1 && {
13795
- address_line1: shippingAddressLine1
13796
- }), shippingAddressLine2 && {
13797
- address_line2: shippingAddressLine2
13798
- }), shippingAddressCountry && {
13799
- address_country: shippingAddressCountry
13800
- }), shippingAddressCity && {
13801
- address_city: shippingAddressCity
13802
- }), shippingAddressPostCode && {
13803
- address_postcode: shippingAddressPostCode
13804
- }), shippingAddressState && {
13805
- address_state: shippingAddressState
13806
- }), {
13807
- contact: _extends(_extends(_extends({}, shippingContactFirstName && {
13808
- first_name: shippingContactFirstName
13809
- }), shippingContactEmail && {
13810
- email: shippingContactEmail
13811
- }), shippingContactPhone && {
13812
- phone: shippingContactPhone
13813
- })
13814
- })
13815
- }),
13816
- onSuccess: function onSuccess() {
13817
- return resolve({
13818
- transactionState: 'SUCCESS'
13819
- });
13820
- },
13821
- onError: function onError(error) {
13822
- return resolve({
13823
- transactionState: 'ERROR',
13824
- error: {
13825
- intent: 'PAYMENT_AUTHORIZATION',
13826
- message: (error === null || error === void 0 ? void 0 : error.message) || 'Error processing payment',
13827
- reason: 'PAYMENT_DATA_INVALID'
13828
- }
13829
- });
13830
- }
13831
- });
12321
+ });
12322
+ };
12323
+ if (_this7.isProcessingAuthorization) {
12324
+ console.warn("Duplicate payment authorization detected. Ignoring.");
12325
+ resolve({
12326
+ transactionState: 'ERROR',
12327
+ error: {
12328
+ intent: 'PAYMENT_AUTHORIZATION',
12329
+ message: 'Another payment authorization is already in progress',
12330
+ reason: 'OTHER_ERROR'
12331
+ }
12332
+ });
12333
+ } else {
12334
+ _this7.isProcessingAuthorization = true;
12335
+ emitPaymentEvent();
12336
+ }
13832
12337
  });
12338
+ return onPaymentAuthorizedResponse;
13833
12339
  }
13834
12340
  }, {
13835
12341
  key: "onPaymentDataChanged",
@@ -18493,6 +16999,9 @@ function getVersionInstructions(version) {
18493
16999
  switch (version) {
18494
17000
  case 1:
18495
17001
  return new InstructionModuleV1();
17002
+ case 2:
17003
+ //Note this is using V1 instructions for now
17004
+ return new InstructionModuleV1();
18496
17005
  default:
18497
17006
  return null;
18498
17007
  }