@owlmeans/payment 0.1.18-rc.8 → 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 (364) 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 +12 -0
  134. package/build/entitlement.d.ts.map +1 -0
  135. package/build/entitlement.js +64 -0
  136. package/build/entitlement.js.map +1 -0
  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 +19 -1
  169. package/build/index.d.ts.map +1 -1
  170. package/build/index.js +12 -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 +86 -0
  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 +19 -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 +103 -0
  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/tsconfig.json +11 -0
  359. package/tests/view.spec.ts +130 -0
  360. package/tsconfig.json +6 -1
  361. package/build/.gitkeep +0 -0
  362. package/src/model/subscription.ts +0 -63
  363. package/src/model/utils.ts +0 -32
  364. package/src/modules.ts +0 -43
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,44 @@
1
+ import type { LimitKind, LimitWindow } from '../consts.js';
2
+ import type { EntitlementView, LimitParam, LimitView } from '../types.js';
3
+ /** The limit windows, the limit gate's parameter, and the questions a view answers about limits. */
4
+ export interface PlanLimitHelper {
5
+ /**
6
+ * The key of the counter window `at` falls into — calendar UTC or seven days from the subscription anchor.
7
+ *
8
+ * `'lifetime'` · `'occupancy'` · `'YYYY-MM'` (month) · `'YYYY-MM-DD'` (day).
9
+ *
10
+ * @throws LimitMisdeclared for a window limit without a known window, or an unknown kind.
11
+ */
12
+ windowKeyOf: (kind: LimitKind, window?: LimitWindow | null, at?: Date, anchor?: Date) => string;
13
+ /**
14
+ * The calendar UTC or anchored subscription window `at` falls into: `start` inclusive, `resetsAt` exclusive (the first
15
+ * instant of the next window).
16
+ *
17
+ * @throws LimitMisdeclared for an unknown window.
18
+ */
19
+ windowBoundsOf: (window: LimitWindow, at?: Date, anchor?: Date) => {
20
+ start: Date;
21
+ resetsAt: Date;
22
+ };
23
+ /** `limit:<key>` · `limit:<key>>=<n>` — the parameter the limit gate takes. */
24
+ formatLimitParam: (key: string, atLeast?: number) => string;
25
+ /**
26
+ * Read a limit parameter: `limit:<key>[>=n]`.
27
+ *
28
+ * `null` for anything else — a capability parameter, a bare key, an empty key, a floor that is not
29
+ * a positive number. Never throws: a gate that crashed on a typo would take down the endpoint it
30
+ * guards.
31
+ */
32
+ parseLimitParam: (param: string) => LimitParam | null;
33
+ /** Whether a limit has room for `atLeast` more. No limit is no room. */
34
+ hasLimitRoom: (limit: LimitView | null | undefined, atLeast?: number) => boolean;
35
+ /** One limit of a view, by key. */
36
+ limitOf: (view: EntitlementView | null | undefined, key: string) => LimitView | null;
37
+ /**
38
+ * Whether a view grants a capability parameter — the same predicate as the capability gate
39
+ * (`hasEntitlement`), over the view's GRANTED capabilities. A `limit:` parameter is never a
40
+ * capability and answers `false`.
41
+ */
42
+ capabilityOf: (view: EntitlementView | null | undefined, param: string) => boolean;
43
+ }
44
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/limit/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEzE,oGAAoG;AACpG,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,KAAK,MAAM,CAAA;IAC/F;;;;;OAKG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,KAAK;QAAE,KAAK,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE,CAAA;IAClG,+EAA+E;IAC/E,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAC3D;;;;;;OAMG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,CAAA;IACrD,wEAAwE;IACxE,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;IAChF,mCAAmC;IACnC,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,SAAS,GAAG,IAAI,CAAA;IACpF;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;CACnF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/limit/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import { LimitKind, LimitWindow } from './consts.js';
2
+ import type { EntitlementView, LimitView, LimitParam } from './types.js';
3
+ import type { PlanLimitHelper } from './limit/types.js';
4
+ export declare const createPlanLimitHelper: () => PlanLimitHelper;
5
+ export declare const planLimitHelper: PlanLimitHelper;
6
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.windowKeyOf(…)` */
7
+ export declare const windowKeyOf: (kind: LimitKind, window?: LimitWindow | null, at?: Date, anchor?: Date) => string;
8
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.windowBoundsOf(…)` */
9
+ export declare const windowBoundsOf: (window: LimitWindow, at?: Date, anchor?: Date) => {
10
+ start: Date;
11
+ resetsAt: Date;
12
+ };
13
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.formatLimitParam(…)` */
14
+ export declare const formatLimitParam: (key: string, atLeast?: number) => string;
15
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.parseLimitParam(…)` */
16
+ export declare const parseLimitParam: (param: string) => LimitParam | null;
17
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.hasLimitRoom(…)` */
18
+ export declare const hasLimitRoom: (limit: LimitView | null | undefined, atLeast?: number) => boolean;
19
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.limitOf(…)` */
20
+ export declare const limitOf: (view: EntitlementView | null | undefined, key: string) => LimitView | null;
21
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.capabilityOf(…)` */
22
+ export declare const capabilityOf: (view: EntitlementView | null | undefined, param: string) => boolean;
23
+ //# sourceMappingURL=limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limit.d.ts","sourceRoot":"","sources":["../src/limit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAA6G,MAAM,aAAa,CAAA;AAG/J,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAExE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAIvD,eAAO,MAAM,qBAAqB,QAAO,eA6FxC,CAAA;AAED,eAAO,MAAM,eAAe,iBAA0B,CAAA;AAEtD,iFAAiF;AACjF,eAAO,MAAM,WAAW,SAAU,SAAS,WAAW,WAAW,GAAG,IAAI,OAAO,IAAI,WAAW,IAAI,KAAG,MAC9C,CAAA;AAEvD,oFAAoF;AACpF,eAAO,MAAM,cAAc,WAAY,WAAW,OAAO,IAAI,WAAW,IAAI,KAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,IAAI,CAAA;CACxD,CAAA;AAEpD,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,QAAS,MAAM,YAAY,MAAM,KAAG,MACjB,CAAA;AAEhD,qFAAqF;AACrF,eAAO,MAAM,eAAe,UAAW,MAAM,KAAG,UAAU,GAAG,IAA8C,CAAA;AAE3G,kFAAkF;AAClF,eAAO,MAAM,YAAY,UAAW,SAAS,GAAG,IAAI,GAAG,SAAS,YAAY,MAAM,KAAG,OACvC,CAAA;AAE9C,6EAA6E;AAC7E,eAAO,MAAM,OAAO,SAAU,eAAe,GAAG,IAAI,GAAG,SAAS,OAAO,MAAM,KAAG,SAAS,GAAG,IACxD,CAAA;AAEpC,kFAAkF;AAClF,eAAO,MAAM,YAAY,SAAU,eAAe,GAAG,IAAI,GAAG,SAAS,SAAS,MAAM,KAAG,OAC5C,CAAA"}
package/build/limit.js ADDED
@@ -0,0 +1,97 @@
1
+ import { LimitKind, LimitWindow, CAPABILITY_LIMIT_SCOPE, LIFETIME_WINDOW, OCCUPANCY_WINDOW, SUBSCRIPTION_WEEK_MS, SUBSCRIPTION_WEEK_PREFIX } from './consts.js';
2
+ import { entitlementParamHelper } from './entitlement.js';
3
+ import { LimitMisdeclared } from './errors.js';
4
+ const pad = (value) => String(value).padStart(2, '0');
5
+ export const createPlanLimitHelper = () => {
6
+ const windowKeyOf = (kind, window, at = new Date(), anchor) => {
7
+ switch (kind) {
8
+ case LimitKind.Lifetime:
9
+ return LIFETIME_WINDOW;
10
+ case LimitKind.Occupancy:
11
+ return OCCUPANCY_WINDOW;
12
+ case LimitKind.Window: {
13
+ const month = `${at.getUTCFullYear()}-${pad(at.getUTCMonth() + 1)}`;
14
+ switch (window) {
15
+ case LimitWindow.SubscriptionWeek:
16
+ return `${SUBSCRIPTION_WEEK_PREFIX}${windowBoundsOf(window, at, anchor).start.toISOString()}`;
17
+ case LimitWindow.Month:
18
+ return month;
19
+ case LimitWindow.Day:
20
+ return `${month}-${pad(at.getUTCDate())}`;
21
+ }
22
+ throw new LimitMisdeclared(`window:${window ?? 'missing'}`);
23
+ }
24
+ }
25
+ throw new LimitMisdeclared(`kind:${kind}`);
26
+ };
27
+ const windowBoundsOf = (window, at = new Date(), anchor) => {
28
+ const year = at.getUTCFullYear();
29
+ const month = at.getUTCMonth();
30
+ switch (window) {
31
+ case LimitWindow.SubscriptionWeek: {
32
+ const origin = anchor?.getTime();
33
+ if (origin == null || !Number.isFinite(origin) || !Number.isFinite(at.getTime())) {
34
+ throw new LimitMisdeclared('subscription-week:anchor');
35
+ }
36
+ const start = new Date(origin + Math.floor((at.getTime() - origin) / SUBSCRIPTION_WEEK_MS) * SUBSCRIPTION_WEEK_MS);
37
+ return { start, resetsAt: new Date(start.getTime() + SUBSCRIPTION_WEEK_MS) };
38
+ }
39
+ case LimitWindow.Month:
40
+ return { start: new Date(Date.UTC(year, month, 1)), resetsAt: new Date(Date.UTC(year, month + 1, 1)) };
41
+ case LimitWindow.Day: {
42
+ const day = at.getUTCDate();
43
+ return {
44
+ start: new Date(Date.UTC(year, month, day)), resetsAt: new Date(Date.UTC(year, month, day + 1)),
45
+ };
46
+ }
47
+ }
48
+ throw new LimitMisdeclared(`window:${window}`);
49
+ };
50
+ const formatLimitParam = (key, atLeast) => entitlementParamHelper.formatEntitlementParam({ scope: CAPABILITY_LIMIT_SCOPE, permission: key, atLeast });
51
+ const parseLimitParam = (param) => {
52
+ if (typeof param !== 'string') {
53
+ return null;
54
+ }
55
+ const parsed = entitlementParamHelper.parseEntitlementParam(param);
56
+ if (parsed.scope !== CAPABILITY_LIMIT_SCOPE || parsed.permission === '') {
57
+ return null;
58
+ }
59
+ const atLeast = parsed.atLeast ?? 1;
60
+ if (!Number.isFinite(atLeast) || atLeast <= 0) {
61
+ return null;
62
+ }
63
+ return { key: parsed.permission, atLeast };
64
+ };
65
+ const hasLimitRoom = (limit, atLeast = 1) => limit != null && limit.remaining >= atLeast;
66
+ const limitOf = (view, key) => view?.limits.find(limit => limit.key === key) ?? null;
67
+ const capabilityOf = (view, param) => {
68
+ if (view == null) {
69
+ return false;
70
+ }
71
+ // One set per row, so two grants of one permission are two chances — exactly as the declared
72
+ // sets they were built from.
73
+ const sets = view.capabilities
74
+ .filter(capability => capability.granted)
75
+ .map(capability => ({
76
+ scope: capability.scope, permissions: { [capability.permission]: capability.value },
77
+ }));
78
+ return entitlementParamHelper.hasEntitlement(sets, param);
79
+ };
80
+ return { windowKeyOf, windowBoundsOf, formatLimitParam, parseLimitParam, hasLimitRoom, limitOf, capabilityOf };
81
+ };
82
+ export const planLimitHelper = createPlanLimitHelper();
83
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.windowKeyOf(…)` */
84
+ export const windowKeyOf = (kind, window, at, anchor) => planLimitHelper.windowKeyOf(kind, window, at, anchor);
85
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.windowBoundsOf(…)` */
86
+ export const windowBoundsOf = (window, at, anchor) => planLimitHelper.windowBoundsOf(window, at, anchor);
87
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.formatLimitParam(…)` */
88
+ export const formatLimitParam = (key, atLeast) => planLimitHelper.formatLimitParam(key, atLeast);
89
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.parseLimitParam(…)` */
90
+ export const parseLimitParam = (param) => planLimitHelper.parseLimitParam(param);
91
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.hasLimitRoom(…)` */
92
+ export const hasLimitRoom = (limit, atLeast) => planLimitHelper.hasLimitRoom(limit, atLeast);
93
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.limitOf(…)` */
94
+ export const limitOf = (view, key) => planLimitHelper.limitOf(view, key);
95
+ /** @deprecated compat:factory-refactor — use `planLimitHelper.capabilityOf(…)` */
96
+ export const capabilityOf = (view, param) => planLimitHelper.capabilityOf(view, param);
97
+ //# sourceMappingURL=limit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limit.js","sourceRoot":"","sources":["../src/limit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,sBAAsB,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAC/J,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAK9C,MAAM,GAAG,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAoB,EAAE;IACzD,MAAM,WAAW,GAAG,CAClB,IAAe,EAAE,MAA2B,EAAE,EAAE,GAAS,IAAI,IAAI,EAAE,EAAE,MAAa,EAC1E,EAAE;QACV,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,SAAS,CAAC,QAAQ;gBACrB,OAAO,eAAe,CAAA;YACxB,KAAK,SAAS,CAAC,SAAS;gBACtB,OAAO,gBAAgB,CAAA;YACzB,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;gBACtB,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,cAAc,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,EAAE,CAAA;gBACnE,QAAQ,MAAM,EAAE,CAAC;oBACf,KAAK,WAAW,CAAC,gBAAgB;wBAC/B,OAAO,GAAG,wBAAwB,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAA;oBAC/F,KAAK,WAAW,CAAC,KAAK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';
2
1
  import type { CreateCheckoutBody, CreateCheckoutResponse } from '../types.js';
3
- export declare const CreateCheckoutBodySchema: JSONSchemaType<CreateCheckoutBody>;
4
- export declare const CreateCheckoutResponseSchema: JSONSchemaType<CreateCheckoutResponse>;
2
+ export declare const CreateCheckoutBodySchema: import("@owlmeans/entrypoint").EntrypointSchema<CreateCheckoutBody>;
3
+ export declare const CreateCheckoutResponseSchema: import("@owlmeans/entrypoint").EntrypointSchema<CreateCheckoutResponse>;
5
4
  //# sourceMappingURL=checkout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/model/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAG7E,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,kBAAkB,CAavE,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,cAAc,CAAC,sBAAsB,CAO/E,CAAA"}
1
+ {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/model/checkout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAK7E,eAAO,MAAM,wBAAwB,qEAgBG,CAAA;AAExC,eAAO,MAAM,4BAA4B,yEAOG,CAAA"}
@@ -1,24 +1,29 @@
1
1
  import { ResourceValueSchema, EntityValueSchema, IdValueSchema } from '@owlmeans/auth';
2
- export const CreateCheckoutBodySchema = {
2
+ import { schema } from '@owlmeans/entrypoint';
3
+ import { CountrySchema } from '../consts.js';
4
+ export const CreateCheckoutBodySchema = schema({
3
5
  type: 'object',
4
6
  properties: {
5
7
  productSku: ResourceValueSchema,
6
- sku: { ...ResourceValueSchema, nullable: true },
7
- entityId: EntityValueSchema,
8
+ planSku: { ...ResourceValueSchema, nullable: true },
9
+ entitySlug: EntityValueSchema,
8
10
  service: { ...ResourceValueSchema, minLength: 2 },
11
+ amountMinor: { type: 'number', minimum: 0, multipleOf: 1, nullable: true },
9
12
  subscriptionId: { ...IdValueSchema, nullable: true },
10
13
  successUrl: { ...ResourceValueSchema, minLength: 1, nullable: true },
11
14
  cancelUrl: { ...ResourceValueSchema, minLength: 1, nullable: true },
15
+ country: { ...CountrySchema, nullable: true },
16
+ startRequestId: { ...IdValueSchema, nullable: true },
12
17
  },
13
- required: ['productSku', 'entityId', 'service'],
18
+ required: ['productSku', 'entitySlug', 'service'],
14
19
  additionalProperties: false,
15
- };
16
- export const CreateCheckoutResponseSchema = {
20
+ });
21
+ export const CreateCheckoutResponseSchema = schema({
17
22
  type: 'object',
18
23
  properties: {
19
24
  url: { type: 'string', minLength: 1 },
20
25
  },
21
26
  required: ['url'],
22
27
  additionalProperties: false,
23
- };
28
+ });
24
29
  //# sourceMappingURL=checkout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/model/checkout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEtF,MAAM,CAAC,MAAM,wBAAwB,GAAuC;IAC1E,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,UAAU,EAAE,mBAAmB;QAC/B,GAAG,EAAE,EAAE,GAAG,mBAAmB,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/C,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,EAAE,GAAG,mBAAmB,EAAE,SAAS,EAAE,CAAC,EAAE;QACjD,cAAc,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QACpD,UAAU,EAAE,EAAE,GAAG,mBAAmB,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACpE,SAAS,EAAE,EAAE,GAAG,mBAAmB,EAAE,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,EAAE,GAAG,mBAAmB,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnE,OAAO,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7C,cAAc,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;KACrD;IACD,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC;IACjD,oBAAoB,EAAE,KAAK;CACU,CAAC,CAAA;AAExC,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAyB;IACzE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;KACtC;IACD,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,oBAAoB,EAAE,KAAK;CACc,CAAC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { JSONSchemaType } from 'ajv';
2
+ import type { CheckoutLimitView, ConsumerRightsLinks, ConsumerRightsMechanisms, PlanPriceView, PlanWithdrawalComponent, PurchaseView, WithdrawalCandidate, WithdrawalEstimate, CapabilityView, EntitlementPlanView, LimitView, PromoView } from '../types.js';
3
+ export declare const ConsumerRightsLinksSchema: JSONSchemaType<ConsumerRightsLinks>;
4
+ export declare const ConsumerRightsMechanismsSchema: JSONSchemaType<ConsumerRightsMechanisms>;
5
+ export declare const PlanWithdrawalComponentSchema: JSONSchemaType<PlanWithdrawalComponent>;
6
+ export declare const PurchaseViewSchema: JSONSchemaType<PurchaseView>;
7
+ export declare const WithdrawalEstimateSchema: JSONSchemaType<WithdrawalEstimate>;
8
+ export declare const WithdrawalCandidateSchema: JSONSchemaType<WithdrawalCandidate>;
9
+ export declare const CheckoutLimitViewSchema: JSONSchemaType<CheckoutLimitView>;
10
+ export declare const PlanPriceViewSchema: JSONSchemaType<PlanPriceView>;
11
+ export declare const PromoViewSchema: JSONSchemaType<PromoView>;
12
+ export declare const CapabilityViewSchema: JSONSchemaType<CapabilityView>;
13
+ export declare const LimitViewSchema: JSONSchemaType<LimitView>;
14
+ export declare const EntitlementPlanViewSchema: JSONSchemaType<EntitlementPlanView>;
15
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/model/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,aAAa,EAAE,uBAAuB,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAK7P,eAAO,MAAM,yBAAyB,EAAE,cAAc,CAAC,mBAAmB,CAWzE,CAAA;AAED,eAAO,MAAM,8BAA8B,EAAE,cAAc,CAAC,wBAAwB,CAiBnF,CAAA;AAED,eAAO,MAAM,6BAA6B,EAAE,cAAc,CAAC,uBAAuB,CASjF,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAoB3D,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,kBAAkB,CAcvE,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,cAAc,CAAC,mBAAmB,CAkBvB,CAAA;AAEnD,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAAC,iBAAiB,CAgBrE,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,aAAa,CAY5B,CAAA;AAElC,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,SAAS,CASrD,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,cAAc,CAYlB,CAAA;AAE9C,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,SAAS,CAiBxB,CAAA;AAE9B,eAAO,MAAM,yBAAyB,EAAE,cAAc,CAAC,mBAAmB,CAsBlC,CAAA"}
@@ -0,0 +1,193 @@
1
+ import { IdValueSchema } from '@owlmeans/auth';
2
+ import { PurchaseKindSchema, TaxBehaviorSchema, LimitKindSchema, LimitWindowSchema, SubscriptionStatusSchema } from '../consts.js';
3
+ import { CurrencySchema, IsoDateSchema, KeySchema, MinorSchema, UrlSchema } from './consts.local.js';
4
+ export const ConsumerRightsLinksSchema = {
5
+ type: 'object',
6
+ properties: {
7
+ billingTerms: UrlSchema,
8
+ withdrawalInformation: { ...UrlSchema, nullable: true },
9
+ withdrawalForm: { ...UrlSchema, nullable: true },
10
+ withdrawalFunction: { ...UrlSchema, nullable: true },
11
+ cancellation: { ...UrlSchema, nullable: true },
12
+ },
13
+ required: ['billingTerms'],
14
+ additionalProperties: false,
15
+ };
16
+ export const ConsumerRightsMechanismsSchema = {
17
+ type: 'object',
18
+ properties: {
19
+ countryLock: { type: 'boolean' },
20
+ checkoutTerms: { type: 'boolean' },
21
+ performanceConsent: { type: 'boolean' },
22
+ subscriptionStart: { type: 'boolean' },
23
+ withdrawal: { type: 'boolean' },
24
+ automaticRefunds: { type: 'boolean' },
25
+ cancellation: { type: 'boolean' },
26
+ purchaseConfirmation: { type: 'boolean' },
27
+ },
28
+ required: [
29
+ 'countryLock', 'checkoutTerms', 'performanceConsent', 'subscriptionStart', 'withdrawal', 'automaticRefunds',
30
+ 'cancellation', 'purchaseConfirmation',
31
+ ],
32
+ additionalProperties: false,
33
+ };
34
+ export const PlanWithdrawalComponentSchema = {
35
+ type: 'object',
36
+ properties: {
37
+ key: KeySchema,
38
+ basis: { type: 'string', enum: ['time', 'units'] },
39
+ shareMinor: MinorSchema,
40
+ },
41
+ required: ['key', 'basis', 'shareMinor'],
42
+ additionalProperties: false,
43
+ };
44
+ export const PurchaseViewSchema = {
45
+ type: 'object',
46
+ properties: {
47
+ purchaseId: IdValueSchema,
48
+ contractRef: IdValueSchema,
49
+ kind: PurchaseKindSchema,
50
+ purchasedAt: IsoDateSchema,
51
+ deadline: { ...IsoDateSchema, nullable: true },
52
+ productSku: KeySchema,
53
+ planSku: { ...KeySchema, nullable: true },
54
+ amountTotalMinor: MinorSchema,
55
+ currency: CurrencySchema,
56
+ consentedAt: { ...IsoDateSchema, nullable: true },
57
+ withdrawnAt: { ...IsoDateSchema, nullable: true },
58
+ withdrawable: { type: 'boolean' },
59
+ },
60
+ required: [
61
+ 'purchaseId', 'contractRef', 'kind', 'purchasedAt', 'productSku', 'amountTotalMinor', 'currency', 'withdrawable',
62
+ ],
63
+ additionalProperties: false,
64
+ };
65
+ export const WithdrawalEstimateSchema = {
66
+ type: 'object',
67
+ properties: {
68
+ refundMinor: MinorSchema,
69
+ currency: CurrencySchema,
70
+ timeDeductionMinor: MinorSchema,
71
+ unitsDeductionMinor: MinorSchema,
72
+ elapsedDays: { ...MinorSchema, nullable: true },
73
+ periodDays: { ...MinorSchema, nullable: true },
74
+ unitsUsed: { type: 'number', minimum: 0, nullable: true },
75
+ unitsGranted: { type: 'number', minimum: 0, nullable: true },
76
+ },
77
+ required: ['refundMinor', 'currency', 'timeDeductionMinor', 'unitsDeductionMinor'],
78
+ additionalProperties: false,
79
+ };
80
+ export const WithdrawalCandidateSchema = {
81
+ type: 'object',
82
+ properties: {
83
+ purchaseId: IdValueSchema,
84
+ contractRef: IdValueSchema,
85
+ kind: PurchaseKindSchema,
86
+ purchasedAt: IsoDateSchema,
87
+ deadline: IsoDateSchema,
88
+ amountTotalMinor: MinorSchema,
89
+ currency: CurrencySchema,
90
+ estimate: { ...WithdrawalEstimateSchema, nullable: true },
91
+ automatic: { type: 'boolean' },
92
+ },
93
+ required: [
94
+ 'purchaseId', 'contractRef', 'kind', 'purchasedAt', 'deadline', 'amountTotalMinor', 'currency', 'estimate',
95
+ 'automatic',
96
+ ],
97
+ additionalProperties: false,
98
+ };
99
+ export const CheckoutLimitViewSchema = {
100
+ type: 'object',
101
+ properties: {
102
+ productSku: { type: 'string', maxLength: 128 },
103
+ planSku: { ...KeySchema, nullable: true },
104
+ currency: CurrencySchema,
105
+ minimumMinor: MinorSchema,
106
+ maximumMinor: MinorSchema,
107
+ narrowed: { type: 'boolean' },
108
+ blocked: { type: 'boolean' },
109
+ reason: { ...KeySchema, nullable: true },
110
+ resetsAt: { ...IsoDateSchema, nullable: true },
111
+ remainingMinor: { ...MinorSchema, nullable: true },
112
+ },
113
+ required: ['productSku', 'currency', 'minimumMinor', 'maximumMinor', 'narrowed', 'blocked'],
114
+ additionalProperties: false,
115
+ };
116
+ export const PlanPriceViewSchema = {
117
+ type: 'object',
118
+ properties: {
119
+ planSku: KeySchema,
120
+ currency: CurrencySchema,
121
+ unitAmountMinor: MinorSchema,
122
+ default: { type: 'boolean' },
123
+ taxBehavior: { ...TaxBehaviorSchema, nullable: true },
124
+ interval: { type: 'string', enum: ['month', 'year'], nullable: true },
125
+ },
126
+ required: ['planSku', 'currency', 'unitAmountMinor', 'default'],
127
+ additionalProperties: false,
128
+ };
129
+ export const PromoViewSchema = {
130
+ type: 'object',
131
+ properties: {
132
+ until: IsoDateSchema,
133
+ grandfathered: { type: 'boolean' },
134
+ active: { type: 'boolean' },
135
+ },
136
+ required: ['until', 'grandfathered', 'active'],
137
+ additionalProperties: false,
138
+ };
139
+ export const CapabilityViewSchema = {
140
+ type: 'object',
141
+ properties: {
142
+ param: KeySchema,
143
+ scope: KeySchema,
144
+ permission: KeySchema,
145
+ value: { type: ['boolean', 'number'] },
146
+ granted: { type: 'boolean' },
147
+ promo: { ...PromoViewSchema, nullable: true },
148
+ },
149
+ required: ['param', 'scope', 'permission', 'value', 'granted'],
150
+ additionalProperties: false,
151
+ };
152
+ export const LimitViewSchema = {
153
+ type: 'object',
154
+ properties: {
155
+ key: KeySchema,
156
+ param: KeySchema,
157
+ kind: LimitKindSchema,
158
+ window: { ...LimitWindowSchema, nullable: true },
159
+ limit: { type: 'number' },
160
+ used: { type: 'number' },
161
+ remaining: { type: 'number' },
162
+ windowStart: { ...IsoDateSchema, nullable: true },
163
+ resetsAt: { ...IsoDateSchema, nullable: true },
164
+ unit: { type: 'string', nullable: true },
165
+ promo: { ...PromoViewSchema, nullable: true },
166
+ },
167
+ required: ['key', 'param', 'kind', 'limit', 'used', 'remaining'],
168
+ additionalProperties: false,
169
+ };
170
+ export const EntitlementPlanViewSchema = {
171
+ type: 'object',
172
+ properties: {
173
+ sku: KeySchema,
174
+ productSku: KeySchema,
175
+ title: { type: 'string' },
176
+ rank: { type: 'number' },
177
+ free: { type: 'boolean' },
178
+ status: SubscriptionStatusSchema,
179
+ paygate: KeySchema,
180
+ subscriptionId: { type: 'string', nullable: true },
181
+ subscribedAt: { ...IsoDateSchema, nullable: true },
182
+ periodStart: { ...IsoDateSchema, nullable: true },
183
+ periodEnd: { ...IsoDateSchema, nullable: true },
184
+ cancelAtPeriodEnd: { type: 'boolean', nullable: true },
185
+ trialEnd: { ...IsoDateSchema, nullable: true },
186
+ pausedAt: { ...IsoDateSchema, nullable: true },
187
+ pastDue: { type: 'boolean', nullable: true },
188
+ fallbackSku: { type: 'string', nullable: true },
189
+ },
190
+ required: ['sku', 'productSku', 'title', 'rank', 'free', 'status', 'paygate'],
191
+ additionalProperties: false,
192
+ };
193
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/model/consts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAClI,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAEpG,MAAM,CAAC,MAAM,yBAAyB,GAAwC;IAC5E,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,YAAY,EA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emas describe the WIRE: a date is an ISO string, exactly as in
6
+ * `model/view.ts` — a response serializer writes a `Date` through it as ISO. A browser revives the
7
+ * dates with the `revive*` helpers before touching one.
8
+ */
9
+ export declare const IsoDateSchema: JSONSchemaType<Date>;
10
+ export declare const MinorSchema: JSONSchemaType<number>;
11
+ export declare const CurrencySchema: JSONSchemaType<string>;
12
+ export declare const VersionSchema: JSONSchemaType<string>;
13
+ export declare const KeySchema: JSONSchemaType<string>;
14
+ export declare const UrlSchema: JSONSchemaType<string>;
15
+ export declare const LanguageSchema: JSONSchemaType<string>;
16
+ export declare const NameSchema: JSONSchemaType<string>;
17
+ export declare const EmailSchema: JSONSchemaType<string>;
18
+ export declare const HoneypotSchema: JSONSchemaType<string>;
19
+ /** A copy variant suffix: `performance-consent.request_<context>`, `subscription-start.request_units`. */
20
+ export declare const ConsentContextSchema: JSONSchemaType<string>;
21
+ export declare const AcknowledgedSchema: JSONSchemaType<true>;
22
+ export declare const ReceiptContentSchema: JSONSchemaType<Record<string, string>>;
23
+ export declare const declarationReceiptProperties: {
24
+ declarationId: JSONSchemaType<string>;
25
+ receivedAt: JSONSchemaType<Date>;
26
+ content: JSONSchemaType<Record<string, string>>;
27
+ mailed: {
28
+ type: string;
29
+ };
30
+ };
31
+ export declare const TaxRateEstimateSchema: JSONSchemaType<TaxRateEstimate>;
32
+ export declare const TaxEstimateSchema: JSONSchemaType<TaxEstimate>;
33
+ /** A region that may be `null` on the wire — an enum admits `null` only when it lists it. */
34
+ export declare const NullableRegionSchema: JSONSchemaType<ConsumerRegion | null>;
35
+ //# sourceMappingURL=consts.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../../src/model/consts.local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAyD,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
1
+ import { IdValueSchema } from '@owlmeans/auth';
2
+ import { TaxEstimateStatusSchema, TaxTypeSchema, CountrySchema, ConsumerRegionSchema } from '../consts.js';
3
+ /**
4
+ * The consumer-rights schemas describe the WIRE: a date is an ISO string, exactly as in
5
+ * `model/view.ts` — a response serializer writes a `Date` through it as ISO. A browser revives the
6
+ * dates with the `revive*` helpers before touching one.
7
+ */
8
+ export const IsoDateSchema = { type: 'string', format: 'date-time' };
9
+ export const MinorSchema = { type: 'number', minimum: 0, multipleOf: 1 };
10
+ export const CurrencySchema = { type: 'string', minLength: 3, maxLength: 3 };
11
+ export const VersionSchema = { type: 'string', minLength: 1, maxLength: 64 };
12
+ export const KeySchema = { type: 'string', minLength: 1, maxLength: 128 };
13
+ export const UrlSchema = { type: 'string', minLength: 1, maxLength: 2048 };
14
+ export const LanguageSchema = {
15
+ type: 'string', minLength: 2, maxLength: 16, pattern: '^[a-z]{2,3}([-_][A-Za-z0-9]{2,8})?$',
16
+ };
17
+ export const NameSchema = { type: 'string', minLength: 1, maxLength: 200 };
18
+ export const EmailSchema = {
19
+ type: 'string', minLength: 3, maxLength: 254, pattern: '^[^\\s@]+@[^\\s@]+$',
20
+ };
21
+ export const HoneypotSchema = { type: 'string', maxLength: 256 };
22
+ /** A copy variant suffix: `performance-consent.request_<context>`, `subscription-start.request_units`. */
23
+ export const ConsentContextSchema = {
24
+ type: 'string', minLength: 1, maxLength: 64, pattern: '^[a-z][a-z0-9-]*$',
25
+ };
26
+ export const AcknowledgedSchema = { type: 'boolean', const: true };
27
+ export const ReceiptContentSchema = {
28
+ type: 'object', required: [], additionalProperties: { type: 'string', maxLength: 4096 },
29
+ };
30
+ export const declarationReceiptProperties = {
31
+ declarationId: IdValueSchema,
32
+ receivedAt: IsoDateSchema,
33
+ content: ReceiptContentSchema,
34
+ mailed: { type: 'boolean' },
35
+ };
36
+ export const TaxRateEstimateSchema = {
37
+ type: 'object',
38
+ properties: {
39
+ type: TaxTypeSchema,
40
+ percentage: { type: 'string', minLength: 1, maxLength: 16 },
41
+ ratePpm: { type: 'number', minimum: 0, multipleOf: 1 },
42
+ country: { ...CountrySchema, nullable: true },
43
+ state: { type: 'string', minLength: 1, maxLength: 8, nullable: true },
44
+ },
45
+ required: ['type', 'percentage', 'ratePpm'],
46
+ additionalProperties: false,
47
+ };
48
+ export const TaxEstimateSchema = {
49
+ type: 'object',
50
+ properties: {
51
+ status: TaxEstimateStatusSchema,
52
+ subtotalMinor: { type: 'number', minimum: 0, multipleOf: 1 },
53
+ taxMinor: { type: 'number', minimum: 0, multipleOf: 1 },
54
+ totalMinor: { type: 'number', minimum: 0, multipleOf: 1 },
55
+ scalable: { type: 'boolean' },
56
+ rates: { type: 'array', items: TaxRateEstimateSchema },
57
+ },
58
+ required: ['status', 'subtotalMinor', 'taxMinor', 'totalMinor', 'scalable', 'rates'],
59
+ additionalProperties: false,
60
+ };
61
+ /** A region that may be `null` on the wire — an enum admits `null` only when it lists it. */
62
+ export const NullableRegionSchema = {
63
+ ...ConsumerRegionSchema, enum: [...ConsumerRegionSchema.enum, null], nullable: true,
64
+ };
65
+ //# sourceMappingURL=consts.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/model/consts.local.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,aAAa,EAAkB,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAE1H;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAqC,CAAA;AAEvG,MAAM,CAAC,MAAM,WAAW,GAA2B,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAA;AAEhG,MAAM,CAAC,MAAM,cAAc,GAA2B,EAAE,IAAI,EAAE,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