palbase 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/backend/engine.js +2 -2
  3. package/dist/backend/env.js +1 -1
  4. package/dist/backend/index.js +3 -3
  5. package/dist/backend/stack.js +1 -1
  6. package/dist/backend/test.js +2 -2
  7. package/dist/chunks/{KHHJRNAO.js → 23G5YVSL.js} +1 -1
  8. package/dist/chunks/{73R33XMD.js → 3X7CRIHE.js} +1 -1
  9. package/dist/chunks/5UXVSEM2.js +2 -0
  10. package/dist/chunks/6YCANJ7U.js +2 -0
  11. package/dist/chunks/{RYI2OB52.js → 7HMBZG2R.js} +2 -2
  12. package/dist/chunks/{MAYLG7WE.js → 7OZCS3BA.js} +2 -2
  13. package/dist/chunks/FFWT3RBE.js +13 -0
  14. package/dist/chunks/{7XVI5JLP.js → GGKL7UV2.js} +2 -2
  15. package/dist/chunks/HGQXQMYU.js +95 -0
  16. package/dist/chunks/{ZSKMWUIQ.js → I45DYZZL.js} +2 -2
  17. package/dist/chunks/{5RTSNQ4X.js → KSU226RI.js} +2 -2
  18. package/dist/chunks/MEIN5GAG.js +22 -0
  19. package/dist/chunks/{NSQAN2ME.js → OEZLXSQN.js} +2 -2
  20. package/dist/chunks/{6RXVXPHC.js → OGREZP5F.js} +1 -1
  21. package/dist/chunks/{T2Q5CKLL.js → ONP77MHF.js} +2 -2
  22. package/dist/chunks/{CA4VJGGG.js → QR4Z3ORW.js} +1 -1
  23. package/dist/chunks/{M4XLAPDF.js → R5NCHIW3.js} +2 -2
  24. package/dist/chunks/{KYJJJUEU.js → RV35QG7V.js} +2 -2
  25. package/dist/chunks/{RZ525VLP.js → YOTK5642.js} +2 -2
  26. package/dist/chunks/{KJWHR5BP.js → Z7VRCVKE.js} +2 -2
  27. package/dist/cli.js +129 -127
  28. package/dist/refuse/ai.js +1 -1
  29. package/dist/refuse/backend.js +1 -1
  30. package/dist/refuse/server.js +1 -1
  31. package/dist/server/index.js +2 -2
  32. package/dist/server/testing.js +2 -2
  33. package/dist/web/index.js +2 -2
  34. package/dist/web/message.js +2 -0
  35. package/dist/web/palbe.js +2 -2
  36. package/dist/web/paywall.js +2 -2
  37. package/dist/web/push-sw.js +2 -0
  38. package/dist/web/ssr.js +2 -2
  39. package/dist/web/vite.js +2 -2
  40. package/package.json +7 -2
  41. package/types/backend/src/services.d.ts +2 -2
  42. package/types/internal/src/modules/ai.d.ts +1 -1
  43. package/types/internal/src/modules/analytics.d.ts +618 -1
  44. package/types/internal/src/modules/auth.d.ts +409 -90
  45. package/types/internal/src/modules/events.d.ts +7 -3
  46. package/types/internal/src/modules/flags.d.ts +380 -14
  47. package/types/internal/src/modules/notify.d.ts +2270 -99
  48. package/types/internal/src/modules/purchases.d.ts +672 -9
  49. package/types/server/src/webhooks.d.ts +1 -1
  50. package/types/web/src/analytics.d.ts +56 -5
  51. package/types/web/src/client.d.ts +26 -4
  52. package/types/web/src/consent.d.ts +218 -0
  53. package/types/web/src/flags.d.ts +75 -0
  54. package/types/web/src/inapp.d.ts +129 -0
  55. package/types/web/src/inbox.d.ts +59 -0
  56. package/types/web/src/index.d.ts +9 -3
  57. package/types/web/src/installation.d.ts +16 -0
  58. package/types/web/src/message/index.d.ts +5 -0
  59. package/types/web/src/message/present.d.ts +20 -0
  60. package/types/web/src/notify.d.ts +67 -0
  61. package/types/web/src/paywall/index.d.ts +4 -4
  62. package/types/web/src/paywall/placement.d.ts +11 -12
  63. package/types/web/src/paywall/prices.d.ts +7 -2
  64. package/types/web/src/purchases.d.ts +32 -0
  65. package/types/web/src/{paywall → screen}/assets.d.ts +6 -6
  66. package/types/web/src/screen/render.d.ts +186 -0
  67. package/types/web/src/{paywall → screen}/resolve.d.ts +56 -8
  68. package/dist/chunks/5M3HV3X4.js +0 -2
  69. package/dist/chunks/Q4XTWEAW.js +0 -92
  70. package/dist/chunks/Y6AQWQBE.js +0 -2
  71. package/types/web/src/paywall/render.d.ts +0 -93
  72. /package/types/web/src/{paywall → screen}/icons.d.ts +0 -0
