@tinkerlandai/longplay-sdk 0.10.16 → 0.10.17-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/{ai-usage-DejUdb17.d.ts → ai-usage-D7BUuP1H.d.ts} +1 -1
  3. package/dist/{api-RQUBSSEJ.d.ts → api-CIbhe8RY.d.ts} +124 -107
  4. package/dist/{chunk-67XTOBGE.js → chunk-4OYBOUHX.js} +1 -1
  5. package/dist/{chunk-55MXKW5J.js → chunk-5BRVIJ6H.js} +1 -1
  6. package/dist/{chunk-4IGRIYOQ.js → chunk-G5LJYYKS.js} +1 -1
  7. package/dist/{chunk-APO7QUBB.js → chunk-GGHK74PT.js} +1 -1
  8. package/dist/chunk-JQ2OW2G2.js +6 -0
  9. package/dist/{chunk-JKLILKI5.js → chunk-MVTV3XXW.js} +1 -1
  10. package/dist/{chunk-AC32XJZW.js → chunk-NAM3Q4GO.js} +1 -1
  11. package/dist/{chunk-6MBVIE3H.js → chunk-VOBRWTAA.js} +1 -1
  12. package/dist/{chunk-M5HQW67G.js → chunk-VOXHGPEV.js} +1 -1
  13. package/dist/chunk-XLD7WFN7.js +1 -0
  14. package/dist/{content-XCLXWNGN.js → content-3O52CXRR.js} +1 -1
  15. package/dist/{funnel-local-client-P_R6FHVV.d.ts → funnel-local-client-CAuNpJ-e.d.ts} +1 -1
  16. package/dist/{funnel-process-client-CY-GQ_SF.d.ts → funnel-process-client-C9EIwNTr.d.ts} +2 -2
  17. package/dist/funnel-runtime-host-RPM6N7B5.js +1 -0
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.js +1 -1
  20. package/dist/native-shell.js +1 -1
  21. package/dist/openrouter.d.ts +2 -2
  22. package/dist/openrouter.js +1 -1
  23. package/dist/page.js +1 -1
  24. package/dist/{paywall-H3KQZEJG.js → paywall-A3LCG5VV.js} +1 -1
  25. package/dist/react-native.d.ts +5 -5
  26. package/dist/react-native.js +1 -1
  27. package/dist/server.d.ts +4 -4
  28. package/dist/server.js +1 -1
  29. package/dist/visual.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/chunk-EFFXE6CX.js +0 -6
  32. package/dist/chunk-FKBSUKXE.js +0 -1
  33. package/dist/funnel-runtime-host-GFTN7KQK.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.17 — 2026-11-06
4
+
5
+ - Add `recordMerchantEvent` to the JavaScript, Python and Go Server SDKs as the single entry for merchant-reported results, including Coupon use (`coupon.redeemed`) and non-financial facts.
6
+ - **Breaking:** remove `recordBillingEvent` and `recordCouponRedemption` with no replacement alias. Call `recordMerchantEvent` instead: drop `provider`, send Coupon use as `type: "coupon.redeemed"`, and read the result from `record`, not `receipt`. Wire protocol stays `0.10`.
7
+
3
8
  ## 0.10.16 — 2026-11-05
4
9
 
5
10
  - Add bounded local display interactions, responsive presentation and brand fonts to the shared screen renderer, including billing controls and catalog-backed quantity sliders.
@@ -1,5 +1,5 @@
1
1
  import { LanguageModelV4Usage, LanguageModelV4Middleware } from '@ai-sdk/provider';
2
- import { F as FoundationApi, A as ApiInput } from './api-RQUBSSEJ.js';
2
+ import { F as FoundationApi, A as ApiInput } from './api-CIbhe8RY.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const tokenCounts: z.ZodObject<{
@@ -4466,48 +4466,12 @@ declare const apiOperations: {
4466
4466
  }, z$1.core.$strict>;
4467
4467
  }, z$1.core.$strict>;
4468
4468
  };
