palbase 0.2.0 → 0.3.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 (46) 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/{NIJHTHNF.js → 4A6S7JKW.js} +2 -2
  8. package/dist/chunks/{6OPBXB7Z.js → 4LGRTNOK.js} +2 -2
  9. package/dist/chunks/{JEJ5CFTK.js → 6BUQ7N4I.js} +2 -2
  10. package/dist/chunks/7D5J3M3D.js +87 -0
  11. package/dist/chunks/{ZFPDYRRY.js → A4VJFSSX.js} +2 -2
  12. package/dist/chunks/AR6WQDU5.js +2 -0
  13. package/dist/chunks/{TL4H6V3P.js → BPWQDLXP.js} +1 -1
  14. package/dist/chunks/{HDX6YUAB.js → IQIXNAI4.js} +1 -1
  15. package/dist/chunks/{UTRQWCMD.js → LLBV62FM.js} +2 -2
  16. package/dist/chunks/{K3C2IEDS.js → MJ35SVVY.js} +2 -2
  17. package/dist/chunks/{5W6XJM46.js → NDJAXNM6.js} +2 -2
  18. package/dist/chunks/{ECUYQ73P.js → RK6M2LNY.js} +2 -2
  19. package/dist/chunks/{KRBVYYME.js → UNOLIHKD.js} +1 -1
  20. package/dist/chunks/{7LOMYBLN.js → W2GV6UU3.js} +2 -2
  21. package/dist/chunks/{I3JNX6MZ.js → YQYMP55L.js} +1 -1
  22. package/dist/cli.js +67 -67
  23. package/dist/refuse/ai.js +1 -1
  24. package/dist/refuse/backend.js +1 -1
  25. package/dist/refuse/server.js +1 -1
  26. package/dist/server/index.js +2 -2
  27. package/dist/server/testing.js +2 -2
  28. package/dist/web/index.js +2 -2
  29. package/dist/web/palbe.js +2 -2
  30. package/dist/web/paywall.js +2 -2
  31. package/dist/web/vite.js +2 -2
  32. package/package.json +2 -2
  33. package/types/internal/src/modules/ai.d.ts +811 -0
  34. package/types/internal/src/modules/purchases.d.ts +1601 -294
  35. package/types/internal/src/modules/storage.d.ts +1 -1
  36. package/types/web/src/client.d.ts +6 -0
  37. package/types/web/src/index.d.ts +1 -0
  38. package/types/web/src/paywall/assets.d.ts +51 -0
  39. package/types/web/src/paywall/attributes.d.ts +13 -0
  40. package/types/web/src/paywall/index.d.ts +4 -2
  41. package/types/web/src/paywall/placement.d.ts +21 -7
  42. package/types/web/src/paywall/render.d.ts +56 -17
  43. package/types/web/src/paywall/resolve.d.ts +150 -115
  44. package/types/web/src/purchases.d.ts +23 -4
  45. package/dist/chunks/AN5LCF5K.js +0 -55
  46. package/dist/chunks/HVC2C35F.js +0 -2
@@ -540,6 +540,48 @@ export type CheckoutRequest = {
540
540
  */
541
541
  success_url: string;
542
542
  };
543
+ /**
544
+ * 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.
545
+ */
546
+ export type Confidence = {
547
+ /**
548
+ * The chance to win the leader needs (0 to 1).
549
+ */
550
+ min_chance: number;
551
+ /**
552
+ * The subjects each variant needs to have been seen by.
553
+ */
554
+ min_viewers: number;
555
+ /**
556
+ * What is still lacking; empty when confident.
557
+ */
558
+ reasons: ConfidenceReason[];
559
+ };
560
+ /**
561
+ * One thing the results lack to call their leader.
562
+ */
563
+ export type ConfidenceReason = {
564
+ /**
565
+ * Its chance to win, for leader_unsure.
566
+ */
567
+ chance?: number;
568
+ /**
569
+ * no_viewers: no one saw a variant yet; too_few_viewers: a variant was seen by fewer than min_viewers (variant, viewers); leader_unsure: the leader's chance to win is under min_chance (variant, chance).
570
+ */
571
+ code: "no_viewers" | "too_few_viewers" | "leader_unsure";
572
+ /**
573
+ * The reason in words ("variant b has 40 viewers (needs 100)").
574
+ */
575
+ message: string;
576
+ /**
577
+ * The variant it is about.
578
+ */
579
+ variant?: string;
580
+ /**
581
+ * Its viewers, for too_few_viewers.
582
+ */
583
+ viewers?: number;
584
+ };
543
585
  /**
544
586
  * An In-App Purchase key handed over with a grant, for one of the environment's iOS apps.
545
587
  */
