@drawbridge/components 0.1.14 → 0.1.16

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.
Files changed (52) hide show
  1. package/dist/bridge/form-subdomain-missions.js +77 -38
  2. package/dist/bridge/form-subdomain-missions.mjs +76 -38
  3. package/dist/bridge/lib/url.js +3 -3
  4. package/dist/bridge/lib/url.mjs +3 -3
  5. package/dist/bridge/share-button.js +12 -2
  6. package/dist/bridge/share-button.mjs +12 -2
  7. package/dist/bridge/template-layout.js +1 -1
  8. package/dist/bridge/template-layout.mjs +1 -1
  9. package/dist/dashboard/answer-rows.js +77 -0
  10. package/dist/dashboard/answer-rows.mjs +41 -0
  11. package/dist/dashboard/card-campaign-switch.js +55 -43
  12. package/dist/dashboard/card-campaign-switch.mjs +56 -44
  13. package/dist/dashboard/card-order.js +248 -120
  14. package/dist/dashboard/card-order.mjs +248 -120
  15. package/dist/dashboard/connection-workflows.js +13 -4
  16. package/dist/dashboard/connection-workflows.mjs +13 -4
  17. package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
  18. package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
  19. package/dist/dashboard/form-organization-campaign-field-select.js +51 -5
  20. package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
  21. package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
  22. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
  23. package/dist/dashboard/form-organization-campaign-section.js +24 -4
  24. package/dist/dashboard/form-organization-campaign-section.mjs +24 -4
  25. package/dist/dashboard/form-organization-workflow.js +195 -56
  26. package/dist/dashboard/form-organization-workflow.mjs +191 -57
  27. package/dist/dashboard/item-row.js +92 -0
  28. package/dist/dashboard/item-row.mjs +63 -0
  29. package/dist/dashboard/lib/sms.js +3 -0
  30. package/dist/dashboard/lib/sms.mjs +2 -0
  31. package/dist/dashboard/order-sections.js +220 -0
  32. package/dist/dashboard/order-sections.mjs +185 -0
  33. package/dist/dashboard/preview.js +29 -2
  34. package/dist/dashboard/preview.mjs +28 -2
  35. package/dist/input-code.js +35 -53
  36. package/dist/input-code.mjs +26 -54
  37. package/dist/shared/button.js +1 -1
  38. package/dist/shared/button.mjs +1 -1
  39. package/dist/shared/lib/campaign.js +9 -3
  40. package/dist/shared/lib/campaign.mjs +7 -2
  41. package/dist/shared/lib/helpers.js +7 -0
  42. package/dist/shared/lib/helpers.mjs +7 -0
  43. package/package.json +19 -4
  44. package/types/bridge/form-subdomain-missions.d.ts +3 -1
  45. package/types/bridge/lib/url.d.ts +5 -4
  46. package/types/dashboard/answer-rows.d.ts +30 -0
  47. package/types/dashboard/card-order.d.ts +18 -3
  48. package/types/dashboard/form-organization-campaign-section.d.ts +2 -0
  49. package/types/dashboard/form-organization-workflow.d.ts +15 -0
  50. package/types/dashboard/item-row.d.ts +25 -0
  51. package/types/dashboard/order-sections.d.ts +36 -0
  52. package/types/shared/lib/helpers.d.ts +1 -1
@@ -99,46 +99,57 @@ const SwitchLock = ({ disabled, onChange, value }) => /* @__PURE__ */ (0, import
99
99
  ]
100
100
  }
101
101
  );