4469
- readonly recordBillingEvent: {
4469
+ readonly recordMerchantEvent: {
4470
4470
  readonly method: "POST";
4471
- readonly path: "billing/events/record";
4471
+ readonly path: "merchant/events/record";
4472
4472
  readonly permission: "billing:write";
4473
4473
  readonly audience: "server";
4474
- readonly request: z$1.ZodUnion<readonly [z$1.ZodObject<{
4475
- provider: z$1.ZodLiteral<"stripe">;
4476
- accountId: z$1.ZodString;
4477
- eventId: z$1.ZodString;
4478
- type: z$1.ZodEnum<{
4479
- "invoice.paid": "invoice.paid";
4480
- "refund.updated": "refund.updated";
4481
- "checkout.session.completed": "checkout.session.completed";
4482
- "checkout.session.expired": "checkout.session.expired";
4483
- "checkout.session.async_payment_succeeded": "checkout.session.async_payment_succeeded";
4484
- "checkout.session.async_payment_failed": "checkout.session.async_payment_failed";
4485
- "customer.subscription.created": "customer.subscription.created";
4486
- "customer.subscription.updated": "customer.subscription.updated";
4487
- "customer.subscription.deleted": "customer.subscription.deleted";
4488
- "customer.subscription.paused": "customer.subscription.paused";
4489
- "customer.subscription.resumed": "customer.subscription.resumed";
4490
- "invoice.created": "invoice.created";
4491
- "customer.discount.created": "customer.discount.created";
4492
- "customer.discount.updated": "customer.discount.updated";
4493
- "refund.created": "refund.created";
4494
- "refund.failed": "refund.failed";
4495
- "charge.refunded": "charge.refunded";
4496
- }>;
4497
- occurredAt: z$1.ZodNumber;
4498
- data: z$1.ZodIntersection<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>, z$1.ZodObject<{
4499
- id: z$1.ZodString;
4500
- object: z$1.ZodEnum<{
4501
- subscription: "subscription";
4502
- discount: "discount";
4503
- refund: "refund";
4504
- invoice: "invoice";
4505
- charge: "charge";
4506
- "checkout.session": "checkout.session";
4507
- }>;
4508
- livemode: z$1.ZodBoolean;
4509
- }, z$1.core.$strip>>;
4510
- }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4474
+ readonly request: z$1.ZodUnion<readonly [z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4511
4475
  type: z$1.ZodLiteral<"purchase.completed">;
4512
4476
  operationId: z$1.ZodUUID;
4513
4477
  merchantOrderId: z$1.ZodString;
@@ -4561,7 +4525,6 @@ declare const apiOperations: {
4561
4525
  quantity: z$1.ZodNumber;
4562
4526
  }, z$1.core.$strict>>;
4563
4527
  }, z$1.core.$strict>>;
4564
- provider: z$1.ZodLiteral<"merchant">;
4565
4528
  eventId: z$1.ZodString;
4566
4529
  customerId: z$1.ZodUUID;
4567
4530
  occurredAt: z$1.ZodISODateTime;
@@ -4573,7 +4536,6 @@ declare const apiOperations: {
4573
4536
  expired: "expired";
4574
4537
  canceled: "canceled";
4575
4538
  }>;
4576
- provider: z$1.ZodLiteral<"merchant">;
4577
4539
  eventId: z$1.ZodString;
4578
4540
  customerId: z$1.ZodUUID;
4579
4541
  occurredAt: z$1.ZodISODateTime;
@@ -4603,7 +4565,6 @@ declare const apiOperations: {
4603
4565
  quantity: z$1.ZodNumber;
4604
4566
  }, z$1.core.$strict>>;
4605
4567
  }, z$1.core.$strict>;
4606
- provider: z$1.ZodLiteral<"merchant">;
4607
4568
  eventId: z$1.ZodString;
4608
4569
  customerId: z$1.ZodUUID;
4609
4570
  occurredAt: z$1.ZodISODateTime;
@@ -4660,7 +4621,6 @@ declare const apiOperations: {
4660
4621
  periodEndsAt: z$1.ZodNullable<z$1.ZodISODateTime>;
4661
4622
  }, z$1.core.$strict>>;
4662
4623
  }, z$1.core.$strict>>;
4663
- provider: z$1.ZodLiteral<"merchant">;
4664
4624
  eventId: z$1.ZodString;
4665
4625
  customerId: z$1.ZodUUID;
4666
4626
  occurredAt: z$1.ZodISODateTime;
@@ -4689,7 +4649,6 @@ declare const apiOperations: {
4689
4649
  periodEndsAt: z$1.ZodNullable<z$1.ZodISODateTime>;
4690
4650
  }, z$1.core.$strict>>;
4691
4651
  }, z$1.core.$strict>;
4692
- provider: z$1.ZodLiteral<"merchant">;
4693
4652
  eventId: z$1.ZodString;
4694
4653
  customerId: z$1.ZodUUID;
4695
4654
  occurredAt: z$1.ZodISODateTime;
@@ -4705,11 +4664,122 @@ declare const apiOperations: {
4705
4664
  }>;
4706
4665
  amountMinor: z$1.ZodNumber;
4707
4666
  currency: z$1.ZodString;
4708
- provider: z$1.ZodLiteral<"merchant">;
4709
4667
  eventId: z$1.ZodString;
4710
4668
  customerId: z$1.ZodUUID;
4711
4669
  occurredAt: z$1.ZodISODateTime;
