@drawbridge/components 0.1.47 → 0.1.48
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/cart-drawer.js +152 -0
- package/dist/bridge/cart-drawer.mjs +123 -0
- package/dist/bridge/fields.js +278 -0
- package/dist/bridge/fields.mjs +276 -1
- package/dist/bridge/form-subdomain-checkout.js +687 -0
- package/dist/bridge/form-subdomain-checkout.mjs +665 -0
- package/dist/bridge/form-subdomain-shop-modal.js +234 -274
- package/dist/bridge/form-subdomain-shop-modal.mjs +233 -275
- package/dist/bridge/form-subdomain.js +1 -0
- package/dist/bridge/form-subdomain.mjs +2 -1
- package/dist/bridge/lib/age-gate.js +12 -0
- package/dist/bridge/lib/age-gate.mjs +11 -0
- package/dist/bridge/lib/cart.js +79 -0
- package/dist/bridge/lib/cart.mjs +48 -0
- package/dist/bridge/lib/checkout-kit.js +2 -32
- package/dist/bridge/lib/checkout-kit.mjs +2 -32
- package/dist/bridge/product-tile.js +9 -6
- package/dist/bridge/product-tile.mjs +9 -6
- package/dist/bridge/template-layout.js +237 -122
- package/dist/bridge/template-layout.mjs +237 -122
- package/dist/bridge/template-modal.js +28 -73
- package/dist/bridge/template-modal.mjs +29 -74
- package/dist/dashboard/buttons-subscription.js +1 -1
- package/dist/dashboard/buttons-subscription.mjs +1 -1
- package/dist/dashboard/campaign-form.js +7 -2
- package/dist/dashboard/campaign-form.mjs +7 -2
- package/dist/dashboard/card-order.js +22 -4
- package/dist/dashboard/card-order.mjs +22 -4
- package/dist/dashboard/embed-stripe.js +145 -0
- package/dist/dashboard/embed-stripe.mjs +116 -0
- package/dist/dashboard/form-admin-provider.js +71 -17
- package/dist/dashboard/form-admin-provider.mjs +71 -17
- package/dist/dashboard/form-file-upload.js +3 -2
- package/dist/dashboard/form-file-upload.mjs +4 -3
- package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
- package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
- package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
- package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
- package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
- package/dist/dashboard/form-organization-campaign.js +82 -0
- package/dist/dashboard/form-organization-campaign.mjs +81 -0
- package/dist/dashboard/form-organization-connection.js +48 -6
- package/dist/dashboard/form-organization-connection.mjs +48 -7
- package/dist/dashboard/form-organization-product.js +1461 -0
- package/dist/dashboard/form-organization-product.mjs +1425 -0
- package/dist/dashboard/form-organization-workflow.js +72 -1
- package/dist/dashboard/form-organization-workflow.mjs +69 -1
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-stripe.js +12 -5
- package/dist/dashboard/form-stripe.mjs +12 -5
- package/dist/dashboard/input-fields.js +11 -158
- package/dist/dashboard/input-fields.mjs +11 -158
- package/dist/dashboard/input-file.js +21 -4
- package/dist/dashboard/input-file.mjs +21 -4
- package/dist/dashboard/input-gallery.js +201 -0
- package/dist/dashboard/input-gallery.mjs +172 -0
- package/dist/dashboard/lib/connection-controls.js +5 -2
- package/dist/dashboard/lib/connection-controls.mjs +3 -1
- package/dist/dashboard/lib/form-page.js +1 -1
- package/dist/dashboard/lib/form-page.mjs +1 -1
- package/dist/dashboard/lib/products.js +169 -0
- package/dist/dashboard/lib/products.mjs +135 -0
- package/dist/dashboard/lib/settings-paths.js +35 -0
- package/dist/dashboard/lib/settings-paths.mjs +11 -0
- package/dist/dashboard/lib/uppy.js +10 -1
- package/dist/dashboard/lib/uppy.mjs +11 -2
- package/dist/dashboard/order-sections.js +456 -6
- package/dist/dashboard/order-sections.mjs +453 -7
- package/dist/dashboard/provider-ui.js +9 -7
- package/dist/dashboard/provider-ui.mjs +9 -7
- package/dist/dashboard/shipping-rates.js +404 -0
- package/dist/dashboard/shipping-rates.mjs +371 -0
- package/dist/dashboard/template-buyer.js +301 -0
- package/dist/dashboard/template-buyer.mjs +267 -0
- package/dist/input-checkbox.js +28 -10
- package/dist/input-checkbox.mjs +28 -10
- package/dist/product.js +96 -24
- package/dist/product.mjs +97 -25
- package/dist/shared/lib/helpers.js +54 -6
- package/dist/shared/lib/helpers.mjs +53 -8
- package/dist/shared/order-summary.js +139 -0
- package/dist/shared/order-summary.mjs +110 -0
- package/package.json +74 -4
- package/types/bridge/cart-drawer.d.ts +31 -0
- package/types/bridge/fields.d.ts +14 -2
- package/types/bridge/form-subdomain-checkout.d.ts +20 -0
- package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
- package/types/bridge/lib/age-gate.d.ts +5 -0
- package/types/bridge/lib/cart.d.ts +44 -0
- package/types/bridge/lib/checkout-kit.d.ts +2 -10
- package/types/dashboard/card-order.d.ts +6 -0
- package/types/dashboard/embed-stripe.d.ts +25 -0
- package/types/dashboard/form-admin-provider.d.ts +9 -2
- package/types/dashboard/form-file-upload.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
- package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
- package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
- package/types/dashboard/form-organization-campaign.d.ts +3 -0
- package/types/dashboard/form-organization-connection.d.ts +11 -0
- package/types/dashboard/form-organization-product.d.ts +24 -0
- package/types/dashboard/form-otc.d.ts +5 -1
- package/types/dashboard/form-stripe.d.ts +3 -2
- package/types/dashboard/input-file.d.ts +2 -0
- package/types/dashboard/input-gallery.d.ts +14 -0
- package/types/dashboard/lib/products.d.ts +14 -0
- package/types/dashboard/lib/settings-paths.d.ts +5 -0
- package/types/dashboard/order-sections.d.ts +24 -1
- package/types/dashboard/shipping-rates.d.ts +26 -0
- package/types/dashboard/template-buyer.d.ts +50 -0
- package/types/input-checkbox.d.ts +2 -0
- package/types/shared/lib/helpers.d.ts +4 -0
- package/types/shared/order-summary.d.ts +19 -0
|
@@ -27,9 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var form_organization_workflow_exports = {};
|
|
29
29
|
__export(form_organization_workflow_exports, {
|
|
30
|
+
ABANDONED: () => ABANDONED,
|
|
30
31
|
FormOrganizationWorkflowEdit: () => FormOrganizationWorkflowEdit,
|
|
31
32
|
RESPONSE: () => RESPONSE,
|
|
32
33
|
TextPreview: () => TextPreview,
|
|
34
|
+
afterOptions: () => afterOptions,
|
|
35
|
+
afterValue: () => afterValue,
|
|
33
36
|
firstEntryOnly: () => firstEntryOnly,
|
|
34
37
|
hasStepOptions: () => hasStepOptions,
|
|
35
38
|
issueRow: () => issueRow,
|
|
@@ -60,6 +63,7 @@ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
|
60
63
|
var import_features = require("@drawbridge/drawbridge-utils/features");
|
|
61
64
|
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
62
65
|
var import_html = require("@drawbridge/drawbridge-utils/html");
|
|
66
|
+
var import_products = require("@drawbridge/drawbridge-utils/products");
|
|
63
67
|
var import_form = require("../shared/lib/form");
|
|
64
68
|
var import_react_query = require("@tanstack/react-query");
|
|
65
69
|
var import_yup = __toESM(require("../shared/lib/yup"));
|
|
@@ -68,6 +72,7 @@ var import_fieldset = __toESM(require("../shared/fieldset"));
|
|
|
68
72
|
var import_input_group = __toESM(require("../input-group"));
|
|
69
73
|
var import_error = __toESM(require("../shared/error"));
|
|
70
74
|
var import_input_textarea = __toESM(require("../input-textarea"));
|
|
75
|
+
var import_input_select = __toESM(require("../input-select"));
|
|
71
76
|
var import_input_url = __toESM(require("../shared/input-url"));
|
|
72
77
|
var import_input_resource = __toESM(require("./input-resource"));
|
|
73
78
|
var import_input_combobox = __toESM(require("./input-combobox"));
|
|
@@ -97,6 +102,12 @@ const firstEntryOnly = ({ campaign, event, type }) => {
|
|
|
97
102
|
if (type === "step.sms.send") return ((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.submissionLeadPrimaryKey) !== "phone";
|
|
98
103
|
return true;
|
|
99
104
|
};
|
|
105
|
+
const ABANDONED = "cart.abandoned";
|
|
106
|
+
const afterOptions = import_products.ABANDON_HOURS.map((hours) => ({
|
|
107
|
+
label: hours + (hours === 1 ? " hour" : " hours"),
|
|
108
|
+
value: String(hours)
|
|
109
|
+
}));
|
|
110
|
+
const afterValue = (trigger) => String(import_products.ABANDON_HOURS.includes(trigger == null ? void 0 : trigger.after) ? trigger.after : import_products.ABANDON_AFTER);
|
|
100
111
|
const stepPrefills = {
|
|
101
112
|
"step.email.send": {
|
|
102
113
|
message: import_drawbridge_utils.constants.campaign.confirmation.message,
|
|
@@ -573,6 +584,15 @@ const LeadEmailNote = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
573
584
|
children: "Drawbridge adds the entrant's order and missions under your message. You can't edit or remove them."
|
|
574
585
|
}
|
|
575
586
|
);
|
|
587
|
+
const CartEmailNote = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
588
|
+
"p",
|
|
589
|
+
{
|
|
590
|
+
...{
|
|
591
|
+
className: "text-sm text-gray-dark"
|
|
592
|
+
},
|
|
593
|
+
children: "Drawbridge adds the lead's cart and a button back to it under your message."
|
|
594
|
+
}
|
|
595
|
+
);
|
|
576
596
|
const RESPONSE_STATES = [
|
|
577
597
|
{
|
|
578
598
|
key: "Email",
|
|
@@ -1019,6 +1039,10 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1019
1039
|
);
|
|
1020
1040
|
const { control, formState, getValues, handleSubmit, reset, setValue, watch } = (0, import_form.useForm)({
|
|
1021
1041
|
values: {
|
|
1042
|
+
// @story workflows/cart-abandonment
|
|
1043
|
+
...event === ABANDONED && {
|
|
1044
|
+
after: afterValue(values == null ? void 0 : values.trigger)
|
|
1045
|
+
},
|
|
1022
1046
|
steps: defaultSteps
|
|
1023
1047
|
},
|
|
1024
1048
|
resolver: (0, import_yup.resolver)(workflowSchema)
|
|
@@ -1172,11 +1196,17 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1172
1196
|
);
|
|
1173
1197
|
};
|
|
1174
1198
|
const onSubmit = async ({
|
|
1199
|
+
after,
|
|
1175
1200
|
steps
|
|
1176
1201
|
}) => {
|
|
1177
1202
|
var _a2;
|
|
1178
1203
|
try {
|
|
1179
1204
|
const body = {
|
|
1205
|
+
// @story workflows/cart-abandonment
|
|
1206
|
+
// Send after, saved by the same Save as the steps.
|
|
1207
|
+
...event === ABANDONED && {
|
|
1208
|
+
after: Number(after)
|
|
1209
|
+
},
|
|
1180
1210
|
steps: steps.map(({ connectionId, discount, enabled, members, message, score, settings: parts, slug, subject, text, type, url }, index) => {
|
|
1181
1211
|
const settings = type === RESPONSE ? responseSave(parts) : {};
|
|
1182
1212
|
if (type === RESPONSE && parts.email.score && !settings.email.score) setValue("steps." + index + ".settings.email.score", null);
|
|
@@ -1256,6 +1286,43 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1256
1286
|
variant: "gray"
|
|
1257
1287
|
},
|
|
1258
1288
|
children: [
|
|
1289
|
+
event === ABANDONED && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1290
|
+
import_card_section.default,
|
|
1291
|
+
{
|
|
1292
|
+
...{
|
|
1293
|
+
className: "mb-4",
|
|
1294
|
+
title: "Send after"
|
|
1295
|
+
},
|
|
1296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1297
|
+
import_form.Controller,
|
|
1298
|
+
{
|
|
1299
|
+
...{
|
|
1300
|
+
control,
|
|
1301
|
+
name: "after",
|
|
1302
|
+
render: ({ field: { onChange, value } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1303
|
+
import_input_group.default,
|
|
1304
|
+
{
|
|
1305
|
+
...{
|
|
1306
|
+
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1307
|
+
import_input_select.default,
|
|
1308
|
+
{
|
|
1309
|
+
...{
|
|
1310
|
+
"aria-label": "Send after",
|
|
1311
|
+
onChange,
|
|
1312
|
+
options: afterOptions,
|
|
1313
|
+
value
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
),
|
|
1317
|
+
message: "Counted from the last change to the cart."
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
)
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
)
|
|
1324
|
+
}
|
|
1325
|
+
),
|
|
1259
1326
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1260
1327
|
import_input_group.default,
|
|
1261
1328
|
{
|
|
@@ -1445,7 +1512,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1445
1512
|
var _a4;
|
|
1446
1513
|
const [type] = val.split("::");
|
|
1447
1514
|
const option = getStepOptions(index).find((o) => o.value === val);
|
|
1448
|
-
const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
|
|
1515
|
+
const copy = event === ABANDONED ? null : pickedCopy({ row: getValues(`steps.${index}`), type });
|
|
1449
1516
|
setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
|
|
1450
1517
|
onChange(type);
|
|
1451
1518
|
setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
|
|
@@ -1582,6 +1649,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1582
1649
|
}
|
|
1583
1650
|
),
|
|
1584
1651
|
event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeadEmailNote, {}),
|
|
1652
|
+
event === ABANDONED && emailSteps.includes(step.type) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CartEmailNote, {}),
|
|
1585
1653
|
step.type === "step.sms.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1586
1654
|
import_form.Controller,
|
|
1587
1655
|
{
|
|
@@ -1724,9 +1792,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1724
1792
|
};
|
|
1725
1793
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1726
1794
|
0 && (module.exports = {
|
|
1795
|
+
ABANDONED,
|
|
1727
1796
|
FormOrganizationWorkflowEdit,
|
|
1728
1797
|
RESPONSE,
|
|
1729
1798
|
TextPreview,
|
|
1799
|
+
afterOptions,
|
|
1800
|
+
afterValue,
|
|
1730
1801
|
firstEntryOnly,
|
|
1731
1802
|
hasStepOptions,
|
|
1732
1803
|
issueRow,
|
|
@@ -6,6 +6,7 @@ import { constants, getPlanFeature } from "@drawbridge/drawbridge-utils";
|
|
|
6
6
|
import { organization as organizationFeatures } from "@drawbridge/drawbridge-utils/features";
|
|
7
7
|
import { isTransientError, request } from "@drawbridge/drawbridge-utils/fetch";
|
|
8
8
|
import { escapeHtml } from "@drawbridge/drawbridge-utils/html";
|
|
9
|
+
import { ABANDON_AFTER, ABANDON_HOURS } from "@drawbridge/drawbridge-utils/products";
|
|
9
10
|
import { useForm, useWatch, Controller } from "../shared/lib/form.mjs";
|
|
10
11
|
import { keepPreviousData, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
11
12
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
@@ -14,6 +15,7 @@ import Fieldset from "../shared/fieldset.mjs";
|
|
|
14
15
|
import InputGroup from "../input-group.mjs";
|
|
15
16
|
import Error from "../shared/error.mjs";
|
|
16
17
|
import InputTextarea from "../input-textarea.mjs";
|
|
18
|
+
import InputSelect from "../input-select.mjs";
|
|
17
19
|
import InputUrl from "../shared/input-url.mjs";
|
|
18
20
|
import InputResource from "./input-resource.mjs";
|
|
19
21
|
import InputCombobox from "./input-combobox.mjs";
|
|
@@ -43,6 +45,12 @@ const firstEntryOnly = ({ campaign, event, type }) => {
|
|
|
43
45
|
if (type === "step.sms.send") return ((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.submissionLeadPrimaryKey) !== "phone";
|
|
44
46
|
return true;
|
|
45
47
|
};
|
|
48
|
+
const ABANDONED = "cart.abandoned";
|
|
49
|
+
const afterOptions = ABANDON_HOURS.map((hours) => ({
|
|
50
|
+
label: hours + (hours === 1 ? " hour" : " hours"),
|
|
51
|
+
value: String(hours)
|
|
52
|
+
}));
|
|
53
|
+
const afterValue = (trigger) => String(ABANDON_HOURS.includes(trigger == null ? void 0 : trigger.after) ? trigger.after : ABANDON_AFTER);
|
|
46
54
|
const stepPrefills = {
|
|
47
55
|
"step.email.send": {
|
|
48
56
|
message: constants.campaign.confirmation.message,
|
|
@@ -519,6 +527,15 @@ const LeadEmailNote = () => /* @__PURE__ */ jsx(
|
|
|
519
527
|
children: "Drawbridge adds the entrant's order and missions under your message. You can't edit or remove them."
|
|
520
528
|
}
|
|
521
529
|
);
|
|
530
|
+
const CartEmailNote = () => /* @__PURE__ */ jsx(
|
|
531
|
+
"p",
|
|
532
|
+
{
|
|
533
|
+
...{
|
|
534
|
+
className: "text-sm text-gray-dark"
|
|
535
|
+
},
|
|
536
|
+
children: "Drawbridge adds the lead's cart and a button back to it under your message."
|
|
537
|
+
}
|
|
538
|
+
);
|
|
522
539
|
const RESPONSE_STATES = [
|
|
523
540
|
{
|
|
524
541
|
key: "Email",
|
|
@@ -965,6 +982,10 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
965
982
|
);
|
|
966
983
|
const { control, formState, getValues, handleSubmit, reset, setValue, watch } = useForm({
|
|
967
984
|
values: {
|
|
985
|
+
// @story workflows/cart-abandonment
|
|
986
|
+
...event === ABANDONED && {
|
|
987
|
+
after: afterValue(values == null ? void 0 : values.trigger)
|
|
988
|
+
},
|
|
968
989
|
steps: defaultSteps
|
|
969
990
|
},
|
|
970
991
|
resolver: resolver(workflowSchema)
|
|
@@ -1118,11 +1139,17 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1118
1139
|
);
|
|
1119
1140
|
};
|
|
1120
1141
|
const onSubmit = async ({
|
|
1142
|
+
after,
|
|
1121
1143
|
steps
|
|
1122
1144
|
}) => {
|
|
1123
1145
|
var _a2;
|
|
1124
1146
|
try {
|
|
1125
1147
|
const body = {
|
|
1148
|
+
// @story workflows/cart-abandonment
|
|
1149
|
+
// Send after, saved by the same Save as the steps.
|
|
1150
|
+
...event === ABANDONED && {
|
|
1151
|
+
after: Number(after)
|
|
1152
|
+
},
|
|
1126
1153
|
steps: steps.map(({ connectionId, discount, enabled, members, message, score, settings: parts, slug, subject, text, type, url }, index) => {
|
|
1127
1154
|
const settings = type === RESPONSE ? responseSave(parts) : {};
|
|
1128
1155
|
if (type === RESPONSE && parts.email.score && !settings.email.score) setValue("steps." + index + ".settings.email.score", null);
|
|
@@ -1202,6 +1229,43 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1202
1229
|
variant: "gray"
|
|
1203
1230
|
},
|
|
1204
1231
|
children: [
|
|
1232
|
+
event === ABANDONED && /* @__PURE__ */ jsx(
|
|
1233
|
+
CardSection,
|
|
1234
|
+
{
|
|
1235
|
+
...{
|
|
1236
|
+
className: "mb-4",
|
|
1237
|
+
title: "Send after"
|
|
1238
|
+
},
|
|
1239
|
+
children: /* @__PURE__ */ jsx(
|
|
1240
|
+
Controller,
|
|
1241
|
+
{
|
|
1242
|
+
...{
|
|
1243
|
+
control,
|
|
1244
|
+
name: "after",
|
|
1245
|
+
render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsx(
|
|
1246
|
+
InputGroup,
|
|
1247
|
+
{
|
|
1248
|
+
...{
|
|
1249
|
+
input: /* @__PURE__ */ jsx(
|
|
1250
|
+
InputSelect,
|
|
1251
|
+
{
|
|
1252
|
+
...{
|
|
1253
|
+
"aria-label": "Send after",
|
|
1254
|
+
onChange,
|
|
1255
|
+
options: afterOptions,
|
|
1256
|
+
value
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
),
|
|
1260
|
+
message: "Counted from the last change to the cart."
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
)
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
)
|
|
1267
|
+
}
|
|
1268
|
+
),
|
|
1205
1269
|
/* @__PURE__ */ jsx(
|
|
1206
1270
|
InputGroup,
|
|
1207
1271
|
{
|
|
@@ -1391,7 +1455,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1391
1455
|
var _a4;
|
|
1392
1456
|
const [type] = val.split("::");
|
|
1393
1457
|
const option = getStepOptions(index).find((o) => o.value === val);
|
|
1394
|
-
const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
|
|
1458
|
+
const copy = event === ABANDONED ? null : pickedCopy({ row: getValues(`steps.${index}`), type });
|
|
1395
1459
|
setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
|
|
1396
1460
|
onChange(type);
|
|
1397
1461
|
setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
|
|
@@ -1528,6 +1592,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1528
1592
|
}
|
|
1529
1593
|
),
|
|
1530
1594
|
event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(LeadEmailNote, {}),
|
|
1595
|
+
event === ABANDONED && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(CartEmailNote, {}),
|
|
1531
1596
|
step.type === "step.sms.send" && /* @__PURE__ */ jsx(
|
|
1532
1597
|
Controller,
|
|
1533
1598
|
{
|
|
@@ -1669,9 +1734,12 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1669
1734
|
);
|
|
1670
1735
|
};
|
|
1671
1736
|
export {
|
|
1737
|
+
ABANDONED,
|
|
1672
1738
|
FormOrganizationWorkflowEdit,
|
|
1673
1739
|
RESPONSE,
|
|
1674
1740
|
TextPreview,
|
|
1741
|
+
afterOptions,
|
|
1742
|
+
afterValue,
|
|
1675
1743
|
firstEntryOnly,
|
|
1676
1744
|
hasStepOptions,
|
|
1677
1745
|
issueRow,
|
|
@@ -42,8 +42,10 @@ var import_input_group = __toESM(require("../input-group"));
|
|
|
42
42
|
var import_input_code = __toESM(require("../input-code"));
|
|
43
43
|
var import_button = __toESM(require("../shared/button"));
|
|
44
44
|
const FormOtcCode = ({
|
|
45
|
+
message,
|
|
45
46
|
onError,
|
|
46
47
|
onSuccess,
|
|
48
|
+
title = "Authorization",
|
|
47
49
|
values
|
|
48
50
|
}) => {
|
|
49
51
|
const [submitting, setSubmitting] = (0, import_react.useState)(false);
|
|
@@ -79,11 +81,8 @@ const FormOtcCode = ({
|
|
|
79
81
|
disabled: submitting
|
|
80
82
|
},
|
|
81
83
|
children: [
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children:
|
|
83
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
84
|
-
"A code will be sent to ",
|
|
85
|
-
values == null ? void 0 : values.identifier
|
|
86
|
-
] })
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: title }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: message || "A code will be sent to " + (values == null ? void 0 : values.identifier) })
|
|
87
86
|
]
|
|
88
87
|
}
|
|
89
88
|
),
|
|
@@ -9,8 +9,10 @@ import InputGroup from "../input-group.mjs";
|
|
|
9
9
|
import InputCode from "../input-code.mjs";
|
|
10
10
|
import Button from "../shared/button.mjs";
|
|
11
11
|
const FormOtcCode = ({
|
|
12
|
+
message,
|
|
12
13
|
onError,
|
|
13
14
|
onSuccess,
|
|
15
|
+
title = "Authorization",
|
|
14
16
|
values
|
|
15
17
|
}) => {
|
|
16
18
|
const [submitting, setSubmitting] = useState(false);
|
|
@@ -46,11 +48,8 @@ const FormOtcCode = ({
|
|
|
46
48
|
disabled: submitting
|
|
47
49
|
},
|
|
48
50
|
children: [
|
|
49
|
-
/* @__PURE__ */ jsx("h3", { children:
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
"A code will be sent to ",
|
|
52
|
-
values == null ? void 0 : values.identifier
|
|
53
|
-
] })
|
|
51
|
+
/* @__PURE__ */ jsx("h3", { children: title }),
|
|
52
|
+
/* @__PURE__ */ jsx("p", { children: message || "A code will be sent to " + (values == null ? void 0 : values.identifier) })
|
|
54
53
|
]
|
|
55
54
|
}
|
|
56
55
|
),
|
|
@@ -33,6 +33,7 @@ __export(form_stripe_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(form_stripe_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var import_react = require("react");
|
|
36
|
+
var import_react_query = require("@tanstack/react-query");
|
|
36
37
|
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
37
38
|
var import_stripe_js = require("@stripe/stripe-js");
|
|
38
39
|
var import_navigation = require("next/navigation");
|
|
@@ -43,14 +44,18 @@ var import_empty = __toESM(require("../shared/empty"));
|
|
|
43
44
|
var import_card_task = __toESM(require("./card-task"));
|
|
44
45
|
var import_provider_resource = __toESM(require("./provider-resource"));
|
|
45
46
|
var import_button = __toESM(require("../shared/button"));
|
|
46
|
-
const
|
|
47
|
+
const loaders = /* @__PURE__ */ new Map();
|
|
48
|
+
const stripeFor = (key) => {
|
|
49
|
+
if (!loaders.has(key)) loaders.set(key, (0, import_stripe_js.loadStripe)(key));
|
|
50
|
+
return loaders.get(key);
|
|
51
|
+
};
|
|
47
52
|
const FormStripeInner = ({
|
|
48
53
|
button,
|
|
49
54
|
disabled,
|
|
50
55
|
onSuccess
|
|
51
56
|
}) => {
|
|
52
57
|
const path = (0, import_navigation.usePathname)();
|
|
53
|
-
const
|
|
58
|
+
const stripe = (0, import_react_stripe_js.useStripe)();
|
|
54
59
|
const elements = (0, import_react_stripe_js.useElements)();
|
|
55
60
|
const [addressReady, setAddressReady] = (0, import_react.useState)(false);
|
|
56
61
|
const [error, setError] = (0, import_react.useState)(null);
|
|
@@ -76,7 +81,7 @@ const FormStripeInner = ({
|
|
|
76
81
|
setAddressReady(false);
|
|
77
82
|
setPaymentReady(false);
|
|
78
83
|
setError(null);
|
|
79
|
-
const { error: error2, setupIntent } = await
|
|
84
|
+
const { error: error2, setupIntent } = await stripe.confirmSetup({
|
|
80
85
|
elements,
|
|
81
86
|
confirmParams: {
|
|
82
87
|
return_url: process.env.NEXT_PUBLIC_APP_URI + path
|
|
@@ -170,14 +175,16 @@ const FormStripe = ({
|
|
|
170
175
|
disabled,
|
|
171
176
|
onSuccess
|
|
172
177
|
}) => {
|
|
173
|
-
|
|
178
|
+
var _a, _b;
|
|
179
|
+
const key = (_b = (_a = (0, import_react_query.useQueryClient)().getQueryData(["app"])) == null ? void 0 : _a.credentials) == null ? void 0 : _b.stripePublishableKey;
|
|
180
|
+
if (!clientSecret || !key) {
|
|
174
181
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_empty.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Payment was not initialized correctly" }) });
|
|
175
182
|
}
|
|
176
183
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
177
184
|
import_react_stripe_js.Elements,
|
|
178
185
|
{
|
|
179
186
|
...{
|
|
180
|
-
stripe,
|
|
187
|
+
stripe: stripeFor(key),
|
|
181
188
|
options: {
|
|
182
189
|
clientSecret,
|
|
183
190
|
appearance: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
4
|
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
4
5
|
import { loadStripe } from "@stripe/stripe-js";
|
|
5
6
|
import { usePathname } from "next/navigation";
|
|
@@ -10,14 +11,18 @@ import Empty from "../shared/empty.mjs";
|
|
|
10
11
|
import CardTask from "./card-task.mjs";
|
|
11
12
|
import ProviderResource from "./provider-resource.mjs";
|
|
12
13
|
import Button from "../shared/button.mjs";
|
|
13
|
-
const
|
|
14
|
+
const loaders = /* @__PURE__ */ new Map();
|
|
15
|
+
const stripeFor = (key) => {
|
|
16
|
+
if (!loaders.has(key)) loaders.set(key, loadStripe(key));
|
|
17
|
+
return loaders.get(key);
|
|
18
|
+
};
|
|
14
19
|
const FormStripeInner = ({
|
|
15
20
|
button,
|
|
16
21
|
disabled,
|
|
17
22
|
onSuccess
|
|
18
23
|
}) => {
|
|
19
24
|
const path = usePathname();
|
|
20
|
-
const
|
|
25
|
+
const stripe = useStripe();
|
|
21
26
|
const elements = useElements();
|
|
22
27
|
const [addressReady, setAddressReady] = useState(false);
|
|
23
28
|
const [error, setError] = useState(null);
|
|
@@ -43,7 +48,7 @@ const FormStripeInner = ({
|
|
|
43
48
|
setAddressReady(false);
|
|
44
49
|
setPaymentReady(false);
|
|
45
50
|
setError(null);
|
|
46
|
-
const { error: error2, setupIntent } = await
|
|
51
|
+
const { error: error2, setupIntent } = await stripe.confirmSetup({
|
|
47
52
|
elements,
|
|
48
53
|
confirmParams: {
|
|
49
54
|
return_url: process.env.NEXT_PUBLIC_APP_URI + path
|
|
@@ -137,14 +142,16 @@ const FormStripe = ({
|
|
|
137
142
|
disabled,
|
|
138
143
|
onSuccess
|
|
139
144
|
}) => {
|
|
140
|
-
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const key = (_b = (_a = useQueryClient().getQueryData(["app"])) == null ? void 0 : _a.credentials) == null ? void 0 : _b.stripePublishableKey;
|
|
147
|
+
if (!clientSecret || !key) {
|
|
141
148
|
return /* @__PURE__ */ jsx(Empty, { children: /* @__PURE__ */ jsx("p", { children: "Payment was not initialized correctly" }) });
|
|
142
149
|
}
|
|
143
150
|
return /* @__PURE__ */ jsx(
|
|
144
151
|
Elements,
|
|
145
152
|
{
|
|
146
153
|
...{
|
|
147
|
-
stripe,
|
|
154
|
+
stripe: stripeFor(key),
|
|
148
155
|
options: {
|
|
149
156
|
clientSecret,
|
|
150
157
|
appearance: {
|
|
@@ -53,19 +53,16 @@ var import_input_combobox = __toESM(require("./input-combobox"));
|
|
|
53
53
|
var import_input_text = __toESM(require("../input-text"));
|
|
54
54
|
var import_input_textarea = __toESM(require("../input-textarea"));
|
|
55
55
|
var import_input_switch = __toESM(require("../shared/input-switch"));
|
|
56
|
-
var import_input_array = require("./input-array");
|
|
57
56
|
var import_input_file = __toESM(require("./input-file"));
|
|
57
|
+
var import_input_gallery = __toESM(require("./input-gallery"));
|
|
58
58
|
var import_hooks = require("./lib/hooks");
|
|
59
59
|
var import_divider = __toESM(require("../shared/divider"));
|
|
60
60
|
var import_button = __toESM(require("../shared/button"));
|
|
61
61
|
var import_map_pin = __toESM(require("../icons/map-pin"));
|
|
62
62
|
var import_lock = __toESM(require("../icons/lock"));
|
|
63
|
-
var import_plus = __toESM(require("../icons/plus"));
|
|
64
|
-
var import_trash = __toESM(require("../icons/trash"));
|
|
65
63
|
var import_geo = require("./lib/geo");
|
|
66
64
|
var import_loader = require("../shared/loader");
|
|
67
65
|
var import_campaign = require("../shared/lib/campaign");
|
|
68
|
-
const FormReposition = (0, import_dynamic.default)(() => import("./form-reposition"), { loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}), ssr: false });
|
|
69
66
|
const InputGoogleAutocomplete = (0, import_dynamic.default)(() => import("./google").then((m) => m.InputGoogleAutocomplete), { loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}), ssr: false });
|
|
70
67
|
const switches = [
|
|
71
68
|
{
|
|
@@ -866,161 +863,17 @@ const InputFieldsImages = ({ described, locked, organization, onUpdate, preview
|
|
|
866
863
|
)
|
|
867
864
|
] });
|
|
868
865
|
};
|
|
869
|
-
const InputFieldsMedia = ({ organization, onUpdate, values = {} }) =>
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
return (_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.id;
|
|
878
|
-
}).filter(Boolean);
|
|
879
|
-
const change = (path, value) => {
|
|
880
|
-
setValue(path, value, { shouldDirty: true });
|
|
881
|
-
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
882
|
-
};
|
|
883
|
-
const reposition = (index) => {
|
|
884
|
-
var _a2, _b2;
|
|
885
|
-
const item = getValues("gallery." + index);
|
|
886
|
-
modal.open({
|
|
887
|
-
message: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
888
|
-
FormReposition,
|
|
889
|
-
{
|
|
890
|
-
...{
|
|
891
|
-
file: item == null ? void 0 : item.file,
|
|
892
|
-
onDone: (position) => {
|
|
893
|
-
change("gallery." + index + ".position", position);
|
|
894
|
-
modal.close();
|
|
895
|
-
},
|
|
896
|
-
page: getValues(),
|
|
897
|
-
position: item == null ? void 0 : item.position
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
),
|
|
901
|
-
title: ((_b2 = (_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.mimetype) == null ? void 0 : _b2.includes("video")) ? "Reposition video" : "Reposition photo"
|
|
902
|
-
});
|
|
903
|
-
};
|
|
904
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
905
|
-
import_input_group.default,
|
|
906
|
-
{
|
|
907
|
-
...{
|
|
908
|
-
error: (_b = (_a = formState == null ? void 0 : formState.errors) == null ? void 0 : _a.gallery) == null ? void 0 : _b.message,
|
|
909
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
910
|
-
import_input_array.InputArraySortable,
|
|
911
|
-
{
|
|
912
|
-
...{
|
|
913
|
-
control,
|
|
914
|
-
"data-guide": "form-input-gallery",
|
|
915
|
-
empty: "Gallery is empty",
|
|
916
|
-
name: "gallery",
|
|
917
|
-
onSort: () => onUpdate == null ? void 0 : onUpdate(getValues()),
|
|
918
|
-
renderButton: (append) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
919
|
-
import_input_file.default,
|
|
920
|
-
{
|
|
921
|
-
...{
|
|
922
|
-
button: {
|
|
923
|
-
icon: import_plus.default,
|
|
924
|
-
text: "Add gallery item"
|
|
925
|
-
},
|
|
926
|
-
endpoint: "/organization/" + values.organization,
|
|
927
|
-
filters: {
|
|
928
|
-
id: {
|
|
929
|
-
$nin: taken()
|
|
930
|
-
}
|
|
931
|
-
},
|
|
932
|
-
onChange: (response) => {
|
|
933
|
-
append({ file: response });
|
|
934
|
-
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
935
|
-
},
|
|
936
|
-
organization,
|
|
937
|
-
nullable: false,
|
|
938
|
-
value: null,
|
|
939
|
-
type: "media"
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
),
|
|
943
|
-
renderControls: ({ index, remove }) => [
|
|
944
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
945
|
-
import_input_array.InputArrayControl,
|
|
946
|
-
{
|
|
947
|
-
...{
|
|
948
|
-
onClick: () => {
|
|
949
|
-
remove(index);
|
|
950
|
-
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
951
|
-
},
|
|
952
|
-
icon: import_trash.default
|
|
953
|
-
}
|
|
954
|
-
},
|
|
955
|
-
"gallery-control-remove-" + index
|
|
956
|
-
)
|
|
957
|
-
]
|
|
958
|
-
},
|
|
959
|
-
children: ({ field, handle, index, update }) => {
|
|
960
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
961
|
-
const item = gallery[index] || field;
|
|
962
|
-
const editable = /^(image|video)\//.test(((_a2 = item == null ? void 0 : item.file) == null ? void 0 : _a2.mimetype) || "");
|
|
963
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
964
|
-
"div",
|
|
965
|
-
{
|
|
966
|
-
...{
|
|
967
|
-
className: "flex items-center min-w-0 flex-1 space-x-3"
|
|
968
|
-
},
|
|
969
|
-
children: [
|
|
970
|
-
handle,
|
|
971
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
972
|
-
import_input_group.default,
|
|
973
|
-
{
|
|
974
|
-
...{
|
|
975
|
-
error: ((_e = (_d = (_c = (_b2 = formState == null ? void 0 : formState.errors) == null ? void 0 : _b2.gallery) == null ? void 0 : _c[index]) == null ? void 0 : _d.file) == null ? void 0 : _e.message) || ((_i = (_h = (_g = (_f = formState == null ? void 0 : formState.errors) == null ? void 0 : _f.gallery) == null ? void 0 : _g[index]) == null ? void 0 : _h.description) == null ? void 0 : _i.message),
|
|
976
|
-
input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
977
|
-
import_input_file.default,
|
|
978
|
-
{
|
|
979
|
-
...{
|
|
980
|
-
// The item's own description and crop.
|
|
981
|
-
description: item == null ? void 0 : item.description,
|
|
982
|
-
edited: Boolean(item == null ? void 0 : item.position),
|
|
983
|
-
endpoint: "/organization/" + values.organization,
|
|
984
|
-
filters: {
|
|
985
|
-
id: {
|
|
986
|
-
$nin: taken()
|
|
987
|
-
}
|
|
988
|
-
},
|
|
989
|
-
// Another file is another item: no description, no crop.
|
|
990
|
-
onChange: (response) => {
|
|
991
|
-
update(
|
|
992
|
-
index,
|
|
993
|
-
{
|
|
994
|
-
file: response
|
|
995
|
-
}
|
|
996
|
-
);
|
|
997
|
-
onUpdate == null ? void 0 : onUpdate(getValues());
|
|
998
|
-
},
|
|
999
|
-
onDescription: (text) => change("gallery." + index + ".description", text),
|
|
1000
|
-
...editable && {
|
|
1001
|
-
onEdit: () => reposition(index)
|
|
1002
|
-
},
|
|
1003
|
-
organization,
|
|
1004
|
-
nullable: false,
|
|
1005
|
-
value: item == null ? void 0 : item.file,
|
|
1006
|
-
type: "media"
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
)
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
)
|
|
1013
|
-
]
|
|
1014
|
-
}
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
),
|
|
1019
|
-
label: "Gallery"
|
|
1020
|
-
}
|
|
866
|
+
const InputFieldsMedia = ({ organization, onUpdate, values = {} }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
867
|
+
import_input_gallery.default,
|
|
868
|
+
{
|
|
869
|
+
...{
|
|
870
|
+
endpoint: "/organization/" + values.organization,
|
|
871
|
+
onUpdate,
|
|
872
|
+
organization,
|
|
873
|
+
reposition: true
|
|
1021
874
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
875
|
+
}
|
|
876
|
+
);
|
|
1024
877
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1025
878
|
0 && (module.exports = {
|
|
1026
879
|
InputFieldsAddress,
|