@achyutlabsau/vue-payment-gateway 0.15.1 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import { d as e, f as t, m as n, p as r, s as i } from "./PairInstructions-Bxziv
2
2
  import { i as a, t as o } from "./tyro-CfOu7q7t.js";
3
3
  import { f as s, m as c } from "./mx51-Df356gl0.js";
4
4
  import { a as l, i as u, r as d } from "./worldline-CEiMow5_.js";
5
- import { n as f } from "./utils-LqvcWjKL.js";
6
- import { t as p } from "./linkly-CT1cdbii.js";
7
- import { t as m } from "./smartpay-ebnYmikX.js";
8
- import { t as h } from "./till-payment-D4iFCkpk.js";
5
+ import { n as f } from "./utils-o5X3364V.js";
6
+ import { t as p } from "./linkly-D3mav3HW.js";
7
+ import { t as m } from "./smartpay-Be3u1f3L.js";
8
+ import { t as h } from "./till-payment-C1iLnYV7.js";
9
9
  import { t as g } from "./valpay-DVV1AH4F.js";
10
10
  import { createBlock as _, createCommentVNode as v, createElementBlock as y, defineComponent as b, openBlock as x, unref as S } from "vue";
11
11
  import { useEventListener as C, useScriptTag as w } from "@vueuse/core";
@@ -1,12 +1,12 @@
1
1
  import { a as e, h as t, i as n, o as r, r as i, t as a, u as o } from "./PairInstructions-BxzivULm.js";
2
- import { i as s, n as c, r as l, t as u } from "./utils-LqvcWjKL.js";
3
- import { t as d } from "./utils-BPFf60Ai.js";
4
- import { t as f } from "./core-BMUVlh-t.js";
5
- import { createBlock as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, onMounted as ee, openBlock as y, ref as b, renderSlot as x, resolveDirective as S, toDisplayString as te, unref as C, useModel as w, withCtx as T, withDirectives as E } from "vue";
6
- import { Dialog as D, Loading as O, Notify as k, QBtn as A, QCard as j, QCardActions as ne, QCardSection as re, QDialog as ie, QForm as ae, QIcon as M, QInput as N, QToolbar as P, QToolbarTitle as F } from "quasar";
7
- import { useLocalStorage as oe } from "@vueuse/core";
2
+ import { a as s, i as c, n as l, r as u, t as d } from "./utils-o5X3364V.js";
3
+ import { t as f } from "./utils-BPFf60Ai.js";
4
+ import { t as p } from "./core-BMUVlh-t.js";
5
+ import { createBlock as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, onMounted as ee, openBlock as b, ref as x, renderSlot as S, resolveDirective as C, toDisplayString as w, unref as T, useModel as E, withCtx as D, withDirectives as O } from "vue";
6
+ import { Dialog as te, Loading as k, Notify as A, QBtn as j, QCard as M, QCardActions as ne, QCardSection as re, QDialog as ie, QForm as N, QIcon as P, QInput as F, QToolbar as ae, QToolbarTitle as oe } from "quasar";
7
+ import { useLocalStorage as se } from "@vueuse/core";
8
8
  import { v7 as I } from "uuid";
9
- import L, { HttpStatusCode as R, isAxiosError as se } from "axios";
9
+ import L, { HttpStatusCode as R, isAxiosError as ce } from "axios";
10
10
  //#region src/library/linkly/linkly.config.ts
11
11
  var z = {
12
12
  PATHS: {
@@ -36,7 +36,7 @@ var z = {
36
36
  BASE: "https://rest.pos.cloud.pceftpos.com/v1/sessions/"
37
37
  }
38
38
  }
39
- }, B = { async: !1 }, V = 18e4, H = 2e3, U = 1e3, { PATHS: W, STORAGE_KEYS: G } = z, ce = class {
39
+ }, B = { async: !1 }, V = 18e4, H = 2e3, U = 1e3, { PATHS: W, STORAGE_KEYS: G } = z, le = class {
40
40
  _api;
41
41
  _authApi;
42
42
  token = null;
@@ -63,7 +63,7 @@ var z = {
63
63
  }
64
64
  _getErrorMessage(e, t) {
65
65
  let n = t ?? "An unexpected error occurred.";
66
- if (se(e)) {
66
+ if (ce(e)) {
67
67
  let t = e.response?.status;
68
68
  switch (t) {
69
69
  case R.Unauthorized:
@@ -75,9 +75,9 @@ var z = {
75
75
  case R.RequestTimeout:
76
76
  n = "Request Timeout. This should be rare: a transient error has occurred, possibly due to server overloading.";
77
77
  break;
78
- default: s(t) && (n = "A server error has occurred. Wait a few seconds and attempt the request again. If the problem persists, contact Linkly Support.");
78
+ default: c(t) && (n = "A server error has occurred. Wait a few seconds and attempt the request again. If the problem persists, contact Linkly Support.");
79
79
  }
80
- l(e) && (n = "You are not connected to the internet");
80
+ u(e) && (n = "You are not connected to the internet");
81
81
  }
82
82
  return n;
83
83
  }
@@ -140,7 +140,7 @@ var z = {
140
140
  } catch {
141
141
  throw Error("Failed to authenticate. Please check your Linkly account credentials.", { cause: n });
142
142
  }
143
- if (r === R.RequestTimeout || s(n)) return this.getTransactionStatus(t);
143
+ if (r === R.RequestTimeout || c(n)) return this.getTransactionStatus(t);
144
144
  }
145
145
  throw n;
146
146
  }
@@ -153,8 +153,8 @@ var z = {
153
153
  } catch (e) {
154
154
  if (L.isAxiosError(e)) {
155
155
  let r = e.response?.status ?? 0;
156
- if (r === R.RequestTimeout || s(e)) {
157
- if (t < V) return await u(H), t = Math.min(t + U, V), n();
156
+ if (r === R.RequestTimeout || c(e)) {
157
+ if (t < V) return await d(H), t = Math.min(t + U, V), n();
158
158
  throw Error("Unable to get the transaction details. Please contact service provider!", { cause: e });
159
159
  } else if (r === R.Unauthorized) return await this.getLinklyAuthToken(), n();
160
160
  }
@@ -190,7 +190,7 @@ var z = {
190
190
  data: null
191
191
  };
192
192
  }
193
- if (n === R.RequestTimeout || s(t)) return await u(), this.reprintReceipt(e);
193
+ if (n === R.RequestTimeout || c(t)) return await d(), this.reprintReceipt(e);
194
194
  }
195
195
  return {
196
196
  success: !1,
@@ -219,7 +219,7 @@ var z = {
219
219
  message: "Failed to authenticate. Please check your Linkly account credentials."
220
220
  };
221
221
  }
222
- if (n === R.RequestTimeout || s(t)) return await u(), this.sendKey(e);
222
+ if (n === R.RequestTimeout || c(t)) return await d(), this.sendKey(e);
223
223
  }
