@odla-ai/chapter 0.10.1 → 0.11.0
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/README.md +21 -3
- package/dist/index.cjs +12 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/worker/index.cjs +17 -3
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +7 -0
- package/dist/worker/index.d.ts +7 -0
- package/dist/worker/index.js +17 -3
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
package/dist/worker/index.cjs
CHANGED
|
@@ -184,6 +184,9 @@ async function createClerkUser(secretKey, input, fetchImpl = fetch) {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// src/member.ts
|
|
187
|
+
function hasDisclaimerAck(fields) {
|
|
188
|
+
return fields.disclaimerAck === true || fields.disclaimerAck === "true";
|
|
189
|
+
}
|
|
187
190
|
var IDENTITY_FIELDS = /* @__PURE__ */ new Set(["email", "firstName", "lastName"]);
|
|
188
191
|
function applicantProfile(chapter, fields) {
|
|
189
192
|
const profile = {};
|
|
@@ -206,6 +209,10 @@ async function submitApplication(db, chapter, fields, opts) {
|
|
|
206
209
|
const cap = app.maxLen[f] ?? app.defaultMaxLen;
|
|
207
210
|
if (typeof v === "string" && v.length > cap) return { ok: false, error: `${f} exceeds ${cap} characters` };
|
|
208
211
|
}
|
|
212
|
+
const acked = hasDisclaimerAck(fields);
|
|
213
|
+
if (app.requireDisclaimerAck && !acked) {
|
|
214
|
+
return { ok: false, error: "disclaimerAck is required" };
|
|
215
|
+
}
|
|
209
216
|
const id = opts.newId();
|
|
210
217
|
const row = { id, status: chapter.pipeline.initial, createdAt: opts.now };
|
|
211
218
|
for (const f of [...app.required, ...app.optional]) {
|
|
@@ -213,12 +220,12 @@ async function submitApplication(db, chapter, fields, opts) {
|
|
|
213
220
|
}
|
|
214
221
|
if (fields.focus !== void 0) row.focus = fields.focus;
|
|
215
222
|
if (opts.groupId) row.groupId = opts.groupId;
|
|
216
|
-
if (
|
|
223
|
+
if (acked) row.disclaimerAckAt = opts.now;
|
|
217
224
|
const { duplicate } = await db.transact(
|
|
218
225
|
[{ t: "update", ns: "applications", id, attrs: row }],
|
|
219
226
|
opts.submissionId ? { mutationId: `join:${opts.submissionId}` } : void 0
|
|
220
227
|
);
|
|
221
|
-
return { ok: true, id, duplicate, status: chapter.pipeline.initial };
|
|
228
|
+
return { ok: true, id, duplicate, status: chapter.pipeline.initial, disclaimerAckAt: acked ? opts.now : null };
|
|
222
229
|
}
|
|
223
230
|
function joinConfig(group, paymentsReady) {
|
|
224
231
|
return {
|
|
@@ -674,7 +681,14 @@ var handleMember = async (req, url, env, ctx) => {
|
|
|
674
681
|
}
|
|
675
682
|
await provisionApplicant(db, chapter, result.id, parsed);
|
|
676
683
|
}
|
|
677
|
-
return json({
|
|
684
|
+
return json({
|
|
685
|
+
id: result.id,
|
|
686
|
+
duplicate: result.duplicate,
|
|
687
|
+
status: result.status,
|
|
688
|
+
// Echoed so a site can see (and assert in an integration test) whether its
|
|
689
|
+
// join page actually posted the ack. Absent consent is otherwise invisible.
|
|
690
|
+
disclaimerAckAt: result.disclaimerAckAt
|
|
691
|
+
});
|
|
678
692
|
}
|
|
679
693
|
return null;
|
|
680
694
|
};
|