@tesouro/embedded-components-react 0.7.49 → 0.7.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.
Files changed (188) hide show
  1. package/dist/lib/monite-sdk.d.ts +42 -42
  2. package/dist/lib/monite-sdk.js +18 -18
  3. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsTable.js +2 -1
  4. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/mocks/counterparts.js +233 -88
  5. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/mocks/labels.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index.js +19 -19
  7. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index100.js +56 -10
  8. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index101.js +10 -37
  9. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index102.js +39 -1
  10. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index103.js +0 -105
  11. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index104.js +105 -0
  12. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index105.js +1 -56
  13. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index106.js +56 -1
  14. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index107.js +1 -55
  15. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index108.js +55 -1
  16. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index109.js +1 -55
  17. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index110.js +55 -1
  18. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index111.js +1 -153
  19. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index112.js +150 -52
  20. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index113.js +55 -2
  21. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index114.js +0 -1
  22. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index115.js +2 -0
  23. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index116.js +0 -1
  24. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index117.js +2 -10
  25. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index118.js +7 -53
  26. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index119.js +51 -36
  27. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index120.js +38 -71
  28. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index121.js +72 -39
  29. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index122.js +36 -9
  30. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index123.js +7 -6
  31. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index124.js +6 -64
  32. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index125.js +57 -158
  33. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index126.js +172 -7
  34. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index127.js +6 -1
  35. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index128.js +2 -76
  36. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index129.js +76 -1
  37. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index130.js +0 -78
  38. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index131.js +78 -0
  39. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index132.js +1 -35
  40. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index133.js +35 -1
  41. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index134.js +0 -57
  42. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index135.js +56 -42
  43. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index136.js +44 -1
  44. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index137.js +0 -568
  45. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index138.js +568 -0
  46. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index139.js +1 -1
  47. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index140.js +1 -160
  48. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index141.js +159 -0
  49. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index142.js +0 -26
  50. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index143.js +26 -0
  51. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index144.js +1 -12
  52. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index145.js +2 -2
  53. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index146.js +2 -2
  54. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index147.js +10 -16
  55. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index148.js +16 -19
  56. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index149.js +19 -27
  57. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index150.js +29 -1
  58. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index151.js +1 -93
  59. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index154.js +4 -4
  60. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index159.js +1 -1
  61. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index162.js +4 -4
  62. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index164.js +1 -1
  63. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index168.js +1 -1
  64. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index172.js +2 -2
  65. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index173.js +1 -1
  66. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index175.js +12 -11
  67. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index178.js +4 -4
  68. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index179.js +2 -2
  69. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index229.js +1 -1
  70. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index235.js +2 -2
  71. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index249.js +4 -4
  72. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index252.js +1 -1
  73. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index260.js +87 -41
  74. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index261.js +44 -48
  75. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index262.js +48 -82
  76. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index263.js +83 -7
  77. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index264.js +7 -305
  78. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index265.js +307 -1
  79. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index266.js +1 -32
  80. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index267.js +32 -1
  81. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index268.js +1 -29
  82. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index269.js +29 -1
  83. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index270.js +1 -22
  84. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index271.js +22 -1
  85. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index272.js +0 -159
  86. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index273.js +159 -0
  87. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index274.js +1 -37
  88. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index275.js +34 -33
  89. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index276.js +33 -3
  90. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index277.js +3 -102
  91. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index278.js +88 -172
  92. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index279.js +171 -116
  93. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index280.js +114 -191
  94. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index281.js +209 -11
  95. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index282.js +11 -15
  96. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index283.js +14 -28
  97. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index284.js +31 -1
  98. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index285.js +0 -241
  99. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index286.js +241 -0
  100. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index287.js +1 -36
  101. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index288.js +31 -137
  102. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index289.js +142 -1
  103. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index290.js +0 -166
  104. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index291.js +166 -25
  105. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index292.js +26 -19
  106. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index293.js +16 -17
  107. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index294.js +17 -5
  108. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index295.js +4 -14
  109. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index296.js +12 -18
  110. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index297.js +9 -9
  111. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index298.js +21 -5
  112. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index299.js +4 -13
  113. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index300.js +11 -14
  114. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index301.js +20 -9
  115. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index302.js +8 -26
  116. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index303.js +23 -11
  117. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index304.js +12 -8
  118. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index305.js +8 -24
  119. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index306.js +25 -14
  120. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index307.js +14 -81
  121. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index308.js +81 -14
  122. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index309.js +14 -100
  123. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index310.js +98 -42
  124. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index311.js +43 -27
  125. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index312.js +30 -1
  126. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index313.js +0 -105
  127. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index314.js +102 -35
  128. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index315.js +32 -166
  129. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index316.js +171 -12
  130. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index317.js +13 -3
  131. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index318.js +4 -70
  132. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index319.js +62 -19
  133. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index320.js +24 -209
  134. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index321.js +207 -87
  135. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index322.js +90 -17
  136. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index323.js +17 -158
  137. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index324.js +144 -88
  138. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index325.js +100 -42
  139. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index326.js +46 -4
  140. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index327.js +4 -24
  141. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index328.js +20 -73
  142. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index329.js +74 -16
  143. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index330.js +16 -19
  144. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index331.js +19 -5
  145. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index332.js +4 -8
  146. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index333.js +10 -11
  147. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index334.js +11 -131
  148. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index335.js +129 -4
  149. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index336.js +4 -4
  150. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index337.js +8 -5
  151. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index338.js +4 -221
  152. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index339.js +219 -31
  153. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index340.js +31 -11
  154. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index341.js +12 -34
  155. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index342.js +34 -20
  156. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index343.js +18 -72
  157. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index344.js +73 -181
  158. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index345.js +182 -14
  159. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index346.js +14 -204
  160. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index347.js +192 -88
  161. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index348.js +97 -61
  162. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index349.js +63 -54
  163. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index350.js +46 -83
  164. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index351.js +91 -40
  165. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index352.js +39 -75
  166. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index353.js +63 -71
  167. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index354.js +85 -12
  168. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index355.js +12 -24
  169. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index356.js +25 -16
  170. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index357.js +14 -2
  171. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index358.js +4 -23
  172. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index359.js +23 -0
  173. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index360.js +0 -45
  174. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index361.js +46 -32
  175. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index362.js +30 -2
  176. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index363.js +2 -34
  177. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index364.js +33 -15
  178. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index365.js +14 -29
  179. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index366.js +29 -27
  180. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index367.js +31 -2
  181. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index368.js +2 -97
  182. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index369.js +97 -0
  183. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index96.js +2 -17
  184. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index97.js +17 -3
  185. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index98.js +5 -1
  186. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index99.js +1 -57
  187. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  188. package/package.json +1 -1
