@guidelytech/react-native 0.10.0 → 0.11.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/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { SelectorStrategy, MessengerConfig, MessengerMessage, MessengerConversation, SdkArticlesResponse, ResourceCenterArticle, PublishedGuide, ProjectTheme, GuideStep, SdkConfigResponse, ChecklistTask, SdkEvent, TargetingContext, StepButton, ResourceCenterConfig, Placement } from '@guidelytech/shared';
4
- export { GuideStep, PublishedGuide, SdkConfigResponse } from '@guidelytech/shared';
3
+ import { SelectorStrategy, AutocaptureSettings, HeatmapPoint, MessengerConfig, MessengerMessage, MessengerConversation, SdkArticlesResponse, ResourceCenterArticle, PublishedGuide, ProjectTheme, GuideStep, SdkConfigResponse, ChecklistTask, SdkEvent, TargetingContext, StepButton, ResourceCenterConfig, RuleGroup, ResourceCenterAnnouncement, Placement } from '@guidelytech/shared';
4
+ export { AutocaptureSettings, GuideStep, HeatmapPoint, PublishedGuide, SdkConfigResponse } from '@guidelytech/shared';
5
5
  import { FlagsClientOptions, FlagsClient, JsonValue, FlagValue, FlagDetails, FlagsBootstrap, Attributes } from '@guidelytech/flags';
6
6
  export { Attributes, EvaluationResult, FlagDetails, FlagsBootstrap, FlagsClient, FlagsClientOptions, FlagsPayload, InMemoryStickyBucketStore, JsonValue, createFlagsClient } from '@guidelytech/flags';
7
+ import { ResourceCenterModuleId } from '@guidelytech/shared/runtime';
7
8
  import { KeyValueStore, ServerHealth, ChecklistProgressState, GuidelyEnvironment, ConsentState, GuidelyUser, GuidelyAccount, GuideLocalState, SessionState } from '@guidelytech/sdk-core/headless';
8
9
  export { ChecklistProgressState, ConsentState, GuidelyAccount, GuidelyEnvironment, GuidelyUser } from '@guidelytech/sdk-core/headless';
9
10
  import { ViewProps, StyleProp, ViewStyle, View, GestureResponderEvent } from 'react-native';
