autumn-js 0.1.61 → 0.1.62

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 (72) hide show
  1. package/dist/libraries/backend/better-auth.js +3 -2
  2. package/dist/libraries/backend/better-auth.mjs +6 -5
  3. package/dist/libraries/backend/convex.mjs +3 -3
  4. package/dist/libraries/backend/elysia.mjs +3 -3
  5. package/dist/libraries/backend/express.mjs +3 -3
  6. package/dist/libraries/backend/fastify.mjs +3 -3
  7. package/dist/libraries/backend/hono.mjs +3 -3
  8. package/dist/libraries/backend/index.mjs +3 -3
  9. package/dist/libraries/backend/next.mjs +3 -3
  10. package/dist/libraries/backend/react-router.mjs +3 -3
  11. package/dist/libraries/backend/remix_dep.mjs +3 -3
  12. package/dist/libraries/backend/routes/backendRouter.mjs +3 -3
  13. package/dist/libraries/backend/supabase.mjs +3 -3
  14. package/dist/libraries/backend/tanstack.mjs +3 -3
  15. package/dist/libraries/react/AutumnContext.mjs +4 -4
  16. package/dist/libraries/react/BaseAutumnProvider.mjs +6 -6
  17. package/dist/libraries/react/ReactAutumnProvider.mjs +7 -7
  18. package/dist/libraries/react/{chunk-7N75YTVM.mjs → chunk-2GEDBGON.mjs} +6 -6
  19. package/dist/libraries/react/{chunk-C3LUB2Q3.mjs → chunk-2LZIBRD4.mjs} +6 -6
  20. package/dist/libraries/react/{chunk-2ZZJUGBO.mjs → chunk-2OHJ6PS6.mjs} +10 -10
  21. package/dist/libraries/react/{chunk-EMHT2HX4.mjs → chunk-47KEC6LH.mjs} +8 -8
  22. package/dist/libraries/react/{chunk-Y626BPVN.mjs → chunk-4KLTPVNG.mjs} +9 -9
  23. package/dist/libraries/react/{chunk-MJF25D7E.mjs → chunk-4QVAJKUF.mjs} +32 -32
  24. package/dist/libraries/react/{chunk-3USIUUS3.mjs → chunk-55YYX6AR.mjs} +1 -1
  25. package/dist/libraries/react/{chunk-36POY2CM.mjs → chunk-5TLRC3ED.mjs} +4 -4
  26. package/dist/libraries/react/{chunk-IDOX5V46.mjs → chunk-6ADAHXOI.mjs} +1 -1
  27. package/dist/libraries/react/{chunk-3MJML3BG.mjs → chunk-7W6MNMN2.mjs} +1 -1
  28. package/dist/libraries/react/{chunk-AAOPTNAA.mjs → chunk-AHB5A4Y2.mjs} +2 -2
  29. package/dist/libraries/react/{chunk-BQ3TB6LH.mjs → chunk-AMBWOUTW.mjs} +452 -454
  30. package/dist/libraries/react/{chunk-ACRIHVEO.mjs → chunk-DXHYWJOY.mjs} +3 -3
  31. package/dist/libraries/react/{chunk-D7DCUX45.mjs → chunk-JCS53EPV.mjs} +1 -1
  32. package/dist/libraries/react/{chunk-IHMQB7NO.mjs → chunk-KHYDU3DA.mjs} +1 -1
  33. package/dist/libraries/react/{chunk-6I5DGTWH.mjs → chunk-QEWVBDWJ.mjs} +2 -2
  34. package/dist/libraries/react/{chunk-WA7QZHL5.mjs → chunk-SWSFJTEQ.mjs} +1 -1
  35. package/dist/libraries/react/{chunk-J3ZAU2WC.mjs → chunk-TLEA6GE7.mjs} +1 -1
  36. package/dist/libraries/react/{chunk-ZPG46FL3.mjs → chunk-TTE2HNTK.mjs} +3 -3
  37. package/dist/libraries/react/{chunk-3XUXFTD4.mjs → chunk-TUZTJYBB.mjs} +1 -1
  38. package/dist/libraries/react/{chunk-MK2IKDCA.mjs → chunk-UNPSUPQQ.mjs} +2 -2
  39. package/dist/libraries/react/{chunk-4YBMXETN.mjs → chunk-UUUCCU2M.mjs} +1 -1
  40. package/dist/libraries/react/{chunk-MYQHICWM.mjs → chunk-VB77RD2S.mjs} +1 -1
  41. package/dist/libraries/react/{chunk-CWQ4UVCS.mjs → chunk-YCHPTRJA.mjs} +13 -13
  42. package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -3
  43. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +68 -68
  44. package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +28 -28
  45. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.js +66 -66
  46. package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +28 -28
  47. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +67 -67
  48. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +28 -28
  49. package/dist/libraries/react/components/ui/accordion.js +23 -23
  50. package/dist/libraries/react/components/ui/accordion.mjs +5 -5
  51. package/dist/libraries/react/components/ui/button.js +3 -3
  52. package/dist/libraries/react/components/ui/button.mjs +2 -2
  53. package/dist/libraries/react/components/ui/dialog.js +49 -49
  54. package/dist/libraries/react/components/ui/dialog.mjs +6 -6
  55. package/dist/libraries/react/components/ui/popover.js +47 -47
  56. package/dist/libraries/react/components/ui/popover.mjs +6 -6
  57. package/dist/libraries/react/components/ui/switch.js +12 -12
  58. package/dist/libraries/react/components/ui/switch.mjs +4 -4
  59. package/dist/libraries/react/hooks/useAggregateEvents.mjs +5 -5
  60. package/dist/libraries/react/hooks/useAnalytics.mjs +5 -5
  61. package/dist/libraries/react/hooks/useCustomer.mjs +6 -6
  62. package/dist/libraries/react/hooks/useCustomerBase.mjs +5 -5
  63. package/dist/libraries/react/hooks/useEntity.mjs +6 -6
  64. package/dist/libraries/react/hooks/useEntityBase.mjs +5 -5
  65. package/dist/libraries/react/hooks/useListEvents.mjs +5 -5
  66. package/dist/libraries/react/hooks/usePaywall.mjs +5 -5
  67. package/dist/libraries/react/hooks/usePricingTable.mjs +5 -5
  68. package/dist/libraries/react/index.js +67 -67
  69. package/dist/libraries/react/index.mjs +67 -67
  70. package/package.json +1 -1
  71. package/dist/libraries/backend/{chunk-E653AL66.mjs → chunk-KKZY2VGU.mjs} +6 -6
  72. package/dist/libraries/react/{chunk-JGDPX6X2.mjs → chunk-FVOKPIQG.mjs} +6 -6
