palbase 0.8.1 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/backend/engine.js +2 -2
  3. package/dist/backend/env.js +1 -1
  4. package/dist/backend/index.js +3 -3
  5. package/dist/backend/stack.js +1 -1
  6. package/dist/backend/test.js +2 -2
  7. package/dist/chunks/2DWAHEYE.js +22 -0
  8. package/dist/chunks/{73R33XMD.js → 2GF6TA4C.js} +1 -1
  9. package/dist/chunks/4DDSGFFD.js +95 -0
  10. package/dist/chunks/{7XVI5JLP.js → 5UI3Q5JO.js} +2 -2
  11. package/dist/chunks/{RZ525VLP.js → 6RX5KVMR.js} +2 -2
  12. package/dist/chunks/{6RXVXPHC.js → BKOIWNJP.js} +1 -1
  13. package/dist/chunks/{ZSKMWUIQ.js → CJPHHWRE.js} +2 -2
  14. package/dist/chunks/{NSQAN2ME.js → CNUOWB6T.js} +2 -2
  15. package/dist/chunks/{RYI2OB52.js → I56MGYTD.js} +2 -2
  16. package/dist/chunks/{KJWHR5BP.js → KUFTU2AJ.js} +2 -2
  17. package/dist/chunks/MALOKTVW.js +13 -0
  18. package/dist/chunks/{CA4VJGGG.js → OV2D7HYG.js} +1 -1
  19. package/dist/chunks/PUILCUFX.js +2 -0
  20. package/dist/chunks/{T2Q5CKLL.js → SE3MXMQD.js} +2 -2
  21. package/dist/chunks/{KHHJRNAO.js → WPE6J77U.js} +1 -1
  22. package/dist/chunks/{KYJJJUEU.js → XGWTZGWR.js} +2 -2
  23. package/dist/chunks/{M4XLAPDF.js → XSPSDUZA.js} +2 -2
  24. package/dist/chunks/{MAYLG7WE.js → YSTCOQFT.js} +2 -2
  25. package/dist/chunks/ZHHMA7V4.js +2 -0
  26. package/dist/chunks/{5RTSNQ4X.js → ZRV54HT6.js} +2 -2
  27. package/dist/cli.js +129 -127
  28. package/dist/refuse/ai.js +1 -1
  29. package/dist/refuse/backend.js +1 -1
  30. package/dist/refuse/server.js +1 -1
  31. package/dist/server/index.js +2 -2
  32. package/dist/server/testing.js +2 -2
  33. package/dist/web/index.js +2 -2
  34. package/dist/web/message.js +2 -0
  35. package/dist/web/palbe.js +2 -2
  36. package/dist/web/paywall.js +2 -2
  37. package/dist/web/push-sw.js +2 -0
  38. package/dist/web/ssr.js +2 -2
  39. package/dist/web/vite.js +2 -2
  40. package/package.json +7 -2
  41. package/types/backend/src/services.d.ts +2 -2
  42. package/types/internal/src/modules/ai.d.ts +1 -1
  43. package/types/internal/src/modules/analytics.d.ts +618 -1
  44. package/types/internal/src/modules/auth.d.ts +409 -90
  45. package/types/internal/src/modules/events.d.ts +7 -3
  46. package/types/internal/src/modules/flags.d.ts +380 -14
  47. package/types/internal/src/modules/notify.d.ts +2270 -99
  48. package/types/internal/src/modules/purchases.d.ts +672 -9
  49. package/types/server/src/webhooks.d.ts +1 -1
  50. package/types/web/src/analytics.d.ts +56 -5
  51. package/types/web/src/client.d.ts +26 -4
  52. package/types/web/src/consent.d.ts +218 -0
  53. package/types/web/src/flags.d.ts +75 -0
  54. package/types/web/src/inapp.d.ts +129 -0
  55. package/types/web/src/inbox.d.ts +59 -0
  56. package/types/web/src/index.d.ts +9 -3
  57. package/types/web/src/installation.d.ts +16 -0
  58. package/types/web/src/message/index.d.ts +5 -0
  59. package/types/web/src/message/present.d.ts +20 -0
  60. package/types/web/src/notify.d.ts +67 -0
  61. package/types/web/src/paywall/index.d.ts +4 -4
  62. package/types/web/src/paywall/placement.d.ts +11 -12
  63. package/types/web/src/paywall/prices.d.ts +7 -2
  64. package/types/web/src/purchases.d.ts +32 -0
  65. package/types/web/src/{paywall → screen}/assets.d.ts +6 -6
  66. package/types/web/src/screen/render.d.ts +186 -0
  67. package/types/web/src/{paywall → screen}/resolve.d.ts +56 -8
  68. package/dist/chunks/5M3HV3X4.js +0 -2
  69. package/dist/chunks/Q4XTWEAW.js +0 -92
  70. package/dist/chunks/Y6AQWQBE.js +0 -2
  71. package/types/web/src/paywall/render.d.ts +0 -93
  72. /package/types/web/src/{paywall → screen}/icons.d.ts +0 -0
@@ -503,27 +503,6 @@ export type AdminUserBanRequest = {
503
503
  */
504
504
  reason?: string;
505
505
  };