@@ -431,6 +431,10 @@ export type Catalog = {
431
431
  * The products.
432
432
  */
433
433
  products: Product[];
434
+ /**
435
+ * Prices for a while, to whom the project chooses.
436
+ */
437
+ offers?: CatalogOffer[];
434
438
  };
435
439
  /**
436
440
  * purchases.catalog.applied: a plan's Stripe part was written (applied) or failed; or the stores module answered of its App Store or Google Play part.
@@ -1048,6 +1052,10 @@ export type CheckoutRequest = {
1048
1052
  */
1049
1053
  success_url: string;
1050
1054
  source?: CheckoutSource;
1055
+ /**
1056
+ * One of the catalog's offers the customer may take, on this plan: its coupon (or the promotion code of the coupon code that opened it), or its free trial, on the checkout.
1057
+ */
1058
+ offer?: string;
1051
1059
  };
1052
1060
  /**
1053
1061
  * What calling a leader takes — every variant seen by min_viewers subjects, the leader's chance to win min_chance — and what the results still lack, reason by reason: none, they are confident.
@@ -2456,6 +2464,10 @@ export type PaywallCondition = {
2456
2464
  * Locale.
2457
2465
  */
2458
2466
  locale?: string[];
2467
+ /**
2468
+ * Holds while the package's offer (its package component's offer) is the customer's to take: the package the component is in, else the selected one.
2469
+ */
2470
+ offer_open?: boolean;
2459
2471
  /**
2460
2472
  * Platform.
2461
2473
  */
@@ -2858,6 +2870,10 @@ export type PaywallPackage = {
2858
2870
  * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2859
2871
  */
2860
2872
  id?: string;
2873
+ /**
2874
+ * One of the catalog's offers on the package: bought with it, and its texts' {{offer_price}} its price, while the customer may take it (GET /purchases/offers lists it).
2875
+ */
2876
+ offer?: string;
2861
2877
  /**
2862
2878
  * Plan.
2863
2879
  */
@@ -3164,7 +3180,7 @@ export type PaywallStop = {
3164
3180
  color: string;
3165
3181
  };
3166
3182
  /**
3167
- * A text: the string itself, or `{"t": key}` of the language table. Either may hold variables the app fills from its store — `{{price}}`, `{{price_per_month}}`, `{{period}}`, `{{trial}}`, `{{savings}}`, `{{product_name}}` — of the package an item is, or of the selected package anywhere else. A text that names a variable its package has no value for (no trial, no savings) is not drawn.
3183
+ * A text: the string itself, or `{"t": key}` of the language table. Either may hold variables the app fills from its store — `{{price}}`, `{{price_per_month}}`, `{{period}}`, `{{trial}}`, `{{savings}}`, `{{product_name}}`, `{{offer_price}}` (the price of the package's offer while the customer may take it, its price otherwise) — of the package an item is, or of the selected package anywhere else. A text that names a variable its package has no value for (no trial, no savings) is not drawn.
3168
3184
  */
3169
3185
  export type PaywallString = PaywallLiteral | PaywallTextKey;
3170
3186
  /**
@@ -3735,6 +3751,10 @@ export type PlacementPaywall = {
3735
3751
  * Its version; report it with the exposure.
3736
3752
  */
3737
3753
  version: number;
3754
+ /**
3755
+ * The offers the definition's packages are sold with that the signed-in customer may take now: what {{offer_price}} is the price of, and what such a package is bought with. None for no one signed in.
3756
+ */
3757
+ offers: OfferView[];
3738
3758
  };
3739
3759
  /**
3740
3760
  * What the placement shows the viewer at the moment, where it came from, and what each rule came to.
@@ -5264,30 +5284,538 @@ export type StripeAppInstall = {
5264
5284
  expires_at: string;
5265
5285
  };
5266
5286
  /**
5267
- * An install started with its link's grant.
5287
+ * An install started with its link's grant — or, with describe, only named.
5268
5288
  */