@@ -1,179 +1,490 @@
1
1
  "use client";
2
2
 
3
- import {
4
- getPaywallContent
5
- } from "./chunk-I5ZGIAIX.mjs";
6
3
  import {
7
4
  getCheckoutContent
8
5
  } from "./chunk-BLM4DAAR.mjs";
6
+ import {
7
+ getPaywallContent
8
+ } from "./chunk-I5ZGIAIX.mjs";
9
9
  import {
10
10
  getPricingTableContent
11
11
  } from "./chunk-URQMBRFZ.mjs";
12
- import {
13
- Input
14
- } from "./chunk-GUM4HIGI.mjs";
15
- import {
16
- Popover,
17
- PopoverContent,
18
- PopoverTrigger
19
- } from "./chunk-CWQ4UVCS.mjs";
20
- import {
21
- Switch
22
- } from "./chunk-C3LUB2Q3.mjs";
23
- import {
24
- loadingStyles,
25
- spinnerStyles
26
- } from "./chunk-WVKYZYFT.mjs";
27
12
  import {
28
13
  Accordion,
29
14
  AccordionContent,
30
15
  AccordionItem,
31
16
  Header,
32
17
  Trigger2
33
- } from "./chunk-Y626BPVN.mjs";
18
+ } from "./chunk-4KLTPVNG.mjs";
34
19
  import {
35
20
  Button
36
- } from "./chunk-WA7QZHL5.mjs";
21
+ } from "./chunk-SWSFJTEQ.mjs";
37
22
  import {
38
23
  Dialog,
39
24
  DialogContent,
40
25
  DialogFooter,
41
26
  DialogTitle
42
- } from "./chunk-EMHT2HX4.mjs";
27
+ } from "./chunk-47KEC6LH.mjs";
43
28
  import {
44
29
  ArrowRight,
45
30
  ChevronDown,
46
31
  LoaderCircle
47
- } from "./chunk-2ZZJUGBO.mjs";
32
+ } from "./chunk-2OHJ6PS6.mjs";
48
33
  import {
49
- cn
50
- } from "./chunk-4J6OC4ZQ.mjs";
34
+ Input
35
+ } from "./chunk-GUM4HIGI.mjs";
51
36
  import {
52
- useCustomer
53
- } from "./chunk-MK2IKDCA.mjs";
37
+ Popover,
38
+ PopoverContent,
39
+ PopoverTrigger
40
+ } from "./chunk-YCHPTRJA.mjs";
41
+ import {
42
+ Switch
43
+ } from "./chunk-2LZIBRD4.mjs";
44
+ import {
45
+ loadingStyles,
46
+ spinnerStyles
47
+ } from "./chunk-WVKYZYFT.mjs";
54
48
  import {
55
49
  usePaywall
56
- } from "./chunk-4YBMXETN.mjs";
50
+ } from "./chunk-UUUCCU2M.mjs";
57
51
  import {
58
52
  usePricingTable
59
- } from "./chunk-3USIUUS3.mjs";
53
+ } from "./chunk-55YYX6AR.mjs";
54
+ import {
55
+ cn
56
+ } from "./chunk-4J6OC4ZQ.mjs";
57
+ import {
58
+ useCustomer
59
+ } from "./chunk-UNPSUPQQ.mjs";
60
60
 
61
61
  // src/libraries/react/components/checkout-dialog/checkout-dialog-synced.tsx
62
- import { useEffect, useState as useState2 } from "react";
63
-
64
- // src/libraries/react/components/paywall-dialog/paywall-dialog-synced.tsx
62
+ import { useEffect, useState } from "react";
65
63
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
66
- function PaywallDialog(params) {
67
- const { data: preview } = usePaywall({
68
- featureId: params?.featureId,
69
- entityId: params?.entityId
70
- });
71
- if (!params || !preview) {
64
+ var formatCurrency = ({
65
+ amount,
66
+ currency
67
+ }) => {
68
+ return new Intl.NumberFormat("en-US", {
69
+ style: "currency",
70
+ currency
71
+ }).format(amount);
72
+ };
73
+ function CheckoutDialog(params) {
74
+ const { attach } = useCustomer();
75
+ const [checkoutResult, setCheckoutResult] = useState(params?.checkoutResult);
76
+ useEffect(() => {
77
+ if (params.checkoutResult) {
78
+ setCheckoutResult(params.checkoutResult);
79
+ }
80
+ }, [params.checkoutResult]);
81
+ const [loading, setLoading] = useState(false);
82
+ if (!checkoutResult) {
72
83
  return /* @__PURE__ */ jsx(Fragment, {});
73
84
  }
74
85
  const { open, setOpen } = params;
75
- const { title, message } = getPaywallContent(preview);
76
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "au-p-0 au-pt-4 au-gap-0 au-text-foreground au-overflow-hidden au-text-sm", children: [
77
- /* @__PURE__ */ jsx(DialogTitle, { className: cn("au-font-bold au-text-xl au-px-6"), children: title }),
78
- /* @__PURE__ */ jsx("div", { className: "au-px-6 au-my-2", children: message }),
79
- /* @__PURE__ */ jsx(DialogFooter, { className: "au-flex au-flex-col sm:au-flex-row au-justify-between au-gap-x-4 au-py-2 au-mt-4 au-pl-6 au-pr-3 au-bg-secondary au-border-t", children: /* @__PURE__ */ jsx(
86
+ const { title, message } = getCheckoutContent(checkoutResult);
87
+ const isFree = checkoutResult?.product.properties?.is_free;
88
+ const isPaid = isFree === false;
89
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "au-p-0 au-pt-4 au-gap-0 au-text-foreground au-text-sm", children: [
90
+ /* @__PURE__ */ jsx(DialogTitle, { className: "au-px-6 au-mb-1", children: title }),
91
+ /* @__PURE__ */ jsx("div", { className: "au-px-6 au-mt-1 au-mb-4 au-text-muted-foreground", children: message }),
92
+ isPaid && checkoutResult && /* @__PURE__ */ jsx(
93
+ PriceInformation,
94
+ {
95
+ checkoutResult,
96
+ setCheckoutResult
97
+ }
98
+ ),
99
+ /* @__PURE__ */ jsx(DialogFooter, { className: "au-flex au-flex-col sm:au-flex-row au-justify-between au-gap-x-4 au-py-2 au-pl-6 au-pr-3 au-bg-secondary au-border-t au-shadow-inner", children: /* @__PURE__ */ jsx(
80
100
  Button,
81
101
  {
82
102
  size: "sm",
83
- className: "au-font-medium au-shadow au-transition au-min-w-20",
84
103
  onClick: async () => {
104
+ setLoading(true);
105
+ const options = checkoutResult.options.map((option) => {
106
+ return {
107
+ featureId: option.feature_id,
108
+ quantity: option.quantity
109
+ };
110
+ });
111
+ await attach({
112
+ productId: checkoutResult.product.id,
113
+ ...params.checkoutParams || {},
114
+ options
115
+ });
85
116
  setOpen(false);
117
+ setLoading(false);
86
118
  },
87
- children: "Confirm"
119
+ disabled: loading,
120
+ className: "au-min-w-16 au-flex au-items-center au-gap-2",
121
+ children: loading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "au-w-4 au-h-4 au-animate-spin" }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("span", { className: "au-whitespace-nowrap au-flex au-gap-1", children: "Confirm" }) })
88
122
  }
89
123
  ) })
90
124
  ] }) });
