@drawbridge/components 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/styles.css +68 -355
- package/dist/advertisement.js +15 -20
- package/dist/advertisement.mjs +15 -20
- package/dist/bridge/advertisements.js +4 -2
- package/dist/bridge/advertisements.mjs +5 -3
- package/dist/bridge/fields.js +89 -6
- package/dist/bridge/fields.mjs +89 -7
- package/dist/bridge/form-subdomain-agreement.js +165 -0
- package/dist/bridge/form-subdomain-agreement.mjs +132 -0
- package/dist/bridge/form-subdomain-embed.js +5 -1
- package/dist/bridge/form-subdomain-embed.mjs +5 -1
- package/dist/bridge/form-subdomain-header.js +21 -14
- package/dist/bridge/form-subdomain-header.mjs +20 -14
- package/dist/bridge/form-subdomain-issue.js +17 -8
- package/dist/bridge/form-subdomain-issue.mjs +17 -8
- package/dist/bridge/form-subdomain-missions.js +58 -52
- package/dist/bridge/form-subdomain-missions.mjs +60 -54
- package/dist/bridge/form-subdomain.js +223 -94
- package/dist/bridge/form-subdomain.mjs +222 -96
- package/dist/bridge/lib/entry.js +61 -6
- package/dist/bridge/lib/entry.mjs +51 -5
- package/dist/bridge/lib/order.js +23 -0
- package/dist/bridge/lib/order.mjs +20 -0
- package/dist/bridge/template-layout.js +5 -2
- package/dist/bridge/template-layout.mjs +6 -3
- package/dist/bridge/template-modal.js +82 -15
- package/dist/bridge/template-modal.mjs +83 -16
- package/dist/bridge/template-subdomain-gallery.js +126 -75
- package/dist/bridge/template-subdomain-gallery.mjs +122 -75
- package/dist/bridge/template-subdomain.js +16 -14
- package/dist/bridge/template-subdomain.mjs +17 -15
- package/dist/dashboard/avatar.js +5 -0
- package/dist/dashboard/avatar.mjs +5 -0
- package/dist/dashboard/campaign-form.js +1798 -0
- package/dist/dashboard/campaign-form.mjs +1769 -0
- package/dist/dashboard/card-affiliate.js +3 -2
- package/dist/dashboard/card-affiliate.mjs +3 -2
- package/dist/dashboard/card-campaign-agreement.js +172 -0
- package/dist/dashboard/card-campaign-agreement.mjs +139 -0
- package/dist/dashboard/card-campaign-switch.js +34 -9
- package/dist/dashboard/card-campaign-switch.mjs +32 -8
- package/dist/dashboard/card-order.js +6 -14
- package/dist/dashboard/card-order.mjs +6 -14
- package/dist/dashboard/card-section.js +69 -26
- package/dist/dashboard/card-section.mjs +65 -26
- package/dist/dashboard/card-shortcut.js +181 -0
- package/dist/dashboard/card-shortcut.mjs +152 -0
- package/dist/dashboard/card-tile.js +3 -35
- package/dist/dashboard/card-tile.mjs +3 -34
- package/dist/dashboard/document-blocks.js +305 -0
- package/dist/dashboard/document-blocks.mjs +270 -0
- package/dist/dashboard/drawer-subscription.js +52 -14
- package/dist/dashboard/drawer-subscription.mjs +52 -14
- package/dist/dashboard/drawer.js +20 -3
- package/dist/dashboard/drawer.mjs +21 -4
- package/dist/dashboard/dropdown.js +6 -2
- package/dist/dashboard/dropdown.mjs +6 -2
- package/dist/dashboard/form-admin-subscription-custom.js +72 -8
- package/dist/dashboard/form-admin-subscription-custom.mjs +72 -8
- package/dist/dashboard/form-ai.js +0 -148
- package/dist/dashboard/form-ai.mjs +1 -148
- package/dist/dashboard/form-filters-analytics.js +88 -37
- package/dist/dashboard/form-filters-analytics.mjs +85 -38
- package/dist/dashboard/form-organization-brand.js +30 -13
- package/dist/dashboard/form-organization-brand.mjs +30 -13
- package/dist/dashboard/form-organization-campaign-advertisement.js +38 -112
- package/dist/dashboard/form-organization-campaign-advertisement.mjs +38 -112
- package/dist/dashboard/form-organization-campaign-advertisements.js +374 -0
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +345 -0
- package/dist/dashboard/form-organization-campaign-agreement.js +414 -210
- package/dist/dashboard/form-organization-campaign-agreement.mjs +411 -212
- package/dist/dashboard/form-organization-campaign-design.js +258 -0
- package/dist/dashboard/form-organization-campaign-design.mjs +223 -0
- package/dist/dashboard/form-organization-campaign-field-item.js +585 -0
- package/dist/dashboard/form-organization-campaign-field-item.mjs +552 -0
- package/dist/dashboard/form-organization-campaign-field-number.js +48 -7
- package/dist/dashboard/form-organization-campaign-field-number.mjs +48 -7
- package/dist/dashboard/form-organization-campaign-field-select.js +15 -4
- package/dist/dashboard/form-organization-campaign-field-select.mjs +15 -4
- package/dist/dashboard/form-organization-campaign-field-skill.js +359 -0
- package/dist/dashboard/form-organization-campaign-field-skill.mjs +330 -0
- package/dist/dashboard/form-organization-campaign-field-text.js +46 -6
- package/dist/dashboard/form-organization-campaign-field-text.mjs +46 -6
- package/dist/dashboard/form-organization-campaign-field-textarea.js +22 -13
- package/dist/dashboard/form-organization-campaign-field-textarea.mjs +22 -13
- package/dist/dashboard/form-organization-campaign-footer.js +178 -0
- package/dist/dashboard/form-organization-campaign-footer.mjs +149 -0
- package/dist/dashboard/form-organization-campaign-integration-age.js +2 -35
- package/dist/dashboard/form-organization-campaign-integration-age.mjs +2 -35
- package/dist/dashboard/form-organization-campaign-integration-geocode.js +4 -1
- package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
- package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
- package/dist/dashboard/form-organization-campaign-page-preview.js +1 -2
- package/dist/dashboard/form-organization-campaign-page-preview.mjs +1 -2
- package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
- package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
- package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
- package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
- package/dist/dashboard/form-organization-campaign-page-slug.js +2 -3
- package/dist/dashboard/form-organization-campaign-page-slug.mjs +2 -3
- package/dist/dashboard/form-organization-campaign-page.js +168 -265
- package/dist/dashboard/form-organization-campaign-page.mjs +170 -266
- package/dist/dashboard/form-organization-campaign-section.js +125 -107
- package/dist/dashboard/form-organization-campaign-section.mjs +121 -107
- package/dist/dashboard/form-organization-campaign.js +119 -9
- package/dist/dashboard/form-organization-campaign.mjs +118 -9
- package/dist/dashboard/form-organization-file-frame.js +7 -1
- package/dist/dashboard/form-organization-file-frame.mjs +7 -1
- package/dist/dashboard/form-organization-workflow.js +587 -530
- package/dist/dashboard/form-organization-workflow.mjs +588 -531
- package/dist/dashboard/form-organization.js +22 -0
- package/dist/dashboard/form-organization.mjs +22 -0
- package/dist/dashboard/form-reposition.js +396 -0
- package/dist/dashboard/form-reposition.mjs +359 -0
- package/dist/dashboard/form-support.js +189 -0
- package/dist/dashboard/form-support.mjs +160 -0
- package/dist/dashboard/form-tests.js +683 -0
- package/dist/dashboard/form-tests.mjs +646 -0
- package/dist/dashboard/form-verify-prize.js +114 -34
- package/dist/dashboard/form-verify-prize.mjs +111 -34
- package/dist/dashboard/google.js +8 -1
- package/dist/dashboard/google.mjs +8 -1
- package/dist/dashboard/input-array.js +2 -0
- package/dist/dashboard/input-array.mjs +2 -0
- package/dist/dashboard/input-editor.js +17 -6
- package/dist/dashboard/input-editor.mjs +17 -6
- package/dist/dashboard/input-fields.js +287 -437
- package/dist/dashboard/input-fields.mjs +287 -436
- package/dist/dashboard/input-file.js +70 -2
- package/dist/dashboard/input-file.mjs +70 -2
- package/dist/dashboard/input-font.js +64 -55
- package/dist/dashboard/input-font.mjs +64 -55
- package/dist/dashboard/input-resource.js +4 -1
- package/dist/dashboard/input-resource.mjs +4 -1
- package/dist/dashboard/lib/ab-tests.js +130 -0
- package/dist/dashboard/lib/ab-tests.mjs +94 -0
- package/dist/dashboard/lib/features.js +1 -1
- package/dist/dashboard/lib/features.mjs +1 -1
- package/dist/dashboard/lib/focus.js +93 -0
- package/dist/dashboard/lib/focus.mjs +69 -0
- package/dist/dashboard/lib/form-page.js +203 -0
- package/dist/dashboard/lib/form-page.mjs +155 -0
- package/dist/dashboard/lib/item-list.js +0 -15
- package/dist/dashboard/lib/item-list.mjs +0 -14
- package/dist/dashboard/lib/rail.js +16 -17
- package/dist/dashboard/lib/rail.mjs +15 -16
- package/dist/dashboard/lib/sms.js +8 -2
- package/dist/dashboard/lib/sms.mjs +6 -1
- package/dist/dashboard/list-resource.js +2 -0
- package/dist/dashboard/list-resource.mjs +2 -0
- package/dist/dashboard/menu.js +54 -5
- package/dist/dashboard/menu.mjs +53 -5
- package/dist/dashboard/modal.js +19 -4
- package/dist/dashboard/modal.mjs +20 -5
- package/dist/dashboard/order-sections.js +4 -0
- package/dist/dashboard/order-sections.mjs +4 -0
- package/dist/dashboard/preview.js +838 -324
- package/dist/dashboard/preview.mjs +826 -324
- package/dist/dashboard/provider-ui.js +20 -12
- package/dist/dashboard/provider-ui.mjs +21 -13
- package/dist/dashboard/recharts.js +53 -28
- package/dist/dashboard/recharts.mjs +53 -28
- package/dist/dashboard/swatch.js +35 -0
- package/dist/dashboard/swatch.mjs +31 -0
- package/dist/dashboard/table-contacts.js +6 -10
- package/dist/dashboard/table-contacts.mjs +6 -10
- package/dist/dashboard/table.js +10 -3
- package/dist/dashboard/table.mjs +9 -3
- package/dist/dashboard/template-dashboard.js +12 -7
- package/dist/dashboard/template-dashboard.mjs +11 -7
- package/dist/dashboard/template-design.js +564 -0
- package/dist/dashboard/template-design.mjs +531 -0
- package/dist/dashboard/template-rail.js +198 -126
- package/dist/dashboard/template-rail.mjs +196 -125
- package/dist/dashboard/template-socket.js +0 -3
- package/dist/dashboard/template-socket.mjs +0 -3
- package/dist/dashboard/template-test-page.js +436 -0
- package/dist/dashboard/template-test-page.mjs +407 -0
- package/dist/dashboard/template-tests.js +141 -0
- package/dist/dashboard/template-tests.mjs +112 -0
- package/dist/dashboard/template-ui.js +20 -11
- package/dist/dashboard/template-ui.mjs +22 -13
- package/dist/dashboard/template-variant.js +185 -0
- package/dist/dashboard/template-variant.mjs +156 -0
- package/dist/icons/arrow-down-long.js +47 -0
- package/dist/icons/arrow-down-long.mjs +28 -0
- package/dist/icons/arrows-pointing-out.js +46 -0
- package/dist/icons/arrows-pointing-out.mjs +27 -0
- package/dist/icons/beaker.js +46 -0
- package/dist/icons/beaker.mjs +27 -0
- package/dist/icons/identification.js +46 -0
- package/dist/icons/identification.mjs +27 -0
- package/dist/icons/lifebuoy.js +46 -0
- package/dist/icons/lifebuoy.mjs +27 -0
- package/dist/icons/rectangle-group.js +46 -0
- package/dist/icons/rectangle-group.mjs +27 -0
- package/dist/icons/rectangle-stack.js +46 -0
- package/dist/icons/rectangle-stack.mjs +27 -0
- package/dist/icons/shopping-bag.js +46 -0
- package/dist/icons/shopping-bag.mjs +27 -0
- package/dist/icons/swatch.js +46 -0
- package/dist/icons/swatch.mjs +27 -0
- package/dist/icons/window.js +46 -0
- package/dist/icons/window.mjs +27 -0
- package/dist/icons/zoom-in.js +46 -0
- package/dist/icons/zoom-in.mjs +27 -0
- package/dist/input-answer.js +60 -0
- package/dist/input-answer.mjs +27 -0
- package/dist/input-checkbox.js +7 -1
- package/dist/input-checkbox.mjs +7 -1
- package/dist/input-name.js +3 -3
- package/dist/input-name.mjs +3 -3
- package/dist/input-select.js +3 -1
- package/dist/input-select.mjs +3 -1
- package/dist/provider-font.js +4 -3
- package/dist/provider-font.mjs +4 -3
- package/dist/shared/badge.js +15 -0
- package/dist/shared/badge.mjs +11 -0
- package/dist/shared/carousel.js +11 -7
- package/dist/shared/carousel.mjs +11 -7
- package/dist/shared/document-pieces.js +295 -0
- package/dist/shared/document-pieces.mjs +260 -0
- package/dist/shared/lib/campaign.js +3 -9
- package/dist/shared/lib/campaign.mjs +3 -9
- package/dist/shared/lib/helpers.js +24 -0
- package/dist/shared/lib/helpers.mjs +22 -0
- package/dist/shared/lib/video.js +6 -0
- package/dist/shared/lib/video.mjs +5 -0
- package/dist/shared/sortable.js +27 -10
- package/dist/shared/sortable.mjs +27 -10
- package/dist/shared/tabs.js +1 -1
- package/dist/shared/tabs.mjs +1 -1
- package/dist/video.js +127 -9
- package/dist/video.mjs +125 -11
- package/package.json +176 -20
- package/types/bridge/fields.d.ts +6 -1
- package/types/bridge/form-subdomain-agreement.d.ts +27 -0
- package/types/bridge/form-subdomain-missions.d.ts +2 -0
- package/types/bridge/form-subdomain.d.ts +62 -3
- package/types/bridge/lib/entry.d.ts +44 -7
- package/types/bridge/lib/order.d.ts +13 -2
- package/types/bridge/subdomain-content.d.ts +1 -0
- package/types/bridge/template-subdomain-gallery.d.ts +13 -1
- package/types/dashboard/campaign-form.d.ts +42 -0
- package/types/dashboard/card-campaign-agreement.d.ts +26 -0
- package/types/dashboard/card-campaign-switch.d.ts +20 -1
- package/types/dashboard/card-order.d.ts +2 -2
- package/types/dashboard/card-section.d.ts +9 -1
- package/types/dashboard/card-shortcut.d.ts +38 -0
- package/types/dashboard/card-tile.d.ts +4 -9
- package/types/dashboard/document-blocks.d.ts +14 -0
- package/types/dashboard/drawer.d.ts +3 -0
- package/types/dashboard/form-ai.d.ts +0 -17
- package/types/dashboard/form-organization-brand.d.ts +3 -0
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +15 -0
- package/types/dashboard/form-organization-campaign-agreement.d.ts +53 -10
- package/types/dashboard/form-organization-campaign-design.d.ts +46 -0
- package/types/dashboard/form-organization-campaign-field-item.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-number.d.ts +4 -1
- package/types/dashboard/form-organization-campaign-field-select.d.ts +6 -1
- package/types/dashboard/form-organization-campaign-field-skill.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-text.d.ts +5 -1
- package/types/dashboard/form-organization-campaign-field-textarea.d.ts +4 -1
- package/types/dashboard/form-organization-campaign-footer.d.ts +23 -0
- package/types/dashboard/form-organization-campaign-integration-age.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +2 -0
- package/types/dashboard/form-organization-campaign-page.d.ts +9 -15
- package/types/dashboard/form-organization-campaign-section.d.ts +24 -8
- package/types/dashboard/form-organization-campaign.d.ts +3 -0
- package/types/dashboard/form-organization-workflow.d.ts +3 -0
- package/types/dashboard/form-organization.d.ts +2 -2
- package/types/dashboard/form-reposition.d.ts +29 -0
- package/types/dashboard/form-support.d.ts +14 -0
- package/types/dashboard/form-tests.d.ts +78 -0
- package/types/dashboard/form-verify-prize.d.ts +30 -3
- package/types/dashboard/input-editor.d.ts +9 -0
- package/types/dashboard/input-fields.d.ts +8 -5
- package/types/dashboard/input-file.d.ts +4 -0
- package/types/dashboard/input-resource.d.ts +1 -0
- package/types/dashboard/lib/ab-tests.d.ts +50 -0
- package/types/dashboard/lib/escape.d.ts +4 -0
- package/types/dashboard/lib/focus.d.ts +16 -0
- package/types/dashboard/lib/form-page.d.ts +25 -0
- package/types/dashboard/lib/item-list.d.ts +10 -5
- package/types/dashboard/lib/rail.d.ts +0 -1
- package/types/dashboard/lib/sms.d.ts +7 -0
- package/types/dashboard/modal.d.ts +3 -1
- package/types/dashboard/preview.d.ts +65 -10
- package/types/dashboard/recharts.d.ts +3 -0
- package/types/dashboard/swatch.d.ts +4 -0
- package/types/dashboard/template-dashboard.d.ts +3 -0
- package/types/dashboard/template-design.d.ts +30 -0
- package/types/dashboard/template-test-page.d.ts +69 -0
- package/types/dashboard/template-tests.d.ts +30 -0
- package/types/dashboard/template-variant.d.ts +18 -0
- package/types/icons/arrow-down-long.d.ts +5 -0
- package/types/icons/arrows-pointing-out.d.ts +5 -0
- package/types/icons/beaker.d.ts +5 -0
- package/types/icons/identification.d.ts +5 -0
- package/types/icons/lifebuoy.d.ts +5 -0
- package/types/icons/rectangle-group.d.ts +5 -0
- package/types/icons/rectangle-stack.d.ts +5 -0
- package/types/icons/shopping-bag.d.ts +5 -0
- package/types/icons/swatch.d.ts +5 -0
- package/types/icons/window.d.ts +5 -0
- package/types/icons/zoom-in.d.ts +5 -0
- package/types/input-answer.d.ts +15 -0
- package/types/input-select.d.ts +2 -0
- package/types/shared/button.d.ts +1 -1
- package/types/shared/document-pieces.d.ts +34 -0
- package/types/shared/lib/helpers.d.ts +22 -1
- package/types/shared/lib/motion.d.ts +2 -0
- package/types/shared/lib/video.d.ts +3 -0
- package/types/shared/sortable.d.ts +6 -0
- package/types/video.d.ts +18 -2
- package/dist/bridge/template-preview.js +0 -208
- package/dist/bridge/template-preview.mjs +0 -173
- package/dist/dashboard/device.js +0 -95
- package/dist/dashboard/device.mjs +0 -72
- package/dist/dashboard/form-organization-campaign-field-list.js +0 -425
- package/dist/dashboard/form-organization-campaign-field-list.mjs +0 -396
- package/dist/dashboard/item-row.js +0 -92
- package/dist/dashboard/item-row.mjs +0 -63
- package/types/bridge/template-preview.d.ts +0 -10
- package/types/dashboard/device.d.ts +0 -12
- package/types/dashboard/form-organization-campaign-field-list.d.ts +0 -36
- package/types/dashboard/item-row.d.ts +0 -25
|
@@ -271,6 +271,10 @@ const DrawerSubscriptionSummary = ({
|
|
|
271
271
|
const invoice = (data == null ? void 0 : data.invoice) || {};
|
|
272
272
|
const first = invoice.first || invoice;
|
|
273
273
|
const renews = Boolean(invoice.first) && invoice.first.total !== invoice.total;
|
|
274
|
+
const money = (cents) => "$" + (0, import_drawbridge_utils.formatNumber)((cents || 0) / 100, 2);
|
|
275
|
+
const per = (plan == null ? void 0 : plan.interval) || "month";
|
|
276
|
+
const fee = first.setup > 0;
|
|
277
|
+
const group = "space-y-1.5 mt-3 pt-3 border-t border-gray";
|
|
274
278
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
275
279
|
"div",
|
|
276
280
|
{
|
|
@@ -286,29 +290,63 @@ const DrawerSubscriptionSummary = ({
|
|
|
286
290
|
className: "space-y-1.5"
|
|
287
291
|
},
|
|
288
292
|
children: [
|
|
289
|
-
(plan == null ? void 0 : plan.title) && renderLine(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
+
(plan == null ? void 0 : plan.title) && (fee && Number.isFinite(plan == null ? void 0 : plan.price) ? renderLine(plan.title + ", per " + per, money(plan.price)) : renderLine("Plan", plan.title)),
|
|
294
|
+
fee && renderLine(
|
|
295
|
+
"Setup fee, one time",
|
|
296
|
+
money(first.setup)
|
|
297
|
+
)
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
...{
|
|
305
|
+
className: group
|
|
306
|
+
},
|
|
307
|
+
children: [
|
|
293
308
|
renderLine(
|
|
294
309
|
"Subtotal",
|
|
295
|
-
|
|
310
|
+
money(first.subtotal)
|
|
296
311
|
),
|
|
297
312
|
first.discount > 0 && renderLine(
|
|
298
313
|
"Discount",
|
|
299
|
-
"
|
|
314
|
+
"-" + money(first.discount)
|
|
300
315
|
),
|
|
301
316
|
renderLine(
|
|
302
317
|
"Tax",
|
|
303
|
-
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
318
|
+
money(first.tax)
|
|
319
|
+
)
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
...{
|
|
327
|
+
className: group
|
|
328
|
+
},
|
|
329
|
+
children: [
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
331
|
+
"div",
|
|
332
|
+
{
|
|
333
|
+
...{
|
|
334
|
+
className: "flex items-center justify-between font-medium"
|
|
335
|
+
},
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Total" }),
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: money(first.total) })
|
|
339
|
+
]
|
|
340
|
+
}
|
|
308
341
|
),
|
|
309
|
-
renews &&
|
|
310
|
-
"
|
|
311
|
-
|
|
342
|
+
renews && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
343
|
+
"p",
|
|
344
|
+
{
|
|
345
|
+
...{
|
|
346
|
+
className: "text-sm text-gray-dark"
|
|
347
|
+
},
|
|
348
|
+
children: "Then " + money(invoice.total) + " per " + per + ", tax included."
|
|
349
|
+
}
|
|
312
350
|
)
|
|
313
351
|
]
|
|
314
352
|
}
|
|
@@ -239,6 +239,10 @@ const DrawerSubscriptionSummary = ({
|
|
|
239
239
|
const invoice = (data == null ? void 0 : data.invoice) || {};
|
|
240
240
|
const first = invoice.first || invoice;
|
|
241
241
|
const renews = Boolean(invoice.first) && invoice.first.total !== invoice.total;
|
|
242
|
+
const money = (cents) => "$" + formatNumber((cents || 0) / 100, 2);
|
|
243
|
+
const per = (plan == null ? void 0 : plan.interval) || "month";
|
|
244
|
+
const fee = first.setup > 0;
|
|
245
|
+
const group = "space-y-1.5 mt-3 pt-3 border-t border-gray";
|
|
242
246
|
return /* @__PURE__ */ jsxs(
|
|
243
247
|
"div",
|
|
244
248
|
{
|
|
@@ -254,29 +258,63 @@ const DrawerSubscriptionSummary = ({
|
|
|
254
258
|
className: "space-y-1.5"
|
|
255
259
|
},
|
|
256
260
|
children: [
|
|
257
|
-
(plan == null ? void 0 : plan.title) && renderLine(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
(plan == null ? void 0 : plan.title) && (fee && Number.isFinite(plan == null ? void 0 : plan.price) ? renderLine(plan.title + ", per " + per, money(plan.price)) : renderLine("Plan", plan.title)),
|
|
262
|
+
fee && renderLine(
|
|
263
|
+
"Setup fee, one time",
|
|
264
|
+
money(first.setup)
|
|
265
|
+
)
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
/* @__PURE__ */ jsxs(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
...{
|
|
273
|
+
className: group
|
|
274
|
+
},
|
|
275
|
+
children: [
|
|
261
276
|
renderLine(
|
|
262
277
|
"Subtotal",
|
|
263
|
-
|
|
278
|
+
money(first.subtotal)
|
|
264
279
|
),
|
|
265
280
|
first.discount > 0 && renderLine(
|
|
266
281
|
"Discount",
|
|
267
|
-
"
|
|
282
|
+
"-" + money(first.discount)
|
|
268
283
|
),
|
|
269
284
|
renderLine(
|
|
270
285
|
"Tax",
|
|
271
|
-
|
|
272
|
-
)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
286
|
+
money(first.tax)
|
|
287
|
+
)
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ jsxs(
|
|
292
|
+
"div",
|
|
293
|
+
{
|
|
294
|
+
...{
|
|
295
|
+
className: group
|
|
296
|
+
},
|
|
297
|
+
children: [
|
|
298
|
+
/* @__PURE__ */ jsxs(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
...{
|
|
302
|
+
className: "flex items-center justify-between font-medium"
|
|
303
|
+
},
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ jsx("p", { children: "Total" }),
|
|
306
|
+
/* @__PURE__ */ jsx("p", { children: money(first.total) })
|
|
307
|
+
]
|
|
308
|
+
}
|
|
276
309
|
),
|
|
277
|
-
renews &&
|
|
278
|
-
"
|
|
279
|
-
|
|
310
|
+
renews && /* @__PURE__ */ jsx(
|
|
311
|
+
"p",
|
|
312
|
+
{
|
|
313
|
+
...{
|
|
314
|
+
className: "text-sm text-gray-dark"
|
|
315
|
+
},
|
|
316
|
+
children: "Then " + money(invoice.total) + " per " + per + ", tax included."
|
|
317
|
+
}
|
|
280
318
|
)
|
|
281
319
|
]
|
|
282
320
|
}
|
package/dist/dashboard/drawer.js
CHANGED
|
@@ -34,6 +34,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
34
34
|
var import_react = require("react");
|
|
35
35
|
var import_react2 = require("@headlessui/react");
|
|
36
36
|
var import_escape = require("./lib/escape");
|
|
37
|
+
var import_focus = require("./lib/focus");
|
|
37
38
|
var import_motion = require("../shared/lib/motion");
|
|
38
39
|
var import_times = __toESM(require("../icons/times"));
|
|
39
40
|
var import_button = __toESM(require("../shared/button"));
|
|
@@ -49,11 +50,14 @@ const Drawer = ({
|
|
|
49
50
|
title
|
|
50
51
|
}) => {
|
|
51
52
|
const close = (0, import_react.useRef)(null);
|
|
53
|
+
const heading = (0, import_react.useId)();
|
|
54
|
+
const [panel, setPanel] = (0, import_react.useState)(null);
|
|
52
55
|
(0, import_escape.useEscape)(active, close);
|
|
56
|
+
(0, import_focus.useTrap)(Boolean(active) && overlay, panel);
|
|
53
57
|
const classes = {
|
|
54
58
|
drawer: [
|
|
55
59
|
className,
|
|
56
|
-
"block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll",
|
|
60
|
+
"block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll outline-none",
|
|
57
61
|
"md:w-1/2 lg:w-1/3",
|
|
58
62
|
// Enter slides in immediately (no delay): the panel used to wait
|
|
59
63
|
// 300ms at translate-x-full, so a reopen before the previous leave
|
|
@@ -86,9 +90,14 @@ const Drawer = ({
|
|
|
86
90
|
import_react2.Transition,
|
|
87
91
|
{
|
|
88
92
|
...{
|
|
93
|
+
"aria-labelledby": heading,
|
|
94
|
+
"aria-modal": overlay,
|
|
89
95
|
as: "div",
|
|
90
96
|
className: classes.drawer.join(" "),
|
|
91
|
-
|
|
97
|
+
ref: setPanel,
|
|
98
|
+
role: "dialog",
|
|
99
|
+
show: Boolean(active),
|
|
100
|
+
tabIndex: -1
|
|
92
101
|
},
|
|
93
102
|
children: [
|
|
94
103
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -98,7 +107,15 @@ const Drawer = ({
|
|
|
98
107
|
className: classes.header.join(" ")
|
|
99
108
|
},
|
|
100
109
|
children: [
|
|
101
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
...{
|
|
114
|
+
id: heading
|
|
115
|
+
},
|
|
116
|
+
children: title
|
|
117
|
+
}
|
|
118
|
+
),
|
|
102
119
|
onClose instanceof Function && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
120
|
import_button.default,
|
|
104
121
|
{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, useRef } from "react";
|
|
2
|
+
import { Fragment, useId, useRef, useState } from "react";
|
|
3
3
|
import { Transition } from "@headlessui/react";
|
|
4
4
|
import { useEscape } from "./lib/escape.mjs";
|
|
5
|
+
import { useTrap } from "./lib/focus.mjs";
|
|
5
6
|
import { motion } from "../shared/lib/motion.mjs";
|
|
6
7
|
import Times from "../icons/times.mjs";
|
|
7
8
|
import Button from "../shared/button.mjs";
|
|
@@ -17,11 +18,14 @@ const Drawer = ({
|
|
|
17
18
|
title
|
|
18
19
|
}) => {
|
|
19
20
|
const close = useRef(null);
|
|
21
|
+
const heading = useId();
|
|
22
|
+
const [panel, setPanel] = useState(null);
|
|
20
23
|
useEscape(active, close);
|
|
24
|
+
useTrap(Boolean(active) && overlay, panel);
|
|
21
25
|
const classes = {
|
|
22
26
|
drawer: [
|
|
23
27
|
className,
|
|
24
|
-
"block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll",
|
|
28
|
+
"block fixed top-0 right-0 w-full h-full bg-white overflow-y-scroll outline-none",
|
|
25
29
|
"md:w-1/2 lg:w-1/3",
|
|
26
30
|
// Enter slides in immediately (no delay): the panel used to wait
|
|
27
31
|
// 300ms at translate-x-full, so a reopen before the previous leave
|
|
@@ -54,9 +58,14 @@ const Drawer = ({
|
|
|
54
58
|
Transition,
|
|
55
59
|
{
|
|
56
60
|
...{
|
|
61
|
+
"aria-labelledby": heading,
|
|
62
|
+
"aria-modal": overlay,
|
|
57
63
|
as: "div",
|
|
58
64
|
className: classes.drawer.join(" "),
|
|
59
|
-
|
|
65
|
+
ref: setPanel,
|
|
66
|
+
role: "dialog",
|
|
67
|
+
show: Boolean(active),
|
|
68
|
+
tabIndex: -1
|
|
60
69
|
},
|
|
61
70
|
children: [
|
|
62
71
|
/* @__PURE__ */ jsxs(
|
|
@@ -66,7 +75,15 @@ const Drawer = ({
|
|
|
66
75
|
className: classes.header.join(" ")
|
|
67
76
|
},
|
|
68
77
|
children: [
|
|
69
|
-
/* @__PURE__ */ jsx(
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
...{
|
|
82
|
+
id: heading
|
|
83
|
+
},
|
|
84
|
+
children: title
|
|
85
|
+
}
|
|
86
|
+
),
|
|
70
87
|
onClose instanceof Function && /* @__PURE__ */ jsx(
|
|
71
88
|
Button,
|
|
72
89
|
{
|
|
@@ -45,6 +45,7 @@ const Dropdown = ({
|
|
|
45
45
|
className = "flex",
|
|
46
46
|
classNameMenu = "w-32",
|
|
47
47
|
items = [],
|
|
48
|
+
onKeyDownMenu,
|
|
48
49
|
...rest
|
|
49
50
|
}) => {
|
|
50
51
|
const classes = {
|
|
@@ -53,7 +54,8 @@ const Dropdown = ({
|
|
|
53
54
|
classNameMenu
|
|
54
55
|
],
|
|
55
56
|
menuItem: [
|
|
56
|
-
|
|
57
|
+
// 44 px tall on a phone, a finger's size; 36 px on a desktop.
|
|
58
|
+
"w-full flex items-center justify-between py-3 md:py-2 px-4 text-sm text-left"
|
|
57
59
|
]
|
|
58
60
|
};
|
|
59
61
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -86,7 +88,8 @@ const Dropdown = ({
|
|
|
86
88
|
{
|
|
87
89
|
...{
|
|
88
90
|
anchor,
|
|
89
|
-
className: classes.menu.join(" ")
|
|
91
|
+
className: classes.menu.join(" "),
|
|
92
|
+
onKeyDown: onKeyDownMenu
|
|
90
93
|
},
|
|
91
94
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
95
|
"div",
|
|
@@ -133,6 +136,7 @@ const Dropdown = ({
|
|
|
133
136
|
IconComponent,
|
|
134
137
|
{
|
|
135
138
|
...{
|
|
139
|
+
"aria-hidden": true,
|
|
136
140
|
className: "w-4 h-4 " + (iconClassName && iconClassName)
|
|
137
141
|
}
|
|
138
142
|
}
|
|
@@ -13,6 +13,7 @@ const Dropdown = ({
|
|
|
13
13
|
className = "flex",
|
|
14
14
|
classNameMenu = "w-32",
|
|
15
15
|
items = [],
|
|
16
|
+
onKeyDownMenu,
|
|
16
17
|
...rest
|
|
17
18
|
}) => {
|
|
18
19
|
const classes = {
|
|
@@ -21,7 +22,8 @@ const Dropdown = ({
|
|
|
21
22
|
classNameMenu
|
|
22
23
|
],
|
|
23
24
|
menuItem: [
|
|
24
|
-
|
|
25
|
+
// 44 px tall on a phone, a finger's size; 36 px on a desktop.
|
|
26
|
+
"w-full flex items-center justify-between py-3 md:py-2 px-4 text-sm text-left"
|
|
25
27
|
]
|
|
26
28
|
};
|
|
27
29
|
return /* @__PURE__ */ jsx(
|
|
@@ -54,7 +56,8 @@ const Dropdown = ({
|
|
|
54
56
|
{
|
|
55
57
|
...{
|
|
56
58
|
anchor,
|
|
57
|
-
className: classes.menu.join(" ")
|
|
59
|
+
className: classes.menu.join(" "),
|
|
60
|
+
onKeyDown: onKeyDownMenu
|
|
58
61
|
},
|
|
59
62
|
children: /* @__PURE__ */ jsx(
|
|
60
63
|
"div",
|
|
@@ -101,6 +104,7 @@ const Dropdown = ({
|
|
|
101
104
|
IconComponent,
|
|
102
105
|
{
|
|
103
106
|
...{
|
|
107
|
+
"aria-hidden": true,
|
|
104
108
|
className: "w-4 h-4 " + (iconClassName && iconClassName)
|
|
105
109
|
}
|
|
106
110
|
}
|
|
@@ -31,6 +31,7 @@ __export(form_admin_subscription_custom_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(form_admin_subscription_custom_exports);
|
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
34
35
|
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
35
36
|
var import_form = require("../shared/lib/form");
|
|
36
37
|
var import_yup = __toESM(require("../shared/lib/yup"));
|
|
@@ -38,6 +39,7 @@ var import_form2 = __toESM(require("../shared/form"));
|
|
|
38
39
|
var import_fieldset = __toESM(require("../shared/fieldset"));
|
|
39
40
|
var import_input_group = __toESM(require("../input-group"));
|
|
40
41
|
var import_input_number = __toESM(require("../input-number"));
|
|
42
|
+
var import_input_select = __toESM(require("../input-select"));
|
|
41
43
|
var import_input_text = __toESM(require("../input-text"));
|
|
42
44
|
var import_input_switch = __toESM(require("../shared/input-switch"));
|
|
43
45
|
var import_features = require("./lib/features");
|
|
@@ -45,14 +47,26 @@ var import_overage = require("./lib/overage");
|
|
|
45
47
|
var import_button = __toESM(require("../shared/button"));
|
|
46
48
|
const gigabyte = 1024 * 1024 * 1024;
|
|
47
49
|
const blank = (value, original) => original === "" || original === null || original === void 0 ? null : value;
|
|
50
|
+
const cents = (value) => value == null || Math.abs(value * 100 - Math.round(value * 100)) < 1e-6;
|
|
51
|
+
const day = (date) => (0, import_drawbridge_utils.formatDateString)({
|
|
52
|
+
date,
|
|
53
|
+
options: {
|
|
54
|
+
day: "numeric",
|
|
55
|
+
month: "short",
|
|
56
|
+
year: "numeric"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const monthsLabel = (months) => months + (months === 1 ? " month" : " months");
|
|
48
60
|
const FormAdminSubscriptionCustom = ({
|
|
49
61
|
onSuccess,
|
|
50
62
|
onError,
|
|
51
63
|
values
|
|
52
64
|
}) => {
|
|
53
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
54
66
|
const custom = (values == null ? void 0 : values.custom) || {};
|
|
55
|
-
const
|
|
67
|
+
const active = (values == null ? void 0 : values.status) === "active";
|
|
68
|
+
const locked = active || Boolean((_a = custom == null ? void 0 : custom.setup) == null ? void 0 : _a.billedAt);
|
|
69
|
+
const { control, handleSubmit, formState, watch } = (0, import_form.useForm)({
|
|
56
70
|
resolver: (0, import_yup.resolver)(
|
|
57
71
|
// Required here mirrors the API's availability gate. A custom plan is
|
|
58
72
|
// self-describing, so an unset term resolves to NOTHING rather than to
|
|
@@ -71,6 +85,15 @@ const FormAdminSubscriptionCustom = ({
|
|
|
71
85
|
conversion: import_yup.default.number().transform(blank).nullable().label("Conversion rate").min(0).max(100).required(),
|
|
72
86
|
members: import_yup.default.number().transform(blank).nullable().label("Members").min(0),
|
|
73
87
|
storage: import_yup.default.number().transform(blank).nullable().label("Storage").min(0),
|
|
88
|
+
setup: import_yup.default.number().transform(blank).nullable().label("Setup fee").min(0).test("cents", "Setup fee must be dollars and cents", cents),
|
|
89
|
+
support: import_yup.default.boolean().label("Support"),
|
|
90
|
+
lasts: import_yup.default.string().oneOf(["forever", "months"]).label("Support lasts"),
|
|
91
|
+
// Asked for only when support is on and lasts a number of months.
|
|
92
|
+
// Checked only while shown, so a hidden value never blocks Submit.
|
|
93
|
+
months: import_yup.default.number().transform(blank).nullable().label("Months").when(["support", "lasts"], {
|
|
94
|
+
is: (support, lasts) => support && lasts === "months",
|
|
95
|
+
then: (schema) => schema.integer().min(1).max(120).required()
|
|
96
|
+
}),
|
|
74
97
|
overages: import_yup.default.number().transform(blank).nullable().label("Actions overage").min(0).required(),
|
|
75
98
|
available: import_yup.default.boolean().label("Available"),
|
|
76
99
|
features: import_yup.default.array().of(import_yup.default.string()).label("Features"),
|
|
@@ -78,20 +101,24 @@ const FormAdminSubscriptionCustom = ({
|
|
|
78
101
|
})
|
|
79
102
|
),
|
|
80
103
|
values: {
|
|
81
|
-
actions: ((
|
|
104
|
+
actions: ((_c = (_b = custom == null ? void 0 : custom.limits) == null ? void 0 : _b.organization) == null ? void 0 : _c.actions) ?? "",
|
|
82
105
|
available: Boolean(custom == null ? void 0 : custom.available),
|
|
83
|
-
features: ((
|
|
84
|
-
amount: Number.isFinite((
|
|
106
|
+
features: ((_d = custom == null ? void 0 : custom.features) == null ? void 0 : _d.granted) || [],
|
|
107
|
+
amount: Number.isFinite((_e = custom == null ? void 0 : custom.data) == null ? void 0 : _e.amount) ? custom.data.amount / 100 : "",
|
|
85
108
|
conversion: (custom == null ? void 0 : custom.conversion) ?? "",
|
|
86
|
-
members: ((
|
|
87
|
-
|
|
109
|
+
members: ((_g = (_f = custom == null ? void 0 : custom.limits) == null ? void 0 : _f.organization) == null ? void 0 : _g.members) ?? "",
|
|
110
|
+
setup: Number.isFinite((_h = custom == null ? void 0 : custom.setup) == null ? void 0 : _h.amount) ? custom.setup.amount / 100 : "",
|
|
111
|
+
support: ((_i = custom == null ? void 0 : custom.support) == null ? void 0 : _i.enabled) === true,
|
|
112
|
+
lasts: ((_j = custom == null ? void 0 : custom.support) == null ? void 0 : _j.months) ? "months" : "forever",
|
|
113
|
+
months: ((_k = custom == null ? void 0 : custom.support) == null ? void 0 : _k.months) ?? "",
|
|
114
|
+
storage: Number.isFinite((_m = (_l = custom == null ? void 0 : custom.limits) == null ? void 0 : _l.organization) == null ? void 0 : _m.storage) ? custom.limits.organization.storage / gigabyte : "",
|
|
88
115
|
// Stored as CENTS per action; edited in dollars, like `amount`. The
|
|
89
116
|
// conversion pair lives in lib/overage.js with the float-dust rounding.
|
|
90
117
|
overages: (0, import_overage.overageToForm)(custom == null ? void 0 : custom.overages),
|
|
91
118
|
title: (custom == null ? void 0 : custom.title) ?? ""
|
|
92
119
|
}
|
|
93
120
|
});
|
|
94
|
-
const onSubmit = async ({ actions, available, amount, conversion, features, members, overages, storage, title }) => {
|
|
121
|
+
const onSubmit = async ({ actions, available, amount, conversion, features, lasts, members, months, overages, setup, storage, support, title }) => {
|
|
95
122
|
try {
|
|
96
123
|
const response = await (0, import_fetch.request)({
|
|
97
124
|
body: {
|
|
@@ -103,6 +130,13 @@ const FormAdminSubscriptionCustom = ({
|
|
|
103
130
|
...Number.isFinite(amount) && { data: { amount: Math.round(amount * 100) } },
|
|
104
131
|
...Number.isFinite(conversion) && { conversion },
|
|
105
132
|
...Number.isFinite(overages) && { overages: (0, import_overage.overageFromForm)(overages) },
|
|
133
|
+
// Whole cents, converted here as the price is. Empty or 0 is no fee.
|
|
134
|
+
...Number.isFinite(setup) && setup > 0 && { setup: { amount: Math.round(setup * 100) } },
|
|
135
|
+
// Off keeps the stored months and date; forever sends no months.
|
|
136
|
+
support: {
|
|
137
|
+
enabled: Boolean(support),
|
|
138
|
+
...support && lasts === "months" && Number.isFinite(months) && { months }
|
|
139
|
+
},
|
|
106
140
|
limits: {
|
|
107
141
|
organization: {
|
|
108
142
|
...Number.isFinite(actions) && { actions },
|
|
@@ -169,6 +203,15 @@ const FormAdminSubscriptionCustom = ({
|
|
|
169
203
|
(value) => Number.isFinite(value) ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Applies immediately only if this is the plan they are billing on." : "The organization is billed this each period.",
|
|
170
204
|
({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_number.default, { ...{ min: 1, onChange, placeholder: "2499.00", step: 0.01, type: "number", value: value ?? "" } })
|
|
171
205
|
),
|
|
206
|
+
field(
|
|
207
|
+
"setup",
|
|
208
|
+
"Setup fee ($)",
|
|
209
|
+
(value) => {
|
|
210
|
+
var _a2;
|
|
211
|
+
return locked ? ((_a2 = custom == null ? void 0 : custom.setup) == null ? void 0 : _a2.billedAt) ? "Billed on " + day(custom.setup.billedAt) + "." : "They are on this plan, so a fee can no longer be added." : value > 0 ? "Sent as " + Math.round(value * 100).toLocaleString("en-US") + " cents. Billed once, on their first invoice." : "Billed once, on their first invoice. Leave empty for no fee.";
|
|
212
|
+
},
|
|
213
|
+
({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_number.default, { ...{ disabled: locked, min: 0, onChange, placeholder: locked ? "None" : "2500.00", step: 0.01, type: "number", value: value ?? "" } })
|
|
214
|
+
),
|
|
172
215
|
field(
|
|
173
216
|
"actions",
|
|
174
217
|
"Actions included",
|
|
@@ -251,6 +294,27 @@ const FormAdminSubscriptionCustom = ({
|
|
|
251
294
|
}
|
|
252
295
|
}
|
|
253
296
|
),
|
|
297
|
+
field(
|
|
298
|
+
"support",
|
|
299
|
+
"Support",
|
|
300
|
+
"On: members see a Support button in their dashboard and can send us a message.",
|
|
301
|
+
({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_switch.default, { ...{ onChange, value: value || false } })
|
|
302
|
+
),
|
|
303
|
+
watch("support") && field(
|
|
304
|
+
"lasts",
|
|
305
|
+
"Support lasts",
|
|
306
|
+
(value) => value === "months" ? null : "For as long as they are on this plan.",
|
|
307
|
+
({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_select.default, { ...{ onChange, options: [{ label: "Forever", value: "forever" }, { label: "A number of months", value: "months" }], value: value || "forever" } })
|
|
308
|
+
),
|
|
309
|
+
watch("support") && watch("lasts") === "months" && field(
|
|
310
|
+
"months",
|
|
311
|
+
"Months",
|
|
312
|
+
(value) => {
|
|
313
|
+
var _a2, _b2;
|
|
314
|
+
return !Number.isFinite(value) ? "Counted from the day they start this plan." : value === ((_a2 = custom == null ? void 0 : custom.support) == null ? void 0 : _a2.months) && ((_b2 = custom == null ? void 0 : custom.support) == null ? void 0 : _b2.until) ? (new Date(custom.support.until) < /* @__PURE__ */ new Date() ? "Support ended " : "Support ends ") + day(custom.support.until) + "." : (custom == null ? void 0 : custom.startedAt) ? "Support ends " + monthsLabel(value) + " after the day they started this plan." : "Support ends " + monthsLabel(value) + " after they start this plan.";
|
|
315
|
+
},
|
|
316
|
+
({ onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_number.default, { ...{ max: 120, min: 1, onChange, placeholder: "6", step: 1, type: "number", value: value ?? "" } })
|
|
317
|
+
),
|
|
254
318
|
field(
|
|
255
319
|
"available",
|
|
256
320
|
"Available to the organization",
|