@microsurveysai/react-native 0.1.6 → 0.1.7

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/dist/index.d.cts CHANGED
@@ -203,12 +203,20 @@ interface CreateClientOptions {
203
203
  * server events mailbox timers. */
204
204
  subscribeBackground?: (onBackground: () => void) => () => void;
205
205
  }
206
- /** An auto-triggered survey the host should present. Call `close` exactly once
207
- * when the UI dismisses (completed, partial, or dismissed). */
206
+ /** A survey the host should present. Call `shown` once it is on screen (this
207
+ * sends the impression), then `close` once when the UI goes away (completed,
208
+ * partial, or dismissed). Both are safe to call more than once. */
208
209
  interface ActiveSurvey {
209
210
  survey: Survey;
211
+ /** The trigger that fired; null for an inline survey. */
210
212
  trigger: Trigger | null;
211
- close(result: SurveyResult): void;
213
+ /** The survey is on screen: queues its impression (`dismissed: false`). */
214
+ shown(): void;
215
+ /** The survey went away. A dismissal re-sends the impression with
216
+ * `dismissed: true`; answers are sent as a response. Without a result (the
217
+ * survey never got to show), nothing more is sent. If `shown` was never
218
+ * called, the impression is sent now, with the final `dismissed`. */
219
+ close(result?: SurveyResult | null): void;
212
220
  }
213
221
  type PresentListener = (active: ActiveSurvey) => void;
214
222
  type ConfigListener = () => void;