@@ -1,19 +1,92 @@
1
- import { Typography as e } from "./index158.js";
2
- import { twMerge as t } from "tailwind-merge";
3
- import { jsx as n, jsxs as r } from "@emotion/react/jsx-runtime";
1
+ import { applyAPIValidationErrors as e, parseAPIValidationErrors as t } from "./index25.js";
2
+ import { useCurrencies as n } from "./index76.js";
3
+ import "./index89.js";
4
+ import { Button as r } from "./index122.js";
5
+ import { LoadingSpinner as i } from "./index67.js";
6
+ import "./index251.js";
7
+ import { useUpdateProduct as a } from "./index301.js";
8
+ import { PRODUCT_API_FIELD_MAP as o } from "./index305.js";
9
+ import { getProductValidationSchema as s } from "./index309.js";
10
+ import { ProductFormContent as c } from "./index321.js";
11
+ import { useCallback as l, useId as u, useMemo as d } from "react";
12
+ import { jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
13
+ import { useLingui as m } from "@lingui/react";
14
+ import { FormProvider as h, useForm as g } from "react-hook-form";
15
+ import { zodResolver as _ } from "@hookform/resolvers/zod";
4
16
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index322.js
5
- var i = ({ label: i, value: a, isLast: o }) => /* @__PURE__ */ r("li", {
6
- className: t("ttw:flex ttw:gap-4 ttw:py-2.5", !o && "ttw:border-b ttw:border-border"),
7
- children: [/* @__PURE__ */ n(e, {
8
- variant: "body2",
9
- color: "muted",
10
- className: "ttw:w-35 ttw:min-w-35 ttw:font-medium",
11
- children: i
12
- }), typeof a == "string" ? /* @__PURE__ */ n(e, {
13
- variant: "body2",
14
- className: "ttw:font-medium",
15
- children: a
16
- }) : a]
17
- });
17
+ var v = ({ product: v, handleClose: y, onUpdate: b }) => {
18
+ let { i18n: x } = m(), { formatToMinorUnits: S, formatFromMinorUnits: C } = n(), w = `product-edit-form-${u()}`, { mutate: T, isPending: E } = a(v.id), D = d(() => ({
19
+ name: v.name,
20
+ type: v.type ?? "product",
21
+ pricePerUnit: C(v.price?.value, v.price?.currency) ?? void 0,
22
+ currency: v.price?.currency ?? "USD",
23
+ description: v.description ?? "",
24
+ measureUnitId: v.measure_unit_id ?? void 0
25
+ }), [
26
+ v.name,
27
+ v.type,
28
+ v.price?.value,
29
+ v.price?.currency,
30
+ v.description,
31
+ v.measure_unit_id,
32
+ C
33
+ ]), O = g({
34
+ resolver: _(s(x)),
35
+ defaultValues: D
36
+ }), k = l((n) => {
37
+ n.preventDefault(), n.stopPropagation(), O.handleSubmit((n) => {
38
+ T({
39
+ name: n.name,
40
+ type: n.type,
41
+ price: {
42
+ value: S(n.pricePerUnit, n.currency) ?? n.pricePerUnit,
43
+ currency: n.currency
44
+ },
45
+ description: n.description,
46
+ ...n.measureUnitId ? { measure_unit_id: n.measureUnitId } : {}
47
+ }, {
48
+ onSuccess: (e) => {
49
+ b?.(e);
50
+ },
51
+ onError: (n) => {
52
+ e(O.setError, t(n), { fieldMap: o });
53
+ }
54
+ });
55
+ })(n);
56
+ }, [
57
+ T,
58
+ S,
59
+ b,
60
+ O.handleSubmit,
61
+ O.setError
62
+ ]);
63
+ return /* @__PURE__ */ f(h, {
64
+ ...O,
65
+ children: /* @__PURE__ */ p("form", {
66
+ id: w,
67
+ onSubmit: k,
68
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:p-4 ttw:border ttw:border-primary ttw:rounded-[10px] ttw:bg-zinc-100",
69
+ children: [/* @__PURE__ */ f(c, {
70
+ isLoading: E,
71
+ isProduct: v?.type === "product",
72
+ isEditMode: !0
73
+ }), /* @__PURE__ */ p("div", {
74
+ className: "ttw:flex ttw:gap-4 ttw:pt-6",
75
+ children: [/* @__PURE__ */ f(r, {
76
+ type: "button",
77
+ variant: "outline",
78
+ className: "ttw:border-border ttw:flex-1",
79
+ onClick: y,
80
+ children: x._("Cancel")
81
+ }), /* @__PURE__ */ p(r, {
82
+ type: "submit",
83
+ className: "ttw:flex-1",
84
+ disabled: E || !O.formState.isDirty,
85
+ children: [E && /* @__PURE__ */ f(i, { className: "ttw:border-white ttw:border-t-transparent ttw:size-4" }), x._("Save")]
86
+ })]
87
+ })]
88
+ })
89
+ });
90
+ };
18
91
  //#endregion
19
- export { i as ProductDetailLine };
92
+ export { v as ProductEditForm };
@@ -1,160 +1,19 @@
1
- import { Scope as e } from "../../shared/data-access/dist/lib/scopes.js";
2
- import "../../shared/data-access/dist/index.js";
3
- import { useMoniteContext as t } from "./index45.js";
4
- import { useCurrencies as n } from "./index76.js";
5
- import { Button as r } from "./index121.js";
6
- import { LoadingSpinner as i } from "./index67.js";
7
- import { Skeleton as a } from "./index72.js";
8
- import { MoniteScopedProviders as o } from "./index155.js";
9
- import { useUserPermissions as s } from "./index156.js";
10
- import { DropdownMenu as c, DropdownMenuContent as l, DropdownMenuItem as u, DropdownMenuTrigger as d } from "./index157.js";
11
- import { Typography as f } from "./index158.js";
12
- import { AccessRestriction as p } from "./index162.js";
13
- import "./index251.js";
14
- import { NotFound as m } from "./index270.js";
15
- import "./index271.js";
16
- import { useGetProductById as h } from "./index298.js";
17
- import { ProductDeleteModal as g } from "./index302.js";
18
- import { Sheet as _, SheetClose as v, SheetContent as y, SheetDescription as b, SheetHeader as x, SheetTitle as S } from "./index307.js";
19
- import { ProductEditForm as C } from "./index321.js";
20
- import { ProductDetailLine as w } from "./index322.js";
21
- import { useState as T } from "react";
22
- import { MoreVerticalIcon as E, Trash2 as D, X as O } from "lucide-react";
23
- import { Fragment as k, jsx as A, jsxs as j } from "@emotion/react/jsx-runtime";
24
- import { useLingui as M } from "@lingui/react";
1
+ import { Typography as e } from "./index158.js";
2
+ import { twMerge as t } from "tailwind-merge";
3
+ import { jsx as n, jsxs as r } from "@emotion/react/jsx-runtime";
25
4
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index323.js
26
- var N = (e) => /* @__PURE__ */ A(o, { children: /* @__PURE__ */ A(P, { ...e }) }), P = ({ id: o, open: N, onClose: P, onUpdated: F, onDeleted: I, showActionsMenu: L = !0 }) => {
27
- let { i18n: R } = M(), { locale: z } = t(), { formatCurrencyToDisplay: B } = n(), [V, H] = T(!1), [U, W] = T(!1), { data: G, isLoading: K, isFetching: q } = h(o), J = G?.type === "product", Y = s(), X = Y.has(e.InvoiceReadOrg), Z = Y.has(e.InvoiceWriteOrg), Q = Y.has(e.InvoiceWriteOrg);
28
- return X ? !K && !q && !G ? /* @__PURE__ */ A(_, {
29
- open: N,
30
- onOpenChange: P,
31
- children: /* @__PURE__ */ A(y, {
32
- showCloseButton: !0,
33
- className: "ttw:gap-0",
34
- children: /* @__PURE__ */ A("div", {
35
- className: "ttw:w-3/4 ttw:m-auto ttw:p-4",
36
- children: /* @__PURE__ */ A(m, {
37
- title: R._("Product not found"),
38
- description: R._("There is no product by provided id: {id}", { id: o })
39
- })
40
- })
41
- })
42
- }) : /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(_, {
43
- open: N,
44
- onOpenChange: P,
45
- children: /* @__PURE__ */ j(y, {
46
- showCloseButton: !1,
47
- className: "ttw:gap-0",
48
- children: [/* @__PURE__ */ j(x, {
49
- className: "ttw:pt-6 ttw:pl-6 ttw:pb-7 ttw:flex-row ttw:gap-3 ttw:border-b ttw:border-border",
50
- children: [/* @__PURE__ */ j("div", {
51
- className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:w-[85%]",
52
- children: [/* @__PURE__ */ A(S, {
53
- asChild: K,
54
- className: "ttw:text-2xl",
55
- children: K ? /* @__PURE__ */ A(a, { className: "ttw:w-40" }) : G?.name ?? ""
56
- }), /* @__PURE__ */ A(b, {
57
- asChild: K,
58
- children: K ? /* @__PURE__ */ A(a, { className: "ttw:w-60" }) : R._("{type} · Added {createdAt}", {
59
- createdAt: R.date(G?.created_at, z.dateFormat),
60
- type: G?.type === "product" ? "Product" : "Service"
61
- })
62
- })]
63
- }), /* @__PURE__ */ j("div", {
64
- className: "ttw:flex ttw:gap-2",
65
- children: [L && Q && /* @__PURE__ */ j(c, { children: [/* @__PURE__ */ A(d, {
66
- asChild: !0,
67
- children: /* @__PURE__ */ A(r, {
68
- type: "button",
69
- variant: "outline",
70
- className: "ttw:p-2 ttw:size-9 ttw:border-none ttw:bg-muted",
71
- children: /* @__PURE__ */ A(E, {})
72
- })
73
- }), /* @__PURE__ */ A(l, {
74
- align: "end",
75
- children: /* @__PURE__ */ j(u, {
76
- onClick: () => W(!0),
77
- variant: "destructive",
78
- children: [/* @__PURE__ */ A(D, {}), R._("Delete product")]
79
- })
80
- })] }), /* @__PURE__ */ A(v, {
81
- className: "ttw:size-9 ttw:bg-muted ttw:p-2 ttw:flex ttw:items-center ttw:justify-center ttw:rounded-md ttw:cursor-pointer",
82
- children: /* @__PURE__ */ A(O, { className: "ttw:size-4" })
83
- })]
84
- })]
85
- }), K ? /* @__PURE__ */ A("div", {
86
- className: "ttw:flex ttw:w-full ttw:h-full ttw:items-center ttw:justify-center",
87
- children: /* @__PURE__ */ A(i, {})
88
- }) : /* @__PURE__ */ A("main", {
89
- className: "ttw:p-6 ttw:overflow-auto ttw:flex ttw:flex-col ttw:gap-4",
90
- children: /* @__PURE__ */ j("div", {
91
- className: "ttw:flex ttw:flex-col ttw:gap-4",
92
- children: [/* @__PURE__ */ j("div", {
93
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
94
- children: [/* @__PURE__ */ j("div", {
95
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
96
- children: [/* @__PURE__ */ A(f, {
97
- variant: "body1",
98
- className: "ttw:font-medium",
99
- children: R._("{type} details", { type: J ? "Product" : "Service" })
100
- }), /* @__PURE__ */ A(f, {
101
- variant: "body2",
102
- color: "muted",
103
- children: J ? R._("A physical or digital item") : R._("Work or labor you provide")
104
- })]
105
- }), !V && Z && /* @__PURE__ */ A(r, {
106
- type: "button",
107
- variant: "ghost",
108
- className: "ttw:text-primary ttw:hover:text-primary",
109
- onClick: () => H(!0),
110
- children: R._("Edit")
111
- })]
112
- }), V && G ? /* @__PURE__ */ A(C, {
113
- product: G,
114
- handleClose: () => H(!1),
115
- onUpdate: (e) => {
116
- F?.(e), H(!1);
117
- }
118
- }) : /* @__PURE__ */ j("ul", {
119
- className: "ttw:list-none",
120
- children: [
121
- /* @__PURE__ */ A(w, {
122
- label: R._("{type} name", { type: J ? "Product" : "Service" }),
123
- value: G?.name ?? "-"
124
- }),
125
- /* @__PURE__ */ A(w, {
126
- label: R._("Price per unit"),
127
- value: G?.price ? B(G.price.value, G.price.currency) : "-"
128
- }),
129
- /* @__PURE__ */ A(w, {
130
- label: R._("Description"),
131
- value: G?.description || "-",
132
- isLast: !0
133
- })
134
- ]
135
- })]
136
- })
137
- })]
138
- })
139
- }), o && U && /* @__PURE__ */ A(g, {
140
- id: o,
141
- open: U,
142
- onClose: () => W(!1),
143
- onDeleted: (e) => {
144
- P?.(), I?.(e), W(!1);
145
- }
146
- })] }) : /* @__PURE__ */ A(_, {
147
- open: N,
148
- onOpenChange: P,
149
- children: /* @__PURE__ */ A(y, {
150
- showCloseButton: !0,
151
- className: "ttw:gap-0",
152
- children: /* @__PURE__ */ A("div", {
153
- className: "ttw:w-3/4 ttw:m-auto ttw:p-4",
154
- children: /* @__PURE__ */ A(p, {})
155
- })
156
- })
157
- });
158
- };
5
+ var i = ({ label: i, value: a, isLast: o }) => /* @__PURE__ */ r("li", {
6
+ className: t("ttw:flex ttw:gap-4 ttw:py-2.5", !o && "ttw:border-b ttw:border-border"),
7
+ children: [/* @__PURE__ */ n(e, {
8
+ variant: "body2",
9
+ color: "muted",
10
+ className: "ttw:w-35 ttw:min-w-35 ttw:font-medium",
11
+ children: i
12
+ }), typeof a == "string" ? /* @__PURE__ */ n(e, {
13
+ variant: "body2",
14
+ className: "ttw:font-medium",
15
+ children: a
16
+ }) : a]
17
+ });
159
18
  //#endregion
