@tesouro/embedded-components-react 0.2.255 → 0.2.257

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 (38) hide show
  1. package/README.md +19 -0
  2. package/dist/index.d.ts +127 -111
  3. package/dist/index.js +42 -38
  4. package/dist/lib/CardsWidget.d.ts +4 -5
  5. package/dist/lib/CreateCardWidget.d.ts +686 -0
  6. package/dist/lib/CreateCardWidget.js +5 -0
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +117 -119
  8. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +5 -0
  9. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index2.js +13 -0
  10. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index3.js +12 -0
  11. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index4.js +29 -0
  12. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +22 -0
  13. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index.js +4 -0
  14. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index2.js +4 -0
  15. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index3.js +56 -0
  16. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +31 -0
  17. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +16 -0
  18. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +52 -0
  19. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +200 -0
  20. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/index.js +4 -0
  21. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardArt.js +12 -0
  22. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CreateCardWidget.js +99 -0
  23. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/ManualAddressFields.js +67 -0
  24. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/PreparingView.js +31 -0
  25. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/SetupView.js +172 -0
  26. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/SuccessView.js +50 -0
  27. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/labels.js +103 -0
  28. package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/types.js +11 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +16 -16
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +169 -151
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +141 -113
  32. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +6 -4
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +5 -5
  34. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js +6 -3
  35. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  36. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js +75 -45
  37. package/dist/pending-feature-style-sources.d.ts +1 -2
  38. package/package.json +1 -1
