@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.
Files changed (69) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.md +24 -1
  3. package/dist/api-client.d.ts +28 -4
  4. package/dist/api-client.js +30 -13
  5. package/dist/api-client.js.map +1 -1
  6. package/dist/browser/mrrocket-flows.js +15 -3
  7. package/dist/browser/mrrocket-messenger.js +38 -5
  8. package/dist/browser/mrrocket.js +1 -1
  9. package/dist/browser.d.ts +2 -2
  10. package/dist/browser.js +2 -1
  11. package/dist/browser.js.map +1 -1
  12. package/dist/client.d.ts +28 -3
  13. package/dist/client.js +37 -5
  14. package/dist/client.js.map +1 -1
  15. package/dist/context.d.ts +3 -1
  16. package/dist/context.js.map +1 -1
  17. package/dist/core.d.ts +7 -1
  18. package/dist/core.js +1 -1
  19. package/dist/core.js.map +1 -1
  20. package/dist/feedback.js +161 -119
  21. package/dist/feedback.js.map +1 -1
  22. package/dist/finish-web.d.ts +18 -0
  23. package/dist/finish-web.js +139 -0
  24. package/dist/finish-web.js.map +1 -0
  25. package/dist/flows-ui.d.ts +1 -10
  26. package/dist/flows-ui.js +175 -48
  27. package/dist/flows-ui.js.map +1 -1
  28. package/dist/flows-web.d.ts +8 -1
  29. package/dist/flows-web.js +10 -1
  30. package/dist/flows-web.js.map +1 -1
  31. package/dist/flows.d.ts +193 -9
  32. package/dist/flows.js +284 -38
  33. package/dist/flows.js.map +1 -1
  34. package/dist/i18n.d.ts +22 -0
  35. package/dist/i18n.js +74 -0
  36. package/dist/i18n.js.map +1 -0
  37. package/dist/icons.d.ts +24 -0
  38. package/dist/icons.js +61 -0
  39. package/dist/icons.js.map +1 -0
  40. package/dist/index.d.ts +6 -2
  41. package/dist/index.js +8 -0
  42. package/dist/index.js.map +1 -1
  43. package/dist/messenger-ui.d.ts +9 -3
  44. package/dist/messenger-ui.js +388 -191
  45. package/dist/messenger-ui.js.map +1 -1
  46. package/dist/messenger.d.ts +3 -1
  47. package/dist/messenger.js +3 -2
  48. package/dist/messenger.js.map +1 -1
  49. package/dist/onboarding-state.d.ts +23 -0
  50. package/dist/onboarding-state.js +43 -0
  51. package/dist/onboarding-state.js.map +1 -0
  52. package/dist/paywall.js +2 -1
  53. package/dist/paywall.js.map +1 -1
  54. package/dist/react-native/index.d.cts +239 -19
  55. package/dist/react-native/index.d.ts +239 -19
  56. package/dist/react-native/index.js +1305 -518
  57. package/dist/react-native/index.js.map +1 -1
  58. package/dist/server.d.ts +4 -2
  59. package/dist/server.js +2 -2
  60. package/dist/server.js.map +1 -1
  61. package/dist/styles-css.d.ts +1 -1
  62. package/dist/styles-css.js +35 -2
  63. package/dist/styles-css.js.map +1 -1
  64. package/dist/survey.js +18 -14
  65. package/dist/survey.js.map +1 -1
  66. package/dist/ui.d.ts +2 -0
  67. package/dist/ui.js +15 -12
  68. package/dist/ui.js.map +1 -1
  69. package/package.json +6 -3
