initial
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Gather w.js anonymous cookie, tk_ai
|
||||
*
|
||||
* @return {?string} The anonymous cookie value, or null if it doesn't exist
|
||||
*/
|
||||
export declare const readAnonCookie: () => string | null;
|
||||
/**
|
||||
* Initializes the anonId:
|
||||
* - Polls for AnonId receival
|
||||
* - Should only be called once at startup
|
||||
* - Happens to be safe to call multiple times if it is necessary to reset the anonId - something like this was necessary for testing.
|
||||
*
|
||||
* This purely for boot-time initialization, in usual circumstances it will be retrieved within 100-300ms, it happens in parallel booting
|
||||
* so should only delay experiment loading that much for boot-time experiments. In some circumstances such as a very slow connection this
|
||||
* can take a lot longer.
|
||||
*
|
||||
* The state of initializeAnonIdPromise should be used rather than the return of this function.
|
||||
* The return is only avaliable to make this easier to test.
|
||||
*
|
||||
* Throws on error.
|
||||
*
|
||||
* @return {Promise<string | null>} The anonymous cookie value, or null if it doesn't exist
|
||||
*/
|
||||
export declare const initializeAnonId: () => Promise<string | null>;
|
||||
export declare const getAnonId: () => Promise<string | null>;
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
export declare const fetchExperimentAssignmentAnonymously: ({ experimentName, anonId, }: {
|
||||
experimentName: string;
|
||||
anonId: string | null;
|
||||
}) => Promise<unknown>;
|
||||
export declare const fetchExperimentAssignmentWithAuth: ({ experimentName, anonId, }: {
|
||||
experimentName: string;
|
||||
anonId: string | null;
|
||||
}) => Promise<unknown>;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export declare const logError: (error: Record<string, string> & {
|
||||
message: string;
|
||||
}) => void;
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { createExPlatClient } from '@automattic/explat-client';
|
||||
import debugFactory from 'debug';
|
||||
export { createExPlatClient };
|
||||
export declare const initializeExPlat: () => Promise<string | null | void>;
|
||||
export declare const loadExperimentAssignment: (experimentName: string) => Promise<import("@automattic/explat-client").ExperimentAssignment>, dangerouslyGetExperimentAssignment: (experimentName: string) => import("@automattic/explat-client").ExperimentAssignment;
|
||||
export declare const useExperiment: (experimentName: string, options?: import("@automattic/explat-client-react-helpers").ExperimentOptions) => [boolean, import("@automattic/explat-client").ExperimentAssignment | null], Experiment: (props: {
|
||||
name: string;
|
||||
defaultExperience: debugFactory;
|
||||
treatmentExperience: debugFactory;
|
||||
loadingExperience: debugFactory;
|
||||
options?: import("@automattic/explat-client-react-helpers").ExperimentOptions;
|
||||
}) => JSX.Element, ProvideExperimentData: (props: {
|
||||
children: (isLoading: boolean, experimentAssignment: import("@automattic/explat-client").ExperimentAssignment | null) => JSX.Element;
|
||||
name: string;
|
||||
options?: import("@automattic/explat-client-react-helpers").ExperimentOptions;
|
||||
}) => JSX.Element;
|
||||
export declare const loadExperimentAssignmentWithAuth: (experimentName: string) => Promise<import("@automattic/explat-client").ExperimentAssignment>, dangerouslyGetExperimentAssignmentWithAuth: (experimentName: string) => import("@automattic/explat-client").ExperimentAssignment;
|
||||
export declare const useExperimentWithAuth: (experimentName: string, options?: import("@automattic/explat-client-react-helpers").ExperimentOptions) => [boolean, import("@automattic/explat-client").ExperimentAssignment | null], ExperimentWithAuth: (props: {
|
||||
name: string;
|
||||
defaultExperience: debugFactory;
|
||||
treatmentExperience: debugFactory;
|
||||
loadingExperience: debugFactory;
|
||||
options?: import("@automattic/explat-client-react-helpers").ExperimentOptions;
|
||||
}) => JSX.Element, ProvideExperimentDataWithAuth: (props: {
|
||||
children: (isLoading: boolean, experimentAssignment: import("@automattic/explat-client").ExperimentAssignment | null) => JSX.Element;
|
||||
name: string;
|
||||
options?: import("@automattic/explat-client-react-helpers").ExperimentOptions;
|
||||
}) => JSX.Element;
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-url'), 'version' => 'd909fec2f1655c5db20c');
|
||||
+1
File diff suppressed because one or more lines are too long
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Boolean determining if environment is development.
|
||||
*/
|
||||
export declare const isDevelopmentMode: boolean;
|
||||
Reference in New Issue
Block a user