5269
5289
  export type StripeAppStartRequest = {
5290
+ /**
5291
+ * Name what the link connects, starting nothing: the grant is not spent, no cookie is set.
5292
+ */
5293
+ describe?: boolean;
5270
5294
  /**
5271
5295
  * The link's grant: `<project id>.<token>`, from its fragment.
5272
5296
  */
5273
5297
  grant: string;
5274
5298
  };
5275
5299
  /**
5276
- * An install started: the project the account will be connected to, and Stripe's page to go on to.
5300
+ * What an install link connects an account to — the project, its ref, in which mode — and, started, Stripe's page to go on to.
5277
5301
  */
5278
5302
  export type StripeAppStart = {
5279
5303
  /**
5280
- * The Palbase project's name.
5304
+ * Stripe's install page, the install started: its state is the install's nonce, which the browser keeps. Absent when only described.
5281
5305
  */
5282
- project: string;
5306
+ authorize_url?: string;
5283
5307
  /**
5284
5308
  * Live mode, or Stripe's test mode.
5285
5309
  */
5286
5310
  livemode: boolean;
5287
5311
  /**
5288
- * Stripe's install page: its state is the install's nonce, which the browser keeps.
5312
+ * The Palbase project's name.
5313
+ */
5314
+ project: string;
5315
+ /**
5316
+ * The project's ref: its address's first label.
5317
+ */
5318
+ project_ref: string;
5319
+ };
5320
+ /**
5321
+ * A percentage off a plan's price for a count of its billing periods.
5322
+ */
5323
+ export type OfferDiscount = {
5324
+ /**
5325
+ * Percent off, 1 to 99.
5326
+ */
5327
+ percent: number;
5328
+ /**
5329
+ * Billing periods it lasts, 1 to 12.
5330
+ */
5331
+ periods: number;
5332
+ };
5333
+ /**
5334
+ * An entitlement for a duration, with no store.
5335
+ */
5336
+ export type OfferGrant = {
5337
+ /**
5338
+ * The catalog's entitlement.
5339
+ */
5340
+ entitlement: string;
5341
+ /**
5342
+ * How long, an ISO 8601 duration (P7D, P1M).
5343
+ */
5344
+ duration: string;
5345
+ };
5346
+ /**
5347
+ * A price for a while, given to whom the project chooses — an analytics audience's members (who allowed personalization), or everyone — once a customer: a discount on some billing periods of a subscription's plans, a free trial of them, or an entitlement for a time with no store (a grant). One of discount, trial and grant. A discount or a trial is each store's own offer, written with the catalog: Apple's promotional offer, Google Play's developer-determined offer, a Stripe coupon; its key is its id at every store.
5348
+ */
5349
+ export type CatalogOffer = {
5350
+ /**
5351
+ * Its key, and its id at the stores (hyphenated at Google Play).
5352
+ */
5353
+ key: string;
5354
+ /**
5355
+ * Its name (Apple's reference name), 1 to 64 characters.
5356
+ */
5357
+ name: string;
5358
+ /**
5359
+ * The subscription a discount or a trial is on.
5360
+ */
5361
+ product?: string;
5362
+ /**
5363
+ * Its plans; none, every plan.
5364
+ */
5365
+ plans?: string[];
5366
+ discount?: OfferDiscount;
5367
+ /**
5368
+ * A free trial's length, an ISO 8601 duration.
5369
+ */
5370
+ trial?: string;
5371
+ grant?: OfferGrant;
5372
+ /**
5373
+ * The analytics audience whose members are given it; none, everyone.
5374
+ */
5375
+ audience?: string;
5376
+ /**
5377
+ * When it is first given.
5378
+ */
5379
+ starts_at?: string;
5380
+ /**
5381
+ * When it is no longer given.
5382
+ */
5383
+ ends_at?: string;
5384
+ };
5385
+ /**
5386
+ * An offer's promotional offer at the App Store.
5387
+ */
5388
+ export type AppStoreOffer = {
5389
+ /**
5390
+ * Its identifier.
5391
+ */
5392
+ offer_id: string;
5393
+ /**
5394
+ * The subscriptions it is on.
5395
+ */
5396
+ product_ids: string[];
5397
+ };
5398
+ /**
5399
+ * An offer's offer at Google Play: developer-determined, tagged palbase.
5400
+ */
5401
+ export type PlayStoreOffer = {
5402
+ /**
5403
+ * Its id.
5404
+ */
5405
+ offer_id: string;
5406
+ /**
5407
+ * The subscription.
5408
+ */
5409
+ product_id: string;
5410
+ /**
5411
+ * The base plans it is on.
5289
5412
  */
5290
- authorize_url: string;
5413
+ base_plan_ids: string[];
5414
+ };
5415
+ /**
5416
+ * An offer on the web's checkout.
5417
+ */
5418
+ export type WebOffer = {
5419
+ /**
5420
+ * The plans.
5421
+ */
5422
+ plans: string[];
5423
+ };
5424
+ /**
5425
+ * An offer the customer may take now, with what each store sells it as.
5426
+ */
5427
+ export type OfferView = {
5428
+ /**
5429
+ * The offer.
5430
+ */
5431
+ key: string;
5432
+ /**
5433
+ * Its name.
5434
+ */
5435
+ name: string;
5436
+ /**
5437
+ * discount, trial or grant.
5438
+ */
5439
+ kind: "discount" | "trial" | "grant";
5440
+ /**
5441
+ * Its subscription.
5442
+ */
5443
+ product?: string;
5444
+ /**
5445
+ * Its plans.
5446
+ */
5447
+ plans?: string[];
5448
+ discount?: OfferDiscount;
5449
+ /**
5450
+ * A free trial's length.
5451
+ */
5452
+ trial?: string;
5453
+ grant?: OfferGrant;
5454
+ /**
5455
+ * When it ends.
5456
+ */
5457
+ ends_at?: string;
5458
+ /**
5459
+ * The coupon that opened it to the customer.
5460
+ */
5461
+ coupon?: string;
5462
+ app_store?: AppStoreOffer;
5463
+ play_store?: PlayStoreOffer;
5464
+ web?: WebOffer;
5465
+ };
5466
+ /**
5467
+ * The offers the signed-in customer may take now.
5468
+ */
5469
+ export type Offers = {
5470
+ /**
5471
+ * Each.
5472
+ */
5473
+ offers: OfferView[];
5474
+ };
5475
+ /**
5476
+ * Which subscription the signature is for, in which app, where StoreKit runs.
5477
+ */
5478
+ export type AppleOfferRequest = {
5479
+ /**
5480
+ * The App Store product (one the offer is on).
5481
+ */
5482
+ product_id: string;
5483
+ /**
5484
+ * The app's bundle identifier (the connected app's is used when one is connected).
5485
+ */
5486
+ bundle_id?: string;
5487
+ /**
5488
+ * xcode for a StoreKit configuration on a developer's Mac (signed with its Subscription Offers Key); otherwise the App Store's.
5489
+ */
5490
+ environment?: string;
5491
+ };
5492
+ /**
5493
+ * What StoreKit buys the promotional offer with, for this customer's purchases: Apple's subscription offer signature.
5494
+ */
5495
+ export type AppleOfferSignature = {
5496
+ /**
5497
+ * The offer's identifier.
5498
+ */
5499
+ offer_id: string;
5500
+ /**
5501
+ * The subscription.
5502
+ */
5503
+ product_id: string;
5504
+ /**
5505
+ * The customer's appAccountToken: the purchase carries it.
5506
+ */
5507
+ app_account_token: string;
5508
+ /**
5509
+ * The key's id.
5510
+ */
5511
+ key_id: string;
5512
+ /**
5513
+ * Used once, lowercase.
5514
+ */
5515
+ nonce: string;
5516
+ /**
5517
+ * Milliseconds since 1970.
5518
+ */
5519
+ timestamp: number;
5520
+ /**
5521
+ * ES256, base64.
5522
+ */
5523
+ signature: string;
5524
+ };
5525
+ /**
5526
+ * What came of an offer.
5527
+ */
5528
+ export type OfferStats = {
5529
+ /**
5530
+ * The offer.
5531
+ */
5532
+ offer: string;
5533
+ /**
5534
+ * Customers shown it.
5535
+ */
5536
+ viewers: number;
5537
+ /**
5538
+ * Customers who took it.
5539
+ */
5540
+ redemptions: number;
5541
+ /**
5542
+ * Redemptions by store: app_store, play_store, stripe, promotional.
5543
+ */
5544
+ by_store: {
5545
+ [key: string]: number;
5546
+ };
5547
+ };
5548
+ /**
5549
+ * Every offer of the catalog, counted.
5550
+ */
5551
+ export type OfferStatsList = {
5552
+ /**
5553
+ * Each.
5554
+ */
5555
+ offers: OfferStats[];
5556
+ };
5557
+ /**
5558
+ * A coupon to make: a code that opens one of the catalog's offers to whoever holds it, once a customer. palbase: Palbase takes the code; apple: an App Store offer code on one of the offer's plans, written to App Store Connect. One of code (shared) and one_time_codes.
5559
+ */
5560
+ export type CouponRequest = {
5561
+ /**
5562
+ * Its key.
5563
+ */
5564
+ key: string;
5565
+ /**
5566
+ * Its name.
5567
+ */
5568
+ name: string;
5569
+ /**
5570
+ * palbase or apple.
5571
+ */
5572
+ kind: "palbase" | "apple";
5573
+ /**
5574
+ * The offer it opens.
5575
+ */
5576
+ offer: string;
5577
+ /**
5578
+ * A code many share, 3 to 32 letters and digits.
5579
+ */
5580
+ code?: string;
5581
+ /**
5582
+ * How many times the shared code is taken.
5583
+ */
5584
+ max_redemptions?: number;
5585
+ /**
5586
+ * How many codes of one use each to make (1 to 25000).
5587
+ */
5588
+ one_time_codes?: number;
5589
+ /**
5590
+ * A guest cannot redeem it.
5591
+ */
5592
+ signed_in_only?: boolean;
5593
+ /**
5594
+ * When it ends (an App Store batch's codes must).
5595
+ */
5596
+ expires_at?: string;
5597
+ /**
5598
+ * An App Store offer code's plan of the offer's product.
5599
+ */
5600
+ plan?: string;
5601
+ };
5602
+ /**
5603
+ * A coupon and what came of it.
5604
+ */
5605
+ export type CouponInfo = {
5606
+ /**
5607
+ * Its key.
5608
+ */
5609
+ key: string;
5610
+ /**
5611
+ * Its name.
5612
+ */
5613
+ name: string;
5614
+ /**
5615
+ * palbase or apple.
5616
+ */
5617
+ kind: string;
5618
+ /**
5619
+ * The offer it opens.
5620
+ */
5621
+ offer: string;
5622
+ /**
5623
+ * Its shared code.
5624
+ */
5625
+ code?: string;
5626
+ /**
5627
+ * The shared code's cap.
5628
+ */
5629
+ max_redemptions?: number | null;
5630
+ /**
5631
+ * Its batch's size.
5632
+ */
5633
+ one_time_codes?: number | null;
5634
+ /**
5635
+ * A guest cannot redeem it.
5636
+ */
5637
+ signed_in_only: boolean;
5638
+ /**
5639
+ * When it ends.
5640
+ */
5641
+ expires_at?: string | null;
5642
+ /**
5643
+ * What App Store Connect holds of an App Store offer code: product_id, state (pending, applied, failed), offer_code_id, error.
5644
+ */
5645
+ apple?: ({
5646
+ [key: string]: unknown;
5647
+ }) | null;
5648
+ /**
5649
+ * The web's Stripe promotion code of a shared code.
5650
+ */
5651
+ stripe_promotion_code?: string;
5652
+ /**
5653
+ * Times it was redeemed: the cap's count (a deleted user's redemption still spends it).
5654
+ */
5655
+ redemptions: number;
5656
+ /**
5657
+ * One-time codes given to people by messages.
5658
+ */
5659
+ codes_given: number;
5660
+ /**
5661
+ * When it was made.
5662
+ */
5663
+ created_at: string;
5664
+ /**
5665
+ * When it was revoked.
5666
+ */
5667
+ revoked_at?: string | null;
5668
+ };
5669
+ /**
5670
+ * The project's coupons, newest first.
5671
+ */
5672
+ export type CouponList = {
5673
+ /**
5674
+ * Each.
5675
+ */
5676
+ coupons: CouponInfo[];
5677
+ };
5678
+ /**
5679
+ * A one-time code.
5680
+ */
5681
+ export type CouponCode = {
5682
+ /**
5683
+ * The code.
5684
+ */
5685
+ code: string;
5686
+ /**
5687
+ * The user a message gave it to.
5688
+ */
5689
+ assigned_to: string | null;
5690
+ /**
5691
+ * When.
5692
+ */
5693
+ assigned_at: string | null;
5694
+ /**
5695
+ * The customer who redeemed it.
5696
+ */
5697
+ redeemed_by: string | null;
5698
+ /**
5699
+ * When.
5700
+ */
5701
+ redeemed_at: string | null;
5702
+ };
5703
+ /**
5704
+ * A coupon's one-time codes.
5705
+ */
5706
+ export type CouponCodes = {
5707
+ /**
5708
+ * Each.
5709
+ */
5710
+ codes: CouponCode[];
5711
+ };
5712
+ /**
5713
+ * A code the customer typed.
5714
+ */
5715
+ export type CouponRedeemRequest = {
5716
+ /**
5717
+ * The code, any case.
5718
+ */
5719
+ code: string;
5720
+ };
5721
+ /**
5722
+ * What a code opened: the offer, and the grant when it gave one.
5723
+ */
5724
+ export type Redeemed = {
5725
+ /**
5726
+ * The coupon.
5727
+ */
5728
+ coupon: string;
5729
+ offer: OfferView;
5730
+ grant?: GrantInfo;
5731
+ };
5732
+ /**
5733
+ * The Subscription Offers Key of Xcode's StoreKit configuration.
5734
+ */
5735
+ export type XcodeOfferKeyRequest = {
5736
+ /**
5737
+ * Its id.
5738
+ */
5739
+ key_id: string;
5740
+ /**
5741
+ * Its .p8 (PEM).
5742
+ */
5743
+ private_key: string;
5744
+ };
5745
+ /**
5746
+ * The key kept.
5747
+ */
5748
+ export type XcodeOfferKey = {
5749
+ /**
5750
+ * Its id.
5751
+ */
5752
+ key_id: string;
5753
+ };
5754
+ /**
5755
+ * purchases.offer.redeemed.
5756
+ */
5757
+ export type OfferRedeemedEvent = {
5758
+ /**
5759
+ * The customer.
5760
+ */
5761
+ customer_id: string;
5762
+ /**
5763
+ * The offer.
5764
+ */
5765
+ offer: string;
5766
+ /**
5767
+ * discount, trial or grant.
5768
+ */
5769
+ kind: string;
5770
+ /**
5771
+ * app_store, play_store, stripe, or promotional (a grant).
5772
+ */
5773
+ store: string;
5774
+ /**
5775
+ * What was bought.
5776
+ */
5777
+ product?: string;
5778
+ /**
5779
+ * Its plan.
5780
+ */
5781
+ plan?: string;
5782
+ /**
5783
+ * The purchase's chain.
5784
+ */
5785
+ chain_id?: string;
5786
+ /**
5787
+ * The coupon it was taken with.
5788
+ */
5789
+ coupon?: string;
5790
+ /**
5791
+ * A grant's entitlement.
5792
+ */
5793
+ entitlement?: string;
5794
+ };
5795
+ /**
5796
+ * purchases.coupon.redeemed.
5797
+ */
5798
+ export type CouponRedeemedEvent = {
5799
+ /**
5800
+ * The customer.
5801
+ */
5802
+ customer_id: string;
5803
+ /**
5804
+ * The coupon.
5805
+ */
5806
+ coupon: string;
5807
+ /**
5808
+ * The offer it opens.
5809
+ */
5810
+ offer?: string;
5811
+ /**
5812
+ * palbase or app_store.
5813
+ */
5814
+ store: string;
5815
+ /**
5816
+ * A one-time code.
5817
+ */
5818
+ one_time: boolean;
5291
5819
  };