4712
- }, z$1.core.$strict>], "type">]>;
4670
+ }, z$1.core.$strict>, z$1.ZodObject<{
4671
+ type: z$1.ZodLiteral<"fulfillment.updated">;
4672
+ operationId: z$1.ZodUUID;
4673
+ merchantFulfillmentId: z$1.ZodString;
4674
+ status: z$1.ZodEnum<{
4675
+ pending: "pending";
4676
+ applied: "applied";
4677
+ failed: "failed";
4678
+ }>;
4679
+ eventId: z$1.ZodString;
4680
+ customerId: z$1.ZodUUID;
4681
+ occurredAt: z$1.ZodISODateTime;
4682
+ }, z$1.core.$strict>, z$1.ZodObject<{
4683
+ type: z$1.ZodLiteral<"benefit.claimed">;
4684
+ merchantBenefitId: z$1.ZodString;
4685
+ resource: z$1.ZodString;
4686
+ unit: z$1.ZodString;
4687
+ quantity: z$1.ZodNumber;
4688
+ expiresAt: z$1.ZodNullable<z$1.ZodISODateTime>;
4689
+ revision: z$1.ZodNumber;
4690
+ eventId: z$1.ZodString;
4691
+ customerId: z$1.ZodUUID;
4692
+ occurredAt: z$1.ZodISODateTime;
4693
+ }, z$1.core.$strict>, z$1.ZodObject<{
4694
+ type: z$1.ZodLiteral<"benefit.closed">;
4695
+ merchantBenefitId: z$1.ZodString;
4696
+ status: z$1.ZodEnum<{
4697
+ failed: "failed";
4698
+ expired: "expired";
4699
+ canceled: "canceled";
4700
+ }>;
4701
+ revision: z$1.ZodNumber;
4702
+ eventId: z$1.ZodString;
4703
+ customerId: z$1.ZodUUID;
4704
+ occurredAt: z$1.ZodISODateTime;
4705
+ }, z$1.core.$strict>, z$1.ZodObject<{
4706
+ type: z$1.ZodLiteral<"benefit.updated">;
4707
+ merchantBenefitId: z$1.ZodString;
4708
+ status: z$1.ZodEnum<{
4709
+ active: "active";
4710
+ expired: "expired";
4711
+ revoked: "revoked";
4712
+ }>;
4713
+ remainingQuantity: z$1.ZodNullable<z$1.ZodNumber>;
4714
+ expiresAt: z$1.ZodNullable<z$1.ZodISODateTime>;
4715
+ revision: z$1.ZodNumber;
4716
+ eventId: z$1.ZodString;
4717
+ customerId: z$1.ZodUUID;
4718
+ occurredAt: z$1.ZodISODateTime;
4719
+ }, z$1.core.$strict>, z$1.ZodObject<{
4720
+ type: z$1.ZodLiteral<"authorization.updated">;
4721
+ merchantAuthorizationId: z$1.ZodString;
4722
+ kind: z$1.ZodLiteral<"auto_topup">;
4723
+ status: z$1.ZodEnum<{
4724
+ pending: "pending";
4725
+ failed: "failed";
4726
+ revoked: "revoked";
4727
+ effective: "effective";
4728
+ }>;
4729
+ termsReference: z$1.ZodNullable<z$1.ZodString>;
4730
+ revision: z$1.ZodNumber;
4731
+ eventId: z$1.ZodString;
4732
+ customerId: z$1.ZodUUID;
4733
+ occurredAt: z$1.ZodISODateTime;
4734
+ }, z$1.core.$strict>, z$1.ZodObject<{
4735
+ type: z$1.ZodLiteral<"balance.observed">;
4736
+ resource: z$1.ZodString;
4737
+ unit: z$1.ZodString;
4738
+ availableQuantity: z$1.ZodNumber;
4739
+ reservedQuantity: z$1.ZodNumber;
4740
+ periodStartsAt: z$1.ZodNullable<z$1.ZodISODateTime>;
4741
+ periodEndsAt: z$1.ZodNullable<z$1.ZodISODateTime>;
4742
+ revision: z$1.ZodNumber;
4743
+ eventId: z$1.ZodString;
4744
+ customerId: z$1.ZodUUID;
4745
+ occurredAt: z$1.ZodISODateTime;
4746
+ }, z$1.core.$strict>], "type">, z$1.ZodObject<{
4747
+ productVersionId: z$1.ZodUUID;
4748
+ subscriptionId: z$1.ZodString;
4749
+ type: z$1.ZodLiteral<"coupon.redeemed">;
4750
+ grantId: z$1.ZodUUID;
4751
+ eventId: z$1.ZodString;
4752
+ customerId: z$1.ZodUUID;
4753
+ occurredAt: z$1.ZodISODateTime;
4754
+ }, z$1.core.$strict>, z$1.ZodObject<{
4755
+ merchandiseId: z$1.ZodUUID;
4756
+ type: z$1.ZodLiteral<"coupon.redeemed">;
4757
+ grantId: z$1.ZodUUID;
4758
+ eventId: z$1.ZodString;
4759
+ customerId: z$1.ZodUUID;
4760
+ occurredAt: z$1.ZodISODateTime;
4761
+ }, z$1.core.$strict>, z$1.ZodObject<{
4762
+ operation: z$1.ZodLiteral<"consume">;
4763
+ type: z$1.ZodLiteral<"usage.observed">;
4764
+ merchantTransactionId: z$1.ZodString;
4765
+ resource: z$1.ZodString;
4766
+ unit: z$1.ZodString;
4767
+ quantity: z$1.ZodNumber;
4768
+ eventId: z$1.ZodString;
4769
+ customerId: z$1.ZodUUID;
4770
+ occurredAt: z$1.ZodISODateTime;
4771
+ }, z$1.core.$strict>, z$1.ZodObject<{
4772
+ operation: z$1.ZodLiteral<"reverse">;
4773
+ reversalOf: z$1.ZodString;
4774
+ type: z$1.ZodLiteral<"usage.observed">;
4775
+ merchantTransactionId: z$1.ZodString;
4776
+ resource: z$1.ZodString;
4777
+ unit: z$1.ZodString;
4778
+ quantity: z$1.ZodNumber;
4779
+ eventId: z$1.ZodString;
4780
+ customerId: z$1.ZodUUID;
4781
+ occurredAt: z$1.ZodISODateTime;
4782
+ }, z$1.core.$strict>]>;
4713
4783
  readonly response: z$1.ZodObject<{
4714
4784
  requestId: z$1.ZodUUID;
4715
4785
  scope: z$1.ZodObject<{
@@ -13010,8 +13080,8 @@ declare const apiOperations: {
13010
13080
  entity: "entity";
13011
13081
  source: "source";
13012
13082
  dimension: "dimension";
13013
- entitlement: "entitlement";
13014
13083
  resource: "resource";
13084
+ entitlement: "entitlement";
13015
13085
  }>, z$1.ZodString]>;
13016
13086
  after: z$1.ZodNullable<z$1.ZodObject<{
13017
13087
  bucket: z$1.ZodISODateTime;
@@ -16830,61 +16900,6 @@ declare const apiOperations: {
16830
16900
  }>>;
16831
16901
  }, z$1.core.$strict>;
16832
16902
  };
