@temps-sdk/analytics-core 0.0.6 → 0.1.0-beta.64

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SessionRecorder.d.ts","sourceRoot":"","sources":["../src/SessionRecorder.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAKtD,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC5D;AAyFD;;;;;;;;;GASG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAW;IACzC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAA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AMtB;;;OAGG;IACI,OAAO,IAAI,IAAI;IAMtB;;;;OAIG;IACI,WAAW,IAAI,IAAI;IAK1B;;;;OAIG;IACI,gBAAgB,IAAI,IAAI;IAMxB,YAAY,IAAI,MAAM,GAAG,IAAI;IAIpC,mEAAmE;IAC5D,oBAAoB,IAAI,MAAM;IAIrC,6EAA6E;IACtE,QAAQ,IAAI,OAAO;CAG3B"}
@@ -3,7 +3,7 @@
3
3
  import { record } from "rrweb";
4
4
  import { pack } from "@rrweb/packer";
5
5
  import { SESSION_RECORDER_ENDPOINT, DEFAULT_BASE_PATH, DEFAULT_EXCLUDED_PATHS } from "./constants";
6
- import { getOrCreateVisitorId } from "./identity";
6
+ import { getOrCreateVisitorId, isIdentityResetPending } from "./identity";
7
7
  import { beaconBlob, ingestKeyHeaders, withIngestKey } from "./utils";
8
8
  /** Interaction that counts as the visitor still being present. */