224
224
  return {
225
225
  success: !1,
@@ -240,15 +240,15 @@ var z = {
240
240
  }({}), Z = /* @__PURE__ */ function(e) {
241
241
  return e.APPROVED = "APPROVED", e.CANCELLED = "CANCELLED", e.DECLINED = "DECLINED", e.UNKNOWN = "UNKNOWN", e;
242
242
  }({}), Q = () => {
243
- let e = new ce({
243
+ let e = new le({
244
244
  posId: t.posId,
245
245
  posName: t.productName,
246
246
  posVendorId: t.productVendorName,
247
247
  posVersion: t.productVersion,
248
248
  environment: o.value
249
249
  }), n = async (t) => {
250
- let n = D.create({
251
- ...d,
250
+ let n = te.create({
251
+ ...f,
252
252
  message: "Pairing with the terminal..."
253
253
  }), r = await e.pairPinpad(t);
254
254
  return n.update({
@@ -261,13 +261,13 @@ var z = {
261
261
  let r = { Request: {
262
262
  Merchant: "00",
263
263
  Application: "00",
264
- TxnRef: c(),
264
+ TxnRef: l(),
265
265
  TxnType: n,
266
266
  CurrencyCode: q.AustralianDollar,
267
267
  CutReceipt: t.CutReceipt,
268
268
  AmtPurchase: t.AmtPurchase,
269
269
  ReceiptAutoPrint: t.ReceiptAutoPrint
270
- } }, i = f({
270
+ } }, i = p({
271
271
  message: `${n === K.Purchase ? "Purchase" : "Refund"} of $${t.AmtPurchase / 100} in progress...`,
272
272
  onCancel: () => {
273
273
  i.progress("Trying to cancel transaction..."), e.sendKey(X.Cancel);
@@ -279,26 +279,26 @@ var z = {
279
279
  result: Z.APPROVED,
280
280
  data: t.response,
281
281
  tipAmount: t.response?.amtTip ?? null,
282
- maskedCard: t.response?.pan ?? null,
283
- cardScheme: t.response?.cardType ?? null
282
+ maskedCard: s(t.response?.pan),
283
+ cardScheme: t.response?.cardType?.trim() || null
284
284
  }) : t?.response?.responseCode === Y.GENERAL_DECLINE ? (i.failed("Transaction Declined!"), {
285
285
  result: Z.DECLINED,
286
286
  data: t.response,
287
287
  tipAmount: t.response?.amtTip ?? null,
288
- maskedCard: t.response?.pan ?? null,
289
- cardScheme: t.response?.cardType ?? null
288
+ maskedCard: s(t.response?.pan),
289
+ cardScheme: t.response?.cardType?.trim() || null
290
290
  }) : t?.response?.responseCode === Y.CANCELLED ? (i.failed("Transaction Cancelled!"), {
291
291
  result: Z.CANCELLED,
292
292
  data: t.response,
293
293
  tipAmount: t.response?.amtTip ?? null,
294
- maskedCard: t.response?.pan ?? null,
295
- cardScheme: t.response?.cardType ?? null
294
+ maskedCard: s(t.response?.pan),
295
+ cardScheme: t.response?.cardType?.trim() || null
296
296
  }) : (i.failed("Transaction Failed!"), {
297
297
  result: Z.UNKNOWN,
298
298
  data: t.response,
299
299
  tipAmount: t.response?.amtTip ?? null,
300
- maskedCard: t.response?.pan ?? null,
301
- cardScheme: t.response?.cardType ?? null
300
+ maskedCard: s(t.response?.pan),
301
+ cardScheme: t.response?.cardType?.trim() || null
302
302
  });
303
303
  } catch (e) {
304
304
  throw i.failed("Transaction Failed!"), e;
@@ -323,7 +323,7 @@ var z = {
323
323
  getTransactionBySessionId: e.getTransactionStatus,
324
324
  getLastTransaction: e.getLastTransactionStatus
325
325
  };
326
- }, le = { class: "" }, ue = /* @__PURE__ */ v({
326
+ }, ue = { class: "" }, de = /* @__PURE__ */ y({
327
327
  __name: "ReprintReceiptDialog",
328
328
  props: {
329
329
  modelValue: { type: Boolean },
@@ -331,37 +331,37 @@ var z = {
331
331
  },
332
332
  emits: ["update:modelValue"],
333
333
  setup(e) {
334
- let t = Q(), n = w(e, "modelValue"), r = b(""), i = async () => {
334
+ let t = Q(), n = E(e, "modelValue"), r = x(""), i = async () => {
335
335
  try {
336
- O.show({ group: "reprintReceipt" });
336
+ k.show({ group: "reprintReceipt" });
337
337
  let e = await t.reprintReceipt(r.value || void 0);
338
- e.success ? (n.value = !1, k.create("Receipt printed successfully")) : k.create({
338
+ e.success ? (n.value = !1, A.create("Receipt printed successfully")) : A.create({
339
339
  type: "negative",
340
340
  message: e.message
341
341
  });
342
342
  } catch (e) {
343
343
  let t = e instanceof Error ? e.message : "Failed to print receipts";
344
- k.create({
344
+ A.create({
345
345
  type: "negative",
346
346
  message: t
347
347
  });
348
348
  } finally {
349
- O.hide("reprintReceipt");
349
+ k.hide("reprintReceipt");
350
350
  }
351
351
  };
352
352
  return (e, t) => {
353
- let a = S("close-popup");
354
- return y(), p(C(ie), {
353
+ let a = C("close-popup");
354
+ return b(), m(T(ie), {
355
355
  modelValue: n.value,
356
356
  "onUpdate:modelValue": t[1] ||= (e) => n.value = e
357
357
  }, {
358
- default: T(() => [_(C(j), { class: "w-full" }, {
359
- default: T(() => [
360
- _(C(P), { class: "bg-primary text-white" }, {
361
- default: T(() => [_(C(F), null, {
362
- default: T(() => [x(e.$slots, "title", {}, () => [t[2] ||= g("Reprint Receipt", -1)])]),
358
+ default: D(() => [v(T(M), { class: "w-full" }, {
359
+ default: D(() => [
360
+ v(T(ae), { class: "bg-primary text-white" }, {
361
+ default: D(() => [v(T(oe), null, {
362
+ default: D(() => [S(e.$slots, "title", {}, () => [t[2] ||= _("Reprint Receipt", -1)])]),
363
363
  _: 3
364
- }), E(_(C(M), {
364
+ }), O(v(T(P), {
365
365
  class: "float-right cursor-pointer rounded p-2 transition-colors",
366
366
  color: "gray",
367
367
  name: "close",
@@ -369,8 +369,8 @@ var z = {
369
369
  }, null, 512), [[a]])]),
370
370
  _: 3
371
371
  }),
372
- _(C(re), null, {
373
- default: T(() => [h("div", le, [t[3] ||= g(" Txn Number: ", -1), _(C(N), {
372
+ v(T(re), null, {
373
+ default: D(() => [g("div", ue, [t[3] ||= _(" Txn Number: ", -1), v(T(F), {
374
374
  modelValue: r.value,
375
375
  "onUpdate:modelValue": t[0] ||= (e) => r.value = e,
376
376
  class: "q-mb-sm",
@@ -381,16 +381,16 @@ var z = {
381
381
  }, null, 8, ["modelValue"])])]),
382
382
  _: 1
383
383
  }),
384
- _(C(ne), {
384
+ v(T(ne), {
385
385
  class: "!p-4",
386
386
  align: "right"
387
387
  }, {
388
- default: T(() => [E(_(C(A), {
388
+ default: D(() => [O(v(T(j), {
389
389
  label: "Cancel",
390
390
  "no-caps": "",
391
391
  unelevated: "",
392
392
  flat: ""
393
- }, null, 512), [[a]]), _(C(A), {
393
+ }, null, 512), [[a]]), v(T(j), {
394
394
  label: "Re-print Receipt",
395
395
  "no-caps": "",
396
396
  unelevated: "",
@@ -406,7 +406,7 @@ var z = {
406
406
  }, 8, ["modelValue"]);
407
407
  };
408
408
  }
409
- }), de = { class: "" }, fe = { class: "text-center" }, pe = { class: "mb-6" }, $ = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, me = { class: "!space-x-3" }, he = { key: 1 }, ge = { class: "flex items-center justify-end gap-3" }, _e = /* @__PURE__ */ v({
409
+ }), fe = { class: "" }, pe = { class: "text-center" }, $ = { class: "mb-6" }, me = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, he = { class: "!space-x-3" }, ge = { key: 1 }, _e = { class: "flex items-center justify-end gap-3" }, ve = /* @__PURE__ */ y({
410
410
  __name: "PairLinkly",
411
411
  emits: ["pairing-success"],
412
412
  setup(t, { emit: o }) {
@@ -415,71 +415,71 @@ var z = {
415
415
  "Set the PIN pad up to connect to the Linkly cloud. Each bank may have different configuration settings.",
416
416
  "Once connected, the PIN pad will display a temporary 'pair code'",
417
417
  "Enter the username, password, and PIN pad 'pair code' from the PIN pad in the form on next screen."
418
- ], c = (e) => [(t) => !!t || `${e} is required`, (t) => t.length <= 16 || `${e} must be less than 16 characters.`], l = o, u = Q(), d = oe("linkly.pairConfig", {
418
+ ], c = (e) => [(t) => !!t || `${e} is required`, (t) => t.length <= 16 || `${e} must be less than 16 characters.`], l = o, u = Q(), d = se("linkly.pairConfig", {
419
419
  isPaired: !1,
420
420
  lastPairedDate: null
421
- }), f = b(!1), g = b({
421
+ }), f = x(!1), p = x({
422
422
  username: "",
423
423
  password: "",
424
424
  pairCode: ""
425
- }), v = b(!d.value.isPaired), x = () => {
426
- v.value = !1;
425
+ }), _ = x(!d.value.isPaired), y = () => {
426
+ _.value = !1;
427
427
  }, S = async () => {
428
- let e = await u.pairPinpad(g.value);
428
+ let e = await u.pairPinpad(p.value);
429
429
  e.success && (d.value.isPaired = !0, d.value.lastPairedDate = /* @__PURE__ */ new Date(), l("pairing-success", e));
430
- }, w = () => {
430
+ }, C = () => {
431
431
  u.unpairPinpad(), d.value.isPaired = !1, d.value.lastPairedDate = null;
432
432
  };
433
- return ee(() => {}), (t, o) => (y(), m("div", de, [C(d).isPaired ? (y(), p(C(j), {
433
+ return ee(() => {}), (t, o) => (b(), h("div", fe, [T(d).isPaired ? (b(), m(T(M), {
434
434
  key: "paired",
435
435
  class: "flex items-center justify-center rounded-lg p-8",
436
436
  flat: "",
437
437
  bordered: ""
438
438
  }, {
439
- default: T(() => [h("div", fe, [
440
- h("div", pe, [_(C(M), {
441
- name: C(i),
439
+ default: D(() => [g("div", pe, [
440
+ g("div", $, [v(T(P), {
441
+ name: T(i),
442
442
  size: "4rem",
443
443
  class: "text-green-500"
444
444
  }, null, 8, ["name"])]),
445
- o[6] ||= h("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
446
- h("p", $, " Last paired: " + te(new Date(C(d).lastPairedDate).toLocaleString()), 1),
447
- h("div", me, [_(C(A), {
445
+ o[6] ||= g("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
446
+ g("p", me, " Last paired: " + w(new Date(T(d).lastPairedDate).toLocaleString()), 1),
447
+ g("div", he, [v(T(j), {
448
448
  color: "green",
449
449
  "no-caps": "",
450
450
  outline: "",
451
451
  unelevated: "",
452
452
  label: "Reprint Receipt",
453
- "icon-left": C(n),
453
+ "icon-left": T(n),
454
454
  onClick: o[0] ||= (e) => f.value = !0
455
- }, null, 8, ["icon-left"]), _(C(A), {
455
+ }, null, 8, ["icon-left"]), v(T(j), {
456
456
  color: "primary",
457
457
  unelevated: "",
458
458
  "no-caps": "",
459
- "icon-left": C(r),
459
+ "icon-left": T(r),
460
460
  label: "Re-pair Terminal",
461
- onClick: w
461
+ onClick: C
462
462
  }, null, 8, ["icon-left"])])
463
463
  ])]),
464
464
  _: 1
465
- })) : (y(), m("section", he, [v.value ? (y(), p(a, {
465
+ })) : (b(), h("section", ge, [_.value ? (b(), m(a, {
466
466
  key: 0,
467
- onNext: x,
467
+ onNext: y,
468
468
  steps: s
469
- })) : (y(), p(C(j), {
469
+ })) : (b(), m(T(M), {
470
470
  key: 1,
471
471
  flat: "",
472
472
  bordered: "",
473
473
  class: "w-full rounded-md p-6"
474
474
  }, {
475
- default: T(() => [o[7] ||= h("div", { class: "text-lg font-semibold" }, "Pairing configuration", -1), _(C(ae), {
475
+ default: D(() => [o[7] ||= g("div", { class: "text-lg font-semibold" }, "Pairing configuration", -1), v(T(N), {
476
476
  onSubmit: S,
477
477
  class: "mt-6 space-y-4"
478
478
  }, {
479
- default: T(() => [
480
- _(C(N), {
481
- modelValue: g.value.username,
482
- "onUpdate:modelValue": o[1] ||= (e) => g.value.username = e,
479
+ default: D(() => [
480
+ v(T(F), {
481
+ modelValue: p.value.username,
482
+ "onUpdate:modelValue": o[1] ||= (e) => p.value.username = e,
483
483
  rules: c("Username"),
484
484
  label: "Username",
485
485
  hint: "Cloud EFT Client Username",
@@ -488,9 +488,9 @@ var z = {
488
488
  "no-error-icon": "",
489
489
  dense: ""
490
490
  }, null, 8, ["modelValue", "rules"]),
491
- _(C(N), {
492
- modelValue: g.value.password,
493
- "onUpdate:modelValue": o[2] ||= (e) => g.value.password = e,
491
+ v(T(F), {
492
+ modelValue: p.value.password,
493
+ "onUpdate:modelValue": o[2] ||= (e) => p.value.password = e,
494
494
  rules: c("Password"),
495
495
  label: "Password",
496
496
  "no-error-icon": "",
@@ -499,9 +499,9 @@ var z = {
499
499
  hint: "Enter Cloud EFT Client Password",
500
500
  dense: ""
501
501
  }, null, 8, ["modelValue", "rules"]),
502
- _(C(N), {
503
- modelValue: g.value.pairCode,
504
- "onUpdate:modelValue": o[3] ||= (e) => g.value.pairCode = e,
502
+ v(T(F), {
503
+ modelValue: p.value.pairCode,
504
+ "onUpdate:modelValue": o[3] ||= (e) => p.value.pairCode = e,
505
505
  rules: c("Pairing Code"),
506
506
  label: "Pairing Code",
507
507
  type: "text",
@@ -510,29 +510,29 @@ var z = {
510
510
  hint: "Enter Pair code from terminal screen",
511
511
  dense: ""
512
512
  }, null, 8, ["modelValue", "rules"]),
513
- h("div", ge, [_(C(A), {
513
+ g("div", _e, [v(T(j), {
514
514
  flat: "",
515
515
  "no-caps": "",
516
516
  label: "Back",
517
- "icon-left": C(n),
518
- onClick: o[4] ||= (e) => v.value = !0
519
- }, null, 8, ["icon-left"]), _(C(A), {
517
+ "icon-left": T(n),
518
+ onClick: o[4] ||= (e) => _.value = !0
519
+ }, null, 8, ["icon-left"]), v(T(j), {
520
520
  type: "submit",
521
521
  color: "primary",
522
522
  unelevated: "",
523
523
  "no-caps": "",
524
- "icon-right": C(e),
524
+ "icon-right": T(e),
525
525
  label: "Pair Device"
526
526
  }, null, 8, ["icon-right"])])
527
527
  ]),
528
528
  _: 1
529
529
  })]),
530
530
  _: 1
531
- }))])), _(ue, {
531
+ }))])), v(de, {
532
532
  modelValue: f.value,
533
533
  "onUpdate:modelValue": o[5] ||= (e) => f.value = e
534
534
  }, null, 8, ["modelValue"])]));
535
535
  }
536
536
  });
537
537
  //#endregion
538
- export { J as a, K as c, X as i, Q as n, Y as o, q as r, Z as s, _e as t };
538
+ export { J as a, K as c, X as i, Q as n, Y as o, q as r, Z as s, ve as t };
package/dist/linkly.d.ts CHANGED
@@ -424,8 +424,8 @@ export declare const useLinkly: () => {
424
424
  };
425
425
  };
426
426
  tipAmount: number;
427
- maskedCard: string;
428
- cardScheme: string;
427
+ maskedCard: string | null;
428
+ cardScheme: string | null;
429
429
  }>;
430
430
  initiateRefund: (data: TransactionPayload) => Promise<{
431
431
  result: TransactionOutcome;
@@ -473,8 +473,8 @@ export declare const useLinkly: () => {
473
473
  };
474
474
  };
475
475
  tipAmount: number;
476
- maskedCard: string;
477
- cardScheme: string;
476
+ maskedCard: string | null;
477
+ cardScheme: string | null;
478
478
  }>;
479
479
  reprintReceipt: (txnRef?: string) => Promise< ReceiptReprintReturn>;
480
480
  getTransactionBySessionId: (transactionId: string) => Promise< LinklyTransactionResponse>;
package/dist/linkly.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./linkly-CT1cdbii.js";
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./linkly-D3mav3HW.js";
2
2
  export { a as CurrencyCodes, n as LinklyKeyType, s as PairLinkly, e as ReceiptAutoPrint, i as ResponseCodes, o as TransactionOutcome, t as TransactionTypes, r as useLinkly };
@@ -1,5 +1,5 @@
1
1
  import { a as e, h as t, i as n, o as r, r as i, t as a, u as o } from "./PairInstructions-BxzivULm.js";
2
- import { t as s } from "./utils-LqvcWjKL.js";
2
+ import { t as s } from "./utils-o5X3364V.js";
3
3
  import { t as c } from "./utils-BPFf60Ai.js";
4
4
  import { createBlock as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, openBlock as h, ref as g, toDisplayString as _, unref as v, withCtx as y, withModifiers as b } from "vue";
5
5
  import { Dialog as x, QBtn as S, QCard as C, QIcon as w, QInput as T } from "quasar";
package/dist/smartpay.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./smartpay-ebnYmikX.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./smartpay-Be3u1f3L.js";
2
2
  export { n as DEV_SMARTPAY_API_URL, e as PROD_SMARTPAY_API_URL, c as PairSmartPay, a as ResultType, o as SmartPay, s as TransactionOutcome, t as TransactionResult, r as TransactionStatus, l as TransactionTypes, i as useSmartPay };
@@ -1,21 +1,21 @@
1
1
  import { a as e, h as t, i as n, o as r, r as i, t as a } from "./PairInstructions-BxzivULm.js";
2
- import { t as o } from "./utils-LqvcWjKL.js";
3
- import { n as s, r as c, t as l } from "./core-BMUVlh-t.js";
4
- import { createBlock as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, onMounted as g, openBlock as _, ref as v, renderSlot as y, resolveDirective as b, toDisplayString as x, unref as S, useModel as C, withCtx as w, withDirectives as T } from "vue";
5
- import { Dialog as E, Loading as D, Notify as O, QBtn as k, QCard as A, QCardActions as j, QCardSection as M, QDialog as N, QForm as P, QIcon as F, QInput as I, QSelect as L, QToolbar as R, QToolbarTitle as z } from "quasar";
2
+ import { a as o, t as s } from "./utils-o5X3364V.js";
3
+ import { n as c, r as l, t as u } from "./core-BMUVlh-t.js";
4
+ import { createBlock as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, onMounted as _, openBlock as v, ref as y, renderSlot as b, resolveDirective as x, toDisplayString as S, unref as C, useModel as w, withCtx as T, withDirectives as E } from "vue";
5
+ import { Dialog as D, Loading as O, Notify as k, QBtn as A, QCard as j, QCardActions as M, QCardSection as N, QDialog as P, QForm as F, QIcon as I, QInput as L, QSelect as R, QToolbar as ee, QToolbarTitle as z } from "quasar";
6
6
  import { useLocalStorage as B } from "@vueuse/core";
7
7
  import { validate as V } from "uuid";
8
8
  import H from "dayjs";
9
- import U, { HttpStatusCode as W, isAxiosError as ee } from "axios";
9
+ import U, { HttpStatusCode as W, isAxiosError as G } from "axios";
10
10
  //#region src/library/till-payment/tillPayment.enums.ts
11
- var te = /* @__PURE__ */ function(e) {
11
+ var K = /* @__PURE__ */ function(e) {
12
12
  return e.SETTLEMENT = "SETTLEMENT", e.PRE_SETTLEMENT = "PRE_SETTLEMENT", e.LAST_SETTLEMENT = "LAST_SETTLEMENT", e;
13
- }({}), G = /* @__PURE__ */ function(e) {
13
+ }({}), q = /* @__PURE__ */ function(e) {
14
14
  return e.REPRINT_RECEIPT = "REPRINT_RECEIPT", e.PAYMENT = "PAYMENT", e.REFUND = "REFUND", e.REVERSAL = "REVERSAL", e.PREAUTH = "PREAUTH", e.PREAUTH_CANCEL = "PREAUTH_CANCEL", e.PREAUTH_CAPTURE = "PREAUTH_CAPTURE", e;
15
- }({}), K = /* @__PURE__ */ function(e) {
15
+ }({}), J = /* @__PURE__ */ function(e) {
16
16
  return e.Accepted = "accepted", e.Declined = "declined", e.Cancelled = "cancelled", e.Timeout = "timeout", e.Failed = "failed", e;
17
- }({}), q = (e) => {
18
- if (console.error(e), ee(e)) {
17
+ }({}), Y = (e) => {
18
+ if (console.error(e), G(e)) {
19
19
  let t = e.response?.data, n = t?.statusCode, r = e.code === "ERR_NETWORK";
20
20
  return {
21
21
  error: !0,
@@ -29,7 +29,7 @@ var te = /* @__PURE__ */ function(e) {
29
29
  message: e instanceof Error ? e.message : "something went wrong!",
30
30
  statusCode: W.BadRequest
31
31
  };
32
- }, J = (e) => (e / 100).toFixed(2), Y = (e, t) => {
32
+ }, X = (e) => (e / 100).toFixed(2), Z = (e, t) => {
33
33
  try {
34
34
  if (!t) return null;
35
35
  let n = JSON.parse(t), r = n.maskedMerchantId || `...${n.merchantId.slice(-4)}`, i = n.maskedTerminalId || n.terminalId, a = n.authMessage?.split("\\n") || [], o = a[0] || "", s = a[1] || "", c = (e, t) => `${e.padEnd(14)}${" AUD".padEnd(8)}${`$${t}`.padStart(10)}`;
@@ -44,14 +44,14 @@ var te = /* @__PURE__ */ function(e) {
44
44
  Card: ${n.maskedPan}
45
45
  Method: ${n.cardEntryMethod}${n.applicationIdentifier ? `\n AID: ${n.applicationIdentifier}` : ""}\n`,
46
46
  "",
47
- c(n.transactionType, J(n.amount.subtotal || n.paymentAmount - (n.amount.surcharge || 0) - (n.amount.tip || 0))),
47
+ c(n.transactionType, X(n.amount.subtotal || n.paymentAmount - (n.amount.surcharge || 0) - (n.amount.tip || 0))),
48
48
  [
49
- n.amount.surcharge > 0 ? c("Surcharge", J(n.amount.surcharge)) : null,
50
- n.amount.tip > 0 ? c("Tip", J(n.amount.tip)) : null,
51
- n.amount.tax > 0 ? c("Tax", J(n.amount.tax)) : null
49
+ n.amount.surcharge > 0 ? c("Surcharge", X(n.amount.surcharge)) : null,
50
+ n.amount.tip > 0 ? c("Tip", X(n.amount.tip)) : null,
51
+ n.amount.tax > 0 ? c("Tax", X(n.amount.tax)) : null
52
52
  ].filter(Boolean).join("\n"),
53
53
  "-".repeat(32),
54
- c("Total", J(n.paymentAmount)),
54
+ c("Total", X(n.paymentAmount)),
55
55
  `
56
56
  Auth Code: ${n.authCode}
57
57
  Response: ${o} ${s}
@@ -65,7 +65,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
65
65
  } catch (e) {
66
66
  return console.error("Receipt generation error:", e), null;
67
67
  }
68
- }, X = class e {
68
+ }, Q = class e {
69
69
  api;
70
70
  config;
71
71
  static URLS = {
@@ -113,14 +113,14 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
113
113
  try {
114
114
  return (await this.api.get("/terminals")).data.terminals;
115
115
  } catch (e) {
116
- return q(e);
116
+ return Y(e);
117
117
  }
118
118
  }
119
119
  async getSpecificTerminal(e) {
120
120
  try {
121
121
  return (await this.api.get(`/terminals/${e}`)).data.terminal;
122
122
  } catch (e) {
123
- return q(e);
123
+ return Y(e);
124
124
  }
125
125
  }
126
126
  async pairTerminal(e) {
@@ -132,7 +132,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
132
132
  statusCode: 0
133
133
  };
134
134
  } catch (e) {
135
- return q(e);
135
+ return Y(e);
136
136
  }
137
137
  }
138
138
  unpair() {
@@ -143,11 +143,11 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
143
143
  let t = await this.api.get(`/intent/${e}`);
144
144
  return {
145
145
  ...t.data,
146
- customerReceipt: Y("CUSTOMER COPY", t.data.transactionDetails?.rawReceipt),
147
- merchantReceipt: Y("MERCHANT COPY", t.data.transactionDetails?.rawReceipt)
146
+ customerReceipt: Z("CUSTOMER COPY", t.data.transactionDetails?.rawReceipt),
147
+ merchantReceipt: Z("MERCHANT COPY", t.data.transactionDetails?.rawReceipt)
148
148
  };
149
149
  } catch (e) {
150
- return q(e);
150
+ return Y(e);
151
151
  }
152
152
  }
153
153
  async createPaymentIntent(e) {
@@ -165,7 +165,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
165
165
  if (!e) return;
166
166
  if ((await this.api.post(`/intent/${e}/cancel`, { tid: this._getTid() })).status === 204) return !0;
167
167
  } catch (e) {
168
- return q(e);
168
+ return Y(e);
169
169
  }
170
170
  }
171
171
  async requestTerminalToProcessIntent(e, t) {
@@ -178,14 +178,14 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
178
178
  async processTransaction(e, t) {
179
179
  try {
180
180
  if (this._setRunningTxnId(t), !await this.requestTerminalToProcessIntent(e, t)) return this._deleteRunningTxnId(), {
181
- transactionOutcome: K.Failed,
181
+ transactionOutcome: J.Failed,
182
182
  message: "Failed to send payment request to terminal.",
183
183
  data: null
184
184
  };
185
185
  this._setLastTransactionId(t);
186
186
  let n, r = Date.now(), i = /* @__PURE__ */ new Set(["PENDING", "PROCESSING"]), a;
187
187
  for (; Date.now() - r < 18e4 && (!n || i.has(n.status));) {
188
- await o(2e3);
188
+ await s(2e3);
189
189
  let e = await this.getIntentById(t);
190
190
  if ("error" in e) {
191
191
  if (e.code === "ERR_NETWORK") continue;
@@ -193,12 +193,12 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
193
193
  }
194
194
  n = e;
195
195
  }
196
- return a = !n || i.has(n.status) ? K.Timeout : n.status === "COMPLETED" ? n.transactionDetails?.status === "SUCCESS" ? K.Accepted : n.transactionDetails?.status === "CANCELLED" ? K.Cancelled : n.transactionDetails?.status === "DECLINED" ? K.Declined : K.Failed : K.Failed, this._deleteRunningTxnId(), {
196
+ return a = !n || i.has(n.status) ? J.Timeout : n.status === "COMPLETED" ? n.transactionDetails?.status === "SUCCESS" ? J.Accepted : n.transactionDetails?.status === "CANCELLED" ? J.Cancelled : n.transactionDetails?.status === "DECLINED" ? J.Declined : J.Failed : J.Failed, this._deleteRunningTxnId(), {
197
197
  transactionOutcome: a,
198
198
  data: n
199
199
  };
200
200
  } catch (e) {
201
- return this._deleteRunningTxnId(), q(e);
201
+ return this._deleteRunningTxnId(), Y(e);
202
202
  }
203
203
  }
204
204
  async initiatePurchase(e) {
@@ -206,7 +206,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
206
206
  let t = await this.createPaymentIntent(e);
207
207
  return this.processTransaction(this._getTid(), t.intentId);
208
208
  } catch (e) {
209
- return q(e);
209
+ return Y(e);
210
210
  }
211
211
  }
212
212
  async initiateRefund(e) {
@@ -214,14 +214,14 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
214
214
  let t = await this.createRefundIntent(e);
215
215
  return this.processTransaction(this._getTid(), t.intentId);
216
216
  } catch (e) {
217
- return q(e);
217
+ return Y(e);
218
218
  }
219
219
  }
220
220
  async reprintReceipt(e) {
221
221
  try {
222
222
  let t = await this.createNftIntent({
223
223
  parentIntentId: e,
224
- type: G.REPRINT_RECEIPT
224
+ type: q.REPRINT_RECEIPT
225
225
  });
226
226
  return await this.requestTerminalToProcessIntent(this._getTid(), t.intentId) ? {
227
227
  error: !1,
@@ -233,7 +233,7 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
233
233
  statusCode: 0
234
234
  };
235
235
  } catch (e) {
236
- return q(e);
236
+ return Y(e);
237
237
  }
238
238
  }
239
239
  async getLastTransaction() {
@@ -247,23 +247,23 @@ ${H(n.dateTime).format("DD MMM YYYY [at] hh:mm A")}
247
247
  };
248
248
  //#endregion
249
249
  //#region src/library/till-payment/tillPayment.mapper.ts
250
- function Z(e) {
250
+ function te(e) {
251
251
  switch (e) {
252
- case K.Accepted: return s.Approved;
253
- case K.Declined: return s.Declined;
254
- case K.Cancelled: return s.Cancelled;
255
- case K.Timeout: return s.Timeout;
256
- default: return s.Failed;
252
+ case J.Accepted: return c.Approved;
253
+ case J.Declined: return c.Declined;
254
+ case J.Cancelled: return c.Cancelled;
255
+ case J.Timeout: return c.Timeout;
256
+ default: return c.Failed;
257
257
  }
258
258
  }
259
259
  function ne(e) {
260
- if ("error" in e) return c({
261
- status: s.Failed,
260
+ if ("error" in e) return l({
261
+ status: c.Failed,
262
262
  message: e.message,
263
263
  raw: e
264
264
  });
265
- let t = Z(e.transactionOutcome), n = e.data?.transactionDetails, r = n?.paymentMethod?.card, i = r?.last4Digit ? `**** **** **** ${r.last4Digit}` : null, a = {};
266
- return e.data?.merchantReceipt && (a.merchant = e.data.merchantReceipt), e.data?.customerReceipt && (a.customer = e.data.customerReceipt), c({
265
+ let t = te(e.transactionOutcome), n = e.data?.transactionDetails, r = n?.paymentMethod?.card, i = o(r?.last4Digit), a = {};
266
+ return e.data?.merchantReceipt && (a.merchant = e.data.merchantReceipt), e.data?.customerReceipt && (a.customer = e.data.customerReceipt), l({
267
267
  status: t,
268
268
  transactionId: e.data?.intentId ?? null,
269
269
  amount: n?.paymentAmount ?? null,
@@ -272,14 +272,14 @@ function ne(e) {
272
272
  maskedCard: i,
273
273
  cardScheme: r?.scheme ?? null,
274
274
  receipts: a,
275
- message: e.message ?? (t === s.Approved ? "Transaction Accepted!" : `Transaction ${e.transactionOutcome}!`),
275
+ message: e.message ?? (t === c.Approved ? "Transaction Accepted!" : `Transaction ${e.transactionOutcome}!`),
276
276
  raw: e.data ?? null
277
277
  });
278
278
  }
279
279
  //#endregion
280
280
  //#region src/library/till-payment/useTillPayment.ts
281
- var re = () => !!localStorage.getItem("till.tid"), Q = () => {
282
- let e = new X({
281
+ var re = () => !!localStorage.getItem("till.tid"), $ = () => {
282
+ let e = new Q({
283
283
  apiKey: t.tillPaymentApiKey,
284
284
  merchantId: t.tillPaymentMerchantId,
285
285
  environment: "SANDBOX"
@@ -297,7 +297,7 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
297
297
  }, r = () => {
298
298
  e.unpair();
299
299
  }, i = async (t, n, r) => {
300
- let i = r?.tipAmount, a = l({
300
+ let i = r?.tipAmount, a = u({
301
301
  message: `${t} of $${n / 100}${i === void 0 ? "" : ` (+ $${i / 100} tip)`} in progress...`,
302
302
  onCancel: () => {
303
303
  a.progress("Trying to cancel transaction..."), e.cancelIntent();
@@ -316,7 +316,7 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
316
316
  refund: (e) => i("Refund", e),
317
317
  reprintReceipt: async (t) => {
318
318
  try {
319
- return D.show(), await e.reprintReceipt(t);
319
+ return O.show(), await e.reprintReceipt(t);
320
320
  } catch (e) {
321
321
  return console.error(e), {
322
322
  error: !0,
@@ -324,12 +324,12 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
324
324
  statusCode: 400
325
325
  };
326
326
  } finally {
327
- D.hide();
327
+ O.hide();
328
328
  }
329
329
  },
330
330
  raw: e
331
331
  };
332
- }, ie = { class: "" }, ae = /* @__PURE__ */ h({
332
+ }, ie = { class: "" }, ae = /* @__PURE__ */ g({
333
333
  __name: "ReprintReceiptDialog",
334
334
  props: {
335
335
  modelValue: { type: Boolean },
@@ -337,38 +337,38 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
337
337
  },
338
338
  emits: ["update:modelValue"],
339
339
  setup(e) {
340
- let t = Q(), n = C(e, "modelValue"), r = v(""), i = async () => {
340
+ let t = $(), n = w(e, "modelValue"), r = y(""), i = async () => {
341
341
  try {
342
- D.show({ group: "reprintReceipt" });
342
+ O.show({ group: "reprintReceipt" });
343
343
  let e = await t.reprintReceipt(r.value);
344
- e.error ? O.create({
344
+ e.error ? k.create({
345
345
  type: "negative",
346
346
  message: e.message
347
- }) : (n.value = !1, O.create("Receipt printed successfully"));
347
+ }) : (n.value = !1, k.create("Receipt printed successfully"));
348
348
  } catch (e) {
349
349
  let t = e instanceof Error ? e.message : "Failed to print receipts";
350
- O.create({
350
+ k.create({
351
351
  type: "negative",
352
352
  message: t
353
353
  });
354
354
  } finally {
355
- D.hide("reprintReceipt");
355
+ O.hide("reprintReceipt");
356
356
  }
357
357
  };
358
358
  return (e, t) => {
359
- let a = b("close-popup");
360
- return _(), u(S(N), {
359
+ let a = x("close-popup");
360
+ return v(), d(C(P), {
361
361
  modelValue: n.value,
362
362
  "onUpdate:modelValue": t[1] ||= (e) => n.value = e
363
363
  }, {
364
- default: w(() => [m(S(A), { class: "w-full" }, {
365
- default: w(() => [m(S(P), { onSubmit: i }, {
366
- default: w(() => [
367
- m(S(R), { class: "bg-primary text-white" }, {
368
- default: w(() => [m(S(z), null, {
369
- default: w(() => [y(e.$slots, "title", {}, () => [t[2] ||= p("Reprint Receipt", -1)])]),
364
+ default: T(() => [h(C(j), { class: "w-full" }, {
365
+ default: T(() => [h(C(F), { onSubmit: i }, {
366
+ default: T(() => [
367
+ h(C(ee), { class: "bg-primary text-white" }, {
368
+ default: T(() => [h(C(z), null, {
369
+ default: T(() => [b(e.$slots, "title", {}, () => [t[2] ||= m("Reprint Receipt", -1)])]),
370
370
  _: 3
371
- }), T(m(S(F), {
371
+ }), E(h(C(I), {
372
372
  class: "float-right cursor-pointer rounded p-2 transition-colors",
373
373
  color: "gray",
374
374
  name: "close",
@@ -376,11 +376,11 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
376
376
  }, null, 512), [[a]])]),
377
377
  _: 3
378
378
  }),
379
- m(S(M), null, {
380
- default: w(() => [f("div", ie, [t[3] ||= p(" Txn Number: ", -1), m(S(I), {
379
+ h(C(N), null, {
380
+ default: T(() => [p("div", ie, [t[3] ||= m(" Txn Number: ", -1), h(C(L), {
381
381
  modelValue: r.value,
382
382
  "onUpdate:modelValue": t[0] ||= (e) => r.value = e,
383
- rules: [(e) => !!e || "Transaction Id is required", (e) => S(V)(e) || "Invalid Transaction Id"],
383
+ rules: [(e) => !!e || "Transaction Id is required", (e) => C(V)(e) || "Invalid Transaction Id"],
384
384
  class: "q-mb-sm",
385
385
  type: "text",
386
386
  outlined: "",
@@ -390,16 +390,16 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
390
390
  }, null, 8, ["modelValue", "rules"])])]),
391
391
  _: 1
392
392
  }),
393
- m(S(j), {
393
+ h(C(M), {
394
394
  class: "!p-4",
395
395
  align: "right"
396
396
  }, {
397
- default: w(() => [T(m(S(k), {
397
+ default: T(() => [E(h(C(A), {
398
398
  label: "Cancel",
399
399
  "no-caps": "",
400
400
  unelevated: "",
401
401
  flat: ""
402
- }, null, 512), [[a]]), m(S(k), {
402
+ }, null, 512), [[a]]), h(C(A), {
403
403
  label: "Re-print Receipt",
404
404
  "no-caps": "",
405
405
  unelevated: "",
@@ -417,102 +417,102 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
417
417
  }, 8, ["modelValue"]);
418
418
  };
419
419
  }
420
- }), oe = { class: "text-center" }, $ = { class: "mb-6" }, se = { class: "!mb-2 text-sm text-gray-500 dark:text-gray-300" }, ce = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, le = { class: "!space-x-3" }, ue = { key: 1 }, de = { class: "flex items-center justify-end gap-3" }, fe = /* @__PURE__ */ h({
420
+ }), oe = { class: "text-center" }, se = { class: "mb-6" }, ce = { class: "!mb-2 text-sm text-gray-500 dark:text-gray-300" }, le = { class: "mb-6 text-sm text-gray-500 dark:text-gray-300" }, ue = { class: "!space-x-3" }, de = { key: 1 }, fe = { class: "flex items-center justify-end gap-3" }, pe = /* @__PURE__ */ g({
421
421
  __name: "PairTillPayment",
422
422
  setup(t) {
423
423
  let o = [
424
424
  "Plug in the PIN pad and connect it to the internet via cable or Wi-Fi, depending on the EFTPOS hardware.",
425
425
  "Once connected, the PIN pad will display as online.",
426
426
  "Select the terminal on the next screen and click 'Pair Device'."
427
- ], { raw: s, pair: c, unpair: l } = Q(), h = B("till.pairConfig", {
427
+ ], { raw: s, pair: c, unpair: l } = $(), u = B("till.pairConfig", {
428
428
  isPaired: !1,
429
429
  lastPairedDate: "",
430
430
  terminalId: ""
431
- }), y = v([]), b = v(null), C = v(!h.value.isPaired), T = v(!1), j = () => {
432
- C.value = !1;
433
- }, N = () => {
434
- h.value.isPaired = !1, l();
435
- }, I = async () => {
431
+ }), g = y([]), b = y(null), x = y(!u.value.isPaired), w = y(!1), E = () => {
432
+ x.value = !1;
433
+ }, M = () => {
434
+ u.value.isPaired = !1, l();
435
+ }, P = async () => {
436
436
  try {
437
- D.show();
437
+ O.show();
438
438
  let e = await c({ tid: b.value });
439
439
  if (!e.success) {
440
- E.create({
440
+ D.create({
441
441
  title: "Pairing Failed!",
442
442
  message: e.message ?? "Failed To pair terminal."
443
443
  });
444
444
  return;
445
445
  }
446
- h.value.isPaired = !0, h.value.lastPairedDate = /* @__PURE__ */ new Date(), h.value.terminalId = b.value;
446
+ u.value.isPaired = !0, u.value.lastPairedDate = /* @__PURE__ */ new Date(), u.value.terminalId = b.value;
447
447
  } catch (e) {
448
- E.create({
448
+ D.create({
449
449
  title: "Pairing Failed!",
450
450
  message: e instanceof Error ? e.message : "Failed To pair terminal."
451
451
  });
452
452
  } finally {
453
- D.hide();
453
+ O.hide();
454
454
  }
455
- }, R = async () => {
455
+ }, L = async () => {
456
456
  let e = await s.getTerminals();
457
457
  if ("error" in e) {
458
- O.create({
458
+ k.create({
459
459
  type: "negative",
460
460
  message: "failed to fetch terminals"
461
461
  });
462
462
  return;
463
463
  }
464
- y.value = e;
464
+ g.value = e;
465
465
  };
466
- return g(async () => {
467
- await R();
468
- }), (t, s) => (_(), d("div", null, [S(h).isPaired ? (_(), u(S(A), {
466
+ return _(async () => {
467
+ await L();
468
+ }), (t, s) => (v(), f("div", null, [C(u).isPaired ? (v(), d(C(j), {
469
469
  key: "paired",
470
470
  class: "flex items-center justify-center rounded-lg p-8",
471
471
  flat: "",
472
472
  bordered: ""
473
473
  }, {
474
- default: w(() => [f("div", oe, [
475
- f("div", $, [m(S(F), {
476
- name: S(i),
474
+ default: T(() => [p("div", oe, [
475
+ p("div", se, [h(C(I), {
476
+ name: C(i),
477
477
  size: "4rem",
478
478
  class: "text-green-500"
479
479
  }, null, 8, ["name"])]),
480
- s[6] ||= f("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
481
- f("p", se, [s[4] ||= p(" Terminal ID: ", -1), f("b", null, x(S(h).terminalId), 1)]),
482
- f("p", ce, [s[5] ||= p(" Last paired: ", -1), f("b", null, x(new Date(S(h).lastPairedDate).toLocaleString()), 1)]),
483
- f("div", le, [m(S(k), {
480
+ s[6] ||= p("h2", { class: "mb-4 text-3xl font-bold" }, "Terminal Connected", -1),
481
+ p("p", ce, [s[4] ||= m(" Terminal ID: ", -1), p("b", null, S(C(u).terminalId), 1)]),
482
+ p("p", le, [s[5] ||= m(" Last paired: ", -1), p("b", null, S(new Date(C(u).lastPairedDate).toLocaleString()), 1)]),
483
+ p("div", ue, [h(C(A), {
484
484
  color: "green",
485
485
  "no-caps": "",
486
486
  outline: "",
487
487
  unelevated: "",
488
488
  label: "Reprint Receipt",
489
- "icon-left": S(n),
490
- onClick: s[0] ||= (e) => T.value = !0
491
- }, null, 8, ["icon-left"]), m(S(k), {
489
+ "icon-left": C(n),
490
+ onClick: s[0] ||= (e) => w.value = !0
491
+ }, null, 8, ["icon-left"]), h(C(A), {
492
492
  color: "primary",
493
493
  unelevated: "",
494
494
  "no-caps": "",
495
- "icon-left": S(r),
495
+ "icon-left": C(r),
496
496
  label: "Re-pair Terminal",
497
- onClick: N
497
+ onClick: M
498
498
  }, null, 8, ["icon-left"])])
499
- ]), m(ae, {
500
- modelValue: T.value,
501
- "onUpdate:modelValue": s[1] ||= (e) => T.value = e
499
+ ]), h(ae, {
500
+ modelValue: w.value,
501
+ "onUpdate:modelValue": s[1] ||= (e) => w.value = e
502
502
  }, null, 8, ["modelValue"])]),
503
503
  _: 1
504
- })) : (_(), d("div", ue, [C.value ? (_(), u(a, {
504
+ })) : (v(), f("div", de, [x.value ? (v(), d(a, {
505
505
  key: 0,
506
- onNext: j,
506
+ onNext: E,
507
507
  steps: o
508
- })) : (_(), u(S(A), {
508
+ })) : (v(), d(C(j), {
509
509
  key: 1,
510
510
  flat: "",
511
511
  bordered: ""
512
512
  }, {
513
- default: w(() => [m(S(M), null, {
514
- default: w(() => [s[7] ||= f("h3", { class: "mb-3 !text-xl font-semibold" }, "Pairing configuration", -1), m(S(P), { onSubmit: I }, {
515
- default: w(() => [m(S(L), {
513
+ default: T(() => [h(C(N), null, {
514
+ default: T(() => [s[7] ||= p("h3", { class: "mb-3 !text-xl font-semibold" }, "Pairing configuration", -1), h(C(F), { onSubmit: P }, {
515
+ default: T(() => [h(C(R), {
516
516
  label: "Select Terminal",
517
517
  dense: "",
518
518
  outlined: "",
@@ -520,7 +520,7 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
520
520
  "onUpdate:modelValue": s[2] ||= (e) => b.value = e,
521
521
  "option-disable": (e) => e.status.connectivity !== "AVAILABLE",
522
522
  "option-label": ({ name: e, terminalId: t }) => e ? `${e} (${t})` : "",
523
- options: y.value,
523
+ options: g.value,
524
524
  rules: [(e) => !!e || "Please select terminal."],
525
525
  "option-value": "terminalId",
526
526
  "outer-label": "Select Terminal",
@@ -533,18 +533,18 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
533
533
  "option-label",
534
534
  "options",
535
535
  "rules"
536
- ]), f("div", de, [m(S(k), {
536
+ ]), p("div", fe, [h(C(A), {
537
537
  flat: "",
538
538
  "no-caps": "",
539
539
  label: "Back",
540
- "icon-left": S(n),
541
- onClick: s[3] ||= (e) => C.value = !0
542
- }, null, 8, ["icon-left"]), m(S(k), {
540
+ "icon-left": C(n),
541
+ onClick: s[3] ||= (e) => x.value = !0
542
+ }, null, 8, ["icon-left"]), h(C(A), {
543
543
  type: "submit",
544
544
  color: "primary",
545
545
  unelevated: "",
546
546
  "no-caps": "",
547
- "icon-right": S(e),
547
+ "icon-right": C(e),
548
548
  label: "Pair Device"
549
549
  }, null, 8, ["icon-right"])])]),
550
550
  _: 1
@@ -556,4 +556,4 @@ var re = () => !!localStorage.getItem("till.tid"), Q = () => {
556
556
  }
557
557
  });
558
558
  //#endregion
559
- export { K as a, te as i, Q as n, G as o, X as r, fe as t };
559
+ export { J as a, K as i, $ as n, q as o, Q as r, pe as t };
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./till-payment-D4iFCkpk.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./till-payment-C1iLnYV7.js";
2
2
  export { a as PairTillPayment, t as SettlementTypes, i as TillPaymentsApi, e as TransactionOutcome, r as TransactionType, n as useTillPayment };
@@ -1,5 +1,8 @@
1
1
  import e from "axios";
2
2
  //#region src/utils/index.ts
3
- var t = () => `${Date.now().toString()}${Math.floor(1e3 + Math.random() * 9e3).toString()}`.slice(0, 16), n = (e = 1e3) => new Promise((t) => setTimeout(t, e)), r = (e) => e && Number(e) >= 500 && Number(e) <= 599, i = (t) => e.isAxiosError(t) && t.code === "ERR_NETWORK";
3
+ var t = () => `${Date.now().toString()}${Math.floor(1e3 + Math.random() * 9e3).toString()}`.slice(0, 16), n = (e = 1e3) => new Promise((t) => setTimeout(t, e)), r = (e) => e && Number(e) >= 500 && Number(e) <= 599, i = (e) => {
4
+ let t = e?.replace(/\s/g, "");
5
+ return t ? `**** **** **** ${t.slice(-4)}` : null;
6
+ }, a = (t) => e.isAxiosError(t) && t.code === "ERR_NETWORK";
4
7
  //#endregion
5
- export { r as i, t as n, i as r, n as t };
8
+ export { i as a, r as i, t as n, a as r, n as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@achyutlabsau/vue-payment-gateway",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Achyut-Labs/al-pay-npm-pkg#readme",
6
6
  "bugs": {