91
125
  }
92
-
93
- // src/libraries/react/components/pricing-table/pricing-table-synced.tsx
94
- import React from "react";
95
- import { createContext, useContext, useState } from "react";
96
- import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
97
- function PricingTable({
98
- productDetails,
99
- checkoutParams
126
+ function PriceInformation({
127
+ checkoutResult,
128
+ setCheckoutResult
100
129
  }) {
101
- const { customer, checkout } = useCustomer({ errorOnNotFound: false });
102
- const [isAnnual, setIsAnnual] = useState(false);
103
- const { products, isLoading, error } = usePricingTable({ productDetails });
104
- if (isLoading) {
105
- return /* @__PURE__ */ jsx2("div", { style: loadingStyles, children: /* @__PURE__ */ jsx2(LoaderCircle, { style: spinnerStyles }) });
106
- }
107
- if (error) {
108
- return /* @__PURE__ */ jsx2("div", { children: " Something went wrong..." });
109
- }
110
- const intervals = Array.from(
111
- new Set(
112
- products?.map((p) => p.properties?.interval_group).filter((i) => !!i)
113
- )
130
+ return /* @__PURE__ */ jsxs("div", { className: "au-px-6 au-mb-4 au-flex au-flex-col au-gap-4", children: [
131
+ /* @__PURE__ */ jsx(
132
+ ProductItems,
133
+ {
134
+ checkoutResult,
135
+ setCheckoutResult
136
+ }
137
+ ),
138
+ /* @__PURE__ */ jsxs("div", { className: "au-flex au-flex-col au-gap-2", children: [
139
+ checkoutResult?.has_prorations && checkoutResult.lines.length > 0 && /* @__PURE__ */ jsx(CheckoutLines, { checkoutResult }),
140
+ /* @__PURE__ */ jsx(DueAmounts, { checkoutResult })
141
+ ] })
142
+ ] });
143
+ }
144
+ function DueAmounts({ checkoutResult }) {
145
+ const { next_cycle, product } = checkoutResult;
146
+ const nextCycleAtStr = next_cycle ? new Date(next_cycle.starts_at).toLocaleDateString() : void 0;
147
+ const hasUsagePrice = product.items.some(
148
+ (item) => item.usage_model === "pay_per_use"
114
149
  );
115
- const multiInterval = intervals.length > 1;
116
- const intervalFilter = (product) => {
117
- if (!product.properties?.interval_group) {
118
- return true;
119
- }
120
- if (multiInterval) {
121
- if (isAnnual) {
122
- return product.properties?.interval_group === "year";
123
- } else {
124
- return product.properties?.interval_group === "month";
150
+ const showNextCycle = next_cycle && next_cycle.total !== checkoutResult.total;
151
+ return /* @__PURE__ */ jsxs("div", { className: "au-flex au-flex-col au-gap-1", children: [
152
+ /* @__PURE__ */ jsxs("div", { className: "au-flex au-justify-between", children: [
153
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "au-font-medium au-text-md", children: "Total due today" }) }),
154
+ /* @__PURE__ */ jsx("p", { className: "au-font-medium au-text-md", children: formatCurrency({
155
+ amount: checkoutResult?.total,
156
+ currency: checkoutResult?.currency
157
+ }) })
158
+ ] }),
159
+ showNextCycle && /* @__PURE__ */ jsxs("div", { className: "au-flex au-justify-between au-text-muted-foreground", children: [
160
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("p", { className: "au-text-md", children: [
161
+ "Due next cycle (",
162
+ nextCycleAtStr,
163
+ ")"
164
+ ] }) }),
165
+ /* @__PURE__ */ jsxs("p", { className: "au-text-md", children: [
166
+ formatCurrency({
167
+ amount: next_cycle.total,
168
+ currency: checkoutResult?.currency
169
+ }),
170
+ hasUsagePrice && /* @__PURE__ */ jsx("span", { children: " + usage prices" })
171
+ ] })
172
+ ] })
173
+ ] });
174
+ }
175
+ function ProductItems({
176
+ checkoutResult,
177
+ setCheckoutResult
178
+ }) {
179
+ const isUpdateQuantity = checkoutResult?.product.scenario === "active" && checkoutResult.product.properties.updateable;
180
+ const isOneOff = checkoutResult?.product.properties.is_one_off;
181
+ return /* @__PURE__ */ jsxs("div", { className: "au-flex au-flex-col au-gap-2", children: [
182
+ /* @__PURE__ */ jsx("p", { className: "au-text-sm au-font-medium", children: "Price" }),
183
+ checkoutResult?.product.items.filter((item) => item.type !== "feature").map((item, index) => {
184
+ if (item.usage_model == "prepaid") {
185
+ return /* @__PURE__ */ jsx(
186
+ PrepaidItem,
187
+ {
188
+ item,
189
+ checkoutResult,
190
+ setCheckoutResult
191
+ },
192
+ index
193
+ );
125
194
  }
126
- }
127
- return true;
128
- };
129
- return /* @__PURE__ */ jsx2("div", { className: cn("au-root"), children: products && /* @__PURE__ */ jsx2(
130
- PricingTableContainer,
131
- {
132
- products,
133
- isAnnualToggle: isAnnual,
134
- setIsAnnualToggle: setIsAnnual,
135
- multiInterval,
136
- children: products.filter(intervalFilter).map((product, index) => /* @__PURE__ */ jsx2(
137
- PricingCard,
195
+ if (isUpdateQuantity) {
196
+ return null;
197
+ }
198
+ return /* @__PURE__ */ jsxs("div", { className: "au-flex au-justify-between", children: [
199
+ /* @__PURE__ */ jsx("p", { className: "au-text-muted-foreground", children: item.feature ? item.feature.name : isOneOff ? "Price" : "Subscription" }),
200
+ /* @__PURE__ */ jsxs("p", { children: [
201
+ item.display?.primary_text,
202
+ " ",
203
+ item.display?.secondary_text
204
+ ] })
205
+ ] }, index);
206
+ })
207
+ ] });
208
+ }
209
+ function CheckoutLines({ checkoutResult }) {
210
+ return /* @__PURE__ */ jsx(Accordion, { type: "single", collapsible: true, children: /* @__PURE__ */ jsxs(AccordionItem, { value: "total", className: "au-border-b-0", children: [
211
+ /* @__PURE__ */ jsx(CustomAccordionTrigger, { className: "au-justify-between au-w-full au-my-0 au-py-0 au-border-none", children: /* @__PURE__ */ jsxs("div", { className: "au-cursor-pointer au-flex au-items-center au-gap-1 au-w-full au-justify-end", children: [
212
+ /* @__PURE__ */ jsx("p", { className: "au-font-light au-text-muted-foreground", children: "View details" }),
213
+ /* @__PURE__ */ jsx(
214
+ ChevronDown,
138
215
  {
139
- productId: product.id,
140
- buttonProps: {
141
- disabled: product.scenario === "active" && !product.properties.updateable || product.scenario === "scheduled",
142
- onClick: async () => {
143
- if (product.id && customer) {
144
- await checkout({
145
- ...checkoutParams,
146
- productId: product.id,
147
- dialog: CheckoutDialog
148
- });
149
- } else if (product.display?.button_url) {
150
- window.open(product.display?.button_url, "_blank");
151
- }
152
- }
153
- }
154
- },
155
- index
156
- ))
216
+ className: "au-text-muted-foreground au-mt-0.5 au-rotate-90 au-transition-transform au-duration-200 au-ease-in-out",
217
+ size: 14
218
+ }
219
+ )
220
+ ] }) }),
221
+ /* @__PURE__ */ jsx(AccordionContent, { className: "au-mt-2 au-mb-0 au-pb-2 au-flex au-flex-col au-gap-2", children: checkoutResult?.lines.filter((line) => line.amount !== 0).map((line, index) => {
222
+ return /* @__PURE__ */ jsxs("div", { className: "au-flex au-justify-between", children: [
223
+ /* @__PURE__ */ jsx("p", { className: "au-text-muted-foreground", children: line.description }),
224
+ /* @__PURE__ */ jsx("p", { className: "au-text-muted-foreground", children: new Intl.NumberFormat("en-US", {
225
+ style: "currency",
226
+ currency: checkoutResult?.currency
227
+ }).format(line.amount) })
228
+ ] }, index);
229
+ }) })
230
+ ] }) });
231
+ }
232
+ function CustomAccordionTrigger({
233
+ className,
234
+ children,
235
+ ...props
236
+ }) {
237
+ return /* @__PURE__ */ jsx(Header, { className: "au-flex", children: /* @__PURE__ */ jsx(
238
+ Trigger2,
239
+ {
240
+ "data-slot": "accordion-trigger",
241
+ className: cn(
242
+ "focus-visible:au-border-ring focus-visible:au-ring-ring/50 au-flex au-flex-1 au-items-start au-justify-between au-gap-4 au-rounded-md au-py-4 au-text-left au-text-sm au-font-medium au-transition-all au-outline-none focus-visible:au-ring-[3px] disabled:au-pointer-events-none disabled:au-opacity-50 [&[data-state=open]_svg]:au-rotate-0",
243
+ className
244
+ ),
245
+ ...props,
246
+ children
157
247
  }
158
248
  ) });
159
249
  }
160
- var PricingTableContext = createContext({
161
- isAnnualToggle: false,
162
- setIsAnnualToggle: () => {
163
- },
164
- products: [],
165
- showFeatures: true
166
- });
167
- var usePricingTableContext = (componentName) => {
168
- const context = useContext(PricingTableContext);
169
- if (context === void 0) {
170
- throw new Error(`${componentName} must be used within <PricingTable />`);
171
- }
172
- return context;
173
- };
174
- var PricingTableContainer = ({
175
- children,
176
- products,
250
+ var PrepaidItem = ({
251
+ item,
252
+ checkoutResult,
253
+ setCheckoutResult
254
+ }) => {
255
+ const { quantity = 0, billing_units: billingUnits = 1 } = item;
256
+ const [quantityInput, setQuantityInput] = useState(
257
+ (quantity / billingUnits).toString()
258
+ );
259
+ const { checkout } = useCustomer();
260
+ const [loading, setLoading] = useState(false);
261
+ const [open, setOpen] = useState(false);
262
+ const scenario = checkoutResult.product.scenario;
263
+ const handleSave = async () => {
264
+ setLoading(true);
265
+ try {
266
+ const newOptions = checkoutResult.options.filter((option) => option.feature_id !== item.feature_id).map((option) => {
267
+ return {
268
+ featureId: option.feature_id,
269
+ quantity: option.quantity
270
+ };
271
+ });
272
+ newOptions.push({
273
+ featureId: item.feature_id,
274
+ quantity: Number(quantityInput) * billingUnits
275
+ });
276
+ const { data, error } = await checkout({
277
+ productId: checkoutResult.product.id,
278
+ options: newOptions,
279
+ dialog: CheckoutDialog
280
+ });
281
+ if (error) {
282
+ console.error(error);
283
+ return;
284
+ }
285
+ setCheckoutResult(data);
286
+ } catch (error) {
287
+ console.error(error);
288
+ } finally {
289
+ setLoading(false);
290
+ setOpen(false);
291
+ }
292
+ };
293
+ const disableSelection = scenario === "renew";
294
+ return /* @__PURE__ */ jsxs("div", { className: "au-flex au-justify-between au-gap-2", children: [
295
+ /* @__PURE__ */ jsxs("div", { className: "au-flex au-gap-2 au-items-start", children: [
296
+ /* @__PURE__ */ jsx("p", { className: "au-text-muted-foreground au-whitespace-nowrap", children: item.feature?.name }),
297
+ /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
298
+ /* @__PURE__ */ jsxs(
299
+ PopoverTrigger,
300
+ {
301
+ className: cn(
302
+ "au-text-muted-foreground au-text-xs au-px-1 au-py-0.5 au-rounded-md au-flex au-items-center au-gap-1 au-bg-accent/80 au-shrink-0",
303
+ disableSelection !== true && "hover:au-bg-accent hover:au-text-foreground",
304
+ disableSelection && "au-pointer-events-none au-opacity-80 au-cursor-not-allowed"
305
+ ),
306
+ disabled: disableSelection,
307
+ children: [
308
+ "Qty: ",
309
+ quantity,
310
+ !disableSelection && /* @__PURE__ */ jsx(ChevronDown, { size: 12 })
311
+ ]
312
+ }
313
+ ),
314
+ /* @__PURE__ */ jsxs(
315
+ PopoverContent,
316
+ {
317
+ align: "start",
318
+ className: "au-w-80 au-text-sm au-p-4 au-pt-3 au-flex au-flex-col au-gap-4",
319
+ children: [
320
+ /* @__PURE__ */ jsxs("div", { className: "au-flex au-flex-col au-gap-1", children: [
321
+ /* @__PURE__ */ jsx("p", { className: "au-text-sm au-font-medium", children: item.feature?.name }),
322
+ /* @__PURE__ */ jsxs("p", { className: "au-text-muted-foreground", children: [
323
+ item.display?.primary_text,
324
+ " ",
325
+ item.display?.secondary_text
326
+ ] })
327
+ ] }),
328
+ /* @__PURE__ */ jsxs("div", { className: "au-flex au-justify-between au-items-end", children: [
329
+ /* @__PURE__ */ jsxs("div", { className: "au-flex au-gap-2 au-items-center", children: [
330
+ /* @__PURE__ */ jsx(
331
+ Input,
332
+ {
333
+ className: "au-h-7 au-w-16 focus:!au-ring-2",
334
+ value: quantityInput,
335
+ onChange: (e) => setQuantityInput(e.target.value)
336
+ }
337
+ ),
338
+ /* @__PURE__ */ jsxs("p", { className: "au-text-muted-foreground", children: [
339
+ billingUnits > 1 && `x ${billingUnits} `,
340
+ item.feature?.name
341
+ ] })
342
+ ] }),
343
+ /* @__PURE__ */ jsx(
344
+ Button,
345
+ {
346
+ onClick: handleSave,
347
+ className: "au-w-14 !au-h-7 au-text-sm au-items-center au-bg-white au-text-foreground au-shadow-sm au-border au-border-zinc-200 hover:au-bg-zinc-100",
348
+ disabled: loading,
349
+ children: loading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "au-text-muted-foreground au-animate-spin !au-w-4 !au-h-4" }) : "Save"
350
+ }
351
+ )
352
+ ] })
353
+ ]
354
+ }
355
+ )
356
+ ] })
357
+ ] }),
358
+ /* @__PURE__ */ jsxs("p", { className: "au-text-end", children: [
359
+ item.display?.primary_text,
360
+ " ",
361
+ item.display?.secondary_text
362
+ ] })
363
+ ] });
364
+ };
365
+ var PriceItem = ({
366
+ children,
367
+ className,
368
+ ...props
369
+ }) => {
370
+ return /* @__PURE__ */ jsx(
371
+ "div",
372
+ {
373
+ className: cn(
374
+ "au-flex au-flex-col au-pb-4 sm:au-pb-0 au-gap-1 sm:au-flex-row au-justify-between sm:au-h-7 sm:au-gap-2 sm:au-items-center",
375
+ className
376
+ ),
377
+ ...props,
378
+ children
379
+ }
380
+ );
381
+ };
382
+ var PricingDialogButton = ({
383
+ children,
384
+ size,
385
+ onClick,
386
+ disabled,
387
+ className
388
+ }) => {
389
+ return /* @__PURE__ */ jsxs(
390
+ Button,
391
+ {
392
+ onClick,
393
+ disabled,
394
+ size,
395
+ className: cn(className, "au-shadow-sm au-shadow-stone-400"),
396
+ children: [
397
+ children,
398
+ /* @__PURE__ */ jsx(ArrowRight, { className: "!au-h-3" })
399
+ ]
400
+ }
401
+ );
402
+ };
403
+
404
+ // src/libraries/react/components/pricing-table/pricing-table-synced.tsx
405
+ import React from "react";
406
+ import { createContext, useContext, useState as useState2 } from "react";
407
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
408
+ function PricingTable({
409
+ productDetails,
410
+ checkoutParams
411
+ }) {
412
+ const { customer, checkout } = useCustomer({ errorOnNotFound: false });
413
+ const [isAnnual, setIsAnnual] = useState2(false);
414
+ const { products, isLoading, error } = usePricingTable({ productDetails });
415
+ if (isLoading) {
416
+ return /* @__PURE__ */ jsx2("div", { style: loadingStyles, children: /* @__PURE__ */ jsx2(LoaderCircle, { style: spinnerStyles }) });
417
+ }
418
+ if (error) {
419
+ return /* @__PURE__ */ jsx2("div", { children: " Something went wrong..." });
420
+ }
421
+ const intervals = Array.from(
422
+ new Set(
423
+ products?.map((p) => p.properties?.interval_group).filter((i) => !!i)
424
+ )
425
+ );
426
+ const multiInterval = intervals.length > 1;
427
+ const intervalFilter = (product) => {
428
+ if (!product.properties?.interval_group) {
429
+ return true;
430
+ }
431
+ if (multiInterval) {
432
+ if (isAnnual) {
433
+ return product.properties?.interval_group === "year";
434
+ } else {
435
+ return product.properties?.interval_group === "month";
436
+ }
437
+ }
438
+ return true;
439
+ };
440
+ return /* @__PURE__ */ jsx2("div", { className: cn("au-root"), children: products && /* @__PURE__ */ jsx2(
441
+ PricingTableContainer,
442
+ {
443
+ products,
444
+ isAnnualToggle: isAnnual,
445
+ setIsAnnualToggle: setIsAnnual,
446
+ multiInterval,
447
+ children: products.filter(intervalFilter).map((product, index) => /* @__PURE__ */ jsx2(
448
+ PricingCard,
449
+ {
450
+ productId: product.id,
451
+ buttonProps: {
452
+ disabled: product.scenario === "active" && !product.properties.updateable || product.scenario === "scheduled",
453
+ onClick: async () => {
454
+ if (product.id && customer) {
455
+ await checkout({
456
+ ...checkoutParams,
457
+ productId: product.id,
458
+ dialog: CheckoutDialog
459
+ });
460
+ } else if (product.display?.button_url) {
461
+ window.open(product.display?.button_url, "_blank");
462
+ }
463
+ }
464
+ }
465
+ },
466
+ index
467
+ ))
468
+ }
469
+ ) });
470
+ }
471
+ var PricingTableContext = createContext({
472
+ isAnnualToggle: false,
473
+ setIsAnnualToggle: () => {
474
+ },
475
+ products: [],
476
+ showFeatures: true
477
+ });
478
+ var usePricingTableContext = (componentName) => {
479
+ const context = useContext(PricingTableContext);
480
+ if (context === void 0) {
481
+ throw new Error(`${componentName} must be used within <PricingTable />`);
482
+ }
483
+ return context;
484
+ };
485
+ var PricingTableContainer = ({
486
+ children,
487
+ products,
177
488
  showFeatures = true,
178
489
  className,
179
490
  isAnnualToggle,
@@ -331,7 +642,7 @@ var PricingFeatureList = ({
331
642
  ] });
332
643
  };
