@owlmeans/payment 0.1.18-rc.9 → 0.1.18

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 (366) hide show
  1. package/README.md +95 -57
  2. package/agent-meta/manifest.json +10 -3
  3. package/agent-meta/skills/entitlements/SKILL.md +159 -0
  4. package/agent-meta/skills/payment/SKILL.md +491 -28
  5. package/build/advertise.d.ts +2 -0
  6. package/build/advertise.d.ts.map +1 -0
  7. package/build/advertise.js +10 -0
  8. package/build/advertise.js.map +1 -0
  9. package/build/checkout/consts.d.ts +2 -0
  10. package/build/checkout/consts.d.ts.map +1 -0
  11. package/build/checkout/consts.js +2 -0
  12. package/build/checkout/consts.js.map +1 -0
  13. package/build/checkout/index.d.ts +6 -0
  14. package/build/checkout/index.d.ts.map +1 -0
  15. package/build/checkout/index.js +4 -0
  16. package/build/checkout/index.js.map +1 -0
  17. package/build/checkout/narrow/types.d.ts +25 -0
  18. package/build/checkout/narrow/types.d.ts.map +1 -0
  19. package/build/checkout/narrow/types.js +2 -0
  20. package/build/checkout/narrow/types.js.map +1 -0
  21. package/build/checkout/narrow.d.ts +8 -0
  22. package/build/checkout/narrow.d.ts.map +1 -0
  23. package/build/checkout/narrow.js +47 -0
  24. package/build/checkout/narrow.js.map +1 -0
  25. package/build/checkout/protocols.d.ts +8 -0
  26. package/build/checkout/protocols.d.ts.map +1 -0
  27. package/build/checkout/protocols.js +28 -0
  28. package/build/checkout/protocols.js.map +1 -0
  29. package/build/checkout/types.d.ts +29 -0
  30. package/build/checkout/types.d.ts.map +1 -0
  31. package/build/checkout/types.js +2 -0
  32. package/build/checkout/types.js.map +1 -0
  33. package/build/consts.d.ts +242 -25
  34. package/build/consts.d.ts.map +1 -1
  35. package/build/consts.js +377 -24
  36. package/build/consts.js.map +1 -1
  37. package/build/consts.local.d.ts +20 -0
  38. package/build/consts.local.d.ts.map +1 -0
  39. package/build/consts.local.js +23 -0
  40. package/build/consts.local.js.map +1 -0
  41. package/build/consumer/cancel.d.ts +11 -0
  42. package/build/consumer/cancel.d.ts.map +1 -0
  43. package/build/consumer/cancel.js +33 -0
  44. package/build/consumer/cancel.js.map +1 -0
  45. package/build/consumer/consts.d.ts +20 -0
  46. package/build/consumer/consts.d.ts.map +1 -0
  47. package/build/consumer/consts.js +39 -0
  48. package/build/consumer/consts.js.map +1 -0
  49. package/build/consumer/consts.local.d.ts +7 -0
  50. package/build/consumer/consts.local.d.ts.map +1 -0
  51. package/build/consumer/consts.local.js +13 -0
  52. package/build/consumer/consts.local.js.map +1 -0
  53. package/build/consumer/copy/types.d.ts +56 -0
  54. package/build/consumer/copy/types.d.ts.map +1 -0
  55. package/build/consumer/copy/types.js +2 -0
  56. package/build/consumer/copy/types.js.map +1 -0
  57. package/build/consumer/copy.d.ts +22 -0
  58. package/build/consumer/copy.d.ts.map +1 -0
  59. package/build/consumer/copy.js +87 -0
  60. package/build/consumer/copy.js.map +1 -0
  61. package/build/consumer/deadline/types.d.ts +30 -0
  62. package/build/consumer/deadline/types.d.ts.map +1 -0
  63. package/build/consumer/deadline/types.js +2 -0
  64. package/build/consumer/deadline/types.js.map +1 -0
  65. package/build/consumer/deadline.d.ts +12 -0
  66. package/build/consumer/deadline.d.ts.map +1 -0
  67. package/build/consumer/deadline.js +44 -0
  68. package/build/consumer/deadline.js.map +1 -0
  69. package/build/consumer/fifo/types.d.ts +17 -0
  70. package/build/consumer/fifo/types.d.ts.map +1 -0
  71. package/build/consumer/fifo/types.js +2 -0
  72. package/build/consumer/fifo/types.js.map +1 -0
  73. package/build/consumer/fifo.d.ts +4 -0
  74. package/build/consumer/fifo.d.ts.map +1 -0
  75. package/build/consumer/fifo.js +34 -0
  76. package/build/consumer/fifo.js.map +1 -0
  77. package/build/consumer/index.d.ts +18 -0
  78. package/build/consumer/index.d.ts.map +1 -0
  79. package/build/consumer/index.js +11 -0
  80. package/build/consumer/index.js.map +1 -0
  81. package/build/consumer/policy/types.d.ts +20 -0
  82. package/build/consumer/policy/types.d.ts.map +1 -0
  83. package/build/consumer/policy/types.js +2 -0
  84. package/build/consumer/policy/types.js.map +1 -0
  85. package/build/consumer/policy.d.ts +17 -0
  86. package/build/consumer/policy.d.ts.map +1 -0
  87. package/build/consumer/policy.js +91 -0
  88. package/build/consumer/policy.js.map +1 -0
  89. package/build/consumer/protocols.d.ts +20 -0
  90. package/build/consumer/protocols.d.ts.map +1 -0
  91. package/build/consumer/protocols.js +70 -0
  92. package/build/consumer/protocols.js.map +1 -0
  93. package/build/consumer/refund/types.d.ts +27 -0
  94. package/build/consumer/refund/types.d.ts.map +1 -0
  95. package/build/consumer/refund/types.js +2 -0
  96. package/build/consumer/refund/types.js.map +1 -0
  97. package/build/consumer/refund.d.ts +9 -0
  98. package/build/consumer/refund.d.ts.map +1 -0
  99. package/build/consumer/refund.js +112 -0
  100. package/build/consumer/refund.js.map +1 -0
  101. package/build/consumer/refusal.d.ts +10 -0
  102. package/build/consumer/refusal.d.ts.map +1 -0
  103. package/build/consumer/refusal.js +35 -0
  104. package/build/consumer/refusal.js.map +1 -0
  105. package/build/consumer/revive/types.d.ts +19 -0
  106. package/build/consumer/revive/types.d.ts.map +1 -0
  107. package/build/consumer/revive/types.js +2 -0
  108. package/build/consumer/revive/types.js.map +1 -0
  109. package/build/consumer/revive.d.ts +13 -0
  110. package/build/consumer/revive.d.ts.map +1 -0
  111. package/build/consumer/revive.js +43 -0
  112. package/build/consumer/revive.js.map +1 -0
  113. package/build/consumer/types.d.ts +196 -0
  114. package/build/consumer/types.d.ts.map +1 -0
  115. package/build/consumer/types.js +2 -0
  116. package/build/consumer/types.js.map +1 -0
  117. package/build/consumer/types.local.d.ts +11 -0
  118. package/build/consumer/types.local.d.ts.map +1 -0
  119. package/build/consumer/types.local.js +2 -0
  120. package/build/consumer/types.local.js.map +1 -0
  121. package/build/countries.d.ts +3 -0
  122. package/build/countries.d.ts.map +1 -0
  123. package/build/countries.js +4 -0
  124. package/build/countries.js.map +1 -0
  125. package/build/entitled.d.ts +14 -0
  126. package/build/entitled.d.ts.map +1 -0
  127. package/build/entitled.js +17 -0
  128. package/build/entitled.js.map +1 -0
  129. package/build/entitlement/types.d.ts +29 -0
  130. package/build/entitlement/types.d.ts.map +1 -0
  131. package/build/entitlement/types.js +2 -0
  132. package/build/entitlement/types.js.map +1 -0
  133. package/build/entitlement.d.ts +7 -55
  134. package/build/entitlement.d.ts.map +1 -1
  135. package/build/entitlement.js +55 -86
  136. package/build/entitlement.js.map +1 -1
  137. package/build/errors.d.ts +189 -0
  138. package/build/errors.d.ts.map +1 -1
  139. package/build/errors.js +361 -0
  140. package/build/errors.js.map +1 -1
  141. package/build/estimate/types.d.ts +34 -0
  142. package/build/estimate/types.d.ts.map +1 -0
  143. package/build/estimate/types.js +2 -0
  144. package/build/estimate/types.js.map +1 -0
  145. package/build/estimate.d.ts +11 -0
  146. package/build/estimate.d.ts.map +1 -0
  147. package/build/estimate.js +76 -0
  148. package/build/estimate.js.map +1 -0
  149. package/build/i18n/consumer-rights/be.json +131 -0
  150. package/build/i18n/consumer-rights/de.json +131 -0
  151. package/build/i18n/consumer-rights/en.json +131 -0
  152. package/build/i18n/consumer-rights/es.json +131 -0
  153. package/build/i18n/consumer-rights/fr.json +131 -0
  154. package/build/i18n/consumer-rights/pl.json +131 -0
  155. package/build/i18n/consumer-rights/ru.json +131 -0
  156. package/build/i18n/consumer-rights/uk.json +131 -0
  157. package/build/i18n/errors/be.json +30 -0
  158. package/build/i18n/errors/de.json +30 -0
  159. package/build/i18n/errors/en.json +30 -0
  160. package/build/i18n/errors/es.json +30 -0
  161. package/build/i18n/errors/fr.json +30 -0
  162. package/build/i18n/errors/pl.json +30 -0
  163. package/build/i18n/errors/ru.json +30 -0
  164. package/build/i18n/errors/uk.json +30 -0
  165. package/build/i18n/fr.json +39 -0
  166. package/build/i18n.js +53 -8
  167. package/build/i18n.js.map +1 -1
  168. package/build/index.d.ts +18 -1
  169. package/build/index.d.ts.map +1 -1
  170. package/build/index.js +11 -1
  171. package/build/index.js.map +1 -1
  172. package/build/limit/types.d.ts +44 -0
  173. package/build/limit/types.d.ts.map +1 -0
  174. package/build/limit/types.js +2 -0
  175. package/build/limit/types.js.map +1 -0
  176. package/build/limit.d.ts +23 -0
  177. package/build/limit.d.ts.map +1 -0
  178. package/build/limit.js +97 -0
  179. package/build/limit.js.map +1 -0
  180. package/build/model/checkout.d.ts +2 -3
  181. package/build/model/checkout.d.ts.map +1 -1
  182. package/build/model/checkout.js +12 -7
  183. package/build/model/checkout.js.map +1 -1
  184. package/build/model/consts.d.ts +15 -0
  185. package/build/model/consts.d.ts.map +1 -0
  186. package/build/model/consts.js +193 -0
  187. package/build/model/consts.js.map +1 -0
  188. package/build/model/consts.local.d.ts +35 -0
  189. package/build/model/consts.local.d.ts.map +1 -0
  190. package/build/model/consts.local.js +65 -0
  191. package/build/model/consts.local.js.map +1 -0
  192. package/build/model/consumer.d.ts +23 -0
  193. package/build/model/consumer.d.ts.map +1 -0
  194. package/build/model/consumer.js +272 -0
  195. package/build/model/consumer.js.map +1 -0
  196. package/build/model/estimate.d.ts +5 -0
  197. package/build/model/estimate.d.ts.map +1 -0
  198. package/build/model/estimate.js +69 -0
  199. package/build/model/estimate.js.map +1 -0
  200. package/build/model/index.d.ts +7 -2
  201. package/build/model/index.d.ts.map +1 -1
  202. package/build/model/index.js +7 -2
  203. package/build/model/index.js.map +1 -1
  204. package/build/model/limit.d.ts +7 -0
  205. package/build/model/limit.d.ts.map +1 -0
  206. package/build/model/limit.js +32 -0
  207. package/build/model/limit.js.map +1 -0
  208. package/build/model/plan.d.ts.map +1 -1
  209. package/build/model/plan.js +24 -11
  210. package/build/model/plan.js.map +1 -1
  211. package/build/model/portal.d.ts +4 -0
  212. package/build/model/portal.d.ts.map +1 -0
  213. package/build/model/portal.js +22 -0
  214. package/build/model/portal.js.map +1 -0
  215. package/build/model/pricing.d.ts +4 -0
  216. package/build/model/pricing.d.ts.map +1 -0
  217. package/build/model/pricing.js +31 -0
  218. package/build/model/pricing.js.map +1 -0
  219. package/build/model/view.d.ts +3 -0
  220. package/build/model/view.d.ts.map +1 -0
  221. package/build/model/view.js +15 -0
  222. package/build/model/view.js.map +1 -0
  223. package/build/pricing/types.d.ts +13 -0
  224. package/build/pricing/types.d.ts.map +1 -0
  225. package/build/pricing/types.js +2 -0
  226. package/build/pricing/types.js.map +1 -0
  227. package/build/pricing.d.ts +13 -0
  228. package/build/pricing.d.ts.map +1 -0
  229. package/build/pricing.js +74 -0
  230. package/build/pricing.js.map +1 -0
  231. package/build/promo/types.d.ts +14 -0
  232. package/build/promo/types.d.ts.map +1 -0
  233. package/build/promo/types.js +2 -0
  234. package/build/promo/types.js.map +1 -0
  235. package/build/promo.d.ts +7 -0
  236. package/build/promo.d.ts.map +1 -0
  237. package/build/promo.js +25 -0
  238. package/build/promo.js.map +1 -0
  239. package/build/regions/types.d.ts +32 -0
  240. package/build/regions/types.d.ts.map +1 -0
  241. package/build/regions/types.js +2 -0
  242. package/build/regions/types.js.map +1 -0
  243. package/build/regions.d.ts +15 -0
  244. package/build/regions.d.ts.map +1 -0
  245. package/build/regions.js +43 -0
  246. package/build/regions.js.map +1 -0
  247. package/build/service.d.ts.map +1 -1
  248. package/build/service.js +24 -9
  249. package/build/service.js.map +1 -1
  250. package/build/types.d.ts +619 -52
  251. package/build/types.d.ts.map +1 -1
  252. package/build/types.local.d.ts +4 -0
  253. package/build/types.local.d.ts.map +1 -0
  254. package/build/types.local.js +2 -0
  255. package/build/types.local.js.map +1 -0
  256. package/build/view/types.d.ts +33 -0
  257. package/build/view/types.d.ts.map +1 -0
  258. package/build/view/types.js +2 -0
  259. package/build/view/types.js.map +1 -0
  260. package/build/view.d.ts +13 -0
  261. package/build/view.d.ts.map +1 -0
  262. package/build/view.js +78 -0
  263. package/build/view.js.map +1 -0
  264. package/package.json +14 -12
  265. package/src/advertise.ts +13 -0
  266. package/src/checkout/consts.ts +1 -0
  267. package/src/checkout/index.ts +5 -0
  268. package/src/checkout/narrow/types.ts +27 -0
  269. package/src/checkout/narrow.ts +63 -0
  270. package/src/checkout/protocols.ts +39 -0
  271. package/src/checkout/types.ts +27 -0
  272. package/src/consts.local.ts +34 -0
  273. package/src/consts.ts +417 -24
  274. package/src/consumer/cancel.ts +40 -0
  275. package/src/consumer/consts.local.ts +16 -0
  276. package/src/consumer/consts.ts +46 -0
  277. package/src/consumer/copy/types.ts +54 -0
  278. package/src/consumer/copy.ts +121 -0
  279. package/src/consumer/deadline/types.ts +30 -0
  280. package/src/consumer/deadline.ts +61 -0
  281. package/src/consumer/fifo/types.ts +17 -0
  282. package/src/consumer/fifo.ts +42 -0
  283. package/src/consumer/index.ts +17 -0
  284. package/src/consumer/policy/types.ts +20 -0
  285. package/src/consumer/policy.ts +101 -0
  286. package/src/consumer/protocols.ts +116 -0
  287. package/src/consumer/refund/types.ts +27 -0
  288. package/src/consumer/refund.ts +136 -0
  289. package/src/consumer/refusal.ts +35 -0
  290. package/src/consumer/revive/types.ts +23 -0
  291. package/src/consumer/revive.ts +82 -0
  292. package/src/consumer/types.local.ts +10 -0
  293. package/src/consumer/types.ts +189 -0
  294. package/src/countries.ts +5 -0
  295. package/src/entitled.ts +20 -0
  296. package/src/entitlement/types.ts +29 -0
  297. package/src/entitlement.ts +67 -103
  298. package/src/errors.ts +445 -0
  299. package/src/estimate/types.ts +34 -0
  300. package/src/estimate.ts +90 -0
  301. package/src/i18n/consumer-rights/be.json +131 -0
  302. package/src/i18n/consumer-rights/de.json +131 -0
  303. package/src/i18n/consumer-rights/en.json +131 -0
  304. package/src/i18n/consumer-rights/es.json +131 -0
  305. package/src/i18n/consumer-rights/fr.json +131 -0
  306. package/src/i18n/consumer-rights/pl.json +131 -0
  307. package/src/i18n/consumer-rights/ru.json +131 -0
  308. package/src/i18n/consumer-rights/uk.json +131 -0
  309. package/src/i18n/errors/be.json +30 -0
  310. package/src/i18n/errors/de.json +30 -0
  311. package/src/i18n/errors/en.json +30 -0
  312. package/src/i18n/errors/es.json +30 -0
  313. package/src/i18n/errors/fr.json +30 -0
  314. package/src/i18n/errors/pl.json +30 -0
  315. package/src/i18n/errors/ru.json +30 -0
  316. package/src/i18n/errors/uk.json +30 -0
  317. package/src/i18n/fr.json +39 -0
  318. package/src/i18n.ts +58 -8
  319. package/src/index.ts +18 -2
  320. package/src/limit/types.ts +41 -0
  321. package/src/limit.ts +132 -0
  322. package/src/model/checkout.ts +12 -7
  323. package/src/model/consts.local.ts +83 -0
  324. package/src/model/consts.ts +206 -0
  325. package/src/model/consumer.ts +294 -0
  326. package/src/model/estimate.ts +73 -0
  327. package/src/model/index.ts +7 -2
  328. package/src/model/limit.ts +36 -0
  329. package/src/model/plan.ts +25 -12
  330. package/src/model/portal.ts +25 -0
  331. package/src/model/pricing.ts +34 -0
  332. package/src/model/view.ts +17 -0
  333. package/src/pricing/types.ts +13 -0
  334. package/src/pricing.ts +110 -0
  335. package/src/promo/types.ts +18 -0
  336. package/src/promo.ts +46 -0
  337. package/src/regions/types.ts +42 -0
  338. package/src/regions.ts +85 -0
  339. package/src/service.ts +32 -15
  340. package/src/types.local.ts +5 -0
  341. package/src/types.ts +669 -49
  342. package/src/view/types.ts +39 -0
  343. package/src/view.ts +119 -0
  344. package/tests/checkout-narrow.spec.ts +75 -0
  345. package/tests/consumer-copy.spec.ts +378 -0
  346. package/tests/consumer-deadline.spec.ts +85 -0
  347. package/tests/consumer-fifo.spec.ts +61 -0
  348. package/tests/consumer-protocols.spec.ts +103 -0
  349. package/tests/consumer-refund.spec.ts +134 -0
  350. package/tests/consumer-regions.spec.ts +140 -0
  351. package/tests/consumer-wire.spec.ts +170 -0
  352. package/tests/contract.spec.ts +183 -0
  353. package/tests/entitlement.spec.ts +38 -25
  354. package/tests/errors.spec.ts +168 -0
  355. package/tests/estimate.spec.ts +139 -0
  356. package/tests/limit.spec.ts +117 -0
  357. package/tests/pricing.spec.ts +30 -0
  358. package/tests/view.spec.ts +130 -0
  359. package/build/.gitkeep +0 -0
  360. package/src/model/subscription.ts +0 -63
  361. package/src/model/utils.ts +0 -32
  362. package/src/modules.ts +0 -43
  363. package/tests/entitlement.spec.d.ts +0 -2
  364. package/tests/entitlement.spec.d.ts.map +0 -1
  365. package/tests/entitlement.spec.js +0 -72
  366. package/tests/entitlement.spec.js.map +0 -1