160
- export { N as ProductDetails };
19
+ export { i as ProductDetailLine };
@@ -1,104 +1,160 @@
1
- import { applyAPIValidationErrors as e, parseAPIValidationErrors as t } from "./index25.js";
1
+ import { Scope as e } from "../../shared/data-access/dist/lib/scopes.js";
2
+ import "../../shared/data-access/dist/index.js";
3
+ import { useMoniteContext as t } from "./index45.js";
2
4
  import { useCurrencies as n } from "./index76.js";
3
- import "./index89.js";
4
- import { Button as r } from "./index121.js";
5
+ import { Button as r } from "./index122.js";
5
6
  import { LoadingSpinner as i } from "./index67.js";
6
- import { MoniteScopedProviders as a } from "./index155.js";
7
+ import { Skeleton as a } from "./index72.js";
8
+ import { MoniteScopedProviders as o } from "./index155.js";
9
+ import { useUserPermissions as s } from "./index156.js";
10
+ import { DropdownMenu as c, DropdownMenuContent as l, DropdownMenuItem as u, DropdownMenuTrigger as d } from "./index157.js";
11
+ import { Typography as f } from "./index158.js";
12
+ import { AccessRestriction as p } from "./index162.js";
7
13
  import "./index251.js";
8
- import { useCreateProduct as o } from "./index293.js";
9
- import "./index301.js";
10
- import { PRODUCT_API_FIELD_MAP as s } from "./index304.js";
11
- import { Sheet as c, SheetClose as l, SheetContent as u, SheetDescription as d, SheetFooter as f, SheetHeader as p, SheetTitle as m } from "./index307.js";
12
- import { getProductValidationSchema as h } from "./index308.js";
13
- import { ProductFormContent as g } from "./index320.js";
14
- import { useCallback as _, useId as v, useMemo as y } from "react";
15
- import { jsx as b, jsxs as x } from "@emotion/react/jsx-runtime";
16
- import { useLingui as S } from "@lingui/react";
17
- import { FormProvider as C, useForm as w } from "react-hook-form";
18
- import { zodResolver as T } from "@hookform/resolvers/zod";
14
+ import { NotFound as m } from "./index271.js";
15
+ import "./index272.js";
16
+ import { useGetProductById as h } from "./index299.js";
17
+ import { ProductDeleteModal as g } from "./index303.js";
18
+ import { Sheet as _, SheetClose as v, SheetContent as y, SheetDescription as b, SheetHeader as x, SheetTitle as S } from "./index308.js";
19
+ import { ProductEditForm as C } from "./index322.js";
20
+ import { ProductDetailLine as w } from "./index323.js";
21
+ import { useState as T } from "react";
22
+ import { MoreVerticalIcon as E, Trash2 as D, X as O } from "lucide-react";
23
+ import { Fragment as k, jsx as A, jsxs as j } from "@emotion/react/jsx-runtime";
24
+ import { useLingui as M } from "@lingui/react";
19
25
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index324.js
20
- var E = (e) => /* @__PURE__ */ b(a, { children: /* @__PURE__ */ b(D, { ...e }) }), D = ({ onClose: a, open: E, onCreated: D }) => {
21
- let { i18n: O } = S(), { formatToMinorUnits: k } = n(), A = `product-form-${v()}`, { mutate: j, isPending: M } = o(D), N = y(() => ({
22
- name: "",
23
- type: "product",
24
- measureUnitId: "",
25
- pricePerUnit: void 0,
26
- currency: "USD",
27
- description: void 0
28
- }), []), { watch: P, ...F } = w({
29
- resolver: T(h(O)),
30
- defaultValues: N
31
- }), I = P("type"), L = !!P("name")?.trim() && P("pricePerUnit") !== void 0, R = _((n) => {
32
- n.preventDefault(), n.stopPropagation(), F.handleSubmit((n) => {
33
- j({ body: {
34
- name: n.name,
35
- type: n.type,
36
- price: {
37
- value: k(n.pricePerUnit, n.currency) ?? 0,
38
- currency: n.currency
39
- },
40
- description: n.description,
41
- ...n.measureUnitId ? { measure_unit_id: n.measureUnitId } : {}
42
- } }, { onError: (n) => {
43
- e(F.setError, t(n), { fieldMap: s });
44
- } });
45
- })(n);
46
- }, [
47
- j,
48
- k,
49
- F.handleSubmit,
50
- F.setError
51
- ]);
52
- return /* @__PURE__ */ b(c, {
53
- open: E,
54
- onOpenChange: a,
55
- children: /* @__PURE__ */ x(u, {
26
+ var N = (e) => /* @__PURE__ */ A(o, { children: /* @__PURE__ */ A(P, { ...e }) }), P = ({ id: o, open: N, onClose: P, onUpdated: F, onDeleted: I, showActionsMenu: L = !0 }) => {
27
+ let { i18n: R } = M(), { locale: z } = t(), { formatCurrencyToDisplay: B } = n(), [V, H] = T(!1), [U, W] = T(!1), { data: G, isLoading: K, isFetching: q } = h(o), J = G?.type === "product", Y = s(), X = Y.has(e.InvoiceReadOrg), Z = Y.has(e.InvoiceWriteOrg), Q = Y.has(e.InvoiceWriteOrg);
28
+ return X ? !K && !q && !G ? /* @__PURE__ */ A(_, {
29
+ open: N,
30
+ onOpenChange: P,
31
+ children: /* @__PURE__ */ A(y, {
32
+ showCloseButton: !0,
56
33
  className: "ttw:gap-0",
57
- children: [
58
- /* @__PURE__ */ x(p, {
59
- className: "ttw:border-b ttw:border-border",
60
- children: [/* @__PURE__ */ b(m, {
34
+ children: /* @__PURE__ */ A("div", {
35
+ className: "ttw:w-3/4 ttw:m-auto ttw:p-4",
36
+ children: /* @__PURE__ */ A(m, {
37
+ title: R._("Product not found"),
38
+ description: R._("There is no product by provided id: {id}", { id: o })
39
+ })
40
+ })
41
+ })
42
+ }) : /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(_, {
43
+ open: N,
44
+ onOpenChange: P,
45
+ children: /* @__PURE__ */ j(y, {
46
+ showCloseButton: !1,
47
+ className: "ttw:gap-0",
48
+ children: [/* @__PURE__ */ j(x, {
49
+ className: "ttw:pt-6 ttw:pl-6 ttw:pb-7 ttw:flex-row ttw:gap-3 ttw:border-b ttw:border-border",
50
+ children: [/* @__PURE__ */ j("div", {
51
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:w-[85%]",
52
+ children: [/* @__PURE__ */ A(S, {
53
+ asChild: K,
61
54
  className: "ttw:text-2xl",
62
- children: O._("Add a product or service")
63
- }), /* @__PURE__ */ b(d, {
64
- className: "ttw:max-w-130",
65
- children: O._("Save the products and services you sell so you can quickly add them as line items on invoices.")
66
- })]
67
- }),
68
- /* @__PURE__ */ b("div", {
69
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:px-6 ttw:py-8 ttw:overflow-auto",
70
- children: /* @__PURE__ */ b(C, {
71
- ...F,
72
- watch: P,
73
- children: /* @__PURE__ */ b("form", {
74
- id: A,
75
- onSubmit: R,
76
- children: /* @__PURE__ */ b(g, { isLoading: M })
55
+ children: K ? /* @__PURE__ */ A(a, { className: "ttw:w-40" }) : G?.name ?? ""
56
+ }), /* @__PURE__ */ A(b, {
57
+ asChild: K,
58
+ children: K ? /* @__PURE__ */ A(a, { className: "ttw:w-60" }) : R._("{type} · Added {createdAt}", {
59
+ createdAt: R.date(G?.created_at, z.dateFormat),
60
+ type: G?.type === "product" ? "Product" : "Service"
77
61
  })
78
- })
79
- }),
80
- /* @__PURE__ */ x(f, {
81
- className: "ttw:border-t ttw:border-border ttw:flex-row ttw:justify-end",
82
- children: [/* @__PURE__ */ b(l, {
62
+ })]
63
+ }), /* @__PURE__ */ j("div", {
64
+ className: "ttw:flex ttw:gap-2",
65
+ children: [L && Q && /* @__PURE__ */ j(c, { children: [/* @__PURE__ */ A(d, {
83
66
  asChild: !0,
84
- children: /* @__PURE__ */ b(r, {
67
+ children: /* @__PURE__ */ A(r, {
68
+ type: "button",
85
69
  variant: "outline",
86
- disabled: M,
87
- className: "ttw:flex-1 ttw:border-border",
88
- children: O._("Cancel")
70
+ className: "ttw:p-2 ttw:size-9 ttw:border-none ttw:bg-muted",
71
+ children: /* @__PURE__ */ A(E, {})
89
72
  })
90
- }), /* @__PURE__ */ x(r, {
91
- type: "submit",
92
- form: A,
93
- className: "ttw:flex-1",
94
- title: O._("Complete the form to continue"),
95
- disabled: M || !L,
96
- children: [M && /* @__PURE__ */ b(i, { className: "ttw:border-white ttw:border-t-transparent ttw:size-4" }), O._("Save {type}", { type: I })]
73
+ }), /* @__PURE__ */ A(l, {
74
+ align: "end",
75
+ children: /* @__PURE__ */ j(u, {
76
+ onClick: () => W(!0),
77
+ variant: "destructive",
78
+ children: [/* @__PURE__ */ A(D, {}), R._("Delete product")]
79
+ })
80
+ })] }), /* @__PURE__ */ A(v, {
81
+ className: "ttw:size-9 ttw:bg-muted ttw:p-2 ttw:flex ttw:items-center ttw:justify-center ttw:rounded-md ttw:cursor-pointer",
82
+ children: /* @__PURE__ */ A(O, { className: "ttw:size-4" })
83
+ })]
84
+ })]
85
+ }), K ? /* @__PURE__ */ A("div", {
86
+ className: "ttw:flex ttw:w-full ttw:h-full ttw:items-center ttw:justify-center",
87
+ children: /* @__PURE__ */ A(i, {})
88
+ }) : /* @__PURE__ */ A("main", {
89
+ className: "ttw:p-6 ttw:overflow-auto ttw:flex ttw:flex-col ttw:gap-4",
90
+ children: /* @__PURE__ */ j("div", {
91
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
92
+ children: [/* @__PURE__ */ j("div", {
93
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
94
+ children: [/* @__PURE__ */ j("div", {
95
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
96
+ children: [/* @__PURE__ */ A(f, {
97
+ variant: "body1",
98
+ className: "ttw:font-medium",
99
+ children: R._("{type} details", { type: J ? "Product" : "Service" })
100
+ }), /* @__PURE__ */ A(f, {
101
+ variant: "body2",
102
+ color: "muted",
103
+ children: J ? R._("A physical or digital item") : R._("Work or labor you provide")
104
+ })]
105
+ }), !V && Z && /* @__PURE__ */ A(r, {
106
+ type: "button",
107
+ variant: "ghost",
108
+ className: "ttw:text-primary ttw:hover:text-primary",
109
+ onClick: () => H(!0),
110
+ children: R._("Edit")
111
+ })]
112
+ }), V && G ? /* @__PURE__ */ A(C, {
113
+ product: G,
114
+ handleClose: () => H(!1),
115
+ onUpdate: (e) => {
116
+ F?.(e), H(!1);
117
+ }
118
+ }) : /* @__PURE__ */ j("ul", {
119
+ className: "ttw:list-none",
120
+ children: [
121
+ /* @__PURE__ */ A(w, {
122
+ label: R._("{type} name", { type: J ? "Product" : "Service" }),
123
+ value: G?.name ?? "-"
124
+ }),
125
+ /* @__PURE__ */ A(w, {
126
+ label: R._("Price per unit"),
127
+ value: G?.price ? B(G.price.value, G.price.currency) : "-"
128
+ }),
129
+ /* @__PURE__ */ A(w, {
130
+ label: R._("Description"),
131
+ value: G?.description || "-",
132
+ isLast: !0
133
+ })
134
+ ]
97
135
  })]
98
136
  })
99
- ]
137
+ })]
138
+ })
139
+ }), o && U && /* @__PURE__ */ A(g, {
140
+ id: o,
141
+ open: U,
142
+ onClose: () => W(!1),
143
+ onDeleted: (e) => {
144
+ P?.(), I?.(e), W(!1);
145
+ }
146
+ })] }) : /* @__PURE__ */ A(_, {
147
+ open: N,
148
+ onOpenChange: P,
149
+ children: /* @__PURE__ */ A(y, {
150
+ showCloseButton: !0,
151
+ className: "ttw:gap-0",
152
+ children: /* @__PURE__ */ A("div", {
153
+ className: "ttw:w-3/4 ttw:m-auto ttw:p-4",
154
+ children: /* @__PURE__ */ A(p, {})
155
+ })
100
156
  })
101
157
  });
102
158
  };
103
159
  //#endregion
104
- export { E as CreateProduct };
160
+ export { N as ProductDetails };