@base44-preview/sdk 0.8.48-pr.280.3801fa1 → 0.8.48-pr.280.4d92ce5
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/client.js
CHANGED
|
@@ -138,6 +138,7 @@ export function createClient(config) {
|
|
|
138
138
|
pageUrl: experimentsContext === null || experimentsContext === void 0 ? void 0 : experimentsContext.pageUrl,
|
|
139
139
|
});
|
|
140
140
|
const experiments = createExperimentsModule({
|
|
141
|
+
appId,
|
|
141
142
|
getAuth: () => userAuthModule,
|
|
142
143
|
trackExposure: exposureTracker.track,
|
|
143
144
|
flushExposures: exposureTracker.flush,
|
|
@@ -16,4 +16,4 @@ export interface ExperimentsRuntime {
|
|
|
16
16
|
setUser(id: string | null): void;
|
|
17
17
|
}
|
|
18
18
|
/** @internal */
|
|
19
|
-
export declare function getExperimentsRuntime(): ExperimentsRuntime | undefined;
|
|
19
|
+
export declare function getExperimentsRuntime(appId?: string): ExperimentsRuntime | undefined;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export function getExperimentsRuntime() {
|
|
2
|
+
export function getExperimentsRuntime(appId) {
|
|
3
|
+
var _a, _b;
|
|
3
4
|
if (typeof window === "undefined" || typeof document === "undefined")
|
|
4
5
|
return;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const page = window;
|
|
7
|
+
// The legacy evaluator has no app ID; its companion bootstrap identifies its owner.
|
|
8
|
+
if (appId !== undefined && ((_b = (_a = page.__B44_EXPERIMENTS_BOOTSTRAP__) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.app_id) !== appId)
|
|
9
|
+
return;
|
|
10
|
+
return page.__B44_EXPERIMENTS__;
|
|
7
11
|
}
|
|
@@ -3,7 +3,8 @@ import type { ExperimentsModule } from "./experiments.types.js";
|
|
|
3
3
|
import type { createExposureTracker } from "./experiment-exposures.js";
|
|
4
4
|
import type { ExperimentsContext } from "./experiments-config.types.js";
|
|
5
5
|
/** @internal */
|
|
6
|
-
export declare function createExperimentsModule({ getAuth, trackExposure, flushExposures, context, }: {
|
|
6
|
+
export declare function createExperimentsModule({ appId, getAuth, trackExposure, flushExposures, context, }: {
|
|
7
|
+
appId: string;
|
|
7
8
|
getAuth: () => InternalAuthModule;
|
|
8
9
|
trackExposure: ReturnType<typeof createExposureTracker>["track"];
|
|
9
10
|
flushExposures?: () => Promise<void>;
|
|
@@ -5,7 +5,7 @@ const EMPTY = Object.freeze({
|
|
|
5
5
|
isLoading: false,
|
|
6
6
|
});
|
|
7
7
|
/** @internal */
|
|
8
|
-
export function createExperimentsModule({ getAuth, trackExposure, flushExposures = async () => { }, context, }) {
|
|
8
|
+
export function createExperimentsModule({ appId, getAuth, trackExposure, flushExposures = async () => { }, context, }) {
|
|
9
9
|
var _a;
|
|
10
10
|
let runtime = context ? createExperimentsRuntime(context) : undefined;
|
|
11
11
|
let state = context
|
|
@@ -67,7 +67,7 @@ export function createExperimentsModule({ getAuth, trackExposure, flushExposures
|
|
|
67
67
|
return;
|
|
68
68
|
active = true;
|
|
69
69
|
if (!context)
|
|
70
|
-
runtime = getExperimentsRuntime();
|
|
70
|
+
runtime = getExperimentsRuntime(appId);
|
|
71
71
|
if (!runtime) {
|
|
72
72
|
publish();
|
|
73
73
|
return;
|
|
@@ -85,7 +85,7 @@ export function createExperimentsModule({ getAuth, trackExposure, flushExposures
|
|
|
85
85
|
if (!active)
|
|
86
86
|
return;
|
|
87
87
|
if (!context)
|
|
88
|
-
runtime = getExperimentsRuntime();
|
|
88
|
+
runtime = getExperimentsRuntime(appId);
|
|
89
89
|
applyIdentity();
|
|
90
90
|
}
|
|
91
91
|
const module = {
|