@drawbridge/components 0.1.15 → 0.1.17
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/dist/bridge/form-subdomain-missions.js +43 -34
- package/dist/bridge/form-subdomain-missions.mjs +43 -34
- package/dist/bridge/lib/url.js +3 -3
- package/dist/bridge/lib/url.mjs +3 -3
- package/dist/bridge/share-button.js +12 -2
- package/dist/bridge/share-button.mjs +12 -2
- package/dist/bridge/template-layout.js +1 -1
- package/dist/bridge/template-layout.mjs +1 -1
- package/dist/dashboard/answer-rows.js +77 -0
- package/dist/dashboard/answer-rows.mjs +41 -0
- package/dist/dashboard/card-order.js +186 -243
- package/dist/dashboard/card-order.mjs +186 -243
- package/dist/dashboard/form-organization-campaign-agreement.js +2 -2
- package/dist/dashboard/form-organization-campaign-agreement.mjs +2 -2
- package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
- package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
- package/dist/dashboard/form-organization-workflow.js +588 -157
- package/dist/dashboard/form-organization-workflow.mjs +578 -157
- package/dist/dashboard/form-otc.js +7 -4
- package/dist/dashboard/form-otc.mjs +8 -5
- package/dist/dashboard/input-editor.js +46 -10
- package/dist/dashboard/input-editor.mjs +44 -9
- package/dist/dashboard/item-row.js +92 -0
- package/dist/dashboard/item-row.mjs +63 -0
- package/dist/dashboard/lib/sms.js +3 -0
- package/dist/dashboard/lib/sms.mjs +2 -0
- package/dist/dashboard/order-sections.js +231 -0
- package/dist/dashboard/order-sections.mjs +196 -0
- package/dist/dashboard/preview.js +29 -2
- package/dist/dashboard/preview.mjs +28 -2
- package/dist/dashboard/steps.js +5 -0
- package/dist/dashboard/steps.mjs +5 -0
- package/dist/dashboard/template-socket.js +6 -0
- package/dist/dashboard/template-socket.mjs +6 -0
- package/dist/input-code.js +2 -8
- package/dist/input-code.mjs +2 -8
- package/dist/shared/lib/helpers.js +7 -0
- package/dist/shared/lib/helpers.mjs +7 -0
- package/package.json +19 -4
- package/types/bridge/lib/url.d.ts +5 -4
- package/types/dashboard/answer-rows.d.ts +30 -0
- package/types/dashboard/card-order.d.ts +16 -14
- package/types/dashboard/form-organization-workflow.d.ts +46 -0
- package/types/dashboard/input-editor.d.ts +7 -1
- package/types/dashboard/item-row.d.ts +25 -0
- package/types/dashboard/order-sections.d.ts +36 -0
- package/types/dashboard/steps.d.ts +2 -0
- package/types/input-code.d.ts +0 -2
- package/types/shared/lib/helpers.d.ts +1 -1
|
@@ -0,0 +1,231 @@
|
|
|
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 order_sections_exports = {};
|
|
30
|
+
__export(order_sections_exports, {
|
|
31
|
+
OrderFulfillment: () => OrderFulfillment,
|
|
32
|
+
fulfillmentControls: () => fulfillmentControls,
|
|
33
|
+
useConfirm: () => useConfirm
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(order_sections_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react_query = require("@tanstack/react-query");
|
|
38
|
+
var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
39
|
+
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
40
|
+
var import_hooks = require("./lib/hooks");
|
|
41
|
+
var import_card_section = __toESM(require("./card-section"));
|
|
42
|
+
var import_card_task = __toESM(require("./card-task"));
|
|
43
|
+
var import_form_action = __toESM(require("./form-action"));
|
|
44
|
+
var import_paged = __toESM(require("./paged"));
|
|
45
|
+
var import_badge = __toESM(require("../shared/badge"));
|
|
46
|
+
var import_button = __toESM(require("../shared/button"));
|
|
47
|
+
var import_plus = __toESM(require("../icons/plus"));
|
|
48
|
+
const date = (value) => (0, import_drawbridge_utils.formatDateString)({
|
|
49
|
+
date: value,
|
|
50
|
+
options: {
|
|
51
|
+
day: "numeric",
|
|
52
|
+
month: "short",
|
|
53
|
+
year: "numeric"
|
|
54
|
+
},
|
|
55
|
+
time: true
|
|
56
|
+
});
|
|
57
|
+
const useConfirm = () => {
|
|
58
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
59
|
+
const modal = (0, import_hooks.useModal)({
|
|
60
|
+
queryClient
|
|
61
|
+
});
|
|
62
|
+
const { onError } = (0, import_hooks.useCallbacks)({
|
|
63
|
+
queryClient
|
|
64
|
+
});
|
|
65
|
+
return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, warning }) => modal.open({
|
|
66
|
+
title: action,
|
|
67
|
+
message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
68
|
+
import_form_action.default,
|
|
69
|
+
{
|
|
70
|
+
...{
|
|
71
|
+
action,
|
|
72
|
+
callback: () => (0, import_fetch.request)({
|
|
73
|
+
body,
|
|
74
|
+
endpoint,
|
|
75
|
+
method
|
|
76
|
+
}),
|
|
77
|
+
disabled: Boolean(task),
|
|
78
|
+
onError,
|
|
79
|
+
onSuccess
|
|
80
|
+
},
|
|
81
|
+
children: [
|
|
82
|
+
task ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
+
import_card_task.default,
|
|
84
|
+
{
|
|
85
|
+
...{
|
|
86
|
+
message: task,
|
|
87
|
+
type: "warning"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: message }),
|
|
91
|
+
!task && warning && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
import_card_task.default,
|
|
93
|
+
{
|
|
94
|
+
...{
|
|
95
|
+
message: warning,
|
|
96
|
+
type: "warning"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
const fulfillmentControls = ({ manage, order }) => {
|
|
106
|
+
var _a;
|
|
107
|
+
const editable = Boolean(manage) && (order == null ? void 0 : order.status) === "open";
|
|
108
|
+
return {
|
|
109
|
+
add: editable && ((_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status) !== "fulfilled",
|
|
110
|
+
cancel: editable
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const small = {
|
|
114
|
+
inline: true,
|
|
115
|
+
size: "small",
|
|
116
|
+
variant: "secondary"
|
|
117
|
+
};
|
|
118
|
+
const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
|
|
119
|
+
const confirm = useConfirm();
|
|
120
|
+
const controls = fulfillmentControls({ manage, order });
|
|
121
|
+
const fulfill = () => confirm({
|
|
122
|
+
action: "Mark as fulfilled",
|
|
123
|
+
endpoint: endpoint + "/fulfillment",
|
|
124
|
+
message: "Mark this order as fulfilled?",
|
|
125
|
+
method: "POST",
|
|
126
|
+
onSuccess
|
|
127
|
+
});
|
|
128
|
+
const cancel = (item) => confirm({
|
|
129
|
+
action: "Cancel fulfillment",
|
|
130
|
+
body: {
|
|
131
|
+
status: "canceled"
|
|
132
|
+
},
|
|
133
|
+
endpoint: endpoint + "/fulfillment/" + item.id,
|
|
134
|
+
message: "Cancel this fulfillment?",
|
|
135
|
+
onSuccess
|
|
136
|
+
});
|
|
137
|
+
const cta = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
138
|
+
import_button.default,
|
|
139
|
+
{
|
|
140
|
+
...{
|
|
141
|
+
...small,
|
|
142
|
+
"aria-label": "Mark as fulfilled",
|
|
143
|
+
disabled: !controls.add,
|
|
144
|
+
icon: import_plus.default,
|
|
145
|
+
onClick: fulfill
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
+
import_card_section.default,
|
|
151
|
+
{
|
|
152
|
+
...{
|
|
153
|
+
className: "shrink-0",
|
|
154
|
+
cta,
|
|
155
|
+
title: "Fulfillment"
|
|
156
|
+
},
|
|
157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
158
|
+
import_paged.default,
|
|
159
|
+
{
|
|
160
|
+
...{
|
|
161
|
+
empty: {
|
|
162
|
+
message: "Not fulfilled yet",
|
|
163
|
+
variant: "secondary"
|
|
164
|
+
},
|
|
165
|
+
endpoint: endpoint + "/fulfillments",
|
|
166
|
+
params: {
|
|
167
|
+
limit: 3
|
|
168
|
+
},
|
|
169
|
+
queryKey: ["order-fulfillments", order == null ? void 0 : order.id]
|
|
170
|
+
},
|
|
171
|
+
children: ({ items }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
...{
|
|
175
|
+
className: "divide-y divide-gray"
|
|
176
|
+
},
|
|
177
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
...{
|
|
181
|
+
className: "flex items-center justify-between gap-4 py-4 first:pt-0 last:pb-0"
|
|
182
|
+
},
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
...{
|
|
188
|
+
className: "flex items-center gap-3 min-w-0"
|
|
189
|
+
},
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: date(item.createdAt) }),
|
|
192
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
193
|
+
import_badge.default,
|
|
194
|
+
{
|
|
195
|
+
...{
|
|
196
|
+
type: item.status === "active" ? "success" : "secondary"
|
|
197
|
+
},
|
|
198
|
+
children: item.status === "active" ? "Fulfilled" : "Canceled"
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
item.status === "active" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
205
|
+
import_button.default,
|
|
206
|
+
{
|
|
207
|
+
...{
|
|
208
|
+
...small,
|
|
209
|
+
disabled: !controls.cancel,
|
|
210
|
+
onClick: () => cancel(item)
|
|
211
|
+
},
|
|
212
|
+
children: "Cancel"
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
item.id
|
|
218
|
+
))
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
227
|
+
0 && (module.exports = {
|
|
228
|
+
OrderFulfillment,
|
|
229
|
+
fulfillmentControls,
|
|
230
|
+
useConfirm
|
|
231
|
+
});
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { formatDateString } from "@drawbridge/drawbridge-utils";
|
|
5
|
+
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
6
|
+
import { useCallbacks, useModal } from "./lib/hooks.mjs";
|
|
7
|
+
import CardSection from "./card-section.mjs";
|
|
8
|
+
import CardTask from "./card-task.mjs";
|
|
9
|
+
import FormAction from "./form-action.mjs";
|
|
10
|
+
import Paged from "./paged.mjs";
|
|
11
|
+
import Badge from "../shared/badge.mjs";
|
|
12
|
+
import Button from "../shared/button.mjs";
|
|
13
|
+
import Plus from "../icons/plus.mjs";
|
|
14
|
+
const date = (value) => formatDateString({
|
|
15
|
+
date: value,
|
|
16
|
+
options: {
|
|
17
|
+
day: "numeric",
|
|
18
|
+
month: "short",
|
|
19
|
+
year: "numeric"
|
|
20
|
+
},
|
|
21
|
+
time: true
|
|
22
|
+
});
|
|
23
|
+
const useConfirm = () => {
|
|
24
|
+
const queryClient = useQueryClient();
|
|
25
|
+
const modal = useModal({
|
|
26
|
+
queryClient
|
|
27
|
+
});
|
|
28
|
+
const { onError } = useCallbacks({
|
|
29
|
+
queryClient
|
|
30
|
+
});
|
|
31
|
+
return ({ action, body, endpoint, message, method = "PUT", onSuccess, task, warning }) => modal.open({
|
|
32
|
+
title: action,
|
|
33
|
+
message: /* @__PURE__ */ jsxs(
|
|
34
|
+
FormAction,
|
|
35
|
+
{
|
|
36
|
+
...{
|
|
37
|
+
action,
|
|
38
|
+
callback: () => request({
|
|
39
|
+
body,
|
|
40
|
+
endpoint,
|
|
41
|
+
method
|
|
42
|
+
}),
|
|
43
|
+
disabled: Boolean(task),
|
|
44
|
+
onError,
|
|
45
|
+
onSuccess
|
|
46
|
+
},
|
|
47
|
+
children: [
|
|
48
|
+
task ? /* @__PURE__ */ jsx(
|
|
49
|
+
CardTask,
|
|
50
|
+
{
|
|
51
|
+
...{
|
|
52
|
+
message: task,
|
|
53
|
+
type: "warning"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
) : /* @__PURE__ */ jsx("p", { children: message }),
|
|
57
|
+
!task && warning && /* @__PURE__ */ jsx(
|
|
58
|
+
CardTask,
|
|
59
|
+
{
|
|
60
|
+
...{
|
|
61
|
+
message: warning,
|
|
62
|
+
type: "warning"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const fulfillmentControls = ({ manage, order }) => {
|
|
72
|
+
var _a;
|
|
73
|
+
const editable = Boolean(manage) && (order == null ? void 0 : order.status) === "open";
|
|
74
|
+
return {
|
|
75
|
+
add: editable && ((_a = order == null ? void 0 : order.fulfillment) == null ? void 0 : _a.status) !== "fulfilled",
|
|
76
|
+
cancel: editable
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const small = {
|
|
80
|
+
inline: true,
|
|
81
|
+
size: "small",
|
|
82
|
+
variant: "secondary"
|
|
83
|
+
};
|
|
84
|
+
const OrderFulfillment = ({ endpoint, manage, onSuccess, order }) => {
|
|
85
|
+
const confirm = useConfirm();
|
|
86
|
+
const controls = fulfillmentControls({ manage, order });
|
|
87
|
+
const fulfill = () => confirm({
|
|
88
|
+
action: "Mark as fulfilled",
|
|
89
|
+
endpoint: endpoint + "/fulfillment",
|
|
90
|
+
message: "Mark this order as fulfilled?",
|
|
91
|
+
method: "POST",
|
|
92
|
+
onSuccess
|
|
93
|
+
});
|
|
94
|
+
const cancel = (item) => confirm({
|
|
95
|
+
action: "Cancel fulfillment",
|
|
96
|
+
body: {
|
|
97
|
+
status: "canceled"
|
|
98
|
+
},
|
|
99
|
+
endpoint: endpoint + "/fulfillment/" + item.id,
|
|
100
|
+
message: "Cancel this fulfillment?",
|
|
101
|
+
onSuccess
|
|
102
|
+
});
|
|
103
|
+
const cta = /* @__PURE__ */ jsx(
|
|
104
|
+
Button,
|
|
105
|
+
{
|
|
106
|
+
...{
|
|
107
|
+
...small,
|
|
108
|
+
"aria-label": "Mark as fulfilled",
|
|
109
|
+
disabled: !controls.add,
|
|
110
|
+
icon: Plus,
|
|
111
|
+
onClick: fulfill
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
return /* @__PURE__ */ jsx(
|
|
116
|
+
CardSection,
|
|
117
|
+
{
|
|
118
|
+
...{
|
|
119
|
+
className: "shrink-0",
|
|
120
|
+
cta,
|
|
121
|
+
title: "Fulfillment"
|
|
122
|
+
},
|
|
123
|
+
children: /* @__PURE__ */ jsx(
|
|
124
|
+
Paged,
|
|
125
|
+
{
|
|
126
|
+
...{
|
|
127
|
+
empty: {
|
|
128
|
+
message: "Not fulfilled yet",
|
|
129
|
+
variant: "secondary"
|
|
130
|
+
},
|
|
131
|
+
endpoint: endpoint + "/fulfillments",
|
|
132
|
+
params: {
|
|
133
|
+
limit: 3
|
|
134
|
+
},
|
|
135
|
+
queryKey: ["order-fulfillments", order == null ? void 0 : order.id]
|
|
136
|
+
},
|
|
137
|
+
children: ({ items }) => /* @__PURE__ */ jsx(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
...{
|
|
141
|
+
className: "divide-y divide-gray"
|
|
142
|
+
},
|
|
143
|
+
children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
...{
|
|
147
|
+
className: "flex items-center justify-between gap-4 py-4 first:pt-0 last:pb-0"
|
|
148
|
+
},
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ jsxs(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
...{
|
|
154
|
+
className: "flex items-center gap-3 min-w-0"
|
|
155
|
+
},
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ jsx("p", { children: date(item.createdAt) }),
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
Badge,
|
|
160
|
+
{
|
|
161
|
+
...{
|
|
162
|
+
type: item.status === "active" ? "success" : "secondary"
|
|
163
|
+
},
|
|
164
|
+
children: item.status === "active" ? "Fulfilled" : "Canceled"
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
item.status === "active" && /* @__PURE__ */ jsx(
|
|
171
|
+
Button,
|
|
172
|
+
{
|
|
173
|
+
...{
|
|
174
|
+
...small,
|
|
175
|
+
disabled: !controls.cancel,
|
|
176
|
+
onClick: () => cancel(item)
|
|
177
|
+
},
|
|
178
|
+
children: "Cancel"
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
item.id
|
|
184
|
+
))
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
export {
|
|
193
|
+
OrderFulfillment,
|
|
194
|
+
fulfillmentControls,
|
|
195
|
+
useConfirm
|
|
196
|
+
};
|
|
@@ -31,7 +31,8 @@ __export(preview_exports, {
|
|
|
31
31
|
PreviewPage: () => PreviewPage,
|
|
32
32
|
clamp: () => clamp,
|
|
33
33
|
default: () => preview_default,
|
|
34
|
-
fitScale: () => fitScale
|
|
34
|
+
fitScale: () => fitScale,
|
|
35
|
+
scroller: () => scroller
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(preview_exports);
|
|
37
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -62,6 +63,17 @@ const ZOOMS = [
|
|
|
62
63
|
];
|
|
63
64
|
const clamp = (value, limit) => Math.min(limit, Math.max(-limit, value));
|
|
64
65
|
const fitScale = (space, size) => space.width && size.width ? Math.min(1, (space.width - GUTTER) / size.width, (space.height - GUTTER) / size.height) : 1;
|
|
66
|
+
const scroller = (node) => {
|
|
67
|
+
for (const iframe of (node == null ? void 0 : node.querySelectorAll("iframe")) || []) {
|
|
68
|
+
const doc = iframe.contentDocument;
|
|
69
|
+
const element = doc == null ? void 0 : doc.scrollingElement;
|
|
70
|
+
if (element && element.scrollHeight > element.clientHeight) return element;
|
|
71
|
+
const inner = doc && scroller(doc);
|
|
72
|
+
if (inner) return inner;
|
|
73
|
+
}
|
|
74
|
+
;
|
|
75
|
+
return null;
|
|
76
|
+
};
|
|
65
77
|
const PreviewFrame = ({
|
|
66
78
|
children,
|
|
67
79
|
states
|
|
@@ -105,6 +117,20 @@ const PreviewFrame = ({
|
|
|
105
117
|
(0, import_react.useLayoutEffect)(() => {
|
|
106
118
|
setOffset({ x: 0, y: 0 });
|
|
107
119
|
}, [device, zoom]);
|
|
120
|
+
(0, import_react.useEffect)(() => {
|
|
121
|
+
const node = area.current;
|
|
122
|
+
const { screen, viewport } = import_device.DEVICE_TYPES[device];
|
|
123
|
+
const ratio = scale * screen.width / viewport;
|
|
124
|
+
const onWheel = (event) => {
|
|
125
|
+
const element = scroller(frame.current);
|
|
126
|
+
if (!element || !event.deltaY) return;
|
|
127
|
+
const top = element.scrollTop;
|
|
128
|
+
element.scrollTop = top + event.deltaY * (event.deltaMode === 1 ? 16 : 1) / ratio;
|
|
129
|
+
if (element.scrollTop !== top) event.preventDefault();
|
|
130
|
+
};
|
|
131
|
+
node.addEventListener("wheel", onWheel, { passive: false });
|
|
132
|
+
return () => node.removeEventListener("wheel", onWheel);
|
|
133
|
+
}, [device, scale]);
|
|
108
134
|
(0, import_react.useEffect)(() => {
|
|
109
135
|
if (!ease) return;
|
|
110
136
|
const timer = setTimeout(() => setEase(false), 200);
|
|
@@ -415,5 +441,6 @@ var preview_default = Preview;
|
|
|
415
441
|
0 && (module.exports = {
|
|
416
442
|
PreviewPage,
|
|
417
443
|
clamp,
|
|
418
|
-
fitScale
|
|
444
|
+
fitScale,
|
|
445
|
+
scroller
|
|
419
446
|
});
|
|
@@ -5,7 +5,7 @@ import { createPortal } from "react-dom";
|
|
|
5
5
|
import Button from "../shared/button.mjs";
|
|
6
6
|
import LoaderComponent from "../shared/loader.mjs";
|
|
7
7
|
import InputCombobox from "./input-combobox.mjs";
|
|
8
|
-
import Device from "./device.mjs";
|
|
8
|
+
import Device, { DEVICE_TYPES } from "./device.mjs";
|
|
9
9
|
import Desktop from "../icons/desktop.mjs";
|
|
10
10
|
import Phone from "../icons/phone.mjs";
|
|
11
11
|
import Tablet from "../icons/tablet.mjs";
|
|
@@ -27,6 +27,17 @@ const ZOOMS = [
|
|
|
27
27
|
];
|
|
28
28
|
const clamp = (value, limit) => Math.min(limit, Math.max(-limit, value));
|
|
29
29
|
const fitScale = (space, size) => space.width && size.width ? Math.min(1, (space.width - GUTTER) / size.width, (space.height - GUTTER) / size.height) : 1;
|
|
30
|
+
const scroller = (node) => {
|
|
31
|
+
for (const iframe of (node == null ? void 0 : node.querySelectorAll("iframe")) || []) {
|
|
32
|
+
const doc = iframe.contentDocument;
|
|
33
|
+
const element = doc == null ? void 0 : doc.scrollingElement;
|
|
34
|
+
if (element && element.scrollHeight > element.clientHeight) return element;
|
|
35
|
+
const inner = doc && scroller(doc);
|
|
36
|
+
if (inner) return inner;
|
|
37
|
+
}
|
|
38
|
+
;
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
30
41
|
const PreviewFrame = ({
|
|
31
42
|
children,
|
|
32
43
|
states
|
|
@@ -70,6 +81,20 @@ const PreviewFrame = ({
|
|
|
70
81
|
useLayoutEffect(() => {
|
|
71
82
|
setOffset({ x: 0, y: 0 });
|
|
72
83
|
}, [device, zoom]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const node = area.current;
|
|
86
|
+
const { screen, viewport } = DEVICE_TYPES[device];
|
|
87
|
+
const ratio = scale * screen.width / viewport;
|
|
88
|
+
const onWheel = (event) => {
|
|
89
|
+
const element = scroller(frame.current);
|
|
90
|
+
if (!element || !event.deltaY) return;
|
|
91
|
+
const top = element.scrollTop;
|
|
92
|
+
element.scrollTop = top + event.deltaY * (event.deltaMode === 1 ? 16 : 1) / ratio;
|
|
93
|
+
if (element.scrollTop !== top) event.preventDefault();
|
|
94
|
+
};
|
|
95
|
+
node.addEventListener("wheel", onWheel, { passive: false });
|
|
96
|
+
return () => node.removeEventListener("wheel", onWheel);
|
|
97
|
+
}, [device, scale]);
|
|
73
98
|
useEffect(() => {
|
|
74
99
|
if (!ease) return;
|
|
75
100
|
const timer = setTimeout(() => setEase(false), 200);
|
|
@@ -380,5 +405,6 @@ export {
|
|
|
380
405
|
PreviewPage,
|
|
381
406
|
clamp,
|
|
382
407
|
preview_default as default,
|
|
383
|
-
fitScale
|
|
408
|
+
fitScale,
|
|
409
|
+
scroller
|
|
384
410
|
};
|
package/dist/dashboard/steps.js
CHANGED
|
@@ -54,6 +54,10 @@ const NOTIFY_LABELS = {
|
|
|
54
54
|
processing: "Sending",
|
|
55
55
|
succeeded: "Email sent"
|
|
56
56
|
};
|
|
57
|
+
const PART_LABELS = {
|
|
58
|
+
email: "the email of Auto response",
|
|
59
|
+
sms: "the text of Auto response"
|
|
60
|
+
};
|
|
57
61
|
const indicatorType = (status) => {
|
|
58
62
|
if (status === "succeeded") return "active";
|
|
59
63
|
if (status === "failed") return "error";
|
|
@@ -233,6 +237,7 @@ const groupTitle = ({ count, email, items, kind, pending }, labels = []) => {
|
|
|
233
237
|
};
|
|
234
238
|
const rowLabel = ({ item, kind, labels = [] }) => {
|
|
235
239
|
var _a;
|
|
240
|
+
if (kind !== "notify" && PART_LABELS[item == null ? void 0 : item.part]) return PART_LABELS[item.part];
|
|
236
241
|
if (kind !== "notify") return ((_a = labels.find((option) => option.value === (item == null ? void 0 : item.slug))) == null ? void 0 : _a.key) || (item == null ? void 0 : item.slug);
|
|
237
242
|
return NOTIFY_LABELS[item == null ? void 0 : item.status] || NOTIFY_LABELS.succeeded;
|
|
238
243
|
};
|
package/dist/dashboard/steps.mjs
CHANGED
|
@@ -18,6 +18,10 @@ const NOTIFY_LABELS = {
|
|
|
18
18
|
processing: "Sending",
|
|
19
19
|
succeeded: "Email sent"
|
|
20
20
|
};
|
|
21
|
+
const PART_LABELS = {
|
|
22
|
+
email: "the email of Auto response",
|
|
23
|
+
sms: "the text of Auto response"
|
|
24
|
+
};
|
|
21
25
|
const indicatorType = (status) => {
|
|
22
26
|
if (status === "succeeded") return "active";
|
|
23
27
|
if (status === "failed") return "error";
|
|
@@ -197,6 +201,7 @@ const groupTitle = ({ count, email, items, kind, pending }, labels = []) => {
|
|
|
197
201
|
};
|
|
198
202
|
const rowLabel = ({ item, kind, labels = [] }) => {
|
|
199
203
|
var _a;
|
|
204
|
+
if (kind !== "notify" && PART_LABELS[item == null ? void 0 : item.part]) return PART_LABELS[item.part];
|
|
200
205
|
if (kind !== "notify") return ((_a = labels.find((option) => option.value === (item == null ? void 0 : item.slug))) == null ? void 0 : _a.key) || (item == null ? void 0 : item.slug);
|
|
201
206
|
return NOTIFY_LABELS[item == null ? void 0 : item.status] || NOTIFY_LABELS.succeeded;
|
|
202
207
|
};
|
|
@@ -320,6 +320,12 @@ const TemplateSocketOrganization = ({
|
|
|
320
320
|
queryClient.invalidateQueries({
|
|
321
321
|
queryKey: ["organization-campaign-missions"]
|
|
322
322
|
});
|
|
323
|
+
queryClient.invalidateQueries({
|
|
324
|
+
queryKey: ["organization-workflows", params.organization]
|
|
325
|
+
});
|
|
326
|
+
queryClient.invalidateQueries({
|
|
327
|
+
queryKey: ["organization-workflow", params.organization]
|
|
328
|
+
});
|
|
323
329
|
},
|
|
324
330
|
"organization.connections": () => {
|
|
325
331
|
queryClient.invalidateQueries({
|
|
@@ -285,6 +285,12 @@ const TemplateSocketOrganization = ({
|
|
|
285
285
|
queryClient.invalidateQueries({
|
|
286
286
|
queryKey: ["organization-campaign-missions"]
|
|
287
287
|
});
|
|
288
|
+
queryClient.invalidateQueries({
|
|
289
|
+
queryKey: ["organization-workflows", params.organization]
|
|
290
|
+
});
|
|
291
|
+
queryClient.invalidateQueries({
|
|
292
|
+
queryKey: ["organization-workflow", params.organization]
|
|
293
|
+
});
|
|
288
294
|
},
|
|
289
295
|
"organization.connections": () => {
|
|
290
296
|
queryClient.invalidateQueries({
|
package/dist/input-code.js
CHANGED
|
@@ -42,11 +42,9 @@ const InputCode = ({
|
|
|
42
42
|
length = 6,
|
|
43
43
|
name,
|
|
44
44
|
onChange,
|
|
45
|
-
onComplete,
|
|
46
45
|
style,
|
|
47
46
|
value
|
|
48
47
|
}) => {
|
|
49
|
-
const digits = codeDigits(value, length);
|
|
50
48
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
49
|
import_input_text.default,
|
|
52
50
|
{
|
|
@@ -63,15 +61,11 @@ const InputCode = ({
|
|
|
63
61
|
inputMode: "numeric",
|
|
64
62
|
maxLength: length,
|
|
65
63
|
name,
|
|
66
|
-
onChange: (text) =>
|
|
67
|
-
const next = codeDigits(text, length);
|
|
68
|
-
onChange == null ? void 0 : onChange(next);
|
|
69
|
-
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
70
|
-
},
|
|
64
|
+
onChange: (text) => onChange == null ? void 0 : onChange(codeDigits(text, length)),
|
|
71
65
|
pattern: "[0-9]*",
|
|
72
66
|
style,
|
|
73
67
|
type: "text",
|
|
74
|
-
value:
|
|
68
|
+
value: codeDigits(value, length)
|
|
75
69
|
}
|
|
76
70
|
}
|
|
77
71
|
);
|
package/dist/input-code.mjs
CHANGED
|
@@ -9,11 +9,9 @@ const InputCode = ({
|
|
|
9
9
|
length = 6,
|
|
10
10
|
name,
|
|
11
11
|
onChange,
|
|
12
|
-
onComplete,
|
|
13
12
|
style,
|
|
14
13
|
value
|
|
15
14
|
}) => {
|
|
16
|
-
const digits = codeDigits(value, length);
|
|
17
15
|
return /* @__PURE__ */ jsx(
|
|
18
16
|
InputText,
|
|
19
17
|
{
|
|
@@ -30,15 +28,11 @@ const InputCode = ({
|
|
|
30
28
|
inputMode: "numeric",
|
|
31
29
|
maxLength: length,
|
|
32
30
|
name,
|
|
33
|
-
onChange: (text) =>
|
|
34
|
-
const next = codeDigits(text, length);
|
|
35
|
-
onChange == null ? void 0 : onChange(next);
|
|
36
|
-
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
37
|
-
},
|
|
31
|
+
onChange: (text) => onChange == null ? void 0 : onChange(codeDigits(text, length)),
|
|
38
32
|
pattern: "[0-9]*",
|
|
39
33
|
style,
|
|
40
34
|
type: "text",
|
|
41
|
-
value:
|
|
35
|
+
value: codeDigits(value, length)
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
38
|
);
|
|
@@ -321,6 +321,13 @@ const statuses = {
|
|
|
321
321
|
member: {
|
|
322
322
|
pending: { text: "Invited", type: "warning" }
|
|
323
323
|
},
|
|
324
|
+
// @story campaigns/manage-order
|
|
325
|
+
// A form order's badge beside its customer on Orders: only a closed order
|
|
326
|
+
// shows one, Canceled red as a canceled subscription is.
|
|
327
|
+
order: {
|
|
328
|
+
canceled: { text: "Canceled", type: "error" },
|
|
329
|
+
completed: { text: "Completed", type: "success" }
|
|
330
|
+
},
|
|
324
331
|
organization: Object.fromEntries(organizationStatuses.map((status) => [status, { text: (0, import_drawbridge_utils.capitalize)(status.replace("_", " ")), type: ["active", "unsubscribed"].includes(status) ? "success" : status === "paused" ? "warning" : "error" }])),
|
|
325
332
|
page: published,
|
|
326
333
|
prize: published,
|