@@ -1091,6 +1133,10 @@ export type ErrorResponse = {
1091
1133
  * An experiment on a placement. Its variants never change while it runs, so no one's variant does.
1092
1134
  */
1093
1135
  export type Experiment = {
1136
+ /**
1137
+ * placement: everyone at the placement, decided before its rules; rules: the viewers the rules targeting it send it.
1138
+ */
1139
+ audience: "placement" | "rules";
1094
1140
  /**
1095
1141
  * When it ended.
1096
1142
  */
@@ -1120,7 +1166,7 @@ export type Experiment = {
1120
1166
  */
1121
1167
  started_by: string;
1122
1168
  /**
1123
- * running; stopped (the placement shows the first variant's paywall); won (the winner's).
1169
+ * running; stopped (what it showed becomes the first variant's paywall); won (the winner's).
1124
1170
  */
1125
1171
  status: "running" | "stopped" | "won";
1126
1172
  /**
@@ -1136,12 +1182,16 @@ export type Experiment = {
1136
1182
  * An experiment to start.
1137
1183
  */
1138
1184
  export type ExperimentRequest = {
1185
+ /**
1186
+ * placement (when none): everyone at the placement — made when new —, decided before its rules; rules: the viewers the placement's rules targeting it send it — the placement is one already.
1187
+ */
1188
+ audience?: "placement" | "rules";
1139
1189
  /**
1140
1190
  * Its name (1 to 100 characters).
1141
1191
  */
1142
1192
  name: string;
1143
1193
  /**
1144
- * The placement it runs on (made when new).
1194
+ * The placement it runs on (for everyone there, made when new).
1145
1195
  */
1146
1196
  placement: string;
1147
1197
  /**
@@ -1157,8 +1207,9 @@ export type ExperimentResults = {
1157
1207
  * When the numbers were counted.
1158
1208
  */
1159
1209
  computed_at: string;
1210
+ confidence: Confidence;
1160
1211
  /**
1161
- * Whether the leader's chance to win is 95% or more and every variant was seen by 100 subjects or more: declaring it the winner is sound.
1212
+ * Whether declaring the leader the winner is sound: confidence has no reason left.
1162
1213
  */
1163
1214
  confident: boolean;
1164
1215
  /**
@@ -1217,7 +1268,7 @@ export type Experiments = {
1217
1268
  next_cursor?: string;
1218
1269
  };
1219
1270
  /**
1220
- * What an app showed at a placement, as it was given it.
1271
+ * What an app showed at a placement, as it was given it. variant and rule_id are claims, checked against the placement: one that does not hold is not written.
1221
1272
  */
1222
1273
  export type ExposureRequest = {
1223
1274
  /**
@@ -1225,7 +1276,11 @@ export type ExposureRequest = {
1225
1276
  */
1226
1277
  paywall_id: string;
1227
1278
  /**
1228
- * The variant it was given, when an experiment runs on the placement.
1279
+ * The rule the answer named, when it named one.
1280
+ */
1281
+ rule_id?: string;
1282
+ /**
1283
+ * The variant the answer named, when it named one.
1229
1284
  */
1230
1285
  variant?: string;
1231
1286
  /**
@@ -1642,438 +1697,1006 @@ export type Paywall = {
1642
1697
  updated_by: string;
1643
1698
  };
1644
1699
  /**
1645
- * The button that closes the paywall.
1700
+ * What a button does.
1646
1701
  */
1647
- export type PaywallCloseButton = {
1648
- /**
1649
- * Its color. A color of the theme (background, surface, text, muted, accent, on_accent, badge) — the light or the dark palette's, as the app appears —, or #RRGGBB / #RRGGBBAA in both.
1650
- */
1651
- color?: string;
1652
- /**
1653
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1654
- */
1655
- id?: string;
1702
+ export type PaywallAction = {
1656
1703
  /**
1657
- * The component.
1704
+ * Package.
1658
1705
  */
1659
- type: "close_button";
1660
- };
1661
- /**
1662
- * A component, by its type. A newer schema adds components; an app never draws a definition with one it does not know.
1663
- */
1664
- export type PaywallComponent = PaywallStack | PaywallText | PaywallImage | PaywallIcon | PaywallFeatures | PaywallPackages | PaywallPurchaseButton | PaywallRestoreButton | PaywallLink | PaywallCloseButton | PaywallSpacer | PaywallDivider;
1665
- /**
1666
- * A paywall: a tree of components an app draws natively (SwiftUI on iOS, the DOM on the web), its texts in each language and its two palettes. Prices are never in it: an app fills `{{price}}` and the other variables from its store. The server refuses what it does not know — a field, a component, a newer schema — and holds a definition to bounds: 64 KiB of JSON, 200 components, 12 deep, 500 characters a text, 40 languages.
1667
- */
1668
- export type PaywallDefinition = {
1706
+ package?: string;
1669
1707
  /**
1670
- * The language a text falls back to: a tag such as en or pt-BR.
1708
+ * Sheet.
1671
1709
  */
1672
- default_locale: string;
1673
- locales?: PaywallLocales;
1710
+ sheet?: string;
1674
1711
  /**
1675
- * The paywall's name, for the people who edit it (1 to 100 characters).
1712
+ * Type.
1676
1713
  */
1677
- name: string;
1678
- root: PaywallComponent;
1714
+ type: "close" | "restore" | "open_url" | "terms" | "privacy" | "offer_code" | "sheet" | "select_package";
1679
1715
  /**
1680
- * The schema the definition is written in. An app asks for the newest schema it draws (`X-Palbase-Paywall-Schema`) and is given the newest version written in it or an older one.
1716
+ * Url.
1681
1717
  */
1682
- schema: number;
1683
- theme: PaywallTheme;
1718
+ url?: string;
1684
1719
  };
1685
1720
  /**
1686
- * A thin line across its stack.
1721
+ * How the component appears; a renderer skips it when the system asks to reduce motion.
1687
1722
  */
1688
- export type PaywallDivider = {
1723
+ export type PaywallAnimation = {
1689
1724
  /**
1690
- * Its color. A color of the theme (background, surface, text, muted, accent, on_accent, badge) — the light or the dark palette's, as the app appears —, or #RRGGBB / #RRGGBBAA in both.
1725
+ * Delay ms.
1691
1726
  */
1692
- color?: string;
1727
+ delay_ms?: number;
1693
1728
  /**
1694
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1729
+ * Duration ms.
1695
1730
  */
1696
- id?: string;
1731
+ duration_ms?: number;
1697
1732
  /**
1698
- * The component.
1733
+ * Easing.
1699
1734
  */
1700
- type: "divider";
1735
+ easing?: "ease_out" | "ease_in_out" | "spring";
1736
+ /**
1737
+ * Type.
1738
+ */
1739
+ type: "fade" | "slide_up" | "slide_down" | "slide_leading" | "slide_trailing" | "scale";
1701
1740
  };
1702
1741
  /**
1703
- * The error envelope of a refused definition, with every problem when it breaks a rule (`invalid_paywall`).
1742
+ * An image, a video, a font or an HTML block the project keeps in its own storage — a public bucket — and registered for its paywalls. A definition names it asset:<id>.
1704
1743
  */
1705
- export type PaywallError = {
1706
- /**
1707
- * Machine-readable error code (snake_case)
1708
- */
1709
- error: string;
1710
- /**
1711
- * Human-readable explanation
1712
- */
1713
- error_description: string;
1714
- /**
1715
- * Every problem, by path: with `invalid_paywall`, absent otherwise.
1716
- */
1717
- problems?: PaywallProblem[];
1744
+ export type PaywallAsset = {
1718
1745
  /**
1719
- * Correlation ID for log/audit lookup
1746
+ * The project's bucket it is in: paywall-assets.
1720
1747
  */
1721
- request_id: string;
1748
+ bucket: string;
1722
1749
  /**
1723
- * Seconds to wait before retrying; present on a refusal that ends with time.
1750
+ * Its size.
1724
1751
  */
1725
- retry_after?: number;
1752
+ bytes: number;
1726
1753
  /**
1727
- * HTTP status code (mirrors the response status)
1754
+ * Its content type, from its bytes.
1728
1755
  */
1729
- status: number;
1730
- };
1731
- /**
1732
- * A feature.
1733
- */
1734
- export type PaywallFeatureItem = {
1735
- icon: PaywallIconName;
1736
- text: PaywallString;
1737
- };
1738
- /**
1739
- * A list of what the purchase gives, each with an icon.
1740
- */
1741
- export type PaywallFeatures = {
1756
+ content_type: string;
1742
1757
  /**
1743
- * The texts' color. A color of the theme (background, surface, text, muted, accent, on_accent, badge) — the light or the dark palette's, as the app appears —, or #RRGGBB / #RRGGBBAA in both.
1758
+ * When it was registered.
1744
1759
  */
1745
- color?: string;
1760
+ created_at: string;
1746
1761
  /**
1747
- * The icons' color. A color of the theme (background, surface, text, muted, accent, on_accent, badge) — the light or the dark palette's, as the app appears —, or #RRGGBB / #RRGGBBAA in both.
1762
+ * Who registered it (the key).
1748
1763
  */
1749
- icon_color?: string;
1764
+ created_by: string;
1750
1765
  /**
1751
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1766
+ * An HTML block's files.
1752
1767
  */
1753
- id?: string;
1768
+ files?: number;
1754
1769
  /**
1755
- * The features, 1 to 12.
1770
+ * The asset's id.
1756
1771
  */
1757
- items: PaywallFeatureItem[];
1772
+ id: string;
1758
1773
  /**
1759
- * Points between the features.
1774
+ * What its bytes are: an image (png, jpeg, webp), a video (mp4, mov), a font (ttf, otf, woff2), or an HTML block's zip.
1760
1775
  */
1761
- spacing?: number;
1776
+ kind: "image" | "video" | "font" | "html";
1762
1777
  /**
1763
- * The component.
1778
+ * What an HTML block's files hold together.
1764
1779
  */
1765
- type: "features";
1766
- };
1767
- /**
1768
- * An icon.
1769
- */
1770
- export type PaywallIcon = {
1780
+ opened_bytes?: number;
1771
1781
  /**
1772
- * Its color. A color of the theme (background, surface, text, muted, accent, on_accent, badge) — the light or the dark palette's, as the app appears —, or #RRGGBB / #RRGGBBAA in both.
1782
+ * Its path in the bucket.
1773
1783
  */
1774
- color?: string;
1784
+ path: string;
1775
1785
  /**
1776
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1786
+ * How a definition names it: asset:<id>.
1777
1787
  */
1778
- id?: string;
1779
- name: PaywallIconName;
1788
+ ref: string;
1780
1789
  /**
1781
- * Its size in points.
1790
+ * The SHA-256 of its bytes, hex: an app draws what it downloads only when it is this.
1782
1791
  */
1783
- size?: number;
1792
+ sha256: string;
1784
1793
  /**
1785
- * The component.
1794
+ * Its public https address.
1786
1795
  */
1787
- type: "icon";
1796
+ url: string;
1788
1797
  };
1789
1798
  /**
1790
- * An icon every renderer draws (SF Symbols on iOS).
1791
- */
1792
- export type PaywallIconName = "ad_free" | "bell" | "bolt" | "book" | "chart" | "chat" | "check" | "check_circle" | "clock" | "cloud" | "crown" | "download" | "gift" | "globe" | "heart" | "infinity" | "lock_open" | "music" | "people" | "person" | "photo" | "shield" | "sparkles" | "star" | "video";
1793
- /**
1794
- * An image the app downloads.
1799
+ * An asset a definition names, as an app downloads it before it shows the paywall.
1795
1800
  */
1796
- export type PaywallImage = {
1797
- alt?: PaywallString;
1798
- /**
1799
- * Its frame's width over its height; the image's own when absent.
1800
- */
1801
- aspect?: number;
1801
+ export type PaywallAssetRef = {
1802
1802
  /**
1803
- * Its corner radius, in points.
1803
+ * Its size.
1804
1804
  */
1805
- corner?: number;
1805
+ bytes: number;
1806
1806
  /**
1807
- * Fit shows it whole; fill covers the frame and crops.
1807
+ * The asset: a definition names it asset:<id>.
1808
1808
  */
1809
- fit?: "fit" | "fill";
1809
+ id: string;
1810
1810
  /**
1811
- * Its frame's height in points; from its width when absent.
1811
+ * What it is.
1812
1812
  */
1813
- height?: number;
1813
+ kind: "image" | "video" | "font" | "html";
1814
1814
  /**
1815
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1815
+ * The SHA-256 its bytes must have: an asset whose download is not this is not drawn.
1816
1816
  */
1817
- id?: string;
1817
+ sha256: string;
1818
1818
  /**
1819
1819
  * Its https address.
1820
1820
  */
1821
- src: string;
1822
- /**
1823
- * The component.
1824
- */
1825
- type: "image";
1821
+ url: string;
1826
1822
  };
1827
1823
  /**
1828
- * A link: the app's terms or privacy policy, or an https address.
1824
+ * An object of the project's public bucket paywall-assets to register, uploaded first with the project's storage (palbase-js). Studio and the CLI make the bucket (public) when it is missing; the module reads nothing else.
1829
1825
  */
1830
- export type PaywallLink = {
1831
- /**
1832
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1833
- */
1834
- id?: string;
1835
- text: PaywallString;
1826
+ export type PaywallAssetRequest = {
1836
1827
  /**
1837
- * The component.
1828
+ * What the object is meant to be: a registration whose bytes are another kind is refused (asset_kind_mismatch).
1838
1829
  */
1839
- type: "link";
1830
+ kind?: "image" | "video" | "font" | "html";
1840
1831
  /**
1841
- * An https address, or `terms` / `privacy`: the addresses the app gives the SDK.
1832
+ * The object's path in the paywall-assets bucket (a leading / is the bucket's root). A . or .. segment, an empty one or a control character is refused, never resolved.
1842
1833
  */
1843
- url: string;
1834
+ path: string;
1844
1835
  };
1845
1836
  /**
1846
- * The project's paywalls (at most 100), oldest first.
1837
+ * The project's paywall assets (at most 500), newest first.
1847
1838
  */
1848
- export type PaywallList = {
1839
+ export type PaywallAssets = {
1849
1840
  /**
1850
- * The paywalls.
1841
+ * The assets.
1851
1842
  */
1852
- paywalls: PaywallSummary[];
1853
- };
1854
- /**
1855
- * The text itself, in every language.
1856
- */
1857
- export type PaywallLiteral = string;
1858
- /**
1859
- * The texts in each language (at most 40), by language tag: a component's `{"t": key}` is the app's language's, or the default locale's when it lacks the key.
1860
- */
1861
- export type PaywallLocales = {
1862
- [key: string]: PaywallTexts;
1843
+ assets: PaywallAsset[];
1863
1844
  };
1864
1845
  /**
1865
- * A package: a product's plan of the catalog. The app shows it with its store's price (the response's offerings name each channel's store id).
1846
+ * A border.
1866
1847
  */
1867
- export type PaywallPackageItem = {
1868
- badge?: PaywallString;
1869
- detail?: PaywallString;
1848
+ export type PaywallBorder = {
1870
1849
  /**
1871
- * The product's plan.
1872
- */
1873
- plan: string;
1874
- /**
1875
- * The catalog's product.
1850
+ * Color.
1876
1851
  */
1877
- product: string;
1852
+ color: string;
1878
1853
  /**
1879
- * Selected when the paywall opens (at most one; the first when none is).
1854
+ * Width.
1880
1855
  */
1881
- selected?: boolean;
1882
- title?: PaywallString;
1856
+ width: number;
1883
1857
  };
1884
1858
  /**
1885
- * The packages on sale, one of them selected: what the purchase button buys. A paywall has one.
1859
+ * A button that does an action: closes the paywall, restores purchases, opens an address, the terms or the privacy policy, the store's offer code sheet, one of the paywall's sheets, or selects a package.
1886
1860
  */
1887
- export type PaywallPackages = {
1861
+ export type PaywallButton = {
1862
+ action: PaywallAction;
1863
+ animation?: PaywallAnimation;
1864
+ content: PaywallComponent;
1888
1865
  /**
1889
1866
  * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1890
1867
  */
1891
1868
  id?: string;
1892
- /**
1893
- * The packages, 1 to 6.
1894
- */
1895
- items: PaywallPackageItem[];
1896
- /**
1897
- * Rows down the screen, cards side by side, or a segmented picker.
1898
- */
1899
- layout?: "list" | "cards" | "segmented";
1869
+ states?: PaywallStates;
1870
+ style?: PaywallStyle;
1900
1871
  /**
1901
1872
  * The component.
1902
1873
  */
1903
- type: "packages";
1874
+ type: "button";
1875
+ visible?: PaywallCondition;
1904
1876
  };
1905
1877
  /**
1906
- * One appearance's colors, each `#RRGGBB` or `#RRGGBBAA`. A component's color names one of them.
1878
+ * Pages the customer swipes through, the next peeking in, advancing on their own, with an indicator.
1907
1879
  */
1908
- export type PaywallPalette = {
1880
+ export type PaywallCarousel = {
1881
+ animation?: PaywallAnimation;
1909
1882
  /**
1910
- * The purchase button, the selected package, icons.
1883
+ * Auto advance ms.
1911
1884
  */
1912
- accent: string;
1885
+ auto_advance_ms?: number;
1913
1886
  /**
1914
- * Behind everything.
1887
+ * Height.
1915
1888
  */
1916
- background: string;
1889
+ height?: PaywallSizeKeyword | PaywallLength;
1917
1890
  /**
1918
- * A package's badge.
1891
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1892
+ */
1893
+ id?: string;
1894
+ indicator?: PaywallIndicator;
1895
+ /**
1896
+ * Loop.
1919
1897
  */
1920
- badge: string;
1898
+ loop?: boolean;
1921
1899
  /**
1922
- * Secondary text, the close button, dividers.
1900
+ * Pages.
1923
1901
  */
1924
- muted: string;
1902
+ pages: PaywallComponent[];
1925
1903
  /**
1926
- * Text on the accent color.
1904
+ * Peek.
1927
1905
  */
1928
- on_accent: string;
1906
+ peek?: number;
1929
1907
  /**
1930
- * Cards and the packages' background.
1908
+ * Spacing.
1931
1909
  */
1932
- surface: string;
1910
+ spacing?: number;
1911
+ states?: PaywallStates;
1912
+ style?: PaywallStyle;
1933
1913
  /**
1934
- * Text.
1914
+ * The component.
1935
1915
  */
1936
- text: string;
1916
+ type: "carousel";
1917
+ visible?: PaywallCondition;
1937
1918
  };
1938
1919
  /**
1939
- * One thing wrong with a definition.
1920
+ * A color: a token of the theme's colors (the light or the dark value, as the app appears), or #RRGGBB / #RRGGBBAA.
1940
1921
  */
1941
- export type PaywallProblem = {
1922
+ export type PaywallColorValue = string;
1923
+ /**
1924
+ * The theme's colors by name, for each appearance; both name the same colors, at least background, surface, text, muted, accent and on_accent.
1925
+ */
1926
+ export type PaywallColors = {
1927
+ dark: PaywallPalette;
1928
+ light: PaywallPalette;
1929
+ };
1930
+ /**
1931
+ * A component, by its type. A newer schema adds components; an app never draws a definition with one it does not know.
1932
+ */
1933
+ export type PaywallComponent = PaywallButton | PaywallCarousel | PaywallCountdown | PaywallCustomHtml | PaywallDivider | PaywallFeatures | PaywallIcon | PaywallImage | PaywallPackage | PaywallPurchaseButton | PaywallSpacer | PaywallStack | PaywallSwitch | PaywallTabs | PaywallText | PaywallTimeline | PaywallVideo;
1934
+ /**
1935
+ * When the component is shown: every field named holds at once.
1936
+ */
1937
+ export type PaywallCondition = {
1942
1938
  /**
1943
- * What it is (unknown_field, unknown_component, too_long, invalid_url, unknown_package …).
1939
+ * Appearance.
1944
1940
  */
1945
- code: string;
1941
+ appearance?: "light" | "dark";
1946
1942
  /**
1947
- * What to do about it.
1943
+ * Intro eligible.
1948
1944
  */
1949
- message: string;
1945
+ intro_eligible?: boolean;
1950
1946
  /**
1951
- * Where it is (root.children[2].items[0].product).
1947
+ * Locale.
1952
1948
  */
1953
- path: string;
1949
+ locale?: string[];
1954
1950
  /**
1955
- * A warning does not stop a save or a publish (App Review's expectations, a package the catalog does not sell yet in a draft).
1951
+ * Platform.
1956
1952
  */
1957
- warning?: boolean;
1953
+ platform?: ("ios" | "android" | "web")[];
1954
+ /**
1955
+ * Selected package.
1956
+ */
1957
+ selected_package?: string[];
1958
+ /**
1959
+ * Tab.
1960
+ */
1961
+ tab?: string;
1958
1962
  };
1959
1963
  /**
1960
- * purchases.paywall.published: a paywall's draft was published as its next version; the apps that ask for a placement showing it get it.
1964
+ * Each corner its own, in points or a token of the theme's radii.
1961
1965
  */
1962
- export type PaywallPublishedEvent = {
1966
+ export type PaywallCorners = {
1963
1967
  /**
1964
- * Its name.
1968
+ * Bottom leading.
1965
1969
  */
1966
- name: string;
1970
+ bottom_leading?: PaywallPoints | PaywallToken;
1967
1971
  /**
1968
- * The paywall.
1972
+ * Bottom trailing.
1969
1973
  */
1970
- paywall_id: string;
1974
+ bottom_trailing?: PaywallPoints | PaywallToken;
1971
1975
  /**
1972
- * The schema it is written in.
1976
+ * Top leading.
1973
1977
  */
1974
- schema: number;
1978
+ top_leading?: PaywallPoints | PaywallToken;
1975
1979
  /**
1976
- * The version published.
1980
+ * Top trailing.
1977
1981
  */
1978
- version: number;
1982
+ top_trailing?: PaywallPoints | PaywallToken;
1979
1983
  };
1980
1984
  /**
1981
- * The button that buys the selected package; the app's store sheet (StoreKit) or checkout (Stripe) opens.
1985
+ * A countdown to an instant, or for a time from the moment the paywall opened: one content while it counts — its texts name {{countdown}}, {{days}}, {{hours}}, {{minutes}}, {{seconds}} —, another once it ended.
1982
1986
  */
1983
- export type PaywallPurchaseButton = {
1987
+ export type PaywallCountdown = {
1988
+ animation?: PaywallAnimation;
1989
+ counting: PaywallComponent;
1990
+ ended?: PaywallComponent;
1984
1991
  /**
1985
1992
  * Names the component, unique in the paywall: an app's code can draw its own part in its place.
1986
1993
  */
1987
1994
  id?: string;
1988
- sub_text?: PaywallString;
1989
- text: PaywallString;
1995
+ states?: PaywallStates;
1996
+ style?: PaywallStyle;
1997
+ target: PaywallTarget;
1990
1998
  /**
1991
1999
  * The component.
1992
2000
  */
1993
- type: "purchase_button";
1994
- };
1995
- /**
1996
- * A definition to save as a paywall's draft.
1997
- */
1998
- export type PaywallRequest = {
1999
- definition: PaywallDefinition;
2001
+ type: "countdown";
2002
+ visible?: PaywallCondition;
2000
2003
  };
2001
2004
  /**
2002
- * The button that restores the customer's purchases from the store.
2005
+ * A decorative HTML block from an archive the project uploaded (an animation, a Lottie or Rive scene): drawn in a sandbox of an origin of its own: it reaches neither the page around it, nor the app, nor the purchase, and loads only what came in its archive (a content security policy) — it may still navigate its own frame away. It is told the selected package, the language and the appearance, and is hidden from screen readers. It cannot buy anything.
2003
2006
  */
2004
- export type PaywallRestoreButton = {
2007
+ export type PaywallCustomHtml = {
2008
+ animation?: PaywallAnimation;
2009
+ /**
2010
+ * Height.
2011
+ */
2012
+ height: PaywallSizeKeyword | PaywallLength;
2005
2013
  /**
2006
2014
  * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2007
2015
  */
2008
2016
  id?: string;
2009
- text?: PaywallString;
2017
+ /**
2018
+ * Src.
2019
+ */
2020
+ src: string;
2021
+ states?: PaywallStates;
2022
+ style?: PaywallStyle;
2010
2023
  /**
2011
2024
  * The component.
2012
2025
  */
2013
- type: "restore_button";
2026
+ type: "custom_html";
2027
+ visible?: PaywallCondition;
2014
2028
  };
2015
2029
  /**
2016
- * Space: a fixed size, or all that is left along its stack when absent.
2030
+ * A paywall: a design system (the theme's colors, type scale, radii and spacing) and a free layout of components that name it — a fixed header and footer around the part that scrolls, and sheets it opens. Every component takes a style, a condition to be shown, a style for when it is selected, and an entrance animation. Prices are never in it: an app fills `{{price}}` and the other variables from its store. Its assets (asset:<id>) are the project's, given as https addresses in the app's answer and listed for the app to download before it shows the paywall. The server refuses what it does not know and holds a definition to bounds: 128 KiB of JSON, 400 components, 16 deep, 500 characters a text, 40 languages, 8 stops a gradient, 2 seconds an animation, 10 carousel pages, 5 tabs, 5 sheets.
2017
2031
  */
2018
- export type PaywallSpacer = {
2032
+ export type PaywallDefinition = {
2019
2033
  /**
2020
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2034
+ * The language a text falls back to: a tag such as en or pt-BR.
2021
2035
  */
2022
- id?: string;
2036
+ default_locale: string;
2037
+ footer?: PaywallComponent;
2038
+ header?: PaywallComponent;
2039
+ locales?: PaywallLocales;
2023
2040
  /**
2024
- * Its size in points.
2041
+ * The paywall's name, for the people who edit it (1 to 100 characters).
2025
2042
  */
2026
- size?: number;
2043
+ name: string;
2044
+ root: PaywallComponent;
2027
2045
  /**
2028
- * The component.
2046
+ * The schema the definition is written in: 2. An app says the newest schema it draws (X-Palbase-Paywall-Schema) and is given the newest version written in it or an older one; an app that draws no schema this server takes is told to update (426).
2029
2047
  */
2030
- type: "spacer";
2048
+ schema: number;
2049
+ sheets?: PaywallSheets;
2050
+ theme: PaywallTheme;
2031
2051
  };
2032
2052
  /**
2033
- * Components laid out one after another — down, across — or over each other. The root is drawn in a scroll view.
2053
+ * A thin line across its stack.
2034
2054
  */
2035
- export type PaywallStack = {
2055
+ export type PaywallDivider = {
2056
+ animation?: PaywallAnimation;
2036
2057
  /**
2037
- * Where the components sit across the axis (on both axes in a z stack); stretch fills it.
2058
+ * Color.
2038
2059
  */
2039
- align?: "start" | "center" | "end" | "stretch";
2060
+ color?: string;
2040
2061
  /**
2041
- * Down the screen, across it, or over each other (z).
2062
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2042
2063
  */
2043
- axis?: "vertical" | "horizontal" | "z";
2064
+ id?: string;
2065
+ states?: PaywallStates;
2066
+ style?: PaywallStyle;
2044
2067
  /**
2045
- * Behind the stack; none when absent. A color of the theme (background, surface, text, muted, accent, on_accent, badge) — the light or the dark palette's, as the app appears —, or #RRGGBB / #RRGGBBAA in both.
2068
+ * Thickness.
2046
2069
  */
2047
- background?: string;
2070
+ thickness?: number;
2048
2071
  /**
2049
- * The components, at most 50.
2072
+ * The component.
2050
2073
  */
2051
- children?: PaywallComponent[];
2074
+ type: "divider";
2075
+ visible?: PaywallCondition;
2076
+ };
2077
+ /**
2078
+ * Each edge its own, in points or a token of the theme's spacing.
2079
+ */
2080
+ export type PaywallEdges = {
2052
2081
  /**
2053
- * The background's corner radius, in points.
2082
+ * Bottom.
2054
2083
  */
2055
- corner?: number;
2084
+ bottom?: PaywallPoints | PaywallToken;
2056
2085
  /**
2057
- * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2086
+ * Leading.
2058
2087
  */
2059
- id?: string;
2088
+ leading?: PaywallPoints | PaywallToken;
2060
2089
  /**
2061
- * Points around the components.
2090
+ * Top.
2062
2091
  */
2063
- padding?: number;
2092
+ top?: PaywallPoints | PaywallToken;
2064
2093
  /**
2065
- * Points between the components.
2094
+ * Trailing.
2066
2095
  */
2067
- spacing?: number;
2068
- /**
2096
+ trailing?: PaywallPoints | PaywallToken;
2097
+ };
2098
+ /**
2099
+ * The error envelope of a refused definition, with every problem when it breaks a rule (`invalid_paywall`).
2100
+ */
2101
+ export type PaywallError = {
2102
+ /**
2103
+ * Machine-readable error code (snake_case)
2104
+ */
2105
+ error: string;
2106
+ /**
2107
+ * Human-readable explanation
2108
+ */
2109
+ error_description: string;
2110
+ /**
2111
+ * Every problem, by path: with `invalid_paywall`, absent otherwise.
2112
+ */
2113
+ problems?: PaywallProblem[];
2114
+ /**
2115
+ * Correlation ID for log/audit lookup
2116
+ */
2117
+ request_id: string;
2118
+ /**
2119
+ * Seconds to wait before retrying; present on a refusal that ends with time.
2120
+ */
2121
+ retry_after?: number;
2122
+ /**
2123
+ * HTTP status code (mirrors the response status)
2124
+ */
2125
+ status: number;
2126
+ };
2127
+ /**
2128
+ * A feature.
2129
+ */
2130
+ export type PaywallFeature = {
2131
+ icon: PaywallIconName;
2132
+ text: PaywallString;
2133
+ };
2134
+ /**
2135
+ * What the purchase gives, each with an icon.
2136
+ */
2137
+ export type PaywallFeatures = {
2138
+ animation?: PaywallAnimation;
2139
+ /**
2140
+ * Color.
2141
+ */
2142
+ color?: string;
2143
+ /**
2144
+ * Icon color.
2145
+ */
2146
+ icon_color?: string;
2147
+ /**
2148
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2149
+ */
2150
+ id?: string;
2151
+ /**
2152
+ * Items.
2153
+ */
2154
+ items: PaywallFeature[];
2155
+ /**
2156
+ * Spacing.
2157
+ */
2158
+ spacing?: number;
2159
+ states?: PaywallStates;
2160
+ style?: PaywallStyle;
2161
+ /**
2162
+ * The component.
2163
+ */
2164
+ type: "features";
2165
+ visible?: PaywallCondition;
2166
+ };
2167
+ /**
2168
+ * A size in points, scaled with the platform's body style.
2169
+ */
2170
+ export type PaywallFontSize = number;
2171
+ /**
2172
+ * An icon every renderer draws.
2173
+ */
2174
+ export type PaywallIcon = {
2175
+ animation?: PaywallAnimation;
2176
+ /**
2177
+ * Color.
2178
+ */
2179
+ color?: string;
2180
+ /**
2181
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2182
+ */
2183
+ id?: string;
2184
+ name: PaywallIconName;
2185
+ /**
2186
+ * Size.
2187
+ */
2188
+ size?: number;
2189
+ states?: PaywallStates;
2190
+ style?: PaywallStyle;
2191
+ /**
2192
+ * The component.
2193
+ */
2194
+ type: "icon";
2195
+ visible?: PaywallCondition;
2196
+ };
2197
+ /**
2198
+ * An icon every renderer draws (SF Symbols on iOS).
2199
+ */
2200
+ export type PaywallIconName = "ad_free" | "arrow_right" | "bell" | "bolt" | "book" | "calendar" | "chart" | "chat" | "check" | "check_circle" | "clock" | "close" | "cloud" | "crown" | "download" | "gift" | "globe" | "heart" | "infinity" | "lock" | "lock_open" | "music" | "people" | "person" | "photo" | "play" | "quote" | "shield" | "sparkles" | "star" | "trophy" | "video";
2201
+ /**
2202
+ * An image the app downloads before it shows the paywall: an https address, or an image the project uploaded.
2203
+ */
2204
+ export type PaywallImage = {
2205
+ alt?: PaywallString;
2206
+ animation?: PaywallAnimation;
2207
+ /**
2208
+ * Aspect.
2209
+ */
2210
+ aspect?: number;
2211
+ /**
2212
+ * Decorative.
2213
+ */
2214
+ decorative?: boolean;
2215
+ /**
2216
+ * Fit.
2217
+ */
2218
+ fit?: "fit" | "fill";
2219
+ /**
2220
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2221
+ */
2222
+ id?: string;
2223
+ mask?: PaywallMask;
2224
+ /**
2225
+ * Overlay.
2226
+ */
2227
+ overlay?: PaywallLinear | PaywallRadial;
2228
+ /**
2229
+ * Src.
2230
+ */
2231
+ src: string;
2232
+ states?: PaywallStates;
2233
+ style?: PaywallStyle;
2234
+ /**
2235
+ * The component.
2236
+ */
2237
+ type: "image";
2238
+ visible?: PaywallCondition;
2239
+ };
2240
+ /**
2241
+ * An image behind the component.
2242
+ */
2243
+ export type PaywallImageFill = {
2244
+ /**
2245
+ * Fit.
2246
+ */
2247
+ fit?: "fit" | "fill";
2248
+ /**
2249
+ * Src.
2250
+ */
2251
+ src: string;
2252
+ /**
2253
+ * Type.
2254
+ */
2255
+ type: "image";
2256
+ };
2257
+ /**
2258
+ * A carousel's page indicator.
2259
+ */
2260
+ export type PaywallIndicator = {
2261
+ /**
2262
+ * Active color.
2263
+ */
2264
+ active_color?: string;
2265
+ /**
2266
+ * Color.
2267
+ */
2268
+ color?: string;
2269
+ /**
2270
+ * Size.
2271
+ */
2272
+ size?: number;
2273
+ /**
2274
+ * Spacing.
2275
+ */
2276
+ spacing?: number;
2277
+ /**
2278
+ * Its style.
2279
+ */
2280
+ style?: "dots" | "bars" | "none";
2281
+ };
2282
+ /**
2283
+ * A length in points.
2284
+ */
2285
+ export type PaywallLength = number;
2286
+ /**
2287
+ * A linear gradient: its angle (0 up, clockwise, 180 down) and 2 to 8 stops.
2288
+ */
2289
+ export type PaywallLinear = {
2290
+ /**
2291
+ * Angle.
2292
+ */
2293
+ angle?: number;
2294
+ /**
2295
+ * Stops.
2296
+ */
2297
+ stops: PaywallStop[];
2298
+ /**
2299
+ * Type.
2300
+ */
2301
+ type: "linear";
2302
+ };
2303
+ /**
2304
+ * The project's paywalls (at most 100), oldest first.
2305
+ */
2306
+ export type PaywallList = {
2307
+ /**
2308
+ * The paywalls.
2309
+ */
2310
+ paywalls: PaywallSummary[];
2311
+ };
2312
+ /**
2313
+ * The text itself, in every language.
2314
+ */
2315
+ export type PaywallLiteral = string;
2316
+ /**
2317
+ * The texts in each language (at most 40), by language tag: a component's `{"t": key}` is the app's language's, or the default locale's when it lacks the key.
2318
+ */
2319
+ export type PaywallLocales = {
2320
+ [key: string]: PaywallTexts;
2321
+ };
2322
+ /**
2323
+ * The image's shape: a rectangle with corners, a circle, or a rectangle whose bottom edge curves in (concave) or out (convex).
2324
+ */
2325
+ export type PaywallMask = {
2326
+ /**
2327
+ * Depth.
2328
+ */
2329
+ depth?: number;
2330
+ /**
2331
+ * Radius.
2332
+ */
2333
+ radius?: PaywallPoints | PaywallToken;
2334
+ /**
2335
+ * Shape.
2336
+ */
2337
+ shape: "rect" | "circle" | "concave" | "convex";
2338
+ };
2339
+ /**
2340
+ * A package on sale, laid out as the project likes: tapping it selects it; its content's styles for when it is selected apply while it is.
2341
+ */
2342
+ export type PaywallPackage = {
2343
+ animation?: PaywallAnimation;
2344
+ /**
2345
+ * The components.
2346
+ */
2347
+ children?: PaywallComponent[];
2348
+ /**
2349
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2350
+ */
2351
+ id?: string;
2352
+ /**
2353
+ * Plan.
2354
+ */
2355
+ plan: string;
2356
+ /**
2357
+ * Product.
2358
+ */
2359
+ product: string;
2360
+ /**
2361
+ * Selected when the paywall opens (at most one).
2362
+ */
2363
+ selected?: boolean;
2364
+ states?: PaywallStates;
2365
+ style?: PaywallStyle;
2366
+ /**
2367
+ * The component.
2368
+ */
2369
+ type: "package";
2370
+ visible?: PaywallCondition;
2371
+ };
2372
+ /**
2373
+ * Colors by token (lowercase letters, digits and _, at most 32), each #RRGGBB or #RRGGBBAA.
2374
+ */
2375
+ export type PaywallPalette = {
2376
+ [key: string]: string;
2377
+ };
2378
+ /**
2379
+ * Points.
2380
+ */
2381
+ export type PaywallPoints = number;
2382
+ /**
2383
+ * One thing wrong with a definition.
2384
+ */
2385
+ export type PaywallProblem = {
2386
+ /**
2387
+ * What it is (unknown_field, unknown_component, too_long, invalid_url, unknown_package, unknown_token, unknown_asset, asset_missing, asset_changed, asset_unverified …).
2388
+ */
2389
+ code: string;
2390
+ /**
2391
+ * What to do about it.
2392
+ */
2393
+ message: string;
2394
+ /**
2395
+ * Where it is (root.children[2].items[0].product).
2396
+ */
2397
+ path: string;
2398
+ /**
2399
+ * A warning does not stop a save or a publish (App Review's expectations, a package the catalog does not sell yet in a draft).
2400
+ */
2401
+ warning?: boolean;
2402
+ };
2403
+ /**
2404
+ * purchases.paywall.published: a paywall's draft was published as its next version; the apps that ask for a placement showing it get it.
2405
+ */
2406
+ export type PaywallPublishedEvent = {
2407
+ /**
2408
+ * Its name.
2409
+ */
2410
+ name: string;
2411
+ /**
2412
+ * The paywall.
2413
+ */
2414
+ paywall_id: string;
2415
+ /**
2416
+ * The schema it is written in.
2417
+ */
2418
+ schema: number;
2419
+ /**
2420
+ * The version published.
2421
+ */
2422
+ version: number;
2423
+ };
2424
+ /**
2425
+ * The button that buys the selected package — or its own package —: the store's sheet (StoreKit) or checkout (Stripe) opens.
2426
+ */
2427
+ export type PaywallPurchaseButton = {
2428
+ animation?: PaywallAnimation;
2429
+ content: PaywallComponent;
2430
+ /**
2431
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2432
+ */
2433
+ id?: string;
2434
+ /**
2435
+ * Package.
2436
+ */
2437
+ package?: string;
2438
+ states?: PaywallStates;
2439
+ style?: PaywallStyle;
2440
+ /**
2441
+ * The component.
2442
+ */
2443
+ type: "purchase_button";
2444
+ visible?: PaywallCondition;
2445
+ };
2446
+ /**
2447
+ * A radial gradient: its center and radius as shares of the component, and 2 to 8 stops.
2448
+ */
2449
+ export type PaywallRadial = {
2450
+ /**
2451
+ * Center x.
2452
+ */
2453
+ center_x?: number;
2454
+ /**
2455
+ * Center y.
2456
+ */
2457
+ center_y?: number;
2458
+ /**
2459
+ * Radius.
2460
+ */
2461
+ radius?: number;
2462
+ /**
2463
+ * Stops.
2464
+ */
2465
+ stops: PaywallStop[];
2466
+ /**
2467
+ * Type.
2468
+ */
2469
+ type: "radial";
2470
+ };
2471
+ /**
2472
+ * A definition to save as a paywall's draft.
2473
+ */
2474
+ export type PaywallRequest = {
2475
+ definition: PaywallDefinition;
2476
+ };
2477
+ /**
2478
+ * Points by token (lowercase letters, digits and _, at most 32).
2479
+ */
2480
+ export type PaywallScale = {
2481
+ [key: string]: number;
2482
+ };
2483
+ /**
2484
+ * The error envelope of an app whose SDK draws no paywall schema this server takes (`paywall_schema_too_old`): it draws its own paywall, and updating the SDK shows the project's.
2485
+ */
2486
+ export type PaywallSchemaError = {
2487
+ /**
2488
+ * Machine-readable error code (snake_case)
2489
+ */
2490
+ error: string;
2491
+ /**
2492
+ * Human-readable explanation
2493
+ */
2494
+ error_description: string;
2495
+ /**
2496
+ * The oldest schema an SDK must draw to be given this project's paywalls.
2497
+ */
2498
+ min_schema: number;
2499
+ /**
2500
+ * Correlation ID for log/audit lookup
2501
+ */
2502
+ request_id: string;
2503
+ /**
2504
+ * HTTP status code (mirrors the response status)
2505
+ */
2506
+ status: number;
2507
+ };
2508
+ /**
2509
+ * A shadow.
2510
+ */
2511
+ export type PaywallShadow = {
2512
+ /**
2513
+ * Color.
2514
+ */
2515
+ color: string;
2516
+ /**
2517
+ * Radius.
2518
+ */
2519
+ radius?: number;
2520
+ /**
2521
+ * X.
2522
+ */
2523
+ x?: number;
2524
+ /**
2525
+ * Y.
2526
+ */
2527
+ y?: number;
2528
+ };
2529
+ /**
2530
+ * A second page a button opens over the paywall.
2531
+ */
2532
+ export type PaywallSheet = {
2533
+ root: PaywallComponent;
2534
+ title?: PaywallString;
2535
+ };
2536
+ /**
2537
+ * The sheets by id (lowercase letters, digits, _ and -, starting with a letter).
2538
+ */
2539
+ export type PaywallSheets = {
2540
+ [key: string]: PaywallSheet;
2541
+ };
2542
+ /**
2543
+ * fit: the content's size; fill: all the parent gives; a share of the parent ("50%").
2544
+ */
2545
+ export type PaywallSizeKeyword = string;
2546
+ /**
2547
+ * Space: a fixed size, or all that is left along its stack when absent.
2548
+ */
2549
+ export type PaywallSpacer = {
2550
+ animation?: PaywallAnimation;
2551
+ /**
2552
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2553
+ */
2554
+ id?: string;
2555
+ /**
2556
+ * Size.
2557
+ */
2558
+ size?: PaywallPoints | PaywallToken;
2559
+ states?: PaywallStates;
2560
+ style?: PaywallStyle;
2561
+ /**
2562
+ * The component.
2563
+ */
2564
+ type: "spacer";
2565
+ visible?: PaywallCondition;
2566
+ };
2567
+ /**
2568
+ * A part of a text: bold, italic, underlined, struck through, colored, a link.
2569
+ */
2570
+ export type PaywallSpan = {
2571
+ /**
2572
+ * Bold.
2573
+ */
2574
+ bold?: boolean;
2575
+ /**
2576
+ * Color.
2577
+ */
2578
+ color?: string;
2579
+ /**
2580
+ * Italic.
2581
+ */
2582
+ italic?: boolean;
2583
+ /**
2584
+ * Link.
2585
+ */
2586
+ link?: string;
2587
+ /**
2588
+ * Strikethrough.
2589
+ */
2590
+ strikethrough?: boolean;
2591
+ text: PaywallString;
2592
+ /**
2593
+ * Underline.
2594
+ */
2595
+ underline?: boolean;
2596
+ };
2597
+ /**
2598
+ * Components laid out one after another — down, across — or over each other (z). The root, the header and the footer are each one; the root scrolls between the fixed header and footer.
2599
+ */
2600
+ export type PaywallStack = {
2601
+ /**
2602
+ * Align.
2603
+ */
2604
+ align?: "start" | "center" | "end" | "stretch";
2605
+ animation?: PaywallAnimation;
2606
+ /**
2607
+ * Axis.
2608
+ */
2609
+ axis?: "vertical" | "horizontal" | "z";
2610
+ /**
2611
+ * The components.
2612
+ */
2613
+ children?: PaywallComponent[];
2614
+ /**
2615
+ * Distribution.
2616
+ */
2617
+ distribution?: "start" | "center" | "end" | "space_between" | "space_around" | "space_evenly";
2618
+ /**
2619
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2620
+ */
2621
+ id?: string;
2622
+ /**
2623
+ * Scroll.
2624
+ */
2625
+ scroll?: boolean;
2626
+ /**
2627
+ * Spacing.
2628
+ */
2629
+ spacing?: PaywallPoints | PaywallToken;
2630
+ states?: PaywallStates;
2631
+ style?: PaywallStyle;
2632
+ /**
2069
2633
  * The component.
2070
2634
  */
2071
2635
  type: "stack";
2636
+ visible?: PaywallCondition;
2637
+ };
2638
+ /**
2639
+ * The component's style while what it is in is selected: the package it is in (or is), the tab whose label it is.
2640
+ */
2641
+ export type PaywallStates = {
2642
+ selected?: PaywallStyle;
2643
+ };
2644
+ /**
2645
+ * A gradient's color at a point along it (0 to 1).
2646
+ */
2647
+ export type PaywallStop = {
2648
+ /**
2649
+ * At.
2650
+ */
2651
+ at: number;
2652
+ /**
2653
+ * Color.
2654
+ */
2655
+ color: string;
2072
2656
  };
2073
2657
  /**
2074
2658
  * 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.
2075
2659
  */
2076
2660
  export type PaywallString = PaywallLiteral | PaywallTextKey;
2661
+ /**
2662
+ * What every component takes: padding and margin by edge, a size, a fill, a border, corners each their own, a shadow, an opacity. Points and colors name the theme's tokens or are given as they are.
2663
+ */
2664
+ export type PaywallStyle = {
2665
+ /**
2666
+ * Background.
2667
+ */
2668
+ background?: PaywallColorValue | PaywallLinear | PaywallRadial | PaywallImageFill | PaywallVideoFill;
2669
+ border?: PaywallBorder;
2670
+ /**
2671
+ * Corners.
2672
+ */
2673
+ corners?: PaywallPoints | PaywallToken | PaywallCorners;
2674
+ /**
2675
+ * Height.
2676
+ */
2677
+ height?: PaywallSizeKeyword | PaywallLength;
2678
+ /**
2679
+ * Margin.
2680
+ */
2681
+ margin?: PaywallPoints | PaywallToken | PaywallEdges;
2682
+ /**
2683
+ * Max width.
2684
+ */
2685
+ max_width?: number;
2686
+ /**
2687
+ * Opacity.
2688
+ */
2689
+ opacity?: number;
2690
+ /**
2691
+ * Padding.
2692
+ */
2693
+ padding?: PaywallPoints | PaywallToken | PaywallEdges;
2694
+ shadow?: PaywallShadow;
2695
+ /**
2696
+ * Width.
2697
+ */
2698
+ width?: PaywallSizeKeyword | PaywallLength;
2699
+ };
2077
2700
  /**
2078
2701
  * A paywall in the project's list.
2079
2702
  */
@@ -2104,34 +2727,152 @@ export type PaywallSummary = {
2104
2727
  updated_at: string;
2105
2728
  };
2106
2729
  /**
2107
- * A text.
2730
+ * A switch between two contents — a yearly and a monthly offer —, each selecting its own package when it is shown.
2731
+ */
2732
+ export type PaywallSwitch = {
2733
+ animation?: PaywallAnimation;
2734
+ /**
2735
+ * Default.
2736
+ */
2737
+ default?: boolean;
2738
+ /**
2739
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2740
+ */
2741
+ id?: string;
2742
+ label?: PaywallString;
2743
+ off: PaywallComponent;
2744
+ /**
2745
+ * Off package.
2746
+ */
2747
+ off_package?: string;
2748
+ on: PaywallComponent;
2749
+ /**
2750
+ * On package.
2751
+ */
2752
+ on_package?: string;
2753
+ states?: PaywallStates;
2754
+ style?: PaywallStyle;
2755
+ /**
2756
+ * Tint.
2757
+ */
2758
+ tint?: string;
2759
+ /**
2760
+ * The component.
2761
+ */
2762
+ type: "switch";
2763
+ visible?: PaywallCondition;
2764
+ };
2765
+ /**
2766
+ * A tab: its label, its content, and the package it selects when it is shown.
2767
+ */
2768
+ export type PaywallTab = {
2769
+ content: PaywallComponent;
2770
+ /**
2771
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2772
+ */
2773
+ id: string;
2774
+ label: PaywallComponent;
2775
+ /**
2776
+ * Package.
2777
+ */
2778
+ package?: string;
2779
+ };
2780
+ /**
2781
+ * Tabs, each its own content and default package; the labels, in a bar, are components whose style when selected is the shown tab's.
2782
+ */
2783
+ export type PaywallTabs = {
2784
+ animation?: PaywallAnimation;
2785
+ bar?: PaywallStyle;
2786
+ /**
2787
+ * Default.
2788
+ */
2789
+ default?: string;
2790
+ /**
2791
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2792
+ */
2793
+ id?: string;
2794
+ states?: PaywallStates;
2795
+ style?: PaywallStyle;
2796
+ /**
2797
+ * Tabs.
2798
+ */
2799
+ tabs: PaywallTab[];
2800
+ /**
2801
+ * The component.
2802
+ */
2803
+ type: "tabs";
2804
+ visible?: PaywallCondition;
2805
+ };
2806
+ /**
2807
+ * What a countdown counts to: an instant (at), or a time from the moment the paywall opened (after_open_seconds) — one of them.
2808
+ */
2809
+ export type PaywallTarget = {
2810
+ /**
2811
+ * After open seconds.
2812
+ */
2813
+ after_open_seconds?: number;
2814
+ /**
2815
+ * At.
2816
+ */
2817
+ at?: string;
2818
+ };
2819
+ /**
2820
+ * A text: one string, or spans — bold, italic, colored parts and links —, in a type style of the theme or its own.
2108
2821
  */
2109
2822
  export type PaywallText = {
2110
2823
  /**
2111
- * Its alignment.
2824
+ * Align.
2112
2825
  */
2113
2826
  align?: "start" | "center" | "end";
2827
+ animation?: PaywallAnimation;
2114
2828
  /**
2115
- * Its color. A color of the theme (background, surface, text, muted, accent, on_accent, badge) — the light or the dark palette's, as the app appears —, or #RRGGBB / #RRGGBBAA in both.
2829
+ * Color.
2116
2830
  */
2117
- color?: string;
2831
+ color?: PaywallColorValue | PaywallLinear | PaywallRadial;
2832
+ /**
2833
+ * Font.
2834
+ */
2835
+ font?: string;
2118
2836
  /**
2119
2837
  * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2120
2838
  */
2121
2839
  id?: string;
2122
2840
  /**
2123
- * The platform's text style, scaled with the reader's text size.
2841
+ * Letter spacing.
2124
2842
  */
2125
- style?: "large_title" | "title" | "headline" | "body" | "callout" | "caption" | "footnote";
2126
- text: PaywallString;
2843
+ letter_spacing?: number;
2844
+ /**
2845
+ * Line height.
2846
+ */
2847
+ line_height?: number;
2848
+ /**
2849
+ * Max lines.
2850
+ */
2851
+ max_lines?: number;
2852
+ /**
2853
+ * Size.
2854
+ */
2855
+ size?: PaywallFontSize | PaywallToken;
2856
+ /**
2857
+ * Spans.
2858
+ */
2859
+ spans?: PaywallSpan[];
2860
+ states?: PaywallStates;
2861
+ style?: PaywallStyle;
2862
+ text?: PaywallString;
2127
2863
  /**
2128
2864
  * The component.
2129
2865
  */
2130
2866
  type: "text";
2131
2867
  /**
2132
- * Its weight; the style's own when absent.
2868
+ * Uppercase.
2869
+ */
2870
+ uppercase?: boolean;
2871
+ visible?: PaywallCondition;
2872
+ /**
2873
+ * Weight.
2133
2874
  */
2134
- weight?: "regular" | "medium" | "semibold" | "bold";
2875
+ weight?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
2135
2876
  };
2136
2877
  /**
2137
2878
  * A text of the language table.
@@ -2149,19 +2890,105 @@ export type PaywallTexts = {
2149
2890
  [key: string]: string;
2150
2891
  };
2151
2892
  /**
2152
- * The paywall's colors in light and dark appearance, its corner radius and its type family.
2893
+ * The paywall's design system: colors for light and dark, a type scale, radii and spacing; the components name them.
2153
2894
  */
2154
2895
  export type PaywallTheme = {
2155
- dark: PaywallPalette;
2896
+ colors: PaywallColors;
2897
+ radii?: PaywallScale;
2898
+ spacing?: PaywallScale;
2899
+ typography?: PaywallTypeScale;
2900
+ };
2901
+ /**
2902
+ * Steps in time — a trial's today, its reminder, its first charge —, each with an icon, joined by a line.
2903
+ */
2904
+ export type PaywallTimeline = {
2905
+ animation?: PaywallAnimation;
2156
2906
  /**
2157
- * The type family: the platform's system font, its rounded or its serif design.
2907
+ * Color.
2158
2908
  */
2159
- font?: "system" | "rounded" | "serif";
2160
- light: PaywallPalette;
2909
+ color?: string;
2161
2910
  /**
2162
- * The corner radius of cards, buttons and the packages, in points.
2911
+ * Icon color.
2163
2912
  */
2164
- radius?: number;
2913
+ icon_color?: string;
2914
+ /**
2915
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
2916
+ */
2917
+ id?: string;
2918
+ /**
2919
+ * Items.
2920
+ */
2921
+ items: PaywallTimelineItem[];
2922
+ /**
2923
+ * Line color.
2924
+ */
2925
+ line_color?: string;
2926
+ /**
2927
+ * Line width.
2928
+ */
2929
+ line_width?: number;
2930
+ /**
2931
+ * Spacing.
2932
+ */
2933
+ spacing?: number;
2934
+ states?: PaywallStates;
2935
+ style?: PaywallStyle;
2936
+ /**
2937
+ * The component.
2938
+ */
2939
+ type: "timeline";
2940
+ visible?: PaywallCondition;
2941
+ };
2942
+ /**
2943
+ * A step of a timeline.
2944
+ */
2945
+ export type PaywallTimelineItem = {
2946
+ /**
2947
+ * Color.
2948
+ */
2949
+ color?: string;
2950
+ icon: PaywallIconName;
2951
+ text?: PaywallString;
2952
+ title: PaywallString;
2953
+ };
2954
+ /**
2955
+ * A token of the theme's scale.
2956
+ */
2957
+ export type PaywallToken = string;
2958
+ /**
2959
+ * Type styles by token (lowercase letters, digits and _, at most 32).
2960
+ */
2961
+ export type PaywallTypeScale = {
2962
+ [key: string]: PaywallTypography;
2963
+ };
2964
+ /**
2965
+ * A type style of the theme: what a text whose size names it is drawn in. It scales with its text style (Dynamic Type on iOS, the root font size on the web).
2966
+ */
2967
+ export type PaywallTypography = {
2968
+ /**
2969
+ * Font.
2970
+ */
2971
+ font?: string;
2972
+ /**
2973
+ * Letter spacing.
2974
+ */
2975
+ letter_spacing?: number;
2976
+ /**
2977
+ * Line height.
2978
+ */
2979
+ line_height?: number;
2980
+ /**
2981
+ * Size.
2982
+ */
2983
+ size: number;
2984
+ /**
2985
+ * Text style.
2986
+ */
2987
+ text_style?: "large_title" | "title" | "title2" | "title3" | "headline" | "body" | "callout" | "subheadline" | "footnote" | "caption";
2988
+ /**
2989
+ * Weight.
2990
+ */
2991
+ weight?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
2165
2992
  };
2166
2993
  /**
2167
2994
  * A definition that passes, and what is left to say of it.
@@ -2190,33 +3017,104 @@ export type PaywallVersion = {
2190
3017
  */
2191
3018
  published_by: string;
2192
3019
  /**
2193
- * The schema it is written in.
3020
+ * The schema it is written in.
3021
+ */
3022
+ schema: number;
3023
+ /**
3024
+ * The version: 1, 2, …
3025
+ */
3026
+ version: number;
3027
+ };
3028
+ /**
3029
+ * A page of a paywall's versions, newest first, without their definitions.
3030
+ */
3031
+ export type PaywallVersions = {
3032
+ /**
3033
+ * The next page's cursor; absent on the last.
3034
+ */
3035
+ next_cursor?: string;
3036
+ /**
3037
+ * The versions.
3038
+ */
3039
+ versions: PaywallVersion[];
3040
+ };
3041
+ /**
3042
+ * A video the app downloads before it shows the paywall; muted and looping unless it says otherwise.
3043
+ */
3044
+ export type PaywallVideo = {
3045
+ alt?: PaywallString;
3046
+ animation?: PaywallAnimation;
3047
+ /**
3048
+ * Aspect.
3049
+ */
3050
+ aspect?: number;
3051
+ /**
3052
+ * Autoplay.
3053
+ */
3054
+ autoplay?: boolean;
3055
+ /**
3056
+ * Controls.
3057
+ */
3058
+ controls?: boolean;
3059
+ /**
3060
+ * Fit.
3061
+ */
3062
+ fit?: "fit" | "fill";
3063
+ /**
3064
+ * Names the component, unique in the paywall: an app's code can draw its own part in its place.
3065
+ */
3066
+ id?: string;
3067
+ /**
3068
+ * Loop.
3069
+ */
3070
+ loop?: boolean;
3071
+ /**
3072
+ * Mute.
3073
+ */
3074
+ mute?: boolean;
3075
+ /**
3076
+ * Poster.
3077
+ */
3078
+ poster?: string;
3079
+ /**
3080
+ * Src.
2194
3081
  */
2195
- schema: number;
3082
+ src: string;
3083
+ states?: PaywallStates;
3084
+ style?: PaywallStyle;
2196
3085
  /**
2197
- * The version: 1, 2, …
3086
+ * The component.
2198
3087
  */
2199
- version: number;
3088
+ type: "video";
3089
+ visible?: PaywallCondition;
2200
3090
  };
2201
3091
  /**
2202
- * A page of a paywall's versions, newest first, without their definitions.
3092
+ * A muted video behind the component.
2203
3093
  */
2204
- export type PaywallVersions = {
3094
+ export type PaywallVideoFill = {
2205
3095
  /**
2206
- * The next page's cursor; absent on the last.
3096
+ * Loop.
2207
3097
  */
2208
- next_cursor?: string;
3098
+ loop?: boolean;
2209
3099
  /**
2210
- * The versions.
3100
+ * Poster.
2211
3101
  */
2212
- versions: PaywallVersion[];
3102
+ poster?: string;
3103
+ /**
3104
+ * Src.
3105
+ */
3106
+ src: string;
3107
+ /**
3108
+ * Type.
3109
+ */
3110
+ type: "video";
2213
3111
  };
2214
3112
  /**
2215
- * A place in an app a paywall is shown, as the app names it: the paywall it shows, or the experiment running on it.
3113
+ * A place in an app a paywall is shown, as the app names it: its default paywall, the experiment running on it for everyone there, and how many rules it has.
2216
3114
  */
2217
3115
  export type Placement = {
2218
3116
  /**
2219
- * The experiment running on it.
3117
+ * The experiment running on it for everyone there (audience placement).
2220
3118
  */
2221
3119
  experiment_id?: string;
2222
3120
  /**
@@ -2224,9 +3122,13 @@ export type Placement = {
2224
3122
  */
2225
3123
  key: string;
2226
3124
  /**
2227
- * The paywall it shows; absent while an experiment runs on it.
3125
+ * Its default paywall: what it shows whoever none of its rules holds for. Absent while an experiment for everyone runs on a placement that had none.
2228
3126
  */
2229
3127
  paywall_id?: string;
3128
+ /**
3129
+ * How many rules it has (GET …/rules reads them).
3130
+ */
3131
+ rule_count: number;
2230
3132
  /**
2231
3133
  * When it was last given a paywall or an experiment.
2232
3134
  */
@@ -2237,9 +3139,13 @@ export type Placement = {
2237
3139
  updated_by: string;
2238
3140
  };
2239
3141
  /**
2240
- * What an app draws at a placement: the paywall's newest version written in a schema the app draws, the subject's variant when an experiment runs there, and the store ids of what it sells — the app takes each price from its store (StoreKit, Stripe) and fills the variables with it.
3142
+ * What an app draws at a placement: the paywall's newest version written in a schema the app draws, where it came from (the experiment running for the whole placement, a rule, the placement's default) and the rule, the subject's variant when it is in an experiment, and the store ids of what it sells — the app takes each price from its store (StoreKit, Stripe) and fills the variables with it.
2241
3143
  */
2242
3144
  export type PlacementPaywall = {
3145
+ /**
3146
+ * The project's assets the definition names (asset:<id>), each once: the app downloads them when it gets the paywall — before it shows it —, checks each one's SHA-256 and size, and draws an asset only from its checked download. One it could not get, or whose bytes are not these, it does without: an image is not drawn, a font is the system's, a video is its poster or the background's color, an HTML block is not drawn.
3147
+ */
3148
+ assets: PaywallAssetRef[];
2243
3149
  definition: PaywallDefinition;
2244
3150
  offerings: Offerings;
2245
3151
  /**
@@ -2250,12 +3156,20 @@ export type PlacementPaywall = {
2250
3156
  * The placement.
2251
3157
  */
2252
3158
  placement: string;
3159
+ /**
3160
+ * The rule that decided, when one did: report it with the exposure.
3161
+ */
3162
+ rule_id?: string;
2253
3163
  /**
2254
3164
  * The schema the definition is written in: at most the one the app said it draws.
2255
3165
  */
2256
3166
  schema: number;
2257
3167
  /**
2258
- * The subject's variant when an experiment runs on the placement; report it with the exposure. The same subject gets the same one every time.
3168
+ * Where it came from: experiment (the one running for the whole placement), rule, or default.
3169
+ */
3170
+ source: "experiment" | "rule" | "default";
3171
+ /**
3172
+ * The subject's variant when it is in an experiment; report it with the exposure. The same subject gets the same one every time.
2259
3173
  */
2260
3174
  variant?: string;
2261
3175
  /**
@@ -2263,6 +3177,36 @@ export type PlacementPaywall = {
2263
3177
  */
2264
3178
  version: number;
2265
3179
  };
3180
+ /**
3181
+ * What the placement shows the viewer at the moment, where it came from, and what each rule came to.
3182
+ */
3183
+ export type PlacementPreview = {
3184
+ /**
3185
+ * The moment.
3186
+ */
3187
+ at: string;
3188
+ /**
3189
+ * The experiment the viewer is in.
3190
+ */
3191
+ experiment_id?: string;
3192
+ /**
3193
+ * The paywall shown.
3194
+ */
3195
+ paywall_id?: string;
3196
+ /**
3197
+ * The rule that decided.
3198
+ */
3199
+ rule_id?: string;
3200
+ /**
3201
+ * experiment (the one running for the whole placement), rule, default, or none (nothing: the app draws its own).
3202
+ */
3203
+ source: "experiment" | "rule" | "default" | "none";
3204
+ steps: RuleStep[];
3205
+ /**
3206
+ * The viewer's variant.
3207
+ */
3208
+ variant?: string;
3209
+ };
2266
3210
  /**
2267
3211
  * The paywall a placement shows.
2268
3212
  */
@@ -2272,6 +3216,60 @@ export type PlacementRequest = {
2272
3216
  */
2273
3217
  paywall_id: string;
2274
3218
  };
3219
+ /**
3220
+ * One of a placement's rules: when all its conditions hold for a viewer — none holds for everyone —, it shows its target.
3221
+ */
3222
+ export type PlacementRule = {
3223
+ /**
3224
+ * At most 10, all of which must hold.
3225
+ */
3226
+ conditions?: RuleCondition[];
3227
+ /**
3228
+ * When it stops being in effect (UTC).
3229
+ */
3230
+ ends_at?: string;
3231
+ /**
3232
+ * The rule's id: kept across edits, named by the answers and the exposures. None for a new rule; one is given.
3233
+ */
3234
+ id?: string;
3235
+ /**
3236
+ * Its name (1 to 100 characters).
3237
+ */
3238
+ name: string;
3239
+ /**
3240
+ * When a scheduled rule starts being in effect (UTC).
3241
+ */
3242
+ starts_at?: string;
3243
+ /**
3244
+ * live: in effect now (until ends_at); scheduled: in effect from starts_at (until ends_at); inactive: not in effect.
3245
+ */
3246
+ state: "live" | "scheduled" | "inactive";
3247
+ /**
3248
+ * What it is now (answers say it; a request's is not read): in_effect, pending (scheduled, not started), ended, inactive.
3249
+ */
3250
+ status?: "in_effect" | "pending" | "ended" | "inactive";
3251
+ target: RuleTarget;
3252
+ };
3253
+ /**
3254
+ * A placement's rules, in the order they are read: the first in effect that holds for a viewer wins.
3255
+ */
3256
+ export type PlacementRules = {
3257
+ /**
3258
+ * The placement.
3259
+ */
3260
+ placement: string;
3261
+ /**
3262
+ * Their revision, also their ETag: send it back as If-Match.
3263
+ */
3264
+ revision: number;
3265
+ rules: PlacementRule[];
3266
+ };
3267
+ /**
3268
+ * A placement's rules, all of them, in the order they are to be read (at most 50).
3269
+ */
3270
+ export type PlacementRulesRequest = {
3271
+ rules: PlacementRule[];
3272
+ };
2275
3273
  /**
2276
3274
  * The project's placements (at most 200), by key.
2277
3275
  */
@@ -2362,6 +3360,75 @@ export type PortalSession = {
2362
3360
  */
2363
3361
  url: string;
2364
3362
  };
3363
+ /**
3364
+ * A viewer to try: what its app would send, and who it is. user_id's entitlements and first seen are read from the project, unless entitlements and first_seen_days are given; user_id, else installation_id, is the subject an experiment's variant is drawn for.
3365
+ */
3366
+ export type PreviewContext = {
3367
+ /**
3368
+ * The registered app (X-Palbase-App).
3369
+ */
3370
+ app?: string;
3371
+ /**
3372
+ * The app's version (X-Palbase-Client-Version).
3373
+ */
3374
+ app_version?: string;
3375
+ /**
3376
+ * What the app says of the viewer (X-Palbase-Attributes): at most 20 keys, 2 KiB, strings, numbers, booleans.
3377
+ */
3378
+ attributes?: {
3379
+ [key: string]: unknown;
3380
+ };
3381
+ /**
3382
+ * The country (X-Palbase-Storefront, else the address's): ISO 3166-1 alpha-2 or alpha-3.
3383
+ */
3384
+ country?: string;
3385
+ /**
3386
+ * The viewer's active entitlements, instead of user_id's.
3387
+ */
3388
+ entitlements?: string[];
3389
+ /**
3390
+ * Whole days since the viewer was first seen, instead of user_id's.
3391
+ */
3392
+ first_seen_days?: number;
3393
+ /**
3394
+ * The installation (X-Palbase-Installation).
3395
+ */
3396
+ installation_id?: string;
3397
+ /**
3398
+ * The locale, a BCP 47 tag (Accept-Language).
3399
+ */
3400
+ locale?: string;
3401
+ /**
3402
+ * ios, android or web (X-Platform).
3403
+ */
3404
+ platform?: string;
3405
+ /**
3406
+ * The SDK's name (X-Palbase-SDK's), with sdk_version.
3407
+ */
3408
+ sdk?: string;
3409
+ /**
3410
+ * The SDK's version, with sdk.
3411
+ */
3412
+ sdk_version?: string;
3413
+ /**
3414
+ * The signed-in user.
3415
+ */
3416
+ user_id?: string;
3417
+ };
3418
+ /**
3419
+ * What to try: a viewer, a moment (now when none), and the rules being edited (the saved ones when none).
3420
+ */
3421
+ export type PreviewRequest = {
3422
+ /**
3423
+ * The moment (UTC): a scheduled rule's start, an end.
3424
+ */
3425
+ at?: string;
3426
+ context: PreviewContext;
3427
+ /**
3428
+ * Rules not yet saved, to try instead of the placement's.
3429
+ */
3430
+ rules?: PlacementRule[];
3431
+ };
2365
3432
  /**
2366
3433
  * The one price entered: each store prices the other currencies its own way (Apple's price points, Google's conversion, Stripe's), except those set by hand.
2367
3434
  */
@@ -2696,6 +3763,159 @@ export type Revenue = {
2696
3763
  */
2697
3764
  currency: string;
2698
3765
  };
3766
+ /**
3767
+ * One thing a rule asks of a viewer. `field` is what it reads, `op` how:
3768
+ * - `country` (`in`, `not_in`; `values` ISO 3166-1 alpha-2, alpha-3 read as alpha-2): the store's country the app sends (X-Palbase-Storefront), else the country of the request's address.
3769
+ * - `platform` (`in`, `not_in`; `values` ios, android, web): X-Platform, else `?channel=`.
3770
+ * - `app` (`in`, `not_in`; `values` registered apps' ids): X-Palbase-App.
3771
+ * - `app_version` (`eq`, `neq`, `gt`, `gte`, `lt`, `lte`; `value` a version string): X-Palbase-Client-Version, compared as Semantic Versioning orders versions (2.1 is 2.1.0; a pre-release before its release).
3772
+ * - `sdk_version` (the same operators; `sdk` the SDK's name, `value` a version): X-Palbase-SDK — a viewer on another SDK does not meet it.
3773
+ * - `locale` (`in`, `not_in`; `values` BCP 47 tags): the first tag of Accept-Language; tr covers tr-TR, en-GB covers en-GB alone.
3774
+ * - `entitlement` (`has`: any of `values`; `lacks`: none of them; the catalog's entitlement keys): the server's — the signed-in user's active entitlements; a viewer without a customer has none.
3775
+ * - `first_seen_days` (`gt`, `gte`, `lt`, `lte`; `value` whole days, 0 to 3650): the server's — whole days since the user was first seen here.
3776
+ * - `attribute` (`key`; `in`, `not_in` with `values`, `exists`, `not_exists`, `gt`, `gte`, `lt`, `lte` with a number `value`): X-Palbase-Attributes, what the app says of the viewer — targeting only.
3777
+ * A value the request does not carry meets no condition on it, `not_in` neither (`not_exists` aside).
3778
+ * Targeting picks what to show; it is not access control: the storefront, the attributes and the versions are what the client says of itself — no price or region entitlement may hang on them.
3779
+ */
3780
+ export type RuleCondition = {
3781
+ /**
3782
+ * What it reads.
3783
+ */
3784
+ field: "country" | "platform" | "app" | "app_version" | "sdk_version" | "locale" | "entitlement" | "first_seen_days" | "attribute";
3785
+ /**
3786
+ * The attribute's key (an attribute condition's alone).
3787
+ */
3788
+ key?: string;
3789
+ /**
3790
+ * How.
3791
+ */
3792
+ op: "in" | "not_in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "has" | "lacks" | "exists" | "not_exists";
3793
+ /**
3794
+ * The SDK the version is of, as X-Palbase-SDK names it (an sdk_version condition's alone).
3795
+ */
3796
+ sdk?: string;
3797
+ /**
3798
+ * An order's operand: a version (app_version, sdk_version), a number (first_seen_days, an attribute).
3799
+ */
3800
+ value?: RuleVersion | RuleNumber;
3801
+ /**
3802
+ * A set's members (1 to 50), or the entitlements of has and lacks.
3803
+ */
3804
+ values?: string[];
3805
+ };
3806
+ /**
3807
+ * What one condition came to.
3808
+ */
3809
+ export type RuleConditionResult = {
3810
+ /**
3811
+ * What it reads.
3812
+ */
3813
+ field: string;
3814
+ /**
3815
+ * Its place in the rule's conditions.
3816
+ */
3817
+ index: number;
3818
+ /**
3819
+ * Whether it holds.
3820
+ */
3821
+ met: boolean;
3822
+ /**
3823
+ * The viewer carries no value for it (so it does not hold).
3824
+ */
3825
+ unknown?: boolean;
3826
+ };
3827
+ /**
3828
+ * A number, as first_seen_days (whole days) and an attribute's order compare it.
3829
+ */
3830
+ export type RuleNumber = number;
3831
+ /**
3832
+ * One thing wrong with a placement's rules.
3833
+ */
3834
+ export type RuleProblem = {
3835
+ /**
3836
+ * What it is (invalid_rule_name, invalid_state, invalid_schedule, invalid_target, unknown_field, invalid_op, invalid_value, invalid_values, too_many_rules, too_many_conditions, duplicate_rule_id, unknown_paywall, unpublished_paywall, experiment_not_targetable …).
3837
+ */
3838
+ code: string;
3839
+ /**
3840
+ * What to do about it.
3841
+ */
3842
+ message: string;
3843
+ /**
3844
+ * Where it is (rules[1].conditions[0].values[2]).
3845
+ */
3846
+ path: string;
3847
+ };
3848
+ /**
3849
+ * What one rule came to for the viewer.
3850
+ */
3851
+ export type RuleStep = {
3852
+ /**
3853
+ * Each condition's, when the rule was in effect and its target could be shown.
3854
+ */
3855
+ conditions?: RuleConditionResult[];
3856
+ /**
3857
+ * The rule's name.
3858
+ */
3859
+ name: string;
3860
+ /**
3861
+ * matched (it decided); unmet (not in effect, or a condition does not hold); unavailable (its experiment no longer runs); not_reached (decided before it).
3862
+ */
3863
+ outcome: "matched" | "unmet" | "unavailable" | "not_reached";
3864
+ /**
3865
+ * The rule.
3866
+ */
3867
+ rule_id: string;
3868
+ /**
3869
+ * What it is at the moment: in_effect, pending, ended, inactive.
3870
+ */
3871
+ status: "in_effect" | "pending" | "ended" | "inactive";
3872
+ };
3873
+ /**
3874
+ * What a rule shows: a published paywall, or the variant of the experiment running on the placement for the rules (audience `rules`). Exactly one.
3875
+ */
3876
+ export type RuleTarget = {
3877
+ /**
3878
+ * The experiment: the viewer gets its variant, the same every time.
3879
+ */
3880
+ experiment_id?: string;
3881
+ /**
3882
+ * The paywall: published.
3883
+ */
3884
+ paywall_id?: string;
3885
+ };
3886
+ /**
3887
+ * A version, as app_version and sdk_version compare it: one to four numbers, a pre-release after - (2.1.0, 2.1, 3.0.0-beta.1).
3888
+ */
3889
+ export type RuleVersion = string;
3890
+ /**
3891
+ * The error envelope of refused rules, with every problem when they break a rule (`invalid_rules`).
3892
+ */
3893
+ export type RulesError = {
3894
+ /**
3895
+ * Machine-readable error code (snake_case)
3896
+ */
3897
+ error: string;
3898
+ /**
3899
+ * Human-readable explanation
3900
+ */
3901
+ error_description: string;
3902
+ /**
3903
+ * Every problem, by path: with `invalid_rules`, absent otherwise.
3904
+ */
3905
+ problems?: RuleProblem[];
3906
+ /**
3907
+ * Correlation ID for log/audit lookup
3908
+ */
3909
+ request_id: string;
3910
+ /**
3911
+ * Seconds to wait before retrying; present on a refusal that ends with time.
3912
+ */
3913
+ retry_after?: number;
3914
+ /**
3915
+ * HTTP status code (mirrors the response status)
3916
+ */
3917
+ status: number;
3918
+ };
2699
3919
  /**
2700
3920
  * The error envelope of a refused save, with every problem when the catalog breaks a rule (`invalid_catalog`).
2701
3921
  */
@@ -3172,9 +4392,13 @@ export type VariantResult = {
3172
4392
  weight: number;
3173
4393
  };
3174
4394
  /**
3175
- * The variant that won.
4395
+ * The variant that won, and how it is rolled out.
3176
4396
  */
3177
4397
  export type WinnerRequest = {
4398
+ /**
4399
+ * For an experiment for everyone at the placement: roll the winner out as a live rule at the top of the placement's rules (for everyone, to narrow later) and keep the placement's default; otherwise the winner becomes the default.
4400
+ */
4401
+ as_rule?: boolean;
3178
4402
  /**
3179
4403
  * The variant's key.
3180
4404
  */
@@ -3723,7 +4947,7 @@ export declare function client(t: Transport): {
3723
4947
  /**
3724
4948
  * Start an experiment
3725
4949
  *
3726
- * Starts an experiment on a placement, making the placement when it is new: from then on the placement shows each subject — the signed-in user (a guest included), else the installation — its variant's paywall, the same every time (a hash of the experiment and the subject, placed on the weights; nothing is stored). Every variant's paywall must be published (422 `invalid_experiment`); one experiment runs on a placement at a time (409 `experiment_running`).
4950
+ * Starts an experiment on a placement: from then on the placement shows each subject in its audience — the signed-in user (a guest included), else the installation — its variant's paywall, the same every time (a hash of the experiment and the subject, placed on the weights; nothing is stored). Every variant's paywall must be published (422 `invalid_experiment`); one experiment runs on a placement at a time (409 `experiment_running`). An experiment for the rules (audience `rules`) shows the viewers the placement's rules targeting it send it — the placement is one already (404 `placement_not_found`); one for everyone (audience `placement`, when none is named) is decided before the placement's rules, and the placement keeps its default for when it ends.
3727
4951
  */
3728
4952
  startExperiment(input: {
3729
4953
  headers?: {
@@ -3761,7 +4985,7 @@ export declare function client(t: Transport): {
3761
4985
  /**
3762
4986
  * Stop an experiment
3763
4987
  *
3764
- * Stops a running experiment: the placement shows its first variant's paywall to everyone. Its results stay.
4988
+ * Stops a running experiment, at once: what it showed becomes its first variant's paywall — the placement's default for an experiment for everyone there, the rules' target for one for the rules. Its results stay.
3765
4989
  */
3766
4990
  stopExperiment(input: {
3767
4991
  path: {
@@ -3775,7 +4999,7 @@ export declare function client(t: Transport): {
3775
4999
  /**
3776
5000
  * Declare an experiment's winner
3777
5001
  *
3778
- * Ends a running experiment with a winner: the placement shows the winner's paywall to everyone, at once. Its results stay.
5002
+ * Ends a running experiment with a winner, at once: for everyone at the placement, the winner's paywall becomes the placement's default — or, with `as_rule`, a live rule at the top of its rules shows it to everyone (to narrow later) and the default stays; for the rules, the rules that targeted the experiment show the winner's paywall. Its results stay.
3779
5003
  */
3780
5004
  declareExperimentWinner(input: {
3781
5005
  path: {
@@ -3843,6 +5067,40 @@ export declare function client(t: Transport): {
3843
5067
  body: PaywallRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3844
5068
  signal?: AbortSignal;
3845
5069
  }): Promise<Reply<201, Paywall>>;
5070
+ /**
5071
+ * List the paywall assets
5072
+ *
5073
+ * The project's paywall assets, newest first.
5074
+ */
5075
+ listPaywallAssets(input?: {
5076
+ signal?: AbortSignal;
5077
+ }): Promise<Reply<200, PaywallAssets>>;
5078
+ /**
5079
+ * Register a paywall asset
5080
+ *
5081
+ * Registers an object of the project's public bucket paywall-assets for its paywalls: Studio and the CLI upload it with the project's storage first (and make the bucket when it is missing), then register its path here. The module builds the object's address itself, from the project's own storage — never from an address it is given — and reads it there as every app will, saying what it is by its bytes, never by its name or the type it was stored with: an image (png, jpeg or webp, at most 2 MiB; never svg), a video (mp4 or mov, 50 MiB), a font (ttf, otf or woff2, 5 MiB), or an HTML block's zip (5 MiB; at most 200 files and 20 MiB opened, read to the end; index.html at its root; no file leaving the root, no link). It stops reading past the bound. It keeps the asset's SHA-256 and size: an app draws what it downloads only when it is that, and a paywall naming an asset whose object was since changed or removed is warned of in a draft and refused when published. A project has at most 500 assets.
5082
+ */
5083
+ registerPaywallAsset(input: {
5084
+ headers?: {
5085
+ "Idempotency-Key"?: string;
5086
+ };
5087
+ body: PaywallAssetRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5088
+ signal?: AbortSignal;
5089
+ }): Promise<Reply<201, PaywallAsset>>;
5090
+ /**
5091
+ * Delete a paywall asset
5092
+ *
5093
+ * Forgets an asset no paywall names — in a draft, or in any version kept (409 `asset_in_use`). The object stays in the project's storage.
5094
+ */
5095
+ deletePaywallAsset(input: {
5096
+ path: {
5097
+ asset_id: string;
5098
+ };
5099
+ headers?: {
5100
+ "Idempotency-Key"?: string;
5101
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5102
+ signal?: AbortSignal;
5103
+ }): Promise<Reply<204, undefined>>;
3846
5104
  /**
3847
5105
  * Check a paywall
3848
5106
  *
@@ -3899,7 +5157,7 @@ export declare function client(t: Transport): {
3899
5157
  /**
3900
5158
  * Publish a paywall
3901
5159
  *
3902
- * Publishes the paywall's draft as its next version, checked as the apps will get it: every package must be sold by the catalog (422 `invalid_paywall`, with every problem). If-Match names the draft revision that was looked at (412 `paywall_changed` when it moved since). The apps asking for a placement that shows the paywall get the new version at once — those whose SDK draws its schema. A draft the same as the newest version publishes nothing new (200). The newest 50 versions are kept, and the newest of each schema. Emits `purchases.paywall.published`.
5160
+ * Publishes the paywall's draft as its next version, checked as the apps will get it: every package must be sold by the catalog (422 `invalid_paywall`, with every problem). If-Match names the draft revision that was looked at (412 `paywall_changed` when it moved since). The apps asking for a placement that shows the paywall get the new version at once — those whose SDK draws its schema. A draft the same as the newest version publishes nothing new (200). The newest 50 versions are kept, and the newest of each schema. Emits `purchases.paywall.published`. Every asset the draft names is looked at in the project's storage: one no longer there (`asset_missing`) or no longer the bytes registered (`asset_changed`) refuses the publish.
3903
5161
  */
3904
5162
  publishPaywall(input: {
3905
5163
  path: {
@@ -3941,7 +5199,7 @@ export declare function client(t: Transport): {
3941
5199
  /**
3942
5200
  * List the placements
3943
5201
  *
3944
- * The project's placements, by key: the paywall each shows, or the experiment running on it.
5202
+ * The project's placements, by key: the default paywall each shows, the experiment running on it for everyone, how many rules it has.
3945
5203
  */
3946
5204
  listPlacements(input?: {
3947
5205
  signal?: AbortSignal;
@@ -3949,7 +5207,7 @@ export declare function client(t: Transport): {
3949
5207
  /**
3950
5208
  * Give a placement a paywall
3951
5209
  *
3952
- * Gives a placement a paywall, making the placement when it is new. The apps that ask for it get the paywall's newest version they can draw; a paywall never published is nothing yet (they get 204 and draw their own). While an experiment runs on the placement, the experiment decides (409 `experiment_running`). A project has at most 200 placements (409 `too_many_placements`).
5210
+ * Gives a placement its default paywall, making the placement when it is new: what it shows whoever none of its rules holds for. The apps that ask for it get the paywall's newest version they can draw; a paywall never published is nothing yet (they get 204 and draw their own). While an experiment runs for everyone at the placement, the experiment decides, and its end the default (409 `experiment_running`). A project has at most 200 placements (409 `too_many_placements`).
3953
5211
  */
3954
5212
  setPlacement(input: {
3955
5213
  path: {
@@ -3964,7 +5222,7 @@ export declare function client(t: Transport): {
3964
5222
  /**
3965
5223
  * Delete a placement
3966
5224
  *
3967
- * Forgets a placement: the apps that ask for it get nothing (404) and draw their own. Not while an experiment runs on it (409 `experiment_running`).
5225
+ * Forgets a placement and its rules: the apps that ask for it get nothing (404) and draw their own. Not while an experiment runs on it (409 `experiment_running`).
3968
5226
  */
3969
5227
  deletePlacement(input: {
3970
5228
  path: {
@@ -3978,7 +5236,7 @@ export declare function client(t: Transport): {
3978
5236
  /**
3979
5237
  * Report a paywall shown
3980
5238
  *
3981
- * Counts that the app showed a version of a paywall at a placement, to the signed-in user (a guest included) or else the installation (X-Palbase-Installation; 400 `installation_required` without either). It is counted for an experiment's variant when it is the subject's variant on the placement's running experiment; a copy the app kept from before is counted for the paywall alone. The same subject, paywall version and placement count once in ten minutes; in a project, one address (an IPv6 /64 is one) reports at most 60 a minute, and at most 20 a minute are taken for one subject (429 `too_many_exposures`, Retry-After); another project's are its own, and reading the placement's paywall is never limited by them. Purchases are never reported here: they are the ones the stores confirmed, read from the ledger.
5239
+ * Counts that the app showed a version of a paywall at a placement, to the signed-in user (a guest included) or else the installation (X-Palbase-Installation; 400 `installation_required` without either). `variant` and `rule_id` are what the answer named — claims, checked against the placement as it is: the rule is written when it is one of the placement's and shows the paywall reported (or sends to the experiment of the variant counted); the variant counts when its experiment runs for the whole placement, or the rule reported sends to it, and it is the subject's own variant there. A claim that does not hold leaves the exposure to the paywall alone — none is refused: what was shown before the viewer bought, before a schedule turned, before the rules were edited still counts. The same subject, paywall version and placement count once in ten minutes; in a project, one address (an IPv6 /64 is one) reports at most 60 a minute, and at most 20 a minute are taken for one subject (429 `too_many_exposures`, Retry-After); another project's are its own, and reading the placement's paywall is never limited by them. Purchases are never reported here: they are the ones the stores confirmed, read from the ledger.
3982
5240
  */
3983
5241
  recordPaywallExposure(input: {
3984
5242
  path: {
@@ -3993,7 +5251,7 @@ export declare function client(t: Transport): {
3993
5251
  /**
3994
5252
  * Read a placement's paywall
3995
5253
  *
3996
- * What an app draws at a placement. The app says the newest paywall schema its SDK draws (X-Palbase-Paywall-Schema; 1 when absent) and is given the newest version of the placement's paywall written in it or an older one: an app on an older SDK keeps getting the last version it can draw. When there is none — the paywall never published, or only in newer schemas — the answer is 204 and the app draws its own (from the offerings). While an experiment runs on the placement, the subject — the signed-in user (a guest included), else the installation (X-Palbase-Installation) — gets its variant, the same every time; without either the first variant is drawn, in no experiment. `offerings` are what the paywall sells, each channel's store ids (`?channel=` keeps one): the app prices them from its store. The ETag names the answer: sent back as If-None-Match, an unchanged one is 304. Any of the project's keys reads it, the publishable one included.
5254
+ * What an app draws at a placement. Who sees what: an experiment running for the whole placement decides first — the subject, the signed-in user (a guest included) else the installation (X-Palbase-Installation), gets its variant, the same every time; without either the first variant is drawn, in no experiment —; then the placement's rules, in order: the first in effect whose conditions all hold shows its paywall, or its experiment's variant; then the placement's default. The rules read what the app declares — X-Platform, X-Palbase-App, X-Palbase-Client-Version, X-Palbase-SDK, X-Palbase-Storefront, Accept-Language, X-Palbase-Attributes — and what the server knows: the user's entitlements, the days since the user was first seen, the request's address's country when no storefront is named. `source` and `rule_id` say which decided. Targeting picks what to show; it is not access control: the storefront, the attributes and the versions are what the client says of itself — no price or region entitlement may hang on them. The app says the newest paywall schema its SDK draws (X-Palbase-Paywall-Schema; this server's, 2, when absent) and is given the newest version of that paywall written in it or an older one: an app on an older SDK keeps getting the last version it can draw. When there is none — the paywall never published, or only in a newer schema — the answer is 204 and the app draws its own (from the offerings). An SDK that draws no schema this server takes (under 2) is told to update: 426 `paywall_schema_too_old`, and it draws its own. `offerings` are what the paywall sells, each channel's store ids (`?channel=` keeps one): the app prices them from its store. The ETag names the answer: sent back as If-None-Match, an unchanged one is 304. Any of the project's keys reads it, the publishable one included.
3997
5255
  */
3998
5256
  getPlacementPaywall(input: {
3999
5257
  path: {
@@ -4005,10 +5263,59 @@ export declare function client(t: Transport): {
4005
5263
  headers?: {
4006
5264
  "X-Palbase-Paywall-Schema"?: number; /** The installation's id, as the SDK keeps it: who the paywall is shown to before anyone signs in. A signed-in user (a guest included) is who it is shown to, the installation aside. */
4007
5265
  "X-Palbase-Installation"?: string; /** The ETag of the answer the app holds (a header over 1 KiB is not read). */
4008
- "If-None-Match"?: string;
5266
+ "If-None-Match"?: string; /** The app's platform: ios, android or web (a placement's platform rules read it; `?channel=` when absent). */
5267
+ "X-Platform"?: string; /** The app's version, as its users see it (CFBundleShortVersionString, versionName): app_version rules read it. */
5268
+ "X-Palbase-Client-Version"?: string; /** The registered app's id: app rules read it. */
5269
+ "X-Palbase-App"?: string; /** The SDK's name and version, name/version (palbase-swift/1.4.0): sdk_version rules read it. */
5270
+ "X-Palbase-SDK"?: string; /** The store's country — StoreKit's Storefront.countryCode, Play's billing country —, ISO 3166-1 alpha-2 or alpha-3: country rules read it, the request's address's country when absent. */
5271
+ "X-Palbase-Storefront"?: string; /** What the app says of the viewer, for attribute rules (targeting only): a JSON object of at most 20 keys (a letter, then letters, digits and _ . -, at most 40), values strings (at most 256), numbers or booleans; at most 2 KiB, non-ASCII escaped (\uXXXX). */
5272
+ "X-Palbase-Attributes"?: string; /** The app's languages: locale rules read the first. */
5273
+ "Accept-Language"?: string;
4009
5274
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4010
5275
  signal?: AbortSignal;
4011
5276
  }): Promise<Reply<200, PlacementPaywall> | Reply<204, undefined> | Reply<304, undefined>>;
5277
+ /**
5278
+ * Preview what a placement shows a viewer
5279
+ *
5280
+ * What the placement shows a viewer, and why: the experiment running for the whole placement, the rule that decided, or the default — with what every rule came to, condition by condition. The console's live preview: by the saved rules, or by rules being edited (`rules`), at a moment (`at`). Nothing is counted or changed.
5281
+ */
5282
+ previewPlacement(input: {
5283
+ path: {
5284
+ placement: string;
5285
+ };
5286
+ headers?: {
5287
+ "Idempotency-Key"?: string;
5288
+ };
5289
+ body: PreviewRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5290
+ signal?: AbortSignal;
5291
+ }): Promise<Reply<200, PlacementPreview>>;
5292
+ /**
5293
+ * Read a placement's rules
5294
+ *
5295
+ * A placement's rules, in the order they are read, each with what it is now (status). The ETag is their revision.
5296
+ */
5297
+ getPlacementRules(input: {
5298
+ path: {
5299
+ placement: string;
5300
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5301
+ signal?: AbortSignal;
5302
+ }): Promise<Reply<200, PlacementRules>>;
5303
+ /**
5304
+ * Replace a placement's rules
5305
+ *
5306
+ * Replaces a placement's rules, all of them, in the order they are to be read: the first in effect whose conditions all hold for a viewer shows its target — a published paywall, or the variant of the experiment running on the placement for the rules —, after an experiment running for the whole placement and before the placement's default. At most 50 rules of at most 10 conditions. If-Match names the revision they were edited from: of two people editing at once, the second is told (412 `rules_changed`), not overwritten. Targeting picks what to show; it is not access control: the storefront, the attributes and the versions are what the client says of itself — no price or region entitlement may hang on them.
5307
+ */
5308
+ setPlacementRules(input: {
5309
+ path: {
5310
+ placement: string;
5311
+ };
5312
+ headers: {
5313
+ "If-Match": string; /** Makes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours. */
5314
+ "Idempotency-Key"?: string;
5315
+ };
5316
+ body: PlacementRulesRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5317
+ signal?: AbortSignal;
5318
+ }): Promise<Reply<200, PlacementRules>>;
4012
5319
  /**
4013
5320
  * Read the settings
4014
5321
  *