16833
- readonly recordCouponRedemption: {
16834
- readonly method: "POST";
16835
- readonly path: "offers/redemptions";
16836
- readonly permission: "billing:write";
16837
- readonly audience: "server";
16838
- /** A stable merchant event records paid Coupon use; this does not verify a provider or grant subscription access. */
16839
- readonly request: z$1.ZodUnion<readonly [z$1.ZodObject<{
16840
- productVersionId: z$1.ZodUUID;
16841
- subscriptionId: z$1.ZodString;
16842
- customerId: z$1.ZodUUID;
16843
- eventId: z$1.ZodString;
16844
- grantId: z$1.ZodUUID;
16845
- occurredAt: z$1.ZodISODateTime;
16846
- }, z$1.core.$strict>, z$1.ZodObject<{
16847
- merchandiseId: z$1.ZodUUID;
16848
- customerId: z$1.ZodUUID;
16849
- eventId: z$1.ZodString;
16850
- grantId: z$1.ZodUUID;
16851
- occurredAt: z$1.ZodISODateTime;
16852
- }, z$1.core.$strict>]>;
16853
- readonly response: z$1.ZodObject<{
16854
- requestId: z$1.ZodUUID;
16855
- scope: z$1.ZodObject<{
16856
- projectId: z$1.ZodString;
16857
- environment: z$1.ZodEnum<{
16858
- sandbox: "sandbox";
16859
- live: "live";
16860
- }>;
16861
- }, z$1.core.$strict>;
16862
- receipt: z$1.ZodUnion<readonly [z$1.ZodObject<{
16863
- productVersionId: z$1.ZodUUID;
16864
- subscriptionId: z$1.ZodString;
16865
- customerId: z$1.ZodUUID;
16866
- eventId: z$1.ZodString;
16867
- grantId: z$1.ZodUUID;
16868
- occurredAt: z$1.ZodISODateTime;
16869
- id: z$1.ZodUUID;
16870
- couponId: z$1.ZodUUID;
16871
- status: z$1.ZodLiteral<"redeemed">;
16872
- source: z$1.ZodLiteral<"merchant">;
16873
- recordedAt: z$1.ZodISODateTime;
16874
- }, z$1.core.$strict>, z$1.ZodObject<{
16875
- merchandiseId: z$1.ZodUUID;
16876
- customerId: z$1.ZodUUID;
16877
- eventId: z$1.ZodString;
16878
- grantId: z$1.ZodUUID;
16879
- occurredAt: z$1.ZodISODateTime;
16880
- id: z$1.ZodUUID;
16881
- couponId: z$1.ZodUUID;
16882
- status: z$1.ZodLiteral<"redeemed">;
16883
- source: z$1.ZodLiteral<"merchant">;
16884
- recordedAt: z$1.ZodISODateTime;
16885
- }, z$1.core.$strict>]>;
16886
- }, z$1.core.$strict>;
16887
- };
16888
16903
  };
16889
16904
  type ApiOperation = keyof typeof apiOperations;
16890
16905
  type ApiInput<K extends ApiOperation> = z$1.input<(typeof apiOperations)[K]["request"]>;
@@ -16949,15 +16964,19 @@ interface FoundationApi {
16949
16964
  * `subscription_data.trial_period_days` (when not null) and `expires_at` no later than `expiresAt`. It copies
16950
16965
  * `execution.metadata` unchanged onto the session `metadata`, onto `subscription_data.metadata` in `subscription`
16951
16966
  * mode, and in `payment` mode enables `invoice_creation` and copies it onto
16952
- * `invoice_creation.invoice_data.metadata`. In record-only mode the backend submits confirmed results with `recordBillingEvent`; Indiana does not accept Stripe callbacks.
16967
+ * `invoice_creation.invoice_data.metadata`. In record-only mode the backend submits confirmed results with `recordMerchantEvent`; Indiana does not accept Stripe callbacks.
16953
16968
  * A quote whose trial needs no card has no `execution` and takes no coupon: `attach` starts that trial at once
16954
16969
  * without Stripe. A trial the customer (or its device fingerprint) already used is left out of the quote.
16955
16970
  */
16956
16971
  previewAttach(input: ApiInput<"previewAttach"> & {
16957
16972
  customerId: string;
16958
16973
  }): Promise<ApiOutput<"previewAttach">>;
16959
- /** Record merchant-confirmed billing facts. Server Key only, in record_only environments. */
16960
- recordBillingEvent(input: ApiInput<"recordBillingEvent">): Promise<ApiOutput<"recordBillingEvent">>;
16974
+ /**
16975
+ * Record one merchant-reported business result, the single entry for merchant
16976
+ * results. The event type selects its domain validator, and retrying the same
16977
+ * `eventId` with identical facts returns the original receipt. Server Key only.
16978
+ */
16979
+ recordMerchantEvent(input: ApiInput<"recordMerchantEvent">): Promise<ApiOutput<"recordMerchantEvent">>;
16961
16980
  /**
16962
16981
  * Confirm a quoted purchase (`intent: "confirm"`, the default) or abandon it and release its held coupon
16963
16982
  * (`intent: "cancel"`). A pending operation carries the hosted `checkoutUrl` when Indiana executes Stripe, or
@@ -17021,8 +17040,6 @@ interface FoundationApi {
17021
17040
  requestId?: string;
17022
17041
  couponContentDigest?: string;
17023
17042
  }): Promise<ApiOutput<"grantOffer">>;
17024
- /** Trusted backend only. Reuse eventId and all facts for callback retries. */
17025
- recordCouponRedemption(input: ApiInput<"recordCouponRedemption">): Promise<ApiOutput<"recordCouponRedemption">>;
17026
17043
  }
