@odla-ai/chapter 0.10.0 → 0.10.1
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 +12 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/worker/index.cjs +19 -2
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.js +19 -2
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
package/dist/worker/index.cjs
CHANGED
|
@@ -184,6 +184,17 @@ async function createClerkUser(secretKey, input, fetchImpl = fetch) {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// src/member.ts
|
|
187
|
+
var IDENTITY_FIELDS = /* @__PURE__ */ new Set(["email", "firstName", "lastName"]);
|
|
188
|
+
function applicantProfile(chapter, fields) {
|
|
189
|
+
const profile = {};
|
|
190
|
+
for (const f of [...chapter.application.required, ...chapter.application.optional]) {
|
|
191
|
+
if (IDENTITY_FIELDS.has(f)) continue;
|
|
192
|
+
const v = fields[f];
|
|
193
|
+
if (typeof v === "string" && v.trim() !== "") profile[f] = v.trim();
|
|
194
|
+
}
|
|
195
|
+
if (fields.focus !== void 0) profile.focus = fields.focus;
|
|
196
|
+
return Object.keys(profile).length > 0 ? profile : void 0;
|
|
197
|
+
}
|
|
187
198
|
async function submitApplication(db, chapter, fields, opts) {
|
|
188
199
|
const app = chapter.application;
|
|
189
200
|
for (const f of app.required) {
|
|
@@ -202,6 +213,7 @@ async function submitApplication(db, chapter, fields, opts) {
|
|
|
202
213
|
}
|
|
203
214
|
if (fields.focus !== void 0) row.focus = fields.focus;
|
|
204
215
|
if (opts.groupId) row.groupId = opts.groupId;
|
|
216
|
+
if (fields.disclaimerAck === true || fields.disclaimerAck === "true") row.disclaimerAckAt = opts.now;
|
|
205
217
|
const { duplicate } = await db.transact(
|
|
206
218
|
[{ t: "update", ns: "applications", id, attrs: row }],
|
|
207
219
|
opts.submissionId ? { mutationId: `join:${opts.submissionId}` } : void 0
|
|
@@ -515,8 +527,13 @@ async function provisionApplicant(db, chapter, applicationId, fields) {
|
|
|
515
527
|
try {
|
|
516
528
|
const secret = await getVaultSecret(db, "clerk_secret_key");
|
|
517
529
|
if (secret) {
|
|
518
|
-
|
|
519
|
-
|
|
530
|
+
const profile = applicantProfile(chapter, fields);
|
|
531
|
+
const publicMetadata = { applicationId, ...profile ? { profile } : {} };
|
|
532
|
+
if (chapter.account === "create") {
|
|
533
|
+
await createClerkUser(secret, { email, firstName: s(fields.firstName), lastName: s(fields.lastName), publicMetadata });
|
|
534
|
+
} else {
|
|
535
|
+
await createClerkInvitation(secret, { email, publicMetadata });
|
|
536
|
+
}
|
|
520
537
|
}
|
|
521
538
|
} catch {
|
|
522
539
|
}
|