5292
5820
  /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
5293
5821
  export interface Events {
@@ -5355,6 +5883,14 @@ export interface Events {
5355
5883
  * purchases.subscription.changed: a customer's subscription started, renewed, stopped renewing (canceled) or renews again (uncanceled), could not be charged (billing_issue) or was again (recovered), ended (expired), or moved to another product (product_changed).
5356
5884
  */
5357
5885
  "purchases.subscription.changed": SubscriptionChangedEvent;
5886
+ /**
5887
+ * purchases.offer.redeemed: a customer took one of the catalog's offers — bought with it at a store, or given its grant — once.
5888
+ */
5889
+ "purchases.offer.redeemed": OfferRedeemedEvent;
5890
+ /**
5891
+ * purchases.coupon.redeemed: a customer redeemed a coupon — its code here, or an App Store offer code at Apple.
5892
+ */
5893
+ "purchases.coupon.redeemed": CouponRedeemedEvent;
5358
5894
  }
5359
5895
  /** Palbase Purchases */
5360
5896
  export declare function client(t: Transport): {
@@ -5657,7 +6193,7 @@ export declare function client(t: Transport): {
5657
6193
  /**
5658
6194
  * Start a Stripe App install
5659
6195
  *
5660
- * Starts an install with its link's grant, once: the grant is traded for the install's nonce, kept in the browser (an HttpOnly cookie of Palbase's address) and carried by Stripe (the state) — the way back is taken only in this browser, and the grant never reaches Stripe. Answers the project's name and Stripe's install page. A grant of no project, used, expired or started already: 410 `grant_invalid`, the same answer for each.
6196
+ * Names what an install link's grant connects (describe), or starts the install with it, once: the grant is traded for the install's nonce, kept in the browser (an HttpOnly cookie of Palbase's address, the install's own) and carried by Stripe (the state) — the way back is taken once, only in this browser, and the grant never reaches Stripe. Answers the project's name and ref and, started, Stripe's install page. A grant of no project, used, expired or started already: 410 `grant_invalid`, the same answer for each.
5661
6197
  */
5662
6198
  startStripeAppInstall(input: {
5663
6199
  body: StripeAppStartRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
@@ -5666,7 +6202,7 @@ export declare function client(t: Transport): {
5666
6202
  /**
5667
6203
  * The Stripe App's return
5668
6204
  *
5669
- * Where Stripe sends a Stripe App's installer back, with the install's code and its state (the project and the install's nonce): taken only in the browser that started the install — its cookie is the nonce —, where the grant, tried once more, names the project; the code is traded at Stripe for the install's tokens, sealed under the project's key, and the account is the project's connection. A cancelled install (`error`) spends its grant; an account already connected through the App to another project is refused. Answers a page the installer reads. No credential: the grant and the browser's nonce are the authorization.
6205
+ * Where Stripe sends a Stripe App's installer back, with the install's code and its state (the project and the install's nonce): taken once, only in the browser that started the install — its install's cookie is the nonce —, where the grant, spent now whatever comes of it, names the project; the code is traded at Stripe for the install's tokens, sealed under the project's key, and the account is the project's connection. A cancelled install (`error`) connects nothing; an account already connected through the App to another project is refused there (409), and that project keeps it with the tokens Stripe answered now. Answers a page the installer reads. No credential: the grant and the browser's nonce are the authorization.
5670
6206
  */
5671
6207
  completeStripeAppInstall(input?: {
5672
6208
  query?: {
@@ -6500,5 +7036,132 @@ export declare function client(t: Transport): {
6500
7036
  body: StripeEvent; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6501
7037
  signal?: AbortSignal;
6502
7038
  }): Promise<Reply<200, undefined>>;
7039
+ /**
7040
+ * List my offers
7041
+ *
7042
+ * The offers the signed-in customer may take now: live, not taken before (once a customer), for everyone, for an audience they are in having allowed personalization, or opened to them by a coupon they redeemed — with what each store sells them as.
7043
+ */
7044
+ listMyOffers(input?: {
7045
+ signal?: AbortSignal;
7046
+ }): Promise<Reply<200, Offers>>;
7047
+ /**
7048
+ * Record an offer shown
7049
+ *
7050
+ * The app showed the offer to its customer: the first time is counted (GET /purchases/offers/stats).
7051
+ */
7052
+ recordOfferView(input: {
7053
+ path: {
7054
+ offer_key: string;
7055
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7056
+ signal?: AbortSignal;
7057
+ }): Promise<Reply<204, undefined>>;
7058
+ /**
7059
+ * Sign an App Store offer
7060
+ *
7061
+ * Apple's signature of the offer's promotional offer for the customer's purchase of one of its subscriptions: StoreKit buys it with these (Product.PurchaseOption.promotionalOffer). Signed with the connected In-App Purchase key — or, for a StoreKit configuration on a developer's Mac, its Subscription Offers Key (PUT /purchases/apple/xcode-offer-key). Apple gives a promotional offer to a customer who subscribes, or subscribed, in the group.
7062
+ */
7063
+ signAppleOffer(input: {
7064
+ path: {
7065
+ offer_key: string;
7066
+ };
7067
+ body: AppleOfferRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7068
+ signal?: AbortSignal;
7069
+ }): Promise<Reply<200, AppleOfferSignature>>;
7070
+ /**
7071
+ * Claim a grant offer
7072
+ *
7073
+ * Takes a grant offer: its entitlement for its duration, from now. Emits `purchases.offer.redeemed` and `purchases.entitlement.changed`.
7074
+ */
7075
+ claimOffer(input: {
7076
+ path: {
7077
+ offer_key: string;
7078
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7079
+ signal?: AbortSignal;
7080
+ }): Promise<Reply<201, GrantInfo>>;
7081
+ /**
7082
+ * Redeem a coupon code
7083
+ *
7084
+ * Redeems a code the customer typed, once a customer: a grant at once, a discount or a trial theirs to buy (GET /purchases/offers lists it with the coupon). A one-time code is anyone's once; a shared code up to its cap. Emits `purchases.coupon.redeemed` (and `purchases.offer.redeemed` for a grant).
7085
+ */
7086
+ redeemCoupon(input: {
7087
+ body: CouponRedeemRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7088
+ signal?: AbortSignal;
7089
+ }): Promise<Reply<200, Redeemed>>;
7090
+ /**
7091
+ * Count the offers
7092
+ *
7093
+ * Every offer of the catalog, counted: customers shown it, customers who took it, by store.
7094
+ */
7095
+ getOfferStats(input?: {
7096
+ signal?: AbortSignal;
7097
+ }): Promise<Reply<200, OfferStatsList>>;
7098
+ /**
7099
+ * List coupons
7100
+ *
7101
+ * The project's coupons, newest first, with what came of each.
7102
+ */
7103
+ listCoupons(input?: {
7104
+ signal?: AbortSignal;
7105
+ }): Promise<Reply<200, CouponList>>;
7106
+ /**
7107
+ * Create a coupon
7108
+ *
7109
+ * Makes a coupon: a code that opens one of the catalog's offers. A palbase coupon's one-time codes are made here; a shared code of a discount on the web is the Stripe promotion code of the offer's coupon too. An apple coupon is an App Store offer code App Store Connect makes (the stores module writes it; `apple.state` says how it went) — its one-time codes are given out as Palbase's are.
7110
+ */
7111
+ createCoupon(input: {
7112
+ headers?: {
7113
+ "Idempotency-Key"?: string;
7114
+ };
7115
+ body: CouponRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7116
+ signal?: AbortSignal;
7117
+ }): Promise<Reply<201, CouponInfo>>;
7118
+ /**
7119
+ * Get a coupon
7120
+ *
7121
+ * A coupon and what came of it.
7122
+ */
7123
+ getCoupon(input: {
7124
+ path: {
7125
+ coupon_key: string;
7126
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7127
+ signal?: AbortSignal;
7128
+ }): Promise<Reply<200, CouponInfo>>;
7129
+ /**
7130
+ * Revoke a coupon
7131
+ *
7132
+ * Revokes a coupon: no code of it is redeemed from now; what was redeemed stays.
7133
+ */
7134
+ revokeCoupon(input: {
7135
+ path: {
7136
+ coupon_key: string;
7137
+ };
7138
+ headers?: {
7139
+ "Idempotency-Key"?: string;
7140
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7141
+ signal?: AbortSignal;
7142
+ }): Promise<Reply<204, undefined>>;
7143
+ /**
7144
+ * List a coupon’s codes
7145
+ *
7146
+ * A coupon's one-time codes: whom a message gave each to, who redeemed it. Accept: text/csv answers a file to hand out.
7147
+ */
7148
+ listCouponCodes(input: {
7149
+ path: {
7150
+ coupon_key: string;
7151
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7152
+ signal?: AbortSignal;
7153
+ }): Promise<Reply<200, CouponCodes>>;
7154
+ /**
7155
+ * Set Xcode’s offer key
7156
+ *
7157
+ * Keeps the Subscription Offers Key of Xcode's StoreKit configuration (Editor › Subscription Offers Key), sealed: an app run there buys a promotional offer with Palbase's signature. The Xcode certificate is set first.
7158
+ */
7159
+ setXcodeOfferKey(input: {
7160
+ headers?: {
7161
+ "Idempotency-Key"?: string;
7162
+ };
7163
+ body: XcodeOfferKeyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
7164
+ signal?: AbortSignal;
7165
+ }): Promise<Reply<200, XcodeOfferKey>>;
6503
7166
  };
6504
7167
  export type Client = ReturnType<typeof client>;