@astropay/payments-lib 0.0.12 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,7 @@ ${t}` : ""}`;
51
51
  function xt(n, e, t) {
52
52
  return e.includes(n) ? n : t;
53
53
  }
54
- const Se = class Se {
54
+ const we = class we {
55
55
  static init(e) {
56
56
  const t = xt(
57
57
  e == null ? void 0 : e.environment,
@@ -62,17 +62,17 @@ const Se = class Se {
62
62
  ps,
63
63
  "iso"
64
64
  );
65
- Se.environment = t, Se.currencyMode = r;
65
+ we.environment = t, we.currencyMode = r;
66
66
  }
67
67
  static getEnvironment() {
68
- return Se.environment;
68
+ return we.environment;
69
69
  }
70
70
  static getCurrencyMode() {
71
- return Se.currencyMode;
71
+ return we.currencyMode;
72
72
  }
73
73
  };
74
- C(Se, "environment"), C(Se, "currencyMode");
75
- let rt = Se;
74
+ C(we, "environment"), C(we, "currencyMode");
75
+ let rt = we;
76
76
  function ii(n, e) {
77
77
  return function() {
78
78
  return n.apply(e, arguments);
@@ -3318,7 +3318,7 @@ const ya = {
3318
3318
  ChromeOS: "Chrome OS",
3319
3319
  PlayStation4: "PlayStation 4",
3320
3320
  Roku: "Roku"
3321
- }, we = {
3321
+ }, Ce = {
3322
3322
  EdgeHTML: "EdgeHTML",
3323
3323
  Blink: "Blink",
3324
3324
  Trident: "Trident",
@@ -4395,11 +4395,11 @@ const Q = /version\/(\d+(\.?_?\d+)+)/i, Ea = [
4395
4395
  describe(n) {
4396
4396
  if (/\sedg\//i.test(n))
4397
4397
  return {
4398
- name: we.Blink
4398
+ name: Ce.Blink
4399
4399
  };
4400
4400
  const t = b.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, n);
4401
4401
  return {
4402
- name: we.EdgeHTML,
4402
+ name: Ce.EdgeHTML,
4403
4403
  version: t
4404
4404
  };
4405
4405
  }
@@ -4409,7 +4409,7 @@ const Q = /version\/(\d+(\.?_?\d+)+)/i, Ea = [
4409
4409
  test: [/trident/i],
4410
4410
  describe(n) {
4411
4411
  const e = {
4412
- name: we.Trident
4412
+ name: Ce.Trident
4413
4413
  }, t = b.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, n);
4414
4414
  return t && (e.version = t), e;
4415
4415
  }
@@ -4421,7 +4421,7 @@ const Q = /version\/(\d+(\.?_?\d+)+)/i, Ea = [
4421
4421
  },
4422
4422
  describe(n) {
4423
4423
  const e = {
4424
- name: we.Presto
4424
+ name: Ce.Presto
4425
4425
  }, t = b.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, n);
4426
4426
  return t && (e.version = t), e;
4427
4427
  }
@@ -4434,7 +4434,7 @@ const Q = /version\/(\d+(\.?_?\d+)+)/i, Ea = [
4434
4434
  },
4435
4435
  describe(n) {
4436
4436
  const e = {
4437
- name: we.Gecko
4437
+ name: Ce.Gecko
4438
4438
  }, t = b.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, n);
4439
4439
  return t && (e.version = t), e;
4440
4440
  }
@@ -4444,7 +4444,7 @@ const Q = /version\/(\d+(\.?_?\d+)+)/i, Ea = [
4444
4444
  test: [/(apple)?webkit\/537\.36/i],
4445
4445
  describe() {
4446
4446
  return {
4447
- name: we.Blink
4447
+ name: Ce.Blink
4448
4448
  };
4449
4449
  }
4450
4450
  },
@@ -4453,7 +4453,7 @@ const Q = /version\/(\d+(\.?_?\d+)+)/i, Ea = [
4453
4453
  test: [/(apple)?webkit/i],
4454
4454
  describe(n) {
4455
4455
  const e = {
4456
- name: we.WebKit
4456
+ name: Ce.WebKit
4457
4457
  }, t = b.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, n);
4458
4458
  return t && (e.version = t), e;
4459
4459
  }
@@ -4795,7 +4795,7 @@ class Ti {
4795
4795
  return Vi;
4796
4796
  }
4797
4797
  static get ENGINE_MAP() {
4798
- return we;
4798
+ return Ce;
4799
4799
  }
4800
4800
  static get OS_MAP() {
4801
4801
  return ne;
@@ -4931,14 +4931,14 @@ C(Y, "GET", async ({
4931
4931
  }), C(Y, "getEncodeParams", () => {
4932
4932
  const e = {
4933
4933
  app_name: Y.config.appName,
4934
- app_id: Ee.getToken(),
4934
+ app_id: Ie.getToken(),
4935
4935
  environment: rt.getEnvironment(),
4936
4936
  platform: Fi(),
4937
- version: "0.0.12"
4937
+ version: "0.1.0"
4938
4938
  };
4939
4939
  return ki(e);
4940
4940
  });
4941
- let Re = Y;
4941
+ let xe = Y;
4942
4942
  const M = {
4943
4943
  surface_dark: "#041311",
4944
4944
  surface_light: "#FFFFFF",
@@ -5025,23 +5025,23 @@ const M = {
5025
5025
  }, va = {
5026
5026
  light: Ui,
5027
5027
  dark: Ia
5028
- }, xe = class xe {
5028
+ }, Se = class Se {
5029
5029
  static init(e) {
5030
5030
  const t = xt(e == null ? void 0 : e.theme, us, "light");
5031
- xe.currentTheme = t, xe.styles = {
5031
+ Se.currentTheme = t, Se.styles = {
5032
5032
  ...va[t],
5033
5033
  ...e == null ? void 0 : e.styles
5034
5034
  };
5035
5035
  }
5036
5036
  static getStyles() {
5037
- return xe.styles;
5037
+ return Se.styles;
5038
5038
  }
5039
5039
  static getTheme() {
5040
- return xe.currentTheme;
5040
+ return Se.currentTheme;
5041
5041
  }
5042
5042
  };
5043
- C(xe, "currentTheme", "light"), C(xe, "styles", Ui);
5044
- let W = xe;
5043
+ C(Se, "currentTheme", "light"), C(Se, "styles", Ui);
5044
+ let W = Se;
5045
5045
  const X = class X {
5046
5046
  constructor() {
5047
5047
  }
@@ -5077,7 +5077,7 @@ const X = class X {
5077
5077
  X.token = e, W.init({ theme: (t == null ? void 0 : t.theme) ?? "light", styles: (t == null ? void 0 : t.styles) ?? {} }), Z.init({ language: (t == null ? void 0 : t.language) ?? "en" }), rt.init({
5078
5078
  environment: (t == null ? void 0 : t.environment) ?? "production",
5079
5079
  currencyMode: (t == null ? void 0 : t.currencyMode) ?? "iso"
5080
- }), Re.init({
5080
+ }), xe.init({
5081
5081
  appName: "ap-cl",
5082
5082
  baseURL: "https://partners-api.astropay.com/api",
5083
5083
  timeout: 5e3
@@ -5113,7 +5113,7 @@ const X = class X {
5113
5113
  }
5114
5114
  };
5115
5115
  C(X, "isInitialized", !1), C(X, "token"), C(X, "components", /* @__PURE__ */ new Set());
5116
- let Ee = X;
5116
+ let Ie = X;
5117
5117
  class j {
5118
5118
  constructor({ tag: e, elementId: t, styles: r }) {
5119
5119
  C(this, "element");
@@ -5831,10 +5831,10 @@ var sl = {
5831
5831
  case "animationName":
5832
5832
  if (typeof t == "string")
5833
5833
  return t.replace(al, function(r, i, s) {
5834
- return Ie = {
5834
+ return Re = {
5835
5835
  name: i,
5836
5836
  styles: s,
5837
- next: Ie
5837
+ next: Re
5838
5838
  }, i;
5839
5839
  });
5840
5840
  }
@@ -5852,20 +5852,20 @@ function Ut(n, e, t) {
5852
5852
  case "object": {
5853
5853
  var i = t;
5854
5854
  if (i.anim === 1)
5855
- return Ie = {
5855
+ return Re = {
5856
5856
  name: i.name,
5857
5857
  styles: i.styles,
5858
- next: Ie
5858
+ next: Re
5859
5859
  }, i.name;
5860
5860
  var s = t;
5861
5861
  if (s.styles !== void 0) {
5862
5862
  var o = s.next;
5863
5863
  if (o !== void 0)
5864
5864
  for (; o !== void 0; )
5865
- Ie = {
5865
+ Re = {
5866
5866
  name: o.name,
5867
5867
  styles: o.styles,
5868
- next: Ie
5868
+ next: Re
5869
5869
  }, o = o.next;
5870
5870
  var a = s.styles + ";";
5871
5871
  return a;
@@ -5908,12 +5908,12 @@ function ll(n, e, t) {
5908
5908
  }
5909
5909
  return r;
5910
5910
  }
5911
- var Rr = /label:\s*([^\s;{]+)\s*(;|$)/g, Ie;
5911
+ var Rr = /label:\s*([^\s;{]+)\s*(;|$)/g, Re;
5912
5912
  function en(n, e, t) {
5913
5913
  if (n.length === 1 && typeof n[0] == "object" && n[0] !== null && n[0].styles !== void 0)
5914
5914
  return n[0];
5915
5915
  var r = !0, i = "";
5916
- Ie = void 0;
5916
+ Re = void 0;
5917
5917
  var s = n[0];
5918
5918
  if (s == null || s.raw === void 0)
5919
5919
  r = !1, i += Ut(t, e, s);
@@ -5933,7 +5933,7 @@ function en(n, e, t) {
5933
5933
  return {
5934
5934
  name: d,
5935
5935
  styles: i,
5936
- next: Ie
5936
+ next: Re
5937
5937
  };
5938
5938
  }
5939
5939
  function Zi(n, e, t) {
@@ -6704,9 +6704,9 @@ function Yl() {
6704
6704
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
6705
6705
  }), nn;
6706
6706
  }
6707
- var rn = {}, Ce = {}, Lr;
6707
+ var rn = {}, Ee = {}, Lr;
6708
6708
  function qe() {
6709
- if (Lr) return Ce;
6709
+ if (Lr) return Ee;
6710
6710
  Lr = 1;
6711
6711
  let n;
6712
6712
  const e = [
@@ -6753,26 +6753,26 @@ function qe() {
6753
6753
  3532,
6754
6754
  3706
6755
6755
  ];
6756
- return Ce.getSymbolSize = function(r) {
6756
+ return Ee.getSymbolSize = function(r) {
6757
6757
  if (!r) throw new Error('"version" cannot be null or undefined');
6758
6758
  if (r < 1 || r > 40) throw new Error('"version" should be in range from 1 to 40');
6759
6759
  return r * 4 + 17;
6760
- }, Ce.getSymbolTotalCodewords = function(r) {
6760
+ }, Ee.getSymbolTotalCodewords = function(r) {
6761
6761
  return e[r];
6762
- }, Ce.getBCHDigit = function(t) {
6762
+ }, Ee.getBCHDigit = function(t) {
6763
6763
  let r = 0;
6764
6764
  for (; t !== 0; )
6765
6765
  r++, t >>>= 1;
6766
6766
  return r;
6767
- }, Ce.setToSJISFunction = function(r) {
6767
+ }, Ee.setToSJISFunction = function(r) {
6768
6768
  if (typeof r != "function")
6769
6769
  throw new Error('"toSJISFunc" is not a valid function.');
6770
6770
  n = r;
6771
- }, Ce.isKanjiModeEnabled = function() {
6771
+ }, Ee.isKanjiModeEnabled = function() {
6772
6772
  return typeof n < "u";
6773
- }, Ce.toSJIS = function(r) {
6773
+ }, Ee.toSJIS = function(r) {
6774
6774
  return n(r);
6775
- }, Ce;
6775
+ }, Ee;
6776
6776
  }
6777
6777
  var sn = {}, Mr;
6778
6778
  function Zn() {
@@ -8781,7 +8781,7 @@ class me {
8781
8781
  }
8782
8782
  C(me, "postCreatePayment", async (e) => {
8783
8783
  try {
8784
- return await Re.POST({
8784
+ return await xe.POST({
8785
8785
  data: e,
8786
8786
  url: wt.createPayment
8787
8787
  });
@@ -8790,7 +8790,7 @@ C(me, "postCreatePayment", async (e) => {
8790
8790
  }
8791
8791
  }), C(me, "postIdentifyUser", async (e, t) => {
8792
8792
  try {
8793
- return await Re.POST({
8793
+ return await xe.POST({
8794
8794
  data: t,
8795
8795
  url: Un(wt.identifyUser, { paymentExternalId: e })
8796
8796
  });
@@ -8799,7 +8799,7 @@ C(me, "postCreatePayment", async (e) => {
8799
8799
  }
8800
8800
  }), C(me, "getPaymentStatus", async (e) => {
8801
8801
  try {
8802
- return await Re.GET({
8802
+ return await xe.GET({
8803
8803
  url: Un(wt.paymentStatus, { paymentExternalId: e })
8804
8804
  });
8805
8805
  } catch (t) {
@@ -8808,7 +8808,7 @@ C(me, "postCreatePayment", async (e) => {
8808
8808
  }), C(me, "getPollingRequest", async (e) => {
8809
8809
  try {
8810
8810
  const t = e.replace(/^\/?api\//, "");
8811
- return await Re.GET({
8811
+ return await xe.GET({
8812
8812
  url: t
8813
8813
  });
8814
8814
  } catch (t) {
@@ -9198,7 +9198,7 @@ class ts {
9198
9198
  }
9199
9199
  C(ts, "postPaymentMethodCreation", async (e) => {
9200
9200
  try {
9201
- return await Re.POST({
9201
+ return await xe.POST({
9202
9202
  url: Un(wt.paymentMethodCreation, {
9203
9203
  paymentExternalId: e.paymentExternalId
9204
9204
  }),
@@ -9706,7 +9706,7 @@ class tu extends j {
9706
9706
  showTitle: !0,
9707
9707
  showDescription: !0,
9708
9708
  ...t
9709
- }, !Ee.isLibInitialized()) {
9709
+ }, !Ie.isLibInitialized()) {
9710
9710
  const i = 'AstroPay Payments Library: Not initialized. Call `AstroPayCore.init("app-id")` first.';
9711
9711
  console.error(i), this.element.innerHTML = "";
9712
9712
  const s = new P({
@@ -9717,7 +9717,7 @@ class tu extends j {
9717
9717
  this.element.append(s);
9718
9718
  return;
9719
9719
  }
9720
- Ee.registerComponent(this), this.loadingWrapper = document.createElement("div"), this.loadingWrapper.classList.add("loading-wrapper");
9720
+ Ie.registerComponent(this), this.loadingWrapper = document.createElement("div"), this.loadingWrapper.classList.add("loading-wrapper");
9721
9721
  const r = new ke({
9722
9722
  size: 100,
9723
9723
  variant: "fetching",
@@ -9837,7 +9837,7 @@ class tu extends j {
9837
9837
  * ```
9838
9838
  */
9839
9839
  destroy() {
9840
- this.element.remove(), Ee.unregisterComponent(this);
9840
+ this.element.remove(), Ie.unregisterComponent(this);
9841
9841
  }
9842
9842
  }
9843
9843
  const Fc = (n) => K`
@@ -9884,7 +9884,7 @@ class nu extends j {
9884
9884
  });
9885
9885
  C(this, "loadingWrapper");
9886
9886
  C(this, "componentProps");
9887
- this.componentProps = t, Ee.registerComponent(this), this.loadingWrapper = document.createElement("div"), this.loadingWrapper.classList.add("loading-wrapper");
9887
+ this.componentProps = t, Ie.registerComponent(this), this.loadingWrapper = document.createElement("div"), this.loadingWrapper.classList.add("loading-wrapper");
9888
9888
  const r = new ke({
9889
9889
  size: 100,
9890
9890
  variant: "fetching",
@@ -9974,13 +9974,13 @@ class nu extends j {
9974
9974
  * ```
9975
9975
  */
9976
9976
  destroy() {
9977
- this.element.remove(), Ee.unregisterComponent(this);
9977
+ this.element.remove(), Ie.unregisterComponent(this);
9978
9978
  }
9979
9979
  }
9980
9980
  ls();
9981
- typeof window < "u" && !window.AstroPayCore && (window.AstroPayCore = Ee);
9982
9981
  export {
9982
+ Ie as AstroPayCore,
9983
9983
  tu as AstroPayFullCheckout,
9984
9984
  nu as AstroPayPayment,
9985
- Ee as default
9985
+ Ie as Core
9986
9986
  };