102
- const Row = ({ description, disabled, onChange, title, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
103
- "div",
104
- {
105
- ...{
106
- className: "flex items-center gap-4 py-3 first:pt-0 last:pb-0"
107
- },
108
- children: [
109
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
110
- "div",
111
- {
112
- ...{
113
- className: "flex-1 min-w-0"
114
- },
115
- children: [
116
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: title }),
117
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
- "p",
119
- {
120
- ...{
121
- className: "text-sm text-gray-dark"
122
- },
123
- children: description
124
- }
125
- )
126
- ]
127
- }
128
- ),
129
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
130
- SwitchLock,
131
- {
132
- ...{
133
- disabled,
134
- onChange,
135
- value
102
+ const Row = ({ description, lock, onChange, title, value }) => {
103
+ const input = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
+ SwitchLock,
105
+ {
106
+ ...{
107
+ disabled: Boolean(lock),
108
+ onChange,
109
+ value
110
+ }
111
+ }
112
+ );
113
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
114
+ "div",
115
+ {
116
+ ...{
117
+ className: "flex items-center gap-4 py-3 first:pt-0 last:pb-0"
118
+ },
119
+ children: [
120
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
121
+ "div",
122
+ {
123
+ ...{
124
+ className: "flex-1 min-w-0"
125
+ },
126
+ children: [
127
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: title }),
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
129
+ "p",
130
+ {
131
+ ...{
132
+ className: "text-sm text-gray-dark"
133
+ },
134
+ children: description
135
+ }
136
+ )
137
+ ]
136
138
  }
137
- }
138
- )
139
- ]
140
- }
141
- );
139
+ ),
140
+ lock ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
141
+ import_tooltip.default,
142
+ {
143
+ ...{
144
+ content: lock
145
+ },
146
+ children: input
147
+ }
148
+ ) : input
149
+ ]
150
+ }
151
+ );
152
+ };
142
153
  const HeaderCampaignSwitch = ({
143
154
  campaign,
144
155
  disabled,
@@ -153,12 +164,13 @@ const HeaderCampaignSwitch = ({
153
164
  onError,
154
165
  onSuccess
155
166
  });
167
+ const lock = (0, import_campaign.switchLock)(campaign, which, disabled);
156
168
  const input = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
157
169
  import_input_switch.default,
158
170
  {
159
171
  ...{
160
172
  "aria-label": which === "form" ? "Form" : "Giveaway",
161
- disabled,
173
+ disabled: Boolean(lock),
162
174
  onChange: (value) => flip(which, value),
163
175
  value: Boolean((_a = campaign == null ? void 0 : campaign[which]) == null ? void 0 : _a.enabled)
164
176
  }
@@ -171,11 +183,11 @@ const HeaderCampaignSwitch = ({
171
183
  className: "flex",
172
184
  ...rest
173
185
  },
174
- children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
+ children: lock ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
187
  import_tooltip.default,
176
188
  {
177
189
  ...{
178
- content: "You need Manage on Campaigns to change this"
190
+ content: lock
179
191
  },
180
192
  children: input
181
193
  }
@@ -241,7 +253,7 @@ const CardLeadCapture = ({
241
253
  {
242
254
  ...{
243
255
  description,
244
- disabled,
256
+ lock: (0, import_campaign.switchLock)(campaign, key, disabled),
245
257
  onChange: (value) => flip(key, value),
246
258
  title,
247
259
  value: Boolean((_a = campaign == null ? void 0 : campaign[key]) == null ? void 0 : _a.enabled)
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useQueryClient } from "@tanstack/react-query";
3
3
  import { request } from "@drawbridge/drawbridge-utils/fetch";
4
- import { awardingCard, campaignSwitch } from "../shared/lib/campaign.mjs";
4
+ import { awardingCard, campaignSwitch, switchLock } from "../shared/lib/campaign.mjs";
5
5
  import { useModal } from "./lib/hooks.mjs";
6
6
  import CardSection from "./card-section.mjs";
7
7
  import CardTask from "./card-task.mjs";
@@ -66,46 +66,57 @@ const SwitchLock = ({ disabled, onChange, value }) => /* @__PURE__ */ jsxs(
66
66
  ]
67
67
  }
68
68
  );
69
- const Row = ({ description, disabled, onChange, title, value }) => /* @__PURE__ */ jsxs(
70
- "div",
71
- {
72
- ...{
73
- className: "flex items-center gap-4 py-3 first:pt-0 last:pb-0"
74
- },
75
- children: [
76
- /* @__PURE__ */ jsxs(
77
- "div",
78
- {
79
- ...{
80
- className: "flex-1 min-w-0"
81
- },
82
- children: [
83
- /* @__PURE__ */ jsx("p", { children: title }),
84
- /* @__PURE__ */ jsx(
85
- "p",
86
- {
87
- ...{
88
- className: "text-sm text-gray-dark"
89
- },
90
- children: description
91
- }
92
- )
93
- ]
94
- }
95
- ),
96
- /* @__PURE__ */ jsx(
97
- SwitchLock,
98
- {
99
- ...{
100
- disabled,
101
- onChange,
102
- value
69
+ const Row = ({ description, lock, onChange, title, value }) => {
70
+ const input = /* @__PURE__ */ jsx(
71
+ SwitchLock,
72
+ {
73
+ ...{
74
+ disabled: Boolean(lock),
75
+ onChange,
76
+ value
77
+ }
78
+ }
79
+ );
80
+ return /* @__PURE__ */ jsxs(
81
+ "div",
82
+ {
83
+ ...{
84
+ className: "flex items-center gap-4 py-3 first:pt-0 last:pb-0"
85
+ },
86
+ children: [
87
+ /* @__PURE__ */ jsxs(
88
+ "div",
89
+ {
90
+ ...{
91
+ className: "flex-1 min-w-0"
92
+ },
93
+ children: [
94
+ /* @__PURE__ */ jsx("p", { children: title }),
95
+ /* @__PURE__ */ jsx(
96
+ "p",
97
+ {
98
+ ...{
99
+ className: "text-sm text-gray-dark"
100
+ },
101
+ children: description
102
+ }
103
+ )
104
+ ]
103
105
  }
104
- }
105
- )
106
- ]
107
- }
108
- );
106
+ ),
107
+ lock ? /* @__PURE__ */ jsx(
108
+ Tooltip,
109
+ {
110
+ ...{
111
+ content: lock
112
+ },
113
+ children: input
114
+ }
115
+ ) : input
116
+ ]
117
+ }
118
+ );
119
+ };
109
120
  const HeaderCampaignSwitch = ({
110
121
  campaign,
111
122
  disabled,
@@ -120,12 +131,13 @@ const HeaderCampaignSwitch = ({
120
131
  onError,
121
132
  onSuccess
122
133
  });
134
+ const lock = switchLock(campaign, which, disabled);
123
135
  const input = /* @__PURE__ */ jsx(
124
136
  InputSwitch,
125
137
  {
126
138
  ...{
127
139
  "aria-label": which === "form" ? "Form" : "Giveaway",
128
- disabled,
140
+ disabled: Boolean(lock),
129
141
  onChange: (value) => flip(which, value),
130
142
  value: Boolean((_a = campaign == null ? void 0 : campaign[which]) == null ? void 0 : _a.enabled)
131
143
  }
@@ -138,11 +150,11 @@ const HeaderCampaignSwitch = ({
138
150
  className: "flex",
139
151
  ...rest
140
152
  },
141
- children: disabled ? /* @__PURE__ */ jsx(
153
+ children: lock ? /* @__PURE__ */ jsx(
142
154
  Tooltip,
143
155
  {
144
156
  ...{
145
- content: "You need Manage on Campaigns to change this"
157
+ content: lock
146
158
  },
147
159
  children: input
148
160
  }
@@ -208,7 +220,7 @@ const CardLeadCapture = ({
208
220
  {
209
221
  ...{
210
222
  description,
211
- disabled,
223
+ lock: switchLock(campaign, key, disabled),
212
224
  onChange: (value) => flip(key, value),
213
225
  title,
214
226
  value: Boolean((_a = campaign == null ? void 0 : campaign[key]) == null ? void 0 : _a.enabled)