@tesouro/embedded-components-react 0.11.50 → 0.11.51

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/README.md CHANGED
@@ -486,6 +486,7 @@ A bill pay widget with Tesouro widget auth and theming: a Bills tab for uploadin
486
486
  | Prop | Type | Default | Description |
487
487
  | ------------------- | ---------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
488
488
  | `initialTab` | `'bills' \| 'vendors'` | `'bills'` | Tab to open on initial mount. |
489
+ | `initialView` | `'create'` | `undefined` | Opens the Bills tab's "Add a bill" dialog once on arrival, when the user can create bills. Closing it does not reopen it. Ignored when `initialTab` is `'vendors'`. |
489
490
  | `poweredByBankName` | `string` | `undefined` | Bank shown as "Powered by {bank}" next to the source account when paying a bill. Omit it to hide the badge. |
490
491
  | `onSettingsClick` | `() => void` | `undefined` | Opens your bill pay settings surface from a cog beside the bill list's "Add bill" button. The cog renders only when this is supplied and the user's scopes reach that surface. |
491
492
 
package/dist/index.d.ts CHANGED
@@ -5233,6 +5233,16 @@ type BillPayWidgetTabId = (typeof TabId)[keyof typeof TabId];
5233
5233
  interface BillPayWidgetProps extends WidgetProviderProps {
5234
5234
  /** Tab to open on initial mount. */
5235
5235
  initialTab?: BillPayWidgetTabId;
5236
+ /**
5237
+ * Opens the Bills tab's Add a bill dialog on arrival, for a host deep link
5238
+ * such as `?create=1` (EMBD-7011). Named like `ReceivablesWidget`'s
5239
+ * `initialView`. Read once, when the user's scopes first resolve: a user
5240
+ * without bill-create permission, or an `initialTab` of `vendors`, lands on
5241
+ * the tab with nothing open. Not controlled, so closing the dialog does not
5242
+ * reopen it. The widget reads no router, so whether the URL keeps the
5243
+ * param is the host's call.
5244
+ */
5245
+ initialView?: 'create';
5236
5246
  /** Bank shown as "Powered by {bank}" next to the source account when paying; omitted hides the badge. */
5237
5247
  poweredByBankName?: string;
5238
5248
  /**
@@ -614,6 +614,16 @@ type BillPayWidgetTabId = (typeof TabId)[keyof typeof TabId];
614
614
  interface BillPayWidgetProps extends WidgetProviderProps {
615
615
  /** Tab to open on initial mount. */
616
616
  initialTab?: BillPayWidgetTabId;
617
+ /**
618
+ * Opens the Bills tab's Add a bill dialog on arrival, for a host deep link
619
+ * such as `?create=1` (EMBD-7011). Named like `ReceivablesWidget`'s
620
+ * `initialView`. Read once, when the user's scopes first resolve: a user
621
+ * without bill-create permission, or an `initialTab` of `vendors`, lands on
622
+ * the tab with nothing open. Not controlled, so closing the dialog does not
623
+ * reopen it. The widget reads no router, so whether the URL keeps the
624
+ * param is the host's call.
625
+ */
626
+ initialView?: 'create';
617
627
  /** Bank shown as "Powered by {bank}" next to the source account when paying; omitted hides the badge. */
618
628
  poweredByBankName?: string;
619
629
  /**
@@ -73,10 +73,10 @@ function g({ labels: g, onOpenBill: _, onEnterManually: v, onFilesSelected: y, m
73
73
  ...g?.queueEmptyStates?.[t]
74
74
  }
75
75
  }), {})
76
- }), [g]), [he, S] = p(!1), [C, w] = p(s.AllBills), { initResponse: T } = te(), E = ne(), D = t(T?.scopes, [n.PayableReadOrg]), O = t(T?.scopes, [n.PayableWriteOrg]), k = !T || D, A = !T || O, j = T && !E ? t(T.scopes, [n.PayablePayOrg]) : void 0, M = t(T?.scopes, [n.CounterpartReadOrg]), N = g?.screen?.statusBadge, P = f(() => ({
76
+ }), [g]), [he, S] = p(!1), [C, w] = p(s.AllBills), { initResponse: T } = te(), E = ne(), ge = t(T?.scopes, [n.PayableReadOrg]), D = t(T?.scopes, [n.PayableWriteOrg]), O = !T || ge, k = !T || D, A = T && !E ? t(T.scopes, [n.PayablePayOrg]) : void 0, j = t(T?.scopes, [n.CounterpartReadOrg]), M = g?.screen?.statusBadge, N = f(() => ({
77
77
  ...re,
78
- ...N
79
- }), [N]), F = f(() => ({
78
+ ...M
79
+ }), [M]), P = f(() => ({
80
80
  menuTrigger: x.duplicateMenuTrigger,
81
81
  notDuplicateAction: x.duplicateNotDuplicateAction,
82
82
  notDuplicateConfirmTitle: x.duplicateNotDuplicateConfirmTitle,
@@ -106,7 +106,7 @@ function g({ labels: g, onOpenBill: _, onEnterManually: v, onFilesSelected: y, m
106
106
  showMore: x.duplicateShowMore,
107
107
  showLess: x.duplicateShowLess,
108
108
  statusSummary: x.duplicateStatusSummary,
109
- statusLabels: P,
109
+ statusLabels: N,
110
110
  pageInfo: x.duplicatePageInfo
111
111
  }), [
112
112
  x.duplicateMenuTrigger,
@@ -138,155 +138,158 @@ function g({ labels: g, onOpenBill: _, onEnterManually: v, onFilesSelected: y, m
138
138
  x.duplicateShowMore,
139
139
  x.duplicateShowLess,
140
140
  x.duplicateStatusSummary,
141
- P,
141
+ N,
142
142
  x.duplicatePageInfo
143
- ]), I = t(T?.scopes, [n.MailboxReadOrg]), { mailboxAddress: L } = ee({
143
+ ]), F = t(T?.scopes, [n.MailboxReadOrg]), { mailboxAddress: I } = ee({
144
144
  relatedObjectType: "payable",
145
- enabled: I && !E
146
- }), R = I ? L : void 0, z = c({
147
- enabled: k,
148
- canPay: j,
149
- canReadVendors: M,
145
+ enabled: F && !E
146
+ }), L = F ? I : void 0, R = c({
147
+ enabled: O,
148
+ canPay: A,
149
+ canReadVendors: j,
150
150
  isVendorFilterPaused: E,
151
151
  filterLabels: x.filters,
152
152
  onOpenBill: _ ?? fe,
153
153
  duplicateRowNote: x.duplicateRowNote,
154
154
  attachmentLabel: x.attachmentIndicator,
155
- duplicateGroupLabels: F,
156
- canManageDuplicates: A,
155
+ duplicateGroupLabels: P,
156
+ canManageDuplicates: k,
157
157
  duplicateView: C,
158
158
  scheduledRelativeDayLabels: x.scheduledRelativeDay
159
- }), B = l({ enabled: k }), V = C === s.PossibleDuplicates, ge = se(B, x), H = le({
160
- enabled: k,
161
- canPay: j
162
- }), U = !B.isError && B.count > 0, _e = f(() => [...i.map((e) => ({
159
+ }), z = l({ enabled: O }), B = C === s.PossibleDuplicates, _e = se(z, x), V = le({
160
+ enabled: O,
161
+ canPay: A
162
+ }), H = !z.isError && z.count > 0, ve = f(() => [...i.map((e) => ({
163
163
  id: e,
164
164
  label: x.queues[e],
165
- badge: u(H[e])
165
+ badge: u(V[e])
166
166
  })), {
167
167
  id: a,
168
168
  label: x.duplicatesTab,
169
- badge: B.isError ? void 0 : u(B.count),
170
- tone: U ? "warning" : void 0,
169
+ badge: z.isError ? void 0 : u(z.count),
170
+ tone: H ? "warning" : void 0,
171
171
  startsGroup: !0
172
172
  }], [
173
173
  x.queues,
174
174
  x.duplicatesTab,
175
- H,
176
- B.isError,
177
- B.count,
178
- U
179
- ]), { clearQueryConstraints: W, onFilterTabChange: G } = z, K = d(() => {
180
- W(), w(s.PossibleDuplicates);
181
- }, [W]), q = d((e) => {
182
- e === "duplicates" ? K() : (w(s.AllBills), G(e));
183
- }, [G, K]), J = g?.screen, ve = f(() => ({
184
- ...J,
175
+ V,
176
+ z.isError,
177
+ z.count,
178
+ H
179
+ ]), { clearQueryConstraints: U, onFilterTabChange: W } = R, G = d(() => {
180
+ U(), w(s.PossibleDuplicates);
181
+ }, [U]), K = d((e) => {
182
+ e === "duplicates" ? G() : (w(s.AllBills), W(e));
183
+ }, [W, G]), q = g?.screen, ye = f(() => ({
184
+ ...q,
185
185
  createButton: x.createButton,
186
186
  settingsButton: x.settingsButton,
187
187
  addBill: {
188
- ...J?.addBill,
188
+ ...q?.addBill,
189
189
  heading: x.nonEmptyHeading
190
190
  },
191
- ...V ? {
191
+ ...B ? {
192
192
  columnAddedOn: x.duplicateColumnCreated,
193
193
  columnAmountDue: x.duplicateColumnAmount
194
194
  } : {}
195
195
  }), [
196
- V,
196
+ B,
197
197
  x.duplicateColumnCreated,
198
198
  x.duplicateColumnAmount,
199
- J,
199
+ q,
200
200
  x.createButton,
201
201
  x.settingsButton,
202
202
  x.nonEmptyHeading
203
- ]), ye = f(() => ({
204
- ...z.filterBarProps,
203
+ ]), be = f(() => ({
204
+ ...R.filterBarProps,
205
205
  labels: x.filterBar
206
- }), [z.filterBarProps, x.filterBar]), Y = () => {
206
+ }), [R.filterBarProps, x.filterBar]), J = () => {
207
207
  S(!1), v?.();
208
- }, X = (e) => {
208
+ }, Y = (e) => {
209
209
  S(!1), y?.(e);
210
- }, Z = R ? {
211
- emailAddress: R,
210
+ }, X = L ? {
211
+ emailAddress: L,
212
212
  onCopyEmail: async () => {
213
- R && (await oe(R) ? e.success(x.emailCopiedToast) : e.error(x.emailCopyFailedToast));
213
+ L && (await oe(L) ? e.success(x.emailCopiedToast) : e.error(x.emailCopyFailedToast));
214
214
  }
215
215
  } : {
216
216
  emailAddress: void 0,
217
217
  onCopyEmail: void 0
218
- }, { showVendorBills: Q } = z, $ = d((e) => {
219
- w(s.AllBills), Q(e);
220
- }, [Q]);
221
- return ue(me, () => ({ showVendorBills: $ }), [$]), /* @__PURE__ */ de(m, { children: [
218
+ }, { showVendorBills: Z } = R, Q = d((e) => {
219
+ w(s.AllBills), Z(e);
220
+ }, [Z]), $ = d(() => S(!0), []);
221
+ return ue(me, () => ({
222
+ showVendorBills: Q,
223
+ openAddBill: $
224
+ }), [Q, $]), /* @__PURE__ */ de(m, { children: [
222
225
  /* @__PURE__ */ h(ae, {
223
- rows: z.rows,
224
- isLoading: z.isLoading || !T,
225
- isError: z.isError,
226
- onRetry: z.onRetry,
227
- sorting: z.sorting,
228
- onSortingChange: z.onSortingChange,
229
- pageSize: z.pageSize,
230
- onPageSizeChange: z.onPageSizeChange,
231
- pageSizeOptions: z.pageSizeOptions,
232
- hasNextPage: z.hasNextPage,
233
- hasPrevPage: z.hasPrevPage,
234
- onNextPage: z.onNextPage,
235
- onPrevPage: z.onPrevPage,
236
- filterTabs: _e,
237
- selectedFilterTabId: V ? a : z.selectedFilterTabId,
238
- onFilterTabChange: q,
239
- searchValue: z.searchValue,
240
- onSearchChange: z.onSearchChange,
241
- filters: ye,
242
- visibleColumns: z.visibleColumns,
243
- keepsColumnOrder: z.keepsColumnOrder,
244
- isSortable: z.isSortable,
245
- pageInfo: z.pageInfo,
226
+ rows: R.rows,
227
+ isLoading: R.isLoading || !T,
228
+ isError: R.isError,
229
+ onRetry: R.onRetry,
230
+ sorting: R.sorting,
231
+ onSortingChange: R.onSortingChange,
232
+ pageSize: R.pageSize,
233
+ onPageSizeChange: R.onPageSizeChange,
234
+ pageSizeOptions: R.pageSizeOptions,
235
+ hasNextPage: R.hasNextPage,
236
+ hasPrevPage: R.hasPrevPage,
237
+ onNextPage: R.onNextPage,
238
+ onPrevPage: R.onPrevPage,
239
+ filterTabs: ve,
240
+ selectedFilterTabId: B ? a : R.selectedFilterTabId,
241
+ onFilterTabChange: K,
242
+ searchValue: R.searchValue,
243
+ onSearchChange: R.onSearchChange,
244
+ filters: be,
245
+ visibleColumns: R.visibleColumns,
246
+ keepsColumnOrder: R.keepsColumnOrder,
247
+ isSortable: R.isSortable,
248
+ pageInfo: R.pageInfo,
246
249
  cellTestIds: ce,
247
- isSearchActive: z.isSearchActive,
248
- showAddPanelWhenEmpty: z.showAddPanelWhenEmpty,
249
- emptyState: V ? x.duplicatesEmptyState : x.queueEmptyStates[z.selectedFilterTabId],
250
- onCreateClick: A ? () => S(!0) : void 0,
250
+ isSearchActive: R.isSearchActive,
251
+ showAddPanelWhenEmpty: R.showAddPanelWhenEmpty,
252
+ emptyState: B ? x.duplicatesEmptyState : x.queueEmptyStates[R.selectedFilterTabId],
253
+ onCreateClick: k ? () => S(!0) : void 0,
251
254
  onSettingsClick: pe,
252
- onEnterManually: A ? Y : void 0,
253
- onFilesSelected: A ? X : void 0,
255
+ onEnterManually: k ? J : void 0,
256
+ onFilesSelected: k ? Y : void 0,
254
257
  maxFiles: b,
255
- ...Z,
256
- duplicateWarning: ge,
257
- duplicateReviewControl: V ? void 0 : {
258
+ ...X,
259
+ duplicateWarning: _e,
260
+ duplicateReviewControl: B ? void 0 : {
258
261
  reviewLabel: x.duplicateReviewButton,
259
- onReview: K
262
+ onReview: G
260
263
  },
261
- labels: ve
264
+ labels: ye
262
265
  }),
263
266
  /* @__PURE__ */ h(r, {
264
- open: z.cancelConfirmation.open,
265
- copy: z.cancelConfirmation.copy,
266
- onConfirm: z.cancelConfirmation.onConfirm,
267
- onCancel: z.cancelConfirmation.onCancel,
268
- isPending: z.cancelConfirmation.isPending,
269
- labels: { cancelButton: z.cancelConfirmation.cancelButtonLabel }
267
+ open: R.cancelConfirmation.open,
268
+ copy: R.cancelConfirmation.copy,
269
+ onConfirm: R.cancelConfirmation.onConfirm,
270
+ onCancel: R.cancelConfirmation.onCancel,
271
+ isPending: R.cancelConfirmation.isPending,
272
+ labels: { cancelButton: R.cancelConfirmation.cancelButtonLabel }
270
273
  }),
271
274
  /* @__PURE__ */ h(r, {
272
- open: z.keepConfirmation.open,
273
- copy: z.keepConfirmation.copy,
274
- onConfirm: z.keepConfirmation.onConfirm,
275
- onCancel: z.keepConfirmation.onCancel,
276
- isPending: z.keepConfirmation.isPending,
277
- labels: { cancelButton: z.keepConfirmation.cancelButtonLabel }
275
+ open: R.keepConfirmation.open,
276
+ copy: R.keepConfirmation.copy,
277
+ onConfirm: R.keepConfirmation.onConfirm,
278
+ onCancel: R.keepConfirmation.onCancel,
279
+ isPending: R.keepConfirmation.isPending,
280
+ labels: { cancelButton: R.keepConfirmation.cancelButtonLabel }
278
281
  }),
279
- A ? /* @__PURE__ */ h(ie, {
282
+ k ? /* @__PURE__ */ h(ie, {
280
283
  open: he,
281
284
  onOpenChange: S,
282
- onFilesSelected: X,
285
+ onFilesSelected: Y,
283
286
  maxFiles: b,
284
- onEnterManually: Y,
285
- ...Z,
287
+ onEnterManually: J,
288
+ ...X,
286
289
  dialogLabels: g?.addBillDialog?.dialog,
287
290
  labels: {
288
291
  ...g?.addBillDialog?.panel,
289
- heading: z.hasAnyBills ? x.nonEmptyHeading : x.emptyHeading
292
+ heading: R.hasAnyBills ? x.nonEmptyHeading : x.emptyHeading
290
293
  }
291
294
  }) : null
292
295
  ] });
@@ -11,83 +11,87 @@ import { EmbeddedToaster as r } from "../../../../../shared/ui/dist/lib/Embedded
11
11
  import "../../../../../shared/ui/dist/index.js";
12
12
  import { useAnalyticsTrack as i } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
13
13
  import { WidgetProvider as a } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
14
- import { useWidgetConfig as o } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
14
+ import { useWidgetConfig as o, useWidgetInitStaleForToken as s } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
15
15
  import "../../../../../shared/feature/dist/index.js";
16
- import { BillPayWidgetAnalyticsEvent as s, WIDGET_NAME as c } from "../analytics/events.js";
17
- import { BillPayWidgetUi as l } from "../../../../ui/dist/index14.js";
16
+ import { BillPayWidgetAnalyticsEvent as c, WIDGET_NAME as l } from "../analytics/events.js";
17
+ import { BillPayWidgetUi as u } from "../../../../ui/dist/index14.js";
18
18
  import "../../../../ui/dist/index.js";
19
- import { BillUploadWidget as u } from "../../../../bill-upload/feature/dist/index8.js";
19
+ import { BillUploadWidget as d } from "../../../../bill-upload/feature/dist/index8.js";
20
20
  import "../../../../bill-upload/feature/dist/index.js";
21
- import { BillsTab as d } from "./BillsTab.js";
22
- import { BILL_PAY_WIDGET_LABELS_EN as f } from "./labels.js";
23
- import { CounterpartsWidget as p } from "../../../../../counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js";
21
+ import { BillsTab as f } from "./BillsTab.js";
22
+ import { BILL_PAY_WIDGET_LABELS_EN as p } from "./labels.js";
23
+ import { CounterpartsWidget as m } from "../../../../../counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js";
24
24
  import "../../../../../counterparts-widget/feature/dist/index.js";
25
- import { useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
26
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
25
+ import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
26
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
27
27
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js
28
- var S = {
28
+ var C = {
29
29
  Bills: "bills",
30
30
  Vendors: "vendors"
31
- }, C = [S.Bills, S.Vendors];
32
- function w({ labels: a, initialTab: c = S.Bills, poweredByBankName: w, onSettingsClick: T }) {
33
- let E = i();
34
- h(() => {
35
- E(s.Mounted);
36
- }, [E]);
37
- let D = g(() => e(f, a), [a]), { initResponse: O } = o(), k = t(O?.scopes, [n.PayableReadOrg]), A = t(O?.scopes, [n.PayableWriteOrg]), j = t(O?.scopes, [n.ApprovalPolicyWriteOrg]) && t(O?.scopes, [n.PayableWriteOrg]) && t(O?.scopes, [n.RoleReadOrg]) && t(O?.scopes, [n.UserReadOrg]), [M, N] = v(c), [P, F] = v(), I = m((e) => {
38
- N(S.Bills), F(e);
39
- }, []), L = _(null), R = m((e) => L.current?.enqueue(e), []), [z, B] = v(), V = m((e) => {
40
- N(S.Bills), B(e);
41
- }, []), H = [{
42
- id: S.Bills,
43
- label: D.tabs.bills,
44
- content: /* @__PURE__ */ b(d, {
45
- labels: D,
46
- onEnqueueFiles: R,
47
- openPayableId: P,
48
- onOpenPayableHandled: () => F(void 0),
49
- vendorIntent: z,
50
- onVendorIntentHandled: () => B(void 0),
51
- poweredByBankName: w,
52
- onSettingsClick: T && j ? T : void 0
31
+ }, w = [C.Bills, C.Vendors];
32
+ function T({ labels: a, initialTab: l = C.Bills, initialView: T, poweredByBankName: E, onSettingsClick: D }) {
33
+ let O = i();
34
+ g(() => {
35
+ O(c.Mounted);
36
+ }, [O]);
37
+ let k = _(() => e(p, a), [a]), { initResponse: A } = o(), j = t(A?.scopes, [n.PayableReadOrg]), M = t(A?.scopes, [n.PayableWriteOrg]), N = t(A?.scopes, [n.ApprovalPolicyWriteOrg]) && t(A?.scopes, [n.PayableWriteOrg]) && t(A?.scopes, [n.RoleReadOrg]) && t(A?.scopes, [n.UserReadOrg]), [P, F] = y(l), [I, L] = y(), R = h((e) => {
38
+ F(C.Bills), L(e);
39
+ }, []), z = v(null), B = h((e) => z.current?.enqueue(e), []), [V, H] = y(), U = h((e) => {
40
+ F(C.Bills), H(e);
41
+ }, []), W = s(), [G, K] = y(T === "create"), [q, J] = y(!1);
42
+ G && A && !W && (K(!1), M && P === C.Bills && J(!0));
43
+ let Y = [{
44
+ id: C.Bills,
45
+ label: k.tabs.bills,
46
+ content: /* @__PURE__ */ x(f, {
47
+ labels: k,
48
+ onEnqueueFiles: B,
49
+ openPayableId: I,
50
+ onOpenPayableHandled: () => L(void 0),
51
+ vendorIntent: V,
52
+ onVendorIntentHandled: () => H(void 0),
53
+ openAddBill: q,
54
+ onOpenAddBillHandled: () => J(!1),
55
+ poweredByBankName: E,
56
+ onSettingsClick: D && N ? D : void 0
53
57
  })
54
58
  }, {
55
- id: S.Vendors,
56
- label: D.tabs.vendors,
57
- content: /* @__PURE__ */ b(p, {
58
- ...D.vendors,
59
+ id: C.Vendors,
60
+ label: k.tabs.vendors,
61
+ content: /* @__PURE__ */ x(m, {
62
+ ...k.vendors,
59
63
  counterpartType: "vendor",
60
64
  passThrough: !0,
61
- onViewAllDocuments: k ? (e) => V({
65
+ onViewAllDocuments: j ? (e) => U({
62
66
  vendorId: e.id,
63
67
  vendorName: e.name,
64
68
  action: "viewBills"
65
69
  }) : void 0,
66
- onCreateDocument: A ? (e) => V({
70
+ onCreateDocument: M ? (e) => U({
67
71
  vendorId: e.id,
68
72
  vendorName: e.name,
69
73
  action: "createBill"
70
74
  }) : void 0
71
75
  })
72
- }], U = H.some((e) => e.id === M) ? M : C.find((e) => H.some((t) => t.id === e)) ?? H[0]?.id ?? "";
73
- return /* @__PURE__ */ x(y, { children: [
74
- /* @__PURE__ */ b(r, {}),
75
- /* @__PURE__ */ b(l, {
76
- labels: D.widget,
77
- tabs: H,
78
- selectedTabId: U,
79
- onTabChange: N
76
+ }], X = Y.some((e) => e.id === P) ? P : w.find((e) => Y.some((t) => t.id === e)) ?? Y[0]?.id ?? "";
77
+ return /* @__PURE__ */ S(b, { children: [
78
+ /* @__PURE__ */ x(r, {}),
79
+ /* @__PURE__ */ x(u, {
80
+ labels: k.widget,
81
+ tabs: Y,
82
+ selectedTabId: X,
83
+ onTabChange: F
80
84
  }),
81
- /* @__PURE__ */ b(u, {
82
- ref: L,
83
- onOpenBill: I,
84
- labels: D.billUpload
85
+ /* @__PURE__ */ x(d, {
86
+ ref: z,
87
+ onOpenBill: R,
88
+ labels: k.billUpload
85
89
  })
86
90
  ] });
87
91
  }
88
- function T({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: o, uiFramework: s, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, providerLabels: p, ...m }) {
89
- return /* @__PURE__ */ b(a, {
90
- widgetName: c,
92
+ function E({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: o, uiFramework: s, errorFallback: c, onError: u, analytics: d, disclosuresAcceptance: f, providerLabels: p, ...m }) {
93
+ return /* @__PURE__ */ x(a, {
94
+ widgetName: l,
91
95
  baseUrl: e,
92
96
  widgetToken: t,
93
97
  organizationId: n,
@@ -95,13 +99,13 @@ function T({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gat
95
99
  gatewayRouting: i,
96
100
  linkComponent: o,
97
101
  uiFramework: s,
98
- errorFallback: l,
102
+ errorFallback: c,
99
103
  onError: u,
100
104
  analytics: d,
101
105
  disclosuresAcceptance: f,
102
106
  providerLabels: p,
103
- children: /* @__PURE__ */ b(w, { ...m })
107
+ children: /* @__PURE__ */ x(T, { ...m })
104
108
  });
105
109
  }
106
- var E = T;
107
- export { E as BillPayWidget, E as default, T as BillPayWidgetWithLabels };
110
+ var D = E;
111
+ export { D as BillPayWidget, D as default, E as BillPayWidgetWithLabels };
@@ -18,22 +18,22 @@ import "../../../../pay-bill/feature/dist/index.js";
18
18
  import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
19
19
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
20
20
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js
21
- function h({ labels: h, onEnqueueFiles: g, openPayableId: _, onOpenPayableHandled: v, vendorIntent: y, onVendorIntentHandled: b, poweredByBankName: x, onSettingsClick: S }) {
22
- let C = d(null), [w, T] = f(), [E, D] = f(), [O, k] = f(!1), [A, j] = f(), [M, N] = f(!1), [P, F] = f(!1), [I, L] = f(null), R = !I || {
23
- create: O,
24
- details: M,
25
- view: P
26
- }[I.surface];
21
+ function h({ labels: h, onEnqueueFiles: g, openPayableId: _, onOpenPayableHandled: v, vendorIntent: y, onVendorIntentHandled: b, openAddBill: x, onOpenAddBillHandled: S, poweredByBankName: C, onSettingsClick: w }) {
22
+ let T = d(null), [E, D] = f(), [O, k] = f(), [A, j] = f(!1), [M, N] = f(), [P, F] = f(!1), [I, L] = f(!1), [R, z] = f(null), B = !R || {
23
+ create: A,
24
+ details: P,
25
+ view: I
26
+ }[R.surface];
27
27
  l(() => {
28
- R || L(null);
29
- }, [R]);
30
- let z = h?.payBill, B = u(() => {
28
+ B || z(null);
29
+ }, [B]);
30
+ let V = h?.payBill, H = u(() => {
31
31
  let e = (e) => (t) => /* @__PURE__ */ p(s, {
32
32
  ...t,
33
- poweredByBankName: x,
34
- labels: z,
35
- openFlow: I?.surface === e ? I.flow : null,
36
- onOpenFlowChange: (t) => L(t ? {
33
+ poweredByBankName: C,
34
+ labels: V,
35
+ openFlow: R?.surface === e ? R.flow : null,
36
+ onOpenFlowChange: (t) => z(t ? {
37
37
  surface: e,
38
38
  flow: t
39
39
  } : null)
@@ -44,77 +44,83 @@ function h({ labels: h, onEnqueueFiles: g, openPayableId: _, onOpenPayableHandle
44
44
  view: e("view")
45
45
  };
46
46
  }, [
47
- I,
48
- x,
49
- z
50
- ]), { initResponse: V } = n(), H = !V || e(V.scopes, [t.PayableWriteOrg]), U = c((e, t) => {
51
- t && H ? (T(e), D(void 0), k(!0)) : (j(e), F(!0));
52
- }, [H]), W = (e, t) => {
53
- k(!1), F(!1), U(e, t);
54
- }, G = () => {
55
- N(!1), F(!0);
56
- }, K = () => {
57
- F(!1), N(!0);
47
+ R,
48
+ C,
49
+ V
50
+ ]), { initResponse: U } = n(), W = !U || e(U.scopes, [t.PayableWriteOrg]), G = c((e, t) => {
51
+ t && W ? (D(e), k(void 0), j(!0)) : (N(e), L(!0));
52
+ }, [W]), K = (e, t) => {
53
+ j(!1), L(!1), G(e, t);
58
54
  }, q = () => {
59
- N(!1), F(!1), T(A), D(void 0), k(!0);
60
- }, J = c((e) => {
61
- T(void 0), D(e), k(!0);
55
+ F(!1), L(!0);
56
+ }, J = () => {
57
+ L(!1), F(!0);
58
+ }, Y = () => {
59
+ F(!1), L(!1), D(M), k(void 0), j(!0);
60
+ }, X = c((e) => {
61
+ D(void 0), k(e), j(!0);
62
62
  }, []);
63
63
  return l(() => {
64
- _ && (T(_), D(void 0), k(!0), v?.());
64
+ _ && (D(_), k(void 0), j(!0), v?.());
65
65
  }, [v, _]), l(() => {
66
- y && (y.action === "createBill" ? H && J(y.vendorId) : C.current?.showVendorBills({
66
+ y && (y.action === "createBill" ? W && X(y.vendorId) : T.current?.showVendorBills({
67
67
  id: y.vendorId,
68
68
  name: y.vendorName
69
69
  }), b?.());
70
70
  }, [
71
- H,
71
+ W,
72
72
  b,
73
- J,
73
+ X,
74
74
  y
75
+ ]), l(() => {
76
+ x && (W && T.current?.openAddBill(), S?.());
77
+ }, [
78
+ W,
79
+ S,
80
+ x
75
81
  ]), /* @__PURE__ */ m("div", {
76
82
  "data-testid": r.root,
77
83
  children: [
78
84
  /* @__PURE__ */ p(o, {
79
- ref: C,
85
+ ref: T,
80
86
  labels: h?.billsList,
81
- onOpenBill: U,
82
- onEnterManually: () => J(),
87
+ onOpenBill: G,
88
+ onEnterManually: () => X(),
83
89
  onFilesSelected: g,
84
90
  maxFiles: 10,
85
- onSettingsClick: S
91
+ onSettingsClick: w
86
92
  }),
87
- O ? /* @__PURE__ */ p(a, {
88
- open: O,
89
- onOpenChange: k,
90
- payableId: w,
91
- initialCounterpartId: E,
92
- onOpenBill: W,
93
- renderPaymentFlows: B.create,
93
+ A ? /* @__PURE__ */ p(a, {
94
+ open: A,
95
+ onOpenChange: j,
96
+ payableId: E,
97
+ initialCounterpartId: O,
98
+ onOpenBill: K,
99
+ renderPaymentFlows: H.create,
94
100
  copy: h?.billDialog
95
- }, w) : null,
96
- M ? /* @__PURE__ */ p(i, {
97
- open: M,
98
- onOpenChange: N,
99
- payableId: A,
100
- onClose: () => N(!1),
101
- onExpand: G,
102
- onEdit: q,
101
+ }, E) : null,
102
+ P ? /* @__PURE__ */ p(i, {
103
+ open: P,
104
+ onOpenChange: F,
105
+ payableId: M,
106
+ onClose: () => F(!1),
107
+ onExpand: q,
108
+ onEdit: Y,
103
109
  testId: r.detailsSheet,
104
- renderPaymentFlows: B.details,
110
+ renderPaymentFlows: H.details,
105
111
  labels: h?.billDetails
106
112
  }) : null,
107
- P ? /* @__PURE__ */ p(a, {
108
- open: P,
109
- onOpenChange: F,
110
- payableId: A,
113
+ I ? /* @__PURE__ */ p(a, {
114
+ open: I,
115
+ onOpenChange: L,
116
+ payableId: M,
111
117
  readOnly: !0,
112
- onCollapse: K,
113
- onEdit: q,
114
- onOpenBill: W,
115
- renderPaymentFlows: B.view,
118
+ onCollapse: J,
119
+ onEdit: Y,
120
+ onOpenBill: K,
121
+ renderPaymentFlows: H.view,
116
122
  copy: h?.billDialog
117
- }, A) : null
123
+ }, M) : null
118
124
  ]
119
125
  });
120
126
  }
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.11.50", n = "7dc9437b7b3ef50908abc2038cb701eeddecf176", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.51", n = "59f22e2b26e5eed43999fe12de6f97f988ab714b", 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.11.50",
3
+ "version": "0.11.51",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [