@vue-skuilder/standalone-ui 0.2.12 → 0.2.14

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.
@@ -29587,7 +29587,13 @@ ${t.stack}` : JSON.stringify(t);
29587
29587
  ...t.doc,
29588
29588
  _rev: void 0
29589
29589
  }));
29590
- return g.length > 0 ? (await d.bulkDocs(g), logger.info(`Successfully migrated ${g.length} documents from ${t} to ${c}`)) : logger.info("No documents to migrate from funnel account"), { success: !0 };
29590
+ g.length > 0 ? (await d.bulkDocs(g), logger.info(`Successfully migrated ${g.length} documents from ${t} to ${c}`)) : logger.info("No documents to migrate from funnel account");
29591
+ try {
29592
+ await u.destroy(), logger.info(`Destroyed consumed guest DB for ${t}`);
29593
+ } catch (c) {
29594
+ logger.warn(`Failed to destroy consumed guest DB for ${t} (non-fatal): ${c instanceof Error ? c.message : String(c)}`);
29595
+ }
29596
+ return { success: !0 };
29591
29597
  } catch (t) {
29592
29598
  return logger.error("Migration failed:", t), {
29593
29599
  success: !1,
@@ -29692,6 +29698,11 @@ Currently logged-in as ${this._username}.`);
29692
29698
  async logout() {
29693
29699
  if (!this.syncStrategy.canAuthenticate()) return this._username = await this.syncStrategy.getCurrentUsername(), await this.init(), { ok: !0 };
29694
29700
  let t = await this.syncStrategy.logout();
29701
+ try {
29702
+ localStorage.removeItem("sk-guest-uuid");
29703
+ } catch (t) {
29704
+ logger.warn("localStorage not available (Node.js environment):", t);
29705
+ }
29695
29706
  return this._username = await this.syncStrategy.getCurrentUsername(), await this.init(), t;
29696
29707
  }
29697
29708
  async get(t) {
@@ -31072,47 +31083,60 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31072
31083
  }