9
9
  const ACTIVITY_EVENTS = [
@@ -117,6 +117,8 @@ export class SessionRecorder {
117
117
  this.paused = false;
118
118
  this.lastActivityAt = Date.now();
119
119
  this.droppedEvents = 0;
120
+ /** Set by `endForReset()` when it stopped a recording. */
121
+ this.resumeAfterResetPending = false;
120
122
  /**
121
123
  * Sampling verdict for this recorder, decided once. Re-rolling per call (the
122
124
  * previous behaviour) let a recorded session flip itself off on any later
@@ -519,10 +521,19 @@ export class SessionRecorder {
519
521
  this.starting = false;
520
522
  }
521
523
  }
522
- /** Forget the server session and any client state pointing at it. */
524
+ /**
525
+ * Forget the server session and any client state pointing at it, including
526
+ * events not delivered yet: they belong to that session, and a later one
527
+ * must never send them under its own id (another visitor's replay after a
528
+ * `reset()`). The final upload `stopRecording` starts has already built its
529
+ * payload with the old id, so it still reaches the old replay.
530
+ */
523
531
  clearSession() {
524
532
  this.sessionInitialized = false;
525
533
  this.sessionId = "";
534
+ this.pending = [];
535
+ this.inflight = null;
536
+ this.sendRetryCount = 0;
526
537
  rememberRecordingSessionId(null);
527
538
  }
528
539
  detachRecorder() {
@@ -644,13 +655,32 @@ export class SessionRecorder {
644
655
  start() {
645
656
  if (this.enabled && this.stopFn)
646
657
  return;
658
+ if (isIdentityResetPending()) {
659
+ // A reset is waiting for the server, so the device may still name the
660
+ // previous visitor: wait for it to confirm, then `resumeAfterReset()`
661
+ // starts this recording under the new one. An explicit `stop()` in the
662
+ // meantime cancels it.
663
+ this.enabled = false;
664
+ this.resumeAfterResetPending = true;
665
+ return;
666
+ }
647
667
  this.enabled = true;
648
668
  if (typeof window === "undefined")
649
669
  return;
650
670
  this.attachGlobalListeners();
651
671
  void this.startRecording();
652
672
  }
673
+ /**
674
+ * Stop recording at the app's request (an opt-out, an unmount, a destroy).
675
+ * This also cancels the new replay a pending `reset()` would start, so a
676
+ * visitor who withdraws consent while the reset waits for the server is
677
+ * not recorded again once it succeeds.
678
+ */
653
679
  stop() {
680
+ this.resumeAfterResetPending = false;
681
+ this.halt();
682
+ }
683
+ halt() {
654
684
  this.enabled = false;
655
685
  this.stopRecording();
656
686
  }
@@ -659,6 +689,36 @@ export class SessionRecorder {
659
689
  this.stopIdleTimer();
660
690
  this.detachGlobalListeners();
661
691
  }
692
+ /**
693
+ * Stop for good and drop every event not uploaded yet, without sending a
694
+ * final batch: the page switched to cookieless mode, which keeps no replay.
695
+ */
696
+ discard() {
697
+ this.pending = [];
698
+ this.inflight = null;
699
+ this.destroy();
700
+ }
701
+ /**
702
+ * `reset()` started (a sign-out): end the current replay, sending what it
703
+ * has to that replay, and remember whether recording was on so
704
+ * `resumeAfterReset()` can start a new one.
705
+ */
706
+ endForReset() {
707
+ if (this.enabled)
708
+ this.resumeAfterResetPending = true;
709
+ this.halt();
710
+ }
711
+ /**
712
+ * The server confirmed the reset: start a new session if `endForReset()`
713
+ * stopped a recording. Until then nothing is recorded, so activity after a
714
+ * sign-out never joins the previous visitor's replay.
715
+ */
716
+ resumeAfterReset() {
717
+ if (!this.resumeAfterResetPending)
718
+ return;
719
+ this.resumeAfterResetPending = false;
720
+ this.start();
721
+ }
662
722
  getSessionId() {
663
723
  return this.sessionId || null;
664
724
  }
@@ -19,13 +19,17 @@ export interface SpeedTrackerOptions {
19
19
  * the ones current at send time. Web Vitals here are page-lifetime metrics of
20
20
  * the hard navigation that loaded the page, so a CLS or INP value reported
21
21
  * after a client-side route change still belongs to the landing page — the
22
- * same attribution CrUX uses.
22
+ * same attribution CrUX uses. The referrer is that page's too, so the
23
+ * project's referrer rules and the spam list exclude its samples exactly
24
+ * when they exclude its page view. It is sent even when empty: a missing
25
+ * field is how the server recognises SDKs that predate it.
23
26
  */
24
27
  export declare class SpeedTracker {
25
28
  private readonly basePath;
26
29
  private readonly ingestKey?;
27
30
  private readonly pathname;
28
31
  private readonly query;
32
+ private readonly referrer;
29
33
  private loadMetrics;
30
34
  private loadSent;
31
35
  /** Load metrics already delivered, so none is ever sent twice. */
@@ -1 +1 @@
1
- {"version":3,"file":"SpeedTracker.d.ts","sourceRoot":"","sources":["../src/SpeedTracker.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,WAAW,CAA+C;IAClE,OAAO,CAAC,QAAQ,CAAS;IACzB,kEAAkE;IAClE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B;IAC7D,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAErC;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;gBAEU,OAAO,EAAE,mBAAmB;IASxC,OAAO,CAAC,KAAK;IAeb,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,SAAS;IAUjB,uEAAuE;IACvE,OAAO,CAAC,SAAS;IAkBjB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,IAAI;IAgBZ;;;OAGG;IACI,OAAO,IAAI,IAAI;CAOvB"}
1
+ {"version":3,"file":"SpeedTracker.d.ts","sourceRoot":"","sources":["../src/SpeedTracker.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,WAAW,CAA+C;IAClE,OAAO,CAAC,QAAQ,CAAS;IACzB,kEAAkE;IAClE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B;IAC7D,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAErC;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;gBAEU,OAAO,EAAE,mBAAmB;IAUxC,OAAO,CAAC,KAAK;IAeb,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,SAAS;IAUjB,uEAAuE;IACvE,OAAO,CAAC,SAAS;IAkBjB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,IAAI;IAiBZ;;;OAGG;IACI,OAAO,IAAI,IAAI;CAOvB"}
@@ -18,12 +18,16 @@ import { sendAnalytics, sendAnalyticsReliable } from "./utils";
18
18
  * the ones current at send time. Web Vitals here are page-lifetime metrics of
19
19
  * the hard navigation that loaded the page, so a CLS or INP value reported
20
20
  * after a client-side route change still belongs to the landing page — the
21
- * same attribution CrUX uses.
21
+ * same attribution CrUX uses. The referrer is that page's too, so the
22
+ * project's referrer rules and the spam list exclude its samples exactly
23
+ * when they exclude its page view. It is sent even when empty: a missing
24
+ * field is how the server recognises SDKs that predate it.
22
25
  */
23
26
  export class SpeedTracker {
24
27
  constructor(options) {
25
28
  this.pathname = "";
26
29
  this.query = "";
30
+ this.referrer = "";
27
31
  this.loadMetrics = {};
28
32
  this.loadSent = false;
29
33
  /** Load metrics already delivered, so none is ever sent twice. */
@@ -42,6 +46,7 @@ export class SpeedTracker {
42
46
  return;
43
47
  this.pathname = window.location.pathname;
44
48
  this.query = window.location.search;
49
+ this.referrer = typeof document !== "undefined" ? document.referrer : "";
45
50
  this.start();
46
51
  }
47
52
  start() {
@@ -115,6 +120,7 @@ export class SpeedTracker {
115
120
  ...metrics,
116
121
  pathname: this.pathname,
117
122
  query: this.query,
123
+ referrer: this.referrer,
118
124
  };
119
125
  // A page that is going away can cancel a plain fetch; a beacon survives.
120
126
  if (typeof document !== "undefined" && document.visibilityState === "hidden") {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The default survey widget: a small card in the bottom-right corner,
3
+ * rendered in a shadow root so the site's CSS cannot reach it and its CSS
4
+ * cannot reach the site. No dependencies; every control is a native form
5
+ * element, so it works with a keyboard and a screen reader.
6
+ */
7
+ import { type Survey, type SurveyAnswers } from "./Surveys";
8
+ export interface SurveyWidgetHandlers {
9
+ /** Return the per-question errors to show, or none when sent. */
10
+ onSubmit: (answers: SurveyAnswers) => Record<string, string> | null;
11
+ onDismiss: () => void;
12
+ /** The card has left the page, however it closed (dismissed, after the
13
+ * thank-you message, or removed by its owner). Called once. */
14
+ onClosed?: () => void;
15
+ }
16
+ /** Render `survey`; returns a function that removes it. */
17
+ export declare function renderSurveyWidget(survey: Survey, handlers: SurveyWidgetHandlers): () => void;
18
+ //# sourceMappingURL=SurveyWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurveyWidget.d.ts","sourceRoot":"","sources":["../src/SurveyWidget.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,OAAO,EAGL,KAAK,MAAM,EAGX,KAAK,aAAa,EAEnB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,oBAAoB;IACnC,iEAAiE;IACjE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACpE,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;mEAC+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AA4BD,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAmE7F"}
@@ -0,0 +1,195 @@
1
+ // SPDX-FileCopyrightText: 2024-2026 Temps Contributors
2
+ // SPDX-License-Identifier: MIT OR Apache-2.0
3
+ /**
4
+ * The default survey widget: a small card in the bottom-right corner,
5
+ * rendered in a shadow root so the site's CSS cannot reach it and its CSS
6
+ * cannot reach the site. No dependencies; every control is a native form
7
+ * element, so it works with a keyboard and a screen reader.
8
+ */
9
+ import { MAX_OPEN_TEXT_LENGTH, surveyScaleBounds, idMap, } from "./Surveys";
10
+ const STYLE = `
11
+ :host { all: initial; }
12
+ .card { position: fixed; right: 16px; bottom: 16px; z-index: 2147483000; width: min(360px, calc(100vw - 32px));
13
+ max-height: calc(100vh - 32px); overflow: auto; box-sizing: border-box; padding: 16px; border-radius: 10px;
14
+ background: #fff; color: #111; border: 1px solid #ddd; box-shadow: 0 8px 30px rgba(0,0,0,.15);
15
+ font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
16
+ @media (prefers-color-scheme: dark) { .card { background: #1c1c1e; color: #f2f2f2; border-color: #3a3a3c; } }
17
+ .head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 8px; }
18
+ h2 { font-size: 15px; margin: 0; }
19
+ fieldset { border: 0; padding: 0; margin: 0 0 12px; }
20
+ legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
21
+ .scale { display: flex; flex-wrap: wrap; gap: 4px; }
22
+ .scale label { flex: 1 0 28px; text-align: center; border: 1px solid #ccc; border-radius: 6px; padding: 4px 0; cursor: pointer; }
23
+ .scale input { position: absolute; opacity: 0; pointer-events: none; }
24
+ .scale label:has(input:checked) { background: #111; color: #fff; border-color: #111; }
25
+ .scale label:has(input:focus-visible) { outline: 2px solid #2563eb; outline-offset: 1px; }
26
+ .labels { display: flex; justify-content: space-between; font-size: 12px; opacity: .7; margin-top: 2px; }
27
+ .choice { display: flex; gap: 6px; align-items: center; margin: 2px 0; }
28
+ textarea { width: 100%; box-sizing: border-box; min-height: 64px; font: inherit; padding: 6px; border-radius: 6px; border: 1px solid #ccc; }
29
+ .error { color: #b91c1c; font-size: 12px; margin-top: 4px; }
30
+ button { font: inherit; cursor: pointer; border-radius: 6px; }
31
+ .close { background: none; border: 0; font-size: 18px; line-height: 1; color: inherit; padding: 0 4px; }
32
+ .send { width: 100%; padding: 8px; background: #111; color: #fff; border: 0; }
33
+ .thanks { margin: 0; }
34
+ `;
35
+ /** Render `survey`; returns a function that removes it. */
36
+ export function renderSurveyWidget(survey, handlers) {
37
+ if (typeof document === "undefined")
38
+ return () => undefined;
39
+ const host = document.createElement("div");
40
+ host.setAttribute("data-temps-survey", String(survey.id));
41
+ const root = host.attachShadow({ mode: "open" });
42
+ const style = document.createElement("style");
43
+ style.textContent = STYLE;
44
+ root.appendChild(style);
45
+ const titleId = `temps-survey-${survey.id}-title`;
46
+ const card = element("form", { class: "card", role: "dialog", "aria-labelledby": titleId });
47
+ card.noValidate = true;
48
+ const head = element("div", { class: "head" });
49
+ const title = element("h2", { id: titleId });
50
+ title.textContent = survey.name;
51
+ const close = element("button", { type: "button", class: "close", "aria-label": "Close survey" });
52
+ close.textContent = "×";
53
+ head.append(title, close);
54
+ card.appendChild(head);
55
+ const errorSlots = new Map();
56
+ for (const question of survey.questions) {
57
+ const { fieldset, error } = renderQuestion(survey.id, question);
58
+ errorSlots.set(question.id, error);
59
+ card.appendChild(fieldset);
60
+ }
61
+ const send = element("button", { type: "submit", class: "send" });
62
+ send.textContent = "Send";
63
+ card.appendChild(send);
64
+ root.appendChild(card);
65
+ document.body.appendChild(host);
66
+ let removed = false;
67
+ // Once answered, closing (button or Escape) only removes the card: the
68
+ // visitor did not dismiss the survey, they finished it.
69
+ let answered = false;
70
+ const remove = () => {
71
+ if (removed)
72
+ return;
73
+ removed = true;
74
+ document.removeEventListener("keydown", onKey);
75
+ host.remove();
76
+ handlers.onClosed?.();
77
+ };
78
+ const dismiss = () => {
79
+ if (!answered)
80
+ handlers.onDismiss();
81
+ remove();
82
+ };
83
+ const onKey = (event) => {
84
+ if (event.key === "Escape")
85
+ dismiss();
86
+ };
87
+ document.addEventListener("keydown", onKey);
88
+ close.addEventListener("click", dismiss);
89
+ card.addEventListener("submit", (event) => {
90
+ event.preventDefault();
91
+ const errors = handlers.onSubmit(collectAnswers(card, survey));
92
+ for (const [id, slot] of errorSlots)
93
+ slot.textContent = errors?.[id] ?? "";
94
+ if (errors)
95
+ return;
96
+ answered = true;
97
+ card.replaceChildren(head);
98
+ const thanks = element("p", { class: "thanks", role: "status" });
99
+ thanks.textContent = "Thanks for your answer.";
100
+ card.appendChild(thanks);
101
+ setTimeout(remove, 2500);
102
+ });
103
+ return remove;
104
+ }
105
+ function renderQuestion(surveyId, question) {
106
+ const name = `q-${surveyId}-${question.id}`;
107
+ const fieldset = element("fieldset", {});
108
+ const legend = element("legend", {});
109
+ legend.textContent = question.optional ? `${question.prompt} (optional)` : question.prompt;
110
+ fieldset.appendChild(legend);
111
+ switch (question.kind) {
112
+ case "open_text": {
113
+ const textarea = element("textarea", { name, maxlength: String(MAX_OPEN_TEXT_LENGTH), "aria-label": question.prompt });
114
+ fieldset.appendChild(textarea);
115
+ break;
116
+ }
117
+ case "rating":
118
+ case "nps": {
119
+ const [min, max] = surveyScaleBounds(question);
120
+ const scale = element("div", { class: "scale" });
121
+ for (let value = min; value <= max; value += 1) {
122
+ const label = element("label", {});
123
+ const input = element("input", { type: "radio", name, value: String(value) });
124
+ label.append(input, document.createTextNode(String(value)));
125
+ scale.appendChild(label);
126
+ }
127
+ fieldset.appendChild(scale);
128
+ if (question.lower_label || question.upper_label) {
129
+ const labels = element("div", { class: "labels" });
130
+ const low = element("span", {});
131
+ low.textContent = question.lower_label ?? "";
132
+ const high = element("span", {});
133
+ high.textContent = question.upper_label ?? "";
134
+ labels.append(low, high);
135
+ fieldset.appendChild(labels);
136
+ }
137
+ break;
138
+ }
139
+ case "single_choice":
140
+ case "multiple_choice": {
141
+ const type = question.kind === "single_choice" ? "radio" : "checkbox";
142
+ for (const choice of question.choices ?? []) {
143
+ const label = element("label", { class: "choice" });
144
+ const input = element("input", { type, name, value: choice });
145
+ label.append(input, document.createTextNode(choice));
146
+ fieldset.appendChild(label);
147
+ }
148
+ break;
149
+ }
150
+ }
151
+ const error = element("div", { class: "error", role: "alert" });
152
+ fieldset.appendChild(error);
153
+ return { fieldset, error };
154
+ }
155
+ function collectAnswers(form, survey) {
156
+ const answers = idMap();
157
+ for (const question of survey.questions) {
158
+ const name = `q-${survey.id}-${question.id}`;
159
+ const fields = Array.from(form.querySelectorAll(`[name="${cssEscape(name)}"]`));
160
+ switch (question.kind) {
161
+ case "open_text":
162
+ answers[question.id] = fields[0]?.value ?? "";
163
+ break;
164
+ case "rating":
165
+ case "nps": {
166
+ const picked = fields.find((field) => field.checked);
167
+ if (picked)
168
+ answers[question.id] = Number(picked.value);
169
+ break;
170
+ }
171
+ case "single_choice": {
172
+ const picked = fields.find((field) => field.checked);
173
+ if (picked)
174
+ answers[question.id] = picked.value;
175
+ break;
176
+ }
177
+ case "multiple_choice":
178
+ answers[question.id] = fields
179
+ .filter((field) => field.checked)
180
+ .map((field) => field.value);
181
+ break;
182
+ }
183
+ }
184
+ return answers;
185
+ }
186
+ /** Question ids are `[a-z0-9_]`, so names need no escaping beyond quotes. */
187
+ function cssEscape(value) {
188
+ return value.replace(/["\\]/g, "\\$&");
189
+ }
190
+ function element(tag, attributes) {
191
+ const node = document.createElement(tag);
192
+ for (const [name, value] of Object.entries(attributes))
193
+ node.setAttribute(name, value);
194
+ return node;
195
+ }
@@ -0,0 +1,138 @@
1
+ import type { JsonValue } from "./types";
2
+ export type SurveyQuestionKind = "open_text" | "rating" | "nps" | "single_choice" | "multiple_choice";
3
+ export interface SurveyQuestion {
4
+ id: string;
5
+ kind: SurveyQuestionKind;
6
+ prompt: string;
7
+ optional?: boolean;
8
+ choices?: string[];
9
+ /** Top of a `rating` scale (3, 5, 7 or 10). Defaults to 5. */
10
+ scale?: number;
11
+ lower_label?: string;
12
+ upper_label?: string;
13
+ }
14
+ export interface SurveyDisplay {
15
+ path_pattern?: string;
16
+ trigger_event?: string;
17
+ once_per_visitor: boolean;
18
+ }
19
+ export interface Survey {
20
+ id: number;
21
+ name: string;
22
+ questions: SurveyQuestion[];
23
+ display: SurveyDisplay;
24
+ }
25
+ /** Open text or a single choice: a string. Rating and NPS: a number.
26
+ * Multiple choice: the selected choices. */
27
+ export type SurveyAnswer = string | number | string[];
28
+ export type SurveyAnswers = Record<string, SurveyAnswer>;
29
+ export type SurveysStatus = "idle" | "loading" | "ready" | "error";
30
+ /** Longest open-text answer sent; the server cuts anything longer. */
31
+ export declare const MAX_OPEN_TEXT_LENGTH = 2000;
32
+ /**
33
+ * Largest `survey_sent` event data, UTF-8 encoded. The event endpoint
34
+ * refuses bodies above 64 KiB; the rest of the body (event name, page path
35
+ * and query, domain, language) gets the remaining 16 KiB.
36
+ */
37
+ export declare const MAX_SURVEY_EVENT_BYTES: number;
38
+ export interface SurveysOptions {
39
+ /** Same-origin API prefix. Defaults to `/api/_temps`. */
40
+ basePath?: string;
41
+ /** Subject for sampling and flag conditions; defaults to the visitor cookie. */
42
+ key?: string;
43
+ /** Attributes for flag conditions. */
44
+ attributes?: Record<string, string | number | boolean>;
45
+ /** Records a survey event. `createAnalytics` passes `trackEvent`. */
46
+ onEvent: (name: string, data: Record<string, JsonValue>) => void;
47
+ onError?: (error: Error) => void;
48
+ /** Never fetch or show anything. */
49
+ disabled?: boolean;
50
+ /** Test seams. */
51
+ fetch?: typeof fetch;
52
+ storage?: Pick<Storage, "getItem" | "setItem"> | null;
53
+ now?: () => number;
54
+ /** How long the surveys request may take, body included. Defaults to 10 s;
55
+ * past it the request fails and is retried later like any other. */
56
+ timeoutMs?: number;
57
+ }
58
+ export declare class Surveys {
59
+ private readonly basePath;
60
+ private readonly onEvent;
61
+ private readonly onError;
62
+ private readonly fetchImpl?;
63
+ private readonly storage;
64
+ private readonly disabled;
65
+ private readonly now;
66
+ private readonly timeoutMs;
67
+ private context;
68
+ /** Bumped by `setContext`, so a request for the old context is ignored. */
69
+ private generation;
70
+ private failures;
71
+ private retryAt;
72
+ private surveys;
73
+ private inflight;
74
+ private currentStatus;
75
+ private listeners;
76
+ private revision;
77
+ /** Shown during this page's lifetime, whatever `once_per_visitor` says,
78
+ * so one page never shows a survey twice. */
79
+ private shownHere;
80
+ constructor(options: SurveysOptions);
81
+ get status(): SurveysStatus;
82
+ /** Changes whenever the fetched surveys change. */
83
+ get version(): number;
84
+ /** Every survey this visitor may see on some page. */
85
+ all(): Survey[];
86
+ /**
87
+ * Fetch once; later calls return the same promise. After a failure, a
88
+ * later call tries again, waiting 15 seconds after the first failure and
89
+ * twice as long after each further one, up to 5 minutes.
90
+ */
91
+ load(): Promise<void>;
92
+ /**
93
+ * Replace the subject and attributes, e.g. once a user signs in. Surveys
94
+ * fetched for the previous context are dropped and the next `load()`
95
+ * fetches again. Surveys already shown on this page stay shown.
96
+ */
97
+ setContext(key: string | undefined, attributes: SurveysOptions["attributes"]): void;
98
+ /**
99
+ * Surveys to show now on `pathname`. With `event`, only surveys triggered
100
+ * by that event; without it, only surveys shown on page load.
101
+ */
102
+ eligible(pathname: string, event?: string): Survey[];
103
+ /** Record that the survey was displayed. */
104
+ markShown(survey: Survey): void;
105
+ /** Record that the visitor closed the survey without answering. */
106
+ dismiss(survey: Survey): void;
107
+ /**
108
+ * Validate and record the visitor's answers. Returns the problems instead
109
+ * of sending when an answer is missing or malformed.
110
+ */
111
+ submit(survey: Survey, answers: SurveyAnswers): {
112
+ ok: true;
113
+ } | {
114
+ ok: false;
115
+ errors: Record<string, string>;
116
+ };
117
+ subscribe(listener: () => void): () => void;
118
+ private emit;
119
+ private seen;
120
+ private remember;
121
+ private notify;
122
+ }
123
+ /** A map keyed by question id, with no prototype. */
124
+ export declare function idMap<T>(): Record<string, T>;
125
+ /** Whether `pathname` matches `pattern`, where `*` matches any run of
126
+ * characters and the whole path must match. */
127
+ export declare function pathMatches(pattern: string, pathname: string): boolean;
128
+ declare function scaleBounds(question: SurveyQuestion): [number, number];
129
+ /** Check answers against the survey; keep only answers to its questions. */
130
+ export declare function validateAnswers(survey: Survey, answers: SurveyAnswers): {
131
+ ok: true;
132
+ responses: Record<string, JsonValue>;
133
+ } | {
134
+ ok: false;
135
+ errors: Record<string, string>;
136
+ };
137
+ export { scaleBounds as surveyScaleBounds };
138
+ //# sourceMappingURL=Surveys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Surveys.d.ts","sourceRoot":"","sources":["../src/Surveys.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,QAAQ,GACR,KAAK,GACL,eAAe,GACf,iBAAiB,CAAC;AAEtB,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,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