@funnelsgrove/runtime 0.7.30 → 0.8.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.
|
@@ -33,12 +33,7 @@ function ActiveFunnelRuntimeConfigBoundary({ funnelId, funnelVersionId, children
|
|
|
33
33
|
error: null,
|
|
34
34
|
});
|
|
35
35
|
useEffect(() => {
|
|
36
|
-
|
|
37
|
-
// frame can briefly mount this active boundary during hydration. Avoid a
|
|
38
|
-
// same-origin config request before the parent switches to disabled mode.
|
|
39
|
-
if (isPreviewFrameRuntime()) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
36
|
+
const isPreviewFrame = isPreviewFrameRuntime();
|
|
42
37
|
let active = true;
|
|
43
38
|
let refreshTimer = null;
|
|
44
39
|
const refresh = () => loadFunnelRuntimeConfig(funnelId, { versionId: funnelVersionId })
|
|
@@ -64,7 +59,10 @@ function ActiveFunnelRuntimeConfigBoundary({ funnelId, funnelVersionId, children
|
|
|
64
59
|
: { status: 'fallback', config: null, error: toError(error) }));
|
|
65
60
|
});
|
|
66
61
|
void refresh().then(() => {
|
|
67
|
-
|
|
62
|
+
// Embedded previews are immutable for the lifetime of their iframe. They
|
|
63
|
+
// need the published config once, but must not multiply polling traffic
|
|
64
|
+
// by the number of step thumbnails open in the editor.
|
|
65
|
+
if (active && !isPreviewFrame) {
|
|
68
66
|
refreshTimer = setInterval(() => void refresh(), FUNNEL_RUNTIME_CONFIG_REFRESH_INTERVAL_MS);
|
|
69
67
|
}
|
|
70
68
|
});
|
|
@@ -5,15 +5,7 @@ export type FunnelSdkRuntimeConfigOverrides = {
|
|
|
5
5
|
funnelVersionId?: string | null;
|
|
6
6
|
funnelSdkPublishableKey?: string | null;
|
|
7
7
|
};
|
|
8
|
-
export type FunnelSdkPaymentPlan = Record<string, unknown>;
|
|
9
8
|
export type FunnelSdkJsonObject = Record<string, unknown>;
|
|
10
|
-
export type FunnelSdkListPaymentPlansResponse = {
|
|
11
|
-
funnelId?: string;
|
|
12
|
-
environment?: FunnelSdkRuntimeMode;
|
|
13
|
-
offerSetId?: string;
|
|
14
|
-
offerSetKey?: string;
|
|
15
|
-
plans: FunnelSdkPaymentPlan[];
|
|
16
|
-
};
|
|
17
9
|
export type FunnelSdkBootstrapUserInput = {
|
|
18
10
|
userId?: string | null;
|
|
19
11
|
idempotencyKey?: string | null;
|
|
@@ -287,12 +279,6 @@ declare class FunnelSdkService {
|
|
|
287
279
|
sizeBytes: number;
|
|
288
280
|
}): Promise<FunnelSdkPreparedPhotoUpload>;
|
|
289
281
|
uploadPhotoFile(input: FunnelSdkUploadPhotoFileInput): Promise<FunnelSdkUploadedPhoto>;
|
|
290
|
-
listPaymentPlans(input?: {
|
|
291
|
-
environment?: FunnelSdkRuntimeMode;
|
|
292
|
-
offerSetId?: string | null;
|
|
293
|
-
offerSetKey?: string | null;
|
|
294
|
-
runtimeConfig?: FunnelSdkRuntimeConfigOverrides;
|
|
295
|
-
}): Promise<FunnelSdkListPaymentPlansResponse>;
|
|
296
282
|
createHostedCheckoutSession(input: FunnelSdkCreateHostedCheckoutSessionInput): Promise<FunnelSdkCreateHostedCheckoutSessionResponse>;
|
|
297
283
|
createSubscriptionCheckout(input: FunnelSdkCreateSubscriptionCheckoutInput): Promise<FunnelSdkCreateSubscriptionCheckoutResponse>;
|
|
298
284
|
createOneTimeCheckout(input: FunnelSdkCreateOneTimeCheckoutInput): Promise<FunnelSdkCreateOneTimeCheckoutResponse>;
|
|
@@ -229,19 +229,6 @@ class FunnelSdkService {
|
|
|
229
229
|
uploadedAt: new Date().toISOString(),
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
|
-
async listPaymentPlans(input = {}) {
|
|
233
|
-
const { funnelId } = resolveRuntimeConfig(input.runtimeConfig);
|
|
234
|
-
return this.getJson('/sdk/public/payments/plans', {
|
|
235
|
-
runtimeConfig: input.runtimeConfig,
|
|
236
|
-
searchParams: {
|
|
237
|
-
environment: input.environment,
|
|
238
|
-
funnelId,
|
|
239
|
-
offerSetId: input.offerSetId,
|
|
240
|
-
offerSetKey: input.offerSetKey,
|
|
241
|
-
},
|
|
242
|
-
errorMessage: 'Unable to load payment plans',
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
232
|
async createHostedCheckoutSession(input) {
|
|
246
233
|
return this.postJson('/sdk/public/payments/checkout-session', {
|
|
247
234
|
runtimeConfig: input.runtimeConfig,
|