package/dist/icons.js ADDED
@@ -0,0 +1,61 @@
1
+ // src/icons.ts
2
+ var FLOW_ICONS = {
3
+ check: { label: "Check", paths: ["M5 12.5l4.5 4.5L19 7.5"], emoji: "\u2705" },
4
+ star: { label: "Star", paths: ["M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z"], emoji: "\u2B50" },
5
+ rocket: {
6
+ label: "Rocket",
7
+ paths: ["M12 3c3 2 4.5 5.5 4 10l-2 3h-4l-2-3c-.5-4.5 1-8 4-10z", "M8 13.5l-3 3 3.5.5", "M16 13.5l3 3-3.5.5", "M13.5 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z", "M11 19.5v1.5M13 19.5v1.5"],
8
+ emoji: "\u{1F680}"
9
+ },
10
+ user: { label: "Person", paths: ["M15.5 8a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z", "M5 20c.8-3.5 3.6-5.5 7-5.5s6.2 2 7 5.5"], emoji: "\u{1F464}" },
11
+ users: {
12
+ label: "Team",
13
+ paths: ["M13 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z", "M3.5 19c.6-3 3-4.8 6.5-4.8s5.9 1.8 6.5 4.8", "M16 5.2a3 3 0 0 1 0 5.6", "M18 14.6c1.5.6 2.4 2 2.7 4.4"],
14
+ emoji: "\u{1F465}"
15
+ },
16
+ settings: {
17
+ label: "Settings",
18
+ paths: ["M12 2.8v2.4M12 18.8v2.4M2.8 12h2.4M18.8 12h2.4M5.5 5.5l1.7 1.7M16.8 16.8l1.7 1.7M5.5 18.5l1.7-1.7M16.8 7.2l1.7-1.7", "M17 12a5 5 0 1 1-10 0 5 5 0 0 1 10 0z", "M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"],
19
+ emoji: "\u2699\uFE0F"
20
+ },
21
+ bell: { label: "Bell", paths: ["M6 16v-5a6 6 0 0 1 12 0v5l1.5 2h-15z", "M10 20.5a2 2 0 0 0 4 0"], emoji: "\u{1F514}" },
22
+ mail: { label: "Mail", paths: ["M4 6h16v12H4z", "M4 7l8 6 8-6"], emoji: "\u2709\uFE0F" },
23
+ chat: { label: "Chat", paths: ["M4 5h16v11H9l-5 4z"], emoji: "\u{1F4AC}" },
24
+ heart: { label: "Heart", paths: ["M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"], emoji: "\u2764\uFE0F" },
25
+ flag: { label: "Flag", paths: ["M5 21V4", "M5 4h11l-2 4 2 4H5"], emoji: "\u{1F6A9}" },
26
+ bolt: { label: "Bolt", paths: ["M13 3L5 13.5h6L10 21l8-10.5h-6z"], emoji: "\u26A1" },
27
+ book: { label: "Book", paths: ["M4 5.5C6.5 4 9.5 4 12 6c2.5-2 5.5-2 8-.5V19c-2.5-1.5-5.5-1.5-8 .5-2.5-2-5.5-2-8-.5z", "M12 6v13.5"], emoji: "\u{1F4D6}" },
28
+ calendar: { label: "Calendar", paths: ["M4 6h16v14H4z", "M4 10h16", "M8 3.5v4M16 3.5v4"], emoji: "\u{1F4C5}" },
29
+ camera: { label: "Camera", paths: ["M4 8h3.5L9 5.5h6L16.5 8H20v11H4z", "M15.5 13a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z"], emoji: "\u{1F4F7}" },
30
+ cart: { label: "Cart", paths: ["M3.5 4.5H6l2 10h10l2-7H7", "M9.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z", "M18.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"], emoji: "\u{1F6D2}" },
31
+ chart: { label: "Chart", paths: ["M4 20h16", "M7 16v-4M12 16V8M17 16V9"], emoji: "\u{1F4CA}" },
32
+ gift: { label: "Gift", paths: ["M4 10h16v10H4z", "M3 7h18v3H3z", "M12 7v13", "M12 7c-1.5-3-5-3-5-1s3.5 1 5 1z", "M12 7c1.5-3 5-3 5-1s-3.5 1-5 1z"], emoji: "\u{1F381}" },
33
+ home: { label: "Home", paths: ["M4 11l8-7 8 7", "M6 9.5V20h12V9.5", "M10 20v-6h4v6"], emoji: "\u{1F3E0}" },
34
+ link: { label: "Link", paths: ["M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1", "M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"], emoji: "\u{1F517}" },
35
+ lock: { label: "Lock", paths: ["M6 11h12v9H6z", "M8.5 11V8a3.5 3.5 0 0 1 7 0v3"], emoji: "\u{1F512}" },
36
+ pencil: { label: "Pencil", paths: ["M4 20l1-4L16 5l3 3L8 19z", "M14 7l3 3"], emoji: "\u270F\uFE0F" },
37
+ plus: { label: "Plus", paths: ["M12 5v14M5 12h14"], emoji: "\u2795" },
38
+ search: { label: "Search", paths: ["M16 10.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z", "M14.5 14.5L20 20"], emoji: "\u{1F50D}" },
39
+ upload: { label: "Upload", paths: ["M12 15V4", "M7.5 8.5L12 4l4.5 4.5", "M4 15v5h16v-5"], emoji: "\u2B06\uFE0F" },
40
+ play: { label: "Play", paths: ["M8 5l11 7-11 7z"], emoji: "\u25B6\uFE0F" },
41
+ sparkle: { label: "Sparkle", paths: ["M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z", "M19 16l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7z"], emoji: "\u2728" },
42
+ globe: {
43
+ label: "Globe",
44
+ paths: ["M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0z", "M4 12h16", "M12 4c2.2 2.2 3.3 4.9 3.3 8s-1.1 5.8-3.3 8c-2.2-2.2-3.3-4.9-3.3-8S9.8 6.2 12 4z"],
45
+ emoji: "\u{1F310}"
46
+ }
47
+ };
48
+ var FLOW_ICON_NAMES = Object.keys(FLOW_ICONS);
49
+ var iconOf = (icon) => {
50
+ if (!icon) return void 0;
51
+ if (icon.kind === "builtin") return icon.name && FLOW_ICONS[icon.name] ? icon : void 0;
52
+ if (icon.kind === "emoji") return icon.value && icon.value.trim() && [...icon.value.trim()].length <= 8 ? icon : void 0;
53
+ if (icon.kind === "image") return icon.url && /^https?:\/\//i.test(icon.url) ? icon : void 0;
54
+ return void 0;
55
+ };
56
+ export {
57
+ FLOW_ICONS,
58
+ FLOW_ICON_NAMES,
59
+ iconOf
60
+ };
61
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/icons.ts"],"sourcesContent":["/**\n * 0.18.0: the SDK's own small line icons for checklist tasks and the heading of a modal or the questions\n * (`FlowIcon { kind: \"builtin\", name }`). Drawn by the SDK itself (an inline SVG on the web, react-native-svg in apps,\n * the emoji when an app has no react-native-svg), and by MRRocket's editor from this same list, so what the owner picks\n * is what people see. Each is a 24×24 outline, stroked at 2 with round ends, in the text color or the accent.\n */\n\nexport interface BuiltinIcon {\n /** What the editor calls it. */\n label: string;\n /** Path data, drawn stroked (no fill), on a 24×24 grid. */\n paths: string[];\n /** Shown instead in an app without react-native-svg. */\n emoji: string;\n}\n\nexport const FLOW_ICONS: Record<string, BuiltinIcon> = {\n check: { label: \"Check\", paths: [\"M5 12.5l4.5 4.5L19 7.5\"], emoji: \"✅\" },\n star: { label: \"Star\", paths: [\"M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z\"], emoji: \"⭐\" },\n rocket: {\n label: \"Rocket\",\n paths: [\"M12 3c3 2 4.5 5.5 4 10l-2 3h-4l-2-3c-.5-4.5 1-8 4-10z\", \"M8 13.5l-3 3 3.5.5\", \"M16 13.5l3 3-3.5.5\", \"M13.5 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z\", \"M11 19.5v1.5M13 19.5v1.5\"],\n emoji: \"🚀\",\n },\n user: { label: \"Person\", paths: [\"M15.5 8a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z\", \"M5 20c.8-3.5 3.6-5.5 7-5.5s6.2 2 7 5.5\"], emoji: \"👤\" },\n users: {\n label: \"Team\",\n paths: [\"M13 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z\", \"M3.5 19c.6-3 3-4.8 6.5-4.8s5.9 1.8 6.5 4.8\", \"M16 5.2a3 3 0 0 1 0 5.6\", \"M18 14.6c1.5.6 2.4 2 2.7 4.4\"],\n emoji: \"👥\",\n },\n settings: {\n label: \"Settings\",\n paths: [\"M12 2.8v2.4M12 18.8v2.4M2.8 12h2.4M18.8 12h2.4M5.5 5.5l1.7 1.7M16.8 16.8l1.7 1.7M5.5 18.5l1.7-1.7M16.8 7.2l1.7-1.7\", \"M17 12a5 5 0 1 1-10 0 5 5 0 0 1 10 0z\", \"M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0z\"],\n emoji: \"⚙️\",\n },\n bell: { label: \"Bell\", paths: [\"M6 16v-5a6 6 0 0 1 12 0v5l1.5 2h-15z\", \"M10 20.5a2 2 0 0 0 4 0\"], emoji: \"🔔\" },\n mail: { label: \"Mail\", paths: [\"M4 6h16v12H4z\", \"M4 7l8 6 8-6\"], emoji: \"✉️\" },\n chat: { label: \"Chat\", paths: [\"M4 5h16v11H9l-5 4z\"], emoji: \"💬\" },\n heart: { label: \"Heart\", paths: [\"M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z\"], emoji: \"❤️\" },\n flag: { label: \"Flag\", paths: [\"M5 21V4\", \"M5 4h11l-2 4 2 4H5\"], emoji: \"🚩\" },\n bolt: { label: \"Bolt\", paths: [\"M13 3L5 13.5h6L10 21l8-10.5h-6z\"], emoji: \"⚡\" },\n book: { label: \"Book\", paths: [\"M4 5.5C6.5 4 9.5 4 12 6c2.5-2 5.5-2 8-.5V19c-2.5-1.5-5.5-1.5-8 .5-2.5-2-5.5-2-8-.5z\", \"M12 6v13.5\"], emoji: \"📖\" },\n calendar: { label: \"Calendar\", paths: [\"M4 6h16v14H4z\", \"M4 10h16\", \"M8 3.5v4M16 3.5v4\"], emoji: \"📅\" },\n camera: { label: \"Camera\", paths: [\"M4 8h3.5L9 5.5h6L16.5 8H20v11H4z\", \"M15.5 13a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z\"], emoji: \"📷\" },\n cart: { label: \"Cart\", paths: [\"M3.5 4.5H6l2 10h10l2-7H7\", \"M9.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z\", \"M18.5 19.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z\"], emoji: \"🛒\" },\n chart: { label: \"Chart\", paths: [\"M4 20h16\", \"M7 16v-4M12 16V8M17 16V9\"], emoji: \"📊\" },\n gift: { label: \"Gift\", paths: [\"M4 10h16v10H4z\", \"M3 7h18v3H3z\", \"M12 7v13\", \"M12 7c-1.5-3-5-3-5-1s3.5 1 5 1z\", \"M12 7c1.5-3 5-3 5-1s-3.5 1-5 1z\"], emoji: \"🎁\" },\n home: { label: \"Home\", paths: [\"M4 11l8-7 8 7\", \"M6 9.5V20h12V9.5\", \"M10 20v-6h4v6\"], emoji: \"🏠\" },\n link: { label: \"Link\", paths: [\"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1\", \"M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1\"], emoji: \"🔗\" },\n lock: { label: \"Lock\", paths: [\"M6 11h12v9H6z\", \"M8.5 11V8a3.5 3.5 0 0 1 7 0v3\"], emoji: \"🔒\" },\n pencil: { label: \"Pencil\", paths: [\"M4 20l1-4L16 5l3 3L8 19z\", \"M14 7l3 3\"], emoji: \"✏️\" },\n plus: { label: \"Plus\", paths: [\"M12 5v14M5 12h14\"], emoji: \"➕\" },\n search: { label: \"Search\", paths: [\"M16 10.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z\", \"M14.5 14.5L20 20\"], emoji: \"🔍\" },\n upload: { label: \"Upload\", paths: [\"M12 15V4\", \"M7.5 8.5L12 4l4.5 4.5\", \"M4 15v5h16v-5\"], emoji: \"⬆️\" },\n play: { label: \"Play\", paths: [\"M8 5l11 7-11 7z\"], emoji: \"▶️\" },\n sparkle: { label: \"Sparkle\", paths: [\"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z\", \"M19 16l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7z\"], emoji: \"✨\" },\n globe: {\n label: \"Globe\",\n paths: [\"M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0z\", \"M4 12h16\", \"M12 4c2.2 2.2 3.3 4.9 3.3 8s-1.1 5.8-3.3 8c-2.2-2.2-3.3-4.9-3.3-8S9.8 6.2 12 4z\"],\n emoji: \"🌐\",\n },\n};\n\n/** The built-in icons' names, in the editor's order. */\nexport const FLOW_ICON_NAMES = Object.keys(FLOW_ICONS);\n\n/** An icon as it may be shown: a known built-in, an emoji (up to 8 code points, so joined ones fit), or an http(s) picture; else undefined. */\nexport const iconOf = <T extends { kind: string; name?: string; value?: string; url?: string }>(icon: T | undefined): T | undefined => {\n if (!icon) return undefined;\n if (icon.kind === \"builtin\") return icon.name && FLOW_ICONS[icon.name] ? icon : undefined;\n if (icon.kind === \"emoji\") return icon.value && icon.value.trim() && [...icon.value.trim()].length <= 8 ? icon : undefined;\n if (icon.kind === \"image\") return icon.url && /^https?:\\/\\//i.test(icon.url) ? icon : undefined;\n return undefined;\n};\n"],"mappings":"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","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,13 @@
1
- export { type ChangelogEntry, type ChatMessage, type ChatThread, type CockpitProviderProps, type CockpitUser, type FeedbackBoardInfo, type FeedbackBoardProps, type FeedbackComment, type FeedbackList, type FeedbackPost, type FeedbackRoadmap, type FeedbackWidgetProps, type MessengerProps, type PostStatus, type SurveyAnswer, type SurveyDefinition, type SurveyQuestion, type SurveyQuestionKind, CockpitProvider, Experiment, FeedbackBoard, FeedbackWidget, Messenger, Survey, Text, WIDGET_CSS, createApi, useCancelFlow, useCockpit, useFeedback, useFlag, useFlagVariant, useMessenger, usePaywall, usePush, useStyles, useVariant, } from "./browser.js";
1
+ export { type ChangelogEntry, type ChatMessage, type ChatSummary, type ChatThread, type CockpitProviderProps, type CockpitUser, type FeedbackBoardInfo, type FeedbackBoardProps, type FeedbackComment, type FeedbackList, type FeedbackPost, type FeedbackRoadmap, type FeedbackWidgetProps, type MessengerProps, type PostStatus, type SurveyAnswer, type SurveyDefinition, type SurveyQuestion, type SurveyQuestionKind, CockpitProvider, Experiment, FeedbackBoard, FeedbackWidget, Messenger, Survey, Text, WIDGET_CSS, createApi, useCancelFlow, useCockpit, useFeedback, useFlag, useFlagVariant, useMessenger, useOnboarding, usePaywall, usePush, useStyles, useVariant, } from "./browser.js";
2
2
  export type { PushResult, PushStatus, WebPushOptions } from "./push-web.js";
3
+ /** 0.21.0: the language of the SDK's words, for an app with its own language switch. */
4
+ export { currentLocale, setLocale } from "./i18n.js";
3
5
  /** `identify(id, props, { hash })` (0.16.0); the hash comes from `userHash()` in `@mrrocket/sdk/next/server`. */
4
6
  export type { IdentifyOptions } from "./identity.js";
5
7
  export { type CockpitConfig, type CockpitEvent, type ConsentChoice, type ConsentMode, type ReplayConfig, type ErrorReport, type ExperimentConfig, type FlagCondition, type FlagConditionSet, type FlagConfig, type FlagPerson, type RedirectConfig, type RedirectDecision, type VariantConfig, type VariantId, EMBED_PARAM, EXPOSURE_PARAM, SDK_VERSION, ID_COOKIE, PREVIEW_PARAM, SESSION_COOKIE, assign, evaluateFlag, parsePreview, previewHref, redirectFor, } from "./core.js";
6
- export { type CancelFlowConfig, type CancelFlowOptions, type CancelFlowResult, type CancelOffer, type InAppMessage, type OnboardingFlow, type OnboardingStep, type FlowMedia, type TourPlacement, videoEmbed, } from "./flows.js";
8
+ export { type CancelFlowConfig, type CancelFlowOptions, type CancelFlowResult, type CancelOffer, type InAppMessage, type OnboardingFlow, type OnboardingStep, type FlowMedia, type TourPlacement, type TaskOpens, type FlowIcon, type FinishAnimation, type OnboardingQuestion, type OnboardingItemState, videoEmbed, } from "./flows.js";
9
+ export type { UseOnboarding } from "./onboarding-state.js";
10
+ export { FLOW_ICONS, FLOW_ICON_NAMES, type BuiltinIcon } from "./icons.js";
7
11
  export type { FlowsTheme } from "./flows-ui.js";
8
12
  export { PAYWALL_EVENT, type PaywallConfig, type PaywallOptions, type PaywallPage, type PaywallPlan, type PaywallResult } from "./paywall.js";
9
13
  export { type AttributionMode, type CheckoutReferral, type Referral, REFERRAL_COOKIE, getReferral, readReferralCookie, referralForCheckout, referralLink, } from "./referral.js";
package/dist/index.js CHANGED
@@ -15,11 +15,13 @@ import {
15
15
  useFlag,
16
16
  useFlagVariant,
17
17
  useMessenger,
18
+ useOnboarding,
18
19
  usePaywall,
19
20
  usePush,
20
21
  useStyles,
21
22
  useVariant
22
23
  } from "./browser.js";
24
+ import { currentLocale, setLocale } from "./i18n.js";
23
25
  import {
24
26
  EMBED_PARAM,
25
27
  EXPOSURE_PARAM,
@@ -36,6 +38,7 @@ import {
36
38
  import {
37
39
  videoEmbed
38
40
  } from "./flows.js";
41
+ import { FLOW_ICONS, FLOW_ICON_NAMES } from "./icons.js";
39
42
  import { PAYWALL_EVENT } from "./paywall.js";
40
43
  import {
41
44
  REFERRAL_COOKIE,
@@ -49,6 +52,8 @@ export {
49
52
  EMBED_PARAM,
50
53
  EXPOSURE_PARAM,
51
54
  Experiment,
55
+ FLOW_ICONS,
56
+ FLOW_ICON_NAMES,
52
57
  FeedbackBoard,
53
58
  FeedbackWidget,
54
59
  ID_COOKIE,
@@ -63,6 +68,7 @@ export {
63
68
  WIDGET_CSS,
64
69
  assign,
65
70
  createApi,
71
+ currentLocale,
66
72
  evaluateFlag,
67
73
  getReferral,
68
74
  parsePreview,
@@ -71,12 +77,14 @@ export {
71
77
  redirectFor,
72
78
  referralForCheckout,
73
79
  referralLink,
80
+ setLocale,
74
81
  useCancelFlow,
75
82
  useCockpit,
76
83
  useFeedback,
77
84
  useFlag,
78
85
  useFlagVariant,
79
86
  useMessenger,
87
+ useOnboarding,
80
88
  usePaywall,
81
89
  usePush,
82
90
  useStyles,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n type ChangelogEntry,\n type ChatMessage,\n type ChatThread,\n type CockpitProviderProps,\n type CockpitUser,\n type FeedbackBoardInfo,\n type FeedbackBoardProps,\n type FeedbackComment,\n type FeedbackList,\n type FeedbackPost,\n type FeedbackRoadmap,\n type FeedbackWidgetProps,\n type MessengerProps,\n type PostStatus,\n type SurveyAnswer,\n type SurveyDefinition,\n type SurveyQuestion,\n type SurveyQuestionKind,\n CockpitProvider,\n Experiment,\n FeedbackBoard,\n FeedbackWidget,\n Messenger,\n Survey,\n Text,\n WIDGET_CSS,\n createApi,\n useCancelFlow,\n useCockpit,\n useFeedback,\n useFlag,\n useFlagVariant,\n useMessenger,\n usePaywall,\n usePush,\n useStyles,\n useVariant,\n} from \"./browser\";\nexport type { PushResult, PushStatus, WebPushOptions } from \"./push-web\";\n/** `identify(id, props, { hash })` (0.16.0); the hash comes from `userHash()` in `@mrrocket/sdk/next/server`. */\nexport type { IdentifyOptions } from \"./identity\";\nexport {\n type CockpitConfig,\n type CockpitEvent,\n type ConsentChoice,\n type ConsentMode,\n type ReplayConfig,\n type ErrorReport,\n type ExperimentConfig,\n type FlagCondition,\n type FlagConditionSet,\n type FlagConfig,\n type FlagPerson,\n type RedirectConfig,\n type RedirectDecision,\n type VariantConfig,\n type VariantId,\n EMBED_PARAM,\n EXPOSURE_PARAM,\n SDK_VERSION,\n ID_COOKIE,\n PREVIEW_PARAM,\n SESSION_COOKIE,\n assign,\n evaluateFlag,\n parsePreview,\n previewHref,\n redirectFor,\n} from \"./core\";\nexport {\n type CancelFlowConfig,\n type CancelFlowOptions,\n type CancelFlowResult,\n type CancelOffer,\n type InAppMessage,\n type OnboardingFlow,\n type OnboardingStep,\n type FlowMedia,\n type TourPlacement,\n videoEmbed,\n} from \"./flows\";\nexport type { FlowsTheme } from \"./flows-ui\";\nexport { PAYWALL_EVENT, type PaywallConfig, type PaywallOptions, type PaywallPage, type PaywallPlan, type PaywallResult } from \"./paywall\";\nexport {\n type AttributionMode,\n type CheckoutReferral,\n type Referral,\n REFERRAL_COOKIE,\n getReferral,\n readReferralCookie,\n referralForCheckout,\n referralLink,\n} from \"./referral\";\n"],"mappings":";AAAA;AAAA,EAmBI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAIP;AAAA,EAgBI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EAUI;AAAA,OACG;AAEP,SAAS,qBAAsH;AAC/H;AAAA,EAII;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n type ChangelogEntry,\n type ChatMessage,\n type ChatSummary,\n type ChatThread,\n type CockpitProviderProps,\n type CockpitUser,\n type FeedbackBoardInfo,\n type FeedbackBoardProps,\n type FeedbackComment,\n type FeedbackList,\n type FeedbackPost,\n type FeedbackRoadmap,\n type FeedbackWidgetProps,\n type MessengerProps,\n type PostStatus,\n type SurveyAnswer,\n type SurveyDefinition,\n type SurveyQuestion,\n type SurveyQuestionKind,\n CockpitProvider,\n Experiment,\n FeedbackBoard,\n FeedbackWidget,\n Messenger,\n Survey,\n Text,\n WIDGET_CSS,\n createApi,\n useCancelFlow,\n useCockpit,\n useFeedback,\n useFlag,\n useFlagVariant,\n useMessenger,\n useOnboarding,\n usePaywall,\n usePush,\n useStyles,\n useVariant,\n} from \"./browser\";\nexport type { PushResult, PushStatus, WebPushOptions } from \"./push-web\";\n/** 0.21.0: the language of the SDK's words, for an app with its own language switch. */\nexport { currentLocale, setLocale } from \"./i18n\";\n/** `identify(id, props, { hash })` (0.16.0); the hash comes from `userHash()` in `@mrrocket/sdk/next/server`. */\nexport type { IdentifyOptions } from \"./identity\";\nexport {\n type CockpitConfig,\n type CockpitEvent,\n type ConsentChoice,\n type ConsentMode,\n type ReplayConfig,\n type ErrorReport,\n type ExperimentConfig,\n type FlagCondition,\n type FlagConditionSet,\n type FlagConfig,\n type FlagPerson,\n type RedirectConfig,\n type RedirectDecision,\n type VariantConfig,\n type VariantId,\n EMBED_PARAM,\n EXPOSURE_PARAM,\n SDK_VERSION,\n ID_COOKIE,\n PREVIEW_PARAM,\n SESSION_COOKIE,\n assign,\n evaluateFlag,\n parsePreview,\n previewHref,\n redirectFor,\n} from \"./core\";\nexport {\n type CancelFlowConfig,\n type CancelFlowOptions,\n type CancelFlowResult,\n type CancelOffer,\n type InAppMessage,\n type OnboardingFlow,\n type OnboardingStep,\n type FlowMedia,\n type TourPlacement,\n type TaskOpens,\n type FlowIcon,\n type FinishAnimation,\n type OnboardingQuestion,\n type OnboardingItemState,\n videoEmbed,\n} from \"./flows\";\nexport type { UseOnboarding } from \"./onboarding-state\";\nexport { FLOW_ICONS, FLOW_ICON_NAMES, type BuiltinIcon } from \"./icons\";\nexport type { FlowsTheme } from \"./flows-ui\";\nexport { PAYWALL_EVENT, type PaywallConfig, type PaywallOptions, type PaywallPage, type PaywallPlan, type PaywallResult } from \"./paywall\";\nexport {\n type AttributionMode,\n type CheckoutReferral,\n type Referral,\n REFERRAL_COOKIE,\n getReferral,\n readReferralCookie,\n referralForCheckout,\n referralLink,\n} from \"./referral\";\n"],"mappings":";AAAA;AAAA,EAoBI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAGP,SAAS,eAAe,iBAAiB;AAGzC;AAAA,EAgBI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EAeI;AAAA,OACG;AAEP,SAAS,YAAY,uBAAyC;AAE9D,SAAS,qBAAsH;AAC/H;AAAA,EAII;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;","names":[]}
@@ -7,6 +7,9 @@
7
7
  * count on the launcher and a preview card above it. Opening, closing, switching and new messages move softly
8
8
  * (none of it with reduced motion).
9
9
  *
10
+ * A visitor can have several conversations (0.19): Home's "Ask a question" starts a new one, the field inside a chat
11
+ * answers in that chat, and Home and Messages list the others.
12
+ *
10
13
  * Plain DOM, no React, so `<Messenger />` (Next.js) and the script tag share it; both load it only when it is used (a
11
14
  * dynamic import, and `sdk-messenger.js` for the script tag). Every text is set with textContent; articles arrive as
12
15
  * blocks, never HTML.
@@ -41,6 +44,8 @@ export interface MessengerUiOptions {
41
44
  replyTime?: "minutes" | "hours" | "day";
42
45
  /** The Help tab with the product's published help articles (default true; hidden while there are none). */
43
46
  help?: boolean;
47
+ /** The Updates tab with your published changelog (default true; hidden while there are none). */
48
+ updates?: boolean;
44
49
  /** A short sound when an answer arrives (default true). */
45
50
  sound?: boolean;
46
51
  /** A preview of a new answer above the closed launcher (default true). */
@@ -73,8 +78,8 @@ export interface MessengerUiOptions {
73
78
  opened?: MessengerView;
74
79
  }
75
80
  /** What the messenger asks the server (createApi's part it uses). */
76
- export type MessengerClient = Pick<Api, "chat" | "sendChat" | "uploadChatFile" | "attachmentUrl" | "articles" | "article" | "rateArticle" | "messengerLook">;
77
- export type MessengerView = "home" | "messages" | "help";
81
+ export type MessengerClient = Pick<Api, "chat" | "sendChat" | "uploadChatFile" | "attachmentUrl" | "articles" | "article" | "rateArticle" | "messengerLook" | "changelog">;
82
+ export type MessengerView = "home" | "messages" | "help" | "updates";
78
83
  export interface MessengerHandle {
79
84
  /** Opens the panel, on Home or the given tab; `{ article }` opens a help article. */
80
85
  open(view?: MessengerView | {
@@ -89,6 +94,7 @@ export interface MessengerHandle {
89
94
  * Mounts the messenger with its look from MRRocket (Support › Messenger) underneath what the code passes: an option the
90
95
  * code sets wins, one it leaves out comes from MRRocket, then the default. Calls made before the look arrived wait.
91
96
  * A repeat visit starts with the look this browser saw last; a look that arrives later than that (changed, or slower
92
- * than LOOK_WAIT_MS) replaces the launcher while the panel is closed, or once it closes.
97
+ * than LOOK_WAIT_MS) replaces the launcher while the panel is closed, or once it closes. New words or another language
98
+ * do the same: the messenger is built anew, with the look read again in another language.
93
99
  */
94
100
  export declare const mountMessenger: (o: MessengerUiOptions) => MessengerHandle;