@guidelytech/react-native 0.6.2 → 0.7.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/LICENSE +21 -0
- package/README.md +33 -0
- package/dist/index.cjs +688 -425
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -3
- package/dist/index.d.ts +83 -3
- package/dist/index.js +533 -282
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { SelectorStrategy, MessengerConfig, MessengerMessage, MessengerConversation, SdkArticlesResponse, ResourceCenterArticle, PublishedGuide, ProjectTheme, GuideStep, SdkConfigResponse, ChecklistTask, SdkEvent, TargetingContext, StepButton, ResourceCenterConfig, Placement } from '@guidelytech/shared';
|
|
4
4
|
export { GuideStep, PublishedGuide, SdkConfigResponse } from '@guidelytech/shared';
|
|
5
|
+
import { FlagsClientOptions, FlagsClient, JsonValue, FlagValue, FlagDetails, FlagsBootstrap, Attributes } from '@guidelytech/flags';
|
|
6
|
+
export { Attributes, EvaluationResult, FlagDetails, FlagsBootstrap, FlagsClient, FlagsClientOptions, FlagsPayload, InMemoryStickyBucketStore, JsonValue, createFlagsClient } from '@guidelytech/flags';
|
|
5
7
|
import { KeyValueStore, ChecklistProgressState, GuidelyEnvironment, ConsentState, GuidelyUser, GuidelyAccount, GuideLocalState, SessionState } from '@guidelytech/sdk-core/headless';
|
|
6
8
|
export { ChecklistProgressState, ConsentState, GuidelyAccount, GuidelyEnvironment, GuidelyUser } from '@guidelytech/sdk-core/headless';
|
|
7
9
|
import { ViewProps, StyleProp, ViewStyle, View, GestureResponderEvent } from 'react-native';
|
|
@@ -241,6 +243,12 @@ interface GuidelyOptions {
|
|
|
241
243
|
showResourceCenterLauncher?: boolean;
|
|
242
244
|
/** Show the Scout chat bubble when the messenger is on for this platform (default `true`). */
|
|
243
245
|
showMessengerLauncher?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Feature flags (on by default, same key and API URL; the last payload is kept in `storage` so
|
|
248
|
+
* flags work offline at cold start). `false` turns them off; an object passes options to the
|
|
249
|
+
* flags client (`attributes`, `payload`, `remoteEval`, `pollingMode`…).
|
|
250
|
+
*/
|
|
251
|
+
flags?: false | Partial<FlagsClientOptions>;
|
|
244
252
|
}
|
|
245
253
|
interface GuideStepInfo {
|
|
246
254
|
guide: PublishedGuide;
|
|
@@ -280,6 +288,10 @@ interface GuidelyEvents {
|
|
|
280
288
|
userId: string | null;
|
|
281
289
|
anonymousId: string;
|
|
282
290
|
}) => void;
|
|
291
|
+
/** Feature flags loaded (bootstrap, storage or network) — or failed to and serve fallbacks. */
|
|
292
|
+
"flags:ready": () => void;
|
|
293
|
+
/** New flag rules arrived. */
|
|
294
|
+
"flags:change": () => void;
|
|
283
295
|
}
|
|
284
296
|
type GuidelyEventName = keyof GuidelyEvents;
|
|
285
297
|
/** A rendered step, as the overlay sees it. */
|
|
@@ -319,7 +331,7 @@ interface UiState {
|
|
|
319
331
|
}
|
|
320
332
|
|
|
321
333
|
declare const SDK_NAME = "@guidelytech/react-native";
|
|
322
|
-
declare const SDK_VERSION = "0.
|
|
334
|
+
declare const SDK_VERSION = "0.7.0";
|
|
323
335
|
declare const DEFAULT_API_URL = "https://guidelytech.com";
|
|
324
336
|
/** Host-platform services the engine needs; the provider supplies React Native implementations. */
|
|
325
337
|
interface PlatformBridge {
|
|
@@ -382,9 +394,14 @@ declare class GuidelyClient {
|
|
|
382
394
|
private messenger;
|
|
383
395
|
private ui;
|
|
384
396
|
private uiListeners;
|
|
397
|
+
/** Feature flags for this environment: `guidely.flags.isEnabled("new-checkout")`. */
|
|
398
|
+
readonly flags: FlagsClient;
|
|
399
|
+
/** Experiments already reported this session (`experiment_viewed` is sent once per session). */
|
|
400
|
+
private exposures;
|
|
385
401
|
private readonly customListeners;
|
|
386
402
|
private readonly eventBus;
|
|
387
403
|
constructor(options: GuidelyOptions, bridge: PlatformBridge);
|
|
404
|
+
private createFlags;
|
|
388
405
|
/** Loads persisted state and config, identifies the stored user and evaluates triggers. Idempotent. */
|
|
389
406
|
init(): Promise<void>;
|
|
390
407
|
ready(): Promise<void>;
|
|
@@ -509,6 +526,19 @@ declare class GuidelyClient {
|
|
|
509
526
|
closeMessenger(): void;
|
|
510
527
|
/** Opens a new messenger conversation, optionally pre-filling the message. */
|
|
511
528
|
showNewMessage(text?: string): void;
|
|
529
|
+
/** Boolean flag value for the current user; `fallback` (default `false`) until loaded or when missing. */
|
|
530
|
+
isFeatureEnabled(key: string, fallback?: boolean): boolean;
|
|
531
|
+
/** Flag value for the current user; `fallback` when missing or of a different type. */
|
|
532
|
+
getFeatureValue<T extends JsonValue>(key: string, fallback: T): FlagValue<T>;
|
|
533
|
+
/** Flag value plus why it was served (reason, rule, variation, experiment). */
|
|
534
|
+
getFeatureDetails<T extends JsonValue>(key: string, fallback: T): FlagDetails<FlagValue<T>>;
|
|
535
|
+
/** Calls `cb` whenever flag values may have changed. Returns an unsubscribe function. */
|
|
536
|
+
onFlagsChange(cb: () => void): () => void;
|
|
537
|
+
/** Attributes flags are evaluated with: identity, traits, account, audiences, screen and device. */
|
|
538
|
+
private flagContext;
|
|
539
|
+
private syncFlagAttributes;
|
|
540
|
+
/** `experiment_viewed`, once per session and assignment, through the event queue (consent applies). */
|
|
541
|
+
private trackExposure;
|
|
512
542
|
on<K extends keyof GuidelyEvents>(event: K, cb: GuidelyEvents[K]): () => void;
|
|
513
543
|
off<K extends keyof GuidelyEvents>(event: K, cb: GuidelyEvents[K]): void;
|
|
514
544
|
isClientReady(): boolean;
|
|
@@ -545,6 +575,7 @@ declare class GuidelyClient {
|
|
|
545
575
|
session: MobileSession;
|
|
546
576
|
pendingEvents: number;
|
|
547
577
|
targets: string[];
|
|
578
|
+
flagsReady: boolean;
|
|
548
579
|
};
|
|
549
580
|
private persistState;
|
|
550
581
|
private persistSession;
|
|
@@ -678,6 +709,51 @@ declare function parseHtml(html: string): TextBlock[];
|
|
|
678
709
|
/** Plain-text rendering of an HTML body (accessibility labels, previews). */
|
|
679
710
|
declare function htmlToText(html: string): string;
|
|
680
711
|
|
|
712
|
+
/** Is the boolean flag on? `fallback` (default `false`) until flags load, or when missing. */
|
|
713
|
+
declare function useFlag(key: string, fallback?: boolean): boolean;
|
|
714
|
+
/** A flag's value (string, number, JSON…); `fallback` when missing or of a different type. */
|
|
715
|
+
declare function useFeatureValue<T extends JsonValue>(key: string, fallback: T): FlagValue<T>;
|
|
716
|
+
/** A flag's value plus why it was served (reason, rule, variation, experiment). */
|
|
717
|
+
declare function useFlagDetails<T extends JsonValue>(key: string, fallback: T): FlagDetails<FlagValue<T>>;
|
|
718
|
+
/** Every flag's value (records no exposures). */
|
|
719
|
+
declare function useFlags(): Record<string, JsonValue>;
|
|
720
|
+
/** True once flags have loaded (bootstrap, storage or network) or failed to and serve fallbacks. */
|
|
721
|
+
declare function useFlagsReady(): boolean;
|
|
722
|
+
/** The flags client (`null` before the provider has created it). */
|
|
723
|
+
declare function useFlagsClient(): FlagsClient | null;
|
|
724
|
+
interface FeatureProps {
|
|
725
|
+
flag: string;
|
|
726
|
+
children?: ReactNode;
|
|
727
|
+
/** Rendered while the flag is off (default: nothing). */
|
|
728
|
+
fallback?: ReactNode;
|
|
729
|
+
}
|
|
730
|
+
/** Renders `children` when the boolean flag is on, else `fallback`. */
|
|
731
|
+
declare function Feature({ flag, children, fallback }: FeatureProps): react.JSX.Element;
|
|
732
|
+
/** Alias of {@link Feature}. */
|
|
733
|
+
declare const FeatureFlag: typeof Feature;
|
|
734
|
+
interface FeatureValueProps extends FeatureProps {
|
|
735
|
+
/** Renders `children` when the flag's value equals this (deep equality). */
|
|
736
|
+
value: JsonValue;
|
|
737
|
+
}
|
|
738
|
+
/** Renders `children` when the flag's value equals `value` (e.g. an experiment variation), else `fallback`. */
|
|
739
|
+
declare function FeatureValue({ flag, value, children, fallback }: FeatureValueProps): react.JSX.Element;
|
|
740
|
+
interface FlagsProviderProps extends Omit<FlagsClientOptions, "payload"> {
|
|
741
|
+
/** Bootstrap payload (or remote results) used until the client has loaded. */
|
|
742
|
+
payload?: FlagsBootstrap | null;
|
|
743
|
+
/** Use an existing client instead of creating one. */
|
|
744
|
+
client?: FlagsClient;
|
|
745
|
+
children?: ReactNode;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Feature flags only (no guides or analytics). Pass AsyncStorage as `storage` so the last flags
|
|
749
|
+
* serve offline at cold start. Refreshes when the app returns to the foreground.
|
|
750
|
+
*
|
|
751
|
+
* ```tsx
|
|
752
|
+
* <FlagsProvider sdkKey="pk_prod_…" apiUrl="https://guidelytech.com" storage={AsyncStorage} attributes={{ id: user.id }}>
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
declare function FlagsProvider({ children, client: external, payload, ...options }: FlagsProviderProps): react.JSX.Element;
|
|
756
|
+
|
|
681
757
|
interface GuidelyProviderProps extends Omit<GuidelyOptions, "user"> {
|
|
682
758
|
/** Identify this user once the client is ready; changing to `null` resets the identity (logout). */
|
|
683
759
|
user?: GuidelyUser | null;
|
|
@@ -685,13 +761,17 @@ interface GuidelyProviderProps extends Omit<GuidelyOptions, "user"> {
|
|
|
685
761
|
insets?: Partial<Insets>;
|
|
686
762
|
/** How far above the bottom inset the checklist launcher sits, to clear tab bars (default 72). */
|
|
687
763
|
launcherOffset?: number;
|
|
764
|
+
/** Flags bootstrap (a payload or remote results) served until the client has loaded. */
|
|
765
|
+
flagsPayload?: FlagsBootstrap | null;
|
|
766
|
+
/** Extra flag attributes (merged over the automatic identity, screen and device attributes). */
|
|
767
|
+
flagAttributes?: Attributes;
|
|
688
768
|
children?: ReactNode;
|
|
689
769
|
}
|
|
690
770
|
/**
|
|
691
771
|
* Creates one Guidely client for the app and renders guide UI above `children`. Place it at the
|
|
692
772
|
* root of the app (outside navigators) so the overlay covers every screen.
|
|
693
773
|
*/
|
|
694
|
-
declare function GuidelyProvider({ children, user, insets, launcherOffset, ...options }: GuidelyProviderProps): react.JSX.Element;
|
|
774
|
+
declare function GuidelyProvider({ children, user, insets, launcherOffset, flagsPayload, flagAttributes, ...options }: GuidelyProviderProps): react.JSX.Element;
|
|
695
775
|
/** A client that ignores every call; returned by `useGuidely()` before the provider has created one. */
|
|
696
776
|
declare const noopClient: GuidelyClient;
|
|
697
777
|
/** The Guidely client (a no-op stand-in until the provider has created it). */
|
|
@@ -737,4 +817,4 @@ declare function useGuideState(idOrKey: string): {
|
|
|
737
817
|
/** The guide currently running exclusively (flow, modal, survey…), or null. */
|
|
738
818
|
declare function useActiveGuide(): PublishedGuide | null;
|
|
739
819
|
|
|
740
|
-
export { type ChecklistView, DEFAULT_API_URL, type DeviceEnvironment, 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, useGuideState, useGuidely, useGuidelyEvent, useGuidelyIdentify, useGuidelyNavigation, useGuidelyReady, useGuidelyScreen, useGuidelyTarget };
|
|
820
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { SelectorStrategy, MessengerConfig, MessengerMessage, MessengerConversation, SdkArticlesResponse, ResourceCenterArticle, PublishedGuide, ProjectTheme, GuideStep, SdkConfigResponse, ChecklistTask, SdkEvent, TargetingContext, StepButton, ResourceCenterConfig, Placement } from '@guidelytech/shared';
|
|
4
4
|
export { GuideStep, PublishedGuide, SdkConfigResponse } from '@guidelytech/shared';
|
|
5
|
+
import { FlagsClientOptions, FlagsClient, JsonValue, FlagValue, FlagDetails, FlagsBootstrap, Attributes } from '@guidelytech/flags';
|
|
6
|
+
export { Attributes, EvaluationResult, FlagDetails, FlagsBootstrap, FlagsClient, FlagsClientOptions, FlagsPayload, InMemoryStickyBucketStore, JsonValue, createFlagsClient } from '@guidelytech/flags';
|
|
5
7
|
import { KeyValueStore, ChecklistProgressState, GuidelyEnvironment, ConsentState, GuidelyUser, GuidelyAccount, GuideLocalState, SessionState } from '@guidelytech/sdk-core/headless';
|
|
6
8
|
export { ChecklistProgressState, ConsentState, GuidelyAccount, GuidelyEnvironment, GuidelyUser } from '@guidelytech/sdk-core/headless';
|
|
7
9
|
import { ViewProps, StyleProp, ViewStyle, View, GestureResponderEvent } from 'react-native';
|
|
@@ -241,6 +243,12 @@ interface GuidelyOptions {
|
|
|
241
243
|
showResourceCenterLauncher?: boolean;
|
|
242
244
|
/** Show the Scout chat bubble when the messenger is on for this platform (default `true`). */
|
|
243
245
|
showMessengerLauncher?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Feature flags (on by default, same key and API URL; the last payload is kept in `storage` so
|
|
248
|
+
* flags work offline at cold start). `false` turns them off; an object passes options to the
|
|
249
|
+
* flags client (`attributes`, `payload`, `remoteEval`, `pollingMode`…).
|
|
250
|
+
*/
|
|
251
|
+
flags?: false | Partial<FlagsClientOptions>;
|
|
244
252
|
}
|
|
245
253
|
interface GuideStepInfo {
|
|
246
254
|
guide: PublishedGuide;
|
|
@@ -280,6 +288,10 @@ interface GuidelyEvents {
|
|
|
280
288
|
userId: string | null;
|
|
281
289
|
anonymousId: string;
|
|
282
290
|
}) => void;
|
|
291
|
+
/** Feature flags loaded (bootstrap, storage or network) — or failed to and serve fallbacks. */
|
|
292
|
+
"flags:ready": () => void;
|
|
293
|
+
/** New flag rules arrived. */
|
|
294
|
+
"flags:change": () => void;
|
|
283
295
|
}
|
|
284
296
|
type GuidelyEventName = keyof GuidelyEvents;
|
|
285
297
|
/** A rendered step, as the overlay sees it. */
|
|
@@ -319,7 +331,7 @@ interface UiState {
|
|
|
319
331
|
}
|
|
320
332
|
|
|
321
333
|
declare const SDK_NAME = "@guidelytech/react-native";
|
|
322
|
-
declare const SDK_VERSION = "0.
|
|
334
|
+
declare const SDK_VERSION = "0.7.0";
|
|
323
335
|
declare const DEFAULT_API_URL = "https://guidelytech.com";
|
|
324
336
|
/** Host-platform services the engine needs; the provider supplies React Native implementations. */
|
|
325
337
|
interface PlatformBridge {
|
|
@@ -382,9 +394,14 @@ declare class GuidelyClient {
|
|
|
382
394
|
private messenger;
|
|
383
395
|
private ui;
|
|
384
396
|
private uiListeners;
|
|
397
|
+
/** Feature flags for this environment: `guidely.flags.isEnabled("new-checkout")`. */
|
|
398
|
+
readonly flags: FlagsClient;
|
|
399
|
+
/** Experiments already reported this session (`experiment_viewed` is sent once per session). */
|
|
400
|
+
private exposures;
|
|
385
401
|
private readonly customListeners;
|
|
386
402
|
private readonly eventBus;
|
|
387
403
|
constructor(options: GuidelyOptions, bridge: PlatformBridge);
|
|
404
|
+
private createFlags;
|
|
388
405
|
/** Loads persisted state and config, identifies the stored user and evaluates triggers. Idempotent. */
|
|
389
406
|
init(): Promise<void>;
|
|
390
407
|
ready(): Promise<void>;
|
|
@@ -509,6 +526,19 @@ declare class GuidelyClient {
|
|
|
509
526
|
closeMessenger(): void;
|
|
510
527
|
/** Opens a new messenger conversation, optionally pre-filling the message. */
|
|
511
528
|
showNewMessage(text?: string): void;
|
|
529
|
+
/** Boolean flag value for the current user; `fallback` (default `false`) until loaded or when missing. */
|
|
530
|
+
isFeatureEnabled(key: string, fallback?: boolean): boolean;
|
|
531
|
+
/** Flag value for the current user; `fallback` when missing or of a different type. */
|
|
532
|
+
getFeatureValue<T extends JsonValue>(key: string, fallback: T): FlagValue<T>;
|
|
533
|
+
/** Flag value plus why it was served (reason, rule, variation, experiment). */
|
|
534
|
+
getFeatureDetails<T extends JsonValue>(key: string, fallback: T): FlagDetails<FlagValue<T>>;
|
|
535
|
+
/** Calls `cb` whenever flag values may have changed. Returns an unsubscribe function. */
|
|
536
|
+
onFlagsChange(cb: () => void): () => void;
|
|
537
|
+
/** Attributes flags are evaluated with: identity, traits, account, audiences, screen and device. */
|
|
538
|
+
private flagContext;
|
|
539
|
+
private syncFlagAttributes;
|
|
540
|
+
/** `experiment_viewed`, once per session and assignment, through the event queue (consent applies). */
|
|
541
|
+
private trackExposure;
|
|
512
542
|
on<K extends keyof GuidelyEvents>(event: K, cb: GuidelyEvents[K]): () => void;
|
|
513
543
|
off<K extends keyof GuidelyEvents>(event: K, cb: GuidelyEvents[K]): void;
|
|
514
544
|
isClientReady(): boolean;
|
|
@@ -545,6 +575,7 @@ declare class GuidelyClient {
|
|
|
545
575
|
session: MobileSession;
|
|
546
576
|
pendingEvents: number;
|
|
547
577
|
targets: string[];
|
|
578
|
+
flagsReady: boolean;
|
|
548
579
|
};
|
|
549
580
|
private persistState;
|
|
550
581
|
private persistSession;
|
|
@@ -678,6 +709,51 @@ declare function parseHtml(html: string): TextBlock[];
|
|
|
678
709
|
/** Plain-text rendering of an HTML body (accessibility labels, previews). */
|
|
679
710
|
declare function htmlToText(html: string): string;
|
|
680
711
|
|
|
712
|
+
/** Is the boolean flag on? `fallback` (default `false`) until flags load, or when missing. */
|
|
713
|
+
declare function useFlag(key: string, fallback?: boolean): boolean;
|
|
714
|
+
/** A flag's value (string, number, JSON…); `fallback` when missing or of a different type. */
|
|
715
|
+
declare function useFeatureValue<T extends JsonValue>(key: string, fallback: T): FlagValue<T>;
|
|
716
|
+
/** A flag's value plus why it was served (reason, rule, variation, experiment). */
|
|
717
|
+
declare function useFlagDetails<T extends JsonValue>(key: string, fallback: T): FlagDetails<FlagValue<T>>;
|
|
718
|
+
/** Every flag's value (records no exposures). */
|
|
719
|
+
declare function useFlags(): Record<string, JsonValue>;
|
|
720
|
+
/** True once flags have loaded (bootstrap, storage or network) or failed to and serve fallbacks. */
|
|
721
|
+
declare function useFlagsReady(): boolean;
|
|
722
|
+
/** The flags client (`null` before the provider has created it). */
|
|
723
|
+
declare function useFlagsClient(): FlagsClient | null;
|
|
724
|
+
interface FeatureProps {
|
|
725
|
+
flag: string;
|
|
726
|
+
children?: ReactNode;
|
|
727
|
+
/** Rendered while the flag is off (default: nothing). */
|
|
728
|
+
fallback?: ReactNode;
|
|
729
|
+
}
|
|
730
|
+
/** Renders `children` when the boolean flag is on, else `fallback`. */
|
|
731
|
+
declare function Feature({ flag, children, fallback }: FeatureProps): react.JSX.Element;
|
|
732
|
+
/** Alias of {@link Feature}. */
|
|
733
|
+
declare const FeatureFlag: typeof Feature;
|
|
734
|
+
interface FeatureValueProps extends FeatureProps {
|
|
735
|
+
/** Renders `children` when the flag's value equals this (deep equality). */
|
|
736
|
+
value: JsonValue;
|
|
737
|
+
}
|
|
738
|
+
/** Renders `children` when the flag's value equals `value` (e.g. an experiment variation), else `fallback`. */
|
|
739
|
+
declare function FeatureValue({ flag, value, children, fallback }: FeatureValueProps): react.JSX.Element;
|
|
740
|
+
interface FlagsProviderProps extends Omit<FlagsClientOptions, "payload"> {
|
|
741
|
+
/** Bootstrap payload (or remote results) used until the client has loaded. */
|
|
742
|
+
payload?: FlagsBootstrap | null;
|
|
743
|
+
/** Use an existing client instead of creating one. */
|
|
744
|
+
client?: FlagsClient;
|
|
745
|
+
children?: ReactNode;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Feature flags only (no guides or analytics). Pass AsyncStorage as `storage` so the last flags
|
|
749
|
+
* serve offline at cold start. Refreshes when the app returns to the foreground.
|
|
750
|
+
*
|
|
751
|
+
* ```tsx
|
|
752
|
+
* <FlagsProvider sdkKey="pk_prod_…" apiUrl="https://guidelytech.com" storage={AsyncStorage} attributes={{ id: user.id }}>
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
declare function FlagsProvider({ children, client: external, payload, ...options }: FlagsProviderProps): react.JSX.Element;
|
|
756
|
+
|
|
681
757
|
interface GuidelyProviderProps extends Omit<GuidelyOptions, "user"> {
|
|
682
758
|
/** Identify this user once the client is ready; changing to `null` resets the identity (logout). */
|
|
683
759
|
user?: GuidelyUser | null;
|
|
@@ -685,13 +761,17 @@ interface GuidelyProviderProps extends Omit<GuidelyOptions, "user"> {
|
|
|
685
761
|
insets?: Partial<Insets>;
|
|
686
762
|
/** How far above the bottom inset the checklist launcher sits, to clear tab bars (default 72). */
|
|
687
763
|
launcherOffset?: number;
|
|
764
|
+
/** Flags bootstrap (a payload or remote results) served until the client has loaded. */
|
|
765
|
+
flagsPayload?: FlagsBootstrap | null;
|
|
766
|
+
/** Extra flag attributes (merged over the automatic identity, screen and device attributes). */
|
|
767
|
+
flagAttributes?: Attributes;
|
|
688
768
|
children?: ReactNode;
|
|
689
769
|
}
|
|
690
770
|
/**
|
|
691
771
|
* Creates one Guidely client for the app and renders guide UI above `children`. Place it at the
|
|
692
772
|
* root of the app (outside navigators) so the overlay covers every screen.
|
|
693
773
|
*/
|
|
694
|
-
declare function GuidelyProvider({ children, user, insets, launcherOffset, ...options }: GuidelyProviderProps): react.JSX.Element;
|
|
774
|
+
declare function GuidelyProvider({ children, user, insets, launcherOffset, flagsPayload, flagAttributes, ...options }: GuidelyProviderProps): react.JSX.Element;
|
|
695
775
|
/** A client that ignores every call; returned by `useGuidely()` before the provider has created one. */
|
|
696
776
|
declare const noopClient: GuidelyClient;
|
|
697
777
|
/** The Guidely client (a no-op stand-in until the provider has created it). */
|
|
@@ -737,4 +817,4 @@ declare function useGuideState(idOrKey: string): {
|
|
|
737
817
|
/** The guide currently running exclusively (flow, modal, survey…), or null. */
|
|
738
818
|
declare function useActiveGuide(): PublishedGuide | null;
|
|
739
819
|
|
|
740
|
-
export { type ChecklistView, DEFAULT_API_URL, type DeviceEnvironment, 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, useGuideState, useGuidely, useGuidelyEvent, useGuidelyIdentify, useGuidelyNavigation, useGuidelyReady, useGuidelyScreen, useGuidelyTarget };
|
|
820
|
+
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 };
|