@@ -50,6 +51,15 @@ declare class TargetRegistry {
50
51
  /** Frame of a visible target (the most recently mounted visible one when an id is used twice), else null. */
51
52
  measure(id: string): Promise<Rect | null>;
52
53
  private measureHandle;
54
+ /**
55
+ * The registered target on the current screen whose visible frame contains the point (window
56
+ * coordinates); the smallest one when targets are nested. Frames that do not answer within
57
+ * `timeoutMs` are skipped.
58
+ */
59
+ hitTest(x: number, y: number, timeoutMs?: number): Promise<{
60
+ id: string;
61
+ rect: Rect;
62
+ } | null>;
53
63
  /** First of `ids` that is mounted and visible. */
54
64
  resolve(ids: string[]): Promise<{
55
65
  id: string;
@@ -67,6 +77,88 @@ declare class TargetRegistry {
67
77
 
68
78
  type GuideStatus = "idle" | "running" | "waiting_url" | "waiting_target" | "ended";
69
79
 
80
+ /** `autocapture` option: `false` turns every capability off, an object turns single ones off. */
81
+ type AutocaptureOption = boolean | Partial<AutocaptureSettings>;
82
+ /** The element a tap resolved to (or the view it hit), as `click` properties need it. */
83
+ interface TapElement {
84
+ selector: string;
85
+ /** Component / host name (`Pressable`, `TouchableOpacity`, `Text`, `View`). */
86
+ tag: string;
87
+ /** Visible label; already empty for text fields and masked content. */
88
+ text?: string;
89
+ /** Window frame of the element, for the position inside it (heatmaps). */
90
+ measure?: () => Promise<Rect | null>;
91
+ }
92
+ /** One observed tap, reported by the provider's touch observer. */
93
+ interface TapInfo {
94
+ /** Window coordinates in points. */
95
+ x: number;
96
+ y: number;
97
+ /** When the tap ended (ms since epoch); defaults to now. */
98
+ t?: number;
99
+ /** Innermost interactive element under the tap (touchable, `Pressable`, `accessibilityRole="button"`…), if found. */
100
+ element?: TapElement | null;
101
+ /** The view the tap hit, used for rage taps and heatmaps when there is no interactive element. */
102
+ hit?: TapElement | null;
103
+ }
104
+ /** `click` / `rage_click` properties on mobile (`ClickProperties` on the web plus `platform`). */
105
+ interface TapProperties {
106
+ selector: string;
107
+ tag: string;
108
+ text?: string;
109
+ x: number;
110
+ y: number;
111
+ platform: string;
112
+ count?: number;
113
+ }
114
+ /**
115
+ * Detects rage taps: 3+ taps within 1s (each within 1s of the previous) and 30pt of the burst's
116
+ * first tap, reported once per burst. Same semantics as the web SDK's `RageClickDetector`
117
+ * (conformance vectors: `rageClicks` in `mobile/conformance/vectors.json`).
118
+ */
119
+ declare class RageClickDetector {
120
+ private readonly threshold;
121
+ private readonly windowMs;
122
+ private readonly radius;
123
+ private clicks;
124
+ private fired;
125
+ constructor(threshold?: number, windowMs?: number, radius?: number);
126
+ /** Taps in the current burst once it has fired (rage), otherwise 0. */
127
+ get burst(): number;
128
+ /** Records a tap; returns the tap count when it completes a burst, otherwise 0. */
129
+ add(x: number, y: number, t: number): number;
130
+ }
131
+ /** Tap positions on the current screen, sent as one `heatmap` event per batch (40 points, screen change, background). */
132
+ declare class HeatmapBuffer {
133
+ /** Screen path the buffered points belong to. */
134
+ url: string;
135
+ points: HeatmapPoint[];
136
+ /** Adds a tap (`burst` > 0 marks it and the burst's previous taps as rage); true when the batch is full. */
137
+ add(url: string, point: HeatmapPoint, burst: number): boolean;
138
+ /** Empties the buffer, returning what was in it. */
139
+ take(): {
140
+ url: string;
141
+ points: HeatmapPoint[];
142
+ } | null;
143
+ }
144
+ /**
145
+ * Tracks one primary-pointer touch and decides whether it was a tap. Feed it the touch events the
146
+ * provider observes; `end` returns the tap position (window points) or null.
147
+ */
148
+ declare class TapTracker {
149
+ private start;
150
+ private moved;
151
+ /** A finger went down. A second finger while one is tracked cancels the gesture (not a tap). */
152
+ begin(x: number, y: number, t: number, touches: number, id?: unknown): void;
153
+ move(x: number, y: number, id?: unknown): void;
154
+ /** The finger lifted: the tap position when it moved ≤ 10pt and lasted < 1s, else null. */
155
+ end(x: number, y: number, t: number, id?: unknown): {
156
+ x: number;
157
+ y: number;
158
+ } | null;
159
+ cancel(): void;
160
+ }
161
+
70
162
  /**
71
163
  * Scout messenger for React Native: the transport of `@guidelytech/sdk-core`'s messenger-api plus
72
164
  * the conversation state the web widget keeps, as a headless store the overlay renders.
@@ -137,6 +229,8 @@ interface MessengerDeps {
137
229
  onError: (err: unknown) => void;
138
230
  /** The SDK API's circuit breaker, told how each reply stream went. */
139
231
  health?: ServerHealth;
232
+ /** The help center's language when it isn't the default; translated articles are fetched with `?locale=`. */
233
+ locale?: () => string | undefined;
140
234
  /** Poll intervals (ms): open thread, and unread badge otherwise. */
141
235
  pollMs?: {
142
236
  thread: number;
@@ -227,14 +321,29 @@ interface GuidelyOptions {
227
321
  /** Send analytics events (default `true`). Guides still render when disabled. */
228
322
  analytics?: boolean;
229
323
  consent?: ConsentState;
230
- /** Host app version for `app.version` targeting rules. */
324
+ /** Host app version for `app.version` targeting rules and `app_install` / `app_update` events (e.g. from `expo-application`). */
231
325
  appVersion?: string;
326
+ /** Host app build number (`CFBundleVersion` / `versionCode`), sent as `build` with app lifecycle events. */
327
+ appBuild?: string;
328
+ /**
329
+ * Product analytics autocapture: taps (`click`), rage taps, heatmaps, time on screen
330
+ * (`page_leave`) and app lifecycle events. Each capability runs when the project enables it in
331
+ * Settings → Product analytics; this option can only turn things off: `false` for everything,
332
+ * or `{ clicks: false, heatmaps: false, … }` per capability. `false` also removes the provider's
333
+ * touch-observing wrapper view.
334
+ */
335
+ autocapture?: boolean | Partial<AutocaptureSettings>;
232
336
  /** How often to refresh the published config (default 5 minutes). */
233
337
  configRefreshMs?: number;
234
338
  /** Overrides for the project theme. */
235
339
  theme?: Partial<ProjectTheme>;
236
340
  /** Identify this user as soon as the client initialises. */
237
341
  user?: GuidelyUser;
342
+ /**
343
+ * Language for guides and the resource center (BCP 47, e.g. `fr` or `pt-BR`). Defaults to the
344
+ * user's `language` / `locale` trait, then the device language. Change it later with `setLocale()`.
345
+ */
346
+ locale?: string;
238
347
  /** Handles relative and custom-scheme URLs from buttons, links and tasks (deep links, in-app routes). Return `true` when handled. */
239
348
  onNavigate?: (url: string) => boolean | void;
240
349
  onError?: (error: Error) => void;
@@ -334,13 +443,18 @@ interface UiState {
334
443
  }
335
444
 
336
445
  declare const SDK_NAME = "@guidelytech/react-native";
337
- declare const SDK_VERSION = "0.10.0";
446
+ declare const SDK_VERSION = "0.11.0";
338
447
  declare const DEFAULT_API_URL = "https://guidelytech.com";
339
448
  /** Host-platform services the engine needs; the provider supplies React Native implementations. */
340
449
  interface PlatformBridge {
341
450
  device: DeviceEnvironment;
342
451
  /** Opens an external URL (React Native `Linking.openURL`). */
343
452
  openExternal(url: string): void;
453
+ /** Window size in points (React Native `Dimensions.get("window")`), for heatmaps. */
454
+ windowSize?(): {
455
+ width: number;
456
+ height: number;
457
+ };
344
458
  }
345
459
  /** Mobile sessions persist across launches and expire after the configured inactivity timeout. */
346
460
  interface MobileSession extends SessionState {
@@ -384,6 +498,7 @@ declare class GuidelyClient {
384
498
  private activeSurvey;
385
499
  private queued;
386
500
  private flows;
501
+ /** Checklists on screen, with the guide as rendered (in the visitor's language). */
387
502
  private checklists;
388
503
  private expanded;
389
504
  private surveyView;
@@ -403,6 +518,26 @@ declare class GuidelyClient {
403
518
  readonly flags: FlagsClient;
404
519
  /** Experiments already reported this session (`experiment_viewed` is sent once per session). */
405
520
  private exposures;
521
+ private readonly rage;
522
+ private readonly heatmap;
523
+ /** Taps are processed in order (target frames are measured asynchronously). */
524
+ private tapChain;
525
+ /** When the current screen's foreground measurement started; `screenLeft` once it has been reported. */
526
+ private screenStartedAt;
527
+ private screenLeft;
528
+ /** Last `app_open` (cold start or return to the foreground), for `app_background.foregroundMs`. */
529
+ private openedAt;
530
+ private launchChecked;
531
+ /** An identity was stored before this launch (an existing install adopting lifecycle events). */
532
+ private hadIdentity;
533
+ /** Language set with `setLocale()` (or the `locale` option). */
534
+ private locale;
535
+ /** Language each shown guide was rendered in; added to its events as `locale`. */
536
+ private guideLocales;
537
+ /** The resource center in the visitor's language, recomputed when the config or language changes. */
538
+ private localizedRc;
539
+ /** "What's new" last-seen time when the resource center opened (entries after it read as new). */
540
+ private announcementsSeenAtOpen;
406
541
  private readonly customListeners;
407
542
  private readonly eventBus;
408
543
  constructor(options: GuidelyOptions, bridge: PlatformBridge);
@@ -449,10 +584,54 @@ declare class GuidelyClient {
449
584
  /** The current screen name (last value passed to `screen()`). */
450
585
  getScreen(): string;
451
586
  private handleTap;
587
+ private captureAllowed;
588
+ /** A capability runs when the project enables it (absent on old servers → off), no option turns it off and analytics are allowed. */
589
+ private autocaptureOn;
590
+ /** `page_view` from `screen()` predates autocapture: only an explicit opt-out stops it. */
591
+ private pageviewsOn;
592
+ /** True when taps are worth observing (clicks, rage taps or heatmaps are on); the provider skips resolving views otherwise. */
593
+ isTapCaptureOn(): boolean;
594
+ /**
595
+ * Records a tap observed by the provider: `click` for an interactive element, `rage_click` for
596
+ * bursts and a heatmap point. A registered `<GuidelyTarget>` whose frame contains the point
597
+ * (smallest wins) takes precedence over the resolved element and is reported as `#<id>`.
598
+ */
599
+ recordTap(tap: TapInfo): void;
600
+ private processTap;
601
+ /** Sends the buffered heatmap taps as one `heatmap` event attributed to the screen they happened on. */
602
+ private flushHeatmap;
603
+ private windowSize;
604
+ /** Ends the foreground measurement of the current screen with a `page_leave` (once per measurement). */
605
+ private leaveScreen;
606
+ /** `{ appVersion, build }` of this launch, without unknown keys. */
607
+ private appInfo;
608
+ /**
609
+ * Once per launch, as soon as a config is known: `app_install` / `app_update` from the stored
610
+ * version (when the app passes `appVersion` and `storage`), then `app_open` with `coldStart: true`.
611
+ */
612
+ private checkLaunch;
613
+ private wentToBackground;
614
+ private cameToForeground;
452
615
  /** Builds the targeting context for the current moment. */
453
616
  getContext(): TargetingContext;
454
617
  private isTargeted;
455
618
  private isEligible;
619
+ /** Guide throttling: may this guide launch automatically now? */
620
+ private throttleAllows;
621
+ private recordLaunch;
622
+ /** Guides and A/B test control groups, which are evaluated the same way but never render. */
623
+ private candidates;
624
+ private holdoutFor;
625
+ /** The visitor's language candidates, most preferred first: `setLocale()` / `locale` option, traits, device. */
626
+ private locales;
627
+ private defaultLocale;
628
+ /** The guide in the visitor's language (remembered so its events carry `locale`). */
629
+ private localize;
630
+ /**
631
+ * Sets the language for guides and the resource center (`null` = back to the user's traits and
632
+ * the device language). Guides already on screen keep their language; the resource center re-renders.
633
+ */
634
+ setLocale(locale: string | null): void;
456
635
  private triggerFires;
457
636
  private evaluate;
458
637
  private armVisibility;
@@ -502,8 +681,28 @@ declare class GuidelyClient {
502
681
  closeSurvey(guideId: string): void;
503
682
  /** The visitor's audiences (from the last identify), for audience-targeted help articles. */
504
683
  getAudienceIds(): readonly string[];
684
+ /** The published resource center in the visitor's language, or null when it is off. */
505
685
  getResourceCenter(): ResourceCenterConfig | null;
686
+ /** The resource center in the visitor's language (cached until the config or language changes). */
687
+ private localizedResourceCenter;
688
+ /** Evaluates targeting rules (e.g. a resource-center section's) for the current visitor and screen. */
689
+ matchesTargeting(rules: RuleGroup | null | undefined): boolean;
690
+ /** Resource-center sections this visitor sees, in order (disabled and non-matching ones left out). */
691
+ getResourceCenterModules(): ResourceCenterModuleId[];
692
+ /**
693
+ * Sections of the messenger's Help tab, in order: the resource center's modules without "What's
694
+ * new" (the messenger has its own News tab); every section when no resource center is published.
695
+ */
696
+ getHelpModules(): ResourceCenterModuleId[];
697
+ /** "What's new" entries this visitor sees (newest first); empty when the section is off. */
698
+ getAnnouncements(): ResourceCenterAnnouncement[];
699
+ /** "What's new" entries published since the visitor last opened the resource center. */
700
+ getUnreadAnnouncements(): number;
701
+ /** Whether an entry is new to the visitor in the resource center that is open now. */
702
+ isAnnouncementNew(a: ResourceCenterAnnouncement): boolean;
506
703
  searchResourceCenter(q: string): Promise<ResourceCenterArticle[]>;
704
+ /** The language of the resource center as shown, when it isn't the default (sent with article fetches). */
705
+ private articleLocale;
507
706
  articleViewed(article: ResourceCenterArticle): void;
508
707
  getChecklistProgress(idOrKey: string): ChecklistProgressState;
509
708
  completeChecklistTask(idOrKey: string, taskId: string): void;
@@ -563,7 +762,7 @@ declare class GuidelyClient {
563
762
  guides: {
564
763
  id: string;
565
764
  key: string;
566
- kind: "tooltip" | "modal" | "banner" | "checklist" | "survey" | "flow" | "announcement";
765
+ kind: "banner" | "tooltip" | "modal" | "checklist" | "survey" | "flow" | "announcement";
567
766
  }[];
568
767
  activeGuide: {
569
768
  status: GuideStatus;
@@ -674,6 +873,15 @@ interface OverlayProps {
674
873
  */
675
874
  declare function GuidelyOverlay({ client, insets: insetsProp, launcherOffset }: OverlayProps): react.JSX.Element;
676
875
 
876
+ interface GuidelyMaskProps extends ViewProps {
877
+ children?: ReactNode;
878
+ }
879
+ /**
880
+ * Keeps the text of its children out of product analytics: taps inside it (or on an element that
881
+ * contains it) are captured without `text`. Renders a plain `View`.
882
+ */
883
+ declare function GuidelyMask({ children, ...rest }: GuidelyMaskProps): react.JSX.Element;
884
+
677
885
  /**
678
886
  * Tiny, tolerant HTML → rich-text converter for guide bodies (already sanitized server-side).
679
887
  * Supports p, div, br, strong/b, em/i, u, a, code, ul/ol/li, h1–h6 and blockquote; every other tag
@@ -827,4 +1035,4 @@ declare function useGuideState(idOrKey: string): {
827
1035
  /** The guide currently running exclusively (flow, modal, survey…), or null. */
828
1036
  declare function useActiveGuide(): PublishedGuide | null;
829
1037
 
830
- export { type ChecklistView, DEFAULT_API_URL, type DeviceEnvironment, Feature, FeatureFlag, type FeatureProps, FeatureValue, type FeatureValueProps, FlagsProvider, type FlagsProviderProps, type GuideStepInfo, GuidelyClient, type GuidelyEventName, type GuidelyEvents, type GuidelyOptions, GuidelyOverlay, GuidelyProvider, type GuidelyProviderProps, GuidelyScreenScope, type GuidelyStorage, GuidelyTarget, type GuidelyTargetProps, type Insets, Messenger, type MessengerSnapshot, type MessengerTab, type MessengerThread, type MessengerView, type PlatformBridge, SDK_NAME, SDK_VERSION, type StepView, type SurveyView, TargetRegistry, type UiState, createSseParser, guidelyScreenLayout, htmlToText, noopClient, parseHtml, positionCard, targetIdsFor, useActiveGuide, useChecklistProgress, useFeatureValue, useFlag, useFlagDetails, useFlags, useFlagsClient, useFlagsReady, useGuideState, useGuidely, useGuidelyEvent, useGuidelyIdentify, useGuidelyNavigation, useGuidelyReady, useGuidelyScreen, useGuidelyTarget };
1038
+ export { type AutocaptureOption, type ChecklistView, DEFAULT_API_URL, type DeviceEnvironment, Feature, FeatureFlag, type FeatureProps, FeatureValue, type FeatureValueProps, FlagsProvider, type FlagsProviderProps, type GuideStepInfo, GuidelyClient, type GuidelyEventName, type GuidelyEvents, GuidelyMask, type GuidelyMaskProps, type GuidelyOptions, GuidelyOverlay, GuidelyProvider, type GuidelyProviderProps, GuidelyScreenScope, type GuidelyStorage, GuidelyTarget, type GuidelyTargetProps, HeatmapBuffer, type Insets, Messenger, type MessengerSnapshot, type MessengerTab, type MessengerThread, type MessengerView, type PlatformBridge, RageClickDetector, SDK_NAME, SDK_VERSION, type StepView, type SurveyView, type TapElement, type TapInfo, type TapProperties, TapTracker, TargetRegistry, type UiState, createSseParser, guidelyScreenLayout, htmlToText, noopClient, parseHtml, positionCard, targetIdsFor, useActiveGuide, useChecklistProgress, useFeatureValue, useFlag, useFlagDetails, useFlags, useFlagsClient, useFlagsReady, useGuideState, useGuidely, useGuidelyEvent, useGuidelyIdentify, useGuidelyNavigation, useGuidelyReady, useGuidelyScreen, useGuidelyTarget };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { SelectorStrategy, MessengerConfig, MessengerMessage, MessengerConversation, SdkArticlesResponse, ResourceCenterArticle, PublishedGuide, ProjectTheme, GuideStep, SdkConfigResponse, ChecklistTask, SdkEvent, TargetingContext, StepButton, ResourceCenterConfig, Placement } from '@guidelytech/shared';
4
- export { GuideStep, PublishedGuide, SdkConfigResponse } from '@guidelytech/shared';
3
+ import { SelectorStrategy, AutocaptureSettings, HeatmapPoint, MessengerConfig, MessengerMessage, MessengerConversation, SdkArticlesResponse, ResourceCenterArticle, PublishedGuide, ProjectTheme, GuideStep, SdkConfigResponse, ChecklistTask, SdkEvent, TargetingContext, StepButton, ResourceCenterConfig, RuleGroup, ResourceCenterAnnouncement, Placement } from '@guidelytech/shared';
4
+ export { AutocaptureSettings, GuideStep, HeatmapPoint, PublishedGuide, SdkConfigResponse } from '@guidelytech/shared';
5
5
  import { FlagsClientOptions, FlagsClient, JsonValue, FlagValue, FlagDetails, FlagsBootstrap, Attributes } from '@guidelytech/flags';
6
6
  export { Attributes, EvaluationResult, FlagDetails, FlagsBootstrap, FlagsClient, FlagsClientOptions, FlagsPayload, InMemoryStickyBucketStore, JsonValue, createFlagsClient } from '@guidelytech/flags';
7
+ import { ResourceCenterModuleId } from '@guidelytech/shared/runtime';
7
8
  import { KeyValueStore, ServerHealth, ChecklistProgressState, GuidelyEnvironment, ConsentState, GuidelyUser, GuidelyAccount, GuideLocalState, SessionState } from '@guidelytech/sdk-core/headless';
8
9
  export { ChecklistProgressState, ConsentState, GuidelyAccount, GuidelyEnvironment, GuidelyUser } from '@guidelytech/sdk-core/headless';
9
10
  import { ViewProps, StyleProp, ViewStyle, View, GestureResponderEvent } from 'react-native';
@@ -50,6 +51,15 @@ declare class TargetRegistry {
50
51
  /** Frame of a visible target (the most recently mounted visible one when an id is used twice), else null. */
51
52
  measure(id: string): Promise<Rect | null>;
52
53
  private measureHandle;
54
+ /**
55
+ * The registered target on the current screen whose visible frame contains the point (window
56
+ * coordinates); the smallest one when targets are nested. Frames that do not answer within
57
+ * `timeoutMs` are skipped.
58
+ */
59
+ hitTest(x: number, y: number, timeoutMs?: number): Promise<{
60
+ id: string;
61
+ rect: Rect;
62
+ } | null>;
53
63
  /** First of `ids` that is mounted and visible. */
54
64
  resolve(ids: string[]): Promise<{
55
65
  id: string;
@@ -67,6 +77,88 @@ declare class TargetRegistry {
67
77
 
68
78
  type GuideStatus = "idle" | "running" | "waiting_url" | "waiting_target" | "ended";
69
79
 
80
+ /** `autocapture` option: `false` turns every capability off, an object turns single ones off. */
81
+ type AutocaptureOption = boolean | Partial<AutocaptureSettings>;
82
+ /** The element a tap resolved to (or the view it hit), as `click` properties need it. */
83
+ interface TapElement {
84
+ selector: string;
85
+ /** Component / host name (`Pressable`, `TouchableOpacity`, `Text`, `View`). */
86
+ tag: string;
87
+ /** Visible label; already empty for text fields and masked content. */
88
+ text?: string;
89
+ /** Window frame of the element, for the position inside it (heatmaps). */
90
+ measure?: () => Promise<Rect | null>;
91
+ }
92
+ /** One observed tap, reported by the provider's touch observer. */
93
+ interface TapInfo {
94
+ /** Window coordinates in points. */
95
+ x: number;
96
+ y: number;
97
+ /** When the tap ended (ms since epoch); defaults to now. */
98
+ t?: number;
99
+ /** Innermost interactive element under the tap (touchable, `Pressable`, `accessibilityRole="button"`…), if found. */
100
+ element?: TapElement | null;
101
+ /** The view the tap hit, used for rage taps and heatmaps when there is no interactive element. */
102
+ hit?: TapElement | null;
103
+ }
104
+ /** `click` / `rage_click` properties on mobile (`ClickProperties` on the web plus `platform`). */
105
+ interface TapProperties {
106
+ selector: string;
107
+ tag: string;
108
+ text?: string;
109
+ x: number;
110
+ y: number;
111
+ platform: string;
112
+ count?: number;
113
+ }
114
+ /**
115
+ * Detects rage taps: 3+ taps within 1s (each within 1s of the previous) and 30pt of the burst's
116
+ * first tap, reported once per burst. Same semantics as the web SDK's `RageClickDetector`
117
+ * (conformance vectors: `rageClicks` in `mobile/conformance/vectors.json`).
118
+ */
119
+ declare class RageClickDetector {
120
+ private readonly threshold;
121
+ private readonly windowMs;
122
+ private readonly radius;
123
+ private clicks;
124
+ private fired;
125
+ constructor(threshold?: number, windowMs?: number, radius?: number);
126
+ /** Taps in the current burst once it has fired (rage), otherwise 0. */
127
+ get burst(): number;
128
+ /** Records a tap; returns the tap count when it completes a burst, otherwise 0. */
129
+ add(x: number, y: number, t: number): number;
130
+ }
131
+ /** Tap positions on the current screen, sent as one `heatmap` event per batch (40 points, screen change, background). */
132
+ declare class HeatmapBuffer {
133
+ /** Screen path the buffered points belong to. */
134
+ url: string;
135
+ points: HeatmapPoint[];
136
+ /** Adds a tap (`burst` > 0 marks it and the burst's previous taps as rage); true when the batch is full. */
137
+ add(url: string, point: HeatmapPoint, burst: number): boolean;
138
+ /** Empties the buffer, returning what was in it. */
139
+ take(): {
140
+ url: string;
141
+ points: HeatmapPoint[];
142
+ } | null;
143
+ }
144
+ /**
145
+ * Tracks one primary-pointer touch and decides whether it was a tap. Feed it the touch events the
146
+ * provider observes; `end` returns the tap position (window points) or null.
147
+ */
148
+ declare class TapTracker {
149
+ private start;
150
+ private moved;
151
+ /** A finger went down. A second finger while one is tracked cancels the gesture (not a tap). */
152
+ begin(x: number, y: number, t: number, touches: number, id?: unknown): void;
153
+ move(x: number, y: number, id?: unknown): void;
154
+ /** The finger lifted: the tap position when it moved ≤ 10pt and lasted < 1s, else null. */
155
+ end(x: number, y: number, t: number, id?: unknown): {
156
+ x: number;
157
+ y: number;
158
+ } | null;
159
+ cancel(): void;
160
+ }
161
+
70
162
  /**
71
163
  * Scout messenger for React Native: the transport of `@guidelytech/sdk-core`'s messenger-api plus
72
164
  * the conversation state the web widget keeps, as a headless store the overlay renders.
@@ -137,6 +229,8 @@ interface MessengerDeps {
137
229
  onError: (err: unknown) => void;
138
230
  /** The SDK API's circuit breaker, told how each reply stream went. */
139
231
  health?: ServerHealth;
232
+ /** The help center's language when it isn't the default; translated articles are fetched with `?locale=`. */
233
+ locale?: () => string | undefined;
140
234
  /** Poll intervals (ms): open thread, and unread badge otherwise. */
141
235
  pollMs?: {
142
236
  thread: number;
@@ -227,14 +321,29 @@ interface GuidelyOptions {
227
321
  /** Send analytics events (default `true`). Guides still render when disabled. */
228
322
  analytics?: boolean;
229
323
  consent?: ConsentState;
230
- /** Host app version for `app.version` targeting rules. */
324
+ /** Host app version for `app.version` targeting rules and `app_install` / `app_update` events (e.g. from `expo-application`). */
231
325
  appVersion?: string;
326
+ /** Host app build number (`CFBundleVersion` / `versionCode`), sent as `build` with app lifecycle events. */
327
+ appBuild?: string;
328
+ /**
329
+ * Product analytics autocapture: taps (`click`), rage taps, heatmaps, time on screen
330
+ * (`page_leave`) and app lifecycle events. Each capability runs when the project enables it in
331
+ * Settings → Product analytics; this option can only turn things off: `false` for everything,
332
+ * or `{ clicks: false, heatmaps: false, … }` per capability. `false` also removes the provider's
333
+ * touch-observing wrapper view.
334
+ */
335
+ autocapture?: boolean | Partial<AutocaptureSettings>;
232
336
  /** How often to refresh the published config (default 5 minutes). */
233
337
  configRefreshMs?: number;
234
338
  /** Overrides for the project theme. */
235
339
  theme?: Partial<ProjectTheme>;
236
340
  /** Identify this user as soon as the client initialises. */
237
341
  user?: GuidelyUser;
342
+ /**
343
+ * Language for guides and the resource center (BCP 47, e.g. `fr` or `pt-BR`). Defaults to the
344
+ * user's `language` / `locale` trait, then the device language. Change it later with `setLocale()`.
345
+ */
346
+ locale?: string;
238
347
  /** Handles relative and custom-scheme URLs from buttons, links and tasks (deep links, in-app routes). Return `true` when handled. */
239
348
  onNavigate?: (url: string) => boolean | void;
240
349
  onError?: (error: Error) => void;
@@ -334,13 +443,18 @@ interface UiState {
334
443
  }
335
444
 
336
445
  declare const SDK_NAME = "@guidelytech/react-native";
337
- declare const SDK_VERSION = "0.10.0";
446
+ declare const SDK_VERSION = "0.11.0";
338
447
  declare const DEFAULT_API_URL = "https://guidelytech.com";
339
448
  /** Host-platform services the engine needs; the provider supplies React Native implementations. */
340
449
  interface PlatformBridge {
341
450
  device: DeviceEnvironment;
342
451
  /** Opens an external URL (React Native `Linking.openURL`). */
343
452
  openExternal(url: string): void;
453
+ /** Window size in points (React Native `Dimensions.get("window")`), for heatmaps. */
454
+ windowSize?(): {
455
+ width: number;
456
+ height: number;
457
+ };
344
458
  }
345
459
  /** Mobile sessions persist across launches and expire after the configured inactivity timeout. */
346
460
  interface MobileSession extends SessionState {
@@ -384,6 +498,7 @@ declare class GuidelyClient {
384
498
  private activeSurvey;
385
499
  private queued;
386
500
  private flows;
501
+ /** Checklists on screen, with the guide as rendered (in the visitor's language). */
387
502
  private checklists;
388
503
  private expanded;
389
504
  private surveyView;
@@ -403,6 +518,26 @@ declare class GuidelyClient {
403
518
  readonly flags: FlagsClient;
404
519
  /** Experiments already reported this session (`experiment_viewed` is sent once per session). */
405
520
  private exposures;
521
+ private readonly rage;
522
+ private readonly heatmap;
523
+ /** Taps are processed in order (target frames are measured asynchronously). */
524
+ private tapChain;
525
+ /** When the current screen's foreground measurement started; `screenLeft` once it has been reported. */
526
+ private screenStartedAt;
527
+ private screenLeft;
528
+ /** Last `app_open` (cold start or return to the foreground), for `app_background.foregroundMs`. */
529
+ private openedAt;
530
+ private launchChecked;
531
+ /** An identity was stored before this launch (an existing install adopting lifecycle events). */
532
+ private hadIdentity;
533
+ /** Language set with `setLocale()` (or the `locale` option). */
534
+ private locale;
535
+ /** Language each shown guide was rendered in; added to its events as `locale`. */
536
+ private guideLocales;
537
+ /** The resource center in the visitor's language, recomputed when the config or language changes. */
538
+ private localizedRc;
539
+ /** "What's new" last-seen time when the resource center opened (entries after it read as new). */
540
+ private announcementsSeenAtOpen;
406
541
  private readonly customListeners;
407
542
  private readonly eventBus;
408
543
  constructor(options: GuidelyOptions, bridge: PlatformBridge);
@@ -449,10 +584,54 @@ declare class GuidelyClient {
449
584
  /** The current screen name (last value passed to `screen()`). */
450
585
  getScreen(): string;
451
586
  private handleTap;
587
+ private captureAllowed;
588
+ /** A capability runs when the project enables it (absent on old servers → off), no option turns it off and analytics are allowed. */
589
+ private autocaptureOn;
590
+ /** `page_view` from `screen()` predates autocapture: only an explicit opt-out stops it. */
591
+ private pageviewsOn;
592
+ /** True when taps are worth observing (clicks, rage taps or heatmaps are on); the provider skips resolving views otherwise. */
593
+ isTapCaptureOn(): boolean;
594
+ /**
595
+ * Records a tap observed by the provider: `click` for an interactive element, `rage_click` for
596
+ * bursts and a heatmap point. A registered `<GuidelyTarget>` whose frame contains the point
597
+ * (smallest wins) takes precedence over the resolved element and is reported as `#<id>`.
598
+ */
599
+ recordTap(tap: TapInfo): void;
600
+ private processTap;
601
+ /** Sends the buffered heatmap taps as one `heatmap` event attributed to the screen they happened on. */
602
+ private flushHeatmap;
603
+ private windowSize;
604
+ /** Ends the foreground measurement of the current screen with a `page_leave` (once per measurement). */
605
+ private leaveScreen;
606
+ /** `{ appVersion, build }` of this launch, without unknown keys. */
607
+ private appInfo;
608
+ /**
609
+ * Once per launch, as soon as a config is known: `app_install` / `app_update` from the stored
610
+ * version (when the app passes `appVersion` and `storage`), then `app_open` with `coldStart: true`.
611
+ */
612
+ private checkLaunch;
613
+ private wentToBackground;
614
+ private cameToForeground;
452
615
  /** Builds the targeting context for the current moment. */
453
616
  getContext(): TargetingContext;
454
617
  private isTargeted;
455
618
  private isEligible;
619
+ /** Guide throttling: may this guide launch automatically now? */
620
+ private throttleAllows;
621
+ private recordLaunch;
622
+ /** Guides and A/B test control groups, which are evaluated the same way but never render. */
623
+ private candidates;
624
+ private holdoutFor;
625
+ /** The visitor's language candidates, most preferred first: `setLocale()` / `locale` option, traits, device. */
626
+ private locales;
627
+ private defaultLocale;
628
+ /** The guide in the visitor's language (remembered so its events carry `locale`). */
629
+ private localize;
630
+ /**
631
+ * Sets the language for guides and the resource center (`null` = back to the user's traits and
632
+ * the device language). Guides already on screen keep their language; the resource center re-renders.
633
+ */
634
+ setLocale(locale: string | null): void;
456
635
  private triggerFires;
457
636
  private evaluate;
458
637
  private armVisibility;
@@ -502,8 +681,28 @@ declare class GuidelyClient {
502
681
  closeSurvey(guideId: string): void;
503
682
  /** The visitor's audiences (from the last identify), for audience-targeted help articles. */
504
683
  getAudienceIds(): readonly string[];
684
+ /** The published resource center in the visitor's language, or null when it is off. */
505
685
  getResourceCenter(): ResourceCenterConfig | null;
686
+ /** The resource center in the visitor's language (cached until the config or language changes). */
687
+ private localizedResourceCenter;
688
+ /** Evaluates targeting rules (e.g. a resource-center section's) for the current visitor and screen. */
689
+ matchesTargeting(rules: RuleGroup | null | undefined): boolean;
690
+ /** Resource-center sections this visitor sees, in order (disabled and non-matching ones left out). */
691
+ getResourceCenterModules(): ResourceCenterModuleId[];
692
+ /**
693
+ * Sections of the messenger's Help tab, in order: the resource center's modules without "What's
694
+ * new" (the messenger has its own News tab); every section when no resource center is published.
695
+ */
696
+ getHelpModules(): ResourceCenterModuleId[];
697
+ /** "What's new" entries this visitor sees (newest first); empty when the section is off. */
698
+ getAnnouncements(): ResourceCenterAnnouncement[];
699
+ /** "What's new" entries published since the visitor last opened the resource center. */
700
+ getUnreadAnnouncements(): number;
701
+ /** Whether an entry is new to the visitor in the resource center that is open now. */
702
+ isAnnouncementNew(a: ResourceCenterAnnouncement): boolean;
506
703
  searchResourceCenter(q: string): Promise<ResourceCenterArticle[]>;
704
+ /** The language of the resource center as shown, when it isn't the default (sent with article fetches). */
705
+ private articleLocale;
507
706
  articleViewed(article: ResourceCenterArticle): void;
508
707
  getChecklistProgress(idOrKey: string): ChecklistProgressState;
509
708
  completeChecklistTask(idOrKey: string, taskId: string): void;
@@ -563,7 +762,7 @@ declare class GuidelyClient {
563
762
  guides: {
564
763
  id: string;
565
764
  key: string;
566
- kind: "tooltip" | "modal" | "banner" | "checklist" | "survey" | "flow" | "announcement";
765
+ kind: "banner" | "tooltip" | "modal" | "checklist" | "survey" | "flow" | "announcement";
567
766
  }[];
568
767
  activeGuide: {
569
768
  status: GuideStatus;
@@ -674,6 +873,15 @@ interface OverlayProps {
674
873
  */
675
874
  declare function GuidelyOverlay({ client, insets: insetsProp, launcherOffset }: OverlayProps): react.JSX.Element;
676
875
 
876
+ interface GuidelyMaskProps extends ViewProps {
877
+ children?: ReactNode;
878
+ }
879
+ /**
880
+ * Keeps the text of its children out of product analytics: taps inside it (or on an element that
881
+ * contains it) are captured without `text`. Renders a plain `View`.
882
+ */
883
+ declare function GuidelyMask({ children, ...rest }: GuidelyMaskProps): react.JSX.Element;
884
+
677
885
  /**
678
886
  * Tiny, tolerant HTML → rich-text converter for guide bodies (already sanitized server-side).
679
887
  * Supports p, div, br, strong/b, em/i, u, a, code, ul/ol/li, h1–h6 and blockquote; every other tag
@@ -827,4 +1035,4 @@ declare function useGuideState(idOrKey: string): {
827
1035
  /** The guide currently running exclusively (flow, modal, survey…), or null. */
828
1036
  declare function useActiveGuide(): PublishedGuide | null;
829
1037
 
830
- export { type ChecklistView, DEFAULT_API_URL, type DeviceEnvironment, Feature, FeatureFlag, type FeatureProps, FeatureValue, type FeatureValueProps, FlagsProvider, type FlagsProviderProps, type GuideStepInfo, GuidelyClient, type GuidelyEventName, type GuidelyEvents, type GuidelyOptions, GuidelyOverlay, GuidelyProvider, type GuidelyProviderProps, GuidelyScreenScope, type GuidelyStorage, GuidelyTarget, type GuidelyTargetProps, type Insets, Messenger, type MessengerSnapshot, type MessengerTab, type MessengerThread, type MessengerView, type PlatformBridge, SDK_NAME, SDK_VERSION, type StepView, type SurveyView, TargetRegistry, type UiState, createSseParser, guidelyScreenLayout, htmlToText, noopClient, parseHtml, positionCard, targetIdsFor, useActiveGuide, useChecklistProgress, useFeatureValue, useFlag, useFlagDetails, useFlags, useFlagsClient, useFlagsReady, useGuideState, useGuidely, useGuidelyEvent, useGuidelyIdentify, useGuidelyNavigation, useGuidelyReady, useGuidelyScreen, useGuidelyTarget };
1038
+ export { type AutocaptureOption, type ChecklistView, DEFAULT_API_URL, type DeviceEnvironment, Feature, FeatureFlag, type FeatureProps, FeatureValue, type FeatureValueProps, FlagsProvider, type FlagsProviderProps, type GuideStepInfo, GuidelyClient, type GuidelyEventName, type GuidelyEvents, GuidelyMask, type GuidelyMaskProps, type GuidelyOptions, GuidelyOverlay, GuidelyProvider, type GuidelyProviderProps, GuidelyScreenScope, type GuidelyStorage, GuidelyTarget, type GuidelyTargetProps, HeatmapBuffer, type Insets, Messenger, type MessengerSnapshot, type MessengerTab, type MessengerThread, type MessengerView, type PlatformBridge, RageClickDetector, SDK_NAME, SDK_VERSION, type StepView, type SurveyView, type TapElement, type TapInfo, type TapProperties, TapTracker, TargetRegistry, type UiState, createSseParser, guidelyScreenLayout, htmlToText, noopClient, parseHtml, positionCard, targetIdsFor, useActiveGuide, useChecklistProgress, useFeatureValue, useFlag, useFlagDetails, useFlags, useFlagsClient, useFlagsReady, useGuideState, useGuidely, useGuidelyEvent, useGuidelyIdentify, useGuidelyNavigation, useGuidelyReady, useGuidelyScreen, useGuidelyTarget };