@@ -0,0 +1,196 @@
1
+ import type { ConsumerRightsMechanisms, ConsumerRightsPolicy, BillingProfileView, CancellationBody, CancellationReceipt, ConsumerRightsPublicView, DeclarationReceipt, PerformanceConsentBody, PerformanceConsentResponse, PerformanceConsentView, PurchaseList, SubscriptionStartBody, SubscriptionStartQuery, SubscriptionStartResponse, SubscriptionStartView, WithdrawalBody, WithdrawalCandidateList, WithdrawalReceipt, PlanWithdrawalComponent } from '../types.js';
2
+ import type { RouteParent } from '@owlmeans/route';
3
+ import type { EntrypointOptions, EntrypointProtocol, OpenRequest, OpenValue } from '@owlmeans/entrypoint';
4
+ import type { PublicOf } from './types.local.js';
5
+ export type BillingInterval = 'month' | 'year';
6
+ /** A copy bundle: nested keys, string leaves. */
7
+ export interface CopyTree {
8
+ [key: string]: string | CopyTree;
9
+ }
10
+ export type CopyValues = Record<string, string | number>;
11
+ export interface LegalLabels {
12
+ withdrawal: {
13
+ function: string;
14
+ confirm: string;
15
+ };
16
+ cancellation: {
17
+ function: string;
18
+ confirm: string;
19
+ };
20
+ }
21
+ export interface ConsentStatement {
22
+ request: string;
23
+ acknowledgement: string;
24
+ /** The checkbox text: the request and the acknowledgement together. */
25
+ checkbox: string;
26
+ }
27
+ export interface WithdrawalDeadlineRule {
28
+ /** Default 14. */
29
+ days?: number;
30
+ /** A period ending on a Saturday or Sunday ends on the Monday after. Default on. */
31
+ weekendRollover?: boolean;
32
+ /** Whole days added after the rollover, covering public holidays. Default 5. */
33
+ marginDays?: number;
34
+ }
35
+ /** What decides whether a purchase can still be withdrawn from. */
36
+ export interface WithdrawalWindow {
37
+ deadline?: Date | null;
38
+ withdrawnAt?: Date | null;
39
+ refundedAt?: Date | null;
40
+ }
41
+ /** Units granted at one instant — a purchase's credits. */
42
+ export interface FifoLot {
43
+ id: string;
44
+ units: number;
45
+ at: Date;
46
+ }
47
+ /** Units spent at one instant. */
48
+ export interface FifoSpend {
49
+ units: number;
50
+ at: Date;
51
+ }
52
+ /** One lot after allocation, with every slice of it a spend took. */
53
+ export interface FifoLotUsage {
54
+ id: string;
55
+ at: Date;
56
+ granted: number;
57
+ used: number;
58
+ slices: Array<{
59
+ at: Date;
60
+ units: number;
61
+ }>;
62
+ }
63
+ export interface FifoAllocation {
64
+ lots: FifoLotUsage[];
65
+ /** Spent units no lot granted at or before the spend could cover. */
66
+ unallocated: number;
67
+ }
68
+ /** What an application must state itself; everything else defaults. */
69
+ export type ConsumerRightsDeclaration = Partial<Omit<ConsumerRightsPolicy, 'mechanisms' | 'deadline'>> & Pick<ConsumerRightsPolicy, 'textVersion' | 'links'> & {
70
+ mechanisms?: Partial<ConsumerRightsMechanisms>;
71
+ deadline?: Partial<ConsumerRightsPolicy['deadline']>;
72
+ };
73
+ export interface ConsumerRightsPublicOptions {
74
+ /** Default `/public/consumer-rights`. */
75
+ path?: string;
76
+ /** An UNGUARDED parent only — whatever it guards, this subtree inherits. */
77
+ parent?: RouteParent;
78
+ /**
79
+ * Declare the two public frontend screens (sticky, like every legal page): the withdrawal
80
+ * function and the cancellation page. Both or neither.
81
+ */
82
+ screens?: {
83
+ withdrawal?: string;
84
+ cancellation?: string;
85
+ parent?: RouteParent;
86
+ };
87
+ }
88
+ export interface ConsumerRightsProtocolOptions {
89
+ /** Alias prefix of every declaration, e.g. `my-app:account:consumer`. */
90
+ prefix: string;
91
+ /** The application's guarded parent (its account base) — its guards and gate are inherited. */
92
+ parent?: RouteParent;
93
+ /** Guards of a tree mounted without a parent. */
94
+ guards?: EntrypointOptions['guards'];
95
+ gate?: EntrypointOptions['gate'];
96
+ /** Default `/consumer-rights`. */
97
+ path?: string;
98
+ /** The unguarded public subtree; absent or `false` declares none. */
99
+ public?: false | ConsumerRightsPublicOptions;
100
+ }
101
+ /** The guarded account subtree: one entity's own purchases, consents and declarations. */
102
+ export interface ConsumerRightsAccountProtocols {
103
+ base: EntrypointProtocol<OpenRequest, OpenValue>;
104
+ profile: EntrypointProtocol<{}, BillingProfileView>;
105
+ purchases: EntrypointProtocol<{}, PurchaseList>;
106
+ consent: EntrypointProtocol<{}, PerformanceConsentView>;
107
+ giveConsent: EntrypointProtocol<{
108
+ body: PerformanceConsentBody;
109
+ }, PerformanceConsentResponse>;
110
+ start: EntrypointProtocol<{
111
+ query: SubscriptionStartQuery;
112
+ }, SubscriptionStartView>;
113
+ requestStart: EntrypointProtocol<{
114
+ body: SubscriptionStartBody;
115
+ }, SubscriptionStartResponse>;
116
+ withdrawals: EntrypointProtocol<{}, WithdrawalCandidateList>;
117
+ withdraw: EntrypointProtocol<{
118
+ body: WithdrawalBody;
119
+ }, WithdrawalReceipt>;
120
+ cancel: EntrypointProtocol<{
121
+ body: CancellationBody;
122
+ }, CancellationReceipt>;
123
+ }
124
+ export interface ConsumerRightsScreens {
125
+ withdrawal: EntrypointProtocol<OpenRequest, OpenValue>;
126
+ cancellation: EntrypointProtocol<OpenRequest, OpenValue>;
127
+ }
128
+ /**
129
+ * The unguarded public subtree: reachable WITHOUT a login (§ 312k BGB). Its receipts carry only
130
+ * what was declared and when — never whether a contract matched.
131
+ */
132
+ export interface ConsumerRightsPublicProtocols {
133
+ base: EntrypointProtocol<OpenRequest, OpenValue>;
134
+ policy: EntrypointProtocol<{}, ConsumerRightsPublicView>;
135
+ withdraw: EntrypointProtocol<{
136
+ body: WithdrawalBody;
137
+ }, DeclarationReceipt>;
138
+ cancel: EntrypointProtocol<{
139
+ body: CancellationBody;
140
+ }, DeclarationReceipt>;
141
+ }
142
+ /** The tree for given options — `public` (and its `screens`) present only when declared. */
143
+ export type ConsumerRightsProtocols<O extends ConsumerRightsProtocolOptions = ConsumerRightsProtocolOptions> = O['public'] extends ConsumerRightsPublicOptions ? ConsumerRightsAccountProtocols & {
144
+ public: PublicOf<O['public']>;
145
+ } : ConsumerRightsAccountProtocols;
146
+ export interface OneTimeRefundInput {
147
+ paidMinor: number;
148
+ /** Already refunded (an earlier partial refund); the refund never exceeds the rest. */
149
+ refundedMinor?: number;
150
+ unitsGranted: number;
151
+ /** Units used AFTER consent — before it, the consumer bears no cost. Clamped to `0..granted`. */
152
+ unitsUsed: number;
153
+ }
154
+ export interface OneTimeRefund {
155
+ refundMinor: number;
156
+ /** The share of the purchase that is unused: `(granted − used) / granted`. */
157
+ netRatio: number;
158
+ /** The unused units a withdrawal takes back. */
159
+ unitsReturned: number;
160
+ }
161
+ export interface SubscriptionRefundInput {
162
+ paidMinor: number;
163
+ refundedMinor?: number;
164
+ /** The price net of tax — the base the components split and the deductions come from. */
165
+ netMinor: number;
166
+ /** Absent or empty: the whole price is one `time` component. */
167
+ components?: PlanWithdrawalComponent[];
168
+ periodStart: Date;
169
+ periodEnd: Date;
170
+ /** When the consumer expressly requested the services. None: no time deduction at all. */
171
+ servicesRequestedAt?: Date | null;
172
+ withdrawnAt: Date;
173
+ /** Units granted with the purchase and used after consent — applied to every `units` component. */
174
+ units?: {
175
+ granted: number;
176
+ used: number;
177
+ } | null;
178
+ }
179
+ export interface SubscriptionRefundComponent extends PlanWithdrawalComponent {
180
+ /** The component's part of `netMinor`. */
181
+ amountMinor: number;
182
+ deductionMinor: number;
183
+ }
184
+ export interface SubscriptionRefund {
185
+ /** Gross (tax-inclusive) refund, capped at what is still unrefunded. */
186
+ refundMinor: number;
187
+ refundNetMinor: number;
188
+ timeDeductionMinor: number;
189
+ unitsDeductionMinor: number;
190
+ elapsedDays: number;
191
+ periodDays: number;
192
+ unitsUsed?: number;
193
+ unitsGranted?: number;
194
+ components: SubscriptionRefundComponent[];
195
+ }
196
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/consumer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wB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EAAE,MAAM,CAAA;IACnB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yFAAyF;IACzF,QAAQ,EAAE,MAAM,CAAA;IAChB,gEAAgE;IAChE,UAAU,CAAC,EAAE,uBAAuB,EAAE,CAAA;IACtC,WAAW,EAAE,IAAI,CAAA;IACjB,SAAS,EAAE,IAAI,CAAA;IACf,0FAA0F;IAC1F,mBAAmB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACjC,WAAW,EAAE,IAAI,CAAA;IACjB,mGAAmG;IACnG,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACjD;AAED,MAAM,WAAW,2BAA4B,SAAQ,uBAAuB;IAC1E,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,2BAA2B,EAAE,CAAA;CAC1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/consumer/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { ConsumerRightsPolicy } from '../types.js';
2
+ import type { ConsumerRightsPublicProtocols, ConsumerRightsScreens } from './types.js';
3
+ export interface DeadlinePolicy extends Pick<ConsumerRightsPolicy, 'withdrawalDays' | 'deadline'> {
4
+ }
5
+ export type PublicOf<P> = P extends {
6
+ screens: object;
7
+ } ? ConsumerRightsPublicProtocols & {
8
+ screens: ConsumerRightsScreens;
9
+ } : ConsumerRightsPublicProtocols;
10
+ export type Dated = Record<string, unknown>;
11
+ //# sourceMappingURL=types.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.local.d.ts","sourceRoot":"","sources":["../../src/consumer/types.local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEtF,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,GAAG,UAAU,CAAC;CAAG;AAEpG,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnD,6BAA6B,GAAG;IAAE,OAAO,EAAE,qBAAqB,CAAA;CAAE,GAClE,6BAA6B,CAAA;AAEjC,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.local.js","sourceRoot":"","sources":["../../src/consumer/types.local.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** The lowercase ISO 4217 currency of a country, or `null` when this map has no entry for it. */
2
+ export declare const currencyOfCountry: (country: string) => string | null;
3
+ //# sourceMappingURL=countries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../src/countries.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,YAAa,MAAM,KAAG,MAAM,GAAG,IACV,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { COUNTRY_CURRENCIES } from './consts.js';
2
+ /** The lowercase ISO 4217 currency of a country, or `null` when this map has no entry for it. */
3
+ export const currencyOfCountry = (country) => COUNTRY_CURRENCIES[country.toUpperCase()] ?? null;
4
+ //# sourceMappingURL=countries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countries.js","sourceRoot":"","sources":["../src/countries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,iGAAiG;AACjG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAiB,EAAE,CAClE,kBAAkB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { EntrypointOptions } from '@owlmeans/entrypoint';
2
+ /**
3
+ * Declare that an entrypoint needs a paid capability.
4
+ *
5
+ * Compatibility sugar over the protocol option
6
+ * `{ gate: { alias: ENTITLEMENT_GATE, params } }` so a route reads as what it means. Several
7
+ * parameters are OR'd, matching every other gate in the framework.
8
+ *
9
+ * Putting the requirement HERE rather than in a handler is the point: the framework asserts a gate
10
+ * before the handler is entered, so the route table states what a feature costs and no new
11
+ * endpoint can forget to check.
12
+ */
13
+ export declare const entitled: (params: string | string[], opts?: EntrypointOptions) => EntrypointOptions;
14
+ //# sourceMappingURL=entitled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitled.d.ts","sourceRoot":"","sources":["../src/entitled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAG7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,WACX,MAAM,GAAG,MAAM,EAAE,SAAS,iBAAiB,KAClD,iBAGD,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { ENTITLEMENT_GATE } from './consts.js';
2
+ /**
3
+ * Declare that an entrypoint needs a paid capability.
4
+ *
5
+ * Compatibility sugar over the protocol option
6
+ * `{ gate: { alias: ENTITLEMENT_GATE, params } }` so a route reads as what it means. Several
7
+ * parameters are OR'd, matching every other gate in the framework.
8
+ *
9
+ * Putting the requirement HERE rather than in a handler is the point: the framework asserts a gate
10
+ * before the handler is entered, so the route table states what a feature costs and no new
11
+ * endpoint can forget to check.
12
+ */
13
+ export const entitled = (params, opts) => ({
14
+ ...opts,
15
+ gate: { alias: ENTITLEMENT_GATE, params },
16
+ });
17
+ //# sourceMappingURL=entitled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitled.js","sourceRoot":"","sources":["../src/entitled.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,MAAyB,EAAE,IAAwB,EAChC,EAAE,CAAC,CAAC;IACvB,GAAG,IAAI;IACP,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE;CAC1C,CAAC,CAAA"}
@@ -0,0 +1,29 @@
1
+ import type { PermissionSet } from '@owlmeans/auth';
2
+ import type { EntitlementParam } from '../types.js';
3
+ /** The entitlement parameter grammar and the capability predicate the server gate and the browser share. */
4
+ export interface EntitlementParamHelper {
5
+ /**
6
+ * Grammar: `[<scope>:]<permission>[>=<n>]`.
7
+ *
8
+ * `feature:branding--whitelabel` · `renewable:credits>=100` · `production--standalone`
9
+ *
10
+ * `@` is deliberately not part of it: that is `@owlmeans/iam`'s resource-selector syntax, and a
11
+ * grammar that reused it would make two different things look the same in a route declaration.
12
+ */
13
+ parseEntitlementParam: (param: string) => EntitlementParam;
14
+ formatEntitlementParam: (parsed: EntitlementParam) => string;
15
+ /**
16
+ * Whether a union of capability sets satisfies one requirement.
17
+ *
18
+ * Pure, and shared by the server gate and the browser: the UI has to know whether to render a
19
+ * control disabled, and a second implementation of the rule for the client would eventually
20
+ * disagree with the one that actually refuses.
21
+ *
22
+ * A malformed parameter answers `false` rather than throwing. A gate that crashed on a typo would
23
+ * take down the endpoint it guards, which is a strictly worse failure than refusing it.
24
+ */
25
+ hasEntitlement: (capabilities: PermissionSet[] | undefined, param: string) => boolean;
26
+ /** Everything a union grants, formatted back into parameters. The wire shape of a client read. */
27
+ entitlementList: (capabilities: PermissionSet[] | undefined) => string[];
28
+ }
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/entitlement/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,4GAA4G;AAC5G,MAAM,WAAW,sBAAsB;IACrC;;;;;;;OAOG;IACH,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,gBAAgB,CAAA;IAC1D,sBAAsB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,MAAM,CAAA;IAC5D;;;;;;;;;OASG;IACH,cAAc,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACrF,kGAAkG;IAClG,eAAe,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,GAAG,SAAS,KAAK,MAAM,EAAE,CAAA;CACzE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/entitlement/types.ts"],"names":[],"mappings":""}
@@ -1,60 +1,12 @@
1
- import type { CommonEntrypointOptions } from '@owlmeans/entrypoint';
2
1
  import type { PermissionSet } from '@owlmeans/auth';
