@tinkerlandai/indiana-sdk 0.8.3 → 0.8.4
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/CHANGELOG.md +8 -0
- package/README.md +44 -3
- package/README.zh-CN.md +8 -0
- package/dist/{ai-usage-BV-FlgWr.d.ts → ai-usage-DUlre7JC.d.ts} +1 -1
- package/dist/{api-B3FIE41b.d.ts → api-XDc4pRlN.d.ts} +63 -10
- package/dist/chunk-3F2NQOR2.js +1 -0
- package/dist/{chunk-BNU6IG3F.js → chunk-663UOBHL.js} +1 -1
- package/dist/chunk-BUDTHBFF.js +173 -0
- package/dist/chunk-EJTBSGLV.js +10 -0
- package/dist/{chunk-SHSNIJJM.js → chunk-F2GOIBDQ.js} +1 -1
- package/dist/chunk-RZBZ6LCT.js +4 -0
- package/dist/{chunk-2QPETWDX.js → chunk-SSHUBTT3.js} +1 -1
- package/dist/chunk-SSLZKIIU.js +1 -0
- package/dist/{configuration-sync-DNvKXHk-.d.ts → configuration-sync-Ce3dShy7.d.ts} +6 -1
- package/dist/content-2FCUY6XX.js +1 -0
- package/dist/{customer-page-WUQVK_tp.d.ts → customer-page-9B97Qdt_.d.ts} +21 -1
- package/dist/{funnel-local-client-wbz-4gFx.d.ts → funnel-local-client-CUGavICI.d.ts} +43 -23
- package/dist/{funnel-runtime-host-C5P5JTV3.js → funnel-runtime-host-ENRTSXPJ.js} +1 -1
- package/dist/index.d.ts +76 -26
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -2
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/page.js +1 -1
- package/dist/paywall-734GWAS4.js +1 -0
- package/dist/popup.d.ts +14 -4
- package/dist/popup.js +1 -1
- package/dist/react-native.d.ts +1 -1
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-DLXDQQKK.js +1 -0
- package/dist/server.d.ts +13 -13
- package/dist/server.js +1 -1
- package/dist/src-CLEFCTAU.js +1 -0
- package/dist/visual.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-ANOOBDW5.js +0 -350
- package/dist/chunk-X747SY26.js +0 -4
- package/dist/chunk-Y32NPIYY.js +0 -1
- package/dist/chunk-ZT66RIFU.js +0 -10
- package/dist/content-J3FKZTGT.js +0 -1
- package/dist/paywall-3GIRKSHN.js +0 -1
- package/dist/screen-renderer-5FPYVSPW.js +0 -1
- package/dist/src-BMJCIMIF.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { C as CouponInput, S as ScreenAnswers, s as screenInputBindingsSchema, a as SurfaceData, b as CustomerDataIntent, O as Offer } from './customer-page-
|
|
4
|
-
export { c as OfferUnavailableReason } from './customer-page-
|
|
3
|
+
import { C as CouponInput, S as ScreenAnswers, s as screenInputBindingsSchema, a as SurfaceData, b as CustomerDataIntent, O as Offer } from './customer-page-9B97Qdt_.js';
|
|
4
|
+
export { c as OfferUnavailableReason } from './customer-page-9B97Qdt_.js';
|
|
5
5
|
import { J as JsonValue, F as FeatureResult } from './growth-rules-B4YYy64R.js';
|
|
6
6
|
import { S as StackNode } from './screen-BpAejkn0.js';
|
|
7
|
-
import { F as FunnelRuntimeResponse, a as FunnelRunView, b as FunnelMutation, c as FunnelPurchaseRecovery, d as FunnelSegmentPrediction, P as PaywallDelivery, e as PaywallResolution, f as FunnelDataQueries, I as IndianaOptions, g as PaywallSession, S as SubscriptionOperation, h as FeatureClientOptions, R as RemoteFeatureResult, i as FunnelCommandStorage, j as FunnelStartInput } from './funnel-local-client-
|
|
8
|
-
export { k as FeatureClient, l as FunnelNodeEvaluationContext, m as FunnelPendingEntry, L as LocalFunnelClient, n as LocalFunnelClientOptions, o as PaywallPurchaseInput, p as PaywallStartInput, q as createFeatureClient, r as createLocalFunnelClient, s as createPaywallSession, t as evaluateFunnelNode } from './funnel-local-client-
|
|
9
|
-
import { I as InvoiceModeParams, A as ApiInput, O as OfferingItem } from './api-
|
|
10
|
-
import { C as ConfigurationSync } from './configuration-sync-
|
|
11
|
-
export { a as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-
|
|
7
|
+
import { F as FunnelRuntimeResponse, a as FunnelRunView, b as FunnelMutation, c as FunnelPurchaseRecovery, d as FunnelSegmentPrediction, P as PaywallDelivery, e as PaywallResolution, f as FunnelDataQueries, I as IndianaOptions, g as PaywallSession, S as SubscriptionOperation, h as FeatureClientOptions, R as RemoteFeatureResult, i as FunnelCommandStorage, j as FunnelStartInput } from './funnel-local-client-CUGavICI.js';
|
|
8
|
+
export { k as FeatureClient, l as FunnelNodeEvaluationContext, m as FunnelPendingEntry, L as LocalFunnelClient, n as LocalFunnelClientOptions, o as PaywallPurchaseInput, p as PaywallStartInput, q as createFeatureClient, r as createLocalFunnelClient, s as createPaywallSession, t as evaluateFunnelNode } from './funnel-local-client-CUGavICI.js';
|
|
9
|
+
import { I as InvoiceModeParams, A as ApiInput, O as OfferingItem } from './api-XDc4pRlN.js';
|
|
10
|
+
import { C as ConfigurationSync } from './configuration-sync-Ce3dShy7.js';
|
|
11
|
+
export { a as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-Ce3dShy7.js';
|
|
12
12
|
import { P as PushAddressObservation } from './errors-C8lRYZ0n.js';
|
|
13
13
|
export { I as IndianaError, a as PushHost, b as PushJournal } from './errors-C8lRYZ0n.js';
|
|
14
14
|
import 'zod/v4';
|
|
@@ -16,7 +16,11 @@ import 'zod/v4';
|
|
|
16
16
|
/** Currency always comes from business data; locale only controls notation. No currency conversion. */
|
|
17
17
|
declare function formatCouponMoney(cents: number, currency: string, locale?: string): string;
|
|
18
18
|
declare function formatCouponDiscount(discount: CouponInput["discount"], locale?: string): string;
|
|
19
|
-
declare function formatCouponTerms(coupon: Pick<CouponInput, "discount" | "duration"
|
|
19
|
+
declare function formatCouponTerms(coupon: Pick<CouponInput, "discount" | "duration"> & {
|
|
20
|
+
appliesTo?: {
|
|
21
|
+
type: CouponInput["appliesTo"]["type"];
|
|
22
|
+
};
|
|
23
|
+
}, locale?: string, billing?: "month" | "year" | "any"): string;
|
|
20
24
|
|
|
21
25
|
declare const funnelOpenInSchema: z.ZodEnum<{
|
|
22
26
|
same_window: "same_window";
|
|
@@ -305,6 +309,8 @@ type ContentActionIntent = {
|
|
|
305
309
|
requestedClose: boolean;
|
|
306
310
|
};
|
|
307
311
|
type ContentHostOptions = {
|
|
312
|
+
/** Cancel preparation or dispose the presentation on host/identity teardown. */
|
|
313
|
+
signal?: AbortSignal;
|
|
308
314
|
content: ContentVersion;
|
|
309
315
|
locale?: string;
|
|
310
316
|
inputs?: Record<string, JsonValue>;
|
|
@@ -317,6 +323,16 @@ type ContentHostOptions = {
|
|
|
317
323
|
/** Explicit host mount. Banner never creates an overlay or a blocking Funnel Run. */
|
|
318
324
|
declare function mountContent$1(container: HTMLElement, options: ContentHostOptions): Promise<{
|
|
319
325
|
destroy: () => void;
|
|
326
|
+
show: () => void;
|
|
327
|
+
readonly pendingAction: ContentActionIntent | null;
|
|
328
|
+
retryAction: () => Promise<void>;
|
|
329
|
+
updateCapabilities: (data: SurfaceData) => void | undefined;
|
|
330
|
+
}>;
|
|
331
|
+
/** Prepare already-resolved content without displaying it or executing actions.
|
|
332
|
+
* Resolves after the first render. Call show() from the opening click. */
|
|
333
|
+
declare function prepareContent$1(container: HTMLElement, options: ContentHostOptions): Promise<{
|
|
334
|
+
destroy: () => void;
|
|
335
|
+
show: () => void;
|
|
320
336
|
readonly pendingAction: ContentActionIntent | null;
|
|
321
337
|
retryAction: () => Promise<void>;
|
|
322
338
|
updateCapabilities: (data: SurfaceData) => void | undefined;
|
|
@@ -1625,6 +1641,11 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
1625
1641
|
} | {
|
|
1626
1642
|
type: "plans";
|
|
1627
1643
|
planIds: string[];
|
|
1644
|
+
} | {
|
|
1645
|
+
type: "merchandise";
|
|
1646
|
+
scope: {
|
|
1647
|
+
type: "selected" | "all" | "condition";
|
|
1648
|
+
};
|
|
1628
1649
|
};
|
|
1629
1650
|
displayCopy: {
|
|
1630
1651
|
defaultLocale: string;
|
|
@@ -1885,7 +1906,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
1885
1906
|
entry: string;
|
|
1886
1907
|
nodes: {
|
|
1887
1908
|
id: string;
|
|
1888
|
-
type: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
1909
|
+
type: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
1889
1910
|
outputs: Record<string, string>;
|
|
1890
1911
|
writes: Record<string, string>;
|
|
1891
1912
|
resources: {
|
|
@@ -1959,7 +1980,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
1959
1980
|
revision: number;
|
|
1960
1981
|
visit: number;
|
|
1961
1982
|
nodeId: string;
|
|
1962
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
1983
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
1963
1984
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
1964
1985
|
stopped: boolean;
|
|
1965
1986
|
canBack: boolean;
|
|
@@ -3125,7 +3146,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
3125
3146
|
revision: number;
|
|
3126
3147
|
visit: number;
|
|
3127
3148
|
nodeId: string;
|
|
3128
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
3149
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
3129
3150
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
3130
3151
|
stopped: boolean;
|
|
3131
3152
|
canBack: boolean;
|
|
@@ -4806,7 +4827,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
4806
4827
|
revision: number;
|
|
4807
4828
|
visit: number;
|
|
4808
4829
|
nodeId: string;
|
|
4809
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
4830
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
4810
4831
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
4811
4832
|
stopped: boolean;
|
|
4812
4833
|
canBack: boolean;
|
|
@@ -6225,7 +6246,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
6225
6246
|
revision: number;
|
|
6226
6247
|
visit: number;
|
|
6227
6248
|
nodeId: string;
|
|
6228
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
6249
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
6229
6250
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
6230
6251
|
stopped: boolean;
|
|
6231
6252
|
canBack: boolean;
|
|
@@ -7642,7 +7663,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
7642
7663
|
revision: number;
|
|
7643
7664
|
visit: number;
|
|
7644
7665
|
nodeId: string;
|
|
7645
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
7666
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
7646
7667
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
7647
7668
|
stopped: boolean;
|
|
7648
7669
|
canBack: boolean;
|
|
@@ -9476,10 +9497,15 @@ declare function createIndiana(options: IndianaOptions): {
|
|
|
9476
9497
|
} | {
|
|
9477
9498
|
type: "plans";
|
|
9478
9499
|
planIds: string[];
|
|
9500
|
+
} | {
|
|
9501
|
+
type: "merchandise";
|
|
9502
|
+
scope: {
|
|
9503
|
+
type: "selected" | "all" | "condition";
|
|
9504
|
+
};
|
|
9479
9505
|
};
|
|
9480
9506
|
};
|
|
9481
9507
|
} | null;
|
|
9482
|
-
reason: "unavailable" | "
|
|
9508
|
+
reason: "unavailable" | "inactive" | "claim_disabled" | "outside_window" | "not_targeted" | "not_first_purchase" | "limit_reached" | "sold_out" | null;
|
|
9483
9509
|
}>;
|
|
9484
9510
|
resolveOffering(input: Omit<ApiInput<"resolveOffering">, "customerId">): Promise<{
|
|
9485
9511
|
requestId: string;
|
|
@@ -10332,7 +10358,7 @@ declare function createIndiana(options: IndianaOptions): {
|
|
|
10332
10358
|
}>;
|
|
10333
10359
|
destroy: () => void;
|
|
10334
10360
|
}>;
|
|
10335
|
-
track(name: string, properties?: Record<string, JsonValue>): void;
|
|
10361
|
+
track(name: string, properties?: Record<string, JsonValue>, context?: Pick<ApiInput<"trackEvents">["events"][number], "merchandise">): void;
|
|
10336
10362
|
flush(): Promise<{
|
|
10337
10363
|
inserted: number;
|
|
10338
10364
|
duplicates: number;
|
|
@@ -10724,10 +10750,15 @@ declare function createIndiana(options: IndianaOptions): {
|
|
|
10724
10750
|
} | {
|
|
10725
10751
|
type: "plans";
|
|
10726
10752
|
planIds: string[];
|
|
10753
|
+
} | {
|
|
10754
|
+
type: "merchandise";
|
|
10755
|
+
scope: {
|
|
10756
|
+
type: "selected" | "all" | "condition";
|
|
10757
|
+
};
|
|
10727
10758
|
};
|
|
10728
10759
|
};
|
|
10729
10760
|
} | null;
|
|
10730
|
-
reason: "unavailable" | "
|
|
10761
|
+
reason: "unavailable" | "inactive" | "claim_disabled" | "outside_window" | "not_targeted" | "not_first_purchase" | "limit_reached" | "sold_out" | null;
|
|
10731
10762
|
}>;
|
|
10732
10763
|
claimCoupon(couponId: string, requestId?: `${string}-${string}-${string}-${string}-${string}`): Promise<{
|
|
10733
10764
|
offer: {
|
|
@@ -10759,10 +10790,15 @@ declare function createIndiana(options: IndianaOptions): {
|
|
|
10759
10790
|
} | {
|
|
10760
10791
|
type: "plans";
|
|
10761
10792
|
planIds: string[];
|
|
10793
|
+
} | {
|
|
10794
|
+
type: "merchandise";
|
|
10795
|
+
scope: {
|
|
10796
|
+
type: "selected" | "all" | "condition";
|
|
10797
|
+
};
|
|
10762
10798
|
};
|
|
10763
10799
|
};
|
|
10764
10800
|
} | null;
|
|
10765
|
-
reason: "unavailable" | "
|
|
10801
|
+
reason: "unavailable" | "inactive" | "claim_disabled" | "outside_window" | "not_targeted" | "not_first_purchase" | "limit_reached" | "sold_out" | null;
|
|
10766
10802
|
}>;
|
|
10767
10803
|
listOffers(): Promise<Offer[]>;
|
|
10768
10804
|
previewUpdate(input: Omit<ApiInput<"previewUpdate">, "customerId">): Promise<{
|
|
@@ -13944,6 +13980,11 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
13944
13980
|
} | {
|
|
13945
13981
|
type: "plans";
|
|
13946
13982
|
planIds: string[];
|
|
13983
|
+
} | {
|
|
13984
|
+
type: "merchandise";
|
|
13985
|
+
scope: {
|
|
13986
|
+
type: "selected" | "all" | "condition";
|
|
13987
|
+
};
|
|
13947
13988
|
};
|
|
13948
13989
|
displayCopy: {
|
|
13949
13990
|
defaultLocale: string;
|
|
@@ -14204,7 +14245,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
14204
14245
|
entry: string;
|
|
14205
14246
|
nodes: {
|
|
14206
14247
|
id: string;
|
|
14207
|
-
type: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
14248
|
+
type: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
14208
14249
|
outputs: Record<string, string>;
|
|
14209
14250
|
writes: Record<string, string>;
|
|
14210
14251
|
resources: {
|
|
@@ -14278,7 +14319,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
14278
14319
|
revision: number;
|
|
14279
14320
|
visit: number;
|
|
14280
14321
|
nodeId: string;
|
|
14281
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
14322
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
14282
14323
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
14283
14324
|
stopped: boolean;
|
|
14284
14325
|
canBack: boolean;
|
|
@@ -15444,7 +15485,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
15444
15485
|
revision: number;
|
|
15445
15486
|
visit: number;
|
|
15446
15487
|
nodeId: string;
|
|
15447
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
15488
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
15448
15489
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
15449
15490
|
stopped: boolean;
|
|
15450
15491
|
canBack: boolean;
|
|
@@ -17125,7 +17166,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
17125
17166
|
revision: number;
|
|
17126
17167
|
visit: number;
|
|
17127
17168
|
nodeId: string;
|
|
17128
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
17169
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
17129
17170
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
17130
17171
|
stopped: boolean;
|
|
17131
17172
|
canBack: boolean;
|
|
@@ -18544,7 +18585,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
18544
18585
|
revision: number;
|
|
18545
18586
|
visit: number;
|
|
18546
18587
|
nodeId: string;
|
|
18547
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
18588
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
18548
18589
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
18549
18590
|
stopped: boolean;
|
|
18550
18591
|
canBack: boolean;
|
|
@@ -19961,7 +20002,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
19961
20002
|
revision: number;
|
|
19962
20003
|
visit: number;
|
|
19963
20004
|
nodeId: string;
|
|
19964
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
20005
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
19965
20006
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
19966
20007
|
stopped: boolean;
|
|
19967
20008
|
canBack: boolean;
|
|
@@ -21381,7 +21422,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
21381
21422
|
revision: number;
|
|
21382
21423
|
visit: number;
|
|
21383
21424
|
nodeId: string;
|
|
21384
|
-
nodeType: "output" | "action" | "feature" | "split" | "condition" | "coupon" | "end" | "screen" | "offering" | "coupons" | "
|
|
21425
|
+
nodeType: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
21385
21426
|
status: "failed" | "completed" | "running" | "closed" | "ineligible" | "waiting";
|
|
21386
21427
|
stopped: boolean;
|
|
21387
21428
|
canBack: boolean;
|
|
@@ -23112,9 +23153,18 @@ declare function showFunnelRun(...args: Parameters<typeof showFunnelRun$1>): Pro
|
|
|
23112
23153
|
|
|
23113
23154
|
declare function mountContent(...args: Parameters<typeof mountContent$1>): Promise<{
|
|
23114
23155
|
destroy: () => void;
|
|
23156
|
+
show: () => void;
|
|
23157
|
+
readonly pendingAction: ContentActionIntent | null;
|
|
23158
|
+
retryAction: () => Promise<void>;
|
|
23159
|
+
updateCapabilities: (data: SurfaceData) => void | undefined;
|
|
23160
|
+
}>;
|
|
23161
|
+
/** Load the presentation module and render resolved content before the opening click. */
|
|
23162
|
+
declare function prepareContent(...args: Parameters<typeof prepareContent$1>): Promise<{
|
|
23163
|
+
destroy: () => void;
|
|
23164
|
+
show: () => void;
|
|
23115
23165
|
readonly pendingAction: ContentActionIntent | null;
|
|
23116
23166
|
retryAction: () => Promise<void>;
|
|
23117
23167
|
updateCapabilities: (data: SurfaceData) => void | undefined;
|
|
23118
23168
|
}>;
|
|
23119
23169
|
|
|
23120
|
-
export { ConfigurationSync, type ContentActionIntent, type ContentHostOptions, FeatureClientOptions, FunnelCommandStorage, type FunnelControllerResponse, type FunnelHostOptions, FunnelPurchaseRecovery, type FunnelResourceSource, type FunnelRunController, FunnelRuntimeResponse, FunnelSegmentPrediction, type IndianaFeatureOptions, IndianaOptions, Offer, type PaywallHostOptions, PaywallSession, createBrowserFunnelCommandStorage, createFunnelClient, createFunnelRunController, createIndiana, formatCouponDiscount, formatCouponMoney, formatCouponTerms, mountContent, showFunnelRun, showPaywall };
|
|
23170
|
+
export { ConfigurationSync, type ContentActionIntent, type ContentHostOptions, FeatureClientOptions, FunnelCommandStorage, type FunnelControllerResponse, type FunnelHostOptions, FunnelPurchaseRecovery, type FunnelResourceSource, type FunnelRunController, FunnelRuntimeResponse, FunnelSegmentPrediction, type IndianaFeatureOptions, IndianaOptions, Offer, type PaywallHostOptions, PaywallSession, createBrowserFunnelCommandStorage, createFunnelClient, createFunnelRunController, createIndiana, formatCouponDiscount, formatCouponMoney, formatCouponTerms, mountContent, prepareContent, showFunnelRun, showPaywall };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B}from"./chunk-BNU6IG3F.js";import{a as k,f as ne,i as D,j as re,k as oe,l as ie,m as _,n as ae}from"./chunk-Y32NPIYY.js";import"./chunk-GRLMT5PR.js";import{a as o}from"./chunk-VVV3JNS3.js";import{a as V}from"./chunk-2QPETWDX.js";import{Ki as r,Le as N,Xi as T,ua as X,va as ee,wa as te}from"./chunk-ZT66RIFU.js";import{a as l}from"./chunk-SOQO2RDZ.js";import"./chunk-LMR2TM3X.js";import"./chunk-OBYJWIRB.js";import"./chunk-EXCPE2XH.js";import"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";function U(n,e,t={}){let i=!1,c=new Set,p=a=>{for(let s of c)try{s(a)}catch{}};return{isIdentified:()=>i,methods:{subscribeIdentity(a){return c.add(a),()=>{c.delete(a)}},identify(a){if(!/^gg_ct_[A-Za-z0-9_-]{43}$/.test(a))throw new l("INVALID_TOKEN","Browser SDK requires a customer session");t.beforeIdentify?.(a),i=!1,n.reset(),e(),n.identify(a),i=!0,p(!0),t.afterChange?.()},reset(){try{t.beforeReset?.()}finally{i=!1,n.reset(),e(),p(!1),t.afterChange?.()}}}}}function u(n){if(n!==null&&typeof n=="object"&&"customerId"in n)throw new l("INVALID_REQUEST","Customer requests use the verified session identity")}function j(n){return{async checkEntitlement(e){u(e);let t=r.checkEntitlement;return o(n,t,e)},async readHoldings(e={}){let t=r.readHoldings;return o(n,{...t,request:t.request.omit({customerId:!0})},e)}}}function q(n){return{async readLedger(e){let t=r.readLedger;return o(n,t,{query:e})},async readCreditStatement(e){u(e);let t=r.readCreditStatement;return o(n,t,e)},async quoteBalance(e){u(e);let t=r.quoteBalance;return o(n,t,{command:e})}}}function L(n){return{async setupPayment(e){u(e);let t=r.setupPayment;return o(n,t,e)},async readPaymentSetup(e){u(e);let t=r.readPaymentSetup;return o(n,t,e)},async readBillingInvoice(e){u(e);let t=r.readBillingInvoice;return o(n,t,e)},async readBillingControls(e={}){u(e);let t=r.readBillingControls;return o(n,t,e)},async prepareBillingAuthorization(e){u(e);let t=r.prepareBillingAuthorization;return o(n,t,e)},async confirmBillingAuthorization(e){u(e);let t=r.confirmBillingAuthorization;return o(n,t,e)},async setBillingCoupons(e){u(e);let t=r.setBillingCoupons;return o(n,t,e,{request:"Invalid billing coupon list",response:"Invalid billing coupon receipt"})},async revokeBillingAuthorization(e){u(e);let t=r.revokeBillingAuthorization;return o(n,t,e)},async listBillingInvoices(e={after:null,limit:25}){u(e);let t=r.listBillingInvoices;return o(n,t,e)},async confirmBillingAdjustment(e){u(e);let t=r.confirmBillingAdjustment;return o(n,t,e)}}}function z(n){return{async previewUpdate(e){u(e);let t=r.previewUpdate;return o(n,t,e)},async update(e){u(e);let t=r.update;return o(n,t,e)},async readSubscriptionUpdate(e){u(e);let t=r.readSubscriptionUpdate;return o(n,t,e)},async restoreNativePurchase(e){u(e);let t=r.restoreNativePurchase;return o(n,t,e)},async previewAttach(e){u(e);let t=r.previewAttach;return o(n,t,e)},async attach(e){u(e);let t=r.attach;return o(n,t,e)},async readSubscriptionOperation(e){u(e);let t=r.readSubscriptionOperation;return o(n,t,e)}}}function M(n){return{async redeemReward(e){return u(e),(await o(n,r.redeemReward,{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid reward redemption",response:"Invalid reward receipt"})).redemption},async claimRewardProduct(e){return u(e),(await o(n,r.claimRewardProduct,e,{request:"Invalid reward product claim",response:"Invalid reward product checkout"})).checkout},async createReferralCode(e){return u(e),(await o(n,r.createReferralCode,{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid referral program",response:"Invalid referral code"})).referralCode},async redeemCoupon(e,t=crypto.randomUUID()){let i=await o(n,r.redeemCoupon,{code:e,requestId:t},{request:"Invalid coupon code",response:"Invalid Coupon receipt"});return{offer:i.offer,reason:i.reason}},async claimCoupon(e,t=crypto.randomUUID()){let i=await o(n,r.grantOffer,{couponId:e,requestId:t},{request:"Invalid Coupon claim",response:"Invalid Coupon receipt"});return{offer:i.offer,reason:i.reason}},async listOffers(){return(await o(n,r.listOffers,{},{response:"Invalid offers response"})).offers}}}function H(n){return{...j(n),...q(n),...L(n),...z(n),...M(n)}}function J(n){return{async resolveContent(e){u(e);let t=r.resolveContent;return o(n,t,e)},async resolvePaywall(e){u(e);let t=r.resolvePaywall;return o(n,t,e)},async resolveOffering(e){u(e);let t=r.resolveOffering;return o(n,t,e)}}}var Q=n=>new TextEncoder().encode(JSON.stringify(n)).length,G=16384;function Y(n,e){let t=0,i,c=m=>{i={config:structuredClone(m),until:Date.now()+3e4}},p=[],a=null,s;function d(){if(!e())throw new l("NOT_IDENTIFIED","Call identify before using Features or events")}function v(){s||!p.length||(s=setTimeout(()=>{s=void 0,O().catch(()=>{}).finally(v)},5e3),typeof s=="object"&&"unref"in s&&s.unref())}function A(m,I={}){if(d(),i&&Date.now()<i.until&&!N(i.config,m))return;F();let h=r.trackEvents.request.parse({events:[{eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),name:m,properties:I}]}).events[0];if(Q({events:[h]})>G)throw new l("INVALID_REQUEST","Event exceeds the delivery size limit");if(p.length>=500)throw new l("EVENT_QUEUE_FULL","Flush pending events before tracking more");p.push(structuredClone(h)),v()}async function O(m=!1){if(d(),a)return a;let I=t,h=(async()=>{let b={inserted:0,duplicates:0,rejected:0,skipped:0},w=p.length;for(;w&&I===t;){let C=[];for(let S of p.slice(0,Math.min(w,100))){if(C.length&&Q({events:[...C,S]})>G)break;C.push(S)}let x=r.trackEvents,y=await o(n,x,{events:C},void 0,{keepalive:m});if(I!==t)throw new l("IDENTITY_CHANGED","Event identity changed during delivery");if(y.inserted+y.duplicates+y.rejected+y.skipped!==C.length)throw new l("INVALID_RESPONSE","Incomplete event acknowledgement");c(y.analyticsConfig),p.splice(0,C.length),w-=C.length,b.inserted+=y.inserted,b.duplicates+=y.duplicates,b.rejected+=y.rejected,b.skipped+=y.skipped}return b})();a=h;try{return await h}finally{a===h&&(a=null)}}let R;function F(){if(R||typeof document>"u")return;let m=()=>{document.visibilityState==="hidden"&&e()&&p.length&&O(!0).catch(()=>{})};document.addEventListener("visibilitychange",m),R=()=>document.removeEventListener("visibilitychange",m)}return{rememberConfiguration:c,track(m,I){return F(),A(m,I)},flush:O,reset(){t++,i=void 0,clearTimeout(s),s=void 0,p=[],a=null},detachVisibility(){R?.(),R=void 0}}}function K(n,e,t,i,c){if(c&&i&&(c.scope.projectId!==i.projectId||c.scope.environment!==i.environment))throw new l("SCOPE_MISMATCH","Configuration belongs to another App/environment");let p=0,a=new Set;function s(){if(!e())throw new l("NOT_IDENTIFIED","Call identify before using Features or events")}async function d(v={}){c||s();let A=p,O=!1,R=async()=>{if(O||A!==p)throw new l("IDENTITY_CHANGED","Feature identity changed");let g=r.getFeatures,f=c?{scope:{projectId:c.scope.projectId,environment:c.scope.environment},payload:await c.features()}:await o(n,g,{});if(A!==p)throw new l("IDENTITY_CHANGED","Feature identity changed");if(i&&(f.scope.projectId!==i.projectId||f.scope.environment!==i.environment))throw new l("INVALID_RESPONSE","Feature response scope changed");return t.rememberConfiguration(f.payload.analyticsConfig),f},F=await R(),m=!0,I,h=g=>{try{v.onError?.(g)}catch{}},b=(g,f)=>{try{t.track(g,f)}catch(E){h(E)}},w=k({assertUsable:c?.assertFeatures,scope:F.scope,attributes:v.attributes,onError:v.onError,load:async()=>m?(m=!1,F.payload):(await R()).payload,evaluateRemote:async g=>{if(A!==p)throw new l("IDENTITY_CHANGED","Feature identity changed");let f=r.evaluateFeatures,E=await o(n,f,g);if(E.scope.projectId!==F.scope.projectId||E.scope.environment!==F.scope.environment)throw new l("INVALID_RESPONSE","Remote Feature response scope changed");return{generation:E.generation,evaluatedAt:E.evaluatedAt,expiresAt:E.expiresAt,features:E.features}},onExperimentViewed:(g,f)=>b("Experiment Viewed",{experimentId:g.key,variationId:f.key}),onFeatureUsage:(g,f)=>b("Feature Evaluated",{feature:g,value:f.value,source:f.source,ruleId:f.ruleId,...f.experimentResult?{variationId:f.experimentResult.key}:{}})}),C=w.refresh;function x(){clearTimeout(I),!c&&(O||A!==p||!w.expiresAt||(I=setTimeout(()=>{y().catch(h)},Math.min(2147483647,Math.max(1e3,Date.parse(w.expiresAt)-Date.now()))),typeof I=="object"&&"unref"in I&&I.unref()))}async function y(){try{return await C()}finally{x()}}let S=()=>{O||y().catch(h)},$=w.subscribe(x),W=c?.subscribe(()=>{!O&&c.fresh&&y().catch(h)});function P(){O||(O=!0,clearTimeout(I),typeof window<"u"&&window.removeEventListener("focus",S),$(),W?.(),w.reset(),a.delete(P))}a.add(P);try{await w.init()}catch(g){throw P(),g}return x(),!c&&typeof window<"u"&&window.addEventListener("focus",S),Object.assign(w,{refresh:y,destroy:P})}return{features:d,reset(v){p++,v();for(let A of a)A()}}}import{z as se}from"zod";function Z(n,e){let t="source"in e?{funnelId:e.source.id,funnelVersionId:e.source.versionId}:"versionId"in e?{funnelId:e.funnelId,funnelVersionId:e.versionId}:e,i=se.object({funnelId:T.shape.id,funnelVersionId:T.shape.versionId.optional()}).safeParse(t);if(!i.success)throw new l("INVALID_REQUEST","A valid Funnel source is required");let c=Object.freeze(i.data);function p(a){if("customerId"in a)throw new l("INVALID_REQUEST","Customer identity cannot be overridden");if("funnelId"in a&&a.funnelId!==void 0&&a.funnelId!==c.funnelId||"funnelVersionId"in a&&a.funnelVersionId!==void 0&&a.funnelVersionId!==c.funnelVersionId)throw new l("SCOPE_MISMATCH","The original Funnel source cannot change");return{...a,...c}}return{async claimCoupon(a,s=crypto.randomUUID()){let d=r.grantOffer,v=await o(n,d,p({couponId:a,requestId:s}));return{offer:v.offer,reason:v.reason}},async resolveOffering(a){let s=r.resolveOffering;return o(n,s,p(a))},async resolvePaywall(a){let s=r.resolvePaywall;return o(n,s,p(a))},async previewAttach(a){let s=r.previewAttach;return o(n,s,p(a))}}}function ce(n){let e=V(n),t=e.request,i=B(n.push,e,n.scope??n.configuration?.scope),c=U(e,()=>{a.reset(p.reset),p.detachVisibility()},{beforeIdentify:i.identify,beforeReset:i.reset,afterChange:i.start}),p=Y(t,c.isIdentified),a=K(t,c.isIdentified,p,n.scope,n.configuration);return{messaging:{async preference(s){let d=r.readMessagingPreference;return d.response.parse(await t(d.path,d.request.parse({channel:s}))).preference},async setPreference(s){let d=r.setMessagingPreference;return d.response.parse(await t(d.path,d.request.parse(s))).preference}},push:{sync:i.sync,read:i.read,recover:i.recover,tokenObserver:i.tokenObserver,recoveryObserver:i.recoveryObserver,async preference(){let s=r.readMessagingPreference;return s.response.parse(await t(s.path,{channel:"push"})).preference},async setPreference(s){let d=r.setMessagingPreference;return d.response.parse(await t(d.path,d.request.parse({...s,channel:"push"}))).preference}},...H(t),...J(t),forFunnel(s){return Z(t,s)},async features(s={}){return a.features(s)},track(s,d){return p.track(s,d)},flush(){return p.flush()},...c.methods}}function ue(n){if(!/^gg_ct_[A-Za-z0-9_-]{32,128}$/.test(n.customerToken))throw new l("INVALID_TOKEN","A customer credential is required");if(!n.scope)throw new l("INVALID_REQUEST","An explicit App and environment scope is required");let e=_({...n,scope:n.scope,apiKey:n.customerToken});return{async start(t){let i=await e.start(t),c=D({...n,runToken:i.runToken});c.identify(n.customerToken);let p=["evaluate","evaluate_segment"].includes(i.run.instruction?.type??"")?await c.get():i;return{...i,...p,controller:c}}}}async function vt(...n){return(await import("./paywall-3GIRKSHN.js")).showPaywall(...n)}async function ht(...n){return(await import("./funnel-runtime-host-C5P5JTV3.js")).showFunnelRun(...n)}async function wt(...n){return(await import("./content-J3FKZTGT.js")).mountContent(...n)}export{l as IndianaError,ne as createBrowserFunnelCommandStorage,oe as createConfigurationSync,k as createFeatureClient,ue as createFunnelClient,D as createFunnelRunController,ce as createIndiana,ae as createLocalFunnelClient,re as createPaywallSession,ie as evaluateFunnelNode,ee as formatCouponDiscount,X as formatCouponMoney,te as formatCouponTerms,wt as mountContent,ht as showFunnelRun,vt as showPaywall};
|
|
1
|
+
import{a as _}from"./chunk-663UOBHL.js";import{a as D,f as oe,i as V,j as ie,k as ae,l as se,m as j,n as ce}from"./chunk-3F2NQOR2.js";import"./chunk-GRLMT5PR.js";import{a as o}from"./chunk-VVV3JNS3.js";import{a as B}from"./chunk-SSHUBTT3.js";import{Ia as te,Ja as ne,Ka as re,Yi as r,_e as N,jj as k}from"./chunk-EJTBSGLV.js";import{a as l}from"./chunk-SOQO2RDZ.js";import"./chunk-LMR2TM3X.js";import"./chunk-OBYJWIRB.js";import"./chunk-EXCPE2XH.js";import"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";function U(t,e,n={}){let i=!1,c=new Set,p=a=>{for(let s of c)try{s(a)}catch{}};return{isIdentified:()=>i,methods:{subscribeIdentity(a){return c.add(a),()=>{c.delete(a)}},identify(a){if(!/^gg_ct_[A-Za-z0-9_-]{43}$/.test(a))throw new l("INVALID_TOKEN","Browser SDK requires a customer session");n.beforeIdentify?.(a),i=!1,t.reset(),e(),t.identify(a),i=!0,p(!0),n.afterChange?.()},reset(){try{n.beforeReset?.()}finally{i=!1,t.reset(),e(),p(!1),n.afterChange?.()}}}}}function u(t){if(t!==null&&typeof t=="object"&&"customerId"in t)throw new l("INVALID_REQUEST","Customer requests use the verified session identity")}function q(t){return{async checkEntitlement(e){u(e);let n=r.checkEntitlement;return o(t,n,e)},async readHoldings(e={}){let n=r.readHoldings;return o(t,{...n,request:n.request.omit({customerId:!0})},e)}}}function L(t){return{async readLedger(e){let n=r.readLedger;return o(t,n,{query:e})},async readCreditStatement(e){u(e);let n=r.readCreditStatement;return o(t,n,e)},async quoteBalance(e){u(e);let n=r.quoteBalance;return o(t,n,{command:e})}}}function z(t){return{async setupPayment(e){u(e);let n=r.setupPayment;return o(t,n,e)},async readPaymentSetup(e){u(e);let n=r.readPaymentSetup;return o(t,n,e)},async readBillingInvoice(e){u(e);let n=r.readBillingInvoice;return o(t,n,e)},async readBillingControls(e={}){u(e);let n=r.readBillingControls;return o(t,n,e)},async prepareBillingAuthorization(e){u(e);let n=r.prepareBillingAuthorization;return o(t,n,e)},async confirmBillingAuthorization(e){u(e);let n=r.confirmBillingAuthorization;return o(t,n,e)},async setBillingCoupons(e){u(e);let n=r.setBillingCoupons;return o(t,n,e,{request:"Invalid billing coupon list",response:"Invalid billing coupon receipt"})},async revokeBillingAuthorization(e){u(e);let n=r.revokeBillingAuthorization;return o(t,n,e)},async listBillingInvoices(e={after:null,limit:25}){u(e);let n=r.listBillingInvoices;return o(t,n,e)},async confirmBillingAdjustment(e){u(e);let n=r.confirmBillingAdjustment;return o(t,n,e)}}}function M(t){return{async previewUpdate(e){u(e);let n=r.previewUpdate;return o(t,n,e)},async update(e){u(e);let n=r.update;return o(t,n,e)},async readSubscriptionUpdate(e){u(e);let n=r.readSubscriptionUpdate;return o(t,n,e)},async restoreNativePurchase(e){u(e);let n=r.restoreNativePurchase;return o(t,n,e)},async previewAttach(e){u(e);let n=r.previewAttach;return o(t,n,e)},async attach(e){u(e);let n=r.attach;return o(t,n,e)},async readSubscriptionOperation(e){u(e);let n=r.readSubscriptionOperation;return o(t,n,e)}}}function H(t){return{async redeemReward(e){return u(e),(await o(t,r.redeemReward,{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid reward redemption",response:"Invalid reward receipt"})).redemption},async claimRewardProduct(e){return u(e),(await o(t,r.claimRewardProduct,e,{request:"Invalid reward product claim",response:"Invalid reward product checkout"})).checkout},async createReferralCode(e){return u(e),(await o(t,r.createReferralCode,{...e,requestId:e.requestId??crypto.randomUUID()},{request:"Invalid referral program",response:"Invalid referral code"})).referralCode},async redeemCoupon(e,n=crypto.randomUUID()){let i=await o(t,r.redeemCoupon,{code:e,requestId:n},{request:"Invalid coupon code",response:"Invalid Coupon receipt"});return{offer:i.offer,reason:i.reason}},async claimCoupon(e,n=crypto.randomUUID()){let i=await o(t,r.grantOffer,{couponId:e,requestId:n},{request:"Invalid Coupon claim",response:"Invalid Coupon receipt"});return{offer:i.offer,reason:i.reason}},async listOffers(){return(await o(t,r.listOffers,{},{response:"Invalid offers response"})).offers}}}function J(t){return{...q(t),...L(t),...z(t),...M(t),...H(t)}}function Q(t){return{async resolveContent(e){u(e);let n=r.resolveContent;return o(t,n,e)},async resolvePaywall(e){u(e);let n=r.resolvePaywall;return o(t,n,e)},async resolveOffering(e){u(e);let n=r.resolveOffering;return o(t,n,e)}}}var G=t=>new TextEncoder().encode(JSON.stringify(t)).length,Y=16384;function K(t,e){let n=0,i,c=y=>{i={config:structuredClone(y),until:Date.now()+3e4}},p=[],a=null,s;function d(){if(!e())throw new l("NOT_IDENTIFIED","Call identify before using Features or events")}function m(){s||!p.length||(s=setTimeout(()=>{s=void 0,A().catch(()=>{}).finally(m)},5e3),typeof s=="object"&&"unref"in s&&s.unref())}function E(y,v={},w={}){if(d(),i&&Date.now()<i.until&&!N(i.config,y))return;x();let O=r.trackEvents.request.parse({events:[{eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),name:y,properties:v,...w}]}).events[0];if(G({events:[O]})>Y)throw new l("INVALID_REQUEST","Event exceeds the delivery size limit");if(p.length>=500)throw new l("EVENT_QUEUE_FULL","Flush pending events before tracking more");p.push(structuredClone(O)),m()}async function A(y=!1){if(d(),a)return a;let v=n,w=(async()=>{let O={inserted:0,duplicates:0,rejected:0,skipped:0},C=p.length;for(;C&&v===n;){let b=[];for(let P of p.slice(0,Math.min(C,100))){if(b.length&&G({events:[...b,P]})>Y)break;b.push(P)}let F=r.trackEvents,I=await o(t,F,{events:b},void 0,{keepalive:y});if(v!==n)throw new l("IDENTITY_CHANGED","Event identity changed during delivery");if(I.inserted+I.duplicates+I.rejected+I.skipped!==b.length)throw new l("INVALID_RESPONSE","Incomplete event acknowledgement");c(I.analyticsConfig),p.splice(0,b.length),C-=b.length,O.inserted+=I.inserted,O.duplicates+=I.duplicates,O.rejected+=I.rejected,O.skipped+=I.skipped}return O})();a=w;try{return await w}finally{a===w&&(a=null)}}let R;function x(){if(R||typeof document>"u")return;let y=()=>{document.visibilityState==="hidden"&&e()&&p.length&&A(!0).catch(()=>{})};document.addEventListener("visibilitychange",y),R=()=>document.removeEventListener("visibilitychange",y)}return{rememberConfiguration:c,track(y,v,w={}){return x(),E(y,v,w)},flush:A,reset(){n++,i=void 0,clearTimeout(s),s=void 0,p=[],a=null},detachVisibility(){R?.(),R=void 0}}}function Z(t){let e=t.merchandise;if(typeof t.merchandiseId=="string")return{internalId:t.merchandiseId};if(!(!e||typeof e!="object"||Array.isArray(e))){if(typeof e.internalId=="string")return{internalId:e.internalId};if(typeof e.externalId=="string")return{id:e.externalId};if(typeof e.id=="string")return{id:e.id}}}function ue(t){let e=Z(t),{merchandiseId:n,merchandise:i,...c}=t;return{...c,...e?{merchandise:e}:{}}}function $(t,e,n,i,c){if(c&&i&&(c.scope.projectId!==i.projectId||c.scope.environment!==i.environment))throw new l("SCOPE_MISMATCH","Configuration belongs to another App/environment");let p=0,a=new Set;function s(){if(!e())throw new l("NOT_IDENTIFIED","Call identify before using Features or events")}async function d(m={}){c||s();let E=p,A=!1,R=async()=>{if(A||E!==p)throw new l("IDENTITY_CHANGED","Feature identity changed");let h=r.getFeatures,f=c?{scope:{projectId:c.scope.projectId,environment:c.scope.environment},payload:await c.features()}:await o(t,h,{});if(E!==p)throw new l("IDENTITY_CHANGED","Feature identity changed");if(i&&(f.scope.projectId!==i.projectId||f.scope.environment!==i.environment))throw new l("INVALID_RESPONSE","Feature response scope changed");return n.rememberConfiguration(f.payload.analyticsConfig),f},x=await R(),y=!0,v,w=h=>{try{m.onError?.(h)}catch{}},O=(h,f,g)=>{try{let T=Z(g);n.track(h,f,T?{merchandise:T}:{})}catch(T){w(T)}},C=D({assertUsable:c?.assertFeatures,scope:x.scope,attributes:m.attributes,onError:m.onError,load:async()=>y?(y=!1,x.payload):(await R()).payload,evaluateRemote:async h=>{if(E!==p)throw new l("IDENTITY_CHANGED","Feature identity changed");let f=r.evaluateFeatures,g=await o(t,f,{...h,attributes:ue(h.attributes)});if(g.scope.projectId!==x.scope.projectId||g.scope.environment!==x.scope.environment)throw new l("INVALID_RESPONSE","Remote Feature response scope changed");return{generation:g.generation,evaluatedAt:g.evaluatedAt,expiresAt:g.expiresAt,features:g.features,...g.merchandiseContext?{merchandiseContext:g.merchandiseContext}:{}}},onExperimentViewed:(h,f,g)=>O("Experiment Viewed",{experimentId:h.key,variationId:f.key},g),onFeatureUsage:(h,f,g)=>O("Feature Evaluated",{feature:h,value:f.value,source:f.source,ruleId:f.ruleId,...f.experimentResult?{variationId:f.experimentResult.key}:{}},g)}),b=C.refresh;function F(){clearTimeout(v),!c&&(A||E!==p||!C.expiresAt||(v=setTimeout(()=>{I().catch(w)},Math.min(2147483647,Math.max(1e3,Date.parse(C.expiresAt)-Date.now()))),typeof v=="object"&&"unref"in v&&v.unref()))}async function I(){try{return await b()}finally{F()}}let P=()=>{A||I().catch(w)},X=C.subscribe(F),ee=c?.subscribe(()=>{!A&&c.fresh&&I().catch(w)});function S(){A||(A=!0,clearTimeout(v),typeof window<"u"&&window.removeEventListener("focus",P),X(),ee?.(),C.reset(),a.delete(S))}a.add(S);try{await C.init(),(m.attributes?.merchandise||m.attributes?.merchandiseId)&&await C.refreshRemote()}catch(h){throw S(),h}return F(),!c&&typeof window<"u"&&window.addEventListener("focus",P),Object.assign(C,{refresh:I,destroy:S})}return{features:d,reset(m){p++,m();for(let E of a)E()}}}import{z as pe}from"zod";function W(t,e){let n="source"in e?{funnelId:e.source.id,funnelVersionId:e.source.versionId}:"versionId"in e?{funnelId:e.funnelId,funnelVersionId:e.versionId}:e,i=pe.object({funnelId:k.shape.id,funnelVersionId:k.shape.versionId.optional()}).safeParse(n);if(!i.success)throw new l("INVALID_REQUEST","A valid Funnel source is required");let c=Object.freeze(i.data);function p(a){if("customerId"in a)throw new l("INVALID_REQUEST","Customer identity cannot be overridden");if("funnelId"in a&&a.funnelId!==void 0&&a.funnelId!==c.funnelId||"funnelVersionId"in a&&a.funnelVersionId!==void 0&&a.funnelVersionId!==c.funnelVersionId)throw new l("SCOPE_MISMATCH","The original Funnel source cannot change");return{...a,...c}}return{async claimCoupon(a,s=crypto.randomUUID()){let d=r.grantOffer,m=await o(t,d,p({couponId:a,requestId:s}));return{offer:m.offer,reason:m.reason}},async resolveOffering(a){let s=r.resolveOffering;return o(t,s,p(a))},async resolvePaywall(a){let s=r.resolvePaywall;return o(t,s,p(a))},async previewAttach(a){let s=r.previewAttach;return o(t,s,p(a))}}}function le(t){let e=B(t),n=e.request,i=_(t.push,e,t.scope??t.configuration?.scope),c=U(e,()=>{a.reset(p.reset),p.detachVisibility()},{beforeIdentify:i.identify,beforeReset:i.reset,afterChange:i.start}),p=K(n,c.isIdentified),a=$(n,c.isIdentified,p,t.scope,t.configuration);return{messaging:{async preference(s){let d=r.readMessagingPreference;return d.response.parse(await n(d.path,d.request.parse({channel:s}))).preference},async setPreference(s){let d=r.setMessagingPreference;return d.response.parse(await n(d.path,d.request.parse(s))).preference}},push:{sync:i.sync,read:i.read,recover:i.recover,tokenObserver:i.tokenObserver,recoveryObserver:i.recoveryObserver,async preference(){let s=r.readMessagingPreference;return s.response.parse(await n(s.path,{channel:"push"})).preference},async setPreference(s){let d=r.setMessagingPreference;return d.response.parse(await n(d.path,d.request.parse({...s,channel:"push"}))).preference}},...J(n),...Q(n),forFunnel(s){return W(n,s)},async features(s={}){return a.features(s)},track(s,d,m={}){return p.track(s,d,m)},flush(){return p.flush()},...c.methods}}function de(t){if(!/^gg_ct_[A-Za-z0-9_-]{32,128}$/.test(t.customerToken))throw new l("INVALID_TOKEN","A customer credential is required");if(!t.scope)throw new l("INVALID_REQUEST","An explicit App and environment scope is required");let e=j({...t,scope:t.scope,apiKey:t.customerToken});return{async start(n){let i=await e.start(n),c=V({...t,runToken:i.runToken});c.identify(t.customerToken);let p=["evaluate","evaluate_segment"].includes(i.run.instruction?.type??"")?await c.get():i;return{...i,...p,controller:c}}}}async function Ct(...t){return(await import("./paywall-734GWAS4.js")).showPaywall(...t)}async function Ot(...t){return(await import("./funnel-runtime-host-ENRTSXPJ.js")).showFunnelRun(...t)}async function At(...t){return(await import("./content-2FCUY6XX.js")).mountContent(...t)}async function bt(...t){return(await import("./content-2FCUY6XX.js")).prepareContent(...t)}export{l as IndianaError,oe as createBrowserFunnelCommandStorage,ae as createConfigurationSync,D as createFeatureClient,de as createFunnelClient,V as createFunnelRunController,le as createIndiana,ce as createLocalFunnelClient,ie as createPaywallSession,se as evaluateFunnelNode,ne as formatCouponDiscount,te as formatCouponMoney,re as formatCouponTerms,At as mountContent,bt as prepareContent,Ot as showFunnelRun,Ct as showPaywall};
|