@drawbridge/components 0.1.13 → 0.1.15
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 +364 -2
- package/dist/advertisement.js +3 -1
- package/dist/advertisement.mjs +3 -1
- package/dist/bridge/advertisements.js +2 -0
- package/dist/bridge/advertisements.mjs +2 -0
- package/dist/bridge/countdown.js +2 -1
- package/dist/bridge/countdown.mjs +2 -1
- package/dist/bridge/form-subdomain-embed.js +18 -20
- package/dist/bridge/form-subdomain-embed.mjs +18 -20
- package/dist/bridge/form-subdomain-header.js +24 -1
- package/dist/bridge/form-subdomain-header.mjs +24 -1
- package/dist/bridge/form-subdomain-missions.js +577 -0
- package/dist/bridge/form-subdomain-missions.mjs +540 -0
- package/dist/bridge/form-subdomain.js +530 -220
- package/dist/bridge/form-subdomain.mjs +533 -222
- package/dist/bridge/lib/entry.js +59 -0
- package/dist/bridge/lib/entry.mjs +29 -0
- package/dist/bridge/lib/location.js +38 -0
- package/dist/bridge/lib/location.mjs +13 -0
- package/dist/bridge/lib/order.js +71 -0
- package/dist/bridge/lib/order.mjs +44 -0
- package/dist/bridge/lib/url.js +9 -0
- package/dist/bridge/lib/url.mjs +7 -0
- package/dist/bridge/share-button.js +5 -3
- package/dist/bridge/share-button.mjs +5 -3
- package/dist/bridge/subdomain-content.js +7 -6
- package/dist/bridge/subdomain-content.mjs +7 -6
- package/dist/bridge/template-layout.js +59 -21
- package/dist/bridge/template-layout.mjs +59 -21
- package/dist/bridge/template-modal.js +42 -76
- package/dist/bridge/template-modal.mjs +39 -73
- package/dist/bridge/template-preview.js +208 -0
- package/dist/bridge/template-preview.mjs +173 -0
- package/dist/bridge/template-subdomain-gallery.js +6 -2
- package/dist/bridge/template-subdomain-gallery.mjs +6 -2
- package/dist/bridge/template-subdomain-link.js +6 -1
- package/dist/bridge/template-subdomain-link.mjs +6 -1
- package/dist/bridge/template-subdomain.js +20 -15
- package/dist/bridge/template-subdomain.mjs +20 -15
- package/dist/dashboard/accordion.js +74 -39
- package/dist/dashboard/accordion.mjs +74 -39
- package/dist/dashboard/avatar.js +109 -3
- package/dist/dashboard/avatar.mjs +106 -4
- package/dist/dashboard/buttons-subscription.js +384 -0
- package/dist/dashboard/buttons-subscription.mjs +349 -0
- package/dist/dashboard/card-campaign-switch.js +277 -0
- package/dist/dashboard/card-campaign-switch.mjs +243 -0
- package/dist/dashboard/card-order.js +231 -29
- package/dist/dashboard/card-order.mjs +231 -29
- package/dist/dashboard/card-section.js +26 -2
- package/dist/dashboard/card-section.mjs +26 -2
- package/dist/dashboard/card-tile.js +6 -7
- package/dist/dashboard/card-tile.mjs +6 -7
- package/dist/dashboard/connection-workflows.js +205 -0
- package/dist/dashboard/connection-workflows.mjs +171 -0
- package/dist/dashboard/device.js +95 -0
- package/dist/dashboard/device.mjs +72 -0
- package/dist/dashboard/form-admin-campaign.js +19 -50
- package/dist/dashboard/form-admin-campaign.mjs +20 -51
- package/dist/dashboard/form-ai.js +9 -6
- package/dist/dashboard/form-ai.mjs +9 -6
- package/dist/dashboard/form-auth.js +35 -25
- package/dist/dashboard/form-auth.mjs +36 -26
- package/dist/dashboard/form-file.js +10 -1
- package/dist/dashboard/form-file.mjs +10 -1
- package/dist/dashboard/form-filters-analytics.js +14 -1
- package/dist/dashboard/form-filters-analytics.mjs +15 -2
- package/dist/dashboard/form-organization-campaign-advertisement.js +15 -1
- package/dist/dashboard/form-organization-campaign-advertisement.mjs +16 -2
- package/dist/dashboard/form-organization-campaign-agreement.js +215 -164
- package/dist/dashboard/form-organization-campaign-agreement.mjs +215 -164
- package/dist/dashboard/form-organization-campaign-field-email.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-email.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-list.js +466 -0
- package/dist/dashboard/form-organization-campaign-field-list.mjs +437 -0
- package/dist/dashboard/form-organization-campaign-field-phone.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-phone.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-remove.js +66 -0
- package/dist/dashboard/form-organization-campaign-field-remove.mjs +33 -0
- package/dist/dashboard/form-organization-campaign-field-select.js +51 -5
- package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
- package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
- package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
- package/dist/dashboard/form-organization-campaign-integration-age.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
- package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
- package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-link.js +7 -1
- package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
- package/dist/dashboard/form-organization-campaign-mission.js +291 -0
- package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
- package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
- package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-page.js +20 -11
- package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
- package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
- package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-section.js +243 -0
- package/dist/dashboard/form-organization-campaign-section.mjs +214 -0
- package/dist/dashboard/form-organization-campaign.js +114 -469
- package/dist/dashboard/form-organization-campaign.mjs +113 -467
- package/dist/dashboard/form-organization-export.js +4 -7
- package/dist/dashboard/form-organization-export.mjs +4 -7
- package/dist/dashboard/form-organization-identity.js +46 -51
- package/dist/dashboard/form-organization-identity.mjs +46 -51
- package/dist/dashboard/form-organization-workflow.js +708 -687
- package/dist/dashboard/form-organization-workflow.mjs +704 -683
- package/dist/dashboard/form-organization.js +82 -110
- package/dist/dashboard/form-organization.mjs +81 -109
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-payment-methods.js +20 -9
- package/dist/dashboard/form-payment-methods.mjs +20 -9
- package/dist/dashboard/form-stripe.js +30 -0
- package/dist/dashboard/form-stripe.mjs +26 -0
- package/dist/dashboard/input-array.js +4 -2
- package/dist/dashboard/input-array.mjs +4 -2
- package/dist/dashboard/input-combobox.js +7 -3
- package/dist/dashboard/input-combobox.mjs +7 -3
- package/dist/dashboard/input-date.js +7 -0
- package/dist/dashboard/input-date.mjs +7 -0
- package/dist/dashboard/input-fields.js +80 -20
- package/dist/dashboard/input-fields.mjs +80 -20
- package/dist/dashboard/input-file.js +21 -1
- package/dist/dashboard/input-file.mjs +21 -1
- package/dist/dashboard/input-font.js +10 -1
- package/dist/dashboard/input-font.mjs +10 -1
- package/dist/dashboard/lib/item-list.js +57 -0
- package/dist/dashboard/lib/item-list.mjs +33 -0
- package/dist/dashboard/lib/menu.js +50 -0
- package/dist/dashboard/lib/menu.mjs +26 -0
- package/dist/dashboard/locked.js +82 -0
- package/dist/dashboard/locked.mjs +53 -0
- package/dist/dashboard/menu.js +72 -19
- package/dist/dashboard/menu.mjs +72 -19
- package/dist/dashboard/note-ai.js +69 -0
- package/dist/dashboard/note-ai.mjs +36 -0
- package/dist/dashboard/preview.js +419 -0
- package/dist/dashboard/preview.mjs +384 -0
- package/dist/dashboard/steps.js +39 -13
- package/dist/dashboard/steps.mjs +37 -12
- package/dist/dashboard/table-contacts.js +136 -0
- package/dist/dashboard/table-contacts.mjs +103 -0
- package/dist/dashboard/template-not-found.js +4 -2
- package/dist/dashboard/template-not-found.mjs +4 -2
- package/dist/dashboard/template-socket.js +20 -7
- package/dist/dashboard/template-socket.mjs +20 -7
- package/dist/icons/desktop.js +46 -0
- package/dist/icons/desktop.mjs +27 -0
- package/dist/icons/phone.js +46 -0
- package/dist/icons/phone.mjs +27 -0
- package/dist/icons/puzzle-piece.js +46 -0
- package/dist/icons/puzzle-piece.mjs +27 -0
- package/dist/icons/tablet.js +46 -0
- package/dist/icons/tablet.mjs +27 -0
- package/dist/icons/users.js +46 -0
- package/dist/icons/users.mjs +27 -0
- package/dist/input-checkbox.js +1 -0
- package/dist/input-checkbox.mjs +1 -0
- package/dist/input-code.js +83 -0
- package/dist/input-code.mjs +50 -0
- package/dist/input-text.js +2 -1
- package/dist/input-text.mjs +2 -1
- package/dist/shared/button.js +1 -1
- package/dist/shared/button.mjs +1 -1
- package/dist/shared/input-checkbox-list.js +0 -1
- package/dist/shared/input-checkbox-list.mjs +0 -1
- package/dist/shared/input-switch.js +6 -1
- package/dist/shared/input-switch.mjs +6 -1
- package/dist/shared/lib/campaign.js +123 -0
- package/dist/shared/lib/campaign.mjs +96 -0
- package/dist/shared/lib/helpers.js +14 -2
- package/dist/shared/lib/helpers.mjs +13 -2
- package/package.json +133 -13
- package/types/bridge/form-subdomain-header.d.ts +2 -0
- package/types/bridge/form-subdomain-missions.d.ts +38 -0
- package/types/bridge/form-subdomain.d.ts +23 -1
- package/types/bridge/lib/entry.d.ts +26 -0
- package/types/bridge/lib/location.d.ts +13 -0
- package/types/bridge/lib/order.d.ts +30 -0
- package/types/bridge/lib/url.d.ts +19 -0
- package/types/bridge/template-modal.d.ts +1 -1
- package/types/bridge/template-preview.d.ts +10 -0
- package/types/bridge/template-subdomain-link.d.ts +2 -0
- package/types/dashboard/accordion.d.ts +2 -0
- package/types/dashboard/avatar.d.ts +18 -2
- package/types/dashboard/buttons-subscription.d.ts +22 -0
- package/types/dashboard/card-campaign-switch.d.ts +32 -0
- package/types/dashboard/card-order.d.ts +25 -1
- package/types/dashboard/card-section.d.ts +2 -0
- package/types/dashboard/connection-workflows.d.ts +33 -0
- package/types/dashboard/device.d.ts +12 -0
- package/types/dashboard/form-admin-campaign.d.ts +3 -2
- package/types/dashboard/form-ai.d.ts +2 -2
- package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
- package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
- package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
- package/types/dashboard/form-organization-campaign-section.d.ts +29 -0
- package/types/dashboard/form-organization-campaign.d.ts +27 -17
- package/types/dashboard/form-organization-identity.d.ts +2 -0
- package/types/dashboard/form-organization-workflow.d.ts +56 -47
- package/types/dashboard/form-organization.d.ts +7 -2
- package/types/dashboard/form-stripe.d.ts +3 -0
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/input-date.d.ts +2 -0
- package/types/dashboard/input-fields.d.ts +3 -2
- package/types/dashboard/input-file.d.ts +4 -0
- package/types/dashboard/lib/item-list.d.ts +14 -0
- package/types/dashboard/lib/menu.d.ts +17 -0
- package/types/dashboard/locked.d.ts +10 -0
- package/types/dashboard/menu.d.ts +10 -2
- package/types/dashboard/note-ai.d.ts +15 -0
- package/types/dashboard/preview.d.ts +33 -0
- package/types/dashboard/steps.d.ts +19 -4
- package/types/dashboard/table-cell-title.d.ts +2 -2
- package/types/dashboard/table-contacts.d.ts +2 -0
- package/types/icons/desktop.d.ts +5 -0
- package/types/icons/phone.d.ts +5 -0
- package/types/icons/puzzle-piece.d.ts +5 -0
- package/types/icons/tablet.d.ts +5 -0
- package/types/icons/users.d.ts +5 -0
- package/types/input-code.d.ts +23 -0
- package/types/shared/input-switch.d.ts +2 -0
- package/types/shared/lib/campaign.d.ts +35 -0
- package/types/shared/lib/helpers.d.ts +3 -0
- package/dist/dashboard/card-integration.js +0 -187
- package/dist/dashboard/card-integration.mjs +0 -158
- package/dist/dashboard/iframe.js +0 -159
- package/dist/dashboard/iframe.mjs +0 -130
- package/types/dashboard/card-integration.d.ts +0 -24
- package/types/dashboard/iframe.d.ts +0 -18
|
@@ -73,8 +73,9 @@ const FormOrganizationExport = ({
|
|
|
73
73
|
const queryClient = (0, import_react_query.useQueryClient)();
|
|
74
74
|
const capabilities = ((_a = queryClient.getQueryData(["organization", values.organization])) == null ? void 0 : _a.capabilities) || {};
|
|
75
75
|
const campaigns = canRead((_b = capabilities.campaigns) == null ? void 0 : _b.leads) && canRead((_c = capabilities.campaigns) == null ? void 0 : _c.settings);
|
|
76
|
+
const segments = canRead(capabilities.segments);
|
|
76
77
|
const availability = {
|
|
77
|
-
contacts: canRead(capabilities.contacts)
|
|
78
|
+
contacts: canRead(capabilities.contacts),
|
|
78
79
|
leads: campaigns,
|
|
79
80
|
submissions: campaigns
|
|
80
81
|
};
|
|
@@ -90,11 +91,7 @@ const FormOrganizationExport = ({
|
|
|
90
91
|
then: (schema) => schema.required(),
|
|
91
92
|
otherwise: (schema) => schema.nullable()
|
|
92
93
|
}),
|
|
93
|
-
segment: import_yup.default.object().label("Segment").nullable()
|
|
94
|
-
is: "contacts",
|
|
95
|
-
then: (schema) => schema.required(),
|
|
96
|
-
otherwise: (schema) => schema.nullable()
|
|
97
|
-
})
|
|
94
|
+
segment: import_yup.default.object().label("Segment").nullable()
|
|
98
95
|
})
|
|
99
96
|
),
|
|
100
97
|
values: {
|
|
@@ -229,7 +226,7 @@ const FormOrganizationExport = ({
|
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
),
|
|
232
|
-
type === "contacts" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
229
|
+
type === "contacts" && segments && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
233
230
|
import_form.Controller,
|
|
234
231
|
{
|
|
235
232
|
...{
|
|
@@ -41,8 +41,9 @@ const FormOrganizationExport = ({
|
|
|
41
41
|
const queryClient = useQueryClient();
|
|
42
42
|
const capabilities = ((_a = queryClient.getQueryData(["organization", values.organization])) == null ? void 0 : _a.capabilities) || {};
|
|
43
43
|
const campaigns = canRead((_b = capabilities.campaigns) == null ? void 0 : _b.leads) && canRead((_c = capabilities.campaigns) == null ? void 0 : _c.settings);
|
|
44
|
+
const segments = canRead(capabilities.segments);
|
|
44
45
|
const availability = {
|
|
45
|
-
contacts: canRead(capabilities.contacts)
|
|
46
|
+
contacts: canRead(capabilities.contacts),
|
|
46
47
|
leads: campaigns,
|
|
47
48
|
submissions: campaigns
|
|
48
49
|
};
|
|
@@ -58,11 +59,7 @@ const FormOrganizationExport = ({
|
|
|
58
59
|
then: (schema) => schema.required(),
|
|
59
60
|
otherwise: (schema) => schema.nullable()
|
|
60
61
|
}),
|
|
61
|
-
segment: yup.object().label("Segment").nullable()
|
|
62
|
-
is: "contacts",
|
|
63
|
-
then: (schema) => schema.required(),
|
|
64
|
-
otherwise: (schema) => schema.nullable()
|
|
65
|
-
})
|
|
62
|
+
segment: yup.object().label("Segment").nullable()
|
|
66
63
|
})
|
|
67
64
|
),
|
|
68
65
|
values: {
|
|
@@ -197,7 +194,7 @@ const FormOrganizationExport = ({
|
|
|
197
194
|
}
|
|
198
195
|
}
|
|
199
196
|
),
|
|
200
|
-
type === "contacts" && /* @__PURE__ */ jsx(
|
|
197
|
+
type === "contacts" && segments && /* @__PURE__ */ jsx(
|
|
201
198
|
Controller,
|
|
202
199
|
{
|
|
203
200
|
...{
|
|
@@ -38,6 +38,7 @@ var import_react = require("react");
|
|
|
38
38
|
var import_form = require("../shared/lib/form");
|
|
39
39
|
var import_yup = __toESM(require("../shared/lib/yup"));
|
|
40
40
|
var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
41
|
+
var import_domains = require("@drawbridge/drawbridge-utils/domains");
|
|
41
42
|
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
42
43
|
var import_list_resource = __toESM(require("./list-resource"));
|
|
43
44
|
var import_link_back = __toESM(require("./link-back"));
|
|
@@ -492,7 +493,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
492
493
|
onSuccess,
|
|
493
494
|
values
|
|
494
495
|
}) => {
|
|
495
|
-
var _a, _b, _c;
|
|
496
|
+
var _a, _b, _c, _d;
|
|
496
497
|
const records = (values == null ? void 0 : values.records) || [];
|
|
497
498
|
const [verifying, setVerifying] = (0, import_react.useState)(false);
|
|
498
499
|
const verify = async () => {
|
|
@@ -526,21 +527,18 @@ const FormOrganizationIdentityEmail = ({
|
|
|
526
527
|
// the part before the @ is free. So the domain is immutable once saved and
|
|
527
528
|
// the address is editable at will, and neither touches the records.
|
|
528
529
|
values: {
|
|
529
|
-
address: String((values == null ? void 0 : values.from) || "").split("@")[0] || ""
|
|
530
|
-
domain: (values == null ? void 0 : values.domain) || String((values == null ? void 0 : values.from) || "").split("@")[1] || ""
|
|
530
|
+
address: String((values == null ? void 0 : values.from) || "").split("@")[0] || ""
|
|
531
531
|
},
|
|
532
|
-
//
|
|
533
|
-
//
|
|
534
|
-
// only thing left to change. So the form validates whichever it shows.
|
|
532
|
+
// Creating asks for nothing: the domain is the website's and the address
|
|
533
|
+
// starts as hello@. Once the row exists the address is the one field.
|
|
535
534
|
resolver: (0, import_yup.resolver)(
|
|
536
535
|
(values == null ? void 0 : values.id) ? import_yup.default.object({
|
|
537
536
|
address: import_yup.default.string().label("Address").max(64).matches(/^[a-z0-9._%+-]+$/i, { excludeEmptyString: true, message: "Letters, numbers and . _ % + - only \u2014 no @" })
|
|
538
|
-
}) : import_yup.default.object({
|
|
539
|
-
domain: import_yup.default.string().label("Domain").required().max(253).matches(/^([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i, "Enter a domain like yourbrand.com")
|
|
540
|
-
})
|
|
537
|
+
}) : import_yup.default.object({})
|
|
541
538
|
)
|
|
542
539
|
});
|
|
543
|
-
const
|
|
540
|
+
const website = (0, import_domains.normalizeDomain)(values == null ? void 0 : values.website);
|
|
541
|
+
const onSubmit = async ({ address }) => {
|
|
544
542
|
try {
|
|
545
543
|
const response = await (0, import_fetch.request)({
|
|
546
544
|
// CREATE AND UPDATE ARE TWO ROUTES with two shapes, and the form uses
|
|
@@ -548,7 +546,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
548
546
|
// both fields; PUT changes the address and nothing else. The domain
|
|
549
547
|
// field is locked once a row exists, and the api would refuse a change
|
|
550
548
|
// regardless — a different domain is a removal, then a new POST.
|
|
551
|
-
body: (values == null ? void 0 : values.id) ? { address: address || "hello" } : {
|
|
549
|
+
body: (values == null ? void 0 : values.id) ? { address: address || "hello" } : {},
|
|
552
550
|
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/identity/email",
|
|
553
551
|
method: (values == null ? void 0 : values.id) ? "PUT" : "POST"
|
|
554
552
|
});
|
|
@@ -557,23 +555,35 @@ const FormOrganizationIdentityEmail = ({
|
|
|
557
555
|
onError(error);
|
|
558
556
|
}
|
|
559
557
|
};
|
|
560
|
-
if (!(values == null ? void 0 : values.id) && !((_a = values == null ? void 0 : values.address) == null ? void 0 : _a.address)) {
|
|
561
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
558
|
+
if (!(values == null ? void 0 : values.id) && (!((_a = values == null ? void 0 : values.address) == null ? void 0 : _a.address) || !website)) {
|
|
559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
562
560
|
"div",
|
|
563
561
|
{
|
|
564
562
|
...{
|
|
565
|
-
className: "p-6"
|
|
563
|
+
className: "p-6 space-y-4"
|
|
566
564
|
},
|
|
567
|
-
children:
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
565
|
+
children: [
|
|
566
|
+
!website && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
567
|
+
import_card_task.default,
|
|
568
|
+
{
|
|
569
|
+
...{
|
|
570
|
+
// The api's WEBSITE_REQUIRED, word for word.
|
|
571
|
+
message: "You must add your website",
|
|
572
|
+
type: "error"
|
|
573
|
+
}
|
|
574
574
|
}
|
|
575
|
-
|
|
576
|
-
|
|
575
|
+
),
|
|
576
|
+
!((_b = values == null ? void 0 : values.address) == null ? void 0 : _b.address) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
577
|
+
import_card_task.default,
|
|
578
|
+
{
|
|
579
|
+
...{
|
|
580
|
+
// The api's BUSINESS_ADDRESS_REQUIRED, word for word.
|
|
581
|
+
message: "You must add your business address",
|
|
582
|
+
type: "error"
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
)
|
|
586
|
+
]
|
|
577
587
|
}
|
|
578
588
|
);
|
|
579
589
|
}
|
|
@@ -614,7 +624,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
614
624
|
...{
|
|
615
625
|
index: 1,
|
|
616
626
|
state: states.address,
|
|
617
|
-
title: (values == null ? void 0 : values.id) ? "Your email address" : "
|
|
627
|
+
title: (values == null ? void 0 : values.id) ? "Your email address" : "Your domain"
|
|
618
628
|
},
|
|
619
629
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
620
630
|
import_fieldset.default,
|
|
@@ -624,35 +634,20 @@ const FormOrganizationIdentityEmail = ({
|
|
|
624
634
|
},
|
|
625
635
|
children: [
|
|
626
636
|
!(values == null ? void 0 : values.id) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
627
|
-
|
|
637
|
+
import_input_group.default,
|
|
628
638
|
{
|
|
629
639
|
...{
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
{
|
|
637
|
-
...{
|
|
638
|
-
error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.domain) == null ? void 0 : _b2.message,
|
|
639
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
640
|
-
import_input_text.default,
|
|
641
|
-
{
|
|
642
|
-
...{
|
|
643
|
-
onChange,
|
|
644
|
-
placeholder: "yourbrand.com",
|
|
645
|
-
type: "text",
|
|
646
|
-
value: value || ""
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
),
|
|
650
|
-
label: "Domain",
|
|
651
|
-
message: "A domain you own and can add DNS records to."
|
|
652
|
-
}
|
|
640
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
641
|
+
import_input_text.default,
|
|
642
|
+
{
|
|
643
|
+
...{
|
|
644
|
+
readOnly: true,
|
|
645
|
+
value: website
|
|
653
646
|
}
|
|
654
|
-
|
|
655
|
-
|
|
647
|
+
}
|
|
648
|
+
),
|
|
649
|
+
label: "Domain",
|
|
650
|
+
message: "Your website's domain. To use another, change Website in the Business section first."
|
|
656
651
|
}
|
|
657
652
|
}
|
|
658
653
|
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -718,7 +713,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
718
713
|
import_card_task.default,
|
|
719
714
|
{
|
|
720
715
|
...{
|
|
721
|
-
message: ((
|
|
716
|
+
message: ((_d = (_c = values == null ? void 0 : values.errors) == null ? void 0 : _c[0]) == null ? void 0 : _d.message) || "We could not find the records. Check them and try again.",
|
|
722
717
|
type: "error"
|
|
723
718
|
}
|
|
724
719
|
}
|
|
@@ -4,6 +4,7 @@ import { Fragment, useState } from "react";
|
|
|
4
4
|
import { useForm, Controller } from "../shared/lib/form.mjs";
|
|
5
5
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
6
6
|
import { formatCurrency } from "@drawbridge/drawbridge-utils";
|
|
7
|
+
import { normalizeDomain } from "@drawbridge/drawbridge-utils/domains";
|
|
7
8
|
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
8
9
|
import ListResource from "./list-resource.mjs";
|
|
9
10
|
import LinkBack from "./link-back.mjs";
|
|
@@ -458,7 +459,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
458
459
|
onSuccess,
|
|
459
460
|
values
|
|
460
461
|
}) => {
|
|
461
|
-
var _a, _b, _c;
|
|
462
|
+
var _a, _b, _c, _d;
|
|
462
463
|
const records = (values == null ? void 0 : values.records) || [];
|
|
463
464
|
const [verifying, setVerifying] = useState(false);
|
|
464
465
|
const verify = async () => {
|
|
@@ -492,21 +493,18 @@ const FormOrganizationIdentityEmail = ({
|
|
|
492
493
|
// the part before the @ is free. So the domain is immutable once saved and
|
|
493
494
|
// the address is editable at will, and neither touches the records.
|
|
494
495
|
values: {
|
|
495
|
-
address: String((values == null ? void 0 : values.from) || "").split("@")[0] || ""
|
|
496
|
-
domain: (values == null ? void 0 : values.domain) || String((values == null ? void 0 : values.from) || "").split("@")[1] || ""
|
|
496
|
+
address: String((values == null ? void 0 : values.from) || "").split("@")[0] || ""
|
|
497
497
|
},
|
|
498
|
-
//
|
|
499
|
-
//
|
|
500
|
-
// only thing left to change. So the form validates whichever it shows.
|
|
498
|
+
// Creating asks for nothing: the domain is the website's and the address
|
|
499
|
+
// starts as hello@. Once the row exists the address is the one field.
|
|
501
500
|
resolver: resolver(
|
|
502
501
|
(values == null ? void 0 : values.id) ? yup.object({
|
|
503
502
|
address: yup.string().label("Address").max(64).matches(/^[a-z0-9._%+-]+$/i, { excludeEmptyString: true, message: "Letters, numbers and . _ % + - only \u2014 no @" })
|
|
504
|
-
}) : yup.object({
|
|
505
|
-
domain: yup.string().label("Domain").required().max(253).matches(/^([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i, "Enter a domain like yourbrand.com")
|
|
506
|
-
})
|
|
503
|
+
}) : yup.object({})
|
|
507
504
|
)
|
|
508
505
|
});
|
|
509
|
-
const
|
|
506
|
+
const website = normalizeDomain(values == null ? void 0 : values.website);
|
|
507
|
+
const onSubmit = async ({ address }) => {
|
|
510
508
|
try {
|
|
511
509
|
const response = await request({
|
|
512
510
|
// CREATE AND UPDATE ARE TWO ROUTES with two shapes, and the form uses
|
|
@@ -514,7 +512,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
514
512
|
// both fields; PUT changes the address and nothing else. The domain
|
|
515
513
|
// field is locked once a row exists, and the api would refuse a change
|
|
516
514
|
// regardless — a different domain is a removal, then a new POST.
|
|
517
|
-
body: (values == null ? void 0 : values.id) ? { address: address || "hello" } : {
|
|
515
|
+
body: (values == null ? void 0 : values.id) ? { address: address || "hello" } : {},
|
|
518
516
|
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/identity/email",
|
|
519
517
|
method: (values == null ? void 0 : values.id) ? "PUT" : "POST"
|
|
520
518
|
});
|
|
@@ -523,23 +521,35 @@ const FormOrganizationIdentityEmail = ({
|
|
|
523
521
|
onError(error);
|
|
524
522
|
}
|
|
525
523
|
};
|
|
526
|
-
if (!(values == null ? void 0 : values.id) && !((_a = values == null ? void 0 : values.address) == null ? void 0 : _a.address)) {
|
|
527
|
-
return /* @__PURE__ */
|
|
524
|
+
if (!(values == null ? void 0 : values.id) && (!((_a = values == null ? void 0 : values.address) == null ? void 0 : _a.address) || !website)) {
|
|
525
|
+
return /* @__PURE__ */ jsxs(
|
|
528
526
|
"div",
|
|
529
527
|
{
|
|
530
528
|
...{
|
|
531
|
-
className: "p-6"
|
|
529
|
+
className: "p-6 space-y-4"
|
|
532
530
|
},
|
|
533
|
-
children:
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
531
|
+
children: [
|
|
532
|
+
!website && /* @__PURE__ */ jsx(
|
|
533
|
+
CardTask,
|
|
534
|
+
{
|
|
535
|
+
...{
|
|
536
|
+
// The api's WEBSITE_REQUIRED, word for word.
|
|
537
|
+
message: "You must add your website",
|
|
538
|
+
type: "error"
|
|
539
|
+
}
|
|
540
540
|
}
|
|
541
|
-
|
|
542
|
-
|
|
541
|
+
),
|
|
542
|
+
!((_b = values == null ? void 0 : values.address) == null ? void 0 : _b.address) && /* @__PURE__ */ jsx(
|
|
543
|
+
CardTask,
|
|
544
|
+
{
|
|
545
|
+
...{
|
|
546
|
+
// The api's BUSINESS_ADDRESS_REQUIRED, word for word.
|
|
547
|
+
message: "You must add your business address",
|
|
548
|
+
type: "error"
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
)
|
|
552
|
+
]
|
|
543
553
|
}
|
|
544
554
|
);
|
|
545
555
|
}
|
|
@@ -580,7 +590,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
580
590
|
...{
|
|
581
591
|
index: 1,
|
|
582
592
|
state: states.address,
|
|
583
|
-
title: (values == null ? void 0 : values.id) ? "Your email address" : "
|
|
593
|
+
title: (values == null ? void 0 : values.id) ? "Your email address" : "Your domain"
|
|
584
594
|
},
|
|
585
595
|
children: /* @__PURE__ */ jsxs(
|
|
586
596
|
Fieldset,
|
|
@@ -590,35 +600,20 @@ const FormOrganizationIdentityEmail = ({
|
|
|
590
600
|
},
|
|
591
601
|
children: [
|
|
592
602
|
!(values == null ? void 0 : values.id) ? /* @__PURE__ */ jsx(
|
|
593
|
-
|
|
603
|
+
InputGroup,
|
|
594
604
|
{
|
|
595
605
|
...{
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
{
|
|
603
|
-
...{
|
|
604
|
-
error: (_b2 = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.domain) == null ? void 0 : _b2.message,
|
|
605
|
-
input: /* @__PURE__ */ jsx(
|
|
606
|
-
InputText,
|
|
607
|
-
{
|
|
608
|
-
...{
|
|
609
|
-
onChange,
|
|
610
|
-
placeholder: "yourbrand.com",
|
|
611
|
-
type: "text",
|
|
612
|
-
value: value || ""
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
),
|
|
616
|
-
label: "Domain",
|
|
617
|
-
message: "A domain you own and can add DNS records to."
|
|
618
|
-
}
|
|
606
|
+
input: /* @__PURE__ */ jsx(
|
|
607
|
+
InputText,
|
|
608
|
+
{
|
|
609
|
+
...{
|
|
610
|
+
readOnly: true,
|
|
611
|
+
value: website
|
|
619
612
|
}
|
|
620
|
-
|
|
621
|
-
|
|
613
|
+
}
|
|
614
|
+
),
|
|
615
|
+
label: "Domain",
|
|
616
|
+
message: "Your website's domain. To use another, change Website in the Business section first."
|
|
622
617
|
}
|
|
623
618
|
}
|
|
624
619
|
) : /* @__PURE__ */ jsx(
|
|
@@ -684,7 +679,7 @@ const FormOrganizationIdentityEmail = ({
|
|
|
684
679
|
CardTask,
|
|
685
680
|
{
|
|
686
681
|
...{
|
|
687
|
-
message: ((
|
|
682
|
+
message: ((_d = (_c = values == null ? void 0 : values.errors) == null ? void 0 : _c[0]) == null ? void 0 : _d.message) || "We could not find the records. Check them and try again.",
|
|
688
683
|
type: "error"
|
|
689
684
|
}
|
|
690
685
|
}
|