3
- /**
4
- * The gate alias a paid capability is asserted under.
5
- *
6
- * Distinct from `paymentGate.base` (a ROUTE id) and from the gateway service alias — three
7
- * different things that would otherwise all be called "payment gate".
8
- */
9
- export declare const ENTITLEMENT_GATE = "entitlement-gate";
10
- /**
11
- * The capability scope that carries FEATURE flags.
12
- *
13
- * Kept apart from `renewable`, which carries numeric quotas that are consumed or counted. Merging
14
- * them would make "has one production slot left" and "may remove the platform credit" the same
15
- * number, and the first purchase that spent the quota would take the feature with it.
16
- */
17
- export declare const CAPABILITY_FEATURE_SCOPE = "feature";
18
- export interface EntitlementParam {
19
- /** Capability scope. Absent means any scope. */
20
- scope?: string;
21
- /** The permission key inside `PermissionSet.permissions`. */
22
- permission: string;
23
- /** Numeric floor: `credits>=100` passes when the held value is a number at least that big. */
24
- atLeast?: number;
25
- }
26
- /**
27
- * Grammar: `[<scope>:]<permission>[>=<n>]`.
28
- *
29
- * `feature:branding--whitelabel` · `renewable:credits>=100` · `production--standalone`
30
- *
31
- * `@` is deliberately not part of it: that is `@owlmeans/iam`'s resource-selector syntax, and a
32
- * grammar that reused it would make two different things look the same in a route declaration.
33
- */
2
+ import type { EntitlementParam } from './types.js';
3
+ import type { EntitlementParamHelper } from './entitlement/types.js';
4
+ export declare const createEntitlementParamHelper: () => EntitlementParamHelper;
5
+ export declare const entitlementParamHelper: EntitlementParamHelper;
6
+ /** @deprecated compat:factory-refactor — use `entitlementParamHelper.parseEntitlementParam(…)` */
34
7
  export declare const parseEntitlementParam: (param: string) => EntitlementParam;
