personalize-connect-sdk 1.1.0 → 1.2.1
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.mts +78 -37
- package/dist/index.d.ts +78 -37
- package/dist/index.js +375 -71
- package/dist/index.mjs +370 -71
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -24,13 +24,13 @@ interface PersonalizeConnectConfig {
|
|
|
24
24
|
interface PersonalizeConnectResponse {
|
|
25
25
|
contentKey: string;
|
|
26
26
|
}
|
|
27
|
-
/** What the SDK sends to Personalize /v2/callFlows */
|
|
27
|
+
/** What the SDK sends to Personalize /v2/callFlows (legacy direct mode) */
|
|
28
28
|
interface CallFlowsRequest {
|
|
29
|
-
clientKey
|
|
29
|
+
clientKey?: string;
|
|
30
30
|
channel: string;
|
|
31
31
|
language: string;
|
|
32
32
|
currencyCode: string;
|
|
33
|
-
pointOfSale
|
|
33
|
+
pointOfSale?: string;
|
|
34
34
|
browserId: string;
|
|
35
35
|
friendlyId: string;
|
|
36
36
|
params?: {
|
|
@@ -41,20 +41,30 @@ interface CallFlowsRequest {
|
|
|
41
41
|
}
|
|
42
42
|
/** Provider configuration */
|
|
43
43
|
interface PersonalizeConnectProviderProps {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/** Sitecore Edge Context ID. When provided, all calls route through the Edge proxy. */
|
|
45
|
+
sitecoreEdgeContextId?: string;
|
|
46
|
+
/** Edge platform base URL. Defaults to https://edge-platform.sitecorecloud.io */
|
|
47
|
+
sitecoreEdgeUrl?: string;
|
|
48
|
+
/** XM Cloud site name, used with Context ID for personalize and init calls. */
|
|
49
|
+
siteName?: string;
|
|
50
|
+
/** Personalize API client key (legacy mode). Not needed when using sitecoreEdgeContextId. */
|
|
51
|
+
clientKey?: string;
|
|
52
|
+
/** Point of sale identifier (legacy mode). Not needed when using sitecoreEdgeContextId. */
|
|
53
|
+
pointOfSale?: string;
|
|
54
|
+
/** Experience Edge GraphQL endpoint for direct access (legacy). Not needed with Context ID. */
|
|
55
|
+
edgeUrl?: string;
|
|
56
|
+
/** Sitecore API key for Experience Edge (legacy). Not needed with Context ID. */
|
|
57
|
+
apiKey?: string;
|
|
46
58
|
channel?: string;
|
|
47
59
|
language?: string;
|
|
48
60
|
currencyCode?: string;
|
|
49
61
|
timeout?: number;
|
|
50
|
-
/** Custom function to fetch datasource fields by item ID. When omitted
|
|
62
|
+
/** Custom function to fetch datasource fields by item ID. When omitted the SDK resolves via Edge. */
|
|
51
63
|
resolveDatasource?: (datasourceId: string) => Promise<ComponentFields>;
|
|
52
|
-
/**
|
|
53
|
-
edgeUrl?: string;
|
|
54
|
-
/** Sitecore API key for Experience Edge (e.g. SITECORE_API_KEY). Required alongside edgeUrl for built-in resolution. */
|
|
55
|
-
apiKey?: string;
|
|
56
|
-
/** Override editing mode detection. When true the HOC renders a visual indicator. When omitted the SDK auto-detects Page Builder / Experience Editor. */
|
|
64
|
+
/** Override editing mode detection. When true the HOC renders a visual indicator. */
|
|
57
65
|
isEditing?: boolean;
|
|
66
|
+
/** Enable debug logging to the browser console. */
|
|
67
|
+
debug?: boolean;
|
|
58
68
|
children: ReactNode;
|
|
59
69
|
}
|
|
60
70
|
/** Resolved datasource fields passed as component props */
|
|
@@ -70,30 +80,34 @@ interface PersonalizeContextValue {
|
|
|
70
80
|
browserId: string;
|
|
71
81
|
resolveDatasource: (datasourceId: string) => Promise<ComponentFields>;
|
|
72
82
|
isEditing: boolean;
|
|
83
|
+
/** True when operating in Edge Context ID mode */
|
|
84
|
+
useEdgeProxy: boolean;
|
|
85
|
+
/** Edge proxy base URL (only set in Context ID mode) */
|
|
86
|
+
edgeProxyUrl: string;
|
|
87
|
+
/** Context ID (only set in Context ID mode) */
|
|
88
|
+
sitecoreEdgeContextId: string;
|
|
89
|
+
/** Site name (only set in Context ID mode) */
|
|
90
|
+
siteName: string;
|
|
73
91
|
}
|
|
74
92
|
|
|
75
|
-
declare function PersonalizeProvider({ children, clientKey, pointOfSale, channel, language, currencyCode, timeout, resolveDatasource,
|
|
93
|
+
declare function PersonalizeProvider({ children, sitecoreEdgeContextId, sitecoreEdgeUrl, siteName, clientKey, pointOfSale, edgeUrl, apiKey, channel, language, currencyCode, timeout, resolveDatasource, isEditing: isEditingProp, debug, }: PersonalizeConnectProviderProps): react_jsx_runtime.JSX.Element;
|
|
76
94
|
declare function usePersonalizeContext(): PersonalizeContextValue | null;
|
|
77
95
|
|
|
78
96
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
97
|
+
* Calls Sitecore Personalize to resolve the active content key.
|
|
98
|
+
*
|
|
99
|
+
* Legacy mode: POST https://api.boxever.com/v2/callFlows
|
|
100
|
+
* Context ID: POST {edgeUrl}/v1/personalize?sitecoreContextId=...&siteName=...
|
|
81
101
|
*/
|
|
82
102
|
|
|
83
103
|
interface CallPersonalizeOptions {
|
|
84
104
|
config: PersonalizeConnectConfig;
|
|
85
105
|
context: PersonalizeContextValue;
|
|
86
|
-
/**
|
|
106
|
+
/** Override API base URL (legacy mode only) */
|
|
87
107
|
apiBase?: string;
|
|
88
|
-
/** Optional: component ref for params */
|
|
89
108
|
componentRef?: string;
|
|
90
|
-
/** Optional: page route for params */
|
|
91
109
|
pageRoute?: string;
|
|
92
110
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Call Personalize /v2/callFlows to get the active content key.
|
|
95
|
-
* Returns the contentKey on success, null on any failure.
|
|
96
|
-
*/
|
|
97
111
|
declare function callPersonalize(options: CallPersonalizeOptions): Promise<string | null>;
|
|
98
112
|
|
|
99
113
|
/**
|
|
@@ -119,13 +133,13 @@ declare function resolveContent(options: ResolveContentOptions): Promise<Resolve
|
|
|
119
133
|
|
|
120
134
|
type GetConfigFromProps<P> = (props: P) => PersonalizeConnectConfig | undefined;
|
|
121
135
|
/**
|
|
122
|
-
* HOC that wraps any JSS
|
|
136
|
+
* HOC that wraps any JSS component.
|
|
123
137
|
* If the rendering has a personalizeConnect config, it renders with defaultKey first,
|
|
124
138
|
* then asynchronously fetches the personalized content and re-renders.
|
|
125
139
|
* If no config, passes through unchanged.
|
|
126
140
|
*
|
|
127
|
-
* In
|
|
128
|
-
*
|
|
141
|
+
* In Page Builder, renders a visual indicator (border + badge) on
|
|
142
|
+
* components that have personalization configured.
|
|
129
143
|
*/
|
|
130
144
|
declare function withPersonalizeConnect<P extends object>(WrappedComponent: ComponentType<P>, getConfig?: GetConfigFromProps<P>): ComponentType<P>;
|
|
131
145
|
|
|
@@ -143,36 +157,63 @@ declare function usePersonalizeExperience(config: PersonalizeConnectConfig | und
|
|
|
143
157
|
|
|
144
158
|
/**
|
|
145
159
|
* Built-in Experience Edge datasource resolver.
|
|
146
|
-
*
|
|
160
|
+
*
|
|
161
|
+
* Legacy mode: Direct Edge GraphQL with sc_apikey header.
|
|
162
|
+
* Context ID mode: Edge proxy GraphQL — Context ID is the auth, no API key needed.
|
|
147
163
|
*/
|
|
148
164
|
|
|
149
165
|
/**
|
|
150
|
-
*
|
|
151
|
-
* When passed as (or used in place of) `resolveDatasource`, allows the SDK
|
|
152
|
-
* to fetch datasource fields without the consuming app providing any resolver.
|
|
166
|
+
* Legacy: creates a resolver that calls Experience Edge directly with an API key.
|
|
153
167
|
*/
|
|
154
168
|
declare function createEdgeResolver(edgeUrl: string, apiKey: string, language?: string): (datasourceId: string) => Promise<ComponentFields>;
|
|
169
|
+
/**
|
|
170
|
+
* Context ID mode: creates a resolver that calls the Edge proxy GraphQL endpoint.
|
|
171
|
+
* No API key header — the Context ID in the URL is the auth.
|
|
172
|
+
*/
|
|
173
|
+
declare function createEdgeProxyResolver(edgeBaseUrl: string, contextId: string, language?: string): (datasourceId: string) => Promise<ComponentFields>;
|
|
155
174
|
|
|
156
175
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
176
|
+
* XM Cloud Pages (Page Builder) editing mode detection.
|
|
177
|
+
* Uses the same Sitecore context shape that JSS for XMC writes to __NEXT_DATA__.
|
|
159
178
|
*/
|
|
160
179
|
/**
|
|
161
|
-
* Detects whether the page is
|
|
162
|
-
*
|
|
180
|
+
* Detects whether the page is rendered inside XM Cloud Pages (Page Builder).
|
|
181
|
+
* Checks the JSS Sitecore context for pageEditing / pageState, and whether
|
|
182
|
+
* the rendering host is loaded in an iframe (Pages always iframes the site).
|
|
183
|
+
* Result is cached after the first call.
|
|
163
184
|
*/
|
|
164
185
|
declare function isEditingMode(): boolean;
|
|
165
186
|
/** Reset the cached result (useful for testing). */
|
|
166
187
|
declare function resetEditingDetectionCache(): void;
|
|
167
188
|
|
|
168
189
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
190
|
+
* SDK debug logger. All output is prefixed with [PersonalizeConnect].
|
|
191
|
+
* Enable by passing debug={true} on PersonalizeProvider.
|
|
171
192
|
*/
|
|
193
|
+
declare function setDebug(on: boolean): void;
|
|
194
|
+
declare function isDebugEnabled(): boolean;
|
|
195
|
+
|
|
172
196
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
197
|
+
* Manages the Sitecore CDP browser ID.
|
|
198
|
+
*
|
|
199
|
+
* Legacy mode: cookie bid_<clientKey>, generated locally.
|
|
200
|
+
* Context ID mode: fetched from Edge proxy /v1/init, stored in cookie sc_<contextId>_personalize.
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Legacy: get or create browser ID from a local cookie keyed by clientKey.
|
|
175
204
|
*/
|
|
176
205
|
declare function getBrowserId(clientKey: string): string;
|
|
206
|
+
/** Response shape from the Edge proxy /v1/init endpoint */
|
|
207
|
+
interface EdgeInitResponse {
|
|
208
|
+
browserId: string;
|
|
209
|
+
guestId?: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Context ID mode: fetch browser ID from the Edge proxy init endpoint.
|
|
213
|
+
* Checks cookie first; if missing, calls /v1/init and caches the result.
|
|
214
|
+
*/
|
|
215
|
+
declare function getEdgeBrowserId(edgeUrl: string, contextId: string, siteName: string): Promise<string>;
|
|
216
|
+
/** Reset the cached init promise (for testing). */
|
|
217
|
+
declare function resetEdgeInitCache(): void;
|
|
177
218
|
|
|
178
|
-
export { type CallFlowsRequest, type CallPersonalizeOptions, type ComponentFields, type GetConfigFromProps, type PersonalizeConnectConfig, type PersonalizeConnectProviderProps, type PersonalizeConnectResponse, type PersonalizeContextValue, PersonalizeProvider, type ResolveContentOptions, type ResolvedContent, type UsePersonalizeExperienceResult, callPersonalize, createEdgeResolver, getBrowserId, isEditingMode, resetEditingDetectionCache, resolveContent, usePersonalizeContext, usePersonalizeExperience, withPersonalizeConnect };
|
|
219
|
+
export { type CallFlowsRequest, type CallPersonalizeOptions, type ComponentFields, type EdgeInitResponse, type GetConfigFromProps, type PersonalizeConnectConfig, type PersonalizeConnectProviderProps, type PersonalizeConnectResponse, type PersonalizeContextValue, PersonalizeProvider, type ResolveContentOptions, type ResolvedContent, type UsePersonalizeExperienceResult, callPersonalize, createEdgeProxyResolver, createEdgeResolver, getBrowserId, getEdgeBrowserId, isDebugEnabled, isEditingMode, resetEdgeInitCache, resetEditingDetectionCache, resolveContent, setDebug, usePersonalizeContext, usePersonalizeExperience, withPersonalizeConnect };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,13 +24,13 @@ interface PersonalizeConnectConfig {
|
|
|
24
24
|
interface PersonalizeConnectResponse {
|
|
25
25
|
contentKey: string;
|
|
26
26
|
}
|
|
27
|
-
/** What the SDK sends to Personalize /v2/callFlows */
|
|
27
|
+
/** What the SDK sends to Personalize /v2/callFlows (legacy direct mode) */
|
|
28
28
|
interface CallFlowsRequest {
|
|
29
|
-
clientKey
|
|
29
|
+
clientKey?: string;
|
|
30
30
|
channel: string;
|
|
31
31
|
language: string;
|
|
32
32
|
currencyCode: string;
|
|
33
|
-
pointOfSale
|
|
33
|
+
pointOfSale?: string;
|
|
34
34
|
browserId: string;
|
|
35
35
|
friendlyId: string;
|
|
36
36
|
params?: {
|
|
@@ -41,20 +41,30 @@ interface CallFlowsRequest {
|
|
|
41
41
|
}
|
|
42
42
|
/** Provider configuration */
|
|
43
43
|
interface PersonalizeConnectProviderProps {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/** Sitecore Edge Context ID. When provided, all calls route through the Edge proxy. */
|
|
45
|
+
sitecoreEdgeContextId?: string;
|
|
46
|
+
/** Edge platform base URL. Defaults to https://edge-platform.sitecorecloud.io */
|
|
47
|
+
sitecoreEdgeUrl?: string;
|
|
48
|
+
/** XM Cloud site name, used with Context ID for personalize and init calls. */
|
|
49
|
+
siteName?: string;
|
|
50
|
+
/** Personalize API client key (legacy mode). Not needed when using sitecoreEdgeContextId. */
|
|
51
|
+
clientKey?: string;
|
|
52
|
+
/** Point of sale identifier (legacy mode). Not needed when using sitecoreEdgeContextId. */
|
|
53
|
+
pointOfSale?: string;
|
|
54
|
+
/** Experience Edge GraphQL endpoint for direct access (legacy). Not needed with Context ID. */
|
|
55
|
+
edgeUrl?: string;
|
|
56
|
+
/** Sitecore API key for Experience Edge (legacy). Not needed with Context ID. */
|
|
57
|
+
apiKey?: string;
|
|
46
58
|
channel?: string;
|
|
47
59
|
language?: string;
|
|
48
60
|
currencyCode?: string;
|
|
49
61
|
timeout?: number;
|
|
50
|
-
/** Custom function to fetch datasource fields by item ID. When omitted
|
|
62
|
+
/** Custom function to fetch datasource fields by item ID. When omitted the SDK resolves via Edge. */
|
|
51
63
|
resolveDatasource?: (datasourceId: string) => Promise<ComponentFields>;
|
|
52
|
-
/**
|
|
53
|
-
edgeUrl?: string;
|
|
54
|
-
/** Sitecore API key for Experience Edge (e.g. SITECORE_API_KEY). Required alongside edgeUrl for built-in resolution. */
|
|
55
|
-
apiKey?: string;
|
|
56
|
-
/** Override editing mode detection. When true the HOC renders a visual indicator. When omitted the SDK auto-detects Page Builder / Experience Editor. */
|
|
64
|
+
/** Override editing mode detection. When true the HOC renders a visual indicator. */
|
|
57
65
|
isEditing?: boolean;
|
|
66
|
+
/** Enable debug logging to the browser console. */
|
|
67
|
+
debug?: boolean;
|
|
58
68
|
children: ReactNode;
|
|
59
69
|
}
|
|
60
70
|
/** Resolved datasource fields passed as component props */
|
|
@@ -70,30 +80,34 @@ interface PersonalizeContextValue {
|
|
|
70
80
|
browserId: string;
|
|
71
81
|
resolveDatasource: (datasourceId: string) => Promise<ComponentFields>;
|
|
72
82
|
isEditing: boolean;
|
|
83
|
+
/** True when operating in Edge Context ID mode */
|
|
84
|
+
useEdgeProxy: boolean;
|
|
85
|
+
/** Edge proxy base URL (only set in Context ID mode) */
|
|
86
|
+
edgeProxyUrl: string;
|
|
87
|
+
/** Context ID (only set in Context ID mode) */
|
|
88
|
+
sitecoreEdgeContextId: string;
|
|
89
|
+
/** Site name (only set in Context ID mode) */
|
|
90
|
+
siteName: string;
|
|
73
91
|
}
|
|
74
92
|
|
|
75
|
-
declare function PersonalizeProvider({ children, clientKey, pointOfSale, channel, language, currencyCode, timeout, resolveDatasource,
|
|
93
|
+
declare function PersonalizeProvider({ children, sitecoreEdgeContextId, sitecoreEdgeUrl, siteName, clientKey, pointOfSale, edgeUrl, apiKey, channel, language, currencyCode, timeout, resolveDatasource, isEditing: isEditingProp, debug, }: PersonalizeConnectProviderProps): react_jsx_runtime.JSX.Element;
|
|
76
94
|
declare function usePersonalizeContext(): PersonalizeContextValue | null;
|
|
77
95
|
|
|
78
96
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
97
|
+
* Calls Sitecore Personalize to resolve the active content key.
|
|
98
|
+
*
|
|
99
|
+
* Legacy mode: POST https://api.boxever.com/v2/callFlows
|
|
100
|
+
* Context ID: POST {edgeUrl}/v1/personalize?sitecoreContextId=...&siteName=...
|
|
81
101
|
*/
|
|
82
102
|
|
|
83
103
|
interface CallPersonalizeOptions {
|
|
84
104
|
config: PersonalizeConnectConfig;
|
|
85
105
|
context: PersonalizeContextValue;
|
|
86
|
-
/**
|
|
106
|
+
/** Override API base URL (legacy mode only) */
|
|
87
107
|
apiBase?: string;
|
|
88
|
-
/** Optional: component ref for params */
|
|
89
108
|
componentRef?: string;
|
|
90
|
-
/** Optional: page route for params */
|
|
91
109
|
pageRoute?: string;
|
|
92
110
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Call Personalize /v2/callFlows to get the active content key.
|
|
95
|
-
* Returns the contentKey on success, null on any failure.
|
|
96
|
-
*/
|
|
97
111
|
declare function callPersonalize(options: CallPersonalizeOptions): Promise<string | null>;
|
|
98
112
|
|
|
99
113
|
/**
|
|
@@ -119,13 +133,13 @@ declare function resolveContent(options: ResolveContentOptions): Promise<Resolve
|
|
|
119
133
|
|
|
120
134
|
type GetConfigFromProps<P> = (props: P) => PersonalizeConnectConfig | undefined;
|
|
121
135
|
/**
|
|
122
|
-
* HOC that wraps any JSS
|
|
136
|
+
* HOC that wraps any JSS component.
|
|
123
137
|
* If the rendering has a personalizeConnect config, it renders with defaultKey first,
|
|
124
138
|
* then asynchronously fetches the personalized content and re-renders.
|
|
125
139
|
* If no config, passes through unchanged.
|
|
126
140
|
*
|
|
127
|
-
* In
|
|
128
|
-
*
|
|
141
|
+
* In Page Builder, renders a visual indicator (border + badge) on
|
|
142
|
+
* components that have personalization configured.
|
|
129
143
|
*/
|
|
130
144
|
declare function withPersonalizeConnect<P extends object>(WrappedComponent: ComponentType<P>, getConfig?: GetConfigFromProps<P>): ComponentType<P>;
|
|
131
145
|
|
|
@@ -143,36 +157,63 @@ declare function usePersonalizeExperience(config: PersonalizeConnectConfig | und
|
|
|
143
157
|
|
|
144
158
|
/**
|
|
145
159
|
* Built-in Experience Edge datasource resolver.
|
|
146
|
-
*
|
|
160
|
+
*
|
|
161
|
+
* Legacy mode: Direct Edge GraphQL with sc_apikey header.
|
|
162
|
+
* Context ID mode: Edge proxy GraphQL — Context ID is the auth, no API key needed.
|
|
147
163
|
*/
|
|
148
164
|
|
|
149
165
|
/**
|
|
150
|
-
*
|
|
151
|
-
* When passed as (or used in place of) `resolveDatasource`, allows the SDK
|
|
152
|
-
* to fetch datasource fields without the consuming app providing any resolver.
|
|
166
|
+
* Legacy: creates a resolver that calls Experience Edge directly with an API key.
|
|
153
167
|
*/
|
|
154
168
|
declare function createEdgeResolver(edgeUrl: string, apiKey: string, language?: string): (datasourceId: string) => Promise<ComponentFields>;
|
|
169
|
+
/**
|
|
170
|
+
* Context ID mode: creates a resolver that calls the Edge proxy GraphQL endpoint.
|
|
171
|
+
* No API key header — the Context ID in the URL is the auth.
|
|
172
|
+
*/
|
|
173
|
+
declare function createEdgeProxyResolver(edgeBaseUrl: string, contextId: string, language?: string): (datasourceId: string) => Promise<ComponentFields>;
|
|
155
174
|
|
|
156
175
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
176
|
+
* XM Cloud Pages (Page Builder) editing mode detection.
|
|
177
|
+
* Uses the same Sitecore context shape that JSS for XMC writes to __NEXT_DATA__.
|
|
159
178
|
*/
|
|
160
179
|
/**
|
|
161
|
-
* Detects whether the page is
|
|
162
|
-
*
|
|
180
|
+
* Detects whether the page is rendered inside XM Cloud Pages (Page Builder).
|
|
181
|
+
* Checks the JSS Sitecore context for pageEditing / pageState, and whether
|
|
182
|
+
* the rendering host is loaded in an iframe (Pages always iframes the site).
|
|
183
|
+
* Result is cached after the first call.
|
|
163
184
|
*/
|
|
164
185
|
declare function isEditingMode(): boolean;
|
|
165
186
|
/** Reset the cached result (useful for testing). */
|
|
166
187
|
declare function resetEditingDetectionCache(): void;
|
|
167
188
|
|
|
168
189
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
190
|
+
* SDK debug logger. All output is prefixed with [PersonalizeConnect].
|
|
191
|
+
* Enable by passing debug={true} on PersonalizeProvider.
|
|
171
192
|
*/
|
|
193
|
+
declare function setDebug(on: boolean): void;
|
|
194
|
+
declare function isDebugEnabled(): boolean;
|
|
195
|
+
|
|
172
196
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
197
|
+
* Manages the Sitecore CDP browser ID.
|
|
198
|
+
*
|
|
199
|
+
* Legacy mode: cookie bid_<clientKey>, generated locally.
|
|
200
|
+
* Context ID mode: fetched from Edge proxy /v1/init, stored in cookie sc_<contextId>_personalize.
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Legacy: get or create browser ID from a local cookie keyed by clientKey.
|
|
175
204
|
*/
|
|
176
205
|
declare function getBrowserId(clientKey: string): string;
|
|
206
|
+
/** Response shape from the Edge proxy /v1/init endpoint */
|
|
207
|
+
interface EdgeInitResponse {
|
|
208
|
+
browserId: string;
|
|
209
|
+
guestId?: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Context ID mode: fetch browser ID from the Edge proxy init endpoint.
|
|
213
|
+
* Checks cookie first; if missing, calls /v1/init and caches the result.
|
|
214
|
+
*/
|
|
215
|
+
declare function getEdgeBrowserId(edgeUrl: string, contextId: string, siteName: string): Promise<string>;
|
|
216
|
+
/** Reset the cached init promise (for testing). */
|
|
217
|
+
declare function resetEdgeInitCache(): void;
|
|
177
218
|
|
|
178
|
-
export { type CallFlowsRequest, type CallPersonalizeOptions, type ComponentFields, type GetConfigFromProps, type PersonalizeConnectConfig, type PersonalizeConnectProviderProps, type PersonalizeConnectResponse, type PersonalizeContextValue, PersonalizeProvider, type ResolveContentOptions, type ResolvedContent, type UsePersonalizeExperienceResult, callPersonalize, createEdgeResolver, getBrowserId, isEditingMode, resetEditingDetectionCache, resolveContent, usePersonalizeContext, usePersonalizeExperience, withPersonalizeConnect };
|
|
219
|
+
export { type CallFlowsRequest, type CallPersonalizeOptions, type ComponentFields, type EdgeInitResponse, type GetConfigFromProps, type PersonalizeConnectConfig, type PersonalizeConnectProviderProps, type PersonalizeConnectResponse, type PersonalizeContextValue, PersonalizeProvider, type ResolveContentOptions, type ResolvedContent, type UsePersonalizeExperienceResult, callPersonalize, createEdgeProxyResolver, createEdgeResolver, getBrowserId, getEdgeBrowserId, isDebugEnabled, isEditingMode, resetEdgeInitCache, resetEditingDetectionCache, resolveContent, setDebug, usePersonalizeContext, usePersonalizeExperience, withPersonalizeConnect };
|