@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
|
@@ -2,8 +2,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import Image from "next/image";
|
|
3
3
|
import Link from "./link.mjs";
|
|
4
4
|
import { Fragment, useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
-
import { constants } from "@drawbridge/drawbridge-utils";
|
|
6
|
-
import {
|
|
5
|
+
import { constants, getPlanFeature } from "@drawbridge/drawbridge-utils";
|
|
6
|
+
import { organization as organizationFeatures } from "@drawbridge/drawbridge-utils/features";
|
|
7
|
+
import { isTransientError, request } from "@drawbridge/drawbridge-utils/fetch";
|
|
7
8
|
import { escapeHtml } from "@drawbridge/drawbridge-utils/html";
|
|
8
9
|
import { useForm, useWatch, Controller } from "../shared/lib/form.mjs";
|
|
9
10
|
import { keepPreviousData, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
@@ -23,12 +24,13 @@ import Badge from "../shared/badge.mjs";
|
|
|
23
24
|
import InputSwitch from "../shared/input-switch.mjs";
|
|
24
25
|
import CardSection from "./card-section.mjs";
|
|
25
26
|
import Accordion from "./accordion.mjs";
|
|
26
|
-
import Preview from "./preview.mjs";
|
|
27
|
+
import Preview, { Mail, NoPreview, SliderLayout, useCard } from "./preview.mjs";
|
|
27
28
|
import CardTask from "./card-task.mjs";
|
|
28
29
|
import { LoaderDynamic } from "../shared/loader.mjs";
|
|
29
30
|
import { smsBrandLine, smsNumberActive } from "./lib/sms.mjs";
|
|
30
31
|
import Trash from "../icons/trash.mjs";
|
|
31
32
|
import Button from "../shared/button.mjs";
|
|
33
|
+
import { hasCapability } from "../shared/lib/helpers.mjs";
|
|
32
34
|
const emailSteps = ["step.email.send"];
|
|
33
35
|
const teamSteps = ["step.email.notify"];
|
|
34
36
|
const messageSteps = [...emailSteps, "step.sms.send"];
|
|
@@ -59,6 +61,10 @@ const memberParams = {
|
|
|
59
61
|
createdAt: -1
|
|
60
62
|
}
|
|
61
63
|
};
|
|
64
|
+
const listsMembers = (organization) => {
|
|
65
|
+
var _a;
|
|
66
|
+
return hasCapability(organization, "members") && (getPlanFeature(organization == null ? void 0 : organization.plan, organizationFeatures.members.key).granted || ((_a = organization == null ? void 0 : organization.totals) == null ? void 0 : _a.members) > 0);
|
|
67
|
+
};
|
|
62
68
|
const memberOptions = (organization) => ({
|
|
63
69
|
queryKey: ["organization-members", organization, "options"],
|
|
64
70
|
queryFn: async () => {
|
|
@@ -71,11 +77,11 @@ const memberOptions = (organization) => ({
|
|
|
71
77
|
},
|
|
72
78
|
staleTime: Infinity
|
|
73
79
|
});
|
|
74
|
-
const useOrganizationMembers = (organization) => {
|
|
80
|
+
const useOrganizationMembers = (organization, listed) => {
|
|
75
81
|
var _a;
|
|
76
82
|
const members = useQuery({
|
|
77
83
|
...memberOptions(organization),
|
|
78
|
-
enabled: Boolean(organization)
|
|
84
|
+
enabled: Boolean(organization) && listed
|
|
79
85
|
});
|
|
80
86
|
return {
|
|
81
87
|
items: ((_a = members.data) == null ? void 0 : _a.items) || [],
|
|
@@ -338,9 +344,10 @@ const workflowSchema = yup.object({
|
|
|
338
344
|
)
|
|
339
345
|
});
|
|
340
346
|
const useEmailPreview = ({ campaign, event, message, organization, subject, text, type }) => {
|
|
347
|
+
const queryClient = useQueryClient();
|
|
341
348
|
const asked = JSON.stringify(teamSteps.includes(type) ? { type } : { message, subject, text });
|
|
342
349
|
const [settled, setSettled] = useState(asked);
|
|
343
|
-
const
|
|
350
|
+
const held = ["workflow-email-preview-shown", organization, campaign, event, type || null];
|
|
344
351
|
useEffect(() => {
|
|
345
352
|
const timer = setTimeout(() => setSettled(asked), 400);
|
|
346
353
|
return () => clearTimeout(timer);
|
|
@@ -354,22 +361,33 @@ const useEmailPreview = ({ campaign, event, message, organization, subject, text
|
|
|
354
361
|
endpoint: "/organization/" + organization + "/campaign/" + campaign + "/workflow/" + event + "/preview",
|
|
355
362
|
method: "POST"
|
|
356
363
|
});
|
|
364
|
+
queryClient.setQueryData(held, result);
|
|
357
365
|
return result;
|
|
358
366
|
},
|
|
359
367
|
// Stale at once ( the dashboard's default is never ): the key holds the
|
|
360
368
|
// step's copy only, and the placeholder under it is the campaign's, so
|
|
361
369
|
// each visit to the trigger page asks again (Asana 1217773117236699).
|
|
362
370
|
queryKey: ["workflow-email-preview", organization, campaign, event, settled],
|
|
371
|
+
retry: (count, error) => count < 5 && isTransientError(error),
|
|
363
372
|
staleTime: 0
|
|
364
373
|
});
|
|
365
|
-
|
|
366
|
-
return last.current;
|
|
374
|
+
return preview.data || queryClient.getQueryData(held);
|
|
367
375
|
};
|
|
376
|
+
const Shown = ({ children, off }) => /* @__PURE__ */ jsx(
|
|
377
|
+
"div",
|
|
378
|
+
{
|
|
379
|
+
...{
|
|
380
|
+
className: "mx-auto w-full max-w-[600px] px-6 space-y-4" + (off ? " opacity-50" : "")
|
|
381
|
+
},
|
|
382
|
+
children
|
|
383
|
+
}
|
|
384
|
+
);
|
|
368
385
|
const EmailStepCard = ({
|
|
369
386
|
card,
|
|
370
387
|
children,
|
|
371
388
|
control,
|
|
372
389
|
off,
|
|
390
|
+
slide,
|
|
373
391
|
email: {
|
|
374
392
|
campaign,
|
|
375
393
|
event,
|
|
@@ -384,12 +402,14 @@ const EmailStepCard = ({
|
|
|
384
402
|
name: [name + ".subject", name + ".message", name + ".text"]
|
|
385
403
|
});
|
|
386
404
|
const preview = useEmailPreview({ campaign, event, message, organization, subject, text, type });
|
|
405
|
+
const target = useCard(slide);
|
|
387
406
|
return /* @__PURE__ */ jsxs(
|
|
388
407
|
CardSection,
|
|
389
408
|
{
|
|
390
409
|
...{
|
|
391
410
|
...card,
|
|
392
|
-
|
|
411
|
+
...target.props,
|
|
412
|
+
className: "relative shrink-0" + target.className
|
|
393
413
|
},
|
|
394
414
|
children: [
|
|
395
415
|
/* @__PURE__ */ jsxs(
|
|
@@ -423,46 +443,36 @@ const EmailStepCard = ({
|
|
|
423
443
|
}
|
|
424
444
|
),
|
|
425
445
|
/* @__PURE__ */ jsx(
|
|
426
|
-
|
|
446
|
+
Preview,
|
|
427
447
|
{
|
|
428
448
|
...{
|
|
429
|
-
|
|
449
|
+
id: slide
|
|
430
450
|
},
|
|
431
|
-
children: /* @__PURE__ */ jsx(
|
|
432
|
-
|
|
451
|
+
children: /* @__PURE__ */ jsx(
|
|
452
|
+
Shown,
|
|
433
453
|
{
|
|
434
454
|
...{
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
455
|
+
off
|
|
456
|
+
},
|
|
457
|
+
children: /* @__PURE__ */ jsx(
|
|
458
|
+
Mail,
|
|
459
|
+
{
|
|
460
|
+
...{
|
|
461
|
+
// The rendered email, as a mail app shows it.
|
|
462
|
+
html: preview == null ? void 0 : preview.html,
|
|
463
|
+
title
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
)
|
|
440
467
|
}
|
|
441
|
-
)
|
|
468
|
+
)
|
|
442
469
|
}
|
|
443
470
|
)
|
|
444
471
|
]
|
|
445
472
|
}
|
|
446
473
|
);
|
|
447
474
|
};
|
|
448
|
-
const
|
|
449
|
-
email: "sam.rivera@example.com",
|
|
450
|
-
name: "Sam Rivera",
|
|
451
|
-
phone: "+14165550142"
|
|
452
|
-
};
|
|
453
|
-
const webhookSample = ({ campaign }) => JSON.stringify({
|
|
454
|
-
campaign: {
|
|
455
|
-
id: (campaign == null ? void 0 : campaign.id) || "cmp_sample",
|
|
456
|
-
title: (campaign == null ? void 0 : campaign.title) || "Your campaign"
|
|
457
|
-
},
|
|
458
|
-
email: SAMPLE.email,
|
|
459
|
-
id: "lead_sample",
|
|
460
|
-
name: SAMPLE.name,
|
|
461
|
-
phone: {
|
|
462
|
-
number: SAMPLE.phone
|
|
463
|
-
}
|
|
464
|
-
}, null, 2);
|
|
465
|
-
const TextPreview = ({ children }) => /* @__PURE__ */ jsx("div", { className: "p-6 font-sans", children: /* @__PURE__ */ jsx("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-gray-light text-black break-words", children }) });
|
|
475
|
+
const TextPreview = ({ children }) => /* @__PURE__ */ jsx("div", { className: "p-6 font-sans", children: /* @__PURE__ */ jsx("div", { className: "max-w-xs px-4 py-3 rounded-2xl rounded-bl-sm bg-white text-black break-words", children }) });
|
|
466
476
|
const StepPreview = ({ campaign, control, image, name, organization, type }) => {
|
|
467
477
|
const [message] = useWatch({
|
|
468
478
|
control,
|
|
@@ -475,23 +485,20 @@ const StepPreview = ({ campaign, control, image, name, organization, type }) =>
|
|
|
475
485
|
(campaign == null ? void 0 : campaign.awarding) && /* @__PURE__ */ jsx("p", { className: "mt-2 px-2 py-1 rounded border border-dashed border-gray-dark text-gray-dark", children: "The entrant's missions appear here" }),
|
|
476
486
|
/* @__PURE__ */ jsx("p", { className: "mt-2", children: "Reply STOP to opt out" })
|
|
477
487
|
] });
|
|
478
|
-
if (type === "step.webhook.send") return /* @__PURE__ */ jsx(
|
|
479
|
-
return /* @__PURE__ */
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
{
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
width: 48
|
|
490
|
-
}
|
|
488
|
+
if (type === "step.webhook.send") return /* @__PURE__ */ jsx(NoPreview, {});
|
|
489
|
+
return /* @__PURE__ */ jsx(NoPreview, { children: image && /* @__PURE__ */ jsx(
|
|
490
|
+
Image,
|
|
491
|
+
{
|
|
492
|
+
...{
|
|
493
|
+
alt: "",
|
|
494
|
+
className: "w-12 h-12 object-contain",
|
|
495
|
+
height: 48,
|
|
496
|
+
src: image,
|
|
497
|
+
unoptimized: true,
|
|
498
|
+
width: 48
|
|
491
499
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
] });
|
|
500
|
+
}
|
|
501
|
+
) });
|
|
495
502
|
};
|
|
496
503
|
const LeadEmailNote = () => /* @__PURE__ */ jsx(
|
|
497
504
|
"p",
|
|
@@ -537,6 +544,7 @@ const ResponseStepCard = ({
|
|
|
537
544
|
formState,
|
|
538
545
|
off,
|
|
539
546
|
onChecking,
|
|
547
|
+
slide,
|
|
540
548
|
response: {
|
|
541
549
|
autoResponse,
|
|
542
550
|
campaign,
|
|
@@ -545,6 +553,8 @@ const ResponseStepCard = ({
|
|
|
545
553
|
id,
|
|
546
554
|
index,
|
|
547
555
|
organization,
|
|
556
|
+
picked,
|
|
557
|
+
setPicked,
|
|
548
558
|
settings,
|
|
549
559
|
title,
|
|
550
560
|
variables
|
|
@@ -552,7 +562,6 @@ const ResponseStepCard = ({
|
|
|
552
562
|
setValue
|
|
553
563
|
}) => {
|
|
554
564
|
var _a, _b, _c, _d, _e;
|
|
555
|
-
const [picked, setPicked] = useState("email");
|
|
556
565
|
const name = `steps.${index}`;
|
|
557
566
|
const parts = responseParts({ autoResponse, campaign, organization, settings });
|
|
558
567
|
const shown = parts.sms.absent ? "email" : parts.email.hidden ? "sms" : parts.sms.hidden ? "email" : picked;
|
|
@@ -566,6 +575,7 @@ const ResponseStepCard = ({
|
|
|
566
575
|
text: (_c = settings == null ? void 0 : settings.email) == null ? void 0 : _c.text
|
|
567
576
|
});
|
|
568
577
|
const brand = smsBrandLine(title, (_d = settings == null ? void 0 : settings.sms) == null ? void 0 : _d.message);
|
|
578
|
+
const target = useCard(slide);
|
|
569
579
|
const partSwitch = ({ label, message, other, part }) => /* @__PURE__ */ jsx(
|
|
570
580
|
Controller,
|
|
571
581
|
{
|
|
@@ -605,7 +615,8 @@ const ResponseStepCard = ({
|
|
|
605
615
|
{
|
|
606
616
|
...{
|
|
607
617
|
...card,
|
|
608
|
-
|
|
618
|
+
...target.props,
|
|
619
|
+
className: "relative shrink-0" + target.className
|
|
609
620
|
},
|
|
610
621
|
children: [
|
|
611
622
|
/* @__PURE__ */ jsxs(
|
|
@@ -743,29 +754,29 @@ const ResponseStepCard = ({
|
|
|
743
754
|
}
|
|
744
755
|
),
|
|
745
756
|
/* @__PURE__ */ jsx(
|
|
746
|
-
|
|
757
|
+
Preview,
|
|
747
758
|
{
|
|
748
759
|
...{
|
|
749
|
-
|
|
760
|
+
id: slide,
|
|
761
|
+
...!parts.email.hidden && !parts.sms.hidden && {
|
|
762
|
+
states: {
|
|
763
|
+
onChange: setPicked,
|
|
764
|
+
options: RESPONSE_STATES,
|
|
765
|
+
value: shown
|
|
766
|
+
}
|
|
767
|
+
}
|
|
750
768
|
},
|
|
751
769
|
children: /* @__PURE__ */ jsx(
|
|
752
|
-
|
|
770
|
+
Shown,
|
|
753
771
|
{
|
|
754
772
|
...{
|
|
755
|
-
|
|
756
|
-
states: {
|
|
757
|
-
onChange: setPicked,
|
|
758
|
-
options: RESPONSE_STATES,
|
|
759
|
-
value: shown
|
|
760
|
-
}
|
|
761
|
-
}
|
|
773
|
+
off: off || !parts[shown].on
|
|
762
774
|
},
|
|
763
775
|
children: shown === "email" ? /* @__PURE__ */ jsx(
|
|
764
|
-
|
|
776
|
+
Mail,
|
|
765
777
|
{
|
|
766
778
|
...{
|
|
767
|
-
|
|
768
|
-
srcDoc: (preview == null ? void 0 : preview.html) || "",
|
|
779
|
+
html: preview == null ? void 0 : preview.html,
|
|
769
780
|
title: "Auto response"
|
|
770
781
|
}
|
|
771
782
|
}
|
|
@@ -799,6 +810,54 @@ const ResponseStepCard = ({
|
|
|
799
810
|
}
|
|
800
811
|
);
|
|
801
812
|
};
|
|
813
|
+
const PlainStepCard = ({
|
|
814
|
+
children,
|
|
815
|
+
control,
|
|
816
|
+
off,
|
|
817
|
+
preview,
|
|
818
|
+
slide,
|
|
819
|
+
...card
|
|
820
|
+
}) => {
|
|
821
|
+
const target = useCard(slide);
|
|
822
|
+
return /* @__PURE__ */ jsxs(
|
|
823
|
+
CardSection,
|
|
824
|
+
{
|
|
825
|
+
...{
|
|
826
|
+
...card,
|
|
827
|
+
...target.props,
|
|
828
|
+
className: "relative shrink-0" + target.className
|
|
829
|
+
},
|
|
830
|
+
children: [
|
|
831
|
+
children,
|
|
832
|
+
/* @__PURE__ */ jsx(
|
|
833
|
+
Preview,
|
|
834
|
+
{
|
|
835
|
+
...{
|
|
836
|
+
id: slide
|
|
837
|
+
},
|
|
838
|
+
children: /* @__PURE__ */ jsx(
|
|
839
|
+
Shown,
|
|
840
|
+
{
|
|
841
|
+
...{
|
|
842
|
+
off
|
|
843
|
+
},
|
|
844
|
+
children: preview ? /* @__PURE__ */ jsx(
|
|
845
|
+
StepPreview,
|
|
846
|
+
{
|
|
847
|
+
...{
|
|
848
|
+
control,
|
|
849
|
+
...preview
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
) : /* @__PURE__ */ jsx(NoPreview, {})
|
|
853
|
+
}
|
|
854
|
+
)
|
|
855
|
+
}
|
|
856
|
+
)
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
);
|
|
860
|
+
};
|
|
802
861
|
const StepCard = ({
|
|
803
862
|
children,
|
|
804
863
|
control,
|
|
@@ -810,6 +869,7 @@ const StepCard = ({
|
|
|
810
869
|
preview,
|
|
811
870
|
response,
|
|
812
871
|
setValue,
|
|
872
|
+
slide,
|
|
813
873
|
...card
|
|
814
874
|
}) => response ? /* @__PURE__ */ jsx(
|
|
815
875
|
ResponseStepCard,
|
|
@@ -822,7 +882,8 @@ const StepCard = ({
|
|
|
822
882
|
off,
|
|
823
883
|
onChecking,
|
|
824
884
|
response,
|
|
825
|
-
setValue
|
|
885
|
+
setValue,
|
|
886
|
+
slide
|
|
826
887
|
},
|
|
827
888
|
children
|
|
828
889
|
}
|
|
@@ -833,37 +894,22 @@ const StepCard = ({
|
|
|
833
894
|
card,
|
|
834
895
|
control,
|
|
835
896
|
email,
|
|
836
|
-
off
|
|
897
|
+
off,
|
|
898
|
+
slide
|
|
837
899
|
},
|
|
838
900
|
children
|
|
839
901
|
}
|
|
840
|
-
) : /* @__PURE__ */
|
|
841
|
-
|
|
902
|
+
) : /* @__PURE__ */ jsx(
|
|
903
|
+
PlainStepCard,
|
|
842
904
|
{
|
|
843
905
|
...{
|
|
844
906
|
...card,
|
|
845
|
-
|
|
907
|
+
control,
|
|
908
|
+
off,
|
|
909
|
+
preview,
|
|
910
|
+
slide
|
|
846
911
|
},
|
|
847
|
-
children
|
|
848
|
-
children,
|
|
849
|
-
preview && /* @__PURE__ */ jsx(
|
|
850
|
-
"div",
|
|
851
|
-
{
|
|
852
|
-
...{
|
|
853
|
-
className: off ? "opacity-50" : ""
|
|
854
|
-
},
|
|
855
|
-
children: /* @__PURE__ */ jsx(Preview, { children: /* @__PURE__ */ jsx(
|
|
856
|
-
StepPreview,
|
|
857
|
-
{
|
|
858
|
-
...{
|
|
859
|
-
control,
|
|
860
|
-
...preview
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
) })
|
|
864
|
-
}
|
|
865
|
-
)
|
|
866
|
-
]
|
|
912
|
+
children
|
|
867
913
|
}
|
|
868
914
|
);
|
|
869
915
|
const FormOrganizationWorkflowEdit = ({
|
|
@@ -875,9 +921,10 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
875
921
|
}) => {
|
|
876
922
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
877
923
|
const event = (_a = values == null ? void 0 : values.trigger) == null ? void 0 : _a.event;
|
|
878
|
-
const { items: memberItems, loading: membersLoading } = useOrganizationMembers(values == null ? void 0 : values.organization);
|
|
879
924
|
const queryClient = useQueryClient();
|
|
880
925
|
const organizationData = queryClient.getQueryData(["organization", values == null ? void 0 : values.organization]);
|
|
926
|
+
const membersListed = listsMembers(organizationData);
|
|
927
|
+
const { items: memberItems, loading: membersLoading } = useOrganizationMembers(values == null ? void 0 : values.organization, membersListed);
|
|
881
928
|
const ownerEmail = organizationData.owner.email;
|
|
882
929
|
const smsActive = smsNumberActive(organizationData);
|
|
883
930
|
const campaignData = queryClient.getQueryData(["campaign", values == null ? void 0 : values.campaign]);
|
|
@@ -898,6 +945,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
898
945
|
const commerceDomain = ((_d = (_c = commerceConnection.data) == null ? void 0 : _c.source) == null ? void 0 : _d.domain) || ((_f = (_e = commerceConnection.data) == null ? void 0 : _e.settings) == null ? void 0 : _f.domain) || null;
|
|
899
946
|
const defaultSteps = ((values == null ? void 0 : values.steps) || []).map((s) => stepRow(s, memberItems));
|
|
900
947
|
const [checking, setChecking] = useState({});
|
|
948
|
+
const [responsePart, setResponsePart] = useState("email");
|
|
901
949
|
const checkingAny = Object.values(checking).some(Boolean);
|
|
902
950
|
const onChecking = useCallback(
|
|
903
951
|
(id, value) => setChecking(
|
|
@@ -905,16 +953,13 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
905
953
|
),
|
|
906
954
|
[]
|
|
907
955
|
);
|
|
908
|
-
const { control, formState, getValues, handleSubmit, setValue } = useForm({
|
|
956
|
+
const { control, formState, getValues, handleSubmit, reset, setValue, watch } = useForm({
|
|
909
957
|
values: {
|
|
910
958
|
steps: defaultSteps
|
|
911
959
|
},
|
|
912
960
|
resolver: resolver(workflowSchema)
|
|
913
961
|
});
|
|
914
|
-
const watchedSteps =
|
|
915
|
-
control,
|
|
916
|
-
name: "steps"
|
|
917
|
-
});
|
|
962
|
+
const watchedSteps = watch("steps");
|
|
918
963
|
const issueIndex = issueRow({ issue: values == null ? void 0 : values.issue, steps: watchedSteps || [] });
|
|
919
964
|
const getAvailableVariables = (index) => stepVariables(catalog, watchedSteps, index);
|
|
920
965
|
const loading = membersLoading || commerceConnection.isLoading;
|
|
@@ -1102,6 +1147,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1102
1147
|
setValue("steps." + index + ".connectionId", step.connectionId || "");
|
|
1103
1148
|
setValue("steps." + index + ".slug", step.slug || "");
|
|
1104
1149
|
});
|
|
1150
|
+
reset(getValues());
|
|
1105
1151
|
onSuccess(response);
|
|
1106
1152
|
} catch (error) {
|
|
1107
1153
|
onError(error);
|
|
@@ -1110,6 +1156,13 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1110
1156
|
if (loading) {
|
|
1111
1157
|
return /* @__PURE__ */ jsx(LoaderDynamic, {});
|
|
1112
1158
|
}
|
|
1159
|
+
const slides = (watchedSteps || []).map((step, index) => {
|
|
1160
|
+
var _a2;
|
|
1161
|
+
return {
|
|
1162
|
+
id: "step-" + index,
|
|
1163
|
+
title: ["Step " + (index + 1), (_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === (step == null ? void 0 : step.type))) == null ? void 0 : _a2.key].filter(Boolean).join(" \xB7 ")
|
|
1164
|
+
};
|
|
1165
|
+
});
|
|
1113
1166
|
return /* @__PURE__ */ jsx(
|
|
1114
1167
|
Form,
|
|
1115
1168
|
{
|
|
@@ -1117,484 +1170,488 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1117
1170
|
className: "relative w-full",
|
|
1118
1171
|
onSubmit: handleSubmit(onSubmit)
|
|
1119
1172
|
},
|
|
1120
|
-
children: /* @__PURE__ */
|
|
1121
|
-
|
|
1173
|
+
children: /* @__PURE__ */ jsx(
|
|
1174
|
+
SliderLayout,
|
|
1122
1175
|
{
|
|
1123
1176
|
...{
|
|
1124
|
-
|
|
1177
|
+
plain: true,
|
|
1178
|
+
slides
|
|
1125
1179
|
},
|
|
1126
|
-
children:
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
{
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
"p",
|
|
1148
|
-
{
|
|
1149
|
-
...{
|
|
1150
|
-
className: "text-sm text-gray-dark"
|
|
1151
|
-
},
|
|
1152
|
-
children: values.description
|
|
1153
|
-
}
|
|
1154
|
-
)
|
|
1155
|
-
]
|
|
1156
|
-
}
|
|
1157
|
-
),
|
|
1158
|
-
/* @__PURE__ */ jsx(
|
|
1159
|
-
InputGroup,
|
|
1160
|
-
{
|
|
1161
|
-
...{
|
|
1162
|
-
error: (_h = (_g = formState == null ? void 0 : formState.errors) == null ? void 0 : _g.steps) == null ? void 0 : _h.message,
|
|
1163
|
-
input: /* @__PURE__ */ jsx(
|
|
1164
|
-
InputArraySortable,
|
|
1165
|
-
{
|
|
1166
|
-
...{
|
|
1167
|
-
control,
|
|
1168
|
-
empty: null,
|
|
1169
|
-
name: "steps",
|
|
1170
|
-
renderButton: (append) => /* @__PURE__ */ jsx(
|
|
1171
|
-
InputArrayButton,
|
|
1172
|
-
{
|
|
1173
|
-
...{
|
|
1174
|
-
disabled: !canAddStep,
|
|
1175
|
-
onClick: () => append(stepRow()),
|
|
1176
|
-
text: "Add step"
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
)
|
|
1180
|
-
},
|
|
1181
|
-
children: ({ field, handle, index, remove }) => {
|
|
1182
|
-
var _a2;
|
|
1183
|
-
const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
|
|
1184
|
-
const parts = step.type === RESPONSE && responseParts({
|
|
1185
|
-
autoResponse: values == null ? void 0 : values.autoResponse,
|
|
1186
|
-
campaign: values == null ? void 0 : values.campaign,
|
|
1187
|
-
organization: values == null ? void 0 : values.organization,
|
|
1188
|
-
settings: step.settings
|
|
1189
|
-
});
|
|
1190
|
-
const stepOptions = getStepOptions(index);
|
|
1191
|
-
return (
|
|
1192
|
-
// @story workflows/edit
|
|
1193
|
-
// EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
|
|
1194
|
-
// edited in place: the drag handle left of Step N, as every
|
|
1195
|
-
// sortable list has it, then its connection badge and Remove
|
|
1196
|
-
// in the card's head, its fields in the body.
|
|
1197
|
-
/* @__PURE__ */ jsx(
|
|
1198
|
-
StepCard,
|
|
1180
|
+
children: /* @__PURE__ */ jsx(
|
|
1181
|
+
Fieldset,
|
|
1182
|
+
{
|
|
1183
|
+
...{
|
|
1184
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
1185
|
+
},
|
|
1186
|
+
children: /* @__PURE__ */ jsxs(
|
|
1187
|
+
CardSection,
|
|
1188
|
+
{
|
|
1189
|
+
...{
|
|
1190
|
+
title: "Sequence",
|
|
1191
|
+
variant: "gray"
|
|
1192
|
+
},
|
|
1193
|
+
children: [
|
|
1194
|
+
/* @__PURE__ */ jsx(
|
|
1195
|
+
InputGroup,
|
|
1196
|
+
{
|
|
1197
|
+
...{
|
|
1198
|
+
error: (_h = (_g = formState == null ? void 0 : formState.errors) == null ? void 0 : _g.steps) == null ? void 0 : _h.message,
|
|
1199
|
+
input: /* @__PURE__ */ jsx(
|
|
1200
|
+
InputArraySortable,
|
|
1199
1201
|
{
|
|
1200
1202
|
...{
|
|
1201
1203
|
control,
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
response: step.type === RESPONSE && {
|
|
1208
|
-
autoResponse: values == null ? void 0 : values.autoResponse,
|
|
1209
|
-
campaign: values == null ? void 0 : values.campaign,
|
|
1210
|
-
enabled: step.enabled,
|
|
1211
|
-
event,
|
|
1212
|
-
id: field.id,
|
|
1213
|
-
index,
|
|
1214
|
-
organization: values == null ? void 0 : values.organization,
|
|
1215
|
-
settings: step.settings,
|
|
1216
|
-
title: organizationData == null ? void 0 : organizationData.title,
|
|
1217
|
-
variables: getAvailableVariables(index)
|
|
1218
|
-
},
|
|
1219
|
-
// @story workflows/send-email
|
|
1220
|
-
// A Send email step shows its email beside its form.
|
|
1221
|
-
off: step.enabled === false,
|
|
1222
|
-
// Every other step with a type has its preview too.
|
|
1223
|
-
preview: step.type && !renderedSteps.includes(step.type) && {
|
|
1224
|
-
campaign: campaignData,
|
|
1225
|
-
image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
|
|
1226
|
-
name: `steps.${index}`,
|
|
1227
|
-
organization: organizationData,
|
|
1228
|
-
type: step.type
|
|
1204
|
+
empty: null,
|
|
1205
|
+
// Each handle says which step it moves.
|
|
1206
|
+
handleLabel: (field) => {
|
|
1207
|
+
var _a2;
|
|
1208
|
+
return "Move " + (((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === (field == null ? void 0 : field.type))) == null ? void 0 : _a2.key) || "step");
|
|
1229
1209
|
},
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
event,
|
|
1234
|
-
name: `steps.${index}`,
|
|
1235
|
-
organization: values == null ? void 0 : values.organization,
|
|
1236
|
-
title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
|
|
1237
|
-
type: step.type
|
|
1238
|
-
},
|
|
1239
|
-
cta: /* @__PURE__ */ jsxs(
|
|
1240
|
-
"span",
|
|
1210
|
+
name: "steps",
|
|
1211
|
+
renderButton: (append) => /* @__PURE__ */ jsx(
|
|
1212
|
+
InputArrayButton,
|
|
1241
1213
|
{
|
|
1242
1214
|
...{
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1215
|
+
disabled: !canAddStep,
|
|
1216
|
+
onClick: () => append(stepRow()),
|
|
1217
|
+
text: "Add step"
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
)
|
|
1221
|
+
},
|
|
1222
|
+
children: ({ field, handle, index, remove }) => {
|
|
1223
|
+
var _a2;
|
|
1224
|
+
const step = (watchedSteps == null ? void 0 : watchedSteps[index]) || field;
|
|
1225
|
+
const parts = step.type === RESPONSE && responseParts({
|
|
1226
|
+
autoResponse: values == null ? void 0 : values.autoResponse,
|
|
1227
|
+
campaign: values == null ? void 0 : values.campaign,
|
|
1228
|
+
organization: values == null ? void 0 : values.organization,
|
|
1229
|
+
settings: step.settings
|
|
1230
|
+
});
|
|
1231
|
+
const stepOptions = getStepOptions(index);
|
|
1232
|
+
return (
|
|
1233
|
+
// @story workflows/edit
|
|
1234
|
+
// EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
|
|
1235
|
+
// edited in place: the drag handle left of Step N, as every
|
|
1236
|
+
// sortable list has it, then its connection badge and Remove
|
|
1237
|
+
// in the card's head, its fields in the body.
|
|
1238
|
+
/* @__PURE__ */ jsx(
|
|
1239
|
+
StepCard,
|
|
1240
|
+
{
|
|
1241
|
+
...{
|
|
1242
|
+
control,
|
|
1243
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
|
|
1244
|
+
formState,
|
|
1245
|
+
onChecking,
|
|
1246
|
+
setValue,
|
|
1247
|
+
// @story workflows/auto-response
|
|
1248
|
+
response: step.type === RESPONSE && {
|
|
1249
|
+
autoResponse: values == null ? void 0 : values.autoResponse,
|
|
1250
|
+
campaign: values == null ? void 0 : values.campaign,
|
|
1251
|
+
enabled: step.enabled,
|
|
1252
|
+
event,
|
|
1253
|
+
id: field.id,
|
|
1254
|
+
index,
|
|
1255
|
+
organization: values == null ? void 0 : values.organization,
|
|
1256
|
+
picked: responsePart,
|
|
1257
|
+
setPicked: setResponsePart,
|
|
1258
|
+
settings: step.settings,
|
|
1259
|
+
title: organizationData == null ? void 0 : organizationData.title,
|
|
1260
|
+
variables: getAvailableVariables(index)
|
|
1254
1261
|
},
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
{
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1262
|
+
// @story workflows/send-email
|
|
1263
|
+
// A Send email step shows its email beside its form.
|
|
1264
|
+
off: step.enabled === false,
|
|
1265
|
+
// Every other step with a type has its preview too.
|
|
1266
|
+
preview: step.type && !renderedSteps.includes(step.type) && {
|
|
1267
|
+
campaign: campaignData,
|
|
1268
|
+
image: ((_a2 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a2.image) || null,
|
|
1269
|
+
name: `steps.${index}`,
|
|
1270
|
+
organization: organizationData,
|
|
1271
|
+
type: step.type
|
|
1272
|
+
},
|
|
1273
|
+
// Send email and Email notification show the email the api renders.
|
|
1274
|
+
email: renderedSteps.includes(step.type) && {
|
|
1275
|
+
campaign: values == null ? void 0 : values.campaign,
|
|
1276
|
+
event,
|
|
1277
|
+
name: `steps.${index}`,
|
|
1278
|
+
organization: values == null ? void 0 : values.organization,
|
|
1279
|
+
title: emailSteps.includes(step.type) ? "Send email" : "Email notification",
|
|
1280
|
+
type: step.type
|
|
1281
|
+
},
|
|
1282
|
+
cta: /* @__PURE__ */ jsxs(
|
|
1283
|
+
"span",
|
|
1284
|
+
{
|
|
1285
|
+
...{
|
|
1286
|
+
className: "flex items-center gap-2"
|
|
1287
|
+
},
|
|
1288
|
+
children: [
|
|
1289
|
+
renderStepBadge(step, index),
|
|
1290
|
+
!lockedStep(index) && /* @__PURE__ */ jsx(
|
|
1291
|
+
InputArrayControl,
|
|
1267
1292
|
{
|
|
1268
1293
|
...{
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1294
|
+
onClick: () => remove(index),
|
|
1295
|
+
icon: Trash
|
|
1296
|
+
}
|
|
1297
|
+
},
|
|
1298
|
+
"remove"
|
|
1299
|
+
),
|
|
1300
|
+
/* @__PURE__ */ jsx(
|
|
1301
|
+
Controller,
|
|
1302
|
+
{
|
|
1303
|
+
...{
|
|
1304
|
+
control,
|
|
1305
|
+
name: `steps.${index}.enabled`,
|
|
1306
|
+
render: ({ field: { onChange, value } }) => {
|
|
1307
|
+
var _a3;
|
|
1308
|
+
return /* @__PURE__ */ jsx(
|
|
1309
|
+
InputSwitch,
|
|
1310
|
+
{
|
|
1311
|
+
...{
|
|
1312
|
+
"aria-label": ((_a3 = ((catalog == null ? void 0 : catalog.steps) || []).find((entry) => entry.value === step.type)) == null ? void 0 : _a3.key) || "Step " + (index + 1),
|
|
1313
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting) || lockedStep(index) || parts && !parts.can,
|
|
1314
|
+
onChange: (next) => {
|
|
1315
|
+
onChange(next);
|
|
1316
|
+
if (parts && next && partToStart(parts)) setValue(`steps.${index}.settings.${partToStart(parts)}.enabled`, true);
|
|
1317
|
+
},
|
|
1318
|
+
small: true,
|
|
1319
|
+
value: value !== false && (!parts || parts.can)
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
);
|
|
1323
|
+
}
|
|
1277
1324
|
}
|
|
1278
1325
|
}
|
|
1279
|
-
)
|
|
1280
|
-
|
|
1326
|
+
)
|
|
1327
|
+
]
|
|
1281
1328
|
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
children: [
|
|
1310
|
-
issueIndex === index && /* @__PURE__ */ jsx(
|
|
1311
|
-
Error,
|
|
1312
|
-
{
|
|
1313
|
-
...{
|
|
1314
|
-
error: values.issue.message
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
),
|
|
1318
|
-
/* @__PURE__ */ jsx(
|
|
1319
|
-
Controller,
|
|
1320
|
-
{
|
|
1321
|
-
...{
|
|
1322
|
-
control,
|
|
1323
|
-
name: `steps.${index}.type`,
|
|
1324
|
-
render: ({ field: { onChange } }) => {
|
|
1325
|
-
var _a3, _b2, _c2, _d2;
|
|
1326
|
-
return /* @__PURE__ */ jsx(
|
|
1327
|
-
InputGroup,
|
|
1329
|
+
),
|
|
1330
|
+
"data-step": index + 1,
|
|
1331
|
+
slide: "step-" + index,
|
|
1332
|
+
title: /* @__PURE__ */ jsxs(
|
|
1333
|
+
"span",
|
|
1334
|
+
{
|
|
1335
|
+
...{
|
|
1336
|
+
className: "flex items-center gap-2"
|
|
1337
|
+
},
|
|
1338
|
+
children: [
|
|
1339
|
+
handle,
|
|
1340
|
+
"Step " + (index + 1)
|
|
1341
|
+
]
|
|
1342
|
+
}
|
|
1343
|
+
)
|
|
1344
|
+
},
|
|
1345
|
+
children: /* @__PURE__ */ jsxs(
|
|
1346
|
+
"div",
|
|
1347
|
+
{
|
|
1348
|
+
...{
|
|
1349
|
+
// A step switched off is greyed; its settings are kept.
|
|
1350
|
+
// Auto response's whole card greys, its parts as well.
|
|
1351
|
+
className: "space-y-3" + (step.enabled === false && !parts ? " opacity-50" : "")
|
|
1352
|
+
},
|
|
1353
|
+
children: [
|
|
1354
|
+
issueIndex === index && /* @__PURE__ */ jsx(
|
|
1355
|
+
Error,
|
|
1328
1356
|
{
|
|
1329
1357
|
...{
|
|
1330
|
-
error:
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1358
|
+
error: values.issue.message
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
),
|
|
1362
|
+
/* @__PURE__ */ jsx(
|
|
1363
|
+
Controller,
|
|
1364
|
+
{
|
|
1365
|
+
...{
|
|
1366
|
+
control,
|
|
1367
|
+
name: `steps.${index}.type`,
|
|
1368
|
+
render: ({ field: { onChange } }) => {
|
|
1369
|
+
var _a3, _b2, _c2, _d2;
|
|
1370
|
+
return /* @__PURE__ */ jsx(
|
|
1371
|
+
InputGroup,
|
|
1372
|
+
{
|
|
1373
|
+
...{
|
|
1374
|
+
error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.type) == null ? void 0 : _d2.message,
|
|
1375
|
+
input: /* @__PURE__ */ jsx(
|
|
1376
|
+
InputCombobox,
|
|
1377
|
+
{
|
|
1378
|
+
...{
|
|
1379
|
+
onChange: (val) => {
|
|
1380
|
+
var _a4;
|
|
1381
|
+
const [type] = val.split("::");
|
|
1382
|
+
const option = getStepOptions(index).find((o) => o.value === val);
|
|
1383
|
+
const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
|
|
1384
|
+
setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
|
|
1385
|
+
onChange(type);
|
|
1386
|
+
setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
|
|
1387
|
+
setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
|
|
1388
|
+
if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
|
|
1389
|
+
},
|
|
1390
|
+
// Locked for a member on the owner's step; disabled
|
|
1391
|
+
// with nothing left to pick.
|
|
1392
|
+
disabled: lockedStep(index) || !hasStepOptions(stepOptions),
|
|
1393
|
+
options: stepOptions,
|
|
1394
|
+
// Resolved from the WHOLE ROW, not from this path: the
|
|
1395
|
+
// option value carries a connection the type alone cannot
|
|
1396
|
+
// name.
|
|
1397
|
+
value: getStepValue(step, index)
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
),
|
|
1401
|
+
label: "Step"
|
|
1402
|
+
}
|
|
1354
1403
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
label: "Step"
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1358
1406
|
}
|
|
1359
1407
|
}
|
|
1360
|
-
)
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1373
|
-
),
|
|
1374
|
-
step.type === "step.webhook.send" && /* @__PURE__ */ jsx(
|
|
1375
|
-
Controller,
|
|
1376
|
-
{
|
|
1377
|
-
...{
|
|
1378
|
-
control,
|
|
1379
|
-
name: `steps.${index}.url`,
|
|
1380
|
-
render: ({ field: { value, onChange } }) => {
|
|
1381
|
-
var _a3, _b2, _c2, _d2;
|
|
1382
|
-
return /* @__PURE__ */ jsx(
|
|
1383
|
-
InputGroup,
|
|
1408
|
+
),
|
|
1409
|
+
firstEntryOnly({ campaign: campaignData, event, type: step.type }) && /* @__PURE__ */ jsx(
|
|
1410
|
+
"p",
|
|
1411
|
+
{
|
|
1412
|
+
...{
|
|
1413
|
+
className: "text-sm text-gray-dark"
|
|
1414
|
+
},
|
|
1415
|
+
children: "Runs on a person's first entry only."
|
|
1416
|
+
}
|
|
1417
|
+
),
|
|
1418
|
+
step.type === "step.webhook.send" && /* @__PURE__ */ jsx(
|
|
1419
|
+
Controller,
|
|
1384
1420
|
{
|
|
1385
1421
|
...{
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1422
|
+
control,
|
|
1423
|
+
name: `steps.${index}.url`,
|
|
1424
|
+
render: ({ field: { value, onChange } }) => {
|
|
1425
|
+
var _a3, _b2, _c2, _d2;
|
|
1426
|
+
return /* @__PURE__ */ jsx(
|
|
1427
|
+
InputGroup,
|
|
1428
|
+
{
|
|
1429
|
+
...{
|
|
1430
|
+
error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.url) == null ? void 0 : _d2.message,
|
|
1431
|
+
input: /* @__PURE__ */ jsx(
|
|
1432
|
+
InputUrl,
|
|
1433
|
+
{
|
|
1434
|
+
...{
|
|
1435
|
+
onChange,
|
|
1436
|
+
value: value || ""
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
),
|
|
1440
|
+
label: "Webhook URL"
|
|
1441
|
+
}
|
|
1393
1442
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
label: "Webhook URL"
|
|
1443
|
+
);
|
|
1444
|
+
}
|
|
1397
1445
|
}
|
|
1398
1446
|
}
|
|
1399
|
-
)
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
),
|
|
1404
|
-
teamSteps.includes(step.type) && lockedStep(index) && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Recipients are chosen by the organization owner." }),
|
|
1405
|
-
teamSteps.includes(step.type) && !lockedStep(index) && /* @__PURE__ */ jsx(
|
|
1406
|
-
Controller,
|
|
1407
|
-
{
|
|
1408
|
-
...{
|
|
1409
|
-
control,
|
|
1410
|
-
name: `steps.${index}.members`,
|
|
1411
|
-
render: ({ field: { value, onChange } }) => {
|
|
1412
|
-
var _a3, _b2, _c2, _d2;
|
|
1413
|
-
return /* @__PURE__ */ jsx(
|
|
1414
|
-
InputGroup,
|
|
1447
|
+
),
|
|
1448
|
+
teamSteps.includes(step.type) && lockedStep(index) && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Recipients are chosen by the organization owner." }),
|
|
1449
|
+
teamSteps.includes(step.type) && !lockedStep(index) && /* @__PURE__ */ jsx(
|
|
1450
|
+
Controller,
|
|
1415
1451
|
{
|
|
1416
1452
|
...{
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1453
|
+
control,
|
|
1454
|
+
name: `steps.${index}.members`,
|
|
1455
|
+
render: ({ field: { value, onChange } }) => {
|
|
1456
|
+
var _a3, _b2, _c2, _d2;
|
|
1457
|
+
return /* @__PURE__ */ jsx(
|
|
1458
|
+
InputGroup,
|
|
1459
|
+
{
|
|
1460
|
+
...{
|
|
1461
|
+
error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.members) == null ? void 0 : _d2.message,
|
|
1462
|
+
input: /* @__PURE__ */ jsx(
|
|
1463
|
+
InputResource,
|
|
1464
|
+
{
|
|
1465
|
+
...{
|
|
1466
|
+
empty: "No members to add",
|
|
1467
|
+
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/members",
|
|
1468
|
+
// The owner is a chip like the others, only it cannot be
|
|
1469
|
+
// removed: they are always a recipient and it is resolved
|
|
1470
|
+
// in sync. Shaped like a member so `render` labels it the
|
|
1471
|
+
// same way.
|
|
1472
|
+
fixed: [{ email: ownerEmail }],
|
|
1473
|
+
model: "member",
|
|
1474
|
+
multiple: true,
|
|
1475
|
+
onChange,
|
|
1476
|
+
params: memberParams,
|
|
1477
|
+
// No Add member where the list cannot be read.
|
|
1478
|
+
picker: membersListed,
|
|
1479
|
+
render: memberLabel,
|
|
1480
|
+
// The row shows the name ( memberLabel ), so the search has
|
|
1481
|
+
// to hit the name too. The members endpoint joins `user`
|
|
1482
|
+
// before its search stage, so the nested keys resolve.
|
|
1483
|
+
// Email stays for invitees who have not registered yet.
|
|
1484
|
+
// ponytail: a full "First Last" query matches neither key;
|
|
1485
|
+
// a $concat'd name on the API side if that comes up.
|
|
1486
|
+
searchKeys: ["email", "user.firstName", "user.lastName"],
|
|
1487
|
+
value: value || []
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
),
|
|
1491
|
+
label: "Recipients"
|
|
1492
|
+
}
|
|
1442
1493
|
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
label: "Recipients"
|
|
1494
|
+
);
|
|
1495
|
+
}
|
|
1446
1496
|
}
|
|
1447
1497
|
}
|
|
1448
|
-
)
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
),
|
|
1473
|
-
event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(LeadEmailNote, {}),
|
|
1474
|
-
step.type === "step.sms.send" && /* @__PURE__ */ jsx(
|
|
1475
|
-
Controller,
|
|
1476
|
-
{
|
|
1477
|
-
...{
|
|
1478
|
-
control,
|
|
1479
|
-
name: `steps.${index}.message`,
|
|
1480
|
-
render: ({ field: { value, onChange } }) => {
|
|
1481
|
-
var _a3, _b2, _c2, _d2;
|
|
1482
|
-
return /* @__PURE__ */ jsx(
|
|
1483
|
-
InputGroup,
|
|
1498
|
+
),
|
|
1499
|
+
emailSteps.includes(step.type) && /* @__PURE__ */ jsx(
|
|
1500
|
+
FormNotification,
|
|
1501
|
+
{
|
|
1502
|
+
...{
|
|
1503
|
+
control,
|
|
1504
|
+
// As the Fieldset above: the Message editor is a
|
|
1505
|
+
// contenteditable, which a disabled fieldset never reaches.
|
|
1506
|
+
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting),
|
|
1507
|
+
formState,
|
|
1508
|
+
onChecking,
|
|
1509
|
+
setValue,
|
|
1510
|
+
values: {
|
|
1511
|
+
id: field.id,
|
|
1512
|
+
name: `steps.${index}`,
|
|
1513
|
+
organization: values == null ? void 0 : values.organization,
|
|
1514
|
+
variables: getAvailableVariables(index)
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
),
|
|
1519
|
+
event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(LeadEmailNote, {}),
|
|
1520
|
+
step.type === "step.sms.send" && /* @__PURE__ */ jsx(
|
|
1521
|
+
Controller,
|
|
1484
1522
|
{
|
|
1485
1523
|
...{
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1524
|
+
control,
|
|
1525
|
+
name: `steps.${index}.message`,
|
|
1526
|
+
render: ({ field: { value, onChange } }) => {
|
|
1527
|
+
var _a3, _b2, _c2, _d2;
|
|
1528
|
+
return /* @__PURE__ */ jsx(
|
|
1529
|
+
InputGroup,
|
|
1530
|
+
{
|
|
1531
|
+
...{
|
|
1532
|
+
error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.message) == null ? void 0 : _d2.message,
|
|
1533
|
+
input: /* @__PURE__ */ jsx(
|
|
1534
|
+
InputTextarea,
|
|
1535
|
+
{
|
|
1536
|
+
...{
|
|
1537
|
+
onChange,
|
|
1538
|
+
rows: 3,
|
|
1539
|
+
value: value || ""
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1543
|
+
label: "Message"
|
|
1544
|
+
}
|
|
1494
1545
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
label: "Message"
|
|
1546
|
+
);
|
|
1547
|
+
}
|
|
1498
1548
|
}
|
|
1499
1549
|
}
|
|
1500
|
-
)
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1504
|
-
),
|
|
1505
|
-
step.type === "step.commerce.code.issue" && /* @__PURE__ */ jsx(
|
|
1506
|
-
Controller,
|
|
1507
|
-
{
|
|
1508
|
-
...{
|
|
1509
|
-
control,
|
|
1510
|
-
name: `steps.${index}.discount`,
|
|
1511
|
-
render: ({ field: { value, onChange } }) => {
|
|
1512
|
-
var _a3, _b2, _c2, _d2;
|
|
1513
|
-
return /* @__PURE__ */ jsx(
|
|
1514
|
-
InputGroup,
|
|
1550
|
+
),
|
|
1551
|
+
step.type === "step.commerce.code.issue" && /* @__PURE__ */ jsx(
|
|
1552
|
+
Controller,
|
|
1515
1553
|
{
|
|
1516
1554
|
...{
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
// setting — and the reason names the fix.
|
|
1529
|
-
render: (item) => /* @__PURE__ */ jsxs("div", { children: [
|
|
1530
|
-
/* @__PURE__ */ jsx("span", { className: (item == null ? void 0 : item.blocked) ? "text-gray-dark" : void 0, children: item == null ? void 0 : item.title }),
|
|
1531
|
-
((item == null ? void 0 : item.blocked) || (item == null ? void 0 : item.warning)) && /* @__PURE__ */ jsx("span", { className: "block text-sm text-gray-dark", children: item.blocked || item.warning })
|
|
1532
|
-
] }),
|
|
1533
|
-
renderButton: ({ button, item }) => (
|
|
1534
|
-
// The list's small inline Add, unless the list says otherwise.
|
|
1535
|
-
/* @__PURE__ */ jsx(
|
|
1536
|
-
Button,
|
|
1555
|
+
control,
|
|
1556
|
+
name: `steps.${index}.discount`,
|
|
1557
|
+
render: ({ field: { value, onChange } }) => {
|
|
1558
|
+
var _a3, _b2, _c2, _d2;
|
|
1559
|
+
return /* @__PURE__ */ jsx(
|
|
1560
|
+
InputGroup,
|
|
1561
|
+
{
|
|
1562
|
+
...{
|
|
1563
|
+
error: (_d2 = (_c2 = (_b2 = (_a3 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a3.steps) == null ? void 0 : _b2[index]) == null ? void 0 : _c2.discount) == null ? void 0 : _d2.message,
|
|
1564
|
+
input: /* @__PURE__ */ jsx(
|
|
1565
|
+
InputResource,
|
|
1537
1566
|
{
|
|
1538
1567
|
...{
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1568
|
+
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + commerceConnectionId + "/hook/browse.promotions",
|
|
1569
|
+
model: "discount",
|
|
1570
|
+
onChange,
|
|
1571
|
+
// A DISCOUNT THE STORE CANNOT BACK IS SHOWN AND EXPLAINED, never
|
|
1572
|
+
// filtered out. The merchant can see it in Shopify admin, so a row
|
|
1573
|
+
// missing here with no reason reads as our bug rather than their
|
|
1574
|
+
// setting — and the reason names the fix.
|
|
1575
|
+
render: (item) => /* @__PURE__ */ jsxs("div", { children: [
|
|
1576
|
+
/* @__PURE__ */ jsx("span", { className: (item == null ? void 0 : item.blocked) ? "text-gray-dark" : void 0, children: item == null ? void 0 : item.title }),
|
|
1577
|
+
((item == null ? void 0 : item.blocked) || (item == null ? void 0 : item.warning)) && /* @__PURE__ */ jsx("span", { className: "block text-sm text-gray-dark", children: item.blocked || item.warning })
|
|
1578
|
+
] }),
|
|
1579
|
+
renderButton: ({ button, item }) => (
|
|
1580
|
+
// The list's small inline Add, unless the list says otherwise.
|
|
1581
|
+
/* @__PURE__ */ jsx(
|
|
1582
|
+
Button,
|
|
1583
|
+
{
|
|
1584
|
+
...{
|
|
1585
|
+
inline: true,
|
|
1586
|
+
size: "small",
|
|
1587
|
+
...button.props,
|
|
1588
|
+
disabled: Boolean(item == null ? void 0 : item.blocked),
|
|
1589
|
+
title: (item == null ? void 0 : item.blocked) || void 0
|
|
1590
|
+
},
|
|
1591
|
+
children: button.text
|
|
1592
|
+
}
|
|
1593
|
+
)
|
|
1594
|
+
),
|
|
1595
|
+
value: value || null
|
|
1596
|
+
}
|
|
1546
1597
|
}
|
|
1547
|
-
)
|
|
1548
|
-
|
|
1549
|
-
|
|
1598
|
+
),
|
|
1599
|
+
label: "Discount",
|
|
1600
|
+
// "Issue" means MINT, not send — this step creates the code and saves
|
|
1601
|
+
// it to the lead, and nothing reaches them until a later email step
|
|
1602
|
+
// names the variable. Said here because the step picker says nothing:
|
|
1603
|
+
// QA read "Issue a discount code", built the one-step workflow that
|
|
1604
|
+
// describes, and reported the codes as never arriving.
|
|
1605
|
+
message: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1606
|
+
"Creates the code and saves it to the lead. To send it, keep this step before Auto response and add Shopify Discount Code to its message.",
|
|
1607
|
+
commerceDomain ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1608
|
+
" ",
|
|
1609
|
+
/* @__PURE__ */ jsx("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
|
|
1610
|
+
] }) : null
|
|
1611
|
+
] })
|
|
1612
|
+
}
|
|
1550
1613
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
label: "Discount",
|
|
1554
|
-
// "Issue" means MINT, not send — this step creates the code and saves
|
|
1555
|
-
// it to the lead, and nothing reaches them until a later email step
|
|
1556
|
-
// names the variable. Said here because the step picker says nothing:
|
|
1557
|
-
// QA read "Issue a discount code", built the one-step workflow that
|
|
1558
|
-
// describes, and reported the codes as never arriving.
|
|
1559
|
-
message: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1560
|
-
"Creates the code and saves it to the lead. To send it, keep this step before Auto response and add Shopify Discount Code to its message.",
|
|
1561
|
-
commerceDomain ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1562
|
-
" ",
|
|
1563
|
-
/* @__PURE__ */ jsx("a", { href: "https://" + commerceDomain + "/admin/discounts", rel: "noopener noreferrer", target: "_blank", children: "Manage discounts" })
|
|
1564
|
-
] }) : null
|
|
1565
|
-
] })
|
|
1614
|
+
);
|
|
1615
|
+
}
|
|
1566
1616
|
}
|
|
1567
1617
|
}
|
|
1568
|
-
)
|
|
1569
|
-
|
|
1618
|
+
)
|
|
1619
|
+
]
|
|
1570
1620
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1621
|
+
)
|
|
1622
|
+
}
|
|
1623
|
+
)
|
|
1624
|
+
);
|
|
1625
|
+
}
|
|
1576
1626
|
}
|
|
1577
1627
|
)
|
|
1578
|
-
|
|
1628
|
+
}
|
|
1579
1629
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1630
|
+
),
|
|
1631
|
+
/* @__PURE__ */ jsx(
|
|
1632
|
+
"div",
|
|
1633
|
+
{
|
|
1634
|
+
...{
|
|
1635
|
+
className: "pt-6"
|
|
1636
|
+
},
|
|
1637
|
+
children: /* @__PURE__ */ jsx(
|
|
1638
|
+
Button,
|
|
1639
|
+
{
|
|
1640
|
+
...{
|
|
1641
|
+
disabled: checkingAny,
|
|
1642
|
+
loading: (formState == null ? void 0 : formState.isSubmitting) || checkingAny,
|
|
1643
|
+
type: "submit"
|
|
1644
|
+
},
|
|
1645
|
+
children: "Save"
|
|
1646
|
+
}
|
|
1647
|
+
)
|
|
1648
|
+
}
|
|
1649
|
+
)
|
|
1650
|
+
]
|
|
1583
1651
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
Button,
|
|
1588
|
-
{
|
|
1589
|
-
...{
|
|
1590
|
-
disabled: checkingAny,
|
|
1591
|
-
loading: (formState == null ? void 0 : formState.isSubmitting) || checkingAny,
|
|
1592
|
-
type: "submit"
|
|
1593
|
-
},
|
|
1594
|
-
children: "Save"
|
|
1595
|
-
}
|
|
1596
|
-
)
|
|
1597
|
-
]
|
|
1652
|
+
)
|
|
1653
|
+
}
|
|
1654
|
+
)
|
|
1598
1655
|
}
|
|
1599
1656
|
)
|
|
1600
1657
|
}
|
|
@@ -1603,11 +1660,11 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1603
1660
|
export {
|
|
1604
1661
|
FormOrganizationWorkflowEdit,
|
|
1605
1662
|
RESPONSE,
|
|
1606
|
-
SAMPLE,
|
|
1607
1663
|
TextPreview,
|
|
1608
1664
|
firstEntryOnly,
|
|
1609
1665
|
hasStepOptions,
|
|
1610
1666
|
issueRow,
|
|
1667
|
+
listsMembers,
|
|
1611
1668
|
memberOptions,
|
|
1612
1669
|
partToStart,
|
|
1613
1670
|
pickedCopy,
|
|
@@ -1620,7 +1677,7 @@ export {
|
|
|
1620
1677
|
stepReason,
|
|
1621
1678
|
stepRow,
|
|
1622
1679
|
stepVariables,
|
|
1680
|
+
useEmailPreview,
|
|
1623
1681
|
useStepPrefill,
|
|
1624
|
-
webhookSample,
|
|
1625
1682
|
workflowSchema
|
|
1626
1683
|
};
|