31073
31084
  async updateUserAndCardElo(t, c, u, d, m, g) {
31074
31085
  g && logger.warn("k value interpretation not currently implemented");
31075
- let b = this.dataLayer.getCourseDB(m.card.course_id), S = toCourseElo(d.courses.find((t) => t.courseID === c).elo), C = (await b.getCardEloData([m.card.card_id]))[0];
31076
- if (C && S) {
31077
- let m = adjustCourseScores(S, C, t);
31078
- d.courses.find((t) => t.courseID === c).elo = m.userElo;
31079
- let g = await Promise.allSettled([this.user.updateUserElo(c, m.userElo), b.updateCardElo(u, m.cardElo)]), w = g[0].status === "fulfilled", T = g[1].status === "fulfilled";
31080
- if (w && T) {
31081
- let t = g[0].value, c = g[1].value;
31086
+ let b = this.dataLayer.getCourseDB(m.card.course_id), S = d.courses.find((t) => t.courseID === c);
31087
+ if (!S) {
31088
+ logger.error(`[EloService] No registration for course ${c} on user's registration doc \u2014 skipping ELO update for card ${u}. (Is the user registered for this course?)`);
31089
+ return;
31090
+ }
31091
+ let C = toCourseElo(S.elo), w = (await b.getCardEloData([m.card.card_id]))[0];
31092
+ if (w && C) {
31093
+ let d = adjustCourseScores(C, w, t);
31094
+ S.elo = d.userElo;
31095
+ let m = await Promise.allSettled([this.user.updateUserElo(c, d.userElo), b.updateCardElo(u, d.cardElo)]), g = m[0].status === "fulfilled", T = m[1].status === "fulfilled";
31096
+ if (g && T) {
31097
+ let t = m[0].value, c = m[1].value;
31082
31098
  t.ok && c && c.ok && logger.info(`[EloService] Updated ELOS:
31083
- User: ${JSON.stringify(m.userElo)})
31084
- Card: ${JSON.stringify(m.cardElo)})
31099
+ User: ${JSON.stringify(d.userElo)})
31100
+ Card: ${JSON.stringify(d.cardElo)})
31085
31101
  `);
31086
31102
  } else logger.warn(`[EloService] Partial ELO update:
31087
- User ELO update: ${w ? "SUCCESS" : "FAILED"}
31088
- Card ELO update: ${T ? "SUCCESS" : "FAILED"}`), !w && g[0].status === "rejected" && logger.error("[EloService] User ELO update error:", g[0].reason), !T && g[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", g[1].reason);
31103
+ User ELO update: ${g ? "SUCCESS" : "FAILED"}
31104
+ Card ELO update: ${T ? "SUCCESS" : "FAILED"}`), !g && m[0].status === "rejected" && logger.error("[EloService] User ELO update error:", m[0].reason), !T && m[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", m[1].reason);
31089
31105
  }
31090
31106
  }
31091
31107
  async updateUserAndCardEloPerTag(t, c, u, d, m) {
31092
- let g = this.dataLayer.getCourseDB(m.card.course_id), b = toCourseElo(d.courses.find((t) => t.courseID === c).elo), [S, C] = await Promise.all([g.getCardEloData([m.card.card_id]), g.getAppliedTagsBatch([u])]), w = S[0], T = C.get(u) ?? [], E = { ...t }, D = t._global;
31093
- for (let t of T) t in E || (E[t] = D);
31094
- if (w && b) {
31095
- let t = adjustCourseScoresPerTag(b, w, E);
31096
- d.courses.find((t) => t.courseID === c).elo = t.userElo;
31097
- let m = await Promise.allSettled([this.user.updateUserElo(c, t.userElo), g.updateCardElo(u, t.cardElo)]), S = m[0].status === "fulfilled", C = m[1].status === "fulfilled";
31098
- if (S && C) {
31099
- let c = m[0].value, u = m[1].value;
31108
+ let g = this.dataLayer.getCourseDB(m.card.course_id), b = d.courses.find((t) => t.courseID === c);
31109
+ if (!b) {
31110
+ logger.error(`[EloService] No registration for course ${c} on user's registration doc \u2014 skipping per-tag ELO update for card ${u}. (Is the user registered for this course?)`);
31111
+ return;
31112
+ }
31113
+ let S = toCourseElo(b.elo), [C, w] = await Promise.all([g.getCardEloData([m.card.card_id]), g.getAppliedTagsBatch([u])]), T = C[0], E = w.get(u) ?? [], D = { ...t }, O = t._global;
31114
+ for (let t of E) t in D || (D[t] = O);
31115
+ if (T && S) {
31116
+ let t = adjustCourseScoresPerTag(S, T, D);
31117
+ b.elo = t.userElo;
31118
+ let d = await Promise.allSettled([this.user.updateUserElo(c, t.userElo), g.updateCardElo(u, t.cardElo)]), m = d[0].status === "fulfilled", C = d[1].status === "fulfilled";
31119
+ if (m && C) {
31120
+ let c = d[0].value, u = d[1].value;
31100
31121
  if (c.ok && u && u.ok) {
31101
- let c = Object.keys(E).length - 1;
31122
+ let c = Object.keys(D).length - 1;
31102
31123
  logger.info(`[EloService] Updated ELOS (per-tag, ${c} tags):
31103
31124
  User: ${JSON.stringify(t.userElo)})
31104
31125
  Card: ${JSON.stringify(t.cardElo)})
31105
31126
  `);
31106
31127
  }
31107
31128
  } else logger.warn(`[EloService] Partial ELO update (per-tag):
31108
- User ELO update: ${S ? "SUCCESS" : "FAILED"}
31109
- Card ELO update: ${C ? "SUCCESS" : "FAILED"}`), !S && m[0].status === "rejected" && logger.error("[EloService] User ELO update error:", m[0].reason), !C && m[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", m[1].reason);
31129
+ User ELO update: ${m ? "SUCCESS" : "FAILED"}
31130
+ Card ELO update: ${C ? "SUCCESS" : "FAILED"}`), !m && d[0].status === "rejected" && logger.error("[EloService] User ELO update error:", d[0].reason), !C && d[1].status === "rejected" && logger.error("[EloService] Card ELO update error:", d[1].reason);
31110
31131
  }
31111
31132
  }
31112
31133
  }, init_core(), init_logger(), ResponseProcessor = class {
31113
31134
  constructor(t, c) {
31114
31135
  _defineProperty$2(this, "srsService", void 0), _defineProperty$2(this, "eloService", void 0), this.srsService = t, this.eloService = c;
31115
31136
  }
31137
+ logEloFailure(t, c) {
31138
+ return (u) => logger.error(`[ResponseProcessor] ELO update failed (${t}) for ${c}:`, u);
31139
+ }
31116
31140
  parsePerformance(t) {
31117
31141
  return typeof t == "number" ? {
31118
31142
  globalScore: t,
@@ -31152,13 +31176,13 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31152
31176
  let { globalScore: S, taggedPerformance: C } = this.parsePerformance(t.performance);
31153
31177
  if (C) {
31154
31178
  let u = Object.keys(C).filter((t) => t !== "_global"), S = u.filter((t) => C[t] === null), w = u.filter((t) => C[t] !== null);
31155
- logger.info(`[FirstContactElo] correct first-attempt per-tag ELO update for ${b} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}): scored=[${w.join(", ")}] count-only=[${S.join(", ")}]`), this.eloService.updateUserAndCardEloPerTag(C, g, b, d, m);
31179
+ logger.info(`[FirstContactElo] correct first-attempt per-tag ELO update for ${b} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}): scored=[${w.join(", ")}] count-only=[${S.join(", ")}]`), this.eloService.updateUserAndCardEloPerTag(C, g, b, d, m).catch(this.logEloFailure("correct per-tag", b));
31156
31180
  } else {
31157
31181
  let u = .5 + S / 2;
31158
- if (c.records.length === 1) this.eloService.updateUserAndCardElo(u, g, b, d, m);
31182
+ if (c.records.length === 1) this.eloService.updateUserAndCardElo(u, g, b, d, m).catch(this.logEloFailure("correct", b));
31159
31183
  else {
31160
31184
  let t = Math.ceil(32 / c.records.length);
31161
- this.eloService.updateUserAndCardElo(u, g, b, d, m, t);
31185
+ this.eloService.updateUserAndCardElo(u, g, b, d, m, t).catch(this.logEloFailure("correct repeat-view", b));
31162
31186
  }
31163
31187
  logger.info(`[FirstContactElo] correct first-attempt ELO update (score=${u.toFixed(3)}) for ${b} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`);
31164
31188
  }
@@ -31183,7 +31207,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31183
31207
  }
31184
31208
  processIncorrectResponse(t, c, u, d, m, g, b, S, C) {
31185
31209
  let { taggedPerformance: w } = this.parsePerformance(t.performance), T = !1;
31186
- return t.priorAttemps === 0 ? (w ? (this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d), logger.info(`[FirstContactElo] incorrect first-attempt per-tag ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}, tags=${Object.keys(w).length - 1})`)) : (this.eloService.updateUserAndCardElo(0, m, g, u, d), logger.info(`[FirstContactElo] incorrect first-attempt ELO update (score=0) for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`)), T = !0) : logger.info(`[FirstContactElo] incorrect retry \u2014 no ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`), d.records.length >= b ? C >= S ? (T ? logger.info(`[FirstContactElo] dismiss-failed \u2014 ELO already updated this response, skipping double penalty for ${g}`) : (w ? this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d) : this.eloService.updateUserAndCardElo(0, m, g, u, d), logger.info(`[FirstContactElo] dismiss-failed final ELO penalty for ${g} (historyLen=${c.records.length}, sessionViews=${C})`)), {
31210
+ return t.priorAttemps === 0 ? (w ? (this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d).catch(this.logEloFailure("incorrect per-tag", g)), logger.info(`[FirstContactElo] incorrect first-attempt per-tag ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps}, tags=${Object.keys(w).length - 1})`)) : (this.eloService.updateUserAndCardElo(0, m, g, u, d).catch(this.logEloFailure("incorrect", g)), logger.info(`[FirstContactElo] incorrect first-attempt ELO update (score=0) for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`)), T = !0) : logger.info(`[FirstContactElo] incorrect retry \u2014 no ELO update for ${g} (historyLen=${c.records.length}, priorAttemps=${t.priorAttemps})`), d.records.length >= b ? C >= S ? (T ? logger.info(`[FirstContactElo] dismiss-failed \u2014 ELO already updated this response, skipping double penalty for ${g}`) : (w ? this.eloService.updateUserAndCardEloPerTag(w, m, g, u, d).catch(this.logEloFailure("dismiss-failed per-tag", g)) : this.eloService.updateUserAndCardElo(0, m, g, u, d).catch(this.logEloFailure("dismiss-failed", g)), logger.info(`[FirstContactElo] dismiss-failed final ELO penalty for ${g} (historyLen=${c.records.length}, sessionViews=${C})`)), {
31187
31211
  nextCardAction: "dismiss-failed",
31188
31212
  shouldLoadNextCard: !0,
31189
31213
  isCorrect: !1,
@@ -43486,11 +43510,14 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
43486
43510
  }), Wt = {
43487
43511
  key: 0,
43488
43512
  class: "StudySession"
43489
- }, Gt = { key: 2 }, Kt = { key: 3 }, qt = { class: "text-h4" }, Jt = { key: 0 }, Yt = {
43513
+ }, Gt = { key: 2 }, Kt = {
43514
+ key: 3,
43515
+ class: "session-finished-area"
43516
+ }, qt = { class: "text-h4" }, Jt = { key: 0 }, Yt = {
43490
43517
  key: 4,
43491
43518
  ref: "shadowWrapper",
43492
43519
  class: "card-transition-container"
43493
- }, Xt = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), Zt = /* @__PURE__ */ F$3(Ut, [["render", _sfc_render$15], ["__scopeId", "data-v-0279250f"]]), Qt = /* @__PURE__ */ defineComponent({
43520
+ }, Xt = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), Zt = /* @__PURE__ */ F$3(Ut, [["render", _sfc_render$15], ["__scopeId", "data-v-1f4b2d6a"]]), Qt = /* @__PURE__ */ defineComponent({
43494
43521
  name: "MultipleChoiceOption",
43495
43522
  components: { MarkdownRenderer: /* @__PURE__ */ defineAsyncComponent(() => Promise.resolve().then(() => (init_MarkdownRenderer_kStoDRNE(), MarkdownRenderer_kStoDRNE_exports)).then((t) => t.n)) },
43496
43523
  props: {