@mrrocket/sdk 0.17.0 → 0.21.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/CHANGELOG.md +30 -1
- package/README.md +24 -1
- package/dist/api-client.d.ts +28 -4
- package/dist/api-client.js +30 -13
- package/dist/api-client.js.map +1 -1
- package/dist/browser/mrrocket-flows.js +15 -3
- package/dist/browser/mrrocket-messenger.js +38 -5
- package/dist/browser/mrrocket.js +1 -1
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +2 -1
- package/dist/browser.js.map +1 -1
- package/dist/client.d.ts +28 -3
- package/dist/client.js +37 -5
- package/dist/client.js.map +1 -1
- package/dist/context.d.ts +3 -1
- package/dist/context.js.map +1 -1
- package/dist/core.d.ts +7 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/feedback.js +161 -119
- package/dist/feedback.js.map +1 -1
- package/dist/finish-web.d.ts +18 -0
- package/dist/finish-web.js +139 -0
- package/dist/finish-web.js.map +1 -0
- package/dist/flows-ui.d.ts +1 -10
- package/dist/flows-ui.js +175 -48
- package/dist/flows-ui.js.map +1 -1
- package/dist/flows-web.d.ts +8 -1
- package/dist/flows-web.js +10 -1
- package/dist/flows-web.js.map +1 -1
- package/dist/flows.d.ts +193 -9
- package/dist/flows.js +284 -38
- package/dist/flows.js.map +1 -1
- package/dist/i18n.d.ts +22 -0
- package/dist/i18n.js +74 -0
- package/dist/i18n.js.map +1 -0
- package/dist/icons.d.ts +24 -0
- package/dist/icons.js +61 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/messenger-ui.d.ts +9 -3
- package/dist/messenger-ui.js +388 -191
- package/dist/messenger-ui.js.map +1 -1
- package/dist/messenger.d.ts +3 -1
- package/dist/messenger.js +3 -2
- package/dist/messenger.js.map +1 -1
- package/dist/onboarding-state.d.ts +23 -0
- package/dist/onboarding-state.js +43 -0
- package/dist/onboarding-state.js.map +1 -0
- package/dist/paywall.js +2 -1
- package/dist/paywall.js.map +1 -1
- package/dist/react-native/index.d.cts +239 -19
- package/dist/react-native/index.d.ts +239 -19
- package/dist/react-native/index.js +1305 -518
- package/dist/react-native/index.js.map +1 -1
- package/dist/server.d.ts +4 -2
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/styles-css.d.ts +1 -1
- package/dist/styles-css.js +35 -2
- package/dist/styles-css.js.map +1 -1
- package/dist/survey.js +18 -14
- package/dist/survey.js.map +1 -1
- package/dist/ui.d.ts +2 -0
- package/dist/ui.js +15 -12
- package/dist/ui.js.map +1 -1
- package/package.json +6 -3
|
@@ -61,6 +61,11 @@ interface SurveyQuestion {
|
|
|
61
61
|
description?: string;
|
|
62
62
|
required: boolean;
|
|
63
63
|
options?: string[];
|
|
64
|
+
/**
|
|
65
|
+
* 0.21.0: what each option says in the visitor's language, parallel to `options`. An answer is still recorded as the
|
|
66
|
+
* `options` value, so rules and numbers do not split by language.
|
|
67
|
+
*/
|
|
68
|
+
labels?: string[];
|
|
64
69
|
scale?: number;
|
|
65
70
|
low?: string;
|
|
66
71
|
high?: string;
|
|
@@ -165,6 +170,8 @@ interface MessengerLook {
|
|
|
165
170
|
/** A round chat button in the app (React Native) too. */
|
|
166
171
|
appLauncher?: boolean;
|
|
167
172
|
help: boolean;
|
|
173
|
+
/** The Updates tab with the published changelog (MRRocket from 0.22; older servers leave it out). */
|
|
174
|
+
updates?: boolean;
|
|
168
175
|
sound: boolean;
|
|
169
176
|
preview: boolean;
|
|
170
177
|
askEmail: boolean;
|
|
@@ -185,13 +192,24 @@ interface MessengerLook {
|
|
|
185
192
|
/** The AI agent's picture beside its answers (from 0.17). */
|
|
186
193
|
agentPhoto?: string;
|
|
187
194
|
}
|
|
188
|
-
/**
|
|
195
|
+
/** One of the visitor's conversations in their list (0.19). */
|
|
196
|
+
interface ChatSummary {
|
|
197
|
+
id: string;
|
|
198
|
+
status: "open" | "solved";
|
|
199
|
+
/** The visitor's first words. */
|
|
200
|
+
subject: string;
|
|
201
|
+
/** The newest message, its body cut to a preview. */
|
|
202
|
+
last: ChatMessage | null;
|
|
203
|
+
}
|
|
204
|
+
/** One chat (the one asked for, else the visitor's newest, open or closed) and its messages. */
|
|
189
205
|
interface ChatThread {
|
|
190
206
|
conversation: {
|
|
191
207
|
id: string;
|
|
192
208
|
status: "open" | "solved";
|
|
193
209
|
} | null;
|
|
194
210
|
messages: ChatMessage[];
|
|
211
|
+
/** All the visitor's conversations, the latest activity first (0.19). */
|
|
212
|
+
conversations?: ChatSummary[];
|
|
195
213
|
/** The visitor gave an email already: the messenger stops asking. */
|
|
196
214
|
hasEmail: boolean;
|
|
197
215
|
}
|
|
@@ -243,10 +261,15 @@ declare const createApi: (c: Conn) => {
|
|
|
243
261
|
completed: boolean;
|
|
244
262
|
seconds: number;
|
|
245
263
|
}) => Promise<unknown>;
|
|
246
|
-
chat
|
|
247
|
-
|
|
264
|
+
/** One chat by id, else the visitor's newest; `conversations` lists them all. */
|
|
265
|
+
chat: (signal?: AbortSignal, conversation?: string) => Promise<ChatThread>;
|
|
266
|
+
/**
|
|
267
|
+
* A message; `attachments` are upload ids from `uploadChatFile` (then the body may be empty). `conversation` is
|
|
268
|
+
* the chat it answers, or "new" to start one; without it, the running chat or else a new one.
|
|
269
|
+
*/
|
|
248
270
|
sendChat: (m: {
|
|
249
271
|
body: string;
|
|
272
|
+
conversation?: string;
|
|
250
273
|
email?: string;
|
|
251
274
|
url?: string;
|
|
252
275
|
attachments?: string[];
|
|
@@ -281,7 +304,9 @@ type Api = ReturnType<typeof createApi>;
|
|
|
281
304
|
* - `$onboarding` `{flow, step?, action: "started" | "shown" | "completed" | "dismissed"}`; since 0.11.0 a wait records
|
|
282
305
|
* "shown" when the person reaches it and "completed" when it is over, a condition `{action: "answered", answer: "yes"
|
|
283
306
|
* | "no"}` once it is decided; since 0.17.0 a tour a checklist task started records `{action: "started", from}` with
|
|
284
|
-
* the checklist's id.
|
|
307
|
+
* the checklist's id; since 0.18.0 a question records `{kind: "question", action: "completed", question, answer,
|
|
308
|
+
* label}` (the question's key, the option's id or the typed text, the option's words), which MRRocket keeps on the
|
|
309
|
+
* contact, and a checklist task that opens something `{action: "opened", opens}`.
|
|
285
310
|
* - `$inapp` `{message, journey, action: "shown" | "clicked" | "dismissed"}`; the journey moves the person on.
|
|
286
311
|
*/
|
|
287
312
|
|
|
@@ -301,8 +326,10 @@ interface CancelOffer {
|
|
|
301
326
|
/** 0.15.0: a second question after an answer ("What would be a fair price?"); no answers means a free text. */
|
|
302
327
|
interface CancelFollowUp {
|
|
303
328
|
question: string;
|
|
304
|
-
/** The choices, in order; empty for a free text. */
|
|
329
|
+
/** The choices, in order; empty for a free text. What is recorded and what rules compare, whatever the language. */
|
|
305
330
|
answers: string[];
|
|
331
|
+
/** 0.21.0: what each choice says in the visitor's language, parallel to `answers`; shown instead of them. */
|
|
332
|
+
answerLabels?: string[];
|
|
306
333
|
}
|
|
307
334
|
/**
|
|
308
335
|
* 0.15.0: a different offer for some customers of one answer. Every condition that is set must hold; the first rule
|
|
@@ -350,7 +377,71 @@ interface CancelFlowConfig {
|
|
|
350
377
|
*/
|
|
351
378
|
offersFor: "business";
|
|
352
379
|
}
|
|
353
|
-
|
|
380
|
+
/** "question" (0.18.0): one question of a Questions item, a slide of its window. */
|
|
381
|
+
type OnboardingStepKind = "tour" | "checklist" | "modal" | "question";
|
|
382
|
+
/**
|
|
383
|
+
* 0.18.0: what a checklist task opens. `page`: a path or address on the web, a deep link (`myapp://…`) or a screen name
|
|
384
|
+
* in an app, handed to the app's `onNavigate` when it passes one; `tour` / `modal`: another item of the config, after
|
|
385
|
+
* which the checklist comes back; `code`: the app's `onTask(taskId, item)`.
|
|
386
|
+
*/
|
|
387
|
+
type TaskOpens = {
|
|
388
|
+
kind: "page";
|
|
389
|
+
target: string;
|
|
390
|
+
} | {
|
|
391
|
+
kind: "tour";
|
|
392
|
+
id: string;
|
|
393
|
+
} | {
|
|
394
|
+
kind: "modal";
|
|
395
|
+
id: string;
|
|
396
|
+
} | {
|
|
397
|
+
kind: "code";
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* 0.18.0: a small picture beside a checklist task or above a modal's or the questions' heading: one of the SDK's own
|
|
401
|
+
* line icons (`FLOW_ICON_NAMES`, icons.ts), an emoji, or a picture (http(s)).
|
|
402
|
+
*/
|
|
403
|
+
type FlowIcon = {
|
|
404
|
+
kind: "builtin";
|
|
405
|
+
name: string;
|
|
406
|
+
} | {
|
|
407
|
+
kind: "emoji";
|
|
408
|
+
value: string;
|
|
409
|
+
} | {
|
|
410
|
+
kind: "image";
|
|
411
|
+
url: string;
|
|
412
|
+
};
|
|
413
|
+
/** 0.18.0: what plays when someone finishes a checklist, a tour or the questions. */
|
|
414
|
+
type FinishAnimation = "none" | "confetti" | "fireworks" | "stars";
|
|
415
|
+
/**
|
|
416
|
+
* 0.18.0: one question of a Questions item: one choice of 2 to 6 options, or a short text. 0.21.0: a number scale, an
|
|
417
|
+
* "Other" with the person's own words, and a Skip button. An older app shows a scale as a text field, leaves "Other"
|
|
418
|
+
* out, and offers no Skip (its close button still ends the window).
|
|
419
|
+
*/
|
|
420
|
+
interface OnboardingQuestion {
|
|
421
|
+
/** The answer's name on the contact (`onboarding.<key>`) and in "People who answered …". */
|
|
422
|
+
key: string;
|
|
423
|
+
type: "choice" | "text" | "scale";
|
|
424
|
+
/** Choice: the options, in order; `id` is what is stored, `label` what people read. */
|
|
425
|
+
options?: {
|
|
426
|
+
id: string;
|
|
427
|
+
label: string;
|
|
428
|
+
}[];
|
|
429
|
+
/** Text: the field's hint. */
|
|
430
|
+
placeholder?: string;
|
|
431
|
+
/** 0.21.0, choice: one more option where people type their own words, stored as `other:<words>`. */
|
|
432
|
+
other?: boolean;
|
|
433
|
+
/** 0.21.0: the words of that option; "Other" when unset. */
|
|
434
|
+
otherLabel?: string;
|
|
435
|
+
/** 0.21.0, scale: the lowest and highest number, and the words under both ends. */
|
|
436
|
+
min?: number;
|
|
437
|
+
max?: number;
|
|
438
|
+
lowLabel?: string;
|
|
439
|
+
highLabel?: string;
|
|
440
|
+
/** 0.21.0: people may go on without answering. */
|
|
441
|
+
optional?: boolean;
|
|
442
|
+
/** 0.21.0: the words of that button; "Skip" when unset. */
|
|
443
|
+
skipLabel?: string;
|
|
444
|
+
}
|
|
354
445
|
/** 0.17.0: where a tour bubble sits next to its element; "auto" (and no value) puts it below, else above, as before. */
|
|
355
446
|
type TourPlacement = "auto" | "top" | "bottom" | "left" | "right";
|
|
356
447
|
/**
|
|
@@ -380,6 +471,12 @@ interface OnboardingStep {
|
|
|
380
471
|
url?: string;
|
|
381
472
|
/** 0.17.0, checklist items: the id of a tour (another flow) the item starts; finishing the tour ticks the item. */
|
|
382
473
|
startsTour?: string;
|
|
474
|
+
/** 0.18.0, checklist items: what the task opens (read before `startsTour`, which MRRocket still sends for a tour). */
|
|
475
|
+
opens?: TaskOpens;
|
|
476
|
+
/** 0.18.0, checklist items: the task's icon. */
|
|
477
|
+
icon?: FlowIcon;
|
|
478
|
+
/** 0.18.0, question steps: the question (the step's `title` is what people read). */
|
|
479
|
+
question?: OnboardingQuestion;
|
|
383
480
|
}
|
|
384
481
|
/** A pause in a flow (0.11.0): the next step shows this long after the one before was done. */
|
|
385
482
|
interface OnboardingWait {
|
|
@@ -412,10 +509,33 @@ interface OnboardingFlow {
|
|
|
412
509
|
* of the app ("/settings", "/projects/*"), or "From a checklist" (only a checklist task starts it).
|
|
413
510
|
*/
|
|
414
511
|
trigger: string;
|
|
415
|
-
/**
|
|
416
|
-
|
|
512
|
+
/**
|
|
513
|
+
* 0.17.0: "signed_in" starts it on its own only for someone the app identified. 0.18.0: "answered" only for someone
|
|
514
|
+
* who gave `answered.option` to the question `answered.question` (its key).
|
|
515
|
+
*/
|
|
516
|
+
audience?: "signed_in" | "answered";
|
|
517
|
+
/** 0.18.0: with `audience: "answered"`, the question's key and the option's id (or the typed text). */
|
|
518
|
+
answered?: {
|
|
519
|
+
question: string;
|
|
520
|
+
option: string;
|
|
521
|
+
};
|
|
417
522
|
/** What every version shows: with `nodes`, only the in-app steps before the first wait or condition. */
|
|
418
523
|
steps: OnboardingStep[];
|
|
524
|
+
/** 0.18.0: the icon above a modal's or the questions' heading. */
|
|
525
|
+
icon?: FlowIcon;
|
|
526
|
+
/** 0.18.0: what plays when the person finishes it (a checklist, a tour, the questions). */
|
|
527
|
+
finish?: FinishAnimation;
|
|
528
|
+
/**
|
|
529
|
+
* 0.18.0: "code": the app draws it itself (`useOnboarding(id)`, `mrrocket.onboarding.get(id)`); the SDK draws
|
|
530
|
+
* nothing for it, never starts it, and still records what the app reports. Such an item's `trigger` is
|
|
531
|
+
* "From your code" (older versions never start it).
|
|
532
|
+
*/
|
|
533
|
+
shownBy?: "code";
|
|
534
|
+
/**
|
|
535
|
+
* 0.18.0: the item's real moment (read instead of `trigger`, see `momentOf`) when `trigger` is one older versions
|
|
536
|
+
* never start: "From your code", or `NEEDS_NEWER` for questions and items that follow another or ask for an answer.
|
|
537
|
+
*/
|
|
538
|
+
when?: string;
|
|
419
539
|
/** 0.11.0+: the whole flow with its waits and conditions. Read instead of `steps` when it is there. */
|
|
420
540
|
nodes?: OnboardingNode[];
|
|
421
541
|
}
|
|
@@ -485,15 +605,22 @@ type FlowView = {
|
|
|
485
605
|
/** The step for the dots, 1 to `steps`. */
|
|
486
606
|
step: number;
|
|
487
607
|
steps: number;
|
|
488
|
-
}
|
|
608
|
+
}
|
|
609
|
+
/** `answer` (0.18.0): a question's answer so far (an option's id or the typed text); `back`: an earlier question to go back to. */
|
|
610
|
+
| {
|
|
489
611
|
type: "step";
|
|
490
612
|
flow: OnboardingFlow;
|
|
491
613
|
step: OnboardingStep;
|
|
492
614
|
index: number;
|
|
493
615
|
total: number;
|
|
494
616
|
last: boolean;
|
|
617
|
+
answer?: string;
|
|
618
|
+
back?: boolean;
|
|
495
619
|
}
|
|
496
|
-
/**
|
|
620
|
+
/**
|
|
621
|
+
* `tour`: the tour the item starts (0.17.0), when the config has it. `opens` (0.18.0): what tapping the task opens
|
|
622
|
+
* (a tour or modal only when the config has it); `target` the item it opens.
|
|
623
|
+
*/
|
|
497
624
|
| {
|
|
498
625
|
type: "checklist";
|
|
499
626
|
flow: OnboardingFlow;
|
|
@@ -501,6 +628,8 @@ type FlowView = {
|
|
|
501
628
|
step: OnboardingStep;
|
|
502
629
|
done: boolean;
|
|
503
630
|
tour?: OnboardingFlow;
|
|
631
|
+
opens?: TaskOpens;
|
|
632
|
+
target?: OnboardingFlow;
|
|
504
633
|
}[];
|
|
505
634
|
} | {
|
|
506
635
|
type: "message";
|
|
@@ -528,17 +657,56 @@ interface FlowsController {
|
|
|
528
657
|
confirm(comment?: string): void;
|
|
529
658
|
close(): void;
|
|
530
659
|
};
|
|
531
|
-
/**
|
|
660
|
+
/**
|
|
661
|
+
* `startTour(stepId)` (0.17.0): the tour a checklist item starts; the checklist comes back when it ends.
|
|
662
|
+
* 0.18.0: `open(stepId)` does what the task opens (a page, a tour, a modal, the app's code); `answer(value)` picks an
|
|
663
|
+
* option or types the text of the question on screen, `back()` returns to the question before. `item(id)` and the
|
|
664
|
+
* calls after it are for an item the app draws itself (`shownBy: "code"`).
|
|
665
|
+
*/
|
|
532
666
|
onboarding: {
|
|
533
667
|
next(): void;
|
|
534
668
|
check(stepId: string): void;
|
|
535
669
|
dismiss(): void;
|
|
536
670
|
startTour(stepId: string): boolean;
|
|
671
|
+
open(stepId: string): boolean;
|
|
672
|
+
answer(value: string): void;
|
|
673
|
+
/** 0.21.0: goes on from an optional question without an answer. */
|
|
674
|
+
skip(): void;
|
|
675
|
+
back(): void;
|
|
676
|
+
item(id: string): OnboardingItemState | null;
|
|
677
|
+
seen(id: string): void;
|
|
678
|
+
complete(id: string, stepId: string): void;
|
|
679
|
+
dismissItem(id: string): void;
|
|
680
|
+
answerItem(id: string, question: string, value: string): void;
|
|
537
681
|
};
|
|
538
682
|
message: {
|
|
539
683
|
click(): void;
|
|
540
684
|
dismiss(): void;
|
|
541
685
|
};
|
|
686
|
+
/** 0.18.0: the animation to play now that someone finished an item (a new `key` each time), or null. */
|
|
687
|
+
finale(): {
|
|
688
|
+
kind: Exclude<FinishAnimation, "none">;
|
|
689
|
+
key: string;
|
|
690
|
+
} | null;
|
|
691
|
+
/** 0.18.0: the product's brand color from MRRocket, for the dialogs when the app passes no accent of its own. */
|
|
692
|
+
accent(): string | undefined;
|
|
693
|
+
/** 0.18.0: the person's answers to onboarding questions, by key. */
|
|
694
|
+
answers(): Record<string, string>;
|
|
695
|
+
}
|
|
696
|
+
/** 0.18.0: an item the app draws itself (`shownBy: "code"`), with the person's progress. */
|
|
697
|
+
interface OnboardingItemState {
|
|
698
|
+
item: OnboardingFlow;
|
|
699
|
+
/** Its steps (a tour's steps, a checklist's tasks, the questions), each with whether the person did it. */
|
|
700
|
+
steps: (OnboardingStep & {
|
|
701
|
+
done: boolean;
|
|
702
|
+
answer?: string;
|
|
703
|
+
})[];
|
|
704
|
+
/** Every step is done. */
|
|
705
|
+
done: boolean;
|
|
706
|
+
/** The person closed it. */
|
|
707
|
+
dismissed: boolean;
|
|
708
|
+
/** Its moment has come for this person (the trigger MRRocket set, and who it is for); your code may ignore it. */
|
|
709
|
+
eligible: boolean;
|
|
542
710
|
}
|
|
543
711
|
|
|
544
712
|
/**
|
|
@@ -658,7 +826,7 @@ interface PaywallHost {
|
|
|
658
826
|
|
|
659
827
|
type VariantId = string;
|
|
660
828
|
/** This build of the SDK. Sent with the config request so MRRocket knows what the site runs (error tracking, flags). */
|
|
661
|
-
declare const SDK_VERSION = "0.
|
|
829
|
+
declare const SDK_VERSION = "0.21.0";
|
|
662
830
|
/** One variant of an experiment. `changes` replaces texts that the page marks with `<Text id>`. */
|
|
663
831
|
interface VariantConfig {
|
|
664
832
|
id: VariantId;
|
|
@@ -692,6 +860,10 @@ interface RedirectConfig {
|
|
|
692
860
|
interface CockpitConfig {
|
|
693
861
|
/** The product the public key belongs to. */
|
|
694
862
|
project: string;
|
|
863
|
+
/** The language the server chose for the words below, like "de" (`lang` on the request). SDK 0.21.0+. */
|
|
864
|
+
lang?: string;
|
|
865
|
+
/** The SDK's own words: English source word to translation (see words.ts). Absent for English. SDK 0.21.0+. */
|
|
866
|
+
words?: Record<string, string>;
|
|
695
867
|
experiments: ExperimentConfig[];
|
|
696
868
|
/** The product's affiliate program: how many days a partner's referral is kept. Missing without a program. */
|
|
697
869
|
referral?: {
|
|
@@ -711,6 +883,8 @@ interface CockpitConfig {
|
|
|
711
883
|
cancelFlow?: CancelFlowConfig;
|
|
712
884
|
/** The in-app steps of live onboarding flows (tours, checklists, modals). SDK 0.7.0+. */
|
|
713
885
|
onboarding?: OnboardingFlow[];
|
|
886
|
+
/** The product's brand color ("#rrggbb") for the onboarding dialogs when the app passes no accent. SDK 0.18.0+. */
|
|
887
|
+
onboardingAccent?: string;
|
|
714
888
|
/** A live Lifecycle journey has in-app messages: signed-in people ask `/api/sdk/inapp` for theirs. SDK 0.7.0+. */
|
|
715
889
|
messages?: boolean;
|
|
716
890
|
/** Page redirects set in MRRocket; the SDK sends visitors on before the page shows (`redirectFor`). SDK 0.7.0+. */
|
|
@@ -857,8 +1031,21 @@ interface MRRocketOptions {
|
|
|
857
1031
|
maxQueue?: number;
|
|
858
1032
|
/** Log what the SDK does to the console. */
|
|
859
1033
|
debug?: boolean;
|
|
1034
|
+
/**
|
|
1035
|
+
* 0.21.0: the language of the SDK's words and of what the server answers, like "de-AT", for an app with its own
|
|
1036
|
+
* language switch. Default: the phone's. `setLocale` does the same from anywhere.
|
|
1037
|
+
*/
|
|
1038
|
+
locale?: string;
|
|
860
1039
|
/** Onboarding flows start on their own when the person does their trigger (default true). False: only `startOnboarding()`. */
|
|
861
1040
|
onboarding?: boolean;
|
|
1041
|
+
/**
|
|
1042
|
+
* 0.18.0: opens what a checklist task's "Opens: page or screen" names: a screen name or a path for your navigator
|
|
1043
|
+
* (`(target) => router.push(target)`). Without it only a deep link or an address (`myapp://…`, `https://…`) opens,
|
|
1044
|
+
* through `Linking`.
|
|
1045
|
+
*/
|
|
1046
|
+
onNavigate?: (target: string) => void;
|
|
1047
|
+
/** 0.18.0: a checklist task set to "Opens: your code" was tapped: `(taskId, item) => …`. */
|
|
1048
|
+
onTask?: (taskId: string, item: OnboardingFlow) => void;
|
|
862
1049
|
/** Taps go to Heatmaps as clicks on the screen they happened on (default true; `MRRocketProvider` captures them). */
|
|
863
1050
|
heatmaps?: boolean;
|
|
864
1051
|
/**
|
|
@@ -1003,15 +1190,37 @@ interface MRRocketClient {
|
|
|
1003
1190
|
/** The name of the screen a React Navigation state shows: the focused route, followed into nested navigators. */
|
|
1004
1191
|
declare const activeRouteName: (state: unknown) => string | undefined;
|
|
1005
1192
|
|
|
1193
|
+
interface UseOnboarding {
|
|
1194
|
+
/** The item as MRRocket published it, or null while the config is loading, or when it is not live. */
|
|
1195
|
+
item: OnboardingFlow | null;
|
|
1196
|
+
/** Its steps (a tour's steps, a checklist's tasks, the questions), each with `done` (and a question's `answer`). */
|
|
1197
|
+
steps: OnboardingItemState["steps"];
|
|
1198
|
+
/** Every step is done. */
|
|
1199
|
+
done: boolean;
|
|
1200
|
+
/** The person closed it. */
|
|
1201
|
+
dismissed: boolean;
|
|
1202
|
+
/** Its moment has come for this person (the trigger MRRocket set, and who it is for). */
|
|
1203
|
+
eligible: boolean;
|
|
1204
|
+
/** Marks a step done (a tour step, a task). */
|
|
1205
|
+
complete(stepId: string): void;
|
|
1206
|
+
/** The person closed it; the item after it follows. */
|
|
1207
|
+
dismiss(): void;
|
|
1208
|
+
/** Answers a question (its step id or its key) with an option's id or a text; it is kept on the contact. */
|
|
1209
|
+
answer(question: string, value: string): void;
|
|
1210
|
+
/** Starts an item the SDK draws (the first live one without an id). */
|
|
1211
|
+
start(id?: string): boolean;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1006
1214
|
interface NativeAppearance {
|
|
1007
1215
|
theme?: "light" | "dark" | "auto";
|
|
1008
1216
|
accent?: string;
|
|
1009
1217
|
}
|
|
1010
|
-
|
|
1218
|
+
/** The dialogs, and (0.18.0) the finish animation over the app when someone just finished an item. */
|
|
1219
|
+
declare const MRRocketFlows: (props: {
|
|
1011
1220
|
flows: FlowsController;
|
|
1012
1221
|
paywall?: PaywallHost;
|
|
1013
1222
|
appearance?: NativeAppearance;
|
|
1014
|
-
}) => react.FunctionComponentElement<
|
|
1223
|
+
}) => react.FunctionComponentElement<react.FragmentProps>;
|
|
1015
1224
|
|
|
1016
1225
|
interface Palette {
|
|
1017
1226
|
accent: string;
|
|
@@ -1095,6 +1304,11 @@ declare const MRRocketMessenger: ({ client, appearance, options: given }: {
|
|
|
1095
1304
|
options?: NativeMessengerOptions;
|
|
1096
1305
|
}) => react.FunctionComponentElement<Record<string, unknown>> | null;
|
|
1097
1306
|
|
|
1307
|
+
/** An app with its own language switch says the language here; undefined goes back to the device's. Re-reads the config. */
|
|
1308
|
+
declare const setLocale: (locale?: string) => void;
|
|
1309
|
+
/** The app's choice, else the phone's (React Native), else the browser's. */
|
|
1310
|
+
declare const currentLocale: () => string | undefined;
|
|
1311
|
+
|
|
1098
1312
|
/**
|
|
1099
1313
|
* Hides what it wraps in session recordings: its area is painted black on every frame before the frame is stored. Use
|
|
1100
1314
|
* it for anything private on screen (balances, addresses, messages). Text fields need no wrapper: nothing is recorded
|
|
@@ -1209,10 +1423,16 @@ declare const usePaywall: () => {
|
|
|
1209
1423
|
declare const useReview: () => {
|
|
1210
1424
|
request: MRRocketClient["requestReview"];
|
|
1211
1425
|
};
|
|
1212
|
-
/**
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1426
|
+
/**
|
|
1427
|
+
* `start(id?)` starts an onboarding flow now (the first live one without an id), whatever its trigger. 0.18.0: with an
|
|
1428
|
+
* id, also the item you draw yourself ("Shown by: your code" in MRRocket): `item`, `steps` (each with `done`), `done`,
|
|
1429
|
+
* `complete(stepId)`, `dismiss()` and `answer(question, value)`; MRRocket still counts it and keeps the answers on the
|
|
1430
|
+
* contact.
|
|
1431
|
+
*
|
|
1432
|
+
* const { item, steps, done, complete } = useOnboarding("flow_123");
|
|
1433
|
+
* if (!item || done) return null;
|
|
1434
|
+
*/
|
|
1435
|
+
declare const useOnboarding: (id?: string) => UseOnboarding;
|
|
1216
1436
|
/** A feature flag from MRRocket › Build › Feature flags: true while it is on for this person; false while off, unknown or loading. */
|
|
1217
1437
|
declare const useFlag: (key: string) => boolean;
|
|
1218
1438
|
/** The variant of a multivariate flag ("control", "test" …), or null while it is off. */
|
|
@@ -1247,4 +1467,4 @@ declare const useExpoRouterTracking: () => void;
|
|
|
1247
1467
|
*/
|
|
1248
1468
|
declare const useNavigationTracking: () => (state: unknown) => void;
|
|
1249
1469
|
|
|
1250
|
-
export { type AppContext, type CancelFlowConfig, type CancelFlowOptions, type CancelFlowResult, type CancelOffer, type ChatMessage, type ChatThread, type CockpitConfig, type FeedbackPost, type FlagConfig, type FlowMedia, type FlowView, type IdentifyOptions, type InAppMessage, type KeyValueStorage, type MRRocketClient, MRRocketFeedback, MRRocketFlows, MRRocketMask, MRRocketMessenger, type MRRocketOptions, MRRocketProvider, type MRRocketProviderProps, MRRocketSurveys, type NativeAppearance, type NativeConsent, type NativeFeedbackOptions, type NativeMessengerOptions, type NativePushResult, type NativePushStatus, type NativeReviewResult, type OnboardingFlow, type OnboardingStep, type PaywallConfig, type PaywallOptions, type PaywallPage, type PaywallPlan, type PaywallResult, type RegisterForPushOptions, SDK_VERSION, type SurveyDefinition, type TourPlacement, type VariantId, activeRouteName, createMRRocket, getMRRocket, useCancelFlow, useExpoRouterTracking, useFeedback, useFlag, useFlagVariant, useMRRocket, useMessenger, useNavigationTracking, useOnboarding, usePaywall, usePush, useReview, useText, useVariant };
|
|
1470
|
+
export { type AppContext, type CancelFlowConfig, type CancelFlowOptions, type CancelFlowResult, type CancelOffer, type ChatMessage, type ChatThread, type CockpitConfig, type FeedbackPost, type FinishAnimation, type FlagConfig, type FlowIcon, type FlowMedia, type FlowView, type IdentifyOptions, type InAppMessage, type KeyValueStorage, type MRRocketClient, MRRocketFeedback, MRRocketFlows, MRRocketMask, MRRocketMessenger, type MRRocketOptions, MRRocketProvider, type MRRocketProviderProps, MRRocketSurveys, type NativeAppearance, type NativeConsent, type NativeFeedbackOptions, type NativeMessengerOptions, type NativePushResult, type NativePushStatus, type NativeReviewResult, type OnboardingFlow, type OnboardingItemState, type OnboardingQuestion, type OnboardingStep, type PaywallConfig, type PaywallOptions, type PaywallPage, type PaywallPlan, type PaywallResult, type RegisterForPushOptions, SDK_VERSION, type SurveyDefinition, type TaskOpens, type TourPlacement, type UseOnboarding, type VariantId, activeRouteName, createMRRocket, currentLocale, getMRRocket, setLocale, useCancelFlow, useExpoRouterTracking, useFeedback, useFlag, useFlagVariant, useMRRocket, useMessenger, useNavigationTracking, useOnboarding, usePaywall, usePush, useReview, useText, useVariant };
|