@drawbridge/components 0.1.19 → 0.1.20

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.
@@ -32,6 +32,7 @@ __export(form_organization_workflow_exports, {
32
32
  SAMPLE: () => SAMPLE,
33
33
  TextPreview: () => TextPreview,
34
34
  firstEntryOnly: () => firstEntryOnly,
35
+ hasStepOptions: () => hasStepOptions,
35
36
  issueRow: () => issueRow,
36
37
  memberOptions: () => memberOptions,
37
38
  partToStart: () => partToStart,
@@ -168,6 +169,7 @@ const stepReason = ({ entry, saved = [], type }) => {
168
169
  var _a, _b;
169
170
  return ((_a = ((entry == null ? void 0 : entry.steps) || []).find((step) => (step == null ? void 0 : step.value) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _a.reason) || ((_b = saved.find((step) => (step == null ? void 0 : step.type) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _b.reason) || null;
170
171
  };
172
+ const hasStepOptions = (options = []) => options.some((option) => Boolean(option == null ? void 0 : option.value));
171
173
  const responseStart = (number) => ({
172
174
  email: {
173
175
  enabled: true,
@@ -1197,6 +1199,7 @@ const FormOrganizationWorkflowEdit = ({
1197
1199
  organization: values == null ? void 0 : values.organization,
1198
1200
  settings: step.settings
1199
1201
  });
1202
+ const stepOptions = getStepOptions(index);
1200
1203
  return (
1201
1204
  // @story workflows/edit
1202
1205
  // EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
@@ -1352,8 +1355,10 @@ const FormOrganizationWorkflowEdit = ({
1352
1355
  setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
1353
1356
  if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
1354
1357
  },
1355
- disabled: lockedStep(index),
1356
- options: getStepOptions(index),
1358
+ // Locked for a member on the owner's step; disabled
1359
+ // with nothing left to pick.
1360
+ disabled: lockedStep(index) || !hasStepOptions(stepOptions),
1361
+ options: stepOptions,
1357
1362
  // Resolved from the WHOLE ROW, not from this path: the
1358
1363
  // option value carries a connection the type alone cannot
1359
1364
  // name.
@@ -1614,6 +1619,7 @@ const FormOrganizationWorkflowEdit = ({
1614
1619
  SAMPLE,
1615
1620
  TextPreview,
1616
1621
  firstEntryOnly,
1622
+ hasStepOptions,
1617
1623
  issueRow,
1618
1624
  memberOptions,
1619
1625
  partToStart,
@@ -117,6 +117,7 @@ const stepReason = ({ entry, saved = [], type }) => {
117
117
  var _a, _b;
118
118
  return ((_a = ((entry == null ? void 0 : entry.steps) || []).find((step) => (step == null ? void 0 : step.value) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _a.reason) || ((_b = saved.find((step) => (step == null ? void 0 : step.type) === type && (step == null ? void 0 : step.reason))) == null ? void 0 : _b.reason) || null;
119
119
  };
120
+ const hasStepOptions = (options = []) => options.some((option) => Boolean(option == null ? void 0 : option.value));
120
121
  const responseStart = (number) => ({
121
122
  email: {
122
123
  enabled: true,
@@ -1146,6 +1147,7 @@ const FormOrganizationWorkflowEdit = ({
1146
1147
  organization: values == null ? void 0 : values.organization,
1147
1148
  settings: step.settings
1148
1149
  });
1150
+ const stepOptions = getStepOptions(index);
1149
1151
  return (
1150
1152
  // @story workflows/edit
1151
1153
  // EACH STEP IS ITS OWN CARD in the flow under the Trigger card,
@@ -1301,8 +1303,10 @@ const FormOrganizationWorkflowEdit = ({
1301
1303
  setValue(`steps.${index}.slug`, (option == null ? void 0 : option.slug) || "");
1302
1304
  if (copy) Object.entries(copy).forEach(([key, value]) => setValue(`steps.${index}.${key}`, value));
1303
1305
  },
1304
- disabled: lockedStep(index),
1305
- options: getStepOptions(index),
1306
+ // Locked for a member on the owner's step; disabled
1307
+ // with nothing left to pick.
1308
+ disabled: lockedStep(index) || !hasStepOptions(stepOptions),
1309
+ options: stepOptions,
1306
1310
  // Resolved from the WHOLE ROW, not from this path: the
1307
1311
  // option value carries a connection the type alone cannot
1308
1312
  // name.
@@ -1562,6 +1566,7 @@ export {
1562
1566
  SAMPLE,
1563
1567
  TextPreview,
1564
1568
  firstEntryOnly,
1569
+ hasStepOptions,
1565
1570
  issueRow,
1566
1571
  memberOptions,
1567
1572
  partToStart,
@@ -49,6 +49,7 @@ const ProviderUi = ({
49
49
  }) => {
50
50
  var _a, _b, _c, _d, _e, _f;
51
51
  const queryClient = (0, import_react_query.useQueryClient)();
52
+ queryClient.setQueryDefaults(["socket"], { structuralSharing: false });
52
53
  const tokenRef = (0, import_react.useRef)(token);
53
54
  (0, import_react.useEffect)(
54
55
  () => {
@@ -17,6 +17,7 @@ const ProviderUi = ({
17
17
  }) => {
18
18
  var _a, _b, _c, _d, _e, _f;
19
19
  const queryClient = useQueryClient();
20
+ queryClient.setQueryDefaults(["socket"], { structuralSharing: false });
20
21
  const tokenRef = useRef(token);
21
22
  useEffect(
22
23
  () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",
@@ -136,6 +136,10 @@ export declare const prefillRow: ( options: { entry?: WorkflowCatalogEntry | nul
136
136
  // from the catalog entry or the saved steps; null when the step can run.
137
137
  export declare const stepReason: ( options: { entry?: WorkflowCatalogEntry | null; saved?: Array<{ reason?: string; type?: string; [ key: string ]: unknown }>; type?: string } ) => string | null;
138
138
 
139
+ // Whether a Step field's list holds a step to pick, beyond "Select a step";
140
+ // false disables the field.
141
+ export declare const hasStepOptions: ( options?: Array<{ value?: string | null; [ key: string ]: unknown }> ) => boolean;
142
+
139
143
  // The stored type of Auto response.
140
144
  export declare const RESPONSE: 'step.response.send';
141
145
  // Auto response's settings as on a new campaign: `number` is the number's status.