8
+ /** @deprecated compat:factory-refactor — use `entitlementParamHelper.formatEntitlementParam(…)` */
35
9
  export declare const formatEntitlementParam: (parsed: EntitlementParam) => string;
36
- /**
37
- * Whether a union of capability sets satisfies one requirement.
38
- *
39
- * Pure, and shared by the server gate and the browser: the UI has to know whether to render a
40
- * control disabled, and a second implementation of the rule for the client would eventually
41
- * disagree with the one that actually refuses.
42
- *
43
- * A malformed parameter answers `false` rather than throwing. A gate that crashed on a typo would
44
- * take down the endpoint it guards, which is a strictly worse failure than refusing it.
45
- */
10
+ /** @deprecated compat:factory-refactor — use `entitlementParamHelper.hasEntitlement(…)` */
46
11
  export declare const hasEntitlement: (capabilities: PermissionSet[] | undefined, param: string) => boolean;
47
- /** Everything a union grants, formatted back into parameters. The wire shape of a client read. */
48
- export declare const entitlementList: (capabilities: PermissionSet[] | undefined) => string[];
49
- /**
50
- * Declare that an entrypoint needs a paid capability.
51
- *
52
- * Sugar over `gate(ENTITLEMENT_GATE, params)` so a route reads as what it means. Several
53
- * parameters are OR'd, matching every other gate in the framework.
54
- *
55
- * Putting the requirement HERE rather than in a handler is the point: the framework asserts a gate
56
- * before the handler is entered, so the route table states what a feature costs and no new
57
- * endpoint can forget to check.
58
- */
59
- export declare const entitled: (params: string | string[], opts?: CommonEntrypointOptions) => CommonEntrypointOptions;
60
12
  //# sourceMappingURL=entitlement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entitlement.d.ts","sourceRoot":"","sources":["../src/entitlement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,YAAY,CAAA;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAA;IAClB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,UAAW,MAAM,KAAG,gBAerD,CAAA;AAED,eAAO,MAAM,sBAAsB,WAAY,gBAAgB,KAAG,MAER,CAAA;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,iBACX,aAAa,EAAE,GAAG,SAAS,SAAS,MAAM,KACvD,OAqBF,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,eAAe,iBAAkB,aAAa,EAAE,GAAG,SAAS,KAAG,MAAM,EAYjF,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,WACX,MAAM,GAAG,MAAM,EAAE,SAAS,uBAAuB,KACxD,uBAA+D,CAAA"}