17027
17044
 
17028
17045
  export type { ApiInput as A, FoundationApi as F, InvoiceModeParams as I, OfferingItem as O, InvoiceModeParamsInput as a };
@@ -1 +1 @@
1
- import{a as u}from"./chunk-DSPLGTQI.js";import{cb as d}from"./chunk-EFFXE6CX.js";function m(e){if(!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("Invalid device cookie name");let t="";for(let i of document.cookie.split(";"))if(i.trim().startsWith(`${e}=`))try{t=decodeURIComponent(i.trim().slice(e.length+1))}catch{}return/^[A-Za-z0-9_-]{8,128}$/.test(t)||(t=crypto.randomUUID(),document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${400*24*3600}; SameSite=Lax`),t}function y(){try{let e=sessionStorage.getItem("indiana_sid");return e||(e=crypto.randomUUID(),sessionStorage.setItem("indiana_sid",e)),e}catch{return}}function g(e=d){let t=new URL(e);if(t.protocol!=="https:"&&!(t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname))||t.username||t.password||t.search||t.hash)throw new Error("baseUrl must be an https origin without credentials");return t.origin}var o=new Set,s;function S(e){let t=()=>e();if(o.add(t),!s){let i=!0,a=history.pushState,p=history.replaceState,r=()=>{if(i)for(let n of[...o])o.has(n)&&u(n)},c=function(...n){a.apply(this,n),r()},h=function(...n){p.apply(this,n),r()};history.pushState=c,history.replaceState=h,addEventListener("popstate",r),addEventListener("hashchange",r),s=()=>{i=!1,history.pushState===c&&(history.pushState=a),history.replaceState===h&&(history.replaceState=p),removeEventListener("popstate",r),removeEventListener("hashchange",r)}}return()=>{o.delete(t)&&(o.size||(s?.(),s=void 0))}}export{m as a,y as b,g as c,S as d};
1
+ import{a as u}from"./chunk-DSPLGTQI.js";import{cb as d}from"./chunk-JQ2OW2G2.js";function m(e){if(!/^[A-Za-z0-9_-]{1,64}$/.test(e))throw new Error("Invalid device cookie name");let t="";for(let i of document.cookie.split(";"))if(i.trim().startsWith(`${e}=`))try{t=decodeURIComponent(i.trim().slice(e.length+1))}catch{}return/^[A-Za-z0-9_-]{8,128}$/.test(t)||(t=crypto.randomUUID(),document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${400*24*3600}; SameSite=Lax`),t}function y(){try{let e=sessionStorage.getItem("indiana_sid");return e||(e=crypto.randomUUID(),sessionStorage.setItem("indiana_sid",e)),e}catch{return}}function g(e=d){let t=new URL(e);if(t.protocol!=="https:"&&!(t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname))||t.username||t.password||t.search||t.hash)throw new Error("baseUrl must be an https origin without credentials");return t.origin}var o=new Set,s;function S(e){let t=()=>e();if(o.add(t),!s){let i=!0,a=history.pushState,p=history.replaceState,r=()=>{if(i)for(let n of[...o])o.has(n)&&u(n)},c=function(...n){a.apply(this,n),r()},h=function(...n){p.apply(this,n),r()};history.pushState=c,history.replaceState=h,addEventListener("popstate",r),addEventListener("hashchange",r),s=()=>{i=!1,history.pushState===c&&(history.pushState=a),history.replaceState===h&&(history.replaceState=p),removeEventListener("popstate",r),removeEventListener("hashchange",r)}}return()=>{o.delete(t)&&(o.size||(s?.(),s=void 0))}}export{m as a,y as b,g as c,S as d};
@@ -1,4 +1,4 @@
1
- import{a as $,b as N,c as J,d as q}from"./chunk-67XTOBGE.js";import{a as _}from"./chunk-DSPLGTQI.js";import{a as P}from"./chunk-6MBVIE3H.js";import{bb as D}from"./chunk-EFFXE6CX.js";import{s as C,v as O,x as j}from"./chunk-PFHS7HK3.js";async function B(e,t,o,n={}){let r=n.message??"Invalid SDK JSON response",s=e.headers.get("content-length");if(!e.ok||!/^application\/json(?:;|$)/i.test(e.headers.get("content-type")??"")||s!==null&&(!/^\d+$/.test(s)||Number(s)>t)||!e.body)throw e.body?.cancel().catch(()=>{}),Error(r);let u;try{u=await P(e,t,{signal:o,error:()=>Error(r)})}catch(p){throw o.aborted?Error(r):p}return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(u))}async function G(e,t){if(!e?.body)return;let o=new AbortController,n=()=>o.abort(t?.reason);t?.addEventListener("abort",n,{once:!0}),t?.aborted&&n();let r=setTimeout(()=>o.abort(Error("Exposure response timeout")),2e3);try{return await P(e,16384,{signal:o.signal,error:()=>Error("Exposure response budget")})}finally{clearTimeout(r),t?.removeEventListener("abort",n)}}var be=2*1024*1024,V=256*1024;async function Y(e,t,o,n){let r=()=>{},s=new Promise((u,p)=>{r=()=>p(n.reason),n.addEventListener("abort",r,{once:!0}),n.aborted&&r()});try{let u=e(t,{...o,signal:n});return u.then(p=>{n.aborted&&p.body?.cancel().catch(()=>{})},()=>{}),await Promise.race([u,s])}finally{n.removeEventListener("abort",r)}}async function M(e,t,o,n=!1){if(new TextEncoder().encode(o).byteLength>65536)throw Error("Exposure request budget");let r=new URL(t);r.searchParams.set("sdkVersion",D.version);let s=new AbortController,u=setTimeout(()=>s.abort(Error("Exposure request timeout")),5e3);try{let p=await Y(e,r.href,{method:"POST",headers:{"Content-Type":"text/plain"},body:o,credentials:"omit",keepalive:n,redirect:"error"},s.signal),a=await G(p,s.signal),c;try{c=a&&JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(a))}catch{}return{response:p,receipt:c}}finally{clearTimeout(u)}}function H(e){let t,o=!1;return{async read(n,r){if(o)throw Error("Experiment client stopped");t?.abort(Error("Experiment request superseded"));let s=new AbortController;t=s;let{signal:u}=s,p=setTimeout(()=>s.abort(Error("Experiment request timeout")),5e3);try{let a=await Y(e,n,{cache:"no-cache",credentials:"omit",redirect:"error"},u),c=await B(a,r,u);return u.throwIfAborted(),c}finally{clearTimeout(p),t===s&&(t=void 0)}},destroy(){o=!0,t?.abort(Error("Experiment client stopped")),t=void 0}}}var Q=20,ie=65536,se=5e3,ae=5,K=e=>new TextEncoder().encode(JSON.stringify(e)).length;function ce(e,t){let o=e,n=r=>Number.isSafeInteger(r)&&r>=0;return!!o&&typeof o=="object"&&n(o.inserted)&&n(o.duplicates)&&n(o.skipped)&&Array.isArray(o.rejected)&&o.inserted+o.duplicates+o.skipped+o.rejected.length===t&&o.rejected.every(r=>!!r&&typeof r=="object"&&n(r.index)&&r.index<t&&typeof r.reason=="string")&&new Set(o.rejected.map(r=>r.index)).size===o.rejected.length}function F(e){let t=[],o,n,r=(a,c)=>{try{e.log?.(`${e.label} ${a}`,c)}catch{}};function s(a){o===void 0&&!n&&t.length&&(o=setTimeout(()=>{p()},a))}async function u(a,c){let g,f;try{({response:g,receipt:f}=await M(e.fetch,e.endpoint,JSON.stringify({events:a}),c))}catch(h){return r("not sent",{error:h}),!1}return g.status===408||g.status===429||g.status>=500?(r("not sent",{status:g.status}),!1):g.ok?ce(f,a.length)?(f.rejected.length&&r("rejected",{rejected:f.rejected}),!0):(r("not acknowledged",{status:g.status}),!1):(r("rejected",{status:g.status,events:a.length}),!0)}function p(a=!0){if(n)return n;clearTimeout(o),o=void 0;let c=[],g=K({events:[]});for(;t.length&&c.length<Q;){let m=K(t[0].event)+(c.length?1:0);if(c.length&&g+m>ie)break;c.push(t.shift()),g+=m}if(!c.length)return Promise.resolve();let f=1e3,h=u(c.map(m=>m.event),a).then(m=>{if(m)return;f=se;let y=c.filter(b=>++b.attempts<ae);y.length<c.length&&r("dropped after retries",{events:c.length-y.length}),t.unshift(...y)}).finally(()=>{n===h&&(n=void 0),s(f)});return n=h,h}return{push(a){t.push({event:structuredClone(a),attempts:0}),t.length>=Q?p():s(1e3)},flush:p}}/*!
1
+ import{a as $,b as N,c as J,d as q}from"./chunk-4OYBOUHX.js";import{a as _}from"./chunk-DSPLGTQI.js";import{a as P}from"./chunk-VOBRWTAA.js";import{bb as D}from"./chunk-JQ2OW2G2.js";import{s as C,v as O,x as j}from"./chunk-PFHS7HK3.js";async function B(e,t,o,n={}){let r=n.message??"Invalid SDK JSON response",s=e.headers.get("content-length");if(!e.ok||!/^application\/json(?:;|$)/i.test(e.headers.get("content-type")??"")||s!==null&&(!/^\d+$/.test(s)||Number(s)>t)||!e.body)throw e.body?.cancel().catch(()=>{}),Error(r);let u;try{u=await P(e,t,{signal:o,error:()=>Error(r)})}catch(p){throw o.aborted?Error(r):p}return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(u))}async function G(e,t){if(!e?.body)return;let o=new AbortController,n=()=>o.abort(t?.reason);t?.addEventListener("abort",n,{once:!0}),t?.aborted&&n();let r=setTimeout(()=>o.abort(Error("Exposure response timeout")),2e3);try{return await P(e,16384,{signal:o.signal,error:()=>Error("Exposure response budget")})}finally{clearTimeout(r),t?.removeEventListener("abort",n)}}var be=2*1024*1024,V=256*1024;async function Y(e,t,o,n){let r=()=>{},s=new Promise((u,p)=>{r=()=>p(n.reason),n.addEventListener("abort",r,{once:!0}),n.aborted&&r()});try{let u=e(t,{...o,signal:n});return u.then(p=>{n.aborted&&p.body?.cancel().catch(()=>{})},()=>{}),await Promise.race([u,s])}finally{n.removeEventListener("abort",r)}}async function M(e,t,o,n=!1){if(new TextEncoder().encode(o).byteLength>65536)throw Error("Exposure request budget");let r=new URL(t);r.searchParams.set("sdkVersion",D.version);let s=new AbortController,u=setTimeout(()=>s.abort(Error("Exposure request timeout")),5e3);try{let p=await Y(e,r.href,{method:"POST",headers:{"Content-Type":"text/plain"},body:o,credentials:"omit",keepalive:n,redirect:"error"},s.signal),a=await G(p,s.signal),c;try{c=a&&JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(a))}catch{}return{response:p,receipt:c}}finally{clearTimeout(u)}}function H(e){let t,o=!1;return{async read(n,r){if(o)throw Error("Experiment client stopped");t?.abort(Error("Experiment request superseded"));let s=new AbortController;t=s;let{signal:u}=s,p=setTimeout(()=>s.abort(Error("Experiment request timeout")),5e3);try{let a=await Y(e,n,{cache:"no-cache",credentials:"omit",redirect:"error"},u),c=await B(a,r,u);return u.throwIfAborted(),c}finally{clearTimeout(p),t===s&&(t=void 0)}},destroy(){o=!0,t?.abort(Error("Experiment client stopped")),t=void 0}}}var Q=20,ie=65536,se=5e3,ae=5,K=e=>new TextEncoder().encode(JSON.stringify(e)).length;function ce(e,t){let o=e,n=r=>Number.isSafeInteger(r)&&r>=0;return!!o&&typeof o=="object"&&n(o.inserted)&&n(o.duplicates)&&n(o.skipped)&&Array.isArray(o.rejected)&&o.inserted+o.duplicates+o.skipped+o.rejected.length===t&&o.rejected.every(r=>!!r&&typeof r=="object"&&n(r.index)&&r.index<t&&typeof r.reason=="string")&&new Set(o.rejected.map(r=>r.index)).size===o.rejected.length}function F(e){let t=[],o,n,r=(a,c)=>{try{e.log?.(`${e.label} ${a}`,c)}catch{}};function s(a){o===void 0&&!n&&t.length&&(o=setTimeout(()=>{p()},a))}async function u(a,c){let g,f;try{({response:g,receipt:f}=await M(e.fetch,e.endpoint,JSON.stringify({events:a}),c))}catch(h){return r("not sent",{error:h}),!1}return g.status===408||g.status===429||g.status>=500?(r("not sent",{status:g.status}),!1):g.ok?ce(f,a.length)?(f.rejected.length&&r("rejected",{rejected:f.rejected}),!0):(r("not acknowledged",{status:g.status}),!1):(r("rejected",{status:g.status,events:a.length}),!0)}function p(a=!0){if(n)return n;clearTimeout(o),o=void 0;let c=[],g=K({events:[]});for(;t.length&&c.length<Q;){let m=K(t[0].event)+(c.length?1:0);if(c.length&&g+m>ie)break;c.push(t.shift()),g+=m}if(!c.length)return Promise.resolve();let f=1e3,h=u(c.map(m=>m.event),a).then(m=>{if(m)return;f=se;let y=c.filter(b=>++b.attempts<ae);y.length<c.length&&r("dropped after retries",{events:c.length-y.length}),t.unshift(...y)}).finally(()=>{n===h&&(n=void 0),s(f)});return n=h,h}return{push(a){t.push({event:structuredClone(a),attempts:0}),t.length>=Q?p():s(1e3)},flush:p}}/*!
2
2
  Portions ported from GrowthBook sdk-js @ ed29827 (GrowthBook.ts auto experiments, util.ts mergeQueryStrings,
3
3
  plugins/auto-attributes.ts). Copyright (c) GrowthBook, Inc. MIT License.
4
4
  */function ue(e,t){let o,n;try{o=new URL(e),n=new URL(t)}catch{return t}return o.searchParams.forEach((r,s)=>{n.searchParams.has(s)||n.searchParams.set(s,r)}),n.toString()}function de(e,t){let o=navigator.userAgent,n=new URLSearchParams(t.search),r={};for(let s of["source","medium","campaign","term","content"]){let u=n.get(`utm_${s}`);u!==null&&(r[`utm${s[0].toUpperCase()}${s.slice(1)}`]=u)}return{id:e,deviceId:e,url:t.href,path:t.pathname,host:t.host,query:t.search,pageTitle:typeof document>"u"?"":document.title,browser:/Edg/.test(o)?"edge":/Chrome/.test(o)?"chrome":/Firefox/.test(o)?"firefox":/Safari/.test(o)?"safari":"unknown",deviceType:/Mobi/.test(o)?"mobile":"desktop",...r}}function le(e){let t=e;if(!(!!t&&typeof t=="object"&&typeof t.environmentId=="string"&&typeof t.trackExposures=="boolean"&&/^[a-f0-9]{64}$/.test(t.generation??"")&&Array.isArray(t.experiments)&&t.experiments.length<=100&&t.experiments.every(n=>!!n&&!["namespace","status","url","groups"].some(r=>Object.hasOwn(n,r))&&(n.hashVersion===void 0||n.hashVersion===2)&&typeof n.key=="string"&&Array.isArray(n.variations)&&n.variations.length>=2&&n.variations.every(r=>!!r&&typeof r.urlRedirect=="string")&&(n.urlPatterns===void 0||Array.isArray(n.urlPatterns)))&&!!t.savedGroups&&typeof t.savedGroups=="object"&&!Array.isArray(t.savedGroups)))throw new Error("Invalid page experiment payload");return t}function Te(e){if(e.configuration&&e.configuration.scope.environmentId!==e.environmentId)throw new Error("Page configuration belongs to another App environment");let t=J(e.baseUrl);if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("environmentId must be the App environment ID");let o=e.fetch??globalThis.fetch.bind(globalThis),n=H(async(i,d)=>{let l=await o(i,d);if(!l.ok)throw l.body?.cancel().catch(()=>{}),new Error(`Page experiments unavailable (${l.status})`);return l}),r=e.log?(i,d)=>_(e.log,i,d):void 0,s=`${t}/api/v1/page-experiments/${e.environmentId}`,u=$(e.deviceIdCookie??"indiana_did"),p=N(),a=null,c={...e.attributes??{}},g="",f=!1,h=!1,m=0,y=0,b=new Map,S=F({endpoint:`${s}/events`,fetch:o,log:r,label:"Exposure"}),k=S.flush,E={trackedExperiments:new Set,log:r,onExperimentViewed:(i,d)=>{e.trackExposures===!1||a?.trackExposures===!1||S.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:u,...p?{sessionId:p}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:i.key,variationKey:d.key})}},z=()=>{E.url=location.href,E.attributes={...de(u,location),...c}};function W(i){if(!e.disableCrossOriginUrlRedirects)return!1;try{let d=new URL(location.href);return i.variations.some(l=>{if(!l.urlRedirect)return!1;let v=new URL(l.urlRedirect);return v.protocol!==d.protocol||v.host!==d.host})}catch{return!0}}function X(i,d){let l=e.configuration?.snapshot?.generation,v=y,te=location.href;g=i;let re=e.navigate??(w=>location.replace(w)),ne=e.navigateDelay??(e.navigate?0:100),oe=e.maxNavigateDelay??1e3;Promise.all([Promise.race([d,new Promise(w=>setTimeout(w,oe))]),new Promise(w=>setTimeout(w,ne))]).then(()=>{!f&&v===y&&location.href===te&&(!e.configuration||e.configuration.fresh&&e.configuration.snapshot?.generation===l)&&re(i)})}function x(){if(!(!a||f||e.configuration&&!e.configuration.fresh)){z();for(let i of a.experiments){if(W(i)){r?.("Auto experiment blocked",{id:i.key});continue}let d;try{d=j(i,E)}catch(l){r?.("Skipping page experiment",{id:i.key,error:String(l)});continue}if(b.set(i.key,d),!!d.inExperiment){if(d.value.urlRedirect){let l=i.persistQueryString?ue(location.href,d.value.urlRedirect):d.value.urlRedirect;C(l,i.urlPatterns??[])?r?.("Skipping redirect because original URL matches redirect URL",{id:i.key}):l!==g&&X(l,k())}break}}}}let R="",Z=()=>{location.href!==R&&(y++,R=location.href,g="",x())},T,L;function ee(){T??=q(Z),addEventListener("pagehide",I)}let I=()=>{k()};async function A(){if(f)return!1;let i=++m,d;try{d=e.configuration?await e.configuration.pageExperiments():await n.read(s,V)}catch(v){if(f||i!==m)return!1;throw v}if(f||i!==m)return!1;let l=le(d);if(l.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Page experiment payload scope changed");return a?.trackExposures===!1&&l.trackExposures&&E.trackedExperiments?.clear(),a=l,E.savedGroups=O(l.savedGroups),!0}function U(){f||(L??=e.configuration?.subscribe(()=>{!f&&e.configuration?.fresh&&A().then(i=>{i&&x()}).catch(i=>r?.("Page configuration unavailable",{error:String(i)}))}),ee(),R=location.href)}return{async start(){h||f||(h=!0,await A()&&(U(),x()))},async refresh(){await A()&&(y++,h&&U(),g="",x())},setAttributes(i){y++,g="",c={...i},x()},getResults(){return new Map(b)},get generation(){return a?.generation??null},destroy(){f||(f=!0,m++,n.destroy(),L?.(),T?.(),removeEventListener("pagehide",I),a=null,b.clear(),k())}}}export{be as a,H as b,F as c,ue as d,de as e,le as f,Te as g};