506
- /**
507
- * One consent decision.
508
- */
509
- export type AdminUserConsent = {
510
- created_at: string;
511
- granted: boolean;
512
- granted_at?: string;
513
- id: string;
514
- purpose: string;
515
- /**
516
- * Absent until the consent is revoked.
517
- */
518
- revoked_at?: string;
519
- /**
520
- * The version of the terms consented to; absent when none was recorded.
521
- */
522
- version?: string;
523
- };
524
- export type AdminUserConsentList = {
525
- consents: AdminUserConsent[];
526
- };
527
506
  export type AdminUserCreateRequest = {
528
507
  email: string;
529
508
  /**
@@ -567,7 +546,7 @@ export type AdminUserCredentialRevocation = {
567
546
  */
568
547
  export type AdminUserExport = {
569
548
  audit_log: AuditEvent[];
570
- consents: AdminUserExportConsent[];
549
+ consents: ConsentRecord[];
571
550
  devices: AdminUserExportDevice[];
572
551
  generated_at: string;
573
552
  identities: IdentityInfo[];
@@ -576,15 +555,6 @@ export type AdminUserExport = {
576
555
  sessions: AdminUserExportSession[];
577
556
  user: AdminUserExportUser;
578
557
  };
579
- export type AdminUserExportConsent = {
580
- created_at?: string;
581
- granted: boolean;
582
- granted_at?: string;
583
- id: string;
584
- purpose: string;
585
- revoked_at?: string;
586
- version?: string;
587
- };
588
558
  export type AdminUserExportDevice = {
589
559
  attestation_status: "pending" | "verified" | "failed" | "revoked";
590
560
  created_at: string;
@@ -1189,51 +1159,243 @@ export type Confirmation = {
1189
1159
  jkt: string;
1190
1160
  };
1191
1161
  /**
1192
- * One recorded consent decision. Records are never edited: a new decision is a new record, and revoking sets `revoked_at`.
1162
+ * One key's new state.
1193
1163
  */
1194
- export type Consent = {
1195
- created_at: string;
1164
+ export type ConsentChange = {
1196
1165
  /**
1197
- * `true` for a grant, `false` for a refusal.
1166
+ * When the person chose.
1198
1167
  */
1199
- granted: boolean;
1168
+ chosen_at: string;
1200
1169
  /**
1201
- * When the decision was recorded.
1170
+ * The key.
1202
1171
  */
1203
- granted_at?: string;
1172
+ key: string;
1204
1173
  /**
1205
- * Consent ID (`con_…`).
1174
+ * Who made the choice.
1206
1175
  */
1207
- id: string;
1176
+ source: "app" | "gpc" | "email_unsubscribe" | "sms_stop" | "support" | "migrated";
1208
1177
  /**
1209
- * What the consent is for, as the app names it.
1178
+ * Its new state.
1210
1179
  */
1211
- purpose: string;
1180
+ state: "granted" | "denied" | "unset";
1181
+ };
1182
+ /**
1183
+ * consent.changed: whose choices changed and to what.
1184
+ */
1185
+ export type ConsentChangedEvent = {
1186
+ changes: ConsentChange[];
1212
1187
  /**
1213
- * When it was revoked; absent while it stands.
1188
+ * The device the choice was made on.
1214
1189
  */
1215
- revoked_at?: string;
1190
+ installation_id?: string;
1191
+ /**
1192
+ * The account, when someone was signed in.
1193
+ */
1194
+ user_id?: string;
1195
+ };
1196
+ /**
1197
+ * A key's state: its newest choice.
1198
+ */
1199
+ export type ConsentChoice = {
1200
+ /**
1201
+ * When the person chose.
1202
+ */
1203
+ chosen_at: string;
1204
+ /**
1205
+ * The key.
1206
+ */
1207
+ key: string;
1208
+ /**
1209
+ * When the key was last refused; absent if never. An ads key refused in the US is not asked again for twelve months from here.
1210
+ */
1211
+ last_denied_at?: string;
1212
+ /**
1213
+ * Who made it: the person's app, their browser's Global Privacy Control, or a server on their word.
1214
+ */
1215
+ source: "app" | "gpc" | "email_unsubscribe" | "sms_stop" | "support" | "migrated";
1216
+ /**
1217
+ * granted, denied, or unset (the device was returned to the app's starting values).
1218
+ */
1219
+ state: "granted" | "denied" | "unset";
1220
+ /**
1221
+ * The version of the consent text the person saw, when the app sent one.
1222
+ */
1223
+ text_version?: string;
1224
+ };
1225
+ /**
1226
+ * The person's state after the refusal.
1227
+ */
1228
+ export type ConsentChoiceList = {
1229
+ choices: ConsentChoice[];
1230
+ };
1231
+ /**
1232
+ * The choices the person made in their app.
1233
+ */
1234
+ export type ConsentChooseRequest = {
1235
+ choices: ConsentInput[];
1216
1236
  /**
1217
- * The version of the text the user agreed to, when the app sent one.
1237
+ * The app install's label (the SDK's installation id).
1218
1238
  */
1219
- version?: string;
1239
+ installation_id: string;
1240
+ /**
1241
+ * app (default), or gpc: the browser's Global Privacy Control refusing the ads keys.
1242
+ */
1243
+ source?: "app" | "gpc";
1244
+ /**
1245
+ * The version of the consent text the person saw.
1246
+ */
1247
+ text_version?: string;
1220
1248
  };
1221
- export type ConsentList = {
1222
- consents: Consent[];
1249
+ /**
1250
+ * A person's state and every choice behind it, newest first.
1251
+ */
1252
+ export type ConsentHistory = {
1253
+ choices: ConsentChoice[];
1254
+ history: ConsentRecord[];
1223
1255
  };
1224
- export type ConsentRecordRequest = {
1256
+ /**
1257
+ * One choice the person made.
1258
+ */
1259
+ export type ConsentInput = {
1260
+ /**
1261
+ * When the person chose, on the device's clock; now when absent. At most 90 days ago.
1262
+ */
1263
+ chosen_at?: string;
1264
+ /**
1265
+ * A platform key or the app's own custom.<name>.
1266
+ */
1267
+ key: string;
1225
1268
  /**
1226
- * The user's decision; absent means `false` (a refusal).
1269
+ * granted, denied, or unset (back to the app's starting value).
1227
1270
  */
1228
- granted?: boolean;
1271
+ state: "granted" | "denied" | "unset";
1272
+ };
1273
+ /**
1274
+ * One of the platform's consent keys, in words an app's consent screen can show.
1275
+ */
1276
+ export type ConsentKey = {
1277
+ /**
1278
+ * Whether the US laws call it selling or sharing: a browser's Global Privacy Control refuses it, and a person who refused it is not asked again for twelve months.
1279
+ */
1280
+ ads: boolean;
1281
+ /**
1282
+ * What the key is about.
1283
+ */
1284
+ category: "measurement" | "personalization" | "marketing" | "advertising";
1285
+ /**
1286
+ * The words by language (en, tr).
1287
+ */
1288
+ description: {
1289
+ [key: string]: string;
1290
+ };
1291
+ /**
1292
+ * The key a choice names.
1293
+ */
1294
+ key: string;
1295
+ /**
1296
+ * The words by language (en, tr).
1297
+ */
1298
+ title: {
1299
+ [key: string]: string;
1300
+ };
1301
+ };
1302
+ /**
1303
+ * The platform's consent keys, in the order a screen lists them. An app's own keys are custom.<name>.
1304
+ */
1305
+ export type ConsentKeyList = {
1306
+ keys: ConsentKey[];
1307
+ };
1308
+ /**
1309
+ * The device the person just signed in on.
1310
+ */
1311
+ export type ConsentLinkRequest = {
1312
+ /**
1313
+ * The app install's label.
1314
+ */
1315
+ installation_id: string;
1316
+ };
1317
+ /**
1318
+ * One choice as it was written: rows are never edited, the newest of a key is its state.
1319
+ */
1320
+ export type ConsentRecord = {
1321
+ /**
1322
+ * When the person chose.
1323
+ */
1324
+ chosen_at: string;
1325
+ /**
1326
+ * Where it was made from (ISO 3166-1 alpha-2).
1327
+ */
1328
+ country?: string;
1329
+ /**
1330
+ * When it was written.
1331
+ */
1332
+ created_at: string;
1333
+ /**
1334
+ * The record (con_…).
1335
+ */
1336
+ id: string;
1337
+ /**
1338
+ * The device it was made on.
1339
+ */
1340
+ installation_id?: string;
1341
+ /**
1342
+ * The key.
1343
+ */
1344
+ key: string;
1345
+ /**
1346
+ * Who made it.
1347
+ */
1348
+ source: "app" | "gpc" | "email_unsubscribe" | "sms_stop" | "support" | "migrated";
1349
+ /**
1350
+ * What was chosen.
1351
+ */
1352
+ state: "granted" | "denied" | "unset";
1353
+ /**
1354
+ * The version of the consent text shown.
1355
+ */
1356
+ text_version?: string;
1357
+ /**
1358
+ * The account it is, when someone was signed in.
1359
+ */
1360
+ user_id?: string;
1361
+ };
1362
+ /**
1363
+ * A refusal the person made elsewhere: name the account (user_id) or the device (installation_id), one of them.
1364
+ */
1365
+ export type ConsentRefuseRequest = {
1366
+ /**
1367
+ * A device no one is signed in on.
1368
+ */
1369
+ installation_id?: string;
1370
+ keys: string[];
1371
+ /**
1372
+ * How it came: an unsubscribe link, an SMS STOP, a support request.
1373
+ */
1374
+ reason: "email_unsubscribe" | "sms_stop" | "support";
1375
+ /**
1376
+ * The account.
1377
+ */
1378
+ user_id?: string;
1379
+ };
1380
+ /**
1381
+ * Where the request came from, as far as a consent screen cares.
1382
+ */
1383
+ export type ConsentRegion = {
1229
1384
  /**
1230
- * What the consent is for (app-defined, e.g. `marketing_email`).
1385
+ * ISO 3166-1 alpha-2; absent when the address cannot tell.
1231
1386
  */
1232
- purpose: string;
1387
+ country?: string;
1233
1388
  /**
1234
- * The version of the text the user saw.
1389
+ * The family of laws: gdpr (the EU, the EEA, the UK, Switzerland: asked before anything is collected), us (collected until refused), other.
1235
1390
  */
1236
- version?: string;
1391
+ jurisdiction: "gdpr" | "us" | "other";
1392
+ };
1393
+ /**
1394
+ * The device's choices, or the signed-in account's, and the request's region.
1395
+ */
1396
+ export type ConsentState = {
1397
+ choices: ConsentChoice[];
1398
+ region: ConsentRegion;
1237
1399
  };
1238
1400
  export type CustomToken = {
1239
1401
  /**
@@ -1384,6 +1546,19 @@ export type DevicePendingRequest = {
1384
1546
  */
1385
1547
  user_agent?: string;
1386
1548
  };
1549
+ /**
1550
+ * device.revoked: a device's key was revoked.
1551
+ */
1552
+ export type DeviceRevokedEvent = {
1553
+ /**
1554
+ * The device.
1555
+ */
1556
+ device_id: string;
1557
+ /**
1558
+ * The user.
1559
+ */
1560
+ user_id?: string;
1561
+ };
1387
1562
  /**
1388
1563
  * The check passed.
1389
1564
  */
@@ -2535,6 +2710,23 @@ export type ServiceAccountRotated = {
2535
2710
  client_secret: string;
2536
2711
  grace_period_end: string;
2537
2712
  };
2713
+ /**
2714
+ * session.ended: a sign-in ended (signed out, ended from another device, revoked, expired).
2715
+ */
2716
+ export type SessionEndedEvent = {
2717
+ /**
2718
+ * When.
2719
+ */
2720
+ ended_at?: string;
2721
+ /**
2722
+ * The session.
2723
+ */
2724
+ session_id: string;
2725
+ /**
2726
+ * The user.
2727
+ */
2728
+ user_id: string;
2729
+ };
2538
2730
  export type SessionInfo = {
2539
2731
  /**
2540
2732
  * AAL level (`aal1`, `aal2`, `aal3`).
@@ -2962,9 +3154,6 @@ export type StatusEnrolled = {
2962
3154
  export type StatusRemoved = {
2963
3155
  status: "removed";
2964
3156
  };
2965
- export type StatusRevoked = {
2966
- status: "revoked";
2967
- };
2968
3157
  export type StatusSent = {
2969
3158
  status: "sent";
2970
3159
  };
@@ -3239,6 +3428,40 @@ export type User = {
3239
3428
  */
3240
3429
  roles: string[];
3241
3430
  };
3431
+ /**
3432
+ * user.converted: a guest became a full account.
3433
+ */
3434
+ export type UserConvertedEvent = {
3435
+ /**
3436
+ * When.
3437
+ */
3438
+ converted_at?: string;
3439
+ /**
3440
+ * How they converted: password, a social provider, …
3441
+ */
3442
+ method?: string;
3443
+ /**
3444
+ * The user.
3445
+ */
3446
+ user_id: string;
3447
+ };
3448
+ /**
3449
+ * user.deleted: a user was deleted; every module forgets what it kept of them.
3450
+ */
3451
+ export type UserDeletedEvent = {
3452
+ /**
3453
+ * When.
3454
+ */
3455
+ deleted_at?: string;
3456
+ /**
3457
+ * Whether it was a test user.
3458
+ */
3459
+ is_test?: boolean;
3460
+ /**
3461
+ * The user.
3462
+ */
3463
+ user_id: string;
3464
+ };
3242
3465
  /**
3243
3466
  * OpenID Connect Core §5.3.2 claims for the token's scopes.
3244
3467
  */
@@ -3250,6 +3473,33 @@ export type UserInfo = {
3250
3473
  sub: string;
3251
3474
  [key: string]: unknown;
3252
3475
  };
3476
+ /**
3477
+ * user.locale_changed: a user's language changed.
3478
+ */
3479
+ export type UserLocaleChangedEvent = {
3480
+ /**
3481
+ * When.
3482
+ */
3483
+ changed_at?: string;
3484
+ /**
3485
+ * Their language (BCP 47).
3486
+ */
3487
+ locale?: string;
3488
+ /**
3489
+ * The user.
3490
+ */
3491
+ user_id: string;
3492
+ };
3493
+ /**
3494
+ * user.permissions_changed: the permissions a user holds changed (a role given, taken or changed).
3495
+ */
3496
+ export type UserPermissionsChangedEvent = {
3497
+ permissions: string[];
3498
+ /**
3499
+ * The user.
3500
+ */
3501
+ user_id: string;
3502
+ };
3253
3503
  export type VerifyContactRequest = {
3254
3504
  token: string;
3255
3505
  };
@@ -3447,6 +3697,37 @@ export type WebAuthnSignupBeginResponse = {
3447
3697
  */
3448
3698
  user_id: string;
3449
3699
  };
3700
+ /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
3701
+ export interface Events {
3702
+ /**
3703
+ * consent.changed: a person's choice changed a key's state — in their app, by their browser's Global Privacy Control, or by a refusal recorded on their word.
3704
+ */
3705
+ "consent.changed": ConsentChangedEvent;
3706
+ /**
3707
+ * device.revoked: a device's key was revoked.
3708
+ */
3709
+ "device.revoked": DeviceRevokedEvent;
3710
+ /**
3711
+ * session.ended: a sign-in ended.
3712
+ */
3713
+ "session.ended": SessionEndedEvent;
3714
+ /**
3715
+ * user.converted: a guest became a full account.
3716
+ */
3717
+ "user.converted": UserConvertedEvent;
3718
+ /**
3719
+ * user.deleted: a user was deleted.
3720
+ */
3721
+ "user.deleted": UserDeletedEvent;
3722
+ /**
3723
+ * user.locale_changed: a user's language changed.
3724
+ */
3725
+ "user.locale_changed": UserLocaleChangedEvent;
3726
+ /**
3727
+ * user.permissions_changed: the permissions a user holds changed.
3728
+ */
3729
+ "user.permissions_changed": UserPermissionsChangedEvent;
3730
+ }
3450
3731
  /** Palbase Auth API */
3451
3732
  export declare function client(t: Transport): {
3452
3733
  /**
@@ -4113,16 +4394,16 @@ export declare function client(t: Transport): {
4113
4394
  signal?: AbortSignal;
4114
4395
  }): Promise<Reply<200, AdminUser>>;
4115
4396
  /**
4116
- * List a user's consents
4397
+ * Get a user's consents
4117
4398
  *
4118
- * Lists every consent decision the user has recorded, newest first, including revoked ones (with revoked_at). A user ID that does not exist answers an empty list.
4399
+ * Returns the account's state, key by key, and every choice behind it, newest first: the proof of what was allowed when.
4119
4400
  */
4120
- adminListUserConsents(input: {
4401
+ adminGetUserConsents(input: {
4121
4402
  path: {
4122
4403
  uid: string;
4123
4404
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4124
4405
  signal?: AbortSignal;
4125
- }): Promise<Reply<200, AdminUserConsentList>>;
4406
+ }): Promise<Reply<200, ConsentHistory>>;
4126
4407
  /**
4127
4408
  * Revoke all of a user's credentials
4128
4409
  *
@@ -5326,34 +5607,6 @@ export declare function client(t: Transport): {
5326
5607
  body?: SelfDeleteRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5327
5608
  signal?: AbortSignal;
5328
5609
  }): Promise<Reply<204, undefined>>;
5329
- /**
5330
- * List the signed-in user's consent records
5331
- *
5332
- * Returns every consent decision the signed-in user has recorded, revoked ones included (with `revoked_at`).
5333
- */
5334
- listConsents(input?: {
5335
- signal?: AbortSignal;
5336
- }): Promise<Reply<200, ConsentList>>;
5337
- /**
5338
- * Record a consent decision
5339
- *
5340
- * Records a new grant or refusal for a purpose. Each call creates a new, unchangeable record; the caller's IP address and user agent are kept with it as proof. Sent again with the same `Idempotency-Key`, the request is applied once and answered the same (`Idempotent-Replayed: true`).
5341
- */
5342
- recordConsent(input: {
5343
- body: ConsentRecordRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5344
- signal?: AbortSignal;
5345
- }): Promise<Reply<201, Consent>>;
5346
- /**
5347
- * Revoke a consent
5348
- *
5349
- * Revokes one of the signed-in user's consent records by setting its `revoked_at`; the record itself is kept. A record that does not exist, belongs to someone else or is already revoked answers 404 `consent_not_found`.
5350
- */
5351
- revokeConsent(input: {
5352
- path: {
5353
- id: string;
5354
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5355
- signal?: AbortSignal;
5356
- }): Promise<Reply<200, StatusRevoked>>;
5357
5610
  /**
5358
5611
  * Verify email address
5359
5612
  *
@@ -5685,5 +5938,71 @@ export declare function client(t: Transport): {
5685
5938
  body: OwnerCLICodeRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5686
5939
  signal?: AbortSignal;
5687
5940
  }): Promise<Reply<200, OwnerCLICode>>;
5941
+ /**
5942
+ * List the consent keys
5943
+ *
5944
+ * Returns the platform's consent keys with words for them, in the order a consent screen lists them. An app writes its own screen from this list; its own keys are custom.<name>.
5945
+ */
5946
+ listConsentKeys(input?: {
5947
+ signal?: AbortSignal;
5948
+ }): Promise<Reply<200, ConsentKeyList>>;
5949
+ /**
5950
+ * Get the consent choices
5951
+ *
5952
+ * Returns the signed-in account's choices — every device of the account holds them — or, with no one signed in, the device's own; with the request's region, so the app picks its starting values. A key the person never chose is absent: the app's starting value stands.
5953
+ */
5954
+ getConsents(input: {
5955
+ query: {
5956
+ installation_id: string;
5957
+ };
5958
+ headers?: {
5959
+ "X-Palbase-Installation-Secret"?: string;
5960
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5961
+ signal?: AbortSignal;
5962
+ }): Promise<Reply<200, ConsentState>>;
5963
+ /**
5964
+ * Record consent choices
5965
+ *
5966
+ * Records the choices the person made in the app: the account's when signed in, else the device's. The newest choice of a key wins — a choice made offline counts from when it was made — so a starting value the app never sent cannot override a refusal. source gpc records the browser's Global Privacy Control refusing the ads keys. Every choice is kept as proof, with the text version, country, address and user agent.
5967
+ */
5968
+ chooseConsents(input: {
5969
+ headers?: {
5970
+ "X-Palbase-Installation-Secret"?: string;
5971
+ };
5972
+ body: ConsentChooseRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5973
+ signal?: AbortSignal;
5974
+ }): Promise<Reply<200, ConsentState>>;
5975
+ /**
5976
+ * Bring a device's choices to the account
5977
+ *
5978
+ * Called on sign-in: a choice the device made after the account's newest of the same key becomes the account's, and the answer is the account's state, which the device takes.
5979
+ */
5980
+ linkConsents(input: {
5981
+ headers?: {
5982
+ "X-Palbase-Installation-Secret"?: string;
5983
+ };
5984
+ body: ConsentLinkRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5985
+ signal?: AbortSignal;
5986
+ }): Promise<Reply<200, ConsentState>>;
5987
+ /**
5988
+ * Get a device's consents
5989
+ *
5990
+ * Returns the choices made on a device while no one was signed in on it, and every one behind them.
5991
+ */
5992
+ adminGetInstallationConsents(input: {
5993
+ path: {
5994
+ installation_id: string;
5995
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5996
+ signal?: AbortSignal;
5997
+ }): Promise<Reply<200, ConsentHistory>>;
5998
+ /**
5999
+ * Record a refusal
6000
+ *
6001
+ * Records a refusal the person made outside the app — an unsubscribe link, an SMS STOP, a support request — for their account or a device. A server can only refuse: granting is the person's own app's alone.
6002
+ */
6003
+ adminRefuseConsents(input: {
6004
+ body: ConsentRefuseRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
6005
+ signal?: AbortSignal;
6006
+ }): Promise<Reply<200, ConsentChoiceList>>;
5688
6007
  };
5689
6008
  export type Client = ReturnType<typeof client>;
@@ -1,19 +1,23 @@
1
1
  import type { WebhookEvent } from '../event.js';
2
2
  import type { Events as AiEvents } from './ai.js';
3
+ import type { Events as AnalyticsEvents } from './analytics.js';
4
+ import type { Events as AuthEvents } from './auth.js';
5
+ import type { Events as FlagsEvents } from './flags.js';
6
+ import type { Events as NotifyEvents } from './notify.js';
3
7
  import type { Events as PurchasesEvents } from './purchases.js';
4
8
  import type { Events as StorageEvents } from './storage.js';
5
9
  import type { Events as StoresEvents } from './stores.js';
6
10
  /** Every event the modules' contracts say they send the project's webhooks (x-palbase-events), by type: its payload, the event's data. */
7
- export interface PlatformEvents extends AiEvents, PurchasesEvents, StorageEvents, StoresEvents {
11
+ export interface PlatformEvents extends AiEvents, AnalyticsEvents, AuthEvents, FlagsEvents, NotifyEvents, PurchasesEvents, StorageEvents, StoresEvents {
8
12
  }
9
13
  /** A platform event's type: one a module's contract declares. */
10
14
  export type EventType = keyof PlatformEvents;
11
15
  /** Every platform event's type, as the contracts declare them. */
12
- export declare const EVENT_TYPES: readonly ["ai.goal.updated", "ai.response.completed", "ai.response.failed", "ai.response.started", "ai.voice.closed", "ai.voice.delegated", "ai.voice.started", "ai.workspace.published", "ai.workspace.pushed", "file.deleted", "file.moved", "file.uploaded", "purchases.catalog.applied", "purchases.catalog.changed", "purchases.credits.depleted", "purchases.credits.low", "purchases.customer.changed", "purchases.customer.erased", "purchases.customer.merged", "purchases.entitlement.changed", "purchases.ownership.transferred", "purchases.paywall.published", "purchases.purchase.completed", "purchases.quota.exhausted", "purchases.quota.threshold", "purchases.refund.changed", "purchases.store.changed", "purchases.subscription.changed", "stores.action.changed", "stores.app.changed", "stores.apple.changed", "stores.delivery.changed", "stores.delivery.requested", "stores.google.changed", "stores.group.changed", "stores.package.changed"];
16
+ export declare const EVENT_TYPES: readonly ["ai.goal.updated", "ai.response.completed", "ai.response.failed", "ai.response.started", "ai.voice.closed", "ai.voice.delegated", "ai.voice.started", "ai.workspace.published", "ai.workspace.pushed", "audience.entered", "audience.exited", "consent.changed", "device.revoked", "file.deleted", "file.moved", "file.uploaded", "flag.changed", "flag.override_changed", "notification.action", "notification.bounced", "notification.complained", "notification.delivered", "notification.dismissed", "notification.expired", "notification.failed", "notification.not_shown", "notification.opened", "notification.read", "notification.received", "notification.rejected", "notification.sent", "notification.unconfirmed", "notification.undelivered", "notification.uninstalled", "purchases.catalog.applied", "purchases.catalog.changed", "purchases.coupon.redeemed", "purchases.credits.depleted", "purchases.credits.low", "purchases.customer.changed", "purchases.customer.erased", "purchases.customer.merged", "purchases.entitlement.changed", "purchases.offer.redeemed", "purchases.ownership.transferred", "purchases.paywall.published", "purchases.purchase.completed", "purchases.quota.exhausted", "purchases.quota.threshold", "purchases.refund.changed", "purchases.store.changed", "purchases.subscription.changed", "session.ended", "stores.action.changed", "stores.app.changed", "stores.apple.changed", "stores.delivery.changed", "stores.delivery.requested", "stores.google.changed", "stores.group.changed", "stores.package.changed", "user.converted", "user.deleted", "user.locale_changed", "user.permissions_changed"];
13
17
  /**
14
18
  * A platform event as delivered: one member per type the contracts declare,
15
19
  * its data that type's payload, so a switch on its type narrows it. An
16
20
  * event of a type none of them declares (one a newer platform sends) is no
17
21
  * member: at run time it reaches the switch's default, which takes it.
18
22
  */
19
- export type PalbaseEvent = WebhookEvent<PlatformEvents["ai.goal.updated"], "ai.goal.updated"> | WebhookEvent<PlatformEvents["ai.response.completed"], "ai.response.completed"> | WebhookEvent<PlatformEvents["ai.response.failed"], "ai.response.failed"> | WebhookEvent<PlatformEvents["ai.response.started"], "ai.response.started"> | WebhookEvent<PlatformEvents["ai.voice.closed"], "ai.voice.closed"> | WebhookEvent<PlatformEvents["ai.voice.delegated"], "ai.voice.delegated"> | WebhookEvent<PlatformEvents["ai.voice.started"], "ai.voice.started"> | WebhookEvent<PlatformEvents["ai.workspace.published"], "ai.workspace.published"> | WebhookEvent<PlatformEvents["ai.workspace.pushed"], "ai.workspace.pushed"> | WebhookEvent<PlatformEvents["file.deleted"], "file.deleted"> | WebhookEvent<PlatformEvents["file.moved"], "file.moved"> | WebhookEvent<PlatformEvents["file.uploaded"], "file.uploaded"> | WebhookEvent<PlatformEvents["purchases.catalog.applied"], "purchases.catalog.applied"> | WebhookEvent<PlatformEvents["purchases.catalog.changed"], "purchases.catalog.changed"> | WebhookEvent<PlatformEvents["purchases.credits.depleted"], "purchases.credits.depleted"> | WebhookEvent<PlatformEvents["purchases.credits.low"], "purchases.credits.low"> | WebhookEvent<PlatformEvents["purchases.customer.changed"], "purchases.customer.changed"> | WebhookEvent<PlatformEvents["purchases.customer.erased"], "purchases.customer.erased"> | WebhookEvent<PlatformEvents["purchases.customer.merged"], "purchases.customer.merged"> | WebhookEvent<PlatformEvents["purchases.entitlement.changed"], "purchases.entitlement.changed"> | WebhookEvent<PlatformEvents["purchases.ownership.transferred"], "purchases.ownership.transferred"> | WebhookEvent<PlatformEvents["purchases.paywall.published"], "purchases.paywall.published"> | WebhookEvent<PlatformEvents["purchases.purchase.completed"], "purchases.purchase.completed"> | WebhookEvent<PlatformEvents["purchases.quota.exhausted"], "purchases.quota.exhausted"> | WebhookEvent<PlatformEvents["purchases.quota.threshold"], "purchases.quota.threshold"> | WebhookEvent<PlatformEvents["purchases.refund.changed"], "purchases.refund.changed"> | WebhookEvent<PlatformEvents["purchases.store.changed"], "purchases.store.changed"> | WebhookEvent<PlatformEvents["purchases.subscription.changed"], "purchases.subscription.changed"> | WebhookEvent<PlatformEvents["stores.action.changed"], "stores.action.changed"> | WebhookEvent<PlatformEvents["stores.app.changed"], "stores.app.changed"> | WebhookEvent<PlatformEvents["stores.apple.changed"], "stores.apple.changed"> | WebhookEvent<PlatformEvents["stores.delivery.changed"], "stores.delivery.changed"> | WebhookEvent<PlatformEvents["stores.delivery.requested"], "stores.delivery.requested"> | WebhookEvent<PlatformEvents["stores.google.changed"], "stores.google.changed"> | WebhookEvent<PlatformEvents["stores.group.changed"], "stores.group.changed"> | WebhookEvent<PlatformEvents["stores.package.changed"], "stores.package.changed">;
23
+ export type PalbaseEvent = WebhookEvent<PlatformEvents["ai.goal.updated"], "ai.goal.updated"> | WebhookEvent<PlatformEvents["ai.response.completed"], "ai.response.completed"> | WebhookEvent<PlatformEvents["ai.response.failed"], "ai.response.failed"> | WebhookEvent<PlatformEvents["ai.response.started"], "ai.response.started"> | WebhookEvent<PlatformEvents["ai.voice.closed"], "ai.voice.closed"> | WebhookEvent<PlatformEvents["ai.voice.delegated"], "ai.voice.delegated"> | WebhookEvent<PlatformEvents["ai.voice.started"], "ai.voice.started"> | WebhookEvent<PlatformEvents["ai.workspace.published"], "ai.workspace.published"> | WebhookEvent<PlatformEvents["ai.workspace.pushed"], "ai.workspace.pushed"> | WebhookEvent<PlatformEvents["audience.entered"], "audience.entered"> | WebhookEvent<PlatformEvents["audience.exited"], "audience.exited"> | WebhookEvent<PlatformEvents["consent.changed"], "consent.changed"> | WebhookEvent<PlatformEvents["device.revoked"], "device.revoked"> | WebhookEvent<PlatformEvents["file.deleted"], "file.deleted"> | WebhookEvent<PlatformEvents["file.moved"], "file.moved"> | WebhookEvent<PlatformEvents["file.uploaded"], "file.uploaded"> | WebhookEvent<PlatformEvents["flag.changed"], "flag.changed"> | WebhookEvent<PlatformEvents["flag.override_changed"], "flag.override_changed"> | WebhookEvent<PlatformEvents["notification.action"], "notification.action"> | WebhookEvent<PlatformEvents["notification.bounced"], "notification.bounced"> | WebhookEvent<PlatformEvents["notification.complained"], "notification.complained"> | WebhookEvent<PlatformEvents["notification.delivered"], "notification.delivered"> | WebhookEvent<PlatformEvents["notification.dismissed"], "notification.dismissed"> | WebhookEvent<PlatformEvents["notification.expired"], "notification.expired"> | WebhookEvent<PlatformEvents["notification.failed"], "notification.failed"> | WebhookEvent<PlatformEvents["notification.not_shown"], "notification.not_shown"> | WebhookEvent<PlatformEvents["notification.opened"], "notification.opened"> | WebhookEvent<PlatformEvents["notification.read"], "notification.read"> | WebhookEvent<PlatformEvents["notification.received"], "notification.received"> | WebhookEvent<PlatformEvents["notification.rejected"], "notification.rejected"> | WebhookEvent<PlatformEvents["notification.sent"], "notification.sent"> | WebhookEvent<PlatformEvents["notification.unconfirmed"], "notification.unconfirmed"> | WebhookEvent<PlatformEvents["notification.undelivered"], "notification.undelivered"> | WebhookEvent<PlatformEvents["notification.uninstalled"], "notification.uninstalled"> | WebhookEvent<PlatformEvents["purchases.catalog.applied"], "purchases.catalog.applied"> | WebhookEvent<PlatformEvents["purchases.catalog.changed"], "purchases.catalog.changed"> | WebhookEvent<PlatformEvents["purchases.coupon.redeemed"], "purchases.coupon.redeemed"> | WebhookEvent<PlatformEvents["purchases.credits.depleted"], "purchases.credits.depleted"> | WebhookEvent<PlatformEvents["purchases.credits.low"], "purchases.credits.low"> | WebhookEvent<PlatformEvents["purchases.customer.changed"], "purchases.customer.changed"> | WebhookEvent<PlatformEvents["purchases.customer.erased"], "purchases.customer.erased"> | WebhookEvent<PlatformEvents["purchases.customer.merged"], "purchases.customer.merged"> | WebhookEvent<PlatformEvents["purchases.entitlement.changed"], "purchases.entitlement.changed"> | WebhookEvent<PlatformEvents["purchases.offer.redeemed"], "purchases.offer.redeemed"> | WebhookEvent<PlatformEvents["purchases.ownership.transferred"], "purchases.ownership.transferred"> | WebhookEvent<PlatformEvents["purchases.paywall.published"], "purchases.paywall.published"> | WebhookEvent<PlatformEvents["purchases.purchase.completed"], "purchases.purchase.completed"> | WebhookEvent<PlatformEvents["purchases.quota.exhausted"], "purchases.quota.exhausted"> | WebhookEvent<PlatformEvents["purchases.quota.threshold"], "purchases.quota.threshold"> | WebhookEvent<PlatformEvents["purchases.refund.changed"], "purchases.refund.changed"> | WebhookEvent<PlatformEvents["purchases.store.changed"], "purchases.store.changed"> | WebhookEvent<PlatformEvents["purchases.subscription.changed"], "purchases.subscription.changed"> | WebhookEvent<PlatformEvents["session.ended"], "session.ended"> | WebhookEvent<PlatformEvents["stores.action.changed"], "stores.action.changed"> | WebhookEvent<PlatformEvents["stores.app.changed"], "stores.app.changed"> | WebhookEvent<PlatformEvents["stores.apple.changed"], "stores.apple.changed"> | WebhookEvent<PlatformEvents["stores.delivery.changed"], "stores.delivery.changed"> | WebhookEvent<PlatformEvents["stores.delivery.requested"], "stores.delivery.requested"> | WebhookEvent<PlatformEvents["stores.google.changed"], "stores.google.changed"> | WebhookEvent<PlatformEvents["stores.group.changed"], "stores.group.changed"> | WebhookEvent<PlatformEvents["stores.package.changed"], "stores.package.changed"> | WebhookEvent<PlatformEvents["user.converted"], "user.converted"> | WebhookEvent<PlatformEvents["user.deleted"], "user.deleted"> | WebhookEvent<PlatformEvents["user.locale_changed"], "user.locale_changed"> | WebhookEvent<PlatformEvents["user.permissions_changed"], "user.permissions_changed">;