@@ -288,8 +296,16 @@ declare class MicroSurveysClient {
288
296
  * survey is already active, the new subscriber is notified immediately. */
289
297
  onPresent(cb: PresentListener): () => void;
290
298
  private handlePresent;
299
+ private newPresentation;
291
300
  private toActiveSurvey;
292
- /** Records the outcome of an **inline** `<MicroSurvey>` (no trigger/gate). */
301
+ /** Queues the impression the moment the survey is on screen, so it counts even
302
+ * if the app is killed before the survey closes. */
303
+ private markShown;
304
+ /** An **inline** `<MicroSurvey>` (no trigger, no gate, not "the" active survey).
305
+ * Call `shown` when it renders and `close` with its outcome. */
306
+ presentInline(survey: Survey): ActiveSurvey;
307
+ /** Records the outcome of an inline survey in one go, at close. Prefer
308
+ * `presentInline`, which sends the impression when the survey appears. */
293
309
  recordInline(survey: Survey, result: SurveyResult, shownAt: Date): void;
294
310
  private recordOutcome;
295
311
  /** Where this showing happened. The language is read at record time: the user
@@ -337,8 +353,9 @@ interface MicroSurveysOptions {
337
353
  apiKey: string;
338
354
  /** Override for self-hosted deployments. Defaults to https://console.microsurveys.ai. */
339
355
  apiBaseURL?: string;
340
- /** Refresh config (when stale) and retry queued ingest whenever the app returns
341
- * to the foreground. Default true. */
356
+ /** Refresh config (when stale) whenever the app returns to the foreground.
357
+ * Default true. (Queued impressions/responses are retried on every foreground
358
+ * either way.) */
342
359
  refreshOnForeground?: boolean;
343
360
  /** Foreground freshness window for the cached config, in ms. Default 12h. */
344
361
  configTTLms?: number;
@@ -386,7 +403,11 @@ declare class MicroSurveys {
386
403
  onConfigChange(cb: () => void): () => void;
387
404
  /** Subscribe to auto-triggered surveys. Returns an unsubscribe function. */
388
405
  onPresent(cb: (active: ActiveSurvey) => void): () => void;
389
- /** Records the outcome of an inline `<MicroSurvey>`. */
406
+ /** Starts one showing of an inline `<MicroSurvey>`: call `shown` once it
407
+ * renders (sends the impression) and `close` with its outcome. */
408
+ presentInline(survey: Survey): ActiveSurvey;
409
+ /** Records the outcome of an inline survey in one go, at close. Prefer
410
+ * `presentInline`, which sends the impression when the survey appears. */
390
411
  recordInline(survey: Survey, result: SurveyResult, shownAt: Date): void;
391
412
  }
392
413
 
package/dist/index.d.ts CHANGED
@@ -203,12 +203,20 @@ interface CreateClientOptions {
203
203
  * server events mailbox timers. */
204
204
  subscribeBackground?: (onBackground: () => void) => () => void;
205
205
  }
206
- /** An auto-triggered survey the host should present. Call `close` exactly once
207
- * when the UI dismisses (completed, partial, or dismissed). */
206
+ /** A survey the host should present. Call `shown` once it is on screen (this
207
+ * sends the impression), then `close` once when the UI goes away (completed,
208
+ * partial, or dismissed). Both are safe to call more than once. */
208
209
  interface ActiveSurvey {
209
210
  survey: Survey;
211
+ /** The trigger that fired; null for an inline survey. */
210
212
  trigger: Trigger | null;
211
- close(result: SurveyResult): void;
213
+ /** The survey is on screen: queues its impression (`dismissed: false`). */
214
+ shown(): void;
215
+ /** The survey went away. A dismissal re-sends the impression with
216
+ * `dismissed: true`; answers are sent as a response. Without a result (the
217
+ * survey never got to show), nothing more is sent. If `shown` was never
218
+ * called, the impression is sent now, with the final `dismissed`. */
219
+ close(result?: SurveyResult | null): void;
212
220
  }
213
221
  type PresentListener = (active: ActiveSurvey) => void;
214
222
  type ConfigListener = () => void;
@@ -288,8 +296,16 @@ declare class MicroSurveysClient {
288
296
  * survey is already active, the new subscriber is notified immediately. */
289
297
  onPresent(cb: PresentListener): () => void;
290
298
  private handlePresent;
299
+ private newPresentation;
291
300
  private toActiveSurvey;
292
- /** Records the outcome of an **inline** `<MicroSurvey>` (no trigger/gate). */
301
+ /** Queues the impression the moment the survey is on screen, so it counts even
302
+ * if the app is killed before the survey closes. */
303
+ private markShown;
304
+ /** An **inline** `<MicroSurvey>` (no trigger, no gate, not "the" active survey).
305
+ * Call `shown` when it renders and `close` with its outcome. */
306
+ presentInline(survey: Survey): ActiveSurvey;
307
+ /** Records the outcome of an inline survey in one go, at close. Prefer
308
+ * `presentInline`, which sends the impression when the survey appears. */
293
309
  recordInline(survey: Survey, result: SurveyResult, shownAt: Date): void;
294
310
  private recordOutcome;
295
311
  /** Where this showing happened. The language is read at record time: the user
@@ -337,8 +353,9 @@ interface MicroSurveysOptions {
337
353
  apiKey: string;
338
354
  /** Override for self-hosted deployments. Defaults to https://console.microsurveys.ai. */
339
355
  apiBaseURL?: string;
340
- /** Refresh config (when stale) and retry queued ingest whenever the app returns
341
- * to the foreground. Default true. */
356
+ /** Refresh config (when stale) whenever the app returns to the foreground.
357
+ * Default true. (Queued impressions/responses are retried on every foreground
358
+ * either way.) */
342
359
  refreshOnForeground?: boolean;
343
360
  /** Foreground freshness window for the cached config, in ms. Default 12h. */
344
361
  configTTLms?: number;
@@ -386,7 +403,11 @@ declare class MicroSurveys {
386
403
  onConfigChange(cb: () => void): () => void;
387
404
  /** Subscribe to auto-triggered surveys. Returns an unsubscribe function. */
388
405
  onPresent(cb: (active: ActiveSurvey) => void): () => void;
389
- /** Records the outcome of an inline `<MicroSurvey>`. */
406
+ /** Starts one showing of an inline `<MicroSurvey>`: call `shown` once it
407
+ * renders (sends the impression) and `close` with its outcome. */
408
+ presentInline(survey: Survey): ActiveSurvey;
409
+ /** Records the outcome of an inline survey in one go, at close. Prefer
410
+ * `presentInline`, which sends the impression when the survey appears. */
390
411
  recordInline(survey: Survey, result: SurveyResult, shownAt: Date): void;
391
412
  }
392
413
 
package/dist/index.js CHANGED
@@ -209,12 +209,24 @@ function parseConfig(rawText) {
209
209
  // src/core/apiClient.ts
210
210
  var API_VERSION = "2026-06-30";
211
211
  var PENDING_PAGE_SIZE = 50;
212
+ var RETRY_BASE_MS = 2e3;
213
+ var RETRY_MAX_MS = 3e4;
214
+ var INGEST_TIMEOUT_MS = 15e3;
212
215
  var ApiClient = class {
213
216
  constructor(apiKey, baseURL, storage) {
214
217
  __publicField(this, "apiKey");
215
218
  __publicField(this, "baseURL");
216
219
  __publicField(this, "outbox");
217
220
  __publicField(this, "isFlushing", false);
221
+ /** The flush in progress, returned to callers that ask for another meanwhile. */
222
+ __publicField(this, "flushPromise", Promise.resolve());
223
+ /** Set when flush() is called during a flush: run another pass before finishing. */
224
+ __publicField(this, "flushAgain", false);
225
+ __publicField(this, "retryTimer", null);
226
+ /** Failed flushes in a row, for the retry backoff. */
227
+ __publicField(this, "failures", 0);
228
+ /** After `cancelRetry()`: no new retry timers until the next `resumeRetry()`. */
229
+ __publicField(this, "retryStopped", false);
218
230
  this.apiKey = apiKey;
219
231
  this.outbox = new Outbox(storage);
220
232
  this.baseURL = baseURL.replace(/\/+$/, "");
@@ -266,9 +278,11 @@ var ApiClient = class {
266
278
  }
267
279
  // ── Impressions / responses ─────────────────────────────────────────────────
268
280
  /** Queues the impression and returns its `clientId`, so the response from the
269
- * same showing can point back to it. */
281
+ * same showing can point back to it. Pass the `clientId` to send the same
282
+ * impression again (e.g. with `dismissed: true` once the user dismissed it):
283
+ * the server updates the one it has. */
270
284
  recordImpression(input) {
271
- const clientId = uuid();
285
+ const clientId = input.clientId ?? uuid();
272
286
  const payload = {
273
287
  clientId,
274
288
  surveyId: input.surveyId,
@@ -314,46 +328,94 @@ var ApiClient = class {
314
328
  }
315
329
  // ── Flush ────────────────────────────────────────────────────────────────────
316
330
  /** POSTs queued entries in order. Stops at the first retryable failure (likely
317
- * offline) and leaves the rest for next time. Entries queued while a flush is
318
- * running are sent by the same flush, so nothing waits for the next event.
319
- * Idempotency keys make re-sends safe. Never throws. */
320
- async flush() {
321
- if (this.isFlushing) return;
331
+ * offline) and schedules a retry (2 s, doubling, capped at 30 s). Entries
332
+ * queued while a flush is running are sent by the same flush, so nothing waits
333
+ * for the next event. Idempotency keys make re-sends safe. Resolves when the
334
+ * flush in progress is done; never throws. */
335
+ flush() {
336
+ if (this.isFlushing) {
337
+ this.flushAgain = true;
338
+ return this.flushPromise;
339
+ }
322
340
  this.isFlushing = true;
341
+ this.clearRetryTimer();
342
+ this.flushPromise = this.runFlush();
343
+ return this.flushPromise;
344
+ }
345
+ /** Stops retrying (the client is stopping). Queued entries stay for later. */
346
+ cancelRetry() {
347
+ this.retryStopped = true;
348
+ this.clearRetryTimer();
349
+ }
350
+ /** Allows retries again after `cancelRetry()`. */
351
+ resumeRetry() {
352
+ this.retryStopped = false;
353
+ }
354
+ async runFlush() {
355
+ let failed = false;
356
+ const sent = /* @__PURE__ */ new Set();
323
357
  try {
324
- const sent = /* @__PURE__ */ new Set();
325
- for (; ; ) {
326
- const pending = this.outbox.snapshot().filter((e) => !sent.has(e.id));
327
- if (pending.length === 0) break;
328
- let failed = false;
329
- for (const entry of pending) {
330
- try {
331
- await this.post(entry.path, entry.body);
332
- this.outbox.remove(entry.id);
333
- sent.add(entry.id);
334
- } catch {
335
- failed = true;
336
- break;
358
+ do {
359
+ this.flushAgain = false;
360
+ for (; ; ) {
361
+ const pending = this.outbox.snapshot().filter((e) => !sent.has(e.id));
362
+ if (pending.length === 0) break;
363
+ for (const entry of pending) {
364
+ try {
365
+ await this.post(entry.path, entry.body);
366
+ this.outbox.remove(entry.id);
367
+ sent.add(entry.id);
368
+ } catch {
369
+ failed = true;
370
+ break;
371
+ }
337
372
  }
373
+ if (failed) break;
338
374
  }
339
- if (failed) break;
340
- }
375
+ } while (!failed && this.flushAgain);
341
376
  } finally {
377
+ this.flushAgain = false;
342
378
  this.isFlushing = false;
343
379
  }
380
+ if (failed) {
381
+ this.failures += 1;
382
+ this.scheduleRetry();
383
+ } else {
384
+ this.failures = 0;
385
+ }
386
+ }
387
+ /** One pending retry at most. */
388
+ scheduleRetry() {
389
+ if (this.retryStopped || this.retryTimer) return;
390
+ const delay = Math.min(RETRY_BASE_MS * 2 ** Math.max(0, this.failures - 1), RETRY_MAX_MS);
391
+ this.retryTimer = setTimeout(() => {
392
+ this.retryTimer = null;
393
+ void this.flush();
394
+ }, delay);
395
+ }
396
+ clearRetryTimer() {
397
+ if (this.retryTimer) clearTimeout(this.retryTimer);
398
+ this.retryTimer = null;
344
399
  }
345
400
  async post(path, body) {
346
- const res = await fetch(this.endpoint(path), {
347
- method: "POST",
348
- headers: {
349
- Authorization: `Bearer ${this.apiKey}`,
350
- "MS-Api-Version": API_VERSION,
351
- "Content-Type": "application/json; charset=utf-8"
352
- },
353
- body
354
- });
355
- if (res.status === 429 || res.status >= 500 && res.status < 600) {
356
- throw new Error(`retryable ${res.status}`);
401
+ const controller = typeof AbortController !== "undefined" ? new AbortController() : null;
402
+ const timeout = controller ? setTimeout(() => controller.abort(), INGEST_TIMEOUT_MS) : null;
403
+ try {
404
+ const res = await fetch(this.endpoint(path), {
405
+ method: "POST",
406
+ headers: {
407
+ Authorization: `Bearer ${this.apiKey}`,
408
+ "MS-Api-Version": API_VERSION,
409
+ "Content-Type": "application/json; charset=utf-8"
410
+ },
411
+ body,
412
+ signal: controller?.signal
413
+ });
414
+ if (res.status === 429 || res.status >= 500 && res.status < 600) {
415
+ throw new Error(`retryable ${res.status}`);
416
+ }
417
+ } finally {
418
+ if (timeout) clearTimeout(timeout);
357
419
  }
358
420
  }
359
421
  endpoint(path) {
@@ -856,7 +918,7 @@ function debugProperties(properties) {
856
918
  }
857
919
 
858
920
  // src/core/version.ts
859
- var SDK_VERSION = "0.1.6";
921
+ var SDK_VERSION = "0.1.7";
860
922
 
861
923
  // src/core/client.ts
862
924
  var DEFAULT_BASE_URL = "https://console.microsurveys.ai";
@@ -921,15 +983,14 @@ var MicroSurveysClient = class {
921
983
  start() {
922
984
  if (this.started) return;
923
985
  this.started = true;
986
+ this.api.resumeRetry();
924
987
  void this.api.flush();
925
988
  void this.refreshConfig().then(() => {
926
989
  if (this.started) this.startPendingChecks();
927
990
  });
928
991
  this.unsubscribeForeground = this.subscribeForeground(() => {
929
- if (this.refreshOnForeground) {
930
- void this.api.flush();
931
- this.refreshConfigIfStale();
932
- }
992
+ void this.api.flush();
993
+ if (this.refreshOnForeground) this.refreshConfigIfStale();
933
994
  this.startPendingChecks();
934
995
  });
935
996
  this.unsubscribeBackground = this.subscribeBackground?.(() => {
@@ -949,6 +1010,7 @@ var MicroSurveysClient = class {
949
1010
  this.unsubscribeBackground = null;
950
1011
  this.unsubscribeForeground?.();
951
1012
  this.unsubscribeForeground = null;
1013
+ this.api.cancelRetry();
952
1014
  this.started = false;
953
1015
  }
954
1016
  /** Force an ETag-aware config refresh; keeps the cache on failure. */
@@ -1126,49 +1188,81 @@ var MicroSurveysClient = class {
1126
1188
  return;
1127
1189
  }
1128
1190
  this.handleDecision({ surveyId: survey.id, triggerId: trigger.id, reason: "shown" });
1129
- const p = { survey, trigger, identity, shownAt: /* @__PURE__ */ new Date(), closed: false };
1191
+ const p = this.newPresentation(survey, trigger, identity);
1130
1192
  this.active = p;
1131
1193
  const active = this.toActiveSurvey(p);
1132
1194
  this.presentListeners.forEach((l) => l(active));
1133
1195
  }
1196
+ newPresentation(survey, trigger, identity) {
1197
+ return { survey, trigger, identity, impressionId: uuid(), presentedAt: /* @__PURE__ */ new Date(), impression: null, closed: false };
1198
+ }
1134
1199
  toActiveSurvey(p) {
1135
1200
  return {
1136
1201
  survey: p.survey,
1137
1202
  trigger: p.trigger,
1203
+ shown: () => this.markShown(p),
1138
1204
  close: (result) => {
1139
1205
  if (p.closed) return;
1140
1206
  p.closed = true;
1141
- this.recordOutcome(p.survey.id, p.trigger?.id ?? null, p.identity, p.shownAt, result);
1142
1207
  if (this.active === p) this.active = null;
1208
+ if (result) this.recordOutcome(p, result);
1143
1209
  }
1144
1210
  };
1145
1211
  }
1146
- /** Records the outcome of an **inline** `<MicroSurvey>` (no trigger/gate). */
1147
- recordInline(survey, result, shownAt) {
1148
- const identity = this.identityStore.snapshot();
1149
- this.recordOutcome(survey.id, null, identity, shownAt, result);
1212
+ /** Queues the impression the moment the survey is on screen, so it counts even
1213
+ * if the app is killed before the survey closes. */
1214
+ markShown(p) {
1215
+ if (p.impression || p.closed) return;
1216
+ p.impression = {
1217
+ clientId: p.impressionId,
1218
+ surveyId: p.survey.id,
1219
+ triggerId: p.trigger?.id ?? null,
1220
+ endUserId: endUserIdOf(p.identity),
1221
+ shownAt: /* @__PURE__ */ new Date(),
1222
+ dismissed: false,
1223
+ context: this.deviceContext()
1224
+ };
1225
+ this.api.recordImpression(p.impression);
1150
1226
  }
1151
- recordOutcome(surveyId, triggerId, identity, shownAt, result) {
1152
- const endUserId = endUserIdOf(identity);
1153
- const context = this.deviceContext();
1154
- const impressionId = this.api.recordImpression({
1155
- surveyId,
1156
- triggerId,
1157
- endUserId,
1158
- shownAt,
1159
- dismissed: result.dismissed,
1160
- context
1161
- });
1227
+ /** An **inline** `<MicroSurvey>` (no trigger, no gate, not "the" active survey).
1228
+ * Call `shown` when it renders and `close` with its outcome. */
1229
+ presentInline(survey) {
1230
+ return this.toActiveSurvey(this.newPresentation(survey, null, this.identityStore.snapshot()));
1231
+ }
1232
+ /** Records the outcome of an inline survey in one go, at close. Prefer
1233
+ * `presentInline`, which sends the impression when the survey appears. */
1234
+ recordInline(survey, result, shownAt) {
1235
+ const p = this.newPresentation(survey, null, this.identityStore.snapshot());
1236
+ p.presentedAt = shownAt;
1237
+ p.closed = true;
1238
+ this.recordOutcome(p, result);
1239
+ }
1240
+ recordOutcome(p, result) {
1241
+ let impression = p.impression;
1242
+ if (!impression) {
1243
+ impression = {
1244
+ clientId: p.impressionId,
1245
+ surveyId: p.survey.id,
1246
+ triggerId: p.trigger?.id ?? null,
1247
+ endUserId: endUserIdOf(p.identity),
1248
+ shownAt: p.presentedAt,
1249
+ dismissed: result.dismissed,
1250
+ context: this.deviceContext()
1251
+ };
1252
+ this.api.recordImpression(impression);
1253
+ } else if (result.dismissed) {
1254
+ this.api.recordImpression({ ...impression, dismissed: true });
1255
+ }
1162
1256
  if (result.completed || result.answers.length > 0) {
1163
1257
  this.api.recordResponse({
1164
- surveyId,
1165
- endUserId,
1258
+ surveyId: p.survey.id,
1259
+ endUserId: impression.endUserId,
1166
1260
  completed: result.completed,
1167
1261
  submittedAt: /* @__PURE__ */ new Date(),
1168
- userProps: identity.userProperties,
1169
- impressionId,
1170
- triggerId,
1171
- context,
1262
+ userProps: p.identity.userProperties,
1263
+ impressionId: p.impressionId,
1264
+ triggerId: p.trigger?.id ?? null,
1265
+ context: impression.context,
1172
1266
  answers: result.answers
1173
1267
  });
1174
1268
  }
@@ -1378,7 +1472,23 @@ var MicroSurveys = class {
1378
1472
  unsubscribe?.();
1379
1473
  };
1380
1474
  }
1381
- /** Records the outcome of an inline `<MicroSurvey>`. */
1475
+ /** Starts one showing of an inline `<MicroSurvey>`: call `shown` once it
1476
+ * renders (sends the impression) and `close` with its outcome. */
1477
+ presentInline(survey) {
1478
+ let inner = null;
1479
+ const withShowing = (fn) => this.withClient((c) => {
1480
+ inner ?? (inner = c.presentInline(survey));
1481
+ fn(inner);
1482
+ });
1483
+ return {
1484
+ survey,
1485
+ trigger: null,
1486
+ shown: () => withShowing((s) => s.shown()),
1487
+ close: (result) => withShowing((s) => s.close(result))
1488
+ };
1489
+ }
1490
+ /** Records the outcome of an inline survey in one go, at close. Prefer
1491
+ * `presentInline`, which sends the impression when the survey appears. */
1382
1492
  recordInline(survey, result, shownAt) {
1383
1493
  this.withClient((c) => c.recordInline(survey, result, shownAt));
1384
1494
  }
@@ -2227,7 +2337,11 @@ function OverlayHost({ instance, fontFamily }) {
2227
2337
  }),
2228
2338
  [instance]
2229
2339
  );
2340
+ useEffect3(() => {
2341
+ current?.active.shown();
2342
+ }, [current]);
2230
2343
  function showNext() {
2344
+ current?.active.close();
2231
2345
  const next = queue.current.shift();
2232
2346
  if (next) {
2233
2347
  setCurrent({ active: next, id: nextId.current++ });
@@ -2273,7 +2387,7 @@ function MicroSurvey({ surveyId, onComplete, style }) {
2273
2387
  const scheme = useColorScheme2() === "dark" ? "dark" : "light";
2274
2388
  const [survey, setSurvey] = useState5(null);
2275
2389
  const [closed, setClosed] = useState5(false);
2276
- const shownAt = useRef4(null);
2390
+ const showing = useRef4(null);
2277
2391
  const result = useRef4(null);
2278
2392
  useEffect4(() => {
2279
2393
  if (!instance) return;
@@ -2281,8 +2395,14 @@ function MicroSurvey({ surveyId, onComplete, style }) {
2281
2395
  }, [instance, surveyId]);
2282
2396
  const projectTheme = instance?.getTheme();
2283
2397
  const theme = useMemo4(() => resolveTheme(projectTheme, { scheme, fontFamily }), [projectTheme, scheme, fontFamily]);
2398
+ const visible = !!instance && !!survey && !closed;
2399
+ if (visible && (!showing.current || showing.current.survey.id !== survey.id)) {
2400
+ showing.current = instance.presentInline(survey);
2401
+ }
2402
+ useEffect4(() => {
2403
+ if (visible) showing.current?.shown();
2404
+ }, [visible, survey]);
2284
2405
  if (!instance || !survey || closed) return null;
2285
- if (!shownAt.current) shownAt.current = /* @__PURE__ */ new Date();
2286
2406
  return /* @__PURE__ */ jsx6(
2287
2407
  View5,
2288
2408
  {
@@ -2298,7 +2418,7 @@ function MicroSurvey({ surveyId, onComplete, style }) {
2298
2418
  variant: "inline",
2299
2419
  onResult: (r) => {
2300
2420
  result.current = r;
2301
- instance.recordInline(survey, r, shownAt.current ?? /* @__PURE__ */ new Date());
2421
+ showing.current?.close(r);
2302
2422
  },
2303
2423
  onClose: () => {
2304
2424
  setClosed(true);