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