@tinkerlandai/indiana-sdk 0.8.1 → 0.8.3
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 +7 -0
- package/dist/{ai-usage-JoM7ZWk-.d.ts → ai-usage-BV-FlgWr.d.ts} +1 -1
- package/dist/{api-JVC7x2FV.d.ts → api-B3FIE41b.d.ts} +381 -7
- package/dist/chunk-2QPETWDX.js +1 -0
- package/dist/chunk-ANOOBDW5.js +350 -0
- package/dist/chunk-BNU6IG3F.js +1 -0
- package/dist/{chunk-YWFNWK7C.js → chunk-GRLMT5PR.js} +1 -1
- package/dist/chunk-LMR2TM3X.js +1 -0
- package/dist/chunk-OBYJWIRB.js +1 -0
- package/dist/{chunk-USLZX2ZA.js → chunk-SHSNIJJM.js} +1 -1
- package/dist/{chunk-6HG7U6AU.js → chunk-SOQO2RDZ.js} +1 -1
- package/dist/{chunk-KSNOXNTC.js → chunk-VVV3JNS3.js} +1 -1
- package/dist/{chunk-56AYS7RS.js → chunk-Y32NPIYY.js} +1 -1
- package/dist/chunk-ZT66RIFU.js +10 -0
- package/dist/{configuration-sync-BexM2qbg.d.ts → configuration-sync-DNvKXHk-.d.ts} +2 -2
- package/dist/{content-YNL2CRJZ.js → content-J3FKZTGT.js} +1 -1
- package/dist/{errors-DrdTlPwf.d.ts → errors-C8lRYZ0n.d.ts} +48 -1
- package/dist/{funnel-local-client-D1Fe7CZ6.d.ts → funnel-local-client-wbz-4gFx.d.ts} +28 -19
- package/dist/{funnel-runtime-host-CAMI6BJS.js → funnel-runtime-host-C5P5JTV3.js} +1 -1
- package/dist/index.d.ts +104 -14
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +3 -3
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +2 -2
- package/dist/{paywall-MXRMMF3R.js → paywall-3GIRKSHN.js} +1 -1
- package/dist/popup.d.ts +1 -1
- package/dist/popup.js +1 -1
- package/dist/react-native.d.ts +97 -4
- package/dist/react-native.js +1 -1
- package/dist/{screen-renderer-P7MLBHY5.js → screen-renderer-5FPYVSPW.js} +1 -1
- package/dist/server.d.ts +11 -8
- package/dist/server.js +1 -1
- package/dist/src-BMJCIMIF.js +1 -0
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3BQFJANQ.js +0 -1
- package/dist/chunk-AE4CUTUE.js +0 -1
- package/dist/chunk-AEUFCOFG.js +0 -1
- package/dist/chunk-F767CM3T.js +0 -7
- package/dist/chunk-X7JJAEQQ.js +0 -350
- package/dist/src-G7UQB3QE.js +0 -1
- package/dist/{screen-i6eHL11m.d.ts → screen-BpAejkn0.d.ts} +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,14 @@ import { z } from 'zod';
|
|
|
3
3
|
import { C as CouponInput, S as ScreenAnswers, s as screenInputBindingsSchema, a as SurfaceData, b as CustomerDataIntent, O as Offer } from './customer-page-WUQVK_tp.js';
|
|
4
4
|
export { c as OfferUnavailableReason } from './customer-page-WUQVK_tp.js';
|
|
5
5
|
import { J as JsonValue, F as FeatureResult } from './growth-rules-B4YYy64R.js';
|
|
6
|
-
import { S as StackNode } from './screen-
|
|
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-
|
|
12
|
-
|
|
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-wbz-4gFx.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-wbz-4gFx.js';
|
|
9
|
+
import { I as InvoiceModeParams, A as ApiInput, O as OfferingItem } from './api-B3FIE41b.js';
|
|
10
|
+
import { C as ConfigurationSync } from './configuration-sync-DNvKXHk-.js';
|
|
11
|
+
export { a as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-DNvKXHk-.js';
|
|
12
|
+
import { P as PushAddressObservation } from './errors-C8lRYZ0n.js';
|
|
13
|
+
export { I as IndianaError, a as PushHost, b as PushJournal } from './errors-C8lRYZ0n.js';
|
|
13
14
|
import 'zod/v4';
|
|
14
15
|
|
|
15
16
|
/** Currency always comes from business data; locale only controls notation. No currency conversion. */
|
|
@@ -921,7 +922,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
921
922
|
event: string;
|
|
922
923
|
} | {
|
|
923
924
|
type: "api";
|
|
924
|
-
operation: "update" | "attach" | "refund" | "readBalanceSource" | "adjustBalance" | "readUsage" | "setUsage" | "manageBalanceGrant" | "listBalanceGrants" | "restoreNativePurchase" | "setupPayment" | "readPaymentSetup" | "verifySubscriptions" | "previewAttach" | "readSubscriptionOperation" | "previewUpdate" | "readSubscriptionUpdate" | "previewRefund" | "readRefund" | "readBillingControls" | "prepareBillingAuthorization" | "confirmBillingAuthorization" | "setBillingCoupons" | "revokeBillingAuthorization" | "listBillingInvoices" | "confirmBillingAdjustment" | "manageBillingLimits" | "manageUsageEntity" | "readUsageAnalytics" | "readCreditAnalytics" | "submitUsageBatch" | "readUsageBatch" | "checkEntitlement" | "resolveOffering" | "readHoldings" | "readLedger" | "readBillingInvoice" | "readCreditStatement" | "quoteBalance" | "trackUsage" | "mutateBalance" | "redeemReward" | "createReferralCode" | "claimRewardProduct" | "readSeats" | "manageSeat" | "redeemCoupon" | "listOffers" | "grantOffer";
|
|
925
|
+
operation: "update" | "attach" | "refund" | "sendMessage" | "readBalanceSource" | "adjustBalance" | "readUsage" | "setUsage" | "manageBalanceGrant" | "listBalanceGrants" | "restoreNativePurchase" | "setupPayment" | "readPaymentSetup" | "verifySubscriptions" | "previewAttach" | "readSubscriptionOperation" | "previewUpdate" | "readSubscriptionUpdate" | "previewRefund" | "readRefund" | "readBillingControls" | "prepareBillingAuthorization" | "confirmBillingAuthorization" | "setBillingCoupons" | "revokeBillingAuthorization" | "listBillingInvoices" | "confirmBillingAdjustment" | "manageBillingLimits" | "manageUsageEntity" | "readUsageAnalytics" | "readCreditAnalytics" | "submitUsageBatch" | "readUsageBatch" | "checkEntitlement" | "resolveOffering" | "readHoldings" | "readLedger" | "readBillingInvoice" | "readCreditStatement" | "quoteBalance" | "trackUsage" | "mutateBalance" | "redeemReward" | "createReferralCode" | "claimRewardProduct" | "readSeats" | "manageSeat" | "redeemCoupon" | "listOffers" | "grantOffer";
|
|
925
926
|
inputs: Record<string, {
|
|
926
927
|
source: "literal";
|
|
927
928
|
value: zod.JSONType;
|
|
@@ -2991,7 +2992,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
2991
2992
|
} | {
|
|
2992
2993
|
type: "client_action";
|
|
2993
2994
|
receiptId: string;
|
|
2994
|
-
outcome: "success" | "failed" | "cancel" | "
|
|
2995
|
+
outcome: "success" | "failed" | "cancel" | "opened" | "failure";
|
|
2995
2996
|
};
|
|
2996
2997
|
requestId: string;
|
|
2997
2998
|
nodeId: string;
|
|
@@ -3064,7 +3065,7 @@ declare function createFunnelRunController(options: IndianaOptions & {
|
|
|
3064
3065
|
} | {
|
|
3065
3066
|
type: "client_action";
|
|
3066
3067
|
receiptId: string;
|
|
3067
|
-
outcome: "success" | "failed" | "cancel" | "
|
|
3068
|
+
outcome: "success" | "failed" | "cancel" | "opened" | "failure";
|
|
3068
3069
|
};
|
|
3069
3070
|
requestId: string;
|
|
3070
3071
|
nodeId: string;
|
|
@@ -12511,7 +12512,7 @@ declare function createIndiana(options: IndianaOptions): {
|
|
|
12511
12512
|
name: string;
|
|
12512
12513
|
groupId: string | null;
|
|
12513
12514
|
membershipType: "addon" | "main";
|
|
12514
|
-
status: "unknown" | "
|
|
12515
|
+
status: "unknown" | "active" | "pending" | "expired" | "scheduled" | "trial" | "past_due" | "paused" | "ended" | "trialing";
|
|
12515
12516
|
cancelAtPeriodEnd: boolean;
|
|
12516
12517
|
accessEnabled: boolean;
|
|
12517
12518
|
renewalChange: {
|
|
@@ -12569,6 +12570,95 @@ declare function createIndiana(options: IndianaOptions): {
|
|
|
12569
12570
|
balancesLimited: boolean;
|
|
12570
12571
|
};
|
|
12571
12572
|
}>;
|
|
12573
|
+
messaging: {
|
|
12574
|
+
preference(channel: "email" | "sms" | "voice" | "push"): Promise<{
|
|
12575
|
+
channel: "email" | "sms" | "voice" | "push";
|
|
12576
|
+
state: "allowed" | "unknown" | "denied";
|
|
12577
|
+
revision: number;
|
|
12578
|
+
updatedAt: string | null;
|
|
12579
|
+
}>;
|
|
12580
|
+
setPreference(input: ApiInput<"setMessagingPreference">): Promise<{
|
|
12581
|
+
channel: "email" | "sms" | "voice" | "push";
|
|
12582
|
+
state: "allowed" | "unknown" | "denied";
|
|
12583
|
+
revision: number;
|
|
12584
|
+
updatedAt: string | null;
|
|
12585
|
+
}>;
|
|
12586
|
+
};
|
|
12587
|
+
push: {
|
|
12588
|
+
sync: () => Promise<{
|
|
12589
|
+
installationId: string;
|
|
12590
|
+
bound: boolean;
|
|
12591
|
+
identitySeq: number;
|
|
12592
|
+
bindingGeneration: number;
|
|
12593
|
+
addressSeq: number;
|
|
12594
|
+
addressRevision: number;
|
|
12595
|
+
connectionId: string | null;
|
|
12596
|
+
addressStatus: "active" | "invalid" | null;
|
|
12597
|
+
permission: "unknown" | "denied" | "provisional" | "granted";
|
|
12598
|
+
} | null>;
|
|
12599
|
+
read: () => Promise<{
|
|
12600
|
+
installationId: string;
|
|
12601
|
+
bound: boolean;
|
|
12602
|
+
identitySeq: number;
|
|
12603
|
+
bindingGeneration: number;
|
|
12604
|
+
addressSeq: number;
|
|
12605
|
+
addressRevision: number;
|
|
12606
|
+
connectionId: string | null;
|
|
12607
|
+
addressStatus: "active" | "invalid" | null;
|
|
12608
|
+
permission: "unknown" | "denied" | "provisional" | "granted";
|
|
12609
|
+
}>;
|
|
12610
|
+
recover: () => Promise<{
|
|
12611
|
+
installationId: string;
|
|
12612
|
+
bound: boolean;
|
|
12613
|
+
identitySeq: number;
|
|
12614
|
+
bindingGeneration: number;
|
|
12615
|
+
addressSeq: number;
|
|
12616
|
+
addressRevision: number;
|
|
12617
|
+
connectionId: string | null;
|
|
12618
|
+
addressStatus: "active" | "invalid" | null;
|
|
12619
|
+
permission: "unknown" | "denied" | "provisional" | "granted";
|
|
12620
|
+
} | null>;
|
|
12621
|
+
tokenObserver: () => (observation: PushAddressObservation) => Promise<{
|
|
12622
|
+
installationId: string;
|
|
12623
|
+
bound: boolean;
|
|
12624
|
+
identitySeq: number;
|
|
12625
|
+
bindingGeneration: number;
|
|
12626
|
+
addressSeq: number;
|
|
12627
|
+
addressRevision: number;
|
|
12628
|
+
connectionId: string | null;
|
|
12629
|
+
addressStatus: "active" | "invalid" | null;
|
|
12630
|
+
permission: "unknown" | "denied" | "provisional" | "granted";
|
|
12631
|
+
} | null>;
|
|
12632
|
+
recoveryObserver: () => {
|
|
12633
|
+
request(observation: PushAddressObservation): Promise<{
|
|
12634
|
+
requested: true;
|
|
12635
|
+
expiresAt: string;
|
|
12636
|
+
}>;
|
|
12637
|
+
confirm(challenge: string, observation: PushAddressObservation): Promise<{
|
|
12638
|
+
installationId: string;
|
|
12639
|
+
bound: boolean;
|
|
12640
|
+
identitySeq: number;
|
|
12641
|
+
bindingGeneration: number;
|
|
12642
|
+
addressSeq: number;
|
|
12643
|
+
addressRevision: number;
|
|
12644
|
+
connectionId: string | null;
|
|
12645
|
+
addressStatus: "active" | "invalid" | null;
|
|
12646
|
+
permission: "unknown" | "denied" | "provisional" | "granted";
|
|
12647
|
+
}>;
|
|
12648
|
+
};
|
|
12649
|
+
preference(): Promise<{
|
|
12650
|
+
channel: "email" | "sms" | "voice" | "push";
|
|
12651
|
+
state: "allowed" | "unknown" | "denied";
|
|
12652
|
+
revision: number;
|
|
12653
|
+
updatedAt: string | null;
|
|
12654
|
+
}>;
|
|
12655
|
+
setPreference(input: Omit<ApiInput<"setMessagingPreference">, "channel">): Promise<{
|
|
12656
|
+
channel: "email" | "sms" | "voice" | "push";
|
|
12657
|
+
state: "allowed" | "unknown" | "denied";
|
|
12658
|
+
revision: number;
|
|
12659
|
+
updatedAt: string | null;
|
|
12660
|
+
}>;
|
|
12661
|
+
};
|
|
12572
12662
|
};
|
|
12573
12663
|
|
|
12574
12664
|
interface FunnelStorageLocks {
|
|
@@ -13151,7 +13241,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
13151
13241
|
event: string;
|
|
13152
13242
|
} | {
|
|
13153
13243
|
type: "api";
|
|
13154
|
-
operation: "update" | "attach" | "refund" | "readBalanceSource" | "adjustBalance" | "readUsage" | "setUsage" | "manageBalanceGrant" | "listBalanceGrants" | "restoreNativePurchase" | "setupPayment" | "readPaymentSetup" | "verifySubscriptions" | "previewAttach" | "readSubscriptionOperation" | "previewUpdate" | "readSubscriptionUpdate" | "previewRefund" | "readRefund" | "readBillingControls" | "prepareBillingAuthorization" | "confirmBillingAuthorization" | "setBillingCoupons" | "revokeBillingAuthorization" | "listBillingInvoices" | "confirmBillingAdjustment" | "manageBillingLimits" | "manageUsageEntity" | "readUsageAnalytics" | "readCreditAnalytics" | "submitUsageBatch" | "readUsageBatch" | "checkEntitlement" | "resolveOffering" | "readHoldings" | "readLedger" | "readBillingInvoice" | "readCreditStatement" | "quoteBalance" | "trackUsage" | "mutateBalance" | "redeemReward" | "createReferralCode" | "claimRewardProduct" | "readSeats" | "manageSeat" | "redeemCoupon" | "listOffers" | "grantOffer";
|
|
13244
|
+
operation: "update" | "attach" | "refund" | "sendMessage" | "readBalanceSource" | "adjustBalance" | "readUsage" | "setUsage" | "manageBalanceGrant" | "listBalanceGrants" | "restoreNativePurchase" | "setupPayment" | "readPaymentSetup" | "verifySubscriptions" | "previewAttach" | "readSubscriptionOperation" | "previewUpdate" | "readSubscriptionUpdate" | "previewRefund" | "readRefund" | "readBillingControls" | "prepareBillingAuthorization" | "confirmBillingAuthorization" | "setBillingCoupons" | "revokeBillingAuthorization" | "listBillingInvoices" | "confirmBillingAdjustment" | "manageBillingLimits" | "manageUsageEntity" | "readUsageAnalytics" | "readCreditAnalytics" | "submitUsageBatch" | "readUsageBatch" | "checkEntitlement" | "resolveOffering" | "readHoldings" | "readLedger" | "readBillingInvoice" | "readCreditStatement" | "quoteBalance" | "trackUsage" | "mutateBalance" | "redeemReward" | "createReferralCode" | "claimRewardProduct" | "readSeats" | "manageSeat" | "redeemCoupon" | "listOffers" | "grantOffer";
|
|
13155
13245
|
inputs: Record<string, {
|
|
13156
13246
|
source: "literal";
|
|
13157
13247
|
value: zod.JSONType;
|
|
@@ -15221,7 +15311,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
15221
15311
|
} | {
|
|
15222
15312
|
type: "client_action";
|
|
15223
15313
|
receiptId: string;
|
|
15224
|
-
outcome: "success" | "failed" | "cancel" | "
|
|
15314
|
+
outcome: "success" | "failed" | "cancel" | "opened" | "failure";
|
|
15225
15315
|
};
|
|
15226
15316
|
requestId: string;
|
|
15227
15317
|
nodeId: string;
|
|
@@ -15294,7 +15384,7 @@ declare function createFunnelClient(options: IndianaOptions & {
|
|
|
15294
15384
|
} | {
|
|
15295
15385
|
type: "client_action";
|
|
15296
15386
|
receiptId: string;
|
|
15297
|
-
outcome: "success" | "failed" | "cancel" | "
|
|
15387
|
+
outcome: "success" | "failed" | "cancel" | "opened" | "failure";
|
|
15298
15388
|
};
|
|
15299
15389
|
requestId: string;
|
|
15300
15390
|
nodeId: string;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k,f as te,i as D,j as ne,k as re,l as oe,m as V,n as ie}from"./chunk-56AYS7RS.js";import"./chunk-YWFNWK7C.js";import{a as o}from"./chunk-KSNOXNTC.js";import{a as B}from"./chunk-AEUFCOFG.js";import{ei as r,fe as N,ga as W,ha as X,ia as ee,ri as P}from"./chunk-F767CM3T.js";import{a as p}from"./chunk-6HG7U6AU.js";import"./chunk-3BQFJANQ.js";import"./chunk-AE4CUTUE.js";import"./chunk-EXCPE2XH.js";import"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";function _(t,e){let n=!1,a=new Set,s=u=>{for(let i of a)try{i(u)}catch{}};return{isIdentified:()=>n,methods:{subscribeIdentity(u){return a.add(u),()=>{a.delete(u)}},identify(u){if(!/^gg_ct_[A-Za-z0-9_-]{43}$/.test(u))throw new p("INVALID_TOKEN","Browser SDK requires a customer session");n=!1,t.reset(),e(),t.identify(u),n=!0,s(!0)},reset(){n=!1,t.reset(),e(),s(!1)}}}}function c(t){if(t!==null&&typeof t=="object"&&"customerId"in t)throw new p("INVALID_REQUEST","Customer requests use the verified session identity")}function U(t){return{async checkEntitlement(e){c(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 j(t){return{async readLedger(e){let n=r.readLedger;return o(t,n,{query:e})},async readCreditStatement(e){c(e);let n=r.readCreditStatement;return o(t,n,e)},async quoteBalance(e){c(e);let n=r.quoteBalance;return o(t,n,{command:e})}}}function q(t){return{async setupPayment(e){c(e);let n=r.setupPayment;return o(t,n,e)},async readPaymentSetup(e){c(e);let n=r.readPaymentSetup;return o(t,n,e)},async readBillingInvoice(e){c(e);let n=r.readBillingInvoice;return o(t,n,e)},async readBillingControls(e={}){c(e);let n=r.readBillingControls;return o(t,n,e)},async prepareBillingAuthorization(e){c(e);let n=r.prepareBillingAuthorization;return o(t,n,e)},async confirmBillingAuthorization(e){c(e);let n=r.confirmBillingAuthorization;return o(t,n,e)},async setBillingCoupons(e){c(e);let n=r.setBillingCoupons;return o(t,n,e,{request:"Invalid billing coupon list",response:"Invalid billing coupon receipt"})},async revokeBillingAuthorization(e){c(e);let n=r.revokeBillingAuthorization;return o(t,n,e)},async listBillingInvoices(e={after:null,limit:25}){c(e);let n=r.listBillingInvoices;return o(t,n,e)},async confirmBillingAdjustment(e){c(e);let n=r.confirmBillingAdjustment;return o(t,n,e)}}}function L(t){return{async previewUpdate(e){c(e);let n=r.previewUpdate;return o(t,n,e)},async update(e){c(e);let n=r.update;return o(t,n,e)},async readSubscriptionUpdate(e){c(e);let n=r.readSubscriptionUpdate;return o(t,n,e)},async restoreNativePurchase(e){c(e);let n=r.restoreNativePurchase;return o(t,n,e)},async previewAttach(e){c(e);let n=r.previewAttach;return o(t,n,e)},async attach(e){c(e);let n=r.attach;return o(t,n,e)},async readSubscriptionOperation(e){c(e);let n=r.readSubscriptionOperation;return o(t,n,e)}}}function z(t){return{async redeemReward(e){return c(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 c(e),(await o(t,r.claimRewardProduct,e,{request:"Invalid reward product claim",response:"Invalid reward product checkout"})).checkout},async createReferralCode(e){return c(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 a=await o(t,r.redeemCoupon,{code:e,requestId:n},{request:"Invalid coupon code",response:"Invalid Coupon receipt"});return{offer:a.offer,reason:a.reason}},async claimCoupon(e,n=crypto.randomUUID()){let a=await o(t,r.grantOffer,{couponId:e,requestId:n},{request:"Invalid Coupon claim",response:"Invalid Coupon receipt"});return{offer:a.offer,reason:a.reason}},async listOffers(){return(await o(t,r.listOffers,{},{response:"Invalid offers response"})).offers}}}function H(t){return{...U(t),...j(t),...q(t),...L(t),...z(t)}}function J(t){return{async resolveContent(e){c(e);let n=r.resolveContent;return o(t,n,e)},async resolvePaywall(e){c(e);let n=r.resolvePaywall;return o(t,n,e)},async resolveOffering(e){c(e);let n=r.resolveOffering;return o(t,n,e)}}}var M=t=>new TextEncoder().encode(JSON.stringify(t)).length,Q=16384;function G(t,e){let n=0,a,s=m=>{a={config:structuredClone(m),until:Date.now()+3e4}},u=[],i=null,l;function F(){if(!e())throw new p("NOT_IDENTIFIED","Call identify before using Features or events")}function v(){l||!u.length||(l=setTimeout(()=>{l=void 0,h().catch(()=>{}).finally(v)},5e3),typeof l=="object"&&"unref"in l&&l.unref())}function O(m,y={}){if(F(),a&&Date.now()<a.until&&!N(a.config,m))return;b();let w=r.trackEvents.request.parse({events:[{eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),name:m,properties:y}]}).events[0];if(M({events:[w]})>Q)throw new p("INVALID_REQUEST","Event exceeds the delivery size limit");if(u.length>=500)throw new p("EVENT_QUEUE_FULL","Flush pending events before tracking more");u.push(structuredClone(w)),v()}async function h(m=!1){if(F(),i)return i;let y=n,w=(async()=>{let A={inserted:0,duplicates:0,rejected:0,skipped:0},g=u.length;for(;g&&y===n;){let C=[];for(let x of u.slice(0,Math.min(g,100))){if(C.length&&M({events:[...C,x]})>Q)break;C.push(x)}let S=r.trackEvents,f=await o(t,S,{events:C},void 0,{keepalive:m});if(y!==n)throw new p("IDENTITY_CHANGED","Event identity changed during delivery");if(f.inserted+f.duplicates+f.rejected+f.skipped!==C.length)throw new p("INVALID_RESPONSE","Incomplete event acknowledgement");s(f.analyticsConfig),u.splice(0,C.length),g-=C.length,A.inserted+=f.inserted,A.duplicates+=f.duplicates,A.rejected+=f.rejected,A.skipped+=f.skipped}return A})();i=w;try{return await w}finally{i===w&&(i=null)}}let R;function b(){if(R||typeof document>"u")return;let m=()=>{document.visibilityState==="hidden"&&e()&&u.length&&h(!0).catch(()=>{})};document.addEventListener("visibilitychange",m),R=()=>document.removeEventListener("visibilitychange",m)}return{rememberConfiguration:s,track(m,y){return b(),O(m,y)},flush:h,reset(){n++,a=void 0,clearTimeout(l),l=void 0,u=[],i=null},detachVisibility(){R?.(),R=void 0}}}function Y(t,e,n,a,s){if(s&&a&&(s.scope.projectId!==a.projectId||s.scope.environment!==a.environment))throw new p("SCOPE_MISMATCH","Configuration belongs to another App/environment");let u=0,i=new Set;function l(){if(!e())throw new p("NOT_IDENTIFIED","Call identify before using Features or events")}async function F(v={}){s||l();let O=u,h=!1,R=async()=>{if(h||O!==u)throw new p("IDENTITY_CHANGED","Feature identity changed");let I=r.getFeatures,d=s?{scope:{projectId:s.scope.projectId,environment:s.scope.environment},payload:await s.features()}:await o(t,I,{});if(O!==u)throw new p("IDENTITY_CHANGED","Feature identity changed");if(a&&(d.scope.projectId!==a.projectId||d.scope.environment!==a.environment))throw new p("INVALID_RESPONSE","Feature response scope changed");return n.rememberConfiguration(d.payload.analyticsConfig),d},b=await R(),m=!0,y,w=I=>{try{v.onError?.(I)}catch{}},A=(I,d)=>{try{n.track(I,d)}catch(E){w(E)}},g=k({assertUsable:s?.assertFeatures,scope:b.scope,attributes:v.attributes,onError:v.onError,load:async()=>m?(m=!1,b.payload):(await R()).payload,evaluateRemote:async I=>{if(O!==u)throw new p("IDENTITY_CHANGED","Feature identity changed");let d=r.evaluateFeatures,E=await o(t,d,I);if(E.scope.projectId!==b.scope.projectId||E.scope.environment!==b.scope.environment)throw new p("INVALID_RESPONSE","Remote Feature response scope changed");return{generation:E.generation,evaluatedAt:E.evaluatedAt,expiresAt:E.expiresAt,features:E.features}},onExperimentViewed:(I,d)=>A("Experiment Viewed",{experimentId:I.key,variationId:d.key}),onFeatureUsage:(I,d)=>A("Feature Evaluated",{feature:I,value:d.value,source:d.source,ruleId:d.ruleId,...d.experimentResult?{variationId:d.experimentResult.key}:{}})}),C=g.refresh;function S(){clearTimeout(y),!s&&(h||O!==u||!g.expiresAt||(y=setTimeout(()=>{f().catch(w)},Math.min(2147483647,Math.max(1e3,Date.parse(g.expiresAt)-Date.now()))),typeof y=="object"&&"unref"in y&&y.unref()))}async function f(){try{return await C()}finally{S()}}let x=()=>{h||f().catch(w)},Z=g.subscribe(S),$=s?.subscribe(()=>{!h&&s.fresh&&f().catch(w)});function T(){h||(h=!0,clearTimeout(y),typeof window<"u"&&window.removeEventListener("focus",x),Z(),$?.(),g.reset(),i.delete(T))}i.add(T);try{await g.init()}catch(I){throw T(),I}return S(),!s&&typeof window<"u"&&window.addEventListener("focus",x),Object.assign(g,{refresh:f,destroy:T})}return{features:F,reset(v){u++,v();for(let O of i)O()}}}import{z as ae}from"zod";function K(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,a=ae.object({funnelId:P.shape.id,funnelVersionId:P.shape.versionId.optional()}).safeParse(n);if(!a.success)throw new p("INVALID_REQUEST","A valid Funnel source is required");let s=Object.freeze(a.data);function u(i){if("customerId"in i)throw new p("INVALID_REQUEST","Customer identity cannot be overridden");if("funnelId"in i&&i.funnelId!==void 0&&i.funnelId!==s.funnelId||"funnelVersionId"in i&&i.funnelVersionId!==void 0&&i.funnelVersionId!==s.funnelVersionId)throw new p("SCOPE_MISMATCH","The original Funnel source cannot change");return{...i,...s}}return{async claimCoupon(i,l=crypto.randomUUID()){let F=r.grantOffer,v=await o(t,F,u({couponId:i,requestId:l}));return{offer:v.offer,reason:v.reason}},async resolveOffering(i){let l=r.resolveOffering;return o(t,l,u(i))},async resolvePaywall(i){let l=r.resolvePaywall;return o(t,l,u(i))},async previewAttach(i){let l=r.previewAttach;return o(t,l,u(i))}}}function se(t){let e=B(t),n=e.request,a=_(e,()=>{u.reset(s.reset),s.detachVisibility()}),s=G(n,a.isIdentified),u=Y(n,a.isIdentified,s,t.scope,t.configuration);return{...H(n),...J(n),forFunnel(i){return K(n,i)},async features(i={}){return u.features(i)},track(i,l){return s.track(i,l)},flush(){return s.flush()},...a.methods}}function ue(t){if(!/^gg_ct_[A-Za-z0-9_-]{32,128}$/.test(t.customerToken))throw new p("INVALID_TOKEN","A customer credential is required");if(!t.scope)throw new p("INVALID_REQUEST","An explicit App and environment scope is required");let e=V({...t,scope:t.scope,apiKey:t.customerToken});return{async start(n){let a=await e.start(n),s=D({...t,runToken:a.runToken});s.identify(t.customerToken);let u=["evaluate","evaluate_segment"].includes(a.run.instruction?.type??"")?await s.get():a;return{...a,...u,controller:s}}}}async function yt(...t){return(await import("./paywall-MXRMMF3R.js")).showPaywall(...t)}async function It(...t){return(await import("./funnel-runtime-host-CAMI6BJS.js")).showFunnelRun(...t)}async function vt(...t){return(await import("./content-YNL2CRJZ.js")).mountContent(...t)}export{p as IndianaError,te as createBrowserFunnelCommandStorage,re as createConfigurationSync,k as createFeatureClient,ue as createFunnelClient,D as createFunnelRunController,se as createIndiana,ie as createLocalFunnelClient,ne as createPaywallSession,oe as evaluateFunnelNode,X as formatCouponDiscount,W as formatCouponMoney,ee as formatCouponTerms,vt as mountContent,It as showFunnelRun,yt as showPaywall};
|
|
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};
|