@drawbridge/components 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/styles.css +364 -2
- package/dist/advertisement.js +3 -1
- package/dist/advertisement.mjs +3 -1
- package/dist/bridge/advertisements.js +2 -0
- package/dist/bridge/advertisements.mjs +2 -0
- package/dist/bridge/countdown.js +2 -1
- package/dist/bridge/countdown.mjs +2 -1
- package/dist/bridge/form-subdomain-embed.js +18 -20
- package/dist/bridge/form-subdomain-embed.mjs +18 -20
- package/dist/bridge/form-subdomain-header.js +24 -1
- package/dist/bridge/form-subdomain-header.mjs +24 -1
- package/dist/bridge/form-subdomain-missions.js +538 -0
- package/dist/bridge/form-subdomain-missions.mjs +502 -0
- package/dist/bridge/form-subdomain.js +530 -220
- package/dist/bridge/form-subdomain.mjs +533 -222
- package/dist/bridge/lib/entry.js +59 -0
- package/dist/bridge/lib/entry.mjs +29 -0
- package/dist/bridge/lib/location.js +38 -0
- package/dist/bridge/lib/location.mjs +13 -0
- package/dist/bridge/lib/order.js +71 -0
- package/dist/bridge/lib/order.mjs +44 -0
- package/dist/bridge/lib/url.js +9 -0
- package/dist/bridge/lib/url.mjs +7 -0
- package/dist/bridge/share-button.js +5 -3
- package/dist/bridge/share-button.mjs +5 -3
- package/dist/bridge/subdomain-content.js +7 -6
- package/dist/bridge/subdomain-content.mjs +7 -6
- package/dist/bridge/template-layout.js +59 -21
- package/dist/bridge/template-layout.mjs +59 -21
- package/dist/bridge/template-modal.js +42 -76
- package/dist/bridge/template-modal.mjs +39 -73
- package/dist/bridge/template-preview.js +208 -0
- package/dist/bridge/template-preview.mjs +173 -0
- package/dist/bridge/template-subdomain-gallery.js +6 -2
- package/dist/bridge/template-subdomain-gallery.mjs +6 -2
- package/dist/bridge/template-subdomain-link.js +6 -1
- package/dist/bridge/template-subdomain-link.mjs +6 -1
- package/dist/bridge/template-subdomain.js +20 -15
- package/dist/bridge/template-subdomain.mjs +20 -15
- package/dist/dashboard/accordion.js +74 -39
- package/dist/dashboard/accordion.mjs +74 -39
- package/dist/dashboard/avatar.js +109 -3
- package/dist/dashboard/avatar.mjs +106 -4
- package/dist/dashboard/buttons-subscription.js +384 -0
- package/dist/dashboard/buttons-subscription.mjs +349 -0
- package/dist/dashboard/card-campaign-switch.js +265 -0
- package/dist/dashboard/card-campaign-switch.mjs +231 -0
- package/dist/dashboard/card-order.js +28 -11
- package/dist/dashboard/card-order.mjs +28 -11
- package/dist/dashboard/card-section.js +26 -2
- package/dist/dashboard/card-section.mjs +26 -2
- package/dist/dashboard/card-tile.js +6 -7
- package/dist/dashboard/card-tile.mjs +6 -7
- package/dist/dashboard/connection-workflows.js +196 -0
- package/dist/dashboard/connection-workflows.mjs +162 -0
- package/dist/dashboard/device.js +95 -0
- package/dist/dashboard/device.mjs +72 -0
- package/dist/dashboard/form-admin-campaign.js +19 -50
- package/dist/dashboard/form-admin-campaign.mjs +20 -51
- package/dist/dashboard/form-ai.js +9 -6
- package/dist/dashboard/form-ai.mjs +9 -6
- package/dist/dashboard/form-auth.js +35 -25
- package/dist/dashboard/form-auth.mjs +36 -26
- package/dist/dashboard/form-file.js +10 -1
- package/dist/dashboard/form-file.mjs +10 -1
- package/dist/dashboard/form-filters-analytics.js +14 -1
- package/dist/dashboard/form-filters-analytics.mjs +15 -2
- package/dist/dashboard/form-organization-campaign-advertisement.js +15 -1
- package/dist/dashboard/form-organization-campaign-advertisement.mjs +16 -2
- package/dist/dashboard/form-organization-campaign-agreement.js +215 -164
- package/dist/dashboard/form-organization-campaign-agreement.mjs +215 -164
- package/dist/dashboard/form-organization-campaign-field-email.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-email.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-list.js +466 -0
- package/dist/dashboard/form-organization-campaign-field-list.mjs +437 -0
- package/dist/dashboard/form-organization-campaign-field-phone.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-phone.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-remove.js +66 -0
- package/dist/dashboard/form-organization-campaign-field-remove.mjs +33 -0
- package/dist/dashboard/form-organization-campaign-integration-age.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
- package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
- package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-link.js +7 -1
- package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
- package/dist/dashboard/form-organization-campaign-mission.js +291 -0
- package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
- package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
- package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-page.js +20 -11
- package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
- package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
- package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-section.js +223 -0
- package/dist/dashboard/form-organization-campaign-section.mjs +194 -0
- package/dist/dashboard/form-organization-campaign.js +114 -469
- package/dist/dashboard/form-organization-campaign.mjs +113 -467
- package/dist/dashboard/form-organization-export.js +4 -7
- package/dist/dashboard/form-organization-export.mjs +4 -7
- package/dist/dashboard/form-organization-identity.js +46 -51
- package/dist/dashboard/form-organization-identity.mjs +46 -51
- package/dist/dashboard/form-organization-workflow.js +518 -686
- package/dist/dashboard/form-organization-workflow.mjs +517 -682
- package/dist/dashboard/form-organization.js +82 -110
- package/dist/dashboard/form-organization.mjs +81 -109
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-payment-methods.js +20 -9
- package/dist/dashboard/form-payment-methods.mjs +20 -9
- package/dist/dashboard/form-stripe.js +30 -0
- package/dist/dashboard/form-stripe.mjs +26 -0
- package/dist/dashboard/input-array.js +4 -2
- package/dist/dashboard/input-array.mjs +4 -2
- package/dist/dashboard/input-combobox.js +7 -3
- package/dist/dashboard/input-combobox.mjs +7 -3
- package/dist/dashboard/input-date.js +7 -0
- package/dist/dashboard/input-date.mjs +7 -0
- package/dist/dashboard/input-fields.js +80 -20
- package/dist/dashboard/input-fields.mjs +80 -20
- package/dist/dashboard/input-file.js +21 -1
- package/dist/dashboard/input-file.mjs +21 -1
- package/dist/dashboard/input-font.js +10 -1
- package/dist/dashboard/input-font.mjs +10 -1
- package/dist/dashboard/lib/item-list.js +57 -0
- package/dist/dashboard/lib/item-list.mjs +33 -0
- package/dist/dashboard/lib/menu.js +50 -0
- package/dist/dashboard/lib/menu.mjs +26 -0
- package/dist/dashboard/locked.js +82 -0
- package/dist/dashboard/locked.mjs +53 -0
- package/dist/dashboard/menu.js +72 -19
- package/dist/dashboard/menu.mjs +72 -19
- package/dist/dashboard/note-ai.js +69 -0
- package/dist/dashboard/note-ai.mjs +36 -0
- package/dist/dashboard/preview.js +419 -0
- package/dist/dashboard/preview.mjs +384 -0
- package/dist/dashboard/steps.js +39 -13
- package/dist/dashboard/steps.mjs +37 -12
- package/dist/dashboard/table-contacts.js +136 -0
- package/dist/dashboard/table-contacts.mjs +103 -0
- package/dist/dashboard/template-not-found.js +4 -2
- package/dist/dashboard/template-not-found.mjs +4 -2
- package/dist/dashboard/template-socket.js +51 -7
- package/dist/dashboard/template-socket.mjs +51 -7
- package/dist/icons/desktop.js +46 -0
- package/dist/icons/desktop.mjs +27 -0
- package/dist/icons/phone.js +46 -0
- package/dist/icons/phone.mjs +27 -0
- package/dist/icons/puzzle-piece.js +46 -0
- package/dist/icons/puzzle-piece.mjs +27 -0
- package/dist/icons/tablet.js +46 -0
- package/dist/icons/tablet.mjs +27 -0
- package/dist/icons/users.js +46 -0
- package/dist/icons/users.mjs +27 -0
- package/dist/input-checkbox.js +1 -0
- package/dist/input-checkbox.mjs +1 -0
- package/dist/input-code.js +101 -0
- package/dist/input-code.mjs +78 -0
- package/dist/input-text.js +2 -1
- package/dist/input-text.mjs +2 -1
- package/dist/shared/input-checkbox-list.js +0 -1
- package/dist/shared/input-checkbox-list.mjs +0 -1
- package/dist/shared/input-switch.js +6 -1
- package/dist/shared/input-switch.mjs +6 -1
- package/dist/shared/lib/campaign.js +117 -0
- package/dist/shared/lib/campaign.mjs +91 -0
- package/dist/shared/lib/helpers.js +14 -2
- package/dist/shared/lib/helpers.mjs +13 -2
- package/package.json +133 -13
- package/types/bridge/form-subdomain-header.d.ts +2 -0
- package/types/bridge/form-subdomain-missions.d.ts +36 -0
- package/types/bridge/form-subdomain.d.ts +23 -1
- package/types/bridge/lib/entry.d.ts +26 -0
- package/types/bridge/lib/location.d.ts +13 -0
- package/types/bridge/lib/order.d.ts +30 -0
- package/types/bridge/lib/url.d.ts +19 -0
- package/types/bridge/template-modal.d.ts +1 -1
- package/types/bridge/template-preview.d.ts +10 -0
- package/types/bridge/template-subdomain-link.d.ts +2 -0
- package/types/dashboard/accordion.d.ts +2 -0
- package/types/dashboard/avatar.d.ts +18 -2
- package/types/dashboard/buttons-subscription.d.ts +22 -0
- package/types/dashboard/card-campaign-switch.d.ts +32 -0
- package/types/dashboard/card-order.d.ts +11 -0
- package/types/dashboard/card-section.d.ts +2 -0
- package/types/dashboard/connection-workflows.d.ts +33 -0
- package/types/dashboard/device.d.ts +12 -0
- package/types/dashboard/form-admin-campaign.d.ts +3 -2
- package/types/dashboard/form-ai.d.ts +2 -2
- package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
- package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
- package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
- package/types/dashboard/form-organization-campaign-section.d.ts +27 -0
- package/types/dashboard/form-organization-campaign.d.ts +27 -17
- package/types/dashboard/form-organization-identity.d.ts +2 -0
- package/types/dashboard/form-organization-workflow.d.ts +43 -47
- package/types/dashboard/form-organization.d.ts +7 -2
- package/types/dashboard/form-stripe.d.ts +3 -0
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/input-date.d.ts +2 -0
- package/types/dashboard/input-fields.d.ts +3 -2
- package/types/dashboard/input-file.d.ts +4 -0
- package/types/dashboard/lib/item-list.d.ts +14 -0
- package/types/dashboard/lib/menu.d.ts +17 -0
- package/types/dashboard/locked.d.ts +10 -0
- package/types/dashboard/menu.d.ts +10 -2
- package/types/dashboard/note-ai.d.ts +15 -0
- package/types/dashboard/preview.d.ts +33 -0
- package/types/dashboard/steps.d.ts +19 -4
- package/types/dashboard/table-cell-title.d.ts +2 -2
- package/types/dashboard/table-contacts.d.ts +2 -0
- package/types/icons/desktop.d.ts +5 -0
- package/types/icons/phone.d.ts +5 -0
- package/types/icons/puzzle-piece.d.ts +5 -0
- package/types/icons/tablet.d.ts +5 -0
- package/types/icons/users.d.ts +5 -0
- package/types/input-code.d.ts +23 -0
- package/types/shared/input-switch.d.ts +2 -0
- package/types/shared/lib/campaign.d.ts +35 -0
- package/types/shared/lib/helpers.d.ts +3 -0
- package/dist/dashboard/card-integration.js +0 -187
- package/dist/dashboard/card-integration.mjs +0 -158
- package/dist/dashboard/iframe.js +0 -159
- package/dist/dashboard/iframe.mjs +0 -130
- package/types/dashboard/card-integration.d.ts +0 -24
- package/types/dashboard/iframe.d.ts +0 -18
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var connection_workflows_exports = {};
|
|
30
|
+
__export(connection_workflows_exports, {
|
|
31
|
+
default: () => connection_workflows_default,
|
|
32
|
+
workflowLine: () => workflowLine,
|
|
33
|
+
workflowsNotRunning: () => workflowsNotRunning
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(connection_workflows_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react_query = require("@tanstack/react-query");
|
|
38
|
+
var import_hooks = require("./lib/hooks");
|
|
39
|
+
var import_paged = __toESM(require("./paged"));
|
|
40
|
+
var import_link = __toESM(require("./link"));
|
|
41
|
+
var import_badge = __toESM(require("../shared/badge"));
|
|
42
|
+
var import_button = __toESM(require("../shared/button"));
|
|
43
|
+
var import_empty = __toESM(require("../shared/empty"));
|
|
44
|
+
var import_helpers = require("../shared/lib/helpers");
|
|
45
|
+
const workflowLine = (row) => {
|
|
46
|
+
var _a;
|
|
47
|
+
return [
|
|
48
|
+
(_a = row == null ? void 0 : row.trigger) == null ? void 0 : _a.title,
|
|
49
|
+
((row == null ? void 0 : row.steps) || []).join(", ")
|
|
50
|
+
].filter(Boolean).join(" \xB7 ");
|
|
51
|
+
};
|
|
52
|
+
const workflowsNotRunning = (items = []) => {
|
|
53
|
+
const broken = items.filter((row) => (row == null ? void 0 : row.status) === "error");
|
|
54
|
+
if (!broken.length) return null;
|
|
55
|
+
const one = broken.length === 1;
|
|
56
|
+
const names = [...new Set(broken.map((row) => {
|
|
57
|
+
var _a;
|
|
58
|
+
return ((_a = row == null ? void 0 : row.campaign) == null ? void 0 : _a.title) || (row == null ? void 0 : row.title);
|
|
59
|
+
}).filter(Boolean))];
|
|
60
|
+
return {
|
|
61
|
+
message: names.join(", ") + ": a step needs this. Connect below to start " + (one ? "it" : "them") + " again.",
|
|
62
|
+
title: broken.length + (one ? " workflow is" : " workflows are") + " not running"
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const ConnectionWorkflows = ({
|
|
66
|
+
endpoint,
|
|
67
|
+
organization,
|
|
68
|
+
queryKey,
|
|
69
|
+
view = true
|
|
70
|
+
}) => {
|
|
71
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
72
|
+
const drawer = (0, import_hooks.useDrawer)({ queryClient });
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
+
import_paged.default,
|
|
75
|
+
{
|
|
76
|
+
...{
|
|
77
|
+
classNamePagination: "pt-6",
|
|
78
|
+
// The drawer is white, so the empty box is the grey one.
|
|
79
|
+
empty: ({ empty, locked }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_empty.default,
|
|
81
|
+
{
|
|
82
|
+
...{
|
|
83
|
+
variant: "secondary"
|
|
84
|
+
},
|
|
85
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: (locked == null ? void 0 : locked.message) || (empty == null ? void 0 : empty.message) || "No workflow uses this connection yet." })
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
endpoint,
|
|
89
|
+
params: {
|
|
90
|
+
limit: 24
|
|
91
|
+
},
|
|
92
|
+
queryKey
|
|
93
|
+
},
|
|
94
|
+
children: ({ items }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
...{
|
|
98
|
+
className: "divide-y divide-gray"
|
|
99
|
+
},
|
|
100
|
+
children: items.map((row) => {
|
|
101
|
+
var _a, _b, _c;
|
|
102
|
+
const badge = (0, import_helpers.statusBadge)("workflow", row == null ? void 0 : row.status);
|
|
103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
...{
|
|
107
|
+
className: "flex items-center gap-4 py-4 first:pt-0"
|
|
108
|
+
},
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
...{
|
|
114
|
+
className: "flex-1 min-w-0 space-y-1"
|
|
115
|
+
},
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
118
|
+
"p",
|
|
119
|
+
{
|
|
120
|
+
...{
|
|
121
|
+
className: "flex items-center gap-2 min-w-0"
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
|
+
"span",
|
|
126
|
+
{
|
|
127
|
+
...{
|
|
128
|
+
className: "truncate"
|
|
129
|
+
},
|
|
130
|
+
children: ((_a = row == null ? void 0 : row.campaign) == null ? void 0 : _a.title) || (row == null ? void 0 : row.title)
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
+
import_badge.default,
|
|
135
|
+
{
|
|
136
|
+
...{
|
|
137
|
+
size: "small",
|
|
138
|
+
type: badge.type
|
|
139
|
+
},
|
|
140
|
+
children: badge.text
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
147
|
+
"p",
|
|
148
|
+
{
|
|
149
|
+
...{
|
|
150
|
+
className: "text-sm text-gray-dark"
|
|
151
|
+
},
|
|
152
|
+
children: workflowLine(row)
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
(row == null ? void 0 : row.locked) || !((_b = row == null ? void 0 : row.campaign) == null ? void 0 : _b.id) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
159
|
+
import_badge.default,
|
|
160
|
+
{
|
|
161
|
+
...{
|
|
162
|
+
size: "small",
|
|
163
|
+
type: "secondary"
|
|
164
|
+
},
|
|
165
|
+
children: "Locked"
|
|
166
|
+
}
|
|
167
|
+
) : view && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
|
+
import_button.default,
|
|
169
|
+
{
|
|
170
|
+
...{
|
|
171
|
+
element: import_link.default,
|
|
172
|
+
href: "/organizations/" + organization + "/campaigns/" + row.campaign.id + "/workflows/" + ((_c = row == null ? void 0 : row.trigger) == null ? void 0 : _c.event),
|
|
173
|
+
inline: true,
|
|
174
|
+
onClick: drawer.close,
|
|
175
|
+
size: "small",
|
|
176
|
+
variant: "secondary"
|
|
177
|
+
},
|
|
178
|
+
children: "View"
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
row.id
|
|
184
|
+
);
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
var connection_workflows_default = ConnectionWorkflows;
|
|
192
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
193
|
+
0 && (module.exports = {
|
|
194
|
+
workflowLine,
|
|
195
|
+
workflowsNotRunning
|
|
196
|
+
});
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { useDrawer } from "./lib/hooks.mjs";
|
|
5
|
+
import Paged from "./paged.mjs";
|
|
6
|
+
import Link from "./link.mjs";
|
|
7
|
+
import Badge from "../shared/badge.mjs";
|
|
8
|
+
import Button from "../shared/button.mjs";
|
|
9
|
+
import Empty from "../shared/empty.mjs";
|
|
10
|
+
import { statusBadge } from "../shared/lib/helpers.mjs";
|
|
11
|
+
const workflowLine = (row) => {
|
|
12
|
+
var _a;
|
|
13
|
+
return [
|
|
14
|
+
(_a = row == null ? void 0 : row.trigger) == null ? void 0 : _a.title,
|
|
15
|
+
((row == null ? void 0 : row.steps) || []).join(", ")
|
|
16
|
+
].filter(Boolean).join(" \xB7 ");
|
|
17
|
+
};
|
|
18
|
+
const workflowsNotRunning = (items = []) => {
|
|
19
|
+
const broken = items.filter((row) => (row == null ? void 0 : row.status) === "error");
|
|
20
|
+
if (!broken.length) return null;
|
|
21
|
+
const one = broken.length === 1;
|
|
22
|
+
const names = [...new Set(broken.map((row) => {
|
|
23
|
+
var _a;
|
|
24
|
+
return ((_a = row == null ? void 0 : row.campaign) == null ? void 0 : _a.title) || (row == null ? void 0 : row.title);
|
|
25
|
+
}).filter(Boolean))];
|
|
26
|
+
return {
|
|
27
|
+
message: names.join(", ") + ": a step needs this. Connect below to start " + (one ? "it" : "them") + " again.",
|
|
28
|
+
title: broken.length + (one ? " workflow is" : " workflows are") + " not running"
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const ConnectionWorkflows = ({
|
|
32
|
+
endpoint,
|
|
33
|
+
organization,
|
|
34
|
+
queryKey,
|
|
35
|
+
view = true
|
|
36
|
+
}) => {
|
|
37
|
+
const queryClient = useQueryClient();
|
|
38
|
+
const drawer = useDrawer({ queryClient });
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
Paged,
|
|
41
|
+
{
|
|
42
|
+
...{
|
|
43
|
+
classNamePagination: "pt-6",
|
|
44
|
+
// The drawer is white, so the empty box is the grey one.
|
|
45
|
+
empty: ({ empty, locked }) => /* @__PURE__ */ jsx(
|
|
46
|
+
Empty,
|
|
47
|
+
{
|
|
48
|
+
...{
|
|
49
|
+
variant: "secondary"
|
|
50
|
+
},
|
|
51
|
+
children: /* @__PURE__ */ jsx("p", { children: (locked == null ? void 0 : locked.message) || (empty == null ? void 0 : empty.message) || "No workflow uses this connection yet." })
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
endpoint,
|
|
55
|
+
params: {
|
|
56
|
+
limit: 24
|
|
57
|
+
},
|
|
58
|
+
queryKey
|
|
59
|
+
},
|
|
60
|
+
children: ({ items }) => /* @__PURE__ */ jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
...{
|
|
64
|
+
className: "divide-y divide-gray"
|
|
65
|
+
},
|
|
66
|
+
children: items.map((row) => {
|
|
67
|
+
var _a, _b, _c;
|
|
68
|
+
const badge = statusBadge("workflow", row == null ? void 0 : row.status);
|
|
69
|
+
return /* @__PURE__ */ jsxs(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
...{
|
|
73
|
+
className: "flex items-center gap-4 py-4 first:pt-0"
|
|
74
|
+
},
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ jsxs(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
...{
|
|
80
|
+
className: "flex-1 min-w-0 space-y-1"
|
|
81
|
+
},
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ jsxs(
|
|
84
|
+
"p",
|
|
85
|
+
{
|
|
86
|
+
...{
|
|
87
|
+
className: "flex items-center gap-2 min-w-0"
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
...{
|
|
94
|
+
className: "truncate"
|
|
95
|
+
},
|
|
96
|
+
children: ((_a = row == null ? void 0 : row.campaign) == null ? void 0 : _a.title) || (row == null ? void 0 : row.title)
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
badge && /* @__PURE__ */ jsx(
|
|
100
|
+
Badge,
|
|
101
|
+
{
|
|
102
|
+
...{
|
|
103
|
+
size: "small",
|
|
104
|
+
type: badge.type
|
|
105
|
+
},
|
|
106
|
+
children: badge.text
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"p",
|
|
114
|
+
{
|
|
115
|
+
...{
|
|
116
|
+
className: "text-sm text-gray-dark"
|
|
117
|
+
},
|
|
118
|
+
children: workflowLine(row)
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
(row == null ? void 0 : row.locked) || !((_b = row == null ? void 0 : row.campaign) == null ? void 0 : _b.id) ? /* @__PURE__ */ jsx(
|
|
125
|
+
Badge,
|
|
126
|
+
{
|
|
127
|
+
...{
|
|
128
|
+
size: "small",
|
|
129
|
+
type: "secondary"
|
|
130
|
+
},
|
|
131
|
+
children: "Locked"
|
|
132
|
+
}
|
|
133
|
+
) : view && /* @__PURE__ */ jsx(
|
|
134
|
+
Button,
|
|
135
|
+
{
|
|
136
|
+
...{
|
|
137
|
+
element: Link,
|
|
138
|
+
href: "/organizations/" + organization + "/campaigns/" + row.campaign.id + "/workflows/" + ((_c = row == null ? void 0 : row.trigger) == null ? void 0 : _c.event),
|
|
139
|
+
inline: true,
|
|
140
|
+
onClick: drawer.close,
|
|
141
|
+
size: "small",
|
|
142
|
+
variant: "secondary"
|
|
143
|
+
},
|
|
144
|
+
children: "View"
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
row.id
|
|
150
|
+
);
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
var connection_workflows_default = ConnectionWorkflows;
|
|
158
|
+
export {
|
|
159
|
+
connection_workflows_default as default,
|
|
160
|
+
workflowLine,
|
|
161
|
+
workflowsNotRunning
|
|
162
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var device_exports = {};
|
|
20
|
+
__export(device_exports, {
|
|
21
|
+
DEVICE_TYPES: () => DEVICE_TYPES,
|
|
22
|
+
default: () => device_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(device_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
const DEVICE_TYPES = {
|
|
27
|
+
// The phone's page starts below its status bar and island, as it does in Safari.
|
|
28
|
+
phone: { model: "iphone-14-pro", safe: 50, screen: { height: 830, width: 390 }, viewport: 390 },
|
|
29
|
+
tablet: { model: "ipad-pro", screen: { height: 724, width: 506 }, viewport: 768 },
|
|
30
|
+
desktop: { model: "macbook-pro", screen: { height: 375, width: 600 }, viewport: 1440 }
|
|
31
|
+
};
|
|
32
|
+
const PARTS = ["stripe", "header", "sensors", "btns", "power", "home"];
|
|
33
|
+
const Device = ({
|
|
34
|
+
children,
|
|
35
|
+
type = "phone"
|
|
36
|
+
}) => {
|
|
37
|
+
const { model, safe = 0, screen, viewport } = DEVICE_TYPES[type];
|
|
38
|
+
const scale = screen.width / viewport;
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
...{
|
|
43
|
+
className: "device device-" + model
|
|
44
|
+
},
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
...{
|
|
50
|
+
className: "device-frame"
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
...{
|
|
56
|
+
className: "device-screen overflow-hidden bg-white"
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
...{
|
|
62
|
+
// The device's own viewport, scaled into the screen.
|
|
63
|
+
className: "absolute left-0 origin-top-left",
|
|
64
|
+
style: {
|
|
65
|
+
height: (screen.height - safe) / scale,
|
|
66
|
+
top: safe,
|
|
67
|
+
transform: "scale(" + scale + ")",
|
|
68
|
+
width: viewport
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
children
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
...{
|
|
82
|
+
className: "device-" + part
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
part
|
|
86
|
+
))
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
var device_default = Device;
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
DEVICE_TYPES
|
|
95
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
const DEVICE_TYPES = {
|
|
4
|
+
// The phone's page starts below its status bar and island, as it does in Safari.
|
|
5
|
+
phone: { model: "iphone-14-pro", safe: 50, screen: { height: 830, width: 390 }, viewport: 390 },
|
|
6
|
+
tablet: { model: "ipad-pro", screen: { height: 724, width: 506 }, viewport: 768 },
|
|
7
|
+
desktop: { model: "macbook-pro", screen: { height: 375, width: 600 }, viewport: 1440 }
|
|
8
|
+
};
|
|
9
|
+
const PARTS = ["stripe", "header", "sensors", "btns", "power", "home"];
|
|
10
|
+
const Device = ({
|
|
11
|
+
children,
|
|
12
|
+
type = "phone"
|
|
13
|
+
}) => {
|
|
14
|
+
const { model, safe = 0, screen, viewport } = DEVICE_TYPES[type];
|
|
15
|
+
const scale = screen.width / viewport;
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
...{
|
|
20
|
+
className: "device device-" + model
|
|
21
|
+
},
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
...{
|
|
27
|
+
className: "device-frame"
|
|
28
|
+
},
|
|
29
|
+
children: /* @__PURE__ */ jsx(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
...{
|
|
33
|
+
className: "device-screen overflow-hidden bg-white"
|
|
34
|
+
},
|
|
35
|
+
children: /* @__PURE__ */ jsx(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
...{
|
|
39
|
+
// The device's own viewport, scaled into the screen.
|
|
40
|
+
className: "absolute left-0 origin-top-left",
|
|
41
|
+
style: {
|
|
42
|
+
height: (screen.height - safe) / scale,
|
|
43
|
+
top: safe,
|
|
44
|
+
transform: "scale(" + scale + ")",
|
|
45
|
+
width: viewport
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
children
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
PARTS.map((part) => /* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
...{
|
|
59
|
+
className: "device-" + part
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
part
|
|
63
|
+
))
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
var device_default = Device;
|
|
69
|
+
export {
|
|
70
|
+
DEVICE_TYPES,
|
|
71
|
+
device_default as default
|
|
72
|
+
};
|
|
@@ -35,11 +35,8 @@ var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
|
35
35
|
var import_form = require("../shared/lib/form");
|
|
36
36
|
var import_yup = __toESM(require("../shared/lib/yup"));
|
|
37
37
|
var import_input_fields = require("./input-fields");
|
|
38
|
-
var import_react_query = require("@tanstack/react-query");
|
|
39
38
|
var import_form2 = __toESM(require("../shared/form"));
|
|
40
39
|
var import_fieldset = __toESM(require("../shared/fieldset"));
|
|
41
|
-
var import_input_group = __toESM(require("../input-group"));
|
|
42
|
-
var import_input_combobox = __toESM(require("./input-combobox"));
|
|
43
40
|
var import_button = __toESM(require("../shared/button"));
|
|
44
41
|
const FormAdminCampaign = ({
|
|
45
42
|
disabled,
|
|
@@ -47,36 +44,41 @@ const FormAdminCampaign = ({
|
|
|
47
44
|
onError,
|
|
48
45
|
values
|
|
49
46
|
}) => {
|
|
50
|
-
var _a;
|
|
51
|
-
const queryClient = (0, import_react_query.useQueryClient)();
|
|
52
|
-
const app = queryClient.getQueryData(["app"]);
|
|
47
|
+
var _a, _b;
|
|
53
48
|
const methods = (0, import_form.useForm)({
|
|
54
49
|
// Reactive `values` (not `defaultValues`): this form stays mounted on
|
|
55
50
|
// the admin campaign page, so the save-then-refetch cycle must rebase
|
|
56
51
|
// the baseline or the unsaved-changes guard would stay armed.
|
|
52
|
+
// @story campaigns/giveaway-module
|
|
53
|
+
// The two switches, read off the campaign; the api applies the rule
|
|
54
|
+
// between them again on the PUT.
|
|
57
55
|
values: {
|
|
58
56
|
...values,
|
|
59
|
-
|
|
57
|
+
form: Boolean((_a = values == null ? void 0 : values.form) == null ? void 0 : _a.enabled),
|
|
58
|
+
giveaway: Boolean((_b = values == null ? void 0 : values.giveaway) == null ? void 0 : _b.enabled)
|
|
60
59
|
},
|
|
61
60
|
resolver: (0, import_yup.resolver)(
|
|
62
61
|
import_yup.default.object({
|
|
63
|
-
...import_input_fields.schemas.campaign(
|
|
64
|
-
status: import_yup.default.string().label("Status").required().oneOf(app.enums.campaign.status.enum)
|
|
62
|
+
...import_input_fields.schemas.campaign()
|
|
65
63
|
})
|
|
66
64
|
)
|
|
67
65
|
});
|
|
68
66
|
const { control, handleSubmit, formState } = methods;
|
|
69
67
|
const onSubmit = async ({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
form,
|
|
69
|
+
giveaway,
|
|
70
|
+
title
|
|
73
71
|
}) => {
|
|
74
72
|
try {
|
|
75
73
|
const response = await (0, import_fetch.request)({
|
|
76
74
|
body: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
form: {
|
|
76
|
+
enabled: form
|
|
77
|
+
},
|
|
78
|
+
giveaway: {
|
|
79
|
+
enabled: giveaway
|
|
80
|
+
},
|
|
81
|
+
title
|
|
80
82
|
},
|
|
81
83
|
endpoint: "/admin/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.id),
|
|
82
84
|
method: "PUT"
|
|
@@ -94,46 +96,13 @@ const FormAdminCampaign = ({
|
|
|
94
96
|
onSubmit: handleSubmit(onSubmit)
|
|
95
97
|
},
|
|
96
98
|
children: [
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
100
|
import_fieldset.default,
|
|
99
101
|
{
|
|
100
102
|
...{
|
|
101
103
|
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
102
104
|
},
|
|
103
|
-
children:
|
|
104
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_fields.InputFieldsCampaign, {}),
|
|
105
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
-
import_form.Controller,
|
|
107
|
-
{
|
|
108
|
-
...{
|
|
109
|
-
control,
|
|
110
|
-
name: "status",
|
|
111
|
-
render: ({ field: { value, onChange } }) => {
|
|
112
|
-
var _a2, _b;
|
|
113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
-
import_input_group.default,
|
|
115
|
-
{
|
|
116
|
-
...{
|
|
117
|
-
error: (_b = (_a2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _a2.status) == null ? void 0 : _b.message,
|
|
118
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
|
-
import_input_combobox.default,
|
|
120
|
-
{
|
|
121
|
-
...{
|
|
122
|
-
onChange,
|
|
123
|
-
options: app.enums.campaign.status.options,
|
|
124
|
-
value
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
),
|
|
128
|
-
label: "Status"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
]
|
|
105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_fields.InputFieldsCampaign, {})
|
|
137
106
|
}
|
|
138
107
|
),
|
|
139
108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|