@drawbridge/components 0.1.45 → 0.1.47
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-shop.js +4 -1
- package/dist/bridge/form-subdomain-shop.mjs +4 -1
- package/dist/bridge/form-subdomain.js +23 -5
- package/dist/bridge/form-subdomain.mjs +23 -5
- package/dist/bridge/lib/entry.js +41 -0
- package/dist/bridge/lib/entry.mjs +40 -0
- package/dist/bridge/product-tile.js +4 -0
- package/dist/bridge/product-tile.mjs +4 -0
- package/dist/bridge/template-layout.js +27 -8
- package/dist/bridge/template-layout.mjs +28 -9
- package/dist/bridge/template-modal.js +11 -1
- package/dist/bridge/template-modal.mjs +11 -1
- package/dist/dashboard/avatar.js +2 -3
- package/dist/dashboard/avatar.mjs +2 -3
- package/dist/dashboard/campaign-form.js +172 -153
- package/dist/dashboard/campaign-form.mjs +172 -153
- package/dist/dashboard/campaign-share.js +347 -0
- package/dist/dashboard/campaign-share.mjs +314 -0
- package/dist/dashboard/card-affiliate.js +1 -1
- package/dist/dashboard/card-affiliate.mjs +1 -1
- package/dist/dashboard/card-campaign-switch.js +4 -1
- package/dist/dashboard/card-campaign-switch.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-field-item.js +4 -1
- package/dist/dashboard/form-organization-campaign-field-item.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-page.js +73 -39
- package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
- package/dist/dashboard/input-combobox.js +6 -0
- package/dist/dashboard/input-combobox.mjs +6 -0
- package/dist/dashboard/input-fields.js +26 -3
- package/dist/dashboard/input-fields.mjs +26 -3
- package/dist/dashboard/input-font.js +2 -0
- package/dist/dashboard/input-font.mjs +2 -0
- package/dist/dashboard/input-group-ai.js +15 -3
- package/dist/dashboard/input-group-ai.mjs +15 -3
- package/dist/dashboard/lib/ab-tests.js +2 -2
- package/dist/dashboard/lib/ab-tests.mjs +2 -2
- package/dist/dashboard/lib/menu.js +19 -0
- package/dist/dashboard/lib/menu.mjs +18 -0
- package/dist/dashboard/menu.js +13 -2
- package/dist/dashboard/menu.mjs +13 -2
- package/dist/dashboard/preview.js +119 -52
- package/dist/dashboard/preview.mjs +119 -52
- package/dist/dashboard/recharts.js +10 -4
- package/dist/dashboard/recharts.mjs +10 -4
- package/dist/dashboard/template-dashboard.js +11 -1
- package/dist/dashboard/template-dashboard.mjs +11 -1
- package/dist/dashboard/template-design.js +209 -130
- package/dist/dashboard/template-design.mjs +210 -131
- package/dist/dashboard/template-ui.js +157 -55
- package/dist/dashboard/template-ui.mjs +158 -56
- package/dist/icons/flags.js +134 -0
- package/dist/icons/flags.mjs +115 -0
- package/dist/shared/carousel.js +14 -5
- package/dist/shared/carousel.mjs +14 -5
- package/package.json +11 -1
- package/types/bridge/form-subdomain.d.ts +13 -0
- package/types/bridge/lib/entry.d.ts +5 -0
- package/types/bridge/product-tile.d.ts +2 -0
- package/types/dashboard/campaign-share.d.ts +16 -0
- package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/preview.d.ts +11 -3
- package/types/icons/flags.d.ts +5 -0
|
@@ -0,0 +1,347 @@
|
|
|
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 campaign_share_exports = {};
|
|
30
|
+
__export(campaign_share_exports, {
|
|
31
|
+
useCampaignShare: () => useCampaignShare
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(campaign_share_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_dynamic = __toESM(require("next/dynamic"));
|
|
37
|
+
var import_react_query = require("@tanstack/react-query");
|
|
38
|
+
var import_hooks = require("./lib/hooks");
|
|
39
|
+
var import_helpers = require("../shared/lib/helpers");
|
|
40
|
+
var import_loader = require("../shared/loader");
|
|
41
|
+
var import_link_back = __toESM(require("./link-back"));
|
|
42
|
+
var import_share = __toESM(require("../icons/share"));
|
|
43
|
+
const FormOrganizationCampaignPageAffiliates = (0, import_dynamic.default)(
|
|
44
|
+
() => import("./form-organization-campaign-page-affiliates"),
|
|
45
|
+
{
|
|
46
|
+
loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}),
|
|
47
|
+
ssr: false
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
const FormOrganizationCampaignPageQRCustomize = (0, import_dynamic.default)(
|
|
51
|
+
() => import("./form-organization-campaign-page-qr").then((mod) => mod.FormOrganizationCampaignPageQRCustomize),
|
|
52
|
+
{
|
|
53
|
+
loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}),
|
|
54
|
+
ssr: false
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
const FormOrganizationCampaignPageQR = (0, import_dynamic.default)(
|
|
58
|
+
() => import("./form-organization-campaign-page-qr"),
|
|
59
|
+
{
|
|
60
|
+
loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}),
|
|
61
|
+
ssr: false
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
const FormOrganizationCampaignPageEmbed = (0, import_dynamic.default)(
|
|
65
|
+
() => import("./form-organization-campaign-page-embed"),
|
|
66
|
+
{
|
|
67
|
+
loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}),
|
|
68
|
+
ssr: false
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
const FormOrganizationCampaignPagePreview = (0, import_dynamic.default)(
|
|
72
|
+
() => import("./form-organization-campaign-page-preview"),
|
|
73
|
+
{
|
|
74
|
+
loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}),
|
|
75
|
+
ssr: false
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
const FormOrganizationCampaignPageShare = (0, import_dynamic.default)(
|
|
79
|
+
() => import("./form-organization-campaign-page-share"),
|
|
80
|
+
{
|
|
81
|
+
loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}),
|
|
82
|
+
ssr: false
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const FormOrganizationCampaignPageSlug = (0, import_dynamic.default)(
|
|
86
|
+
() => import("./form-organization-campaign-page-slug"),
|
|
87
|
+
{
|
|
88
|
+
loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_loader.LoaderDynamic, {}),
|
|
89
|
+
ssr: false
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
const useCampaignShare = ({ params }) => {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
95
|
+
const campaign = (0, import_react_query.useQuery)({
|
|
96
|
+
enabled: false,
|
|
97
|
+
queryKey: ["campaign", params.campaign]
|
|
98
|
+
});
|
|
99
|
+
const { data: organization } = (0, import_react_query.useQuery)({
|
|
100
|
+
enabled: false,
|
|
101
|
+
queryKey: ["organization", params.organization]
|
|
102
|
+
});
|
|
103
|
+
const canManage = (0, import_helpers.hasCapability)(organization, "campaigns.settings");
|
|
104
|
+
const { onError, onSuccess } = (0, import_hooks.useCallbacks)({
|
|
105
|
+
queryClient
|
|
106
|
+
});
|
|
107
|
+
const drawer = (0, import_hooks.useDrawer)({
|
|
108
|
+
queryClient
|
|
109
|
+
});
|
|
110
|
+
const modal = (0, import_hooks.useModal)({
|
|
111
|
+
queryClient
|
|
112
|
+
});
|
|
113
|
+
const address = (values = campaign == null ? void 0 : campaign.data) => ({
|
|
114
|
+
...values,
|
|
115
|
+
organization: params.organization
|
|
116
|
+
});
|
|
117
|
+
const back = (values) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
118
|
+
import_link_back.default,
|
|
119
|
+
{
|
|
120
|
+
...{
|
|
121
|
+
element: "button",
|
|
122
|
+
onClick: () => actions.share(values)
|
|
123
|
+
},
|
|
124
|
+
children: "Back"
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
const panel = (children) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
...{
|
|
131
|
+
className: "p-6 space-y-6"
|
|
132
|
+
},
|
|
133
|
+
children
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
const notice = (response) => queryClient.setQueryData(
|
|
137
|
+
["notice"],
|
|
138
|
+
{
|
|
139
|
+
active: true,
|
|
140
|
+
response
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
const actions = {
|
|
144
|
+
affiliates: (values) => drawer.open({
|
|
145
|
+
children: panel(
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
147
|
+
back(values),
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
+
FormOrganizationCampaignPageAffiliates,
|
|
150
|
+
{
|
|
151
|
+
...{
|
|
152
|
+
...params,
|
|
153
|
+
affiliates: values == null ? void 0 : values.affiliates
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
] })
|
|
158
|
+
),
|
|
159
|
+
title: "Affiliates"
|
|
160
|
+
}),
|
|
161
|
+
customize: (values) => drawer.open({
|
|
162
|
+
children: panel(
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
|
+
import_link_back.default,
|
|
166
|
+
{
|
|
167
|
+
...{
|
|
168
|
+
element: "button",
|
|
169
|
+
onClick: () => actions.qr(values)
|
|
170
|
+
},
|
|
171
|
+
children: "Back"
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
175
|
+
FormOrganizationCampaignPageQRCustomize,
|
|
176
|
+
{
|
|
177
|
+
...{
|
|
178
|
+
onError,
|
|
179
|
+
onSuccess: (response) => {
|
|
180
|
+
queryClient.invalidateQueries({
|
|
181
|
+
queryKey: ["campaign", params.campaign]
|
|
182
|
+
});
|
|
183
|
+
actions.qr(address(response == null ? void 0 : response.result));
|
|
184
|
+
},
|
|
185
|
+
values
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
values == null ? void 0 : values.updatedAt
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
),
|
|
192
|
+
title: "Customize QR codes"
|
|
193
|
+
}),
|
|
194
|
+
embed: (values) => drawer.open({
|
|
195
|
+
children: panel(
|
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
197
|
+
back(values),
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
199
|
+
FormOrganizationCampaignPageEmbed,
|
|
200
|
+
{
|
|
201
|
+
...{
|
|
202
|
+
values
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] })
|
|
207
|
+
),
|
|
208
|
+
title: "Embed code"
|
|
209
|
+
}),
|
|
210
|
+
preview: (values) => drawer.open({
|
|
211
|
+
children: panel(
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
213
|
+
back(values),
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
215
|
+
FormOrganizationCampaignPagePreview,
|
|
216
|
+
{
|
|
217
|
+
...{
|
|
218
|
+
campaign: params.campaign,
|
|
219
|
+
onError,
|
|
220
|
+
onSuccess: (response) => {
|
|
221
|
+
var _a2;
|
|
222
|
+
onSuccess(
|
|
223
|
+
response,
|
|
224
|
+
{
|
|
225
|
+
invalidate: [
|
|
226
|
+
{
|
|
227
|
+
queryKey: ["campaign", params.campaign]
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
actions.preview({
|
|
233
|
+
...values,
|
|
234
|
+
tokens: {
|
|
235
|
+
...values == null ? void 0 : values.tokens,
|
|
236
|
+
preview: (_a2 = response == null ? void 0 : response.result) == null ? void 0 : _a2.token
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
organization: params.organization,
|
|
241
|
+
values
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
] })
|
|
246
|
+
),
|
|
247
|
+
title: "Preview URL"
|
|
248
|
+
}),
|
|
249
|
+
qr: (values) => drawer.open({
|
|
250
|
+
children: panel(
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
252
|
+
back(values),
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
254
|
+
FormOrganizationCampaignPageQR,
|
|
255
|
+
{
|
|
256
|
+
...{
|
|
257
|
+
disabled: !canManage,
|
|
258
|
+
onClickCustomize: () => actions.customize(values),
|
|
259
|
+
onError: notice,
|
|
260
|
+
onSuccess: (response) => {
|
|
261
|
+
notice(response);
|
|
262
|
+
queryClient.invalidateQueries({
|
|
263
|
+
queryKey: ["campaign", params.campaign]
|
|
264
|
+
});
|
|
265
|
+
},
|
|
266
|
+
organization,
|
|
267
|
+
values
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
] })
|
|
272
|
+
),
|
|
273
|
+
title: "QR codes"
|
|
274
|
+
}),
|
|
275
|
+
share: (values = address()) => drawer.open({
|
|
276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
...{
|
|
280
|
+
className: "p-6"
|
|
281
|
+
},
|
|
282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
283
|
+
FormOrganizationCampaignPageShare,
|
|
284
|
+
{
|
|
285
|
+
...{
|
|
286
|
+
disabled: !canManage,
|
|
287
|
+
onClickAffiliates: () => actions.affiliates(values),
|
|
288
|
+
onClickEditPreview: () => actions.preview(values),
|
|
289
|
+
onClickEditQR: () => actions.qr(values),
|
|
290
|
+
onClickEditSlug: () => actions.slug(values),
|
|
291
|
+
onClickEmbed: () => actions.embed(values),
|
|
292
|
+
onClickUpgrade: () => modal.close(),
|
|
293
|
+
organization,
|
|
294
|
+
values
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
title: "Share your campaign"
|
|
301
|
+
}),
|
|
302
|
+
slug: (values) => drawer.open({
|
|
303
|
+
children: panel(
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
305
|
+
back(values),
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
307
|
+
FormOrganizationCampaignPageSlug,
|
|
308
|
+
{
|
|
309
|
+
...{
|
|
310
|
+
onError,
|
|
311
|
+
onSuccess: (response) => {
|
|
312
|
+
onSuccess(
|
|
313
|
+
response,
|
|
314
|
+
{
|
|
315
|
+
invalidate: [
|
|
316
|
+
{
|
|
317
|
+
queryKey: ["campaign", params.campaign]
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
actions.share(address(response == null ? void 0 : response.result));
|
|
323
|
+
},
|
|
324
|
+
values
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
] })
|
|
329
|
+
),
|
|
330
|
+
title: "Customize campaign url"
|
|
331
|
+
})
|
|
332
|
+
};
|
|
333
|
+
return {
|
|
334
|
+
button: {
|
|
335
|
+
"data-guide": "button-share",
|
|
336
|
+
disabled: !((_b = (_a = campaign == null ? void 0 : campaign.data) == null ? void 0 : _a.share) == null ? void 0 : _b.url),
|
|
337
|
+
onClick: () => actions.share(),
|
|
338
|
+
svg: import_share.default,
|
|
339
|
+
title: "Share"
|
|
340
|
+
},
|
|
341
|
+
share: actions.share
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
345
|
+
0 && (module.exports = {
|
|
346
|
+
useCampaignShare
|
|
347
|
+
});
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import dynamic from "next/dynamic";
|
|
5
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { useCallbacks, useDrawer, useModal } from "./lib/hooks.mjs";
|
|
7
|
+
import { hasCapability } from "../shared/lib/helpers.mjs";
|
|
8
|
+
import { LoaderDynamic } from "../shared/loader.mjs";
|
|
9
|
+
import LinkBack from "./link-back.mjs";
|
|
10
|
+
import Share from "../icons/share.mjs";
|
|
11
|
+
const FormOrganizationCampaignPageAffiliates = dynamic(
|
|
12
|
+
() => import("./form-organization-campaign-page-affiliates.mjs"),
|
|
13
|
+
{
|
|
14
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
15
|
+
ssr: false
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
const FormOrganizationCampaignPageQRCustomize = dynamic(
|
|
19
|
+
() => import("./form-organization-campaign-page-qr.mjs").then((mod) => mod.FormOrganizationCampaignPageQRCustomize),
|
|
20
|
+
{
|
|
21
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
22
|
+
ssr: false
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
const FormOrganizationCampaignPageQR = dynamic(
|
|
26
|
+
() => import("./form-organization-campaign-page-qr.mjs"),
|
|
27
|
+
{
|
|
28
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
29
|
+
ssr: false
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
const FormOrganizationCampaignPageEmbed = dynamic(
|
|
33
|
+
() => import("./form-organization-campaign-page-embed.mjs"),
|
|
34
|
+
{
|
|
35
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
36
|
+
ssr: false
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
const FormOrganizationCampaignPagePreview = dynamic(
|
|
40
|
+
() => import("./form-organization-campaign-page-preview.mjs"),
|
|
41
|
+
{
|
|
42
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
43
|
+
ssr: false
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
const FormOrganizationCampaignPageShare = dynamic(
|
|
47
|
+
() => import("./form-organization-campaign-page-share.mjs"),
|
|
48
|
+
{
|
|
49
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
50
|
+
ssr: false
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
const FormOrganizationCampaignPageSlug = dynamic(
|
|
54
|
+
() => import("./form-organization-campaign-page-slug.mjs"),
|
|
55
|
+
{
|
|
56
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
57
|
+
ssr: false
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
const useCampaignShare = ({ params }) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
const queryClient = useQueryClient();
|
|
63
|
+
const campaign = useQuery({
|
|
64
|
+
enabled: false,
|
|
65
|
+
queryKey: ["campaign", params.campaign]
|
|
66
|
+
});
|
|
67
|
+
const { data: organization } = useQuery({
|
|
68
|
+
enabled: false,
|
|
69
|
+
queryKey: ["organization", params.organization]
|
|
70
|
+
});
|
|
71
|
+
const canManage = hasCapability(organization, "campaigns.settings");
|
|
72
|
+
const { onError, onSuccess } = useCallbacks({
|
|
73
|
+
queryClient
|
|
74
|
+
});
|
|
75
|
+
const drawer = useDrawer({
|
|
76
|
+
queryClient
|
|
77
|
+
});
|
|
78
|
+
const modal = useModal({
|
|
79
|
+
queryClient
|
|
80
|
+
});
|
|
81
|
+
const address = (values = campaign == null ? void 0 : campaign.data) => ({
|
|
82
|
+
...values,
|
|
83
|
+
organization: params.organization
|
|
84
|
+
});
|
|
85
|
+
const back = (values) => /* @__PURE__ */ jsx(
|
|
86
|
+
LinkBack,
|
|
87
|
+
{
|
|
88
|
+
...{
|
|
89
|
+
element: "button",
|
|
90
|
+
onClick: () => actions.share(values)
|
|
91
|
+
},
|
|
92
|
+
children: "Back"
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
const panel = (children) => /* @__PURE__ */ jsx(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
...{
|
|
99
|
+
className: "p-6 space-y-6"
|
|
100
|
+
},
|
|
101
|
+
children
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
const notice = (response) => queryClient.setQueryData(
|
|
105
|
+
["notice"],
|
|
106
|
+
{
|
|
107
|
+
active: true,
|
|
108
|
+
response
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
const actions = {
|
|
112
|
+
affiliates: (values) => drawer.open({
|
|
113
|
+
children: panel(
|
|
114
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
115
|
+
back(values),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
FormOrganizationCampaignPageAffiliates,
|
|
118
|
+
{
|
|
119
|
+
...{
|
|
120
|
+
...params,
|
|
121
|
+
affiliates: values == null ? void 0 : values.affiliates
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] })
|
|
126
|
+
),
|
|
127
|
+
title: "Affiliates"
|
|
128
|
+
}),
|
|
129
|
+
customize: (values) => drawer.open({
|
|
130
|
+
children: panel(
|
|
131
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
LinkBack,
|
|
134
|
+
{
|
|
135
|
+
...{
|
|
136
|
+
element: "button",
|
|
137
|
+
onClick: () => actions.qr(values)
|
|
138
|
+
},
|
|
139
|
+
children: "Back"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
FormOrganizationCampaignPageQRCustomize,
|
|
144
|
+
{
|
|
145
|
+
...{
|
|
146
|
+
onError,
|
|
147
|
+
onSuccess: (response) => {
|
|
148
|
+
queryClient.invalidateQueries({
|
|
149
|
+
queryKey: ["campaign", params.campaign]
|
|
150
|
+
});
|
|
151
|
+
actions.qr(address(response == null ? void 0 : response.result));
|
|
152
|
+
},
|
|
153
|
+
values
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
values == null ? void 0 : values.updatedAt
|
|
157
|
+
)
|
|
158
|
+
] })
|
|
159
|
+
),
|
|
160
|
+
title: "Customize QR codes"
|
|
161
|
+
}),
|
|
162
|
+
embed: (values) => drawer.open({
|
|
163
|
+
children: panel(
|
|
164
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
165
|
+
back(values),
|
|
166
|
+
/* @__PURE__ */ jsx(
|
|
167
|
+
FormOrganizationCampaignPageEmbed,
|
|
168
|
+
{
|
|
169
|
+
...{
|
|
170
|
+
values
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
] })
|
|
175
|
+
),
|
|
176
|
+
title: "Embed code"
|
|
177
|
+
}),
|
|
178
|
+
preview: (values) => drawer.open({
|
|
179
|
+
children: panel(
|
|
180
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
181
|
+
back(values),
|
|
182
|
+
/* @__PURE__ */ jsx(
|
|
183
|
+
FormOrganizationCampaignPagePreview,
|
|
184
|
+
{
|
|
185
|
+
...{
|
|
186
|
+
campaign: params.campaign,
|
|
187
|
+
onError,
|
|
188
|
+
onSuccess: (response) => {
|
|
189
|
+
var _a2;
|
|
190
|
+
onSuccess(
|
|
191
|
+
response,
|
|
192
|
+
{
|
|
193
|
+
invalidate: [
|
|
194
|
+
{
|
|
195
|
+
queryKey: ["campaign", params.campaign]
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
actions.preview({
|
|
201
|
+
...values,
|
|
202
|
+
tokens: {
|
|
203
|
+
...values == null ? void 0 : values.tokens,
|
|
204
|
+
preview: (_a2 = response == null ? void 0 : response.result) == null ? void 0 : _a2.token
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
organization: params.organization,
|
|
209
|
+
values
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] })
|
|
214
|
+
),
|
|
215
|
+
title: "Preview URL"
|
|
216
|
+
}),
|
|
217
|
+
qr: (values) => drawer.open({
|
|
218
|
+
children: panel(
|
|
219
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
220
|
+
back(values),
|
|
221
|
+
/* @__PURE__ */ jsx(
|
|
222
|
+
FormOrganizationCampaignPageQR,
|
|
223
|
+
{
|
|
224
|
+
...{
|
|
225
|
+
disabled: !canManage,
|
|
226
|
+
onClickCustomize: () => actions.customize(values),
|
|
227
|
+
onError: notice,
|
|
228
|
+
onSuccess: (response) => {
|
|
229
|
+
notice(response);
|
|
230
|
+
queryClient.invalidateQueries({
|
|
231
|
+
queryKey: ["campaign", params.campaign]
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
organization,
|
|
235
|
+
values
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
] })
|
|
240
|
+
),
|
|
241
|
+
title: "QR codes"
|
|
242
|
+
}),
|
|
243
|
+
share: (values = address()) => drawer.open({
|
|
244
|
+
children: /* @__PURE__ */ jsx(
|
|
245
|
+
"div",
|
|
246
|
+
{
|
|
247
|
+
...{
|
|
248
|
+
className: "p-6"
|
|
249
|
+
},
|
|
250
|
+
children: /* @__PURE__ */ jsx(
|
|
251
|
+
FormOrganizationCampaignPageShare,
|
|
252
|
+
{
|
|
253
|
+
...{
|
|
254
|
+
disabled: !canManage,
|
|
255
|
+
onClickAffiliates: () => actions.affiliates(values),
|
|
256
|
+
onClickEditPreview: () => actions.preview(values),
|
|
257
|
+
onClickEditQR: () => actions.qr(values),
|
|
258
|
+
onClickEditSlug: () => actions.slug(values),
|
|
259
|
+
onClickEmbed: () => actions.embed(values),
|
|
260
|
+
onClickUpgrade: () => modal.close(),
|
|
261
|
+
organization,
|
|
262
|
+
values
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
title: "Share your campaign"
|
|
269
|
+
}),
|
|
270
|
+
slug: (values) => drawer.open({
|
|
271
|
+
children: panel(
|
|
272
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
273
|
+
back(values),
|
|
274
|
+
/* @__PURE__ */ jsx(
|
|
275
|
+
FormOrganizationCampaignPageSlug,
|
|
276
|
+
{
|
|
277
|
+
...{
|
|
278
|
+
onError,
|
|
279
|
+
onSuccess: (response) => {
|
|
280
|
+
onSuccess(
|
|
281
|
+
response,
|
|
282
|
+
{
|
|
283
|
+
invalidate: [
|
|
284
|
+
{
|
|
285
|
+
queryKey: ["campaign", params.campaign]
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
actions.share(address(response == null ? void 0 : response.result));
|
|
291
|
+
},
|
|
292
|
+
values
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] })
|
|
297
|
+
),
|
|
298
|
+
title: "Customize campaign url"
|
|
299
|
+
})
|
|
300
|
+
};
|
|
301
|
+
return {
|
|
302
|
+
button: {
|
|
303
|
+
"data-guide": "button-share",
|
|
304
|
+
disabled: !((_b = (_a = campaign == null ? void 0 : campaign.data) == null ? void 0 : _a.share) == null ? void 0 : _b.url),
|
|
305
|
+
onClick: () => actions.share(),
|
|
306
|
+
svg: Share,
|
|
307
|
+
title: "Share"
|
|
308
|
+
},
|
|
309
|
+
share: actions.share
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
export {
|
|
313
|
+
useCampaignShare
|
|
314
|
+
};
|
|
@@ -228,7 +228,7 @@ const CardAffiliate = ({
|
|
|
228
228
|
...{
|
|
229
229
|
element: import_link.default,
|
|
230
230
|
// The campaign's live page: the api lists only that one, which opens on the Page row.
|
|
231
|
-
href: "/organizations/" + (page == null ? void 0 : page.organization) + "/campaigns/" + (page == null ? void 0 : page.campaign) + "/
|
|
231
|
+
href: "/organizations/" + (page == null ? void 0 : page.organization) + "/campaigns/" + (page == null ? void 0 : page.campaign) + "/design",
|
|
232
232
|
inline: true,
|
|
233
233
|
variant: "link"
|
|
234
234
|
},
|
|
@@ -196,7 +196,7 @@ const CardAffiliate = ({
|
|
|
196
196
|
...{
|
|
197
197
|
element: Link,
|
|
198
198
|
// The campaign's live page: the api lists only that one, which opens on the Page row.
|
|
199
|
-
href: "/organizations/" + (page == null ? void 0 : page.organization) + "/campaigns/" + (page == null ? void 0 : page.campaign) + "/
|
|
199
|
+
href: "/organizations/" + (page == null ? void 0 : page.organization) + "/campaigns/" + (page == null ? void 0 : page.campaign) + "/design",
|
|
200
200
|
inline: true,
|
|
201
201
|
variant: "link"
|
|
202
202
|
},
|
|
@@ -76,7 +76,7 @@ const useCampaignSwitch = ({ campaign, onError, onSuccess }) => {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
-
const SwitchLock = ({ disabled, onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
79
|
+
const SwitchLock = ({ disabled, name, onChange, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
80
80
|
"span",
|
|
81
81
|
{
|
|
82
82
|
...{
|
|
@@ -97,6 +97,8 @@ const SwitchLock = ({ disabled, onChange, value }) => /* @__PURE__ */ (0, import
|
|
|
97
97
|
import_input_switch.default,
|
|
98
98
|
{
|
|
99
99
|
...{
|
|
100
|
+
// Impeccable audit, 2026-11-21: the switch is named for its row.
|
|
101
|
+
"aria-label": name,
|
|
100
102
|
disabled,
|
|
101
103
|
onChange,
|
|
102
104
|
value
|
|
@@ -112,6 +114,7 @@ const SwitchRow = ({ description, lock, onChange, title, value }) => {
|
|
|
112
114
|
{
|
|
113
115
|
...{
|
|
114
116
|
disabled: Boolean(lock),
|
|
117
|
+
name: typeof title === "string" ? title : void 0,
|
|
115
118
|
onChange,
|
|
116
119
|
value
|
|
117
120
|
}
|