@feedmepos/mf-inventory-portal 1.5.0 → 1.5.2-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/{App-D56G3kPH.js → App-DYOb7uJv.js} +4 -4
  2. package/dist/{ApprovalView-jCA1FvSS.js → ApprovalView-DRBS-RE3.js} +7 -7
  3. package/dist/{BindingsDialog-aTTSnlPM.js → BindingsDialog-DFBuiKjI.js} +2 -2
  4. package/dist/{BindingsPicker-BbFVGwmp.js → BindingsPicker-BSt1KP3v.js} +2 -2
  5. package/dist/{BindingsTable-5pmkxqhC.js → BindingsTable-DbfWpchk.js} +3 -3
  6. package/dist/ClosingDraftView-CzAV6Ak-.js +3202 -0
  7. package/dist/{ClosingHistoryView-o4wJAJJT.js → ClosingHistoryView-B2m1mFVb.js} +5 -5
  8. package/dist/{ClosingTemplateView-Cbg1Uwjx.js → ClosingTemplateView-CPoNLI4K.js} +14 -14
  9. package/dist/{DefaultView-A3gYMt2N.js → DefaultView-Dr7NC5pE.js} +2 -2
  10. package/dist/{DeliveryOrderPrintPreview-DHFMoSS6.js → DeliveryOrderPrintPreview-CSJ3EbkI.js} +2 -2
  11. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CtFewq-W.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BxCzBq7X.js} +2 -2
  12. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-j3aDZ2cT.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DhFYEJSi.js} +2 -2
  13. package/dist/{FmMultiselectDialog-D-38fV59.js → FmMultiselectDialog-CK4OxOcC.js} +2 -2
  14. package/dist/{FmMultiselectDialog-DHiMw0t6.js → FmMultiselectDialog-Dc9XTsJp.js} +1 -1
  15. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Mic67Qjt.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Cf3ZVYFG.js} +4 -4
  16. package/dist/{ImportView-Ck8rnxyR.js → ImportView-D19TZvnF.js} +6 -6
  17. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BBfMiiPT.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BLS6Nv_u.js} +1 -1
  18. package/dist/{IngredientGroupView-B4ylskyw.js → IngredientGroupView-BArstaQe.js} +5 -5
  19. package/dist/{IngredientsView-DsCfOh07.js → IngredientsView-KOpZ2hFt.js} +15 -15
  20. package/dist/{IntegrationExplorerView-C1Ld_qxp.js → IntegrationExplorerView-Sw7DUhV4.js} +5 -5
  21. package/dist/{IntegrationView-BJmmPrHP.js → IntegrationView-D4T29bFi.js} +13 -13
  22. package/dist/{InventoryBindingForm-b8OONqJs.js → InventoryBindingForm-CZa1x5z5.js} +1 -1
  23. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D8wXZyxi.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-ByLQyONl.js} +5 -5
  24. package/dist/{InventoryBindingSummary-TiO1vsiR.js → InventoryBindingSummary-DAy_XvKk.js} +1 -1
  25. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C50b1vbd.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CCjud7QA.js} +1 -1
  26. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D5Oc4Mz8.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DI4Z24d2.js} +1 -1
  27. package/dist/{PublishView-Cl9ZSgZr.js → PublishView-8SaK6fyS.js} +3 -3
  28. package/dist/{PurchaseOrderPrintPreview-DtMuOktc.js → PurchaseOrderPrintPreview-B2UholCw.js} +2 -2
  29. package/dist/{ReceiveRequestView-zfdKN3Gl.js → ReceiveRequestView-jKp1PH1p.js} +25 -25
  30. package/dist/{RecipeView-CX4paowp.js → RecipeView-B-_V8Hl0.js} +17 -17
  31. package/dist/{SettingsView-DYIXmmYj.js → SettingsView-DoKpbHug.js} +4 -4
  32. package/dist/StockView-BtlUbkCk.js +2573 -0
  33. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-C-OhTH0B.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-y0pbttbS.js} +1 -1
  34. package/dist/{SupplierView-Cpv2OECi.js → SupplierView-B4xKWE8v.js} +12 -12
  35. package/dist/{SurchargeView-pjPgcNoS.js → SurchargeView-B_3TwBUc.js} +6 -6
  36. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-qJoe3Rw5.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BW6VWRLA.js} +2 -2
  37. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BKLYNLrJ.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-atJQ2x6h.js} +1 -1
  38. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DtY8MWv5.js → TransferDetails.vue_vue_type_script_setup_true_lang-yt-idxfW.js} +21 -21
  39. package/dist/{TransferTemplateView-Btxrrwm5.js → TransferTemplateView-Df5vRxcF.js} +18 -18
  40. package/dist/{UnitCostHistoryView-CdfBkfuD.js → UnitCostHistoryView-VD8C3tW0.js} +4 -4
  41. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-IYlWKszA.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-BZ9doLmV.js} +4 -4
  42. package/dist/{UnitView-CuklnpEd.js → UnitView-CXOAeVfR.js} +7 -7
  43. package/dist/{WarehouseView-BigoM5Fc.js → WarehouseView-Cqq49OjI.js} +5 -5
  44. package/dist/{WastageTemplateView-BweDS-9M.js → WastageTemplateView-BTzJB_Un.js} +14 -14
  45. package/dist/{app-Bpb4394e.js → app-Dgp7U3Bu.js} +2667 -2637
  46. package/dist/app.d.ts +4 -4
  47. package/dist/app.js +1 -1
  48. package/dist/{closing-template-ar_kUs4X.js → closing-template-CDO4H1ec.js} +1 -1
  49. package/dist/{date2-DpnYOzUg.js → date2-Co4esyS0.js} +1 -1
  50. package/dist/{dayjs.min-D5mIeZ1x.js → dayjs.min-fDFTQLDV.js} +1 -1
  51. package/dist/{decimal-C219qGO5.js → decimal-CAoqWZAo.js} +2 -2
  52. package/dist/{defineDeepModel-BF0Cvhza.js → defineDeepModel-Bu3A8_gN.js} +1 -1
  53. package/dist/{duplicate-template-ct64aRN_.js → duplicate-template-DFYzr9yc.js} +1 -1
  54. package/dist/{export-Dgopr7wH.js → export-SbWbn-Q1.js} +2 -2
  55. package/dist/{feature-Cz6F0_cm.js → feature-CiFq5nzV.js} +2 -2
  56. package/dist/{format-time-from-id-BvLCC6cK.js → format-time-from-id-CewwXLFE.js} +1 -1
  57. package/dist/{format-unit-display-CR_I8nfG.js → format-unit-display-CjSRi94f.js} +11 -11
  58. package/dist/{import-export.helper-BnI8EiMF.js → import-export.helper-BTmjUBR4.js} +6 -6
  59. package/dist/{index-CH0wxGs4.js → index-B2NWsBtj.js} +1 -1
  60. package/dist/{index-BJexyEQI.js → index-DMx7gikW.js} +3 -3
  61. package/dist/{index-gmzPcOZI.js → index-Ds1sxRgy.js} +1 -1
  62. package/dist/{inventory-core-dart.default-DanfWZQm.js → inventory-core-dart.default-CTfsXlyP.js} +1 -1
  63. package/dist/{lodash-TzWV2CbR.js → lodash-BoYjh2w1.js} +1 -1
  64. package/dist/{lz-string-UCgR6_DC.js → lz-string-DFsbzXIB.js} +1 -1
  65. package/dist/{netsuite-BGUUAOqe.js → netsuite-DWa9K-3f.js} +3 -3
  66. package/dist/{number-BVg7EKPV.js → number-Dr63YrYs.js} +3 -3
  67. package/dist/{predefined-templates-BAEoCP7i.js → predefined-templates-CjGGmE-S.js} +1 -1
  68. package/dist/{purchase-order-template-BBNXnta7.js → purchase-order-template-e6v2iw1L.js} +1 -1
  69. package/dist/{recalculationUtils-CbjBkJQt.js → recalculationUtils-CATRgU8s.js} +1 -1
  70. package/dist/{rules-CoimOM7X.js → rules-o0HyoFZS.js} +2 -2
  71. package/dist/{stock-DWkfMCtv.js → stock-CiQJys85.js} +1 -1
  72. package/dist/style.css +1 -1
  73. package/dist/{supplier-Bu6V24R6.js → supplier-l7eN_Q6M.js} +2 -2
  74. package/dist/{surcharge-aw55KM3G.js → surcharge-C66q09ht.js} +1 -1
  75. package/dist/tsconfig.app.tsbuildinfo +1 -1
  76. package/dist/{use-ingredient-select-dialog-WYM92c37.js → use-ingredient-select-dialog-C5hAoyG7.js} +2 -2
  77. package/dist/{use-inventory-binding-dialog-zJqVnpvd.js → use-inventory-binding-dialog-IYVfWMn0.js} +2 -2
  78. package/dist/{use-template-enabled-locations-Puw8RG4I.js → use-template-enabled-locations-DH9oAsU9.js} +2 -2
  79. package/dist/{use-transfer-locations-B0o32Kyf.js → use-transfer-locations-C0qBfWjj.js} +2 -2
  80. package/dist/{useHrmPermission-DEaN-y77.js → useHrmPermission-O6wgWbn6.js} +1 -1
  81. package/dist/{useNavigationMenu-C1H2mTfQ.js → useNavigationMenu-CSQM3o-a.js} +2 -2
  82. package/dist/useSseClient-V3x2n4_X.js +524 -0
  83. package/dist/views/stock/composables/use-stock-refresh-balance.d.ts +32 -0
  84. package/dist/{vue-i18n-C4H80O5H.js → vue-i18n-B_D296iV.js} +348 -348
  85. package/dist/{xlsx-Byegf6ga.js → xlsx-z39dJT1l.js} +184 -184
  86. package/dist/{xlsx.util-BPV2vsSD.js → xlsx.util-BT9LSxGd.js} +3 -3
  87. package/package.json +3 -3
  88. package/dist/ClosingDraftView-yD8jHAQU.js +0 -3649
  89. package/dist/StockView-BqUBjCSD.js +0 -2484
  90. package/dist/stock-Dvcz34IY.js +0 -75
@@ -1,6 +1,6 @@
1
1
  import { defineStore as y } from "pinia";
2
- import { a as S } from "./app-Bpb4394e.js";
3
- import { a as b } from "./FmMultiselectDialog-D-38fV59.js";
2
+ import { a as S } from "./app-Dgp7U3Bu.js";
3
+ import { a as b } from "./FmMultiselectDialog-CK4OxOcC.js";
4
4
  import { useDialog as A } from "@feedmepos/ui-library";
5
5
  import { useI18n as I } from "@feedmepos/mf-common";
6
6
  const B = y(
@@ -1,5 +1,5 @@
1
- import { a as g } from "./FmMultiselectDialog-D-38fV59.js";
2
- import { a as P } from "./app-Bpb4394e.js";
1
+ import { a as g } from "./FmMultiselectDialog-CK4OxOcC.js";
2
+ import { a as P } from "./app-Dgp7U3Bu.js";
3
3
  import { useDialog as E } from "@feedmepos/ui-library";
4
4
  function A() {
5
5
  const u = P(), _ = E();
@@ -1,5 +1,5 @@
1
- import { a as A } from "./FmMultiselectDialog-D-38fV59.js";
2
- import { u as S } from "./app-Bpb4394e.js";
1
+ import { a as A } from "./FmMultiselectDialog-CK4OxOcC.js";
2
+ import { u as S } from "./app-Dgp7U3Bu.js";
3
3
  import { useI18n as v, useCoreStore as d, useCustomAttributes as w } from "@feedmepos/mf-common";
4
4
  import { useDialog as _, components as m } from "@feedmepos/ui-library";
5
5
  import { computed as r, h as c } from "vue";
@@ -1,5 +1,5 @@
1
- import { u as w, r as l, Q as R, W as g } from "./app-Bpb4394e.js";
2
- import { u as E } from "./supplier-Bu6V24R6.js";
1
+ import { u as w, r as l, Q as R, W as g } from "./app-Dgp7U3Bu.js";
2
+ import { u as E } from "./supplier-l7eN_Q6M.js";
3
3
  import { computed as u } from "vue";
4
4
  function d(o) {
5
5
  const c = g.safeParse(o);
@@ -1,5 +1,5 @@
1
1
  import { computed as p, toValue as o } from "vue";
2
- import { a2 as n } from "./app-Bpb4394e.js";
2
+ import { a2 as n } from "./app-Dgp7U3Bu.js";
3
3
  import { useCoreStore as c } from "@feedmepos/mf-common";
4
4
  function g(t, i = "all") {
5
5
  const m = c();
@@ -1,7 +1,7 @@
1
1
  import { computed as T } from "vue";
2
- import { am as P, R as e, b, an as A, a2 as O } from "./app-Bpb4394e.js";
2
+ import { am as P, R as e, b, an as A, a2 as O } from "./app-Dgp7U3Bu.js";
3
3
  import { useCoreStore as C, useI18n as L } from "@feedmepos/mf-common";
4
- import { u as _ } from "./feature-Cz6F0_cm.js";
4
+ import { u as _ } from "./feature-CiFq5nzV.js";
5
5
  const G = P.reduce(
6
6
  (o, i) => {
7
7
  var s;
@@ -0,0 +1,524 @@
1
+ import { u as re } from "./stock-CiQJys85.js";
2
+ import { a as K, O as oe, m as ae } from "./app-Dgp7U3Bu.js";
3
+ import { ref as ie, computed as ce } from "vue";
4
+ import { c as le } from "./number-Dr63YrYs.js";
5
+ import { useCoreStore as he } from "@feedmepos/mf-common";
6
+ function ue() {
7
+ return {
8
+ stockBalance: {
9
+ _id: "",
10
+ items: []
11
+ },
12
+ productBalance: []
13
+ };
14
+ }
15
+ const de = le(0), pe = {
16
+ id: "",
17
+ balance: de,
18
+ closing: null,
19
+ costs: null
20
+ }, I = ie(ue()), Be = () => {
21
+ const e = K(), t = ce(() => {
22
+ var r;
23
+ const s = (r = I.value.stockBalance.skus) == null ? void 0 : r.groupBy((o) => o.id), i = (o) => {
24
+ var l;
25
+ return ((l = s == null ? void 0 : s.get(o)) == null ? void 0 : l[0]) ?? { ...pe, id: o };
26
+ };
27
+ return e.skus.map((o) => i(o._id));
28
+ }), n = re();
29
+ return {
30
+ // state
31
+ get stockBalance() {
32
+ return {
33
+ ...I.value.stockBalance,
34
+ skus: t.value
35
+ };
36
+ },
37
+ set stockBalance(s) {
38
+ I.value.stockBalance = s;
39
+ },
40
+ get productBalance() {
41
+ return I.value.productBalance;
42
+ },
43
+ set productBalance(s) {
44
+ I.value.productBalance = s;
45
+ },
46
+ // actions
47
+ async readStockBalance() {
48
+ this.stockBalance = await n.readStockBalance();
49
+ },
50
+ async readProductBalance() {
51
+ this.productBalance = [];
52
+ const s = K(), i = oe({
53
+ recipes: s.recipes,
54
+ skus: s.skus,
55
+ skuGroups: s.skuGroups,
56
+ inventoryBindingMapping: {},
57
+ stockBalance: this.stockBalance
58
+ // silent: true
59
+ });
60
+ function r(o, l) {
61
+ return Object.prototype.hasOwnProperty.call(o, l);
62
+ }
63
+ for (const o in i.convertCountdown)
64
+ if (r(i.convertCountdown, o)) {
65
+ const l = i.convertCountdown[o];
66
+ this.productBalance.push({
67
+ id: o,
68
+ count: l
69
+ });
70
+ }
71
+ }
72
+ };
73
+ }, fe = ae((e, t) => ({
74
+ getSubscribeUrl(n, s, i) {
75
+ const r = new URLSearchParams({ clientId: n, type: s, ...i });
76
+ return `${e.inventoryBackendUrl}/sse/subscribe?${r.toString()}`;
77
+ },
78
+ async getStatus(n, s) {
79
+ const i = new URLSearchParams({ type: n, ...s }), r = `${e.inventoryBackendUrl}/sse/status?${i.toString()}`;
80
+ return t.get(r);
81
+ }
82
+ }));
83
+ class Q extends Error {
84
+ constructor(t, n) {
85
+ super(t), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
86
+ }
87
+ }
88
+ function F(e) {
89
+ }
90
+ function ve(e) {
91
+ if (typeof e == "function")
92
+ throw new TypeError(
93
+ "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
94
+ );
95
+ const { onEvent: t = F, onError: n = F, onRetry: s = F, onComment: i } = e;
96
+ let r = "", o = !0, l, f = "", v = "";
97
+ function C(c) {
98
+ const h = o ? c.replace(/^\xEF\xBB\xBF/, "") : c, [d, L] = Ee(`${r}${h}`);
99
+ for (const x of d)
100
+ _(x);
101
+ r = L, o = !1;
102
+ }
103
+ function _(c) {
104
+ if (c === "") {
105
+ T();
106
+ return;
107
+ }
108
+ if (c.startsWith(":")) {
109
+ i && i(c.slice(c.startsWith(": ") ? 2 : 1));
110
+ return;
111
+ }
112
+ const h = c.indexOf(":");
113
+ if (h !== -1) {
114
+ const d = c.slice(0, h), L = c[h + 1] === " " ? 2 : 1, x = c.slice(h + L);
115
+ y(d, x, c);
116
+ return;
117
+ }
118
+ y(c, "", c);
119
+ }
120
+ function y(c, h, d) {
121
+ switch (c) {
122
+ case "event":
123
+ v = h;
124
+ break;
125
+ case "data":
126
+ f = `${f}${h}
127
+ `;
128
+ break;
129
+ case "id":
130
+ l = h.includes("\0") ? void 0 : h;
131
+ break;
132
+ case "retry":
133
+ /^\d+$/.test(h) ? s(parseInt(h, 10)) : n(
134
+ new Q(`Invalid \`retry\` value: "${h}"`, {
135
+ type: "invalid-retry",
136
+ value: h,
137
+ line: d
138
+ })
139
+ );
140
+ break;
141
+ default:
142
+ n(
143
+ new Q(
144
+ `Unknown field "${c.length > 20 ? `${c.slice(0, 20)}…` : c}"`,
145
+ { type: "unknown-field", field: c, value: h, line: d }
146
+ )
147
+ );
148
+ break;
149
+ }
150
+ }
151
+ function T() {
152
+ f.length > 0 && t({
153
+ id: l,
154
+ event: v || void 0,
155
+ // If the data buffer's last character is a U+000A LINE FEED (LF) character,
156
+ // then remove the last character from the data buffer.
157
+ data: f.endsWith(`
158
+ `) ? f.slice(0, -1) : f
159
+ }), l = void 0, f = "", v = "";
160
+ }
161
+ function m(c = {}) {
162
+ r && c.consume && _(r), o = !0, l = void 0, f = "", v = "", r = "";
163
+ }
164
+ return { feed: C, reset: m };
165
+ }
166
+ function Ee(e) {
167
+ const t = [];
168
+ let n = "", s = 0;
169
+ for (; s < e.length; ) {
170
+ const i = e.indexOf("\r", s), r = e.indexOf(`
171
+ `, s);
172
+ let o = -1;
173
+ if (i !== -1 && r !== -1 ? o = Math.min(i, r) : i !== -1 ? i === e.length - 1 ? o = -1 : o = i : r !== -1 && (o = r), o === -1) {
174
+ n = e.slice(s);
175
+ break;
176
+ } else {
177
+ const l = e.slice(s, o);
178
+ t.push(l), s = o + 1, e[s - 1] === "\r" && e[s] === `
179
+ ` && s++;
180
+ }
181
+ }
182
+ return [t, n];
183
+ }
184
+ class V extends Event {
185
+ /**
186
+ * Constructs a new `ErrorEvent` instance. This is typically not called directly,
187
+ * but rather emitted by the `EventSource` object when an error occurs.
188
+ *
189
+ * @param type - The type of the event (should be "error")
190
+ * @param errorEventInitDict - Optional properties to include in the error event
191
+ */
192
+ constructor(t, n) {
193
+ var s, i;
194
+ super(t), this.code = (s = n == null ? void 0 : n.code) != null ? s : void 0, this.message = (i = n == null ? void 0 : n.message) != null ? i : void 0;
195
+ }
196
+ /**
197
+ * Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
198
+ * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
199
+ * we explicitly include the properties in the `inspect` method.
200
+ *
201
+ * This is automatically called by Node.js when you `console.log` an instance of this class.
202
+ *
203
+ * @param _depth - The current depth
204
+ * @param options - The options passed to `util.inspect`
205
+ * @param inspect - The inspect function to use (prevents having to import it from `util`)
206
+ * @returns A string representation of the error
207
+ */
208
+ [Symbol.for("nodejs.util.inspect.custom")](t, n, s) {
209
+ return s(ee(this), n);
210
+ }
211
+ /**
212
+ * Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
213
+ * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
214
+ * we explicitly include the properties in the `inspect` method.
215
+ *
216
+ * This is automatically called by Deno when you `console.log` an instance of this class.
217
+ *
218
+ * @param inspect - The inspect function to use (prevents having to import it from `util`)
219
+ * @param options - The options passed to `Deno.inspect`
220
+ * @returns A string representation of the error
221
+ */
222
+ [Symbol.for("Deno.customInspect")](t, n) {
223
+ return t(ee(this), n);
224
+ }
225
+ }
226
+ function me(e) {
227
+ const t = globalThis.DOMException;
228
+ return typeof t == "function" ? new t(e, "SyntaxError") : new SyntaxError(e);
229
+ }
230
+ function G(e) {
231
+ return e instanceof Error ? "errors" in e && Array.isArray(e.errors) ? e.errors.map(G).join(", ") : "cause" in e && e.cause instanceof Error ? `${e}: ${G(e.cause)}` : e.message : `${e}`;
232
+ }
233
+ function ee(e) {
234
+ return {
235
+ type: e.type,
236
+ message: e.message,
237
+ code: e.code,
238
+ defaultPrevented: e.defaultPrevented,
239
+ cancelable: e.cancelable,
240
+ timeStamp: e.timeStamp
241
+ };
242
+ }
243
+ var se = (e) => {
244
+ throw TypeError(e);
245
+ }, H = (e, t, n) => t.has(e) || se("Cannot " + n), a = (e, t, n) => (H(e, t, "read from private field"), n ? n.call(e) : t.get(e)), p = (e, t, n) => t.has(e) ? se("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), u = (e, t, n, s) => (H(e, t, "write to private field"), t.set(e, n), n), w = (e, t, n) => (H(e, t, "access private method"), n), E, k, b, P, D, U, B, A, S, O, N, M, R, g, j, q, J, te, X, Y, W, Z, z;
246
+ class $ extends EventTarget {
247
+ constructor(t, n) {
248
+ var s, i;
249
+ super(), p(this, g), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, p(this, E), p(this, k), p(this, b), p(this, P), p(this, D), p(this, U), p(this, B), p(this, A, null), p(this, S), p(this, O), p(this, N, null), p(this, M, null), p(this, R, null), p(this, q, async (r) => {
250
+ var o;
251
+ a(this, O).reset();
252
+ const { body: l, redirected: f, status: v, headers: C } = r;
253
+ if (v === 204) {
254
+ w(this, g, W).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
255
+ return;
256
+ }
257
+ if (f ? u(this, b, new URL(r.url)) : u(this, b, void 0), v !== 200) {
258
+ w(this, g, W).call(this, `Non-200 status code (${v})`, v);
259
+ return;
260
+ }
261
+ if (!(C.get("content-type") || "").startsWith("text/event-stream")) {
262
+ w(this, g, W).call(this, 'Invalid content type, expected "text/event-stream"', v);
263
+ return;
264
+ }
265
+ if (a(this, E) === this.CLOSED)
266
+ return;
267
+ u(this, E, this.OPEN);
268
+ const _ = new Event("open");
269
+ if ((o = a(this, R)) == null || o.call(this, _), this.dispatchEvent(_), typeof l != "object" || !l || !("getReader" in l)) {
270
+ w(this, g, W).call(this, "Invalid response body, expected a web ReadableStream", v), this.close();
271
+ return;
272
+ }
273
+ const y = new TextDecoder(), T = l.getReader();
274
+ let m = !0;
275
+ do {
276
+ const { done: c, value: h } = await T.read();
277
+ h && a(this, O).feed(y.decode(h, { stream: !c })), c && (m = !1, a(this, O).reset(), w(this, g, Z).call(this));
278
+ } while (m);
279
+ }), p(this, J, (r) => {
280
+ u(this, S, void 0), !(r.name === "AbortError" || r.type === "aborted") && w(this, g, Z).call(this, G(r));
281
+ }), p(this, X, (r) => {
282
+ typeof r.id == "string" && u(this, A, r.id);
283
+ const o = new MessageEvent(r.event || "message", {
284
+ data: r.data,
285
+ origin: a(this, b) ? a(this, b).origin : a(this, k).origin,
286
+ lastEventId: r.id || ""
287
+ });
288
+ a(this, M) && (!r.event || r.event === "message") && a(this, M).call(this, o), this.dispatchEvent(o);
289
+ }), p(this, Y, (r) => {
290
+ u(this, U, r);
291
+ }), p(this, z, () => {
292
+ u(this, B, void 0), a(this, E) === this.CONNECTING && w(this, g, j).call(this);
293
+ });
294
+ try {
295
+ if (t instanceof URL)
296
+ u(this, k, t);
297
+ else if (typeof t == "string")
298
+ u(this, k, new URL(t, ge()));
299
+ else
300
+ throw new Error("Invalid URL");
301
+ } catch {
302
+ throw me("An invalid or illegal string was specified");
303
+ }
304
+ u(this, O, ve({
305
+ onEvent: a(this, X),
306
+ onRetry: a(this, Y)
307
+ })), u(this, E, this.CONNECTING), u(this, U, 3e3), u(this, D, (s = n == null ? void 0 : n.fetch) != null ? s : globalThis.fetch), u(this, P, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), w(this, g, j).call(this);
308
+ }
309
+ /**
310
+ * Returns the state of this EventSource object's connection. It can have the values described below.
311
+ *
312
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
313
+ *
314
+ * Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface,
315
+ * defined in the TypeScript `dom` library.
316
+ *
317
+ * @public
318
+ */
319
+ get readyState() {
320
+ return a(this, E);
321
+ }
322
+ /**
323
+ * Returns the URL providing the event stream.
324
+ *
325
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
326
+ *
327
+ * @public
328
+ */
329
+ get url() {
330
+ return a(this, k).href;
331
+ }
332
+ /**
333
+ * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
334
+ *
335
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
336
+ */
337
+ get withCredentials() {
338
+ return a(this, P);
339
+ }
340
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
341
+ get onerror() {
342
+ return a(this, N);
343
+ }
344
+ set onerror(t) {
345
+ u(this, N, t);
346
+ }
347
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
348
+ get onmessage() {
349
+ return a(this, M);
350
+ }
351
+ set onmessage(t) {
352
+ u(this, M, t);
353
+ }
354
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
355
+ get onopen() {
356
+ return a(this, R);
357
+ }
358
+ set onopen(t) {
359
+ u(this, R, t);
360
+ }
361
+ addEventListener(t, n, s) {
362
+ const i = n;
363
+ super.addEventListener(t, i, s);
364
+ }
365
+ removeEventListener(t, n, s) {
366
+ const i = n;
367
+ super.removeEventListener(t, i, s);
368
+ }
369
+ /**
370
+ * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
371
+ *
372
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
373
+ *
374
+ * @public
375
+ */
376
+ close() {
377
+ a(this, B) && clearTimeout(a(this, B)), a(this, E) !== this.CLOSED && (a(this, S) && a(this, S).abort(), u(this, E, this.CLOSED), u(this, S, void 0));
378
+ }
379
+ }
380
+ E = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakSet(), /**
381
+ * Connect to the given URL and start receiving events
382
+ *
383
+ * @internal
384
+ */
385
+ j = function() {
386
+ u(this, E, this.CONNECTING), u(this, S, new AbortController()), a(this, D)(a(this, k), w(this, g, te).call(this)).then(a(this, q)).catch(a(this, J));
387
+ }, q = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), /**
388
+ * Get request options for the `fetch()` request
389
+ *
390
+ * @returns The request options
391
+ * @internal
392
+ */
393
+ te = function() {
394
+ var e;
395
+ const t = {
396
+ // [spec] Let `corsAttributeState` be `Anonymous`…
397
+ // [spec] …will have their mode set to "cors"…
398
+ mode: "cors",
399
+ redirect: "follow",
400
+ headers: { Accept: "text/event-stream", ...a(this, A) ? { "Last-Event-ID": a(this, A) } : void 0 },
401
+ cache: "no-store",
402
+ signal: (e = a(this, S)) == null ? void 0 : e.signal
403
+ };
404
+ return "window" in globalThis && (t.credentials = this.withCredentials ? "include" : "same-origin"), t;
405
+ }, X = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), /**
406
+ * Handles the process referred to in the EventSource specification as "failing a connection".
407
+ *
408
+ * @param error - The error causing the connection to fail
409
+ * @param code - The HTTP status code, if available
410
+ * @internal
411
+ */
412
+ W = function(e, t) {
413
+ var n;
414
+ a(this, E) !== this.CLOSED && u(this, E, this.CLOSED);
415
+ const s = new V("error", { code: t, message: e });
416
+ (n = a(this, N)) == null || n.call(this, s), this.dispatchEvent(s);
417
+ }, /**
418
+ * Schedules a reconnection attempt against the EventSource endpoint.
419
+ *
420
+ * @param message - The error causing the connection to fail
421
+ * @param code - The HTTP status code, if available
422
+ * @internal
423
+ */
424
+ Z = function(e, t) {
425
+ var n;
426
+ if (a(this, E) === this.CLOSED)
427
+ return;
428
+ u(this, E, this.CONNECTING);
429
+ const s = new V("error", { code: t, message: e });
430
+ (n = a(this, N)) == null || n.call(this, s), this.dispatchEvent(s), u(this, B, setTimeout(a(this, z), a(this, U)));
431
+ }, z = /* @__PURE__ */ new WeakMap(), /**
432
+ * ReadyState representing an EventSource currently trying to connect
433
+ *
434
+ * @public
435
+ */
436
+ $.CONNECTING = 0, /**
437
+ * ReadyState representing an EventSource connection that is open (eg connected)
438
+ *
439
+ * @public
440
+ */
441
+ $.OPEN = 1, /**
442
+ * ReadyState representing an EventSource connection that is closed (eg disconnected)
443
+ *
444
+ * @public
445
+ */
446
+ $.CLOSED = 2;
447
+ Object.defineProperty($, Symbol.for("eventsource.supports-fetch-override"), {
448
+ value: !0,
449
+ writable: !1,
450
+ configurable: !1,
451
+ enumerable: !1
452
+ });
453
+ function ge() {
454
+ const e = "document" in globalThis ? globalThis.document : void 0;
455
+ return e && typeof e == "object" && "baseURI" in e && typeof e.baseURI == "string" ? e.baseURI : void 0;
456
+ }
457
+ const ye = 3e3, we = 6e4, Se = 15, ne = _e();
458
+ function _e() {
459
+ var t, n;
460
+ const e = (n = (t = globalThis.crypto) == null ? void 0 : t.randomUUID) == null ? void 0 : n.call(t);
461
+ return e || `sse-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
462
+ }
463
+ function Ne() {
464
+ const e = fe(), t = he();
465
+ function n(i) {
466
+ return Math.min(ye * 2 ** i, we);
467
+ }
468
+ function s(i, r) {
469
+ let o = null, l = null, f = 0, v = !1;
470
+ function C() {
471
+ var c;
472
+ const y = ((c = t.sessionUser.value) == null ? void 0 : c.token) ?? "";
473
+ if (v || !y) return;
474
+ l && (clearTimeout(l), l = null);
475
+ const T = e.getSubscribeUrl(ne, i.type, i.params), m = new $(T, {
476
+ fetch: (h, d) => fetch(h, {
477
+ ...d,
478
+ headers: {
479
+ ...(d == null ? void 0 : d.headers) ?? {},
480
+ authorization: `Bearer ${y}`
481
+ }
482
+ })
483
+ });
484
+ o = m, m.onopen = () => {
485
+ f = 0;
486
+ }, m.onmessage = (h) => {
487
+ try {
488
+ if (!h.data) return;
489
+ const d = JSON.parse(h.data), L = d.data ? typeof d.data == "string" ? JSON.parse(d.data) : d.data : d;
490
+ Promise.resolve(r(L)).catch((x) => {
491
+ console.error("Failed to handle SSE message", x);
492
+ });
493
+ } catch (d) {
494
+ console.error("Failed to parse SSE message", d);
495
+ }
496
+ }, m.onerror = () => {
497
+ if (o === m && (o = null), m.close(), !v) {
498
+ if (f >= Se) {
499
+ console.warn("SSE subscription reconnect retries exhausted", i.type);
500
+ return;
501
+ }
502
+ const h = n(f);
503
+ f += 1, l = setTimeout(() => C(), h);
504
+ }
505
+ };
506
+ }
507
+ C();
508
+ const _ = e.getStatus(i.type, i.params).catch((y) => (console.error("Failed to fetch initial state", y), null));
509
+ return {
510
+ unsubscribe: () => {
511
+ v = !0, l && (clearTimeout(l), l = null), o && (o.close(), o = null);
512
+ },
513
+ initialState: _
514
+ };
515
+ }
516
+ return {
517
+ clientId: ne,
518
+ subscribe: s
519
+ };
520
+ }
521
+ export {
522
+ Ne as a,
523
+ Be as u
524
+ };
@@ -0,0 +1,32 @@
1
+ export type RefreshBalanceStatus = {
2
+ requestId?: string;
3
+ dbName?: string;
4
+ message?: string | null;
5
+ startedAt?: string;
6
+ completedAt?: string | null;
7
+ error?: string | null;
8
+ } | null;
9
+ export declare function useStockRefreshBalance(args: {
10
+ onCompleted: () => void | Promise<void>;
11
+ onError?: (message: string) => void | Promise<void>;
12
+ }): {
13
+ refreshing: import("vue").Ref<boolean, boolean>;
14
+ refreshStatus: import("vue").Ref<{
15
+ requestId?: string | undefined;
16
+ dbName?: string | undefined;
17
+ message?: string | null | undefined;
18
+ startedAt?: string | undefined;
19
+ completedAt?: string | null | undefined;
20
+ error?: string | null | undefined;
21
+ } | null, RefreshBalanceStatus | {
22
+ requestId?: string | undefined;
23
+ dbName?: string | undefined;
24
+ message?: string | null | undefined;
25
+ startedAt?: string | undefined;
26
+ completedAt?: string | null | undefined;
27
+ error?: string | null | undefined;
28
+ }>;
29
+ lastCompletedAt: import("vue").Ref<string | null, string | null>;
30
+ startListening: () => void;
31
+ stopListening: () => void;
32
+ };