@drawbridge/components 0.1.28 → 0.1.30

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.
@@ -1091,6 +1091,7 @@ const FormOrganizationWorkflowEdit = ({
1091
1091
  const onSubmit = async ({
1092
1092
  steps
1093
1093
  }) => {
1094
+ var _a2;
1094
1095
  try {
1095
1096
  const body = {
1096
1097
  steps: steps.map(({ connectionId, discount, enabled, members, message, score, settings: parts, slug, subject, text, type, url }, index) => {
@@ -1124,6 +1125,10 @@ const FormOrganizationWorkflowEdit = ({
1124
1125
  endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/workflow/" + event,
1125
1126
  method: "PUT"
1126
1127
  });
1128
+ (((_a2 = response == null ? void 0 : response.result) == null ? void 0 : _a2.steps) || []).forEach((step, index) => {
1129
+ setValue("steps." + index + ".connectionId", step.connectionId || "");
1130
+ setValue("steps." + index + ".slug", step.slug || "");
1131
+ });
1127
1132
  onSuccess(response);
1128
1133
  } catch (error) {
1129
1134
  onError(error);
@@ -1038,6 +1038,7 @@ const FormOrganizationWorkflowEdit = ({
1038
1038
  const onSubmit = async ({
1039
1039
  steps
1040
1040
  }) => {
1041
+ var _a2;
1041
1042
  try {
1042
1043
  const body = {
1043
1044
  steps: steps.map(({ connectionId, discount, enabled, members, message, score, settings: parts, slug, subject, text, type, url }, index) => {
@@ -1071,6 +1072,10 @@ const FormOrganizationWorkflowEdit = ({
1071
1072
  endpoint: "/organization/" + (values == null ? void 0 : values.organization) + "/campaign/" + (values == null ? void 0 : values.campaign) + "/workflow/" + event,
1072
1073
  method: "PUT"
1073
1074
  });
1075
+ (((_a2 = response == null ? void 0 : response.result) == null ? void 0 : _a2.steps) || []).forEach((step, index) => {
1076
+ setValue("steps." + index + ".connectionId", step.connectionId || "");
1077
+ setValue("steps." + index + ".slug", step.slug || "");
1078
+ });
1074
1079
  onSuccess(response);
1075
1080
  } catch (error) {
1076
1081
  onError(error);
@@ -182,6 +182,15 @@ const TemplateSocketCampaign = ({
182
182
  queryClient.invalidateQueries({
183
183
  queryKey: ["organization-campaign-prizes", params.organization, params.campaign]
184
184
  });
185
+ },
186
+ // @story campaigns/orders
187
+ // An order arrived, changed status, was fulfilled or left: the
188
+ // campaign's Orders list refetches, so a new order and a change made
189
+ // in another tab show without a reload.
190
+ "campaign.orders": () => {
191
+ queryClient.invalidateQueries({
192
+ queryKey: ["campaign-orders", params.organization, params.campaign]
193
+ });
185
194
  }
186
195
  },
187
196
  // The live handler applies leads as a delta, which can't be replayed after
@@ -199,7 +208,9 @@ const TemplateSocketCampaign = ({
199
208
  }],
200
209
  ["campaign-advertisements", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign],
201
210
  ["organization-campaign-advertisement"],
202
- ["organization-campaign-prizes", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign]
211
+ ["organization-campaign-prizes", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign],
212
+ // An order placed while this room was not joined was never heard.
213
+ ["campaign-orders", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign]
203
214
  ]
204
215
  });
205
216
  return children;
@@ -147,6 +147,15 @@ const TemplateSocketCampaign = ({
147
147
  queryClient.invalidateQueries({
148
148
  queryKey: ["organization-campaign-prizes", params.organization, params.campaign]
149
149
  });
150
+ },
151
+ // @story campaigns/orders
152
+ // An order arrived, changed status, was fulfilled or left: the
153
+ // campaign's Orders list refetches, so a new order and a change made
154
+ // in another tab show without a reload.
155
+ "campaign.orders": () => {
156
+ queryClient.invalidateQueries({
157
+ queryKey: ["campaign-orders", params.organization, params.campaign]
158
+ });
150
159
  }
151
160
  },
152
161
  // The live handler applies leads as a delta, which can't be replayed after
@@ -164,7 +173,9 @@ const TemplateSocketCampaign = ({
164
173
  }],
165
174
  ["campaign-advertisements", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign],
166
175
  ["organization-campaign-advertisement"],
167
- ["organization-campaign-prizes", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign]
176
+ ["organization-campaign-prizes", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign],
177
+ // An order placed while this room was not joined was never heard.
178
+ ["campaign-orders", params == null ? void 0 : params.organization, params == null ? void 0 : params.campaign]
168
179
  ]
169
180
  });
170
181
  return children;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",