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