@drawbridge/components 0.1.48 → 0.1.49
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/fields.js +0 -278
- package/dist/bridge/fields.mjs +1 -276
- package/dist/bridge/form-subdomain-shop-modal.js +274 -234
- package/dist/bridge/form-subdomain-shop-modal.mjs +275 -233
- package/dist/bridge/form-subdomain.js +0 -7
- package/dist/bridge/form-subdomain.mjs +2 -9
- package/dist/bridge/lib/age-gate.js +0 -12
- package/dist/bridge/lib/age-gate.mjs +0 -11
- package/dist/bridge/lib/checkout-kit.js +32 -2
- package/dist/bridge/lib/checkout-kit.mjs +32 -2
- package/dist/bridge/lib/entry.js +0 -3
- package/dist/bridge/lib/entry.mjs +0 -2
- package/dist/bridge/product-tile.js +6 -9
- package/dist/bridge/product-tile.mjs +6 -9
- package/dist/bridge/template-layout.js +122 -237
- package/dist/bridge/template-layout.mjs +122 -237
- package/dist/bridge/template-modal.js +73 -28
- package/dist/bridge/template-modal.mjs +74 -29
- package/dist/dashboard/buttons-subscription.js +1 -1
- package/dist/dashboard/buttons-subscription.mjs +1 -1
- package/dist/dashboard/campaign-form.js +2 -7
- package/dist/dashboard/campaign-form.mjs +2 -7
- package/dist/dashboard/card-order.js +4 -22
- package/dist/dashboard/card-order.mjs +4 -22
- package/dist/dashboard/document-blocks.js +17 -4
- package/dist/dashboard/document-blocks.mjs +17 -4
- package/dist/dashboard/form-admin-provider.js +17 -71
- package/dist/dashboard/form-admin-provider.mjs +17 -71
- package/dist/dashboard/form-file-upload.js +2 -3
- package/dist/dashboard/form-file-upload.mjs +3 -4
- package/dist/dashboard/form-organization-campaign-advertisements.js +6 -47
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +6 -47
- package/dist/dashboard/form-organization-campaign-agreement.js +121 -83
- package/dist/dashboard/form-organization-campaign-agreement.mjs +121 -83
- package/dist/dashboard/form-organization-campaign.js +0 -82
- package/dist/dashboard/form-organization-campaign.mjs +0 -81
- package/dist/dashboard/form-organization-connection.js +6 -48
- package/dist/dashboard/form-organization-connection.mjs +7 -48
- package/dist/dashboard/form-organization-workflow.js +1 -72
- package/dist/dashboard/form-organization-workflow.mjs +1 -69
- package/dist/dashboard/form-otc.js +5 -4
- package/dist/dashboard/form-otc.mjs +5 -4
- package/dist/dashboard/form-stripe.js +5 -12
- package/dist/dashboard/form-stripe.mjs +5 -12
- package/dist/dashboard/input-fields.js +158 -11
- package/dist/dashboard/input-fields.mjs +158 -11
- package/dist/dashboard/input-file.js +4 -21
- package/dist/dashboard/input-file.mjs +4 -21
- package/dist/dashboard/lib/connection-controls.js +2 -5
- package/dist/dashboard/lib/connection-controls.mjs +1 -3
- package/dist/dashboard/lib/form-page.js +1 -1
- package/dist/dashboard/lib/form-page.mjs +1 -1
- package/dist/dashboard/lib/uppy.js +1 -10
- package/dist/dashboard/lib/uppy.mjs +2 -11
- package/dist/dashboard/order-sections.js +6 -456
- package/dist/dashboard/order-sections.mjs +7 -453
- package/dist/dashboard/provider-ui.js +7 -9
- package/dist/dashboard/provider-ui.mjs +7 -9
- package/dist/dashboard/template-ui.js +12 -4
- package/dist/dashboard/template-ui.mjs +12 -4
- package/dist/input-checkbox.js +10 -28
- package/dist/input-checkbox.mjs +10 -28
- package/dist/product.js +24 -96
- package/dist/product.mjs +25 -97
- package/dist/shared/lib/helpers.js +6 -54
- package/dist/shared/lib/helpers.mjs +8 -53
- package/package.json +4 -74
- package/types/bridge/fields.d.ts +2 -14
- package/types/bridge/form-subdomain-shop-modal.d.ts +3 -27
- package/types/bridge/lib/age-gate.d.ts +0 -5
- package/types/bridge/lib/checkout-kit.d.ts +10 -2
- package/types/bridge/lib/entry.d.ts +0 -3
- package/types/dashboard/card-order.d.ts +0 -6
- package/types/dashboard/document-blocks.d.ts +3 -2
- package/types/dashboard/form-admin-provider.d.ts +2 -9
- package/types/dashboard/form-file-upload.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +0 -3
- package/types/dashboard/form-organization-campaign-agreement.d.ts +5 -2
- package/types/dashboard/form-organization-campaign.d.ts +0 -3
- package/types/dashboard/form-organization-connection.d.ts +0 -11
- package/types/dashboard/form-otc.d.ts +1 -5
- package/types/dashboard/form-stripe.d.ts +2 -3
- package/types/dashboard/input-file.d.ts +0 -2
- package/types/dashboard/order-sections.d.ts +1 -24
- package/types/input-checkbox.d.ts +0 -2
- package/types/shared/lib/helpers.d.ts +0 -4
- package/dist/bridge/cart-drawer.js +0 -152
- package/dist/bridge/cart-drawer.mjs +0 -123
- package/dist/bridge/form-subdomain-checkout.js +0 -687
- package/dist/bridge/form-subdomain-checkout.mjs +0 -665
- package/dist/bridge/lib/cart.js +0 -79
- package/dist/bridge/lib/cart.mjs +0 -48
- package/dist/dashboard/embed-stripe.js +0 -145
- package/dist/dashboard/embed-stripe.mjs +0 -116
- package/dist/dashboard/form-organization-campaign-field-birthday.js +0 -193
- package/dist/dashboard/form-organization-campaign-field-birthday.mjs +0 -164
- package/dist/dashboard/form-organization-campaign-field-rating.js +0 -246
- package/dist/dashboard/form-organization-campaign-field-rating.mjs +0 -217
- package/dist/dashboard/form-organization-product.js +0 -1461
- package/dist/dashboard/form-organization-product.mjs +0 -1425
- package/dist/dashboard/input-gallery.js +0 -201
- package/dist/dashboard/input-gallery.mjs +0 -172
- package/dist/dashboard/lib/products.js +0 -169
- package/dist/dashboard/lib/products.mjs +0 -135
- package/dist/dashboard/lib/settings-paths.js +0 -35
- package/dist/dashboard/lib/settings-paths.mjs +0 -11
- package/dist/dashboard/shipping-rates.js +0 -404
- package/dist/dashboard/shipping-rates.mjs +0 -371
- package/dist/dashboard/template-buyer.js +0 -301
- package/dist/dashboard/template-buyer.mjs +0 -267
- package/dist/shared/order-summary.js +0 -139
- package/dist/shared/order-summary.mjs +0 -110
- package/types/bridge/cart-drawer.d.ts +0 -31
- package/types/bridge/form-subdomain-checkout.d.ts +0 -20
- package/types/bridge/lib/cart.d.ts +0 -44
- package/types/dashboard/embed-stripe.d.ts +0 -25
- package/types/dashboard/form-organization-campaign-field-birthday.d.ts +0 -31
- package/types/dashboard/form-organization-campaign-field-rating.d.ts +0 -33
- package/types/dashboard/form-organization-product.d.ts +0 -24
- package/types/dashboard/input-gallery.d.ts +0 -14
- package/types/dashboard/lib/products.d.ts +0 -14
- package/types/dashboard/lib/settings-paths.d.ts +0 -5
- package/types/dashboard/shipping-rates.d.ts +0 -26
- package/types/dashboard/template-buyer.d.ts +0 -50
- package/types/shared/order-summary.d.ts +0 -19
|
@@ -6,7 +6,6 @@ import { useQueryClient } from "@tanstack/react-query";
|
|
|
6
6
|
import { useForm, useWatch, FormProvider, Controller } from "../shared/lib/form.mjs";
|
|
7
7
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
8
8
|
import { InputFieldsCampaign, schemas } from "./input-fields.mjs";
|
|
9
|
-
import { CHECKOUT_LABELS } from "./lib/products.mjs";
|
|
10
9
|
import Form from "../shared/form.mjs";
|
|
11
10
|
import Fieldset from "../shared/fieldset.mjs";
|
|
12
11
|
import InputGroup from "../input-group.mjs";
|
|
@@ -191,10 +190,6 @@ const copyFields = {
|
|
|
191
190
|
// The form's one Submit text, on its last step ( the Footer's Button text ).
|
|
192
191
|
submit: ["Button text"]
|
|
193
192
|
};
|
|
194
|
-
const CHECKOUT_OPTIONS = Object.entries(CHECKOUT_LABELS).map(([value, key]) => ({
|
|
195
|
-
key,
|
|
196
|
-
value
|
|
197
|
-
}));
|
|
198
193
|
const copyPlaceholder = (key) => {
|
|
199
194
|
var _a, _b, _c, _d;
|
|
200
195
|
return ((_d = (_c = (_b = (_a = constants) == null ? void 0 : _a.campaign) == null ? void 0 : _b.form) == null ? void 0 : _c.copy) == null ? void 0 : _d[key]) || (key === "submit" ? "Submit" : void 0);
|
|
@@ -816,84 +811,8 @@ const FormOrganizationCampaignSettingsShop = ({
|
|
|
816
811
|
}
|
|
817
812
|
);
|
|
818
813
|
};
|
|
819
|
-
const FormOrganizationCampaignCheckout = ({
|
|
820
|
-
disabled,
|
|
821
|
-
onSubmit,
|
|
822
|
-
values
|
|
823
|
-
}) => {
|
|
824
|
-
const { control, formState, handleSubmit } = useForm({
|
|
825
|
-
defaultValues: {
|
|
826
|
-
checkout: (values == null ? void 0 : values.checkout) || "stripe"
|
|
827
|
-
},
|
|
828
|
-
guard: false
|
|
829
|
-
});
|
|
830
|
-
return /* @__PURE__ */ jsxs(
|
|
831
|
-
Form,
|
|
832
|
-
{
|
|
833
|
-
...{
|
|
834
|
-
className: "relative w-full space-y-6",
|
|
835
|
-
onSubmit: handleSubmit(({ checkout }) => onSubmit(checkout))
|
|
836
|
-
},
|
|
837
|
-
children: [
|
|
838
|
-
/* @__PURE__ */ jsx(
|
|
839
|
-
Fieldset,
|
|
840
|
-
{
|
|
841
|
-
...{
|
|
842
|
-
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
843
|
-
},
|
|
844
|
-
children: /* @__PURE__ */ jsx(
|
|
845
|
-
Controller,
|
|
846
|
-
{
|
|
847
|
-
...{
|
|
848
|
-
control,
|
|
849
|
-
name: "checkout",
|
|
850
|
-
render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsx(
|
|
851
|
-
InputGroup,
|
|
852
|
-
{
|
|
853
|
-
...{
|
|
854
|
-
input: /* @__PURE__ */ jsx(
|
|
855
|
-
InputCombobox,
|
|
856
|
-
{
|
|
857
|
-
...{
|
|
858
|
-
onChange,
|
|
859
|
-
options: CHECKOUT_OPTIONS,
|
|
860
|
-
value
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
),
|
|
864
|
-
label: "Products and checkout"
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
)
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
)
|
|
871
|
-
}
|
|
872
|
-
),
|
|
873
|
-
/* @__PURE__ */ jsx(
|
|
874
|
-
Fieldset,
|
|
875
|
-
{
|
|
876
|
-
...{
|
|
877
|
-
disabled: disabled || (formState == null ? void 0 : formState.isSubmitting)
|
|
878
|
-
},
|
|
879
|
-
children: /* @__PURE__ */ jsx(
|
|
880
|
-
Button,
|
|
881
|
-
{
|
|
882
|
-
...{
|
|
883
|
-
type: "submit"
|
|
884
|
-
},
|
|
885
|
-
children: "Save"
|
|
886
|
-
}
|
|
887
|
-
)
|
|
888
|
-
}
|
|
889
|
-
)
|
|
890
|
-
]
|
|
891
|
-
}
|
|
892
|
-
);
|
|
893
|
-
};
|
|
894
814
|
export {
|
|
895
815
|
FormOrganizationCampaign,
|
|
896
|
-
FormOrganizationCampaignCheckout,
|
|
897
816
|
FormOrganizationCampaignClaimWindow,
|
|
898
817
|
FormOrganizationCampaignCopy,
|
|
899
818
|
FormOrganizationCampaignNotifications,
|
|
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var form_organization_connection_exports = {};
|
|
30
30
|
__export(form_organization_connection_exports, {
|
|
31
|
-
Editable: () => Editable,
|
|
32
31
|
FormOrganizationConnection: () => FormOrganizationConnection
|
|
33
32
|
});
|
|
34
33
|
module.exports = __toCommonJS(form_organization_connection_exports);
|
|
@@ -228,11 +227,10 @@ const FormOrganizationConnection = ({
|
|
|
228
227
|
onSuccess,
|
|
229
228
|
values
|
|
230
229
|
}) => {
|
|
231
|
-
var _a, _b, _c, _d, _e, _f
|
|
230
|
+
var _a, _b, _c, _d, _e, _f;
|
|
232
231
|
const fields = (values == null ? void 0 : values.fields) || [];
|
|
233
232
|
const kind = (_a = values == null ? void 0 : values.connect) == null ? void 0 : _a.type;
|
|
234
|
-
const
|
|
235
|
-
const redirect = kind === "install" ? (_c = values == null ? void 0 : values.connect) == null ? void 0 : _c.redirect : null;
|
|
233
|
+
const redirect = kind === "install" ? (_b = values == null ? void 0 : values.connect) == null ? void 0 : _b.redirect : null;
|
|
236
234
|
const readable = fields.filter((field) => !field.input).map((field) => {
|
|
237
235
|
var _a2;
|
|
238
236
|
return {
|
|
@@ -245,17 +243,6 @@ const FormOrganizationConnection = ({
|
|
|
245
243
|
const consent = async () => {
|
|
246
244
|
setConsenting(true);
|
|
247
245
|
try {
|
|
248
|
-
if (link) {
|
|
249
|
-
await (0, import_fetch.request)({
|
|
250
|
-
body: {
|
|
251
|
-
settings: {},
|
|
252
|
-
slug: values == null ? void 0 : values.slug
|
|
253
|
-
},
|
|
254
|
-
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection",
|
|
255
|
-
method: "POST"
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
;
|
|
259
246
|
const { result } = await (0, import_fetch.request)({
|
|
260
247
|
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + (values == null ? void 0 : values.slug) + "/authorize",
|
|
261
248
|
method: "POST"
|
|
@@ -348,34 +335,6 @@ const FormOrganizationConnection = ({
|
|
|
348
335
|
}
|
|
349
336
|
) : null;
|
|
350
337
|
}
|
|
351
|
-
if (link) {
|
|
352
|
-
return (values == null ? void 0 : values.status) === "active" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
353
|
-
import_form2.default,
|
|
354
|
-
{
|
|
355
|
-
...{
|
|
356
|
-
className: "relative w-full space-y-8"
|
|
357
|
-
},
|
|
358
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
359
|
-
import_fieldset.default,
|
|
360
|
-
{
|
|
361
|
-
...{
|
|
362
|
-
disabled: disabled || consenting
|
|
363
|
-
},
|
|
364
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
365
|
-
import_button.default,
|
|
366
|
-
{
|
|
367
|
-
...{
|
|
368
|
-
loading: consenting,
|
|
369
|
-
onClick: consent
|
|
370
|
-
},
|
|
371
|
-
children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
|
|
372
|
-
}
|
|
373
|
-
)
|
|
374
|
-
}
|
|
375
|
-
)
|
|
376
|
-
}
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
338
|
if (kind === "oauth") {
|
|
380
339
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
381
340
|
import_form2.default,
|
|
@@ -445,7 +404,7 @@ const FormOrganizationConnection = ({
|
|
|
445
404
|
// the connection would read Active over nothing.
|
|
446
405
|
disabled: disabled || Object.values(optionsFor).some((entry) => entry == null ? void 0 : entry.isLoading),
|
|
447
406
|
isSubmitting: formState == null ? void 0 : formState.isSubmitting,
|
|
448
|
-
text: ((
|
|
407
|
+
text: ((_c = values == null ? void 0 : values.actions) == null ? void 0 : _c.update) || "Save"
|
|
449
408
|
}
|
|
450
409
|
}
|
|
451
410
|
),
|
|
@@ -456,7 +415,7 @@ const FormOrganizationConnection = ({
|
|
|
456
415
|
loading: consenting,
|
|
457
416
|
onClick: consent
|
|
458
417
|
},
|
|
459
|
-
children: ((
|
|
418
|
+
children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
|
|
460
419
|
}
|
|
461
420
|
)
|
|
462
421
|
]
|
|
@@ -565,13 +524,13 @@ const FormOrganizationConnection = ({
|
|
|
565
524
|
},
|
|
566
525
|
field.key
|
|
567
526
|
)),
|
|
568
|
-
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
569
528
|
Submit,
|
|
570
529
|
{
|
|
571
530
|
...{
|
|
572
531
|
disabled,
|
|
573
532
|
isSubmitting: formState == null ? void 0 : formState.isSubmitting,
|
|
574
|
-
text: connected ? ((
|
|
533
|
+
text: connected ? ((_e = values == null ? void 0 : values.actions) == null ? void 0 : _e.update) || "Submit" : ((_f = values == null ? void 0 : values.actions) == null ? void 0 : _f.create) || "Submit"
|
|
575
534
|
}
|
|
576
535
|
}
|
|
577
536
|
)
|
|
@@ -583,6 +542,5 @@ const FormOrganizationConnection = ({
|
|
|
583
542
|
};
|
|
584
543
|
// Annotate the CommonJS export names for ESM import in node:
|
|
585
544
|
0 && (module.exports = {
|
|
586
|
-
Editable,
|
|
587
545
|
FormOrganizationConnection
|
|
588
546
|
});
|
|
@@ -17,7 +17,7 @@ import InputCheckbox from "../input-checkbox.mjs";
|
|
|
17
17
|
import InputSwitch from "../shared/input-switch.mjs";
|
|
18
18
|
import Button from "../shared/button.mjs";
|
|
19
19
|
import CopyToClipboard from "../shared/copy-to-clipboard.mjs";
|
|
20
|
-
import { isConnected
|
|
20
|
+
import { isConnected } from "./lib/connection-controls.mjs";
|
|
21
21
|
const Submit = ({
|
|
22
22
|
disabled,
|
|
23
23
|
isSubmitting,
|
|
@@ -195,11 +195,10 @@ const FormOrganizationConnection = ({
|
|
|
195
195
|
onSuccess,
|
|
196
196
|
values
|
|
197
197
|
}) => {
|
|
198
|
-
var _a, _b, _c, _d, _e, _f
|
|
198
|
+
var _a, _b, _c, _d, _e, _f;
|
|
199
199
|
const fields = (values == null ? void 0 : values.fields) || [];
|
|
200
200
|
const kind = (_a = values == null ? void 0 : values.connect) == null ? void 0 : _a.type;
|
|
201
|
-
const
|
|
202
|
-
const redirect = kind === "install" ? (_c = values == null ? void 0 : values.connect) == null ? void 0 : _c.redirect : null;
|
|
201
|
+
const redirect = kind === "install" ? (_b = values == null ? void 0 : values.connect) == null ? void 0 : _b.redirect : null;
|
|
203
202
|
const readable = fields.filter((field) => !field.input).map((field) => {
|
|
204
203
|
var _a2;
|
|
205
204
|
return {
|
|
@@ -212,17 +211,6 @@ const FormOrganizationConnection = ({
|
|
|
212
211
|
const consent = async () => {
|
|
213
212
|
setConsenting(true);
|
|
214
213
|
try {
|
|
215
|
-
if (link) {
|
|
216
|
-
await request({
|
|
217
|
-
body: {
|
|
218
|
-
settings: {},
|
|
219
|
-
slug: values == null ? void 0 : values.slug
|
|
220
|
-
},
|
|
221
|
-
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection",
|
|
222
|
-
method: "POST"
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
;
|
|
226
214
|
const { result } = await request({
|
|
227
215
|
endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/connection/" + (values == null ? void 0 : values.slug) + "/authorize",
|
|
228
216
|
method: "POST"
|
|
@@ -315,34 +303,6 @@ const FormOrganizationConnection = ({
|
|
|
315
303
|
}
|
|
316
304
|
) : null;
|
|
317
305
|
}
|
|
318
|
-
if (link) {
|
|
319
|
-
return (values == null ? void 0 : values.status) === "active" ? null : /* @__PURE__ */ jsx(
|
|
320
|
-
Form,
|
|
321
|
-
{
|
|
322
|
-
...{
|
|
323
|
-
className: "relative w-full space-y-8"
|
|
324
|
-
},
|
|
325
|
-
children: /* @__PURE__ */ jsx(
|
|
326
|
-
Fieldset,
|
|
327
|
-
{
|
|
328
|
-
...{
|
|
329
|
-
disabled: disabled || consenting
|
|
330
|
-
},
|
|
331
|
-
children: /* @__PURE__ */ jsx(
|
|
332
|
-
Button,
|
|
333
|
-
{
|
|
334
|
-
...{
|
|
335
|
-
loading: consenting,
|
|
336
|
-
onClick: consent
|
|
337
|
-
},
|
|
338
|
-
children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
|
|
339
|
-
}
|
|
340
|
-
)
|
|
341
|
-
}
|
|
342
|
-
)
|
|
343
|
-
}
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
306
|
if (kind === "oauth") {
|
|
347
307
|
return /* @__PURE__ */ jsx(
|
|
348
308
|
Form,
|
|
@@ -412,7 +372,7 @@ const FormOrganizationConnection = ({
|
|
|
412
372
|
// the connection would read Active over nothing.
|
|
413
373
|
disabled: disabled || Object.values(optionsFor).some((entry) => entry == null ? void 0 : entry.isLoading),
|
|
414
374
|
isSubmitting: formState == null ? void 0 : formState.isSubmitting,
|
|
415
|
-
text: ((
|
|
375
|
+
text: ((_c = values == null ? void 0 : values.actions) == null ? void 0 : _c.update) || "Save"
|
|
416
376
|
}
|
|
417
377
|
}
|
|
418
378
|
),
|
|
@@ -423,7 +383,7 @@ const FormOrganizationConnection = ({
|
|
|
423
383
|
loading: consenting,
|
|
424
384
|
onClick: consent
|
|
425
385
|
},
|
|
426
|
-
children: ((
|
|
386
|
+
children: ((_d = values == null ? void 0 : values.actions) == null ? void 0 : _d.create) || "Connect"
|
|
427
387
|
}
|
|
428
388
|
)
|
|
429
389
|
]
|
|
@@ -532,13 +492,13 @@ const FormOrganizationConnection = ({
|
|
|
532
492
|
},
|
|
533
493
|
field.key
|
|
534
494
|
)),
|
|
535
|
-
|
|
495
|
+
/* @__PURE__ */ jsx(
|
|
536
496
|
Submit,
|
|
537
497
|
{
|
|
538
498
|
...{
|
|
539
499
|
disabled,
|
|
540
500
|
isSubmitting: formState == null ? void 0 : formState.isSubmitting,
|
|
541
|
-
text: connected ? ((
|
|
501
|
+
text: connected ? ((_e = values == null ? void 0 : values.actions) == null ? void 0 : _e.update) || "Submit" : ((_f = values == null ? void 0 : values.actions) == null ? void 0 : _f.create) || "Submit"
|
|
542
502
|
}
|
|
543
503
|
}
|
|
544
504
|
)
|
|
@@ -549,6 +509,5 @@ const FormOrganizationConnection = ({
|
|
|
549
509
|
);
|
|
550
510
|
};
|
|
551
511
|
export {
|
|
552
|
-
Editable,
|
|
553
512
|
FormOrganizationConnection
|
|
554
513
|
};
|
|
@@ -27,12 +27,9 @@ 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,
|
|
31
30
|
FormOrganizationWorkflowEdit: () => FormOrganizationWorkflowEdit,
|
|
32
31
|
RESPONSE: () => RESPONSE,
|
|
33
32
|
TextPreview: () => TextPreview,
|
|
34
|
-
afterOptions: () => afterOptions,
|
|
35
|
-
afterValue: () => afterValue,
|
|
36
33
|
firstEntryOnly: () => firstEntryOnly,
|
|
37
34
|
hasStepOptions: () => hasStepOptions,
|
|
38
35
|
issueRow: () => issueRow,
|
|
@@ -63,7 +60,6 @@ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
|
63
60
|
var import_features = require("@drawbridge/drawbridge-utils/features");
|
|
64
61
|
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
65
62
|
var import_html = require("@drawbridge/drawbridge-utils/html");
|
|
66
|
-
var import_products = require("@drawbridge/drawbridge-utils/products");
|
|
67
63
|
var import_form = require("../shared/lib/form");
|
|
68
64
|
var import_react_query = require("@tanstack/react-query");
|
|
69
65
|
var import_yup = __toESM(require("../shared/lib/yup"));
|
|
@@ -72,7 +68,6 @@ var import_fieldset = __toESM(require("../shared/fieldset"));
|
|
|
72
68
|
var import_input_group = __toESM(require("../input-group"));
|
|
73
69
|
var import_error = __toESM(require("../shared/error"));
|
|
74
70
|
var import_input_textarea = __toESM(require("../input-textarea"));
|
|
75
|
-
var import_input_select = __toESM(require("../input-select"));
|
|
76
71
|
var import_input_url = __toESM(require("../shared/input-url"));
|
|
77
72
|
var import_input_resource = __toESM(require("./input-resource"));
|
|
78
73
|
var import_input_combobox = __toESM(require("./input-combobox"));
|
|
@@ -102,12 +97,6 @@ const firstEntryOnly = ({ campaign, event, type }) => {
|
|
|
102
97
|
if (type === "step.sms.send") return ((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.submissionLeadPrimaryKey) !== "phone";
|
|
103
98
|
return true;
|
|
104
99
|
};
|
|
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);
|
|
111
100
|
const stepPrefills = {
|
|
112
101
|
"step.email.send": {
|
|
113
102
|
message: import_drawbridge_utils.constants.campaign.confirmation.message,
|
|
@@ -584,15 +573,6 @@ const LeadEmailNote = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
584
573
|
children: "Drawbridge adds the entrant's order and missions under your message. You can't edit or remove them."
|
|
585
574
|
}
|
|
586
575
|
);
|
|
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
|
-
);
|
|
596
576
|
const RESPONSE_STATES = [
|
|
597
577
|
{
|
|
598
578
|
key: "Email",
|
|
@@ -1039,10 +1019,6 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1039
1019
|
);
|
|
1040
1020
|
const { control, formState, getValues, handleSubmit, reset, setValue, watch } = (0, import_form.useForm)({
|
|
1041
1021
|
values: {
|
|
1042
|
-
// @story workflows/cart-abandonment
|
|
1043
|
-
...event === ABANDONED && {
|
|
1044
|
-
after: afterValue(values == null ? void 0 : values.trigger)
|
|
1045
|
-
},
|
|
1046
1022
|
steps: defaultSteps
|
|
1047
1023
|
},
|
|
1048
1024
|
resolver: (0, import_yup.resolver)(workflowSchema)
|
|
@@ -1196,17 +1172,11 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1196
1172
|
);
|
|
1197
1173
|
};
|
|
1198
1174
|
const onSubmit = async ({
|
|
1199
|
-
after,
|
|
1200
1175
|
steps
|
|
1201
1176
|
}) => {
|
|
1202
1177
|
var _a2;
|
|
1203
1178
|
try {
|
|
1204
1179
|
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
|
-
},
|
|
1210
1180
|
steps: steps.map(({ connectionId, discount, enabled, members, message, score, settings: parts, slug, subject, text, type, url }, index) => {
|
|
1211
1181
|
const settings = type === RESPONSE ? responseSave(parts) : {};
|
|
1212
1182
|
if (type === RESPONSE && parts.email.score && !settings.email.score) setValue("steps." + index + ".settings.email.score", null);
|
|
@@ -1286,43 +1256,6 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1286
1256
|
variant: "gray"
|
|
1287
1257
|
},
|
|
1288
1258
|
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
|
-
),
|
|
1326
1259
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1327
1260
|
import_input_group.default,
|
|
1328
1261
|
{
|
|
@@ -1512,7 +1445,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1512
1445
|
var _a4;
|
|
1513
1446
|
const [type] = val.split("::");
|
|
1514
1447
|
const option = getStepOptions(index).find((o) => o.value === val);
|
|
1515
|
-
const copy =
|
|
1448
|
+
const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
|
|
1516
1449
|
setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
|
|
1517
1450
|
onChange(type);
|
|
1518
1451
|
setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
|
|
@@ -1649,7 +1582,6 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1649
1582
|
}
|
|
1650
1583
|
),
|
|
1651
1584
|
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, {}),
|
|
1653
1585
|
step.type === "step.sms.send" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1654
1586
|
import_form.Controller,
|
|
1655
1587
|
{
|
|
@@ -1792,12 +1724,9 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1792
1724
|
};
|
|
1793
1725
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1794
1726
|
0 && (module.exports = {
|
|
1795
|
-
ABANDONED,
|
|
1796
1727
|
FormOrganizationWorkflowEdit,
|
|
1797
1728
|
RESPONSE,
|
|
1798
1729
|
TextPreview,
|
|
1799
|
-
afterOptions,
|
|
1800
|
-
afterValue,
|
|
1801
1730
|
firstEntryOnly,
|
|
1802
1731
|
hasStepOptions,
|
|
1803
1732
|
issueRow,
|
|
@@ -6,7 +6,6 @@ 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";
|
|
10
9
|
import { useForm, useWatch, Controller } from "../shared/lib/form.mjs";
|
|
11
10
|
import { keepPreviousData, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
12
11
|
import yup, { resolver } from "../shared/lib/yup.mjs";
|
|
@@ -15,7 +14,6 @@ import Fieldset from "../shared/fieldset.mjs";
|
|
|
15
14
|
import InputGroup from "../input-group.mjs";
|
|
16
15
|
import Error from "../shared/error.mjs";
|
|
17
16
|
import InputTextarea from "../input-textarea.mjs";
|
|
18
|
-
import InputSelect from "../input-select.mjs";
|
|
19
17
|
import InputUrl from "../shared/input-url.mjs";
|
|
20
18
|
import InputResource from "./input-resource.mjs";
|
|
21
19
|
import InputCombobox from "./input-combobox.mjs";
|
|
@@ -45,12 +43,6 @@ const firstEntryOnly = ({ campaign, event, type }) => {
|
|
|
45
43
|
if (type === "step.sms.send") return ((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.submissionLeadPrimaryKey) !== "phone";
|
|
46
44
|
return true;
|
|
47
45
|
};
|
|
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);
|
|
54
46
|
const stepPrefills = {
|
|
55
47
|
"step.email.send": {
|
|
56
48
|
message: constants.campaign.confirmation.message,
|
|
@@ -527,15 +519,6 @@ const LeadEmailNote = () => /* @__PURE__ */ jsx(
|
|
|
527
519
|
children: "Drawbridge adds the entrant's order and missions under your message. You can't edit or remove them."
|
|
528
520
|
}
|
|
529
521
|
);
|
|
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
|
-
);
|
|
539
522
|
const RESPONSE_STATES = [
|
|
540
523
|
{
|
|
541
524
|
key: "Email",
|
|
@@ -982,10 +965,6 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
982
965
|
);
|
|
983
966
|
const { control, formState, getValues, handleSubmit, reset, setValue, watch } = useForm({
|
|
984
967
|
values: {
|
|
985
|
-
// @story workflows/cart-abandonment
|
|
986
|
-
...event === ABANDONED && {
|
|
987
|
-
after: afterValue(values == null ? void 0 : values.trigger)
|
|
988
|
-
},
|
|
989
968
|
steps: defaultSteps
|
|
990
969
|
},
|
|
991
970
|
resolver: resolver(workflowSchema)
|
|
@@ -1139,17 +1118,11 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1139
1118
|
);
|
|
1140
1119
|
};
|
|
1141
1120
|
const onSubmit = async ({
|
|
1142
|
-
after,
|
|
1143
1121
|
steps
|
|
1144
1122
|
}) => {
|
|
1145
1123
|
var _a2;
|
|
1146
1124
|
try {
|
|
1147
1125
|
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
|
-
},
|
|
1153
1126
|
steps: steps.map(({ connectionId, discount, enabled, members, message, score, settings: parts, slug, subject, text, type, url }, index) => {
|
|
1154
1127
|
const settings = type === RESPONSE ? responseSave(parts) : {};
|
|
1155
1128
|
if (type === RESPONSE && parts.email.score && !settings.email.score) setValue("steps." + index + ".settings.email.score", null);
|
|
@@ -1229,43 +1202,6 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1229
1202
|
variant: "gray"
|
|
1230
1203
|
},
|
|
1231
1204
|
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
|
-
),
|
|
1269
1205
|
/* @__PURE__ */ jsx(
|
|
1270
1206
|
InputGroup,
|
|
1271
1207
|
{
|
|
@@ -1455,7 +1391,7 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1455
1391
|
var _a4;
|
|
1456
1392
|
const [type] = val.split("::");
|
|
1457
1393
|
const option = getStepOptions(index).find((o) => o.value === val);
|
|
1458
|
-
const copy =
|
|
1394
|
+
const copy = pickedCopy({ row: getValues(`steps.${index}`), type });
|
|
1459
1395
|
setValue(`steps.${index}.settings`, type === RESPONSE ? responseStart((_a4 = values == null ? void 0 : values.autoResponse) == null ? void 0 : _a4.number) : null);
|
|
1460
1396
|
onChange(type);
|
|
1461
1397
|
setValue(`steps.${index}.connectionId`, (option == null ? void 0 : option.connectionId) || "");
|
|
@@ -1592,7 +1528,6 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1592
1528
|
}
|
|
1593
1529
|
),
|
|
1594
1530
|
event === "lead.insert" && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(LeadEmailNote, {}),
|
|
1595
|
-
event === ABANDONED && emailSteps.includes(step.type) && /* @__PURE__ */ jsx(CartEmailNote, {}),
|
|
1596
1531
|
step.type === "step.sms.send" && /* @__PURE__ */ jsx(
|
|
1597
1532
|
Controller,
|
|
1598
1533
|
{
|
|
@@ -1734,12 +1669,9 @@ const FormOrganizationWorkflowEdit = ({
|
|
|
1734
1669
|
);
|
|
1735
1670
|
};
|
|
1736
1671
|
export {
|
|
1737
|
-
ABANDONED,
|
|
1738
1672
|
FormOrganizationWorkflowEdit,
|
|
1739
1673
|
RESPONSE,
|
|
1740
1674
|
TextPreview,
|
|
1741
|
-
afterOptions,
|
|
1742
|
-
afterValue,
|
|
1743
1675
|
firstEntryOnly,
|
|
1744
1676
|
hasStepOptions,
|
|
1745
1677
|
issueRow,
|
|
@@ -42,10 +42,8 @@ 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,
|
|
46
45
|
onError,
|
|
47
46
|
onSuccess,
|
|
48
|
-
title = "Authorization",
|
|
49
47
|
values
|
|
50
48
|
}) => {
|
|
51
49
|
const [submitting, setSubmitting] = (0, import_react.useState)(false);
|
|
@@ -81,8 +79,11 @@ const FormOtcCode = ({
|
|
|
81
79
|
disabled: submitting
|
|
82
80
|
},
|
|
83
81
|
children: [
|
|
84
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children:
|
|
85
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Authorization" }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
84
|
+
"A code will be sent to ",
|
|
85
|
+
values == null ? void 0 : values.identifier
|
|
86
|
+
] })
|
|
86
87
|
]
|
|
87
88
|
}
|
|
88
89
|
),
|