1
+ {"version":3,"file":"entitlement.d.ts","sourceRoot":"","sources":["../src/entitlement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAEpE,eAAO,MAAM,4BAA4B,QAAO,sBAkE/C,CAAA;AAED,eAAO,MAAM,sBAAsB,wBAAiC,CAAA;AAEpE,kGAAkG;AAClG,eAAO,MAAM,qBAAqB,UAAW,MAAM,KAAG,gBACD,CAAA;AAErD,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,WAAY,gBAAgB,KAAG,MACX,CAAA;AAEvD,2FAA2F;AAC3F,eAAO,MAAM,cAAc,iBAAkB,aAAa,EAAE,GAAG,SAAS,SAAS,MAAM,KAAG,OAC9B,CAAA"}
@@ -1,95 +1,64 @@
1
- import { gate } from '@owlmeans/entrypoint';
2
- /**
3
- * The gate alias a paid capability is asserted under.
4
- *
5
- * Distinct from `paymentGate.base` (a ROUTE id) and from the gateway service alias — three
6
- * different things that would otherwise all be called "payment gate".
7
- */
8
- export const ENTITLEMENT_GATE = 'entitlement-gate';
9
- /**
10
- * The capability scope that carries FEATURE flags.
11
- *
12
- * Kept apart from `renewable`, which carries numeric quotas that are consumed or counted. Merging
13
- * them would make "has one production slot left" and "may remove the platform credit" the same
14
- * number, and the first purchase that spent the quota would take the feature with it.
15
- */
16
- export const CAPABILITY_FEATURE_SCOPE = 'feature';
17
- /**
18
- * Grammar: `[<scope>:]<permission>[>=<n>]`.
19
- *
20
- * `feature:branding--whitelabel` · `renewable:credits>=100` · `production--standalone`
21
- *
22
- * `@` is deliberately not part of it: that is `@owlmeans/iam`'s resource-selector syntax, and a
23
- * grammar that reused it would make two different things look the same in a route declaration.
24
- */
25
- export const parseEntitlementParam = (param) => {
26
- const [scoped, floor] = param.split('>=');
27
- const colon = scoped.indexOf(':');
28
- const parsed = colon >= 0
29
- ? { scope: scoped.slice(0, colon), permission: scoped.slice(colon + 1) }
30
- : { permission: scoped };
31
- if (floor != null) {
32
- const value = Number.parseFloat(floor);
33
- if (!Number.isNaN(value)) {
34
- parsed.atLeast = value;
1
+ import { CAPABILITY_LIMIT_SCOPE } from './consts.js';
2
+ export const createEntitlementParamHelper = () => {
3
+ const parseEntitlementParam = (param) => {
4
+ const [scoped, floor] = param.split('>=');
5
+ const colon = scoped.indexOf(':');
6
+ const parsed = colon >= 0
7
+ ? { scope: scoped.slice(0, colon), permission: scoped.slice(colon + 1) }
8
+ : { permission: scoped };
9
+ if (floor != null) {
10
+ const value = Number.parseFloat(floor);
11
+ if (!Number.isNaN(value)) {
12
+ parsed.atLeast = value;
13
+ }
35
14
  }
36
- }
37
- return parsed;
38
- };
39
- export const formatEntitlementParam = (parsed) => `${parsed.scope != null ? `${parsed.scope}:` : ''}${parsed.permission}` +
40
- `${parsed.atLeast != null ? `>=${parsed.atLeast}` : ''}`;
41
- /**
42
- * Whether a union of capability sets satisfies one requirement.
43
- *
44
- * Pure, and shared by the server gate and the browser: the UI has to know whether to render a
45
- * control disabled, and a second implementation of the rule for the client would eventually
46
- * disagree with the one that actually refuses.
47
- *
48
- * A malformed parameter answers `false` rather than throwing. A gate that crashed on a typo would
49
- * take down the endpoint it guards, which is a strictly worse failure than refusing it.
50
- */
51
- export const hasEntitlement = (capabilities, param) => {
52
- if (capabilities == null || capabilities.length < 1) {
53
- return false;
54
- }
55
- const { scope, permission, atLeast } = parseEntitlementParam(param);
56
- if (permission === '') {
57
- return false;
58
- }
59
- return capabilities.some(set => {
60
- if (scope != null && set.scope !== scope) {
15
+ return parsed;
16
+ };
17
+ const formatEntitlementParam = (parsed) => `${parsed.scope != null ? `${parsed.scope}:` : ''}${parsed.permission}` +
18
+ `${parsed.atLeast != null ? `>=${parsed.atLeast}` : ''}`;
19
+ const hasEntitlement = (capabilities, param) => {
20
+ if (capabilities == null || capabilities.length < 1) {
61
21
  return false;
62
22
  }
63
- const held = set.permissions?.[permission];
64
- if (held == null || held === false) {
23
+ if (typeof param !== 'string') {
65
24
  return false;
66
25
  }
67
- // A floor is a numeric question: a boolean flag, however true, does not answer it.
68
- return atLeast != null ? typeof held === 'number' && held >= atLeast : true;
69
- });
70
- };
71
- /** Everything a union grants, formatted back into parameters. The wire shape of a client read. */
72
- export const entitlementList = (capabilities) => {
73
- const list = [];
74
- for (const set of capabilities ?? []) {
75
- for (const [permission, value] of Object.entries(set.permissions ?? {})) {
76
- if (value == null || value === false) {
77
- continue;
26
+ const { scope, permission, atLeast } = parseEntitlementParam(param);
27
+ // A limit is never a capability: its room is counted, not granted.
28
+ if (permission === '' || scope === CAPABILITY_LIMIT_SCOPE) {
29
+ return false;
30
+ }
31
+ return capabilities.some(set => {
32
+ if (scope != null && set.scope !== scope) {
33
+ return false;
34
+ }
35
+ const held = set.permissions?.[permission];
36
+ if (held == null || held === false) {
37
+ return false;
38
+ }
39
+ // A floor is a numeric question: a boolean flag, however true, does not answer it.
40
+ return atLeast != null ? typeof held === 'number' && held >= atLeast : true;
41
+ });
42
+ };
43
+ const entitlementList = (capabilities) => {
44
+ const list = [];
45
+ for (const set of capabilities ?? []) {
46
+ for (const [permission, value] of Object.entries(set.permissions ?? {})) {
47
+ if (value == null || value === false) {
48
+ continue;
49
+ }
50
+ list.push(formatEntitlementParam({ scope: set.scope, permission }));
78
51
  }
79
- list.push(formatEntitlementParam({ scope: set.scope, permission }));
80
52
  }
81
- }
82
- return [...new Set(list)];
53
+ return [...new Set(list)];
54
+ };
55
+ return { parseEntitlementParam, formatEntitlementParam, hasEntitlement, entitlementList };
83
56
  };
84
- /**
85
- * Declare that an entrypoint needs a paid capability.
86
- *
87
- * Sugar over `gate(ENTITLEMENT_GATE, params)` so a route reads as what it means. Several
88
- * parameters are OR'd, matching every other gate in the framework.
89
- *
90
- * Putting the requirement HERE rather than in a handler is the point: the framework asserts a gate
91
- * before the handler is entered, so the route table states what a feature costs and no new
92
- * endpoint can forget to check.
93
- */
94
- export const entitled = (params, opts) => gate(ENTITLEMENT_GATE, params, opts);
57
+ export const entitlementParamHelper = createEntitlementParamHelper();
58
+ /** @deprecated compat:factory-refactor — use `entitlementParamHelper.parseEntitlementParam(…)` */
59
+ export const parseEntitlementParam = (param) => entitlementParamHelper.parseEntitlementParam(param);
60
+ /** @deprecated compat:factory-refactor — use `entitlementParamHelper.formatEntitlementParam(…)` */
61
+ export const formatEntitlementParam = (parsed) => entitlementParamHelper.formatEntitlementParam(parsed);
62
+ /** @deprecated compat:factory-refactor — use `entitlementParamHelper.hasEntitlement(…)` */
63
+ export const hasEntitlement = (capabilities, param) => entitlementParamHelper.hasEntitlement(capabilities, param);
95
64
  //# sourceMappingURL=entitlement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entitlement.js","sourceRoot":"","sources":["../src/entitlement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAI3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAA;AAWjD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAoB,EAAE;IACvE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,MAAM,C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