palbase 0.1.0 → 0.2.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.
- package/dist/ai/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +3 -3
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{QXUMLO7O.js → 5W6XJM46.js} +2 -2
- package/dist/chunks/{JAWWIVZH.js → 6OPBXB7Z.js} +2 -2
- package/dist/chunks/{3OGEBGYZ.js → 7LOMYBLN.js} +2 -2
- package/dist/chunks/AN5LCF5K.js +55 -0
- package/dist/chunks/ECUYQ73P.js +2 -0
- package/dist/chunks/{DAOLIUNZ.js → HDX6YUAB.js} +1 -1
- package/dist/chunks/HVC2C35F.js +2 -0
- package/dist/chunks/{LYEFPLJZ.js → I3JNX6MZ.js} +1 -1
- package/dist/chunks/JEJ5CFTK.js +2 -0
- package/dist/chunks/{E5Q4VTW4.js → K3C2IEDS.js} +2 -2
- package/dist/chunks/{6FWCNTAM.js → KRBVYYME.js} +1 -1
- package/dist/chunks/{3VASGTIN.js → NIJHTHNF.js} +2 -2
- package/dist/chunks/{45J7YXRB.js → TL4H6V3P.js} +1 -1
- package/dist/chunks/{UAY56IQR.js → UTRQWCMD.js} +2 -2
- package/dist/chunks/ZFPDYRRY.js +2 -0
- package/dist/cli.js +72 -72
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -0
- package/dist/web/vite.js +2 -2
- package/package.json +6 -2
- package/types/internal/src/modules/events.d.ts +2 -2
- package/types/internal/src/modules/purchases.d.ts +1213 -44
- package/types/web/src/index.d.ts +2 -0
- package/types/web/src/paywall/icons.d.ts +5 -0
- package/types/web/src/paywall/index.d.ts +5 -0
- package/types/web/src/paywall/placement.d.ts +85 -0
- package/types/web/src/paywall/prices.d.ts +40 -0
- package/types/web/src/paywall/render.d.ts +54 -0
- package/types/web/src/paywall/resolve.d.ts +149 -0
- package/types/web/src/purchases.d.ts +13 -0
- package/dist/chunks/3XT4L2XV.js +0 -2
- package/dist/chunks/HKJU2FKE.js +0 -2
- package/dist/chunks/IKVOXHEE.js +0 -2
|
@@ -1087,6 +1087,152 @@ export type ErrorResponse = {
|
|
|
1087
1087
|
*/
|
|
1088
1088
|
status: number;
|
|
1089
1089
|
};
|
|
1090
|
+
/**
|
|
1091
|
+
* An experiment on a placement. Its variants never change while it runs, so no one's variant does.
|
|
1092
|
+
*/
|
|
1093
|
+
export type Experiment = {
|
|
1094
|
+
/**
|
|
1095
|
+
* When it ended.
|
|
1096
|
+
*/
|
|
1097
|
+
ended_at?: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* Who ended it.
|
|
1100
|
+
*/
|
|
1101
|
+
ended_by?: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* The experiment's id.
|
|
1104
|
+
*/
|
|
1105
|
+
id: string;
|
|
1106
|
+
/**
|
|
1107
|
+
* Its name.
|
|
1108
|
+
*/
|
|
1109
|
+
name: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* The placement it runs on.
|
|
1112
|
+
*/
|
|
1113
|
+
placement: string;
|
|
1114
|
+
/**
|
|
1115
|
+
* When it started.
|
|
1116
|
+
*/
|
|
1117
|
+
started_at: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* Who started it (the key).
|
|
1120
|
+
*/
|
|
1121
|
+
started_by: string;
|
|
1122
|
+
/**
|
|
1123
|
+
* running; stopped (the placement shows the first variant's paywall); won (the winner's).
|
|
1124
|
+
*/
|
|
1125
|
+
status: "running" | "stopped" | "won";
|
|
1126
|
+
/**
|
|
1127
|
+
* The variants, the first the one a stop keeps.
|
|
1128
|
+
*/
|
|
1129
|
+
variants: ExperimentVariant[];
|
|
1130
|
+
/**
|
|
1131
|
+
* The variant declared the winner.
|
|
1132
|
+
*/
|
|
1133
|
+
winner?: string;
|
|
1134
|
+
};
|
|
1135
|
+
/**
|
|
1136
|
+
* An experiment to start.
|
|
1137
|
+
*/
|
|
1138
|
+
export type ExperimentRequest = {
|
|
1139
|
+
/**
|
|
1140
|
+
* Its name (1 to 100 characters).
|
|
1141
|
+
*/
|
|
1142
|
+
name: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* The placement it runs on (made when new).
|
|
1145
|
+
*/
|
|
1146
|
+
placement: string;
|
|
1147
|
+
/**
|
|
1148
|
+
* 2 to 4 variants, each its own published paywall; the first is the one a stop keeps.
|
|
1149
|
+
*/
|
|
1150
|
+
variants: ExperimentVariant[];
|
|
1151
|
+
};
|
|
1152
|
+
/**
|
|
1153
|
+
* What each variant's audience did, and which leads.
|
|
1154
|
+
*/
|
|
1155
|
+
export type ExperimentResults = {
|
|
1156
|
+
/**
|
|
1157
|
+
* When the numbers were counted.
|
|
1158
|
+
*/
|
|
1159
|
+
computed_at: string;
|
|
1160
|
+
/**
|
|
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.
|
|
1162
|
+
*/
|
|
1163
|
+
confident: boolean;
|
|
1164
|
+
/**
|
|
1165
|
+
* The experiment.
|
|
1166
|
+
*/
|
|
1167
|
+
experiment_id: string;
|
|
1168
|
+
/**
|
|
1169
|
+
* The variant with the highest chance to win; absent before anyone saw one.
|
|
1170
|
+
*/
|
|
1171
|
+
leader?: string;
|
|
1172
|
+
/**
|
|
1173
|
+
* Whether the stores' test purchases count.
|
|
1174
|
+
*/
|
|
1175
|
+
sandbox: boolean;
|
|
1176
|
+
/**
|
|
1177
|
+
* The experiment's status.
|
|
1178
|
+
*/
|
|
1179
|
+
status: "running" | "stopped" | "won";
|
|
1180
|
+
/**
|
|
1181
|
+
* Each variant, in the experiment's order.
|
|
1182
|
+
*/
|
|
1183
|
+
variants: VariantResult[];
|
|
1184
|
+
/**
|
|
1185
|
+
* The days after first seeing a variant a purchase counts for it.
|
|
1186
|
+
*/
|
|
1187
|
+
window_days: number;
|
|
1188
|
+
};
|
|
1189
|
+
/**
|
|
1190
|
+
* A variant: a paywall shown to its share of the placement's audience — its weight over the variants' weights together.
|
|
1191
|
+
*/
|
|
1192
|
+
export type ExperimentVariant = {
|
|
1193
|
+
/**
|
|
1194
|
+
* The variant's key (a, b, control …): lowercase letters, digits and _, at most 20.
|
|
1195
|
+
*/
|
|
1196
|
+
key: string;
|
|
1197
|
+
/**
|
|
1198
|
+
* The paywall it shows (published).
|
|
1199
|
+
*/
|
|
1200
|
+
paywall_id: string;
|
|
1201
|
+
/**
|
|
1202
|
+
* Its weight.
|
|
1203
|
+
*/
|
|
1204
|
+
weight: number;
|
|
1205
|
+
};
|
|
1206
|
+
/**
|
|
1207
|
+
* A page of the project's experiments, newest first.
|
|
1208
|
+
*/
|
|
1209
|
+
export type Experiments = {
|
|
1210
|
+
/**
|
|
1211
|
+
* The experiments.
|
|
1212
|
+
*/
|
|
1213
|
+
experiments: Experiment[];
|
|
1214
|
+
/**
|
|
1215
|
+
* The next page's cursor; absent on the last.
|
|
1216
|
+
*/
|
|
1217
|
+
next_cursor?: string;
|
|
1218
|
+
};
|
|
1219
|
+
/**
|
|
1220
|
+
* What an app showed at a placement, as it was given it.
|
|
1221
|
+
*/
|
|
1222
|
+
export type ExposureRequest = {
|
|
1223
|
+
/**
|
|
1224
|
+
* The paywall.
|
|
1225
|
+
*/
|
|
1226
|
+
paywall_id: string;
|
|
1227
|
+
/**
|
|
1228
|
+
* The variant it was given, when an experiment runs on the placement.
|
|
1229
|
+
*/
|
|
1230
|
+
variant?: string;
|
|
1231
|
+
/**
|
|
1232
|
+
* Its version.
|
|
1233
|
+
*/
|
|
1234
|
+
version: number;
|
|
1235
|
+
};
|
|
1090
1236
|
/**
|
|
1091
1237
|
* A granted (promotional) entitlement.
|
|
1092
1238
|
*/
|
|
@@ -1364,90 +1510,776 @@ export type OfferingPlan = {
|
|
|
1364
1510
|
/**
|
|
1365
1511
|
* What the store sells it by: the App Store's product id, Google Play's product id, Stripe's price lookup key.
|
|
1366
1512
|
*/
|
|
1367
|
-
store_id: string;
|
|
1513
|
+
store_id: string;
|
|
1514
|
+
};
|
|
1515
|
+
/**
|
|
1516
|
+
* The paywall's catalog: the products on sale.
|
|
1517
|
+
*/
|
|
1518
|
+
export type Offerings = {
|
|
1519
|
+
/**
|
|
1520
|
+
* The products, each on the channels it is sold on.
|
|
1521
|
+
*/
|
|
1522
|
+
products: Offering[];
|
|
1523
|
+
/**
|
|
1524
|
+
* The catalog's revision.
|
|
1525
|
+
*/
|
|
1526
|
+
revision: number;
|
|
1527
|
+
};
|
|
1528
|
+
/**
|
|
1529
|
+
* What a quota spend took in credits past its limit.
|
|
1530
|
+
*/
|
|
1531
|
+
export type OverflowReceipt = {
|
|
1532
|
+
/**
|
|
1533
|
+
* What is available of it after.
|
|
1534
|
+
*/
|
|
1535
|
+
available_after: number;
|
|
1536
|
+
/**
|
|
1537
|
+
* The credit's balance after.
|
|
1538
|
+
*/
|
|
1539
|
+
balance_after: number;
|
|
1540
|
+
/**
|
|
1541
|
+
* Credits taken.
|
|
1542
|
+
*/
|
|
1543
|
+
committed: number;
|
|
1544
|
+
/**
|
|
1545
|
+
* What it took, lot by lot.
|
|
1546
|
+
*/
|
|
1547
|
+
consumed: CreditConsumption[];
|
|
1548
|
+
/**
|
|
1549
|
+
* The credit.
|
|
1550
|
+
*/
|
|
1551
|
+
currency: string;
|
|
1552
|
+
/**
|
|
1553
|
+
* Credits held.
|
|
1554
|
+
*/
|
|
1555
|
+
held: number;
|
|
1556
|
+
/**
|
|
1557
|
+
* What a unit cost.
|
|
1558
|
+
*/
|
|
1559
|
+
per_unit: number;
|
|
1560
|
+
/**
|
|
1561
|
+
* Credits handed back.
|
|
1562
|
+
*/
|
|
1563
|
+
reversed: number;
|
|
1564
|
+
/**
|
|
1565
|
+
* How many units went past the limit.
|
|
1566
|
+
*/
|
|
1567
|
+
units: number;
|
|
1568
|
+
};
|
|
1569
|
+
/**
|
|
1570
|
+
* purchases.ownership.transferred: a purchase moved from one customer to another: the second restored the App Store purchases of the Apple ID it was made with.
|
|
1571
|
+
*/
|
|
1572
|
+
export type OwnershipTransferredEvent = {
|
|
1573
|
+
/**
|
|
1574
|
+
* The purchase's id in the ledger.
|
|
1575
|
+
*/
|
|
1576
|
+
chain_id: string;
|
|
1577
|
+
/**
|
|
1578
|
+
* Who had it.
|
|
1579
|
+
*/
|
|
1580
|
+
from_customer_id: string;
|
|
1581
|
+
/**
|
|
1582
|
+
* The catalog's product; empty when unmapped.
|
|
1583
|
+
*/
|
|
1584
|
+
product: string;
|
|
1585
|
+
/**
|
|
1586
|
+
* Where it was bought.
|
|
1587
|
+
*/
|
|
1588
|
+
store: "app_store" | "play_store" | "stripe";
|
|
1589
|
+
/**
|
|
1590
|
+
* Who has it now.
|
|
1591
|
+
*/
|
|
1592
|
+
to_customer_id: string;
|
|
1593
|
+
/**
|
|
1594
|
+
* How.
|
|
1595
|
+
*/
|
|
1596
|
+
via: "restore";
|
|
1597
|
+
};
|
|
1598
|
+
/**
|
|
1599
|
+
* A paywall as Studio edits it: its draft, and what was published of it.
|
|
1600
|
+
*/
|
|
1601
|
+
export type Paywall = {
|
|
1602
|
+
/**
|
|
1603
|
+
* When it was made.
|
|
1604
|
+
*/
|
|
1605
|
+
created_at: string;
|
|
1606
|
+
/**
|
|
1607
|
+
* Who made it (the key).
|
|
1608
|
+
*/
|
|
1609
|
+
created_by: string;
|
|
1610
|
+
draft: PaywallDefinition;
|
|
1611
|
+
/**
|
|
1612
|
+
* Rises with every save of the draft; If-Match names it.
|
|
1613
|
+
*/
|
|
1614
|
+
draft_revision: number;
|
|
1615
|
+
/**
|
|
1616
|
+
* The paywall's id.
|
|
1617
|
+
*/
|
|
1618
|
+
id: string;
|
|
1619
|
+
/**
|
|
1620
|
+
* Its name (the draft's).
|
|
1621
|
+
*/
|
|
1622
|
+
name: string;
|
|
1623
|
+
/**
|
|
1624
|
+
* What there is to say of the draft against the catalog as it is: warnings — a package the catalog does not sell yet is one here and stops a publish.
|
|
1625
|
+
*/
|
|
1626
|
+
problems: PaywallProblem[];
|
|
1627
|
+
/**
|
|
1628
|
+
* When the newest version was published.
|
|
1629
|
+
*/
|
|
1630
|
+
published_at?: string;
|
|
1631
|
+
/**
|
|
1632
|
+
* The newest version published; 0 before the first.
|
|
1633
|
+
*/
|
|
1634
|
+
published_version: number;
|
|
1635
|
+
/**
|
|
1636
|
+
* When the draft was last saved.
|
|
1637
|
+
*/
|
|
1638
|
+
updated_at: string;
|
|
1639
|
+
/**
|
|
1640
|
+
* Who saved it last.
|
|
1641
|
+
*/
|
|
1642
|
+
updated_by: string;
|
|
1643
|
+
};
|
|
1644
|
+
/**
|
|
1645
|
+
* The button that closes the paywall.
|
|
1646
|
+
*/
|
|
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;
|
|
1656
|
+
/**
|
|
1657
|
+
* The component.
|
|
1658
|
+
*/
|
|
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 = {
|
|
1669
|
+
/**
|
|
1670
|
+
* The language a text falls back to: a tag such as en or pt-BR.
|
|
1671
|
+
*/
|
|
1672
|
+
default_locale: string;
|
|
1673
|
+
locales?: PaywallLocales;
|
|
1674
|
+
/**
|
|
1675
|
+
* The paywall's name, for the people who edit it (1 to 100 characters).
|
|
1676
|
+
*/
|
|
1677
|
+
name: string;
|
|
1678
|
+
root: PaywallComponent;
|
|
1679
|
+
/**
|
|
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.
|
|
1681
|
+
*/
|
|
1682
|
+
schema: number;
|
|
1683
|
+
theme: PaywallTheme;
|
|
1684
|
+
};
|
|
1685
|
+
/**
|
|
1686
|
+
* A thin line across its stack.
|
|
1687
|
+
*/
|
|
1688
|
+
export type PaywallDivider = {
|
|
1689
|
+
/**
|
|
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.
|
|
1691
|
+
*/
|
|
1692
|
+
color?: string;
|
|
1693
|
+
/**
|
|
1694
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
1695
|
+
*/
|
|
1696
|
+
id?: string;
|
|
1697
|
+
/**
|
|
1698
|
+
* The component.
|
|
1699
|
+
*/
|
|
1700
|
+
type: "divider";
|
|
1701
|
+
};
|
|
1702
|
+
/**
|
|
1703
|
+
* The error envelope of a refused definition, with every problem when it breaks a rule (`invalid_paywall`).
|
|
1704
|
+
*/
|
|
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[];
|
|
1718
|
+
/**
|
|
1719
|
+
* Correlation ID for log/audit lookup
|
|
1720
|
+
*/
|
|
1721
|
+
request_id: string;
|
|
1722
|
+
/**
|
|
1723
|
+
* Seconds to wait before retrying; present on a refusal that ends with time.
|
|
1724
|
+
*/
|
|
1725
|
+
retry_after?: number;
|
|
1726
|
+
/**
|
|
1727
|
+
* HTTP status code (mirrors the response status)
|
|
1728
|
+
*/
|
|
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 = {
|
|
1742
|
+
/**
|
|
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.
|
|
1744
|
+
*/
|
|
1745
|
+
color?: string;
|
|
1746
|
+
/**
|
|
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.
|
|
1748
|
+
*/
|
|
1749
|
+
icon_color?: string;
|
|
1750
|
+
/**
|
|
1751
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
1752
|
+
*/
|
|
1753
|
+
id?: string;
|
|
1754
|
+
/**
|
|
1755
|
+
* The features, 1 to 12.
|
|
1756
|
+
*/
|
|
1757
|
+
items: PaywallFeatureItem[];
|
|
1758
|
+
/**
|
|
1759
|
+
* Points between the features.
|
|
1760
|
+
*/
|
|
1761
|
+
spacing?: number;
|
|
1762
|
+
/**
|
|
1763
|
+
* The component.
|
|
1764
|
+
*/
|
|
1765
|
+
type: "features";
|
|
1766
|
+
};
|
|
1767
|
+
/**
|
|
1768
|
+
* An icon.
|
|
1769
|
+
*/
|
|
1770
|
+
export type PaywallIcon = {
|
|
1771
|
+
/**
|
|
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.
|
|
1773
|
+
*/
|
|
1774
|
+
color?: string;
|
|
1775
|
+
/**
|
|
1776
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
1777
|
+
*/
|
|
1778
|
+
id?: string;
|
|
1779
|
+
name: PaywallIconName;
|
|
1780
|
+
/**
|
|
1781
|
+
* Its size in points.
|
|
1782
|
+
*/
|
|
1783
|
+
size?: number;
|
|
1784
|
+
/**
|
|
1785
|
+
* The component.
|
|
1786
|
+
*/
|
|
1787
|
+
type: "icon";
|
|
1788
|
+
};
|
|
1789
|
+
/**
|
|
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.
|
|
1795
|
+
*/
|
|
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;
|
|
1802
|
+
/**
|
|
1803
|
+
* Its corner radius, in points.
|
|
1804
|
+
*/
|
|
1805
|
+
corner?: number;
|
|
1806
|
+
/**
|
|
1807
|
+
* Fit shows it whole; fill covers the frame and crops.
|
|
1808
|
+
*/
|
|
1809
|
+
fit?: "fit" | "fill";
|
|
1810
|
+
/**
|
|
1811
|
+
* Its frame's height in points; from its width when absent.
|
|
1812
|
+
*/
|
|
1813
|
+
height?: number;
|
|
1814
|
+
/**
|
|
1815
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
1816
|
+
*/
|
|
1817
|
+
id?: string;
|
|
1818
|
+
/**
|
|
1819
|
+
* Its https address.
|
|
1820
|
+
*/
|
|
1821
|
+
src: string;
|
|
1822
|
+
/**
|
|
1823
|
+
* The component.
|
|
1824
|
+
*/
|
|
1825
|
+
type: "image";
|
|
1826
|
+
};
|
|
1827
|
+
/**
|
|
1828
|
+
* A link: the app's terms or privacy policy, or an https address.
|
|
1829
|
+
*/
|
|
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;
|
|
1836
|
+
/**
|
|
1837
|
+
* The component.
|
|
1838
|
+
*/
|
|
1839
|
+
type: "link";
|
|
1840
|
+
/**
|
|
1841
|
+
* An https address, or `terms` / `privacy`: the addresses the app gives the SDK.
|
|
1842
|
+
*/
|
|
1843
|
+
url: string;
|
|
1844
|
+
};
|
|
1845
|
+
/**
|
|
1846
|
+
* The project's paywalls (at most 100), oldest first.
|
|
1847
|
+
*/
|
|
1848
|
+
export type PaywallList = {
|
|
1849
|
+
/**
|
|
1850
|
+
* The paywalls.
|
|
1851
|
+
*/
|
|
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;
|
|
1863
|
+
};
|
|
1864
|
+
/**
|
|
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).
|
|
1866
|
+
*/
|
|
1867
|
+
export type PaywallPackageItem = {
|
|
1868
|
+
badge?: PaywallString;
|
|
1869
|
+
detail?: PaywallString;
|
|
1870
|
+
/**
|
|
1871
|
+
* The product's plan.
|
|
1872
|
+
*/
|
|
1873
|
+
plan: string;
|
|
1874
|
+
/**
|
|
1875
|
+
* The catalog's product.
|
|
1876
|
+
*/
|
|
1877
|
+
product: string;
|
|
1878
|
+
/**
|
|
1879
|
+
* Selected when the paywall opens (at most one; the first when none is).
|
|
1880
|
+
*/
|
|
1881
|
+
selected?: boolean;
|
|
1882
|
+
title?: PaywallString;
|
|
1883
|
+
};
|
|
1884
|
+
/**
|
|
1885
|
+
* The packages on sale, one of them selected: what the purchase button buys. A paywall has one.
|
|
1886
|
+
*/
|
|
1887
|
+
export type PaywallPackages = {
|
|
1888
|
+
/**
|
|
1889
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
1890
|
+
*/
|
|
1891
|
+
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";
|
|
1900
|
+
/**
|
|
1901
|
+
* The component.
|
|
1902
|
+
*/
|
|
1903
|
+
type: "packages";
|
|
1904
|
+
};
|
|
1905
|
+
/**
|
|
1906
|
+
* One appearance's colors, each `#RRGGBB` or `#RRGGBBAA`. A component's color names one of them.
|
|
1907
|
+
*/
|
|
1908
|
+
export type PaywallPalette = {
|
|
1909
|
+
/**
|
|
1910
|
+
* The purchase button, the selected package, icons.
|
|
1911
|
+
*/
|
|
1912
|
+
accent: string;
|
|
1913
|
+
/**
|
|
1914
|
+
* Behind everything.
|
|
1915
|
+
*/
|
|
1916
|
+
background: string;
|
|
1917
|
+
/**
|
|
1918
|
+
* A package's badge.
|
|
1919
|
+
*/
|
|
1920
|
+
badge: string;
|
|
1921
|
+
/**
|
|
1922
|
+
* Secondary text, the close button, dividers.
|
|
1923
|
+
*/
|
|
1924
|
+
muted: string;
|
|
1925
|
+
/**
|
|
1926
|
+
* Text on the accent color.
|
|
1927
|
+
*/
|
|
1928
|
+
on_accent: string;
|
|
1929
|
+
/**
|
|
1930
|
+
* Cards and the packages' background.
|
|
1931
|
+
*/
|
|
1932
|
+
surface: string;
|
|
1933
|
+
/**
|
|
1934
|
+
* Text.
|
|
1935
|
+
*/
|
|
1936
|
+
text: string;
|
|
1937
|
+
};
|
|
1938
|
+
/**
|
|
1939
|
+
* One thing wrong with a definition.
|
|
1940
|
+
*/
|
|
1941
|
+
export type PaywallProblem = {
|
|
1942
|
+
/**
|
|
1943
|
+
* What it is (unknown_field, unknown_component, too_long, invalid_url, unknown_package …).
|
|
1944
|
+
*/
|
|
1945
|
+
code: string;
|
|
1946
|
+
/**
|
|
1947
|
+
* What to do about it.
|
|
1948
|
+
*/
|
|
1949
|
+
message: string;
|
|
1950
|
+
/**
|
|
1951
|
+
* Where it is (root.children[2].items[0].product).
|
|
1952
|
+
*/
|
|
1953
|
+
path: string;
|
|
1954
|
+
/**
|
|
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).
|
|
1956
|
+
*/
|
|
1957
|
+
warning?: boolean;
|
|
1958
|
+
};
|
|
1959
|
+
/**
|
|
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.
|
|
1961
|
+
*/
|
|
1962
|
+
export type PaywallPublishedEvent = {
|
|
1963
|
+
/**
|
|
1964
|
+
* Its name.
|
|
1965
|
+
*/
|
|
1966
|
+
name: string;
|
|
1967
|
+
/**
|
|
1968
|
+
* The paywall.
|
|
1969
|
+
*/
|
|
1970
|
+
paywall_id: string;
|
|
1971
|
+
/**
|
|
1972
|
+
* The schema it is written in.
|
|
1973
|
+
*/
|
|
1974
|
+
schema: number;
|
|
1975
|
+
/**
|
|
1976
|
+
* The version published.
|
|
1977
|
+
*/
|
|
1978
|
+
version: number;
|
|
1979
|
+
};
|
|
1980
|
+
/**
|
|
1981
|
+
* The button that buys the selected package; the app's store sheet (StoreKit) or checkout (Stripe) opens.
|
|
1982
|
+
*/
|
|
1983
|
+
export type PaywallPurchaseButton = {
|
|
1984
|
+
/**
|
|
1985
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
1986
|
+
*/
|
|
1987
|
+
id?: string;
|
|
1988
|
+
sub_text?: PaywallString;
|
|
1989
|
+
text: PaywallString;
|
|
1990
|
+
/**
|
|
1991
|
+
* The component.
|
|
1992
|
+
*/
|
|
1993
|
+
type: "purchase_button";
|
|
1994
|
+
};
|
|
1995
|
+
/**
|
|
1996
|
+
* A definition to save as a paywall's draft.
|
|
1997
|
+
*/
|
|
1998
|
+
export type PaywallRequest = {
|
|
1999
|
+
definition: PaywallDefinition;
|
|
2000
|
+
};
|
|
2001
|
+
/**
|
|
2002
|
+
* The button that restores the customer's purchases from the store.
|
|
2003
|
+
*/
|
|
2004
|
+
export type PaywallRestoreButton = {
|
|
2005
|
+
/**
|
|
2006
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
2007
|
+
*/
|
|
2008
|
+
id?: string;
|
|
2009
|
+
text?: PaywallString;
|
|
2010
|
+
/**
|
|
2011
|
+
* The component.
|
|
2012
|
+
*/
|
|
2013
|
+
type: "restore_button";
|
|
2014
|
+
};
|
|
2015
|
+
/**
|
|
2016
|
+
* Space: a fixed size, or all that is left along its stack when absent.
|
|
2017
|
+
*/
|
|
2018
|
+
export type PaywallSpacer = {
|
|
2019
|
+
/**
|
|
2020
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
2021
|
+
*/
|
|
2022
|
+
id?: string;
|
|
2023
|
+
/**
|
|
2024
|
+
* Its size in points.
|
|
2025
|
+
*/
|
|
2026
|
+
size?: number;
|
|
2027
|
+
/**
|
|
2028
|
+
* The component.
|
|
2029
|
+
*/
|
|
2030
|
+
type: "spacer";
|
|
2031
|
+
};
|
|
2032
|
+
/**
|
|
2033
|
+
* Components laid out one after another — down, across — or over each other. The root is drawn in a scroll view.
|
|
2034
|
+
*/
|
|
2035
|
+
export type PaywallStack = {
|
|
2036
|
+
/**
|
|
2037
|
+
* Where the components sit across the axis (on both axes in a z stack); stretch fills it.
|
|
2038
|
+
*/
|
|
2039
|
+
align?: "start" | "center" | "end" | "stretch";
|
|
2040
|
+
/**
|
|
2041
|
+
* Down the screen, across it, or over each other (z).
|
|
2042
|
+
*/
|
|
2043
|
+
axis?: "vertical" | "horizontal" | "z";
|
|
2044
|
+
/**
|
|
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.
|
|
2046
|
+
*/
|
|
2047
|
+
background?: string;
|
|
2048
|
+
/**
|
|
2049
|
+
* The components, at most 50.
|
|
2050
|
+
*/
|
|
2051
|
+
children?: PaywallComponent[];
|
|
2052
|
+
/**
|
|
2053
|
+
* The background's corner radius, in points.
|
|
2054
|
+
*/
|
|
2055
|
+
corner?: number;
|
|
2056
|
+
/**
|
|
2057
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
2058
|
+
*/
|
|
2059
|
+
id?: string;
|
|
2060
|
+
/**
|
|
2061
|
+
* Points around the components.
|
|
2062
|
+
*/
|
|
2063
|
+
padding?: number;
|
|
2064
|
+
/**
|
|
2065
|
+
* Points between the components.
|
|
2066
|
+
*/
|
|
2067
|
+
spacing?: number;
|
|
2068
|
+
/**
|
|
2069
|
+
* The component.
|
|
2070
|
+
*/
|
|
2071
|
+
type: "stack";
|
|
2072
|
+
};
|
|
2073
|
+
/**
|
|
2074
|
+
* 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
|
+
*/
|
|
2076
|
+
export type PaywallString = PaywallLiteral | PaywallTextKey;
|
|
2077
|
+
/**
|
|
2078
|
+
* A paywall in the project's list.
|
|
2079
|
+
*/
|
|
2080
|
+
export type PaywallSummary = {
|
|
2081
|
+
/**
|
|
2082
|
+
* Its draft's revision.
|
|
2083
|
+
*/
|
|
2084
|
+
draft_revision: number;
|
|
2085
|
+
/**
|
|
2086
|
+
* The paywall's id.
|
|
2087
|
+
*/
|
|
2088
|
+
id: string;
|
|
2089
|
+
/**
|
|
2090
|
+
* Its name.
|
|
2091
|
+
*/
|
|
2092
|
+
name: string;
|
|
2093
|
+
/**
|
|
2094
|
+
* When the newest version was published.
|
|
2095
|
+
*/
|
|
2096
|
+
published_at?: string;
|
|
2097
|
+
/**
|
|
2098
|
+
* The newest version published; 0 before the first.
|
|
2099
|
+
*/
|
|
2100
|
+
published_version: number;
|
|
2101
|
+
/**
|
|
2102
|
+
* When the draft was last saved.
|
|
2103
|
+
*/
|
|
2104
|
+
updated_at: string;
|
|
2105
|
+
};
|
|
2106
|
+
/**
|
|
2107
|
+
* A text.
|
|
2108
|
+
*/
|
|
2109
|
+
export type PaywallText = {
|
|
2110
|
+
/**
|
|
2111
|
+
* Its alignment.
|
|
2112
|
+
*/
|
|
2113
|
+
align?: "start" | "center" | "end";
|
|
2114
|
+
/**
|
|
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.
|
|
2116
|
+
*/
|
|
2117
|
+
color?: string;
|
|
2118
|
+
/**
|
|
2119
|
+
* Names the component, unique in the paywall: an app's code can draw its own part in its place.
|
|
2120
|
+
*/
|
|
2121
|
+
id?: string;
|
|
2122
|
+
/**
|
|
2123
|
+
* The platform's text style, scaled with the reader's text size.
|
|
2124
|
+
*/
|
|
2125
|
+
style?: "large_title" | "title" | "headline" | "body" | "callout" | "caption" | "footnote";
|
|
2126
|
+
text: PaywallString;
|
|
2127
|
+
/**
|
|
2128
|
+
* The component.
|
|
2129
|
+
*/
|
|
2130
|
+
type: "text";
|
|
2131
|
+
/**
|
|
2132
|
+
* Its weight; the style's own when absent.
|
|
2133
|
+
*/
|
|
2134
|
+
weight?: "regular" | "medium" | "semibold" | "bold";
|
|
2135
|
+
};
|
|
2136
|
+
/**
|
|
2137
|
+
* A text of the language table.
|
|
2138
|
+
*/
|
|
2139
|
+
export type PaywallTextKey = {
|
|
2140
|
+
/**
|
|
2141
|
+
* The text's key.
|
|
2142
|
+
*/
|
|
2143
|
+
t: string;
|
|
2144
|
+
};
|
|
2145
|
+
/**
|
|
2146
|
+
* One language's texts, by key (lowercase letters, digits, `_` `.` `-`, at most 64): each at most 500 characters, with variables.
|
|
2147
|
+
*/
|
|
2148
|
+
export type PaywallTexts = {
|
|
2149
|
+
[key: string]: string;
|
|
2150
|
+
};
|
|
2151
|
+
/**
|
|
2152
|
+
* The paywall's colors in light and dark appearance, its corner radius and its type family.
|
|
2153
|
+
*/
|
|
2154
|
+
export type PaywallTheme = {
|
|
2155
|
+
dark: PaywallPalette;
|
|
2156
|
+
/**
|
|
2157
|
+
* The type family: the platform's system font, its rounded or its serif design.
|
|
2158
|
+
*/
|
|
2159
|
+
font?: "system" | "rounded" | "serif";
|
|
2160
|
+
light: PaywallPalette;
|
|
2161
|
+
/**
|
|
2162
|
+
* The corner radius of cards, buttons and the packages, in points.
|
|
2163
|
+
*/
|
|
2164
|
+
radius?: number;
|
|
2165
|
+
};
|
|
2166
|
+
/**
|
|
2167
|
+
* A definition that passes, and what is left to say of it.
|
|
2168
|
+
*/
|
|
2169
|
+
export type PaywallValidation = {
|
|
2170
|
+
/**
|
|
2171
|
+
* The warnings, by path.
|
|
2172
|
+
*/
|
|
2173
|
+
problems: PaywallProblem[];
|
|
1368
2174
|
};
|
|
1369
2175
|
/**
|
|
1370
|
-
*
|
|
2176
|
+
* A published version of a paywall.
|
|
1371
2177
|
*/
|
|
1372
|
-
export type
|
|
2178
|
+
export type PaywallVersion = {
|
|
2179
|
+
definition?: PaywallDefinition;
|
|
1373
2180
|
/**
|
|
1374
|
-
* The
|
|
2181
|
+
* The paywall.
|
|
1375
2182
|
*/
|
|
1376
|
-
|
|
2183
|
+
paywall_id: string;
|
|
1377
2184
|
/**
|
|
1378
|
-
*
|
|
2185
|
+
* When it was published.
|
|
1379
2186
|
*/
|
|
1380
|
-
|
|
1381
|
-
};
|
|
1382
|
-
/**
|
|
1383
|
-
* What a quota spend took in credits past its limit.
|
|
1384
|
-
*/
|
|
1385
|
-
export type OverflowReceipt = {
|
|
2187
|
+
published_at: string;
|
|
1386
2188
|
/**
|
|
1387
|
-
*
|
|
2189
|
+
* Who published it (the key).
|
|
1388
2190
|
*/
|
|
1389
|
-
|
|
2191
|
+
published_by: string;
|
|
1390
2192
|
/**
|
|
1391
|
-
* The
|
|
2193
|
+
* The schema it is written in.
|
|
1392
2194
|
*/
|
|
1393
|
-
|
|
2195
|
+
schema: number;
|
|
1394
2196
|
/**
|
|
1395
|
-
*
|
|
2197
|
+
* The version: 1, 2, …
|
|
1396
2198
|
*/
|
|
1397
|
-
|
|
2199
|
+
version: number;
|
|
2200
|
+
};
|
|
2201
|
+
/**
|
|
2202
|
+
* A page of a paywall's versions, newest first, without their definitions.
|
|
2203
|
+
*/
|
|
2204
|
+
export type PaywallVersions = {
|
|
1398
2205
|
/**
|
|
1399
|
-
*
|
|
2206
|
+
* The next page's cursor; absent on the last.
|
|
1400
2207
|
*/
|
|
1401
|
-
|
|
2208
|
+
next_cursor?: string;
|
|
1402
2209
|
/**
|
|
1403
|
-
* The
|
|
2210
|
+
* The versions.
|
|
1404
2211
|
*/
|
|
1405
|
-
|
|
2212
|
+
versions: PaywallVersion[];
|
|
2213
|
+
};
|
|
2214
|
+
/**
|
|
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.
|
|
2216
|
+
*/
|
|
2217
|
+
export type Placement = {
|
|
1406
2218
|
/**
|
|
1407
|
-
*
|
|
2219
|
+
* The experiment running on it.
|
|
1408
2220
|
*/
|
|
1409
|
-
|
|
2221
|
+
experiment_id?: string;
|
|
1410
2222
|
/**
|
|
1411
|
-
*
|
|
2223
|
+
* The placement's key.
|
|
1412
2224
|
*/
|
|
1413
|
-
|
|
2225
|
+
key: string;
|
|
1414
2226
|
/**
|
|
1415
|
-
*
|
|
2227
|
+
* The paywall it shows; absent while an experiment runs on it.
|
|
1416
2228
|
*/
|
|
1417
|
-
|
|
2229
|
+
paywall_id?: string;
|
|
1418
2230
|
/**
|
|
1419
|
-
*
|
|
2231
|
+
* When it was last given a paywall or an experiment.
|
|
1420
2232
|
*/
|
|
1421
|
-
|
|
2233
|
+
updated_at: string;
|
|
2234
|
+
/**
|
|
2235
|
+
* Who did (the key).
|
|
2236
|
+
*/
|
|
2237
|
+
updated_by: string;
|
|
1422
2238
|
};
|
|
1423
2239
|
/**
|
|
1424
|
-
*
|
|
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.
|
|
1425
2241
|
*/
|
|
1426
|
-
export type
|
|
2242
|
+
export type PlacementPaywall = {
|
|
2243
|
+
definition: PaywallDefinition;
|
|
2244
|
+
offerings: Offerings;
|
|
1427
2245
|
/**
|
|
1428
|
-
* The
|
|
2246
|
+
* The paywall.
|
|
1429
2247
|
*/
|
|
1430
|
-
|
|
2248
|
+
paywall_id: string;
|
|
1431
2249
|
/**
|
|
1432
|
-
*
|
|
2250
|
+
* The placement.
|
|
1433
2251
|
*/
|
|
1434
|
-
|
|
2252
|
+
placement: string;
|
|
1435
2253
|
/**
|
|
1436
|
-
* The
|
|
2254
|
+
* The schema the definition is written in: at most the one the app said it draws.
|
|
1437
2255
|
*/
|
|
1438
|
-
|
|
2256
|
+
schema: number;
|
|
1439
2257
|
/**
|
|
1440
|
-
*
|
|
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.
|
|
1441
2259
|
*/
|
|
1442
|
-
|
|
2260
|
+
variant?: string;
|
|
1443
2261
|
/**
|
|
1444
|
-
*
|
|
2262
|
+
* Its version; report it with the exposure.
|
|
1445
2263
|
*/
|
|
1446
|
-
|
|
2264
|
+
version: number;
|
|
2265
|
+
};
|
|
2266
|
+
/**
|
|
2267
|
+
* The paywall a placement shows.
|
|
2268
|
+
*/
|
|
2269
|
+
export type PlacementRequest = {
|
|
1447
2270
|
/**
|
|
1448
|
-
*
|
|
2271
|
+
* The paywall.
|
|
1449
2272
|
*/
|
|
1450
|
-
|
|
2273
|
+
paywall_id: string;
|
|
2274
|
+
};
|
|
2275
|
+
/**
|
|
2276
|
+
* The project's placements (at most 200), by key.
|
|
2277
|
+
*/
|
|
2278
|
+
export type Placements = {
|
|
2279
|
+
/**
|
|
2280
|
+
* The placements.
|
|
2281
|
+
*/
|
|
2282
|
+
placements: Placement[];
|
|
1451
2283
|
};
|
|
1452
2284
|
/**
|
|
1453
2285
|
* How a product is paid for.
|
|
@@ -1851,6 +2683,19 @@ export type RefundChangedEvent = {
|
|
|
1851
2683
|
*/
|
|
1852
2684
|
transaction_id: string;
|
|
1853
2685
|
};
|
|
2686
|
+
/**
|
|
2687
|
+
* What was paid in one currency, net of what was refunded.
|
|
2688
|
+
*/
|
|
2689
|
+
export type Revenue = {
|
|
2690
|
+
/**
|
|
2691
|
+
* The amount in millionths of the currency's unit, as the stores report prices: the App Store's list price, Stripe's charged total, Google Play's recurring price.
|
|
2692
|
+
*/
|
|
2693
|
+
amount_micros: number;
|
|
2694
|
+
/**
|
|
2695
|
+
* The currency (ISO 4217).
|
|
2696
|
+
*/
|
|
2697
|
+
currency: string;
|
|
2698
|
+
};
|
|
1854
2699
|
/**
|
|
1855
2700
|
* The error envelope of a refused save, with every problem when the catalog breaks a rule (`invalid_catalog`).
|
|
1856
2701
|
*/
|
|
@@ -2281,6 +3126,60 @@ export type SubscriptionInfo = {
|
|
|
2281
3126
|
*/
|
|
2282
3127
|
will_renew: boolean;
|
|
2283
3128
|
};
|
|
3129
|
+
/**
|
|
3130
|
+
* One variant's numbers.
|
|
3131
|
+
*/
|
|
3132
|
+
export type VariantResult = {
|
|
3133
|
+
/**
|
|
3134
|
+
* The probability that its conversion rate is the highest (0 to 1), Bayesian: each rate is Beta(1 + converters, 1 + viewers − converters) and the chance is how often its draw is the highest. It answers "how likely is this one best?" for any number of variants, at any sample, while the experiment runs.
|
|
3135
|
+
*/
|
|
3136
|
+
chance_to_win: number;
|
|
3137
|
+
/**
|
|
3138
|
+
* converters over viewers. A viewer never signed in cannot be followed to a purchase: the rate is the same lower bound on every variant.
|
|
3139
|
+
*/
|
|
3140
|
+
conversion_rate: number;
|
|
3141
|
+
/**
|
|
3142
|
+
* How many of its viewers made one.
|
|
3143
|
+
*/
|
|
3144
|
+
converters: number;
|
|
3145
|
+
/**
|
|
3146
|
+
* How many times it was shown (a subject once in ten minutes).
|
|
3147
|
+
*/
|
|
3148
|
+
exposures: number;
|
|
3149
|
+
/**
|
|
3150
|
+
* Its paywall.
|
|
3151
|
+
*/
|
|
3152
|
+
paywall_id: string;
|
|
3153
|
+
/**
|
|
3154
|
+
* The purchases the stores confirmed (a subscription's start, a one-time product) that its viewers made within the window after first seeing it — each counted once, for the first variant its buyer saw.
|
|
3155
|
+
*/
|
|
3156
|
+
purchases: number;
|
|
3157
|
+
/**
|
|
3158
|
+
* What its purchases were paid to date, renewals included, net of refunds, by currency.
|
|
3159
|
+
*/
|
|
3160
|
+
revenue: Revenue[];
|
|
3161
|
+
/**
|
|
3162
|
+
* The variant.
|
|
3163
|
+
*/
|
|
3164
|
+
variant: string;
|
|
3165
|
+
/**
|
|
3166
|
+
* How many subjects saw it: users, guests, and installations no one had signed in on.
|
|
3167
|
+
*/
|
|
3168
|
+
viewers: number;
|
|
3169
|
+
/**
|
|
3170
|
+
* Its weight.
|
|
3171
|
+
*/
|
|
3172
|
+
weight: number;
|
|
3173
|
+
};
|
|
3174
|
+
/**
|
|
3175
|
+
* The variant that won.
|
|
3176
|
+
*/
|
|
3177
|
+
export type WinnerRequest = {
|
|
3178
|
+
/**
|
|
3179
|
+
* The variant's key.
|
|
3180
|
+
*/
|
|
3181
|
+
variant: string;
|
|
3182
|
+
};
|
|
2284
3183
|
/**
|
|
2285
3184
|
* The certificate the environment takes Xcode's StoreKit Testing purchases signed with: test purchases made on a developer's Mac with no App Store at all, the sandbox's. It is public: Xcode saves it for whoever asks (Editor › Save Public Certificate).
|
|
2286
3185
|
*/
|
|
@@ -2353,6 +3252,10 @@ export interface Events {
|
|
|
2353
3252
|
* purchases.ownership.transferred: a purchase moved from one customer to another: the second restored the App Store purchases of the Apple ID it was made with.
|
|
2354
3253
|
*/
|
|
2355
3254
|
"purchases.ownership.transferred": OwnershipTransferredEvent;
|
|
3255
|
+
/**
|
|
3256
|
+
* purchases.paywall.published: a paywall's draft was published as its next version; the apps that ask for a placement showing it get it.
|
|
3257
|
+
*/
|
|
3258
|
+
"purchases.paywall.published": PaywallPublishedEvent;
|
|
2356
3259
|
/**
|
|
2357
3260
|
* purchases.purchase.completed: a purchase new to the ledger: a subscription's start or a one-time product, in any store.
|
|
2358
3261
|
*/
|
|
@@ -2804,6 +3707,86 @@ export declare function client(t: Transport): {
|
|
|
2804
3707
|
body?: SpendAction; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
2805
3708
|
signal?: AbortSignal;
|
|
2806
3709
|
}): Promise<Reply<200, SpendReceipt>>;
|
|
3710
|
+
/**
|
|
3711
|
+
* List the experiments
|
|
3712
|
+
*
|
|
3713
|
+
* The project's experiments, newest first, a page at a time; ?placement= keeps one placement's.
|
|
3714
|
+
*/
|
|
3715
|
+
listExperiments(input?: {
|
|
3716
|
+
query?: {
|
|
3717
|
+
placement?: string; /** How many experiments a page holds (20 unless said). */
|
|
3718
|
+
limit?: number; /** The `next_cursor` of the page before. */
|
|
3719
|
+
cursor?: string;
|
|
3720
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3721
|
+
signal?: AbortSignal;
|
|
3722
|
+
}): Promise<Reply<200, Experiments>>;
|
|
3723
|
+
/**
|
|
3724
|
+
* Start an experiment
|
|
3725
|
+
*
|
|
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`).
|
|
3727
|
+
*/
|
|
3728
|
+
startExperiment(input: {
|
|
3729
|
+
headers?: {
|
|
3730
|
+
"Idempotency-Key"?: string;
|
|
3731
|
+
};
|
|
3732
|
+
body: ExperimentRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3733
|
+
signal?: AbortSignal;
|
|
3734
|
+
}): Promise<Reply<201, Experiment>>;
|
|
3735
|
+
/**
|
|
3736
|
+
* Read an experiment
|
|
3737
|
+
*
|
|
3738
|
+
* An experiment: its placement, its variants and its status.
|
|
3739
|
+
*/
|
|
3740
|
+
getExperiment(input: {
|
|
3741
|
+
path: {
|
|
3742
|
+
experiment_id: string;
|
|
3743
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3744
|
+
signal?: AbortSignal;
|
|
3745
|
+
}): Promise<Reply<200, Experiment>>;
|
|
3746
|
+
/**
|
|
3747
|
+
* Read an experiment's results
|
|
3748
|
+
*
|
|
3749
|
+
* What each variant's audience did: exposures and viewers (distinct subjects); the purchases the stores confirmed that its viewers made within `window_days` (7 unless said) after first seeing it — the ledger's, never what an app reports — and how many viewers made one; the conversion rate; what was paid for them to date, net of refunds, by currency; and each variant's chance to convert best. `leader` is the likeliest best, `confident` whether declaring it the winner is sound. A store's test purchases count only with sandbox=true (a development environment's are all test purchases).
|
|
3750
|
+
*/
|
|
3751
|
+
getExperimentResults(input: {
|
|
3752
|
+
path: {
|
|
3753
|
+
experiment_id: string;
|
|
3754
|
+
};
|
|
3755
|
+
query?: {
|
|
3756
|
+
window_days?: number; /** Count the stores' test purchases too. */
|
|
3757
|
+
sandbox?: boolean;
|
|
3758
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3759
|
+
signal?: AbortSignal;
|
|
3760
|
+
}): Promise<Reply<200, ExperimentResults>>;
|
|
3761
|
+
/**
|
|
3762
|
+
* Stop an experiment
|
|
3763
|
+
*
|
|
3764
|
+
* Stops a running experiment: the placement shows its first variant's paywall to everyone. Its results stay.
|
|
3765
|
+
*/
|
|
3766
|
+
stopExperiment(input: {
|
|
3767
|
+
path: {
|
|
3768
|
+
experiment_id: string;
|
|
3769
|
+
};
|
|
3770
|
+
headers?: {
|
|
3771
|
+
"Idempotency-Key"?: string;
|
|
3772
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3773
|
+
signal?: AbortSignal;
|
|
3774
|
+
}): Promise<Reply<200, Experiment>>;
|
|
3775
|
+
/**
|
|
3776
|
+
* Declare an experiment's winner
|
|
3777
|
+
*
|
|
3778
|
+
* Ends a running experiment with a winner: the placement shows the winner's paywall to everyone, at once. Its results stay.
|
|
3779
|
+
*/
|
|
3780
|
+
declareExperimentWinner(input: {
|
|
3781
|
+
path: {
|
|
3782
|
+
experiment_id: string;
|
|
3783
|
+
};
|
|
3784
|
+
headers?: {
|
|
3785
|
+
"Idempotency-Key"?: string;
|
|
3786
|
+
};
|
|
3787
|
+
body: WinnerRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3788
|
+
signal?: AbortSignal;
|
|
3789
|
+
}): Promise<Reply<200, Experiment>>;
|
|
2807
3790
|
/**
|
|
2808
3791
|
* Read what the customer has
|
|
2809
3792
|
*
|
|
@@ -2840,6 +3823,192 @@ export declare function client(t: Transport): {
|
|
|
2840
3823
|
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
2841
3824
|
signal?: AbortSignal;
|
|
2842
3825
|
}): Promise<Reply<200, Offerings>>;
|
|
3826
|
+
/**
|
|
3827
|
+
* List the paywalls
|
|
3828
|
+
*
|
|
3829
|
+
* The project's paywalls, oldest first, with the newest version published of each.
|
|
3830
|
+
*/
|
|
3831
|
+
listPaywalls(input?: {
|
|
3832
|
+
signal?: AbortSignal;
|
|
3833
|
+
}): Promise<Reply<200, PaywallList>>;
|
|
3834
|
+
/**
|
|
3835
|
+
* Make a paywall
|
|
3836
|
+
*
|
|
3837
|
+
* Makes a paywall with its first draft; nothing is published, and no app sees it until it is published and a placement shows it. The draft is checked as a draft: a rule broken refuses it (422 `invalid_paywall`, with every problem); a package the catalog does not sell yet is a warning. A project has at most 100 paywalls (409 `too_many_paywalls`).
|
|
3838
|
+
*/
|
|
3839
|
+
createPaywall(input: {
|
|
3840
|
+
headers?: {
|
|
3841
|
+
"Idempotency-Key"?: string;
|
|
3842
|
+
};
|
|
3843
|
+
body: PaywallRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3844
|
+
signal?: AbortSignal;
|
|
3845
|
+
}): Promise<Reply<201, Paywall>>;
|
|
3846
|
+
/**
|
|
3847
|
+
* Check a paywall
|
|
3848
|
+
*
|
|
3849
|
+
* Checks a definition as publishing it would, without saving anything: every rule of its schema, and every package against the catalog as it is. A definition that passes is answered with its warnings (what App Review expects of a subscription's paywall: a restore button, the legal links); one that breaks a rule is refused with every problem (422 `invalid_paywall`).
|
|
3850
|
+
*/
|
|
3851
|
+
validatePaywall(input: {
|
|
3852
|
+
headers?: {
|
|
3853
|
+
"Idempotency-Key"?: string;
|
|
3854
|
+
};
|
|
3855
|
+
body: PaywallDefinition; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3856
|
+
signal?: AbortSignal;
|
|
3857
|
+
}): Promise<Reply<200, PaywallValidation>>;
|
|
3858
|
+
/**
|
|
3859
|
+
* Read a paywall
|
|
3860
|
+
*
|
|
3861
|
+
* A paywall: its draft (the ETag is its revision), what was published of it, and what there is to say of the draft against the catalog as it is.
|
|
3862
|
+
*/
|
|
3863
|
+
getPaywall(input: {
|
|
3864
|
+
path: {
|
|
3865
|
+
paywall_id: string;
|
|
3866
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3867
|
+
signal?: AbortSignal;
|
|
3868
|
+
}): Promise<Reply<200, Paywall>>;
|
|
3869
|
+
/**
|
|
3870
|
+
* Delete a paywall
|
|
3871
|
+
*
|
|
3872
|
+
* Deletes a paywall and its versions. A paywall a placement shows, or a running experiment does, is not deleted (409 `paywall_in_use`). What was counted of it stays in its experiments' results.
|
|
3873
|
+
*/
|
|
3874
|
+
deletePaywall(input: {
|
|
3875
|
+
path: {
|
|
3876
|
+
paywall_id: string;
|
|
3877
|
+
};
|
|
3878
|
+
headers?: {
|
|
3879
|
+
"Idempotency-Key"?: string;
|
|
3880
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3881
|
+
signal?: AbortSignal;
|
|
3882
|
+
}): Promise<Reply<204, undefined>>;
|
|
3883
|
+
/**
|
|
3884
|
+
* Save a paywall's draft
|
|
3885
|
+
*
|
|
3886
|
+
* Replaces the paywall's draft; what the apps show changes only when it is published. If-Match names the draft revision it was edited from: of two people editing at once, the second is told (412 `paywall_changed`), not overwritten. The draft is checked as a draft (422 `invalid_paywall`, with every problem).
|
|
3887
|
+
*/
|
|
3888
|
+
savePaywallDraft(input: {
|
|
3889
|
+
path: {
|
|
3890
|
+
paywall_id: string;
|
|
3891
|
+
};
|
|
3892
|
+
headers: {
|
|
3893
|
+
"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. */
|
|
3894
|
+
"Idempotency-Key"?: string;
|
|
3895
|
+
};
|
|
3896
|
+
body: PaywallRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3897
|
+
signal?: AbortSignal;
|
|
3898
|
+
}): Promise<Reply<200, Paywall>>;
|
|
3899
|
+
/**
|
|
3900
|
+
* Publish a paywall
|
|
3901
|
+
*
|
|
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`.
|
|
3903
|
+
*/
|
|
3904
|
+
publishPaywall(input: {
|
|
3905
|
+
path: {
|
|
3906
|
+
paywall_id: string;
|
|
3907
|
+
};
|
|
3908
|
+
headers: {
|
|
3909
|
+
"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. */
|
|
3910
|
+
"Idempotency-Key"?: string;
|
|
3911
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3912
|
+
signal?: AbortSignal;
|
|
3913
|
+
}): Promise<Reply<200, PaywallVersion> | Reply<201, PaywallVersion>>;
|
|
3914
|
+
/**
|
|
3915
|
+
* List a paywall's versions
|
|
3916
|
+
*
|
|
3917
|
+
* The paywall's published versions, newest first, a page at a time, without their definitions.
|
|
3918
|
+
*/
|
|
3919
|
+
listPaywallVersions(input: {
|
|
3920
|
+
path: {
|
|
3921
|
+
paywall_id: string;
|
|
3922
|
+
};
|
|
3923
|
+
query?: {
|
|
3924
|
+
limit?: number; /** The `next_cursor` of the page before. */
|
|
3925
|
+
cursor?: string;
|
|
3926
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3927
|
+
signal?: AbortSignal;
|
|
3928
|
+
}): Promise<Reply<200, PaywallVersions>>;
|
|
3929
|
+
/**
|
|
3930
|
+
* Read a paywall's version
|
|
3931
|
+
*
|
|
3932
|
+
* A published version, its definition as it was published.
|
|
3933
|
+
*/
|
|
3934
|
+
getPaywallVersion(input: {
|
|
3935
|
+
path: {
|
|
3936
|
+
paywall_id: string; /** The version. */
|
|
3937
|
+
version: number;
|
|
3938
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3939
|
+
signal?: AbortSignal;
|
|
3940
|
+
}): Promise<Reply<200, PaywallVersion>>;
|
|
3941
|
+
/**
|
|
3942
|
+
* List the placements
|
|
3943
|
+
*
|
|
3944
|
+
* The project's placements, by key: the paywall each shows, or the experiment running on it.
|
|
3945
|
+
*/
|
|
3946
|
+
listPlacements(input?: {
|
|
3947
|
+
signal?: AbortSignal;
|
|
3948
|
+
}): Promise<Reply<200, Placements>>;
|
|
3949
|
+
/**
|
|
3950
|
+
* Give a placement a paywall
|
|
3951
|
+
*
|
|
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`).
|
|
3953
|
+
*/
|
|
3954
|
+
setPlacement(input: {
|
|
3955
|
+
path: {
|
|
3956
|
+
placement: string;
|
|
3957
|
+
};
|
|
3958
|
+
headers?: {
|
|
3959
|
+
"Idempotency-Key"?: string;
|
|
3960
|
+
};
|
|
3961
|
+
body: PlacementRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3962
|
+
signal?: AbortSignal;
|
|
3963
|
+
}): Promise<Reply<200, Placement>>;
|
|
3964
|
+
/**
|
|
3965
|
+
* Delete a placement
|
|
3966
|
+
*
|
|
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`).
|
|
3968
|
+
*/
|
|
3969
|
+
deletePlacement(input: {
|
|
3970
|
+
path: {
|
|
3971
|
+
placement: string;
|
|
3972
|
+
};
|
|
3973
|
+
headers?: {
|
|
3974
|
+
"Idempotency-Key"?: string;
|
|
3975
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3976
|
+
signal?: AbortSignal;
|
|
3977
|
+
}): Promise<Reply<204, undefined>>;
|
|
3978
|
+
/**
|
|
3979
|
+
* Report a paywall shown
|
|
3980
|
+
*
|
|
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.
|
|
3982
|
+
*/
|
|
3983
|
+
recordPaywallExposure(input: {
|
|
3984
|
+
path: {
|
|
3985
|
+
placement: string;
|
|
3986
|
+
};
|
|
3987
|
+
headers?: {
|
|
3988
|
+
"X-Palbase-Installation"?: string;
|
|
3989
|
+
};
|
|
3990
|
+
body: ExposureRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3991
|
+
signal?: AbortSignal;
|
|
3992
|
+
}): Promise<Reply<204, undefined>>;
|
|
3993
|
+
/**
|
|
3994
|
+
* Read a placement's paywall
|
|
3995
|
+
*
|
|
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.
|
|
3997
|
+
*/
|
|
3998
|
+
getPlacementPaywall(input: {
|
|
3999
|
+
path: {
|
|
4000
|
+
placement: string;
|
|
4001
|
+
};
|
|
4002
|
+
query?: {
|
|
4003
|
+
channel?: "ios" | "android" | "web";
|
|
4004
|
+
};
|
|
4005
|
+
headers?: {
|
|
4006
|
+
"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
|
+
"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;
|
|
4009
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
4010
|
+
signal?: AbortSignal;
|
|
4011
|
+
}): Promise<Reply<200, PlacementPaywall> | Reply<204, undefined> | Reply<304, undefined>>;
|
|
2843
4012
|
/**
|
|
2844
4013
|
* Read the settings
|
|
2845
4014
|
*
|