333
644
  var PricingCardButton = React.forwardRef(({ recommended, children, className, onClick, ...props }, ref) => {
334
- const [loading, setLoading] = useState(false);
645
+ const [loading, setLoading] = useState2(false);
335
646
  const handleClick = async (e) => {
336
647
  setLoading(true);
337
648
  try {
@@ -389,352 +700,37 @@ var RecommendedBadge = ({ recommended }) => {
389
700
  return /* @__PURE__ */ jsx2("div", { className: "au-bg-secondary au-absolute au-border au-text-muted-foreground au-text-sm au-font-medium lg:au-rounded-full au-px-3 lg:au-py-0.5 lg:au-top-4 lg:au-right-4 au-top-[-1px] au-right-[-1px] au-rounded-bl-lg", children: recommended });
390
701
  };
391
702
 
392
- // src/libraries/react/components/checkout-dialog/checkout-dialog-synced.tsx
703
+ // src/libraries/react/components/paywall-dialog/paywall-dialog-synced.tsx
393
704
  import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
394
- var formatCurrency = ({
395
- amount,
396
- currency
397
- }) => {
398
- return new Intl.NumberFormat("en-US", {
399
- style: "currency",
400
- currency
401
- }).format(amount);
402
- };
403
- function CheckoutDialog(params) {
404
- const { attach } = useCustomer();
405
- const [checkoutResult, setCheckoutResult] = useState2(params?.checkoutResult);
406
- useEffect(() => {
407
- if (params.checkoutResult) {
408
- setCheckoutResult(params.checkoutResult);
409
- }
410
- }, [params.checkoutResult]);
411
- const [loading, setLoading] = useState2(false);
412
- if (!checkoutResult) {
705
+ function PaywallDialog(params) {
706
+ const { data: preview } = usePaywall({
707
+ featureId: params?.featureId,
708
+ entityId: params?.entityId
709
+ });
710
+ if (!params || !preview) {
413
711
  return /* @__PURE__ */ jsx3(Fragment3, {});
414
712
  }
415
713
  const { open, setOpen } = params;
416
- const { title, message } = getCheckoutContent(checkoutResult);
417
- const isFree = checkoutResult?.product.properties?.is_free;
418
- const isPaid = isFree === false;
419
- return /* @__PURE__ */ jsx3(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs3(DialogContent, { className: "au-p-0 au-pt-4 au-gap-0 au-text-foreground au-text-sm", children: [
420
- /* @__PURE__ */ jsx3(DialogTitle, { className: "au-px-6 au-mb-1", children: title }),
421
- /* @__PURE__ */ jsx3("div", { className: "au-px-6 au-mt-1 au-mb-4 au-text-muted-foreground", children: message }),
422
- isPaid && checkoutResult && /* @__PURE__ */ jsx3(
423
- PriceInformation,
424
- {
425
- checkoutResult,
426
- setCheckoutResult
427
- }
428
- ),
429
- /* @__PURE__ */ jsx3(DialogFooter, { className: "au-flex au-flex-col sm:au-flex-row au-justify-between au-gap-x-4 au-py-2 au-pl-6 au-pr-3 au-bg-secondary au-border-t au-shadow-inner", children: /* @__PURE__ */ jsx3(
714
+ const { title, message } = getPaywallContent(preview);
715
+ return /* @__PURE__ */ jsx3(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs3(DialogContent, { className: "au-p-0 au-pt-4 au-gap-0 au-text-foreground au-overflow-hidden au-text-sm", children: [
716
+ /* @__PURE__ */ jsx3(DialogTitle, { className: cn("au-font-bold au-text-xl au-px-6"), children: title }),
717
+ /* @__PURE__ */ jsx3("div", { className: "au-px-6 au-my-2", children: message }),
718
+ /* @__PURE__ */ jsx3(DialogFooter, { className: "au-flex au-flex-col sm:au-flex-row au-justify-between au-gap-x-4 au-py-2 au-mt-4 au-pl-6 au-pr-3 au-bg-secondary au-border-t", children: /* @__PURE__ */ jsx3(
430
719
  Button,
431
720
  {
432
721
  size: "sm",
722
+ className: "au-font-medium au-shadow au-transition au-min-w-20",
433
723
  onClick: async () => {
434
- setLoading(true);
435
- const options = checkoutResult.options.map((option) => {
436
- return {
437
- featureId: option.feature_id,
438
- quantity: option.quantity
439
- };
440
- });
441
- await attach({
442
- productId: checkoutResult.product.id,
443
- ...params.checkoutParams || {},
444
- options
445
- });
446
724
  setOpen(false);
447
- setLoading(false);
448
725
  },
449
- disabled: loading,
450
- className: "au-min-w-16 au-flex au-items-center au-gap-2",
451
- children: loading ? /* @__PURE__ */ jsx3(LoaderCircle, { className: "au-w-4 au-h-4 au-animate-spin" }) : /* @__PURE__ */ jsx3(Fragment3, { children: /* @__PURE__ */ jsx3("span", { className: "au-whitespace-nowrap au-flex au-gap-1", children: "Confirm" }) })
726
+ children: "Confirm"
452
727
  }
453
728
  ) })
454
729
  ] }) });
455
730
  }
456
- function PriceInformation({
457
- checkoutResult,
458
- setCheckoutResult
459
- }) {
460
- return /* @__PURE__ */ jsxs3("div", { className: "au-px-6 au-mb-4 au-flex au-flex-col au-gap-4", children: [
461
- /* @__PURE__ */ jsx3(
462
- ProductItems,
463
- {
464
- checkoutResult,
465
- setCheckoutResult
466
- }
467
- ),
468
- /* @__PURE__ */ jsxs3("div", { className: "au-flex au-flex-col au-gap-2", children: [
469
- checkoutResult?.has_prorations && checkoutResult.lines.length > 0 && /* @__PURE__ */ jsx3(CheckoutLines, { checkoutResult }),
470
- /* @__PURE__ */ jsx3(DueAmounts, { checkoutResult })
471
- ] })
472
- ] });
473
- }
474
- function DueAmounts({ checkoutResult }) {
475
- const { next_cycle, product } = checkoutResult;
476
- const nextCycleAtStr = next_cycle ? new Date(next_cycle.starts_at).toLocaleDateString() : void 0;
477
- const hasUsagePrice = product.items.some(
478
- (item) => item.usage_model === "pay_per_use"
479
- );
480
- const showNextCycle = next_cycle && next_cycle.total !== checkoutResult.total;
481
- return /* @__PURE__ */ jsxs3("div", { className: "au-flex au-flex-col au-gap-1", children: [
482
- /* @__PURE__ */ jsxs3("div", { className: "au-flex au-justify-between", children: [
483
- /* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsx3("p", { className: "au-font-medium au-text-md", children: "Total due today" }) }),
484
- /* @__PURE__ */ jsx3("p", { className: "au-font-medium au-text-md", children: formatCurrency({
485
- amount: checkoutResult?.total,
486
- currency: checkoutResult?.currency
487
- }) })
488
- ] }),
489
- showNextCycle && /* @__PURE__ */ jsxs3("div", { className: "au-flex au-justify-between au-text-muted-foreground", children: [
490
- /* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsxs3("p", { className: "au-text-md", children: [
491
- "Due next cycle (",
492
- nextCycleAtStr,
493
- ")"
494
- ] }) }),
495
- /* @__PURE__ */ jsxs3("p", { className: "au-text-md", children: [
496
- formatCurrency({
497
- amount: next_cycle.total,
498
- currency: checkoutResult?.currency
499
- }),
500
- hasUsagePrice && /* @__PURE__ */ jsx3("span", { children: " + usage prices" })
501
- ] })
502
- ] })
503
- ] });
504
- }
505
- function ProductItems({
506
- checkoutResult,
507
- setCheckoutResult
508
- }) {
509
- const isUpdateQuantity = checkoutResult?.product.scenario === "active" && checkoutResult.product.properties.updateable;
510
- const isOneOff = checkoutResult?.product.properties.is_one_off;
511
- return /* @__PURE__ */ jsxs3("div", { className: "au-flex au-flex-col au-gap-2", children: [
512
- /* @__PURE__ */ jsx3("p", { className: "au-text-sm au-font-medium", children: "Price" }),
513
- checkoutResult?.product.items.filter((item) => item.type !== "feature").map((item, index) => {
514
- if (item.usage_model == "prepaid") {
515
- return /* @__PURE__ */ jsx3(
516
- PrepaidItem,
517
- {
518
- item,
519
- checkoutResult,
520
- setCheckoutResult
521
- },
522
- index
523
- );
524
- }
525
- if (isUpdateQuantity) {
526
- return null;
527
- }
528
- return /* @__PURE__ */ jsxs3("div", { className: "au-flex au-justify-between", children: [
529
- /* @__PURE__ */ jsx3("p", { className: "au-text-muted-foreground", children: item.feature ? item.feature.name : isOneOff ? "Price" : "Subscription" }),
530
- /* @__PURE__ */ jsxs3("p", { children: [
531
- item.display?.primary_text,
532
- " ",
533
- item.display?.secondary_text
534
- ] })
535
- ] }, index);
536
- })
537
- ] });
538
- }
539
- function CheckoutLines({ checkoutResult }) {
540
- return /* @__PURE__ */ jsx3(Accordion, { type: "single", collapsible: true, children: /* @__PURE__ */ jsxs3(AccordionItem, { value: "total", className: "au-border-b-0", children: [
541
- /* @__PURE__ */ jsx3(CustomAccordionTrigger, { className: "au-justify-between au-w-full au-my-0 au-py-0 au-border-none", children: /* @__PURE__ */ jsxs3("div", { className: "au-cursor-pointer au-flex au-items-center au-gap-1 au-w-full au-justify-end", children: [
542
- /* @__PURE__ */ jsx3("p", { className: "au-font-light au-text-muted-foreground", children: "View details" }),
543
- /* @__PURE__ */ jsx3(
544
- ChevronDown,
545
- {
546
- className: "au-text-muted-foreground au-mt-0.5 au-rotate-90 au-transition-transform au-duration-200 au-ease-in-out",
547
- size: 14
548
- }
549
- )
550
- ] }) }),
551
- /* @__PURE__ */ jsx3(AccordionContent, { className: "au-mt-2 au-mb-0 au-pb-2 au-flex au-flex-col au-gap-2", children: checkoutResult?.lines.filter((line) => line.amount !== 0).map((line, index) => {
552
- return /* @__PURE__ */ jsxs3("div", { className: "au-flex au-justify-between", children: [
553
- /* @__PURE__ */ jsx3("p", { className: "au-text-muted-foreground", children: line.description }),
554
- /* @__PURE__ */ jsx3("p", { className: "au-text-muted-foreground", children: new Intl.NumberFormat("en-US", {
555
- style: "currency",
556
- currency: checkoutResult?.currency
557
- }).format(line.amount) })
558
- ] }, index);
559
- }) })
560
- ] }) });
561
- }
562
- function CustomAccordionTrigger({
563
- className,
564
- children,
565
- ...props
566
- }) {
567
- return /* @__PURE__ */ jsx3(Header, { className: "au-flex", children: /* @__PURE__ */ jsx3(
568
- Trigger2,
569
- {
570
- "data-slot": "accordion-trigger",
571
- className: cn(
572
- "focus-visible:au-border-ring focus-visible:au-ring-ring/50 au-flex au-flex-1 au-items-start au-justify-between au-gap-4 au-rounded-md au-py-4 au-text-left au-text-sm au-font-medium au-transition-all au-outline-none focus-visible:au-ring-[3px] disabled:au-pointer-events-none disabled:au-opacity-50 [&[data-state=open]_svg]:au-rotate-0",
573
- className
574
- ),
575
- ...props,
576
- children
577
- }
578
- ) });
579
- }
580
- var PrepaidItem = ({
581
- item,
582
- checkoutResult,
583
- setCheckoutResult
584
- }) => {
585
- const { quantity = 0, billing_units: billingUnits = 1 } = item;
586
- const [quantityInput, setQuantityInput] = useState2(
587
- (quantity / billingUnits).toString()
588
- );
589
- const { checkout } = useCustomer();
590
- const [loading, setLoading] = useState2(false);
591
- const [open, setOpen] = useState2(false);
592
- const scenario = checkoutResult.product.scenario;
593
- const handleSave = async () => {
594
- setLoading(true);
595
- try {
596
- const newOptions = checkoutResult.options.filter((option) => option.feature_id !== item.feature_id).map((option) => {
597
- return {
598
- featureId: option.feature_id,
599
- quantity: option.quantity
600
- };
601
- });
602
- newOptions.push({
603
- featureId: item.feature_id,
604
- quantity: Number(quantityInput) * billingUnits
605
- });
606
- const { data, error } = await checkout({
607
- productId: checkoutResult.product.id,
608
- options: newOptions,
609
- dialog: CheckoutDialog
610
- });
611
- if (error) {
612
- console.error(error);
613
- return;
614
- }
615
- setCheckoutResult(data);
616
- } catch (error) {
617
- console.error(error);
618
- } finally {
619
- setLoading(false);
620
- setOpen(false);
621
- }
622
- };
623
- const disableSelection = scenario === "renew";
624
- return /* @__PURE__ */ jsxs3("div", { className: "au-flex au-justify-between au-gap-2", children: [
625
- /* @__PURE__ */ jsxs3("div", { className: "au-flex au-gap-2 au-items-start", children: [
626
- /* @__PURE__ */ jsx3("p", { className: "au-text-muted-foreground au-whitespace-nowrap", children: item.feature?.name }),
627
- /* @__PURE__ */ jsxs3(Popover, { open, onOpenChange: setOpen, children: [
628
- /* @__PURE__ */ jsxs3(
629
- PopoverTrigger,
630
- {
631
- className: cn(
632
- "au-text-muted-foreground au-text-xs au-px-1 au-py-0.5 au-rounded-md au-flex au-items-center au-gap-1 au-bg-accent/80 au-shrink-0",
633
- disableSelection !== true && "hover:au-bg-accent hover:au-text-foreground",
634
- disableSelection && "au-pointer-events-none au-opacity-80 au-cursor-not-allowed"
635
- ),
636
- disabled: disableSelection,
637
- children: [
638
- "Qty: ",
639
- quantity,
640
- !disableSelection && /* @__PURE__ */ jsx3(ChevronDown, { size: 12 })
641
- ]
642
- }
643
- ),
644
- /* @__PURE__ */ jsxs3(
645
- PopoverContent,
646
- {
647
- align: "start",
648
- className: "au-w-80 au-text-sm au-p-4 au-pt-3 au-flex au-flex-col au-gap-4",
649
- children: [
650
- /* @__PURE__ */ jsxs3("div", { className: "au-flex au-flex-col au-gap-1", children: [
651
- /* @__PURE__ */ jsx3("p", { className: "au-text-sm au-font-medium", children: item.feature?.name }),
652
- /* @__PURE__ */ jsxs3("p", { className: "au-text-muted-foreground", children: [
653
- item.display?.primary_text,
654
- " ",
655
- item.display?.secondary_text
656
- ] })
657
- ] }),
658
- /* @__PURE__ */ jsxs3("div", { className: "au-flex au-justify-between au-items-end", children: [
659
- /* @__PURE__ */ jsxs3("div", { className: "au-flex au-gap-2 au-items-center", children: [
660
- /* @__PURE__ */ jsx3(
661
- Input,
662
- {
663
- className: "au-h-7 au-w-16 focus:!au-ring-2",
664
- value: quantityInput,
665
- onChange: (e) => setQuantityInput(e.target.value)
666
- }
667
- ),
668
- /* @__PURE__ */ jsxs3("p", { className: "au-text-muted-foreground", children: [
669
- billingUnits > 1 && `x ${billingUnits} `,
670
- item.feature?.name
671
- ] })
672
- ] }),
673
- /* @__PURE__ */ jsx3(
674
- Button,
675
- {
676
- onClick: handleSave,
677
- className: "au-w-14 !au-h-7 au-text-sm au-items-center au-bg-white au-text-foreground au-shadow-sm au-border au-border-zinc-200 hover:au-bg-zinc-100",
678
- disabled: loading,
679
- children: loading ? /* @__PURE__ */ jsx3(LoaderCircle, { className: "au-text-muted-foreground au-animate-spin !au-w-4 !au-h-4" }) : "Save"
680
- }
681
- )
682
- ] })
683
- ]
684
- }
685
- )
686
- ] })
687
- ] }),
688
- /* @__PURE__ */ jsxs3("p", { className: "au-text-end", children: [
689
- item.display?.primary_text,
690
- " ",
691
- item.display?.secondary_text
692
- ] })
693
- ] });
694
- };
695
- var PriceItem = ({
696
- children,
697
- className,
698
- ...props
699
- }) => {
700
- return /* @__PURE__ */ jsx3(
701
- "div",
702
- {
703
- className: cn(
704
- "au-flex au-flex-col au-pb-4 sm:au-pb-0 au-gap-1 sm:au-flex-row au-justify-between sm:au-h-7 sm:au-gap-2 sm:au-items-center",
705
- className
706
- ),
707
- ...props,
708
- children
709
- }
710
- );
711
- };
712
- var PricingDialogButton = ({
713
- children,
714
- size,
715
- onClick,
716
- disabled,
717
- className
718
- }) => {
719
- return /* @__PURE__ */ jsxs3(
720
- Button,
721
- {
722
- onClick,
723
- disabled,
724
- size,
725
- className: cn(className, "au-shadow-sm au-shadow-stone-400"),
726
- children: [
727
- children,
728
- /* @__PURE__ */ jsx3(ArrowRight, { className: "!au-h-3" })
729
- ]
730
- }
731
- );
732
- };
733
731
 
734
732
  export {
735
- CheckoutDialog,
736
- PriceItem,
737
- PricingDialogButton,
733
+ PaywallDialog,
738
734
  PricingTable,
739
735
  usePricingTableContext,
740
736
  PricingTableContainer,
@@ -743,5 +739,7 @@ export {
743
739
  PricingCardButton,
744
740
  AnnualSwitch,
745
741
  RecommendedBadge,
746
- PaywallDialog
742
+ CheckoutDialog,
743
+ PriceItem,
744
+ PricingDialogButton
747
745
  };