@@ -0,0 +1,200 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { useAllBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
7
+ import "../../../shared/data-access/dist/index.js";
8
+ import { EmbeddedToaster as n } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
9
+ import "../../../shared/ui/dist/index.js";
10
+ import { useAnalyticsTrack as r } from "../../../shared/feature/dist/lib/analytics/hooks.js";
11
+ import { WidgetProvider as ee } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
12
+ import { getStateOptions as i } from "../../../shared/util/dist/lib/usStates.js";
13
+ import { useWidgetConfig as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
14
+ import "../../../shared/feature/dist/index.js";
15
+ import { CREATE_CARD_WIDGET_LABELS_EN as o } from "../../ui/dist/lib/CreateCardWidget/labels.js";
16
+ import { CreateCardView as s, MailingOptionValue as c } from "../../ui/dist/lib/CreateCardWidget/types.js";
17
+ import { CreateCardWidget as te } from "../../ui/dist/lib/CreateCardWidget/CreateCardWidget.js";
18
+ import "../../ui/dist/index.js";
19
+ import { CardFormatValue as l, buildCreateDebitCardRequest as ne, createDebitCardReference as re, formatBusinessAddress as ie, isBusinessAddressComplete as ae, isManualAddressComplete as oe } from "./index3.js";
20
+ import { resolveCreateCardFeatureLabels as se } from "./index4.js";
21
+ import { CreateCardWidgetAnalyticsEvent as ce, WIDGET_NAME as u } from "./index2.js";
22
+ import { getCreateCardPermissions as le } from "./index5.js";
23
+ import { useCreateCardCardholderOptions as ue } from "./index6.js";
24
+ import { useCreateCard as de } from "../../data-access/dist/index2.js";
25
+ import { useCreateDebitCardMutation as fe } from "../../data-access/dist/index4.js";
26
+ import { useCreateCardOrganizationQuery as pe } from "../../data-access/dist/index5.js";
27
+ import "../../data-access/dist/index.js";
28
+ import { useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
29
+ import { Fragment as me, jsx as h, jsxs as he } from "react/jsx-runtime";
30
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js
31
+ var g = {
32
+ street: "",
33
+ city: "",
34
+ state: "",
35
+ zip: ""
36
+ }, ge = 3e3, _e = 5e3;
37
+ function ve(e, t) {
38
+ if (e === "PENDING_ACTIVATION") return {
39
+ title: t.success.pendingActivationTitle,
40
+ description: t.success.pendingActivationDescription
41
+ };
42
+ if (e !== null && e !== "ACTIVE") return {
43
+ title: t.success.createdTitle,
44
+ description: t.success.createdDescription
45
+ };
46
+ }
47
+ function _(e) {
48
+ let t = e?.trim().slice(-4);
49
+ return t ? `••••${t}` : void 0;
50
+ }
51
+ function v(e, t) {
52
+ let n = e.nickname?.trim(), r = _(e.accountNumber);
53
+ return n && r ? `${n} (${r})` : n || r || t;
54
+ }
55
+ function y({ cardArtSrc: ee, labels: u, featureLabels: _, className: y, onClose: b, onCancel: ye, onViewCard: x }) {
56
+ let S = r(), { isReady: C } = de(), { initResponse: w, organizationId: T } = a(), E = f(() => le(w?.scopes), [w?.scopes]), D = se(_), O = {
57
+ ...o,
58
+ ...u,
59
+ setup: {
60
+ ...o.setup,
61
+ ...u?.setup
62
+ }
63
+ }, be = f(() => [{
64
+ value: l.Virtual,
65
+ label: O.setup.cardFormatVirtual
66
+ }, {
67
+ value: l.Physical,
68
+ label: O.setup.cardFormatPhysical
69
+ }], [O.setup.cardFormatPhysical, O.setup.cardFormatVirtual]), xe = f(() => i(), []), [Se, k] = m(s.Setup), [A, j] = m(null), [M, N] = m(null), [Ce, P] = m(null), [F, I] = m(null), [L, R] = m(g), [z, B] = m(null), [V, H] = m(null), U = () => {
70
+ j(null), N(null), P(null), I(null), R(g), B(null), H(null), k(s.Setup);
71
+ }, W = p(T);
72
+ T && T !== W.current && (W.current = T, U());
73
+ let G = p(!0);
74
+ d(() => (G.current = !0, () => {
75
+ G.current = !1;
76
+ }), []), d(() => {
77
+ S(ce.Mounted);
78
+ }, [S]);
79
+ let { options: we, isError: K, refetch: Te } = ue({ enabled: C && E.canReadUsers && E.canReadRoles }), Ee = pe({ enabled: C && E.canReadOrganization }), q = t({ enabled: C && E.canReadFundingAccounts }), J = fe(), Y = !!q.isError && C && E.canReadFundingAccounts, X = f(() => Y ? [] : (q.data?.data ?? []).map((e) => ({
80
+ value: e.id,
81
+ label: v(e, D.untitledFundingAccount)
82
+ })), [
83
+ q.data?.data,
84
+ D.untitledFundingAccount,
85
+ Y
86
+ ]), Z = Ce ?? (X.length === 1 ? X[0].value : null), Q = Ee.data?.address, De = ie(Q), Oe = ae(Q), $ = M === l.Physical, ke = $ && F === c.BusinessAddress && !!De, Ae = $ && F === c.DifferentAddress, je = Y || X.length > 0, Me = !C || !E.canIssue || J.isPending || K || Y || !A || !M || !Z || M === l.Physical && (!F || F === c.BusinessAddress && !Oe || F === c.DifferentAddress && !oe(L)), Ne = f(() => {
87
+ let e = ve(V, D);
88
+ return {
89
+ ...u,
90
+ success: {
91
+ ...u?.success,
92
+ ...e
93
+ }
94
+ };
95
+ }, [
96
+ V,
97
+ D,
98
+ u
99
+ ]), Pe = async () => {
100
+ if (!C) return;
101
+ let t = re(), n = ne({
102
+ cardholderUserId: A,
103
+ format: M,
104
+ bankAccountId: Z,
105
+ reference: t,
106
+ mailingOption: F,
107
+ orgAddress: Q,
108
+ manualAddress: L
109
+ });
110
+ if (!n) return;
111
+ k(s.Preparing);
112
+ let r = e.loading(D.toast.creating);
113
+ try {
114
+ let t = await J.mutateAsync({ body: n });
115
+ if (!G.current) {
116
+ e.dismiss(r);
117
+ return;
118
+ }
119
+ B(t.id), H(t.cardStatus), k(s.Success), e.success(D.toast.success, {
120
+ id: r,
121
+ duration: ge
122
+ });
123
+ } catch {
124
+ if (!G.current) {
125
+ e.dismiss(r);
126
+ return;
127
+ }
128
+ k(s.Setup), e.error(D.toast.error, {
129
+ id: r,
130
+ duration: _e
131
+ });
132
+ }
133
+ };
134
+ return /* @__PURE__ */ he(me, { children: [/* @__PURE__ */ h(n, {}), /* @__PURE__ */ h(te, {
135
+ view: Se,
136
+ cardArtSrc: ee,
137
+ labels: Ne,
138
+ className: y,
139
+ cardholderOptions: we,
140
+ selectedCardholder: A,
141
+ onCardholderSelect: j,
142
+ isCardholderError: K,
143
+ onCardholderRetry: K ? Te : void 0,
144
+ cardFormatOptions: be,
145
+ selectedCardFormat: M,
146
+ onCardFormatSelect: (e) => {
147
+ N(e), I(null);
148
+ },
149
+ isFundingAccountVisible: je,
150
+ fundingAccountOptions: X,
151
+ selectedFundingAccount: Z,
152
+ onFundingAccountSelect: P,
153
+ isFundingAccountError: Y,
154
+ onFundingAccountRetry: Y ? () => {
155
+ q.refetch();
156
+ } : void 0,
157
+ isMailingSectionVisible: $,
158
+ selectedMailingOption: F,
159
+ onMailingOptionSelect: I,
160
+ businessAddress: De,
161
+ isBusinessAddressVisible: ke,
162
+ isManualAddressVisible: Ae,
163
+ manualAddress: L,
164
+ onManualAddressChange: (e) => R((t) => ({
165
+ ...t,
166
+ ...e
167
+ })),
168
+ stateOptions: xe,
169
+ isCreateDisabled: Me,
170
+ onCreateClick: () => {
171
+ Pe();
172
+ },
173
+ onCancelClick: () => {
174
+ ye?.(), b?.();
175
+ },
176
+ onClose: b,
177
+ onCreateAnotherClick: U,
178
+ onViewCardClick: x && z ? () => {
179
+ x(z);
180
+ } : void 0
181
+ })] });
182
+ }
183
+ function b({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, linkComponent: i, implementation: a, uiFramework: o, errorFallback: s, onError: c, analytics: te, ...l }) {
184
+ return /* @__PURE__ */ h(ee, {
185
+ widgetName: u,
186
+ baseUrl: e,
187
+ widgetToken: t,
188
+ organizationId: n,
189
+ configClient: r,
190
+ linkComponent: i,
191
+ implementation: a,
192
+ uiFramework: o,
193
+ errorFallback: s,
194
+ onError: c,
195
+ analytics: te,
196
+ children: /* @__PURE__ */ h(y, { ...l })
197
+ });
198
+ }
199
+ //#endregion
200
+ export { b as CreateCardWidget, v as formatFundingAccountLabel };
@@ -0,0 +1,4 @@
1
+ import { CREATE_CARD_WIDGET_LABELS_EN as e } from "./lib/CreateCardWidget/labels.js";
2
+ import { CreateCardView as t, MailingOptionValue as n } from "./lib/CreateCardWidget/types.js";
3
+ import { CreateCardWidget as r } from "./lib/CreateCardWidget/CreateCardWidget.js";
4
+ export { e as CREATE_CARD_WIDGET_LABELS_EN, t as CreateCardView, r as CreateCardWidget, n as MailingOptionValue };
@@ -0,0 +1,12 @@
1
+ import { cn as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardArt.js
4
+ function n({ src: n, alt: r, className: i }) {
5
+ return /* @__PURE__ */ t("img", {
6
+ src: n,
7
+ alt: r,
8
+ className: e("ttw:mx-auto ttw:block ttw:h-auto ttw:w-full ttw:max-w-[300px] ttw:rounded-xl ttw:object-cover ttw:shadow-md", i)
9
+ });
10
+ }
11
+ //#endregion
12
+ export { n as CardArt };
@@ -0,0 +1,99 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { Button as e, cn as t } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { resolveCreateCardWidgetLabels as n } from "./labels.js";
7
+ import { CreateCardView as r } from "./types.js";
8
+ import { PreparingView as i } from "./PreparingView.js";
9
+ import { SetupView as a } from "./SetupView.js";
10
+ import { SuccessView as o } from "./SuccessView.js";
11
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
12
+ import { ChevronRightIcon as u, XIcon as d } from "lucide-react";
13
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CreateCardWidget.js
14
+ var f = {
15
+ street: "",
16
+ city: "",
17
+ state: "",
18
+ zip: ""
19
+ }, p = () => void 0;
20
+ function m(e) {
21
+ return e === r.Setup || e === r.Preparing || e === r.Success ? e : (console.error(`[CreateCardWidget] unexpected view ${JSON.stringify(e)}; falling back to "${r.Setup}"`), r.Setup);
22
+ }
23
+ function h({ view: h, cardArtSrc: g, labels: _, className: v, cardholderOptions: y = [], selectedCardholder: b = null, onCardholderSelect: x = p, isCardholderError: S = !1, onCardholderRetry: C, cardFormatOptions: w = [], selectedCardFormat: T = null, onCardFormatSelect: E = p, isFundingAccountVisible: D = !1, fundingAccountOptions: O = [], selectedFundingAccount: k = null, onFundingAccountSelect: A = p, isFundingAccountError: j = !1, onFundingAccountRetry: M, isMailingSectionVisible: N = !1, selectedMailingOption: P = null, onMailingOptionSelect: F = p, businessAddress: I = "", isBusinessAddressVisible: L = !1, isManualAddressVisible: R = !1, manualAddress: z = f, onManualAddressChange: B = p, stateOptions: V = [], isCreateDisabled: H = !1, onCreateClick: U = p, onCancelClick: W = p, onClose: G, onCreateAnotherClick: K = p, onViewCardClick: q }) {
24
+ let J = n(_), Y = m(h), X = Y === r.Setup;
25
+ return /* @__PURE__ */ l("div", {
26
+ className: t("ttw:relative ttw:flex ttw:h-full ttw:w-full ttw:min-h-0 ttw:flex-col ttw:bg-background", v),
27
+ children: [
28
+ /* @__PURE__ */ l("div", {
29
+ className: t("ttw:flex ttw:shrink-0 ttw:items-center ttw:gap-3 ttw:px-6 ttw:pt-4", X ? "ttw:bg-primary/5 ttw:pb-2" : "ttw:absolute ttw:inset-x-0 ttw:top-0 ttw:z-10 ttw:bg-transparent ttw:pb-0"),
30
+ children: [X ? /* @__PURE__ */ c("h2", {
31
+ className: "ttw:min-w-0 ttw:flex-1 ttw:text-lg ttw:font-semibold ttw:text-primary",
32
+ children: J.header.title
33
+ }) : /* @__PURE__ */ c("span", { className: "ttw:flex-1" }), G ? /* @__PURE__ */ c(e, {
34
+ type: "button",
35
+ variant: "ghost",
36
+ size: "icon",
37
+ "aria-label": J.header.closeAriaLabel,
38
+ onClick: G,
39
+ children: /* @__PURE__ */ c(d, { className: "ttw:size-4" })
40
+ }) : null]
41
+ }),
42
+ X ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
43
+ className: "ttw:min-h-0 ttw:flex-1 ttw:overflow-y-auto",
44
+ children: /* @__PURE__ */ c(a, {
45
+ cardArtSrc: g,
46
+ labels: J,
47
+ cardholderOptions: y,
48
+ selectedCardholder: b,
49
+ onCardholderSelect: x,
50
+ isCardholderError: S,
51
+ onCardholderRetry: C,
52
+ cardFormatOptions: w,
53
+ selectedCardFormat: T,
54
+ onCardFormatSelect: E,
55
+ isFundingAccountVisible: D,
56
+ fundingAccountOptions: O,
57
+ selectedFundingAccount: k,
58
+ onFundingAccountSelect: A,
59
+ isFundingAccountError: j,
60
+ onFundingAccountRetry: M,
61
+ isMailingSectionVisible: N,
62
+ selectedMailingOption: P,
63
+ onMailingOptionSelect: F,
64
+ businessAddress: I,
65
+ isBusinessAddressVisible: L,
66
+ isManualAddressVisible: R,
67
+ manualAddress: z,
68
+ onManualAddressChange: B,
69
+ stateOptions: V
70
+ })
71
+ }), /* @__PURE__ */ l("div", {
72
+ className: "ttw:flex ttw:shrink-0 ttw:justify-end ttw:gap-3 ttw:border-t ttw:border-border ttw:bg-muted/40 ttw:px-6 ttw:py-4",
73
+ children: [/* @__PURE__ */ c(e, {
74
+ type: "button",
75
+ variant: "outline",
76
+ onClick: W,
77
+ children: J.footer.cancel
78
+ }), /* @__PURE__ */ l(e, {
79
+ type: "button",
80
+ disabled: H,
81
+ onClick: U,
82
+ children: [J.footer.createCard, /* @__PURE__ */ c(u, { className: "ttw:size-4" })]
83
+ })]
84
+ })] }) : null,
85
+ Y === r.Preparing ? /* @__PURE__ */ c(i, {
86
+ cardArtSrc: g,
87
+ labels: J
88
+ }) : null,
89
+ Y === r.Success ? /* @__PURE__ */ c(o, {
90
+ cardArtSrc: g,
91
+ labels: J,
92
+ onCreateAnotherClick: K,
93
+ onViewCardClick: q
94
+ }) : null
95
+ ]
96
+ });
97
+ }
98
+ //#endregion
99
+ export { r as CreateCardView, h as CreateCardWidget, n as resolveCreateCardWidgetLabels };
@@ -0,0 +1,67 @@
1
+ import { Input as e, Label as t, Select as n, SelectContent as r, SelectItem as i, SelectTrigger as a, SelectValue as o } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { useId as s } from "react";
3
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
4
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/ManualAddressFields.js
5
+ function u({ values: u, stateOptions: d, onChange: f, labels: p }) {
6
+ let m = s(), h = `${m}-street`, g = `${m}-city`, _ = `${m}-state`, v = `${m}-zip`;
7
+ return /* @__PURE__ */ l("div", {
8
+ className: "ttw:mt-3 ttw:flex ttw:flex-col ttw:gap-3",
9
+ children: [/* @__PURE__ */ l("div", {
10
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
11
+ children: [/* @__PURE__ */ c(t, {
12
+ htmlFor: h,
13
+ children: p.streetLabel
14
+ }), /* @__PURE__ */ c(e, {
15
+ id: h,
16
+ value: u.street,
17
+ onChange: (e) => f({ street: e.target.value })
18
+ })]
19
+ }), /* @__PURE__ */ l("div", {
20
+ className: "ttw:grid ttw:grid-cols-3 ttw:gap-3",
21
+ children: [
22
+ /* @__PURE__ */ l("div", {
23
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
24
+ children: [/* @__PURE__ */ c(t, {
25
+ htmlFor: g,
26
+ children: p.cityLabel
27
+ }), /* @__PURE__ */ c(e, {
28
+ id: g,
29
+ value: u.city,
30
+ onChange: (e) => f({ city: e.target.value })
31
+ })]
32
+ }),
33
+ /* @__PURE__ */ l("div", {
34
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
35
+ children: [/* @__PURE__ */ c(t, {
36
+ htmlFor: _,
37
+ children: p.stateLabel
38
+ }), /* @__PURE__ */ l(n, {
39
+ value: u.state,
40
+ onValueChange: (e) => f({ state: e }),
41
+ children: [/* @__PURE__ */ c(a, {
42
+ id: _,
43
+ className: "ttw:w-full",
44
+ children: /* @__PURE__ */ c(o, { placeholder: p.statePlaceholder })
45
+ }), /* @__PURE__ */ c(r, { children: d.map((e) => /* @__PURE__ */ c(i, {
46
+ value: e.value,
47
+ children: e.label
48
+ }, e.value)) })]
49
+ })]
50
+ }),
51
+ /* @__PURE__ */ l("div", {
52
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
53
+ children: [/* @__PURE__ */ c(t, {
54
+ htmlFor: v,
55
+ children: p.zipLabel
56
+ }), /* @__PURE__ */ c(e, {
57
+ id: v,
58
+ value: u.zip,
59
+ onChange: (e) => f({ zip: e.target.value })
60
+ })]
61
+ })
62
+ ]
63
+ })]
64
+ });
65
+ }
66
+ //#endregion
67
+ export { u as ManualAddressFields };
@@ -0,0 +1,31 @@
1
+ import { Spinner as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { CardArt as t } from "./CardArt.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/PreparingView.js
5
+ function i({ cardArtSrc: i, labels: a }) {
6
+ return /* @__PURE__ */ r("div", {
7
+ className: "ttw:flex ttw:min-h-full ttw:flex-1 ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-6 ttw:bg-gradient-to-b ttw:from-background ttw:to-primary/10 ttw:px-6 ttw:py-12",
8
+ children: [
9
+ /* @__PURE__ */ n(t, {
10
+ src: i,
11
+ alt: a.cardArtAlt
12
+ }),
13
+ /* @__PURE__ */ r("div", {
14
+ className: "ttw:flex ttw:flex-col ttw:items-center ttw:gap-2 ttw:text-center",
15
+ children: [/* @__PURE__ */ n("h2", {
16
+ className: "ttw:text-xl ttw:font-semibold ttw:text-foreground",
17
+ children: a.preparing.title
18
+ }), /* @__PURE__ */ n("p", {
19
+ className: "ttw:text-sm ttw:text-muted-foreground",
20
+ children: a.preparing.description
21
+ })]
22
+ }),
23
+ /* @__PURE__ */ n(e, {
24
+ className: "ttw:size-8 ttw:text-primary",
25
+ "aria-label": a.preparing.title
26
+ })
27
+ ]
28
+ });
29
+ }
30
+ //#endregion
31
+ export { i as PreparingView };
@@ -0,0 +1,172 @@
1
+ import { Label as e, RadioGroup as t, RadioGroupItem as n, Select as r, SelectContent as i, SelectItem as a, SelectTrigger as o, SelectValue as s, Separator as c } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { ErrorState as l } from "../../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
3
+ import "../../../../../shared/ui/dist/index.js";
4
+ import { MailingOptionValue as u } from "./types.js";
5
+ import { CardArt as d } from "./CardArt.js";
6
+ import { ManualAddressFields as f } from "./ManualAddressFields.js";
7
+ import { useId as p } from "react";
8
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
9
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/SetupView.js
10
+ function _({ cardArtSrc: _, labels: v, cardholderOptions: y, selectedCardholder: b, onCardholderSelect: x, isCardholderError: S = !1, onCardholderRetry: C, cardFormatOptions: w, selectedCardFormat: T, onCardFormatSelect: E, isFundingAccountVisible: D, fundingAccountOptions: O, selectedFundingAccount: k, onFundingAccountSelect: A, isFundingAccountError: j = !1, onFundingAccountRetry: M, isMailingSectionVisible: N, selectedMailingOption: P, onMailingOptionSelect: F, businessAddress: I, isBusinessAddressVisible: L, isManualAddressVisible: R, manualAddress: z, onManualAddressChange: B, stateOptions: V }) {
11
+ let H = p(), U = `${H}-cardholder`, W = `${H}-card-format`, G = `${H}-funding-account`, K = `${H}-mailing-business`, q = `${H}-mailing-custom`;
12
+ return /* @__PURE__ */ g("div", {
13
+ className: "ttw:flex ttw:flex-col",
14
+ children: [/* @__PURE__ */ h("div", {
15
+ className: "ttw:bg-primary/5 ttw:px-6 ttw:pt-2 ttw:pb-6",
16
+ children: /* @__PURE__ */ h(d, {
17
+ src: _,
18
+ alt: v.cardArtAlt
19
+ })
20
+ }), /* @__PURE__ */ g("div", {
21
+ className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:px-6 ttw:py-6",
22
+ children: [/* @__PURE__ */ g("section", {
23
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
24
+ children: [
25
+ /* @__PURE__ */ g("div", {
26
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
27
+ children: [/* @__PURE__ */ h("h3", {
28
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
29
+ children: v.setup.sectionTitle
30
+ }), /* @__PURE__ */ h("p", {
31
+ className: "ttw:text-sm ttw:text-muted-foreground",
32
+ children: v.setup.sectionDescription
33
+ })]
34
+ }),
35
+ /* @__PURE__ */ g("div", {
36
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
37
+ children: [/* @__PURE__ */ h(e, {
38
+ htmlFor: U,
39
+ children: v.setup.cardholderLabel
40
+ }), S ? /* @__PURE__ */ h(l, {
41
+ title: v.cardholderError.title,
42
+ description: v.cardholderError.description,
43
+ retryLabel: v.cardholderError.retry,
44
+ onRetry: C,
45
+ className: "ttw:rounded-lg ttw:border ttw:border-border ttw:py-8"
46
+ }) : /* @__PURE__ */ g(r, {
47
+ value: b ?? "",
48
+ onValueChange: x,
49
+ children: [/* @__PURE__ */ h(o, {
50
+ id: U,
51
+ className: "ttw:w-full",
52
+ children: /* @__PURE__ */ h(s, { placeholder: v.setup.cardholderPlaceholder })
53
+ }), /* @__PURE__ */ h(i, { children: y.map((e) => /* @__PURE__ */ h(a, {
54
+ value: e.value,
55
+ children: e.label
56
+ }, e.value)) })]
57
+ })]
58
+ }),
59
+ /* @__PURE__ */ g("div", {
60
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
61
+ children: [/* @__PURE__ */ h(e, {
62
+ htmlFor: W,
63
+ children: v.setup.cardFormatLabel
64
+ }), /* @__PURE__ */ g(r, {
65
+ value: T ?? "",
66
+ onValueChange: E,
67
+ children: [/* @__PURE__ */ h(o, {
68
+ id: W,
69
+ className: "ttw:w-full",
70
+ children: /* @__PURE__ */ h(s, { placeholder: v.setup.cardFormatPlaceholder })
71
+ }), /* @__PURE__ */ h(i, { children: w.map((e) => /* @__PURE__ */ h(a, {
72
+ value: e.value,
73
+ children: e.label
74
+ }, e.value)) })]
75
+ })]
76
+ }),
77
+ D ? /* @__PURE__ */ g("div", {
78
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
79
+ children: [/* @__PURE__ */ h(e, {
80
+ htmlFor: G,
81
+ children: v.setup.fundingAccountLabel
82
+ }), j ? /* @__PURE__ */ h(l, {
83
+ title: v.fundingAccountError.title,
84
+ description: v.fundingAccountError.description,
85
+ retryLabel: v.fundingAccountError.retry,
86
+ onRetry: M,
87
+ className: "ttw:rounded-lg ttw:border ttw:border-border ttw:py-8"
88
+ }) : /* @__PURE__ */ g(r, {
89
+ value: k ?? "",
90
+ onValueChange: A,
91
+ children: [/* @__PURE__ */ h(o, {
92
+ id: G,
93
+ className: "ttw:w-full",
94
+ children: /* @__PURE__ */ h(s, { placeholder: v.setup.fundingAccountPlaceholder })
95
+ }), /* @__PURE__ */ h(i, { children: O.map((e) => /* @__PURE__ */ h(a, {
96
+ value: e.value,
97
+ children: e.label
98
+ }, e.value)) })]
99
+ })]
100
+ }) : null
101
+ ]
102
+ }), N ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(c, {}), /* @__PURE__ */ g("section", {
103
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
104
+ children: [/* @__PURE__ */ g("div", {
105
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
106
+ children: [/* @__PURE__ */ h("h3", {
107
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
108
+ children: v.mailing.sectionTitle
109
+ }), /* @__PURE__ */ h("p", {
110
+ className: "ttw:text-sm ttw:text-muted-foreground",
111
+ children: v.mailing.sectionDescription
112
+ })]
113
+ }), /* @__PURE__ */ g(t, {
114
+ value: P ?? "",
115
+ onValueChange: F,
116
+ className: "ttw:gap-0 ttw:overflow-hidden ttw:rounded-lg ttw:border ttw:border-border",
117
+ children: [/* @__PURE__ */ g("div", {
118
+ className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:border-b ttw:border-border ttw:p-4",
119
+ children: [/* @__PURE__ */ g("label", {
120
+ htmlFor: K,
121
+ className: "ttw:flex ttw:cursor-pointer ttw:items-start ttw:gap-3",
122
+ children: [/* @__PURE__ */ h(n, {
123
+ value: u.BusinessAddress,
124
+ id: K,
125
+ className: "ttw:mt-0.5"
126
+ }), /* @__PURE__ */ g("span", {
127
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:flex-col ttw:gap-0.5",
128
+ children: [/* @__PURE__ */ h("span", {
129
+ className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
130
+ children: v.mailing.businessTitle
131
+ }), /* @__PURE__ */ h("span", {
132
+ className: "ttw:text-sm ttw:text-muted-foreground",
133
+ children: v.mailing.businessDescription
134
+ })]
135
+ })]
136
+ }), L ? /* @__PURE__ */ h("div", {
137
+ className: "ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-foreground",
138
+ children: I
139
+ }) : null]
140
+ }), /* @__PURE__ */ g("div", {
141
+ className: "ttw:flex ttw:flex-col ttw:gap-0 ttw:p-4",
142
+ children: [/* @__PURE__ */ g("label", {
143
+ htmlFor: q,
144
+ className: "ttw:flex ttw:cursor-pointer ttw:items-start ttw:gap-3",
145
+ children: [/* @__PURE__ */ h(n, {
146
+ value: u.DifferentAddress,
147
+ id: q,
148
+ className: "ttw:mt-0.5"
149
+ }), /* @__PURE__ */ g("span", {
150
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:flex-col ttw:gap-0.5",
151
+ children: [/* @__PURE__ */ h("span", {
152
+ className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
153
+ children: v.mailing.customTitle
154
+ }), /* @__PURE__ */ h("span", {
155
+ className: "ttw:text-sm ttw:text-muted-foreground",
156
+ children: v.mailing.customDescription
157
+ })]
158
+ })]
159
+ }), R ? /* @__PURE__ */ h(f, {
160
+ values: z,
161
+ stateOptions: V,
162
+ onChange: B,
163
+ labels: v.manualAddress
164
+ }) : null]
165
+ })]
166
+ })]
167
+ })] }) : null]
168
+ })]
169
+ });
170
+ }
171
+ //#endregion
172
+ export { _ as SetupView };
@@ -0,0 +1,50 @@
1
+ import { Button as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { CardArt as t } from "./CardArt.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { CheckIcon as i, ChevronRightIcon as a } from "lucide-react";
5
+ //#region ../../libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/SuccessView.js
6
+ function o({ cardArtSrc: o, labels: s, onCreateAnotherClick: c, onViewCardClick: l }) {
7
+ return /* @__PURE__ */ r("div", {
8
+ className: "ttw:flex ttw:min-h-0 ttw:flex-1 ttw:flex-col",
9
+ children: [/* @__PURE__ */ r("div", {
10
+ className: "ttw:flex ttw:min-h-0 ttw:flex-1 ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-6 ttw:overflow-y-auto ttw:bg-gradient-to-b ttw:from-background ttw:to-primary/10 ttw:px-6 ttw:py-12",
11
+ children: [/* @__PURE__ */ n(t, {
12
+ src: o,
13
+ alt: s.cardArtAlt
14
+ }), /* @__PURE__ */ r("div", {
15
+ className: "ttw:flex ttw:flex-col ttw:items-center ttw:gap-3 ttw:text-center",
16
+ children: [
17
+ /* @__PURE__ */ n("div", {
18
+ "aria-hidden": "true",
19
+ className: "ttw:flex ttw:size-10 ttw:items-center ttw:justify-center ttw:rounded-lg ttw:bg-emerald-700 ttw:text-white",
20
+ children: /* @__PURE__ */ n(i, { className: "ttw:size-5" })
21
+ }),
22
+ /* @__PURE__ */ n("h2", {
23
+ className: "ttw:text-xl ttw:font-semibold ttw:text-foreground",
24
+ children: s.success.title
25
+ }),
26
+ /* @__PURE__ */ n("p", {
27
+ className: "ttw:text-sm ttw:text-muted-foreground",
28
+ children: s.success.description
29
+ })
30
+ ]
31
+ })]
32
+ }), /* @__PURE__ */ r("div", {
33
+ className: "ttw:flex ttw:shrink-0 ttw:gap-3 ttw:border-t ttw:border-border ttw:bg-background ttw:px-6 ttw:py-4",
34
+ children: [/* @__PURE__ */ n(e, {
35
+ type: "button",
36
+ variant: "outline",
37
+ className: "ttw:flex-1",
38
+ onClick: c,
39
+ children: s.success.createAnother
40
+ }), l ? /* @__PURE__ */ r(e, {
41
+ type: "button",
42
+ className: "ttw:flex-1",
43
+ onClick: l,
44
+ children: [s.success.viewCard, /* @__PURE__ */ n(a, { className: "ttw:size-4" })]
45
+ }) : null]
46
+ })]
47
+ });
48
+ }
49
+ //#endregion
50
+ export { o as SuccessView };