@tesouro/embedded-components-react 0.3.33 → 0.3.34

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.
@@ -43,10 +43,14 @@ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepa
43
43
  let k = {
44
44
  ...s,
45
45
  ...O
46
- }, [A, j] = g(), M = _ ?? A, [N, P] = g(), F = m(() => P(void 0), []), [I, L] = g(!1), R = m(() => L(!0), []), [z, B] = g(), V = h(!1), H = n(), U = r(), W = a(), G = t(), K = o(), q = i(), J = m(() => {
47
- let t = p(v.lineItems, k), n = f(v.discount, v.tax, v.totalOverride, k);
46
+ }, [A, j] = g(), M = _ ?? A, [N, P] = g(), F = m(() => P(void 0), []), [I, L] = g(!1), R = m(() => L(!0), []), [z, B] = g(), V = h(!1), H = n(), U = r(), W = a(), G = t(), K = o(), q = i(), J = m(() => v.isTotalsDirty ? f(v.discount, v.tax, v.totalOverride, k) : void 0, [v, k]), Y = m(() => {
47
+ let t = p(v.lineItems, k), n = J();
48
48
  return v.setLineItemErrors(t), !t && !n || (t ? (v.setErrors(void 0), e.error(k.lineItemsNeedAttention)) : v.setErrors(n), !1);
49
- }, [v, k]), Y = m(async (e) => {
49
+ }, [
50
+ v,
51
+ k,
52
+ J
53
+ ]), X = m(async (e) => {
50
54
  let t = !M && N ? {
51
55
  base64EncodedFile: await c(N),
52
56
  fileName: N.name
@@ -93,17 +97,17 @@ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepa
93
97
  G,
94
98
  N,
95
99
  W
96
- ]), X = m(async () => {
100
+ ]), Z = m(async () => {
97
101
  M && (await U.mutateAsync({ path: { payable_id: M } }), L(!1));
98
102
  }, [U, M]);
99
103
  return {
100
104
  saveDraft: m(async () => {
101
- if (!V.current && J()) {
105
+ if (!V.current && Y()) {
102
106
  V.current = !0, B("draft");
103
107
  try {
104
108
  let t = await C?.();
105
109
  if (t && !t.ok) return;
106
- let n = await Y(t?.counterpartBankAccountId);
110
+ let n = await X(t?.counterpartBankAccountId);
107
111
  return v.setErrors(void 0), w?.(n), E?.(n), e.success(k.draftSaved), n;
108
112
  } catch {
109
113
  v.setErrors({ form: k.saveFailed });
@@ -114,17 +118,17 @@ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepa
114
118
  }
115
119
  }, [
116
120
  v,
117
- J,
121
+ Y,
118
122
  k.draftSaved,
119
123
  k.saveFailed,
120
124
  E,
121
125
  w,
122
126
  C,
123
- Y
127
+ X
124
128
  ]),
125
129
  finalize: m(async () => {
126
130
  if (V.current) return;
127
- let t = p(v.lineItems, k), n = f(v.discount, v.tax, v.totalOverride, k), { formErrors: r, lineItemErrors: i } = d(v.values, x, v.lineItems, k), a = b(i, t);
131
+ let t = p(v.lineItems, k), n = J(), { formErrors: r, lineItemErrors: i } = d(v.values, x, v.lineItems, k), a = b(i, t);
128
132
  v.setLineItemErrors(a);
129
133
  let o = {
130
134
  ...r,
@@ -137,7 +141,7 @@ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepa
137
141
  try {
138
142
  let e = await C?.();
139
143
  if (e && !e.ok) return;
140
- t = await Y(e?.counterpartBankAccountId);
144
+ t = await X(e?.counterpartBankAccountId);
141
145
  } catch {
142
146
  v.setErrors({ form: k.saveFailed });
143
147
  return;
@@ -164,8 +168,9 @@ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepa
164
168
  D,
165
169
  w,
166
170
  C,
167
- Y,
171
+ X,
168
172
  q,
173
+ J,
169
174
  K
170
175
  ]),
171
176
  payableId: M,
@@ -176,7 +181,7 @@ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepa
176
181
  clearStagedFile: F,
177
182
  isFileDeletionPending: I,
178
183
  requestFileDeletion: R,
179
- detachFileNow: X,
184
+ detachFileNow: Z,
180
185
  isDeletingFile: U.isPending,
181
186
  hasFileDeletionFailed: U.isError
182
187
  };
@@ -31,7 +31,7 @@ function n({ payable: n, lineItems: r }) {
31
31
  lineItems: a.length ? a : [e()],
32
32
  discount: t(n.discount),
33
33
  tax: t(n.tax_amount),
34
- total: t(n.total_amount)
34
+ total: n.total_amount ? t(n.total_amount) : ""
35
35
  };
36
36
  }
37
37
  //#endregion
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.3.33", n = "b38f405d312a87d289ad0b359bc1c086f2617ae9", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.3.34", n = "e357f0cbf41446ba98c8ceba8b7e433958040851", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.3.33",
3
+ "version": "0.3.34",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {