@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.
- package/README.md +95 -57
- package/agent-meta/manifest.json +10 -3
- package/agent-meta/skills/entitlements/SKILL.md +159 -0
- package/agent-meta/skills/payment/SKILL.md +491 -28
- package/build/advertise.d.ts +2 -0
- package/build/advertise.d.ts.map +1 -0
- package/build/advertise.js +10 -0
- package/build/advertise.js.map +1 -0
- package/build/checkout/consts.d.ts +2 -0
- package/build/checkout/consts.d.ts.map +1 -0
- package/build/checkout/consts.js +2 -0
- package/build/checkout/consts.js.map +1 -0
- package/build/checkout/index.d.ts +6 -0
- package/build/checkout/index.d.ts.map +1 -0
- package/build/checkout/index.js +4 -0
- package/build/checkout/index.js.map +1 -0
- package/build/checkout/narrow/types.d.ts +25 -0
- package/build/checkout/narrow/types.d.ts.map +1 -0
- package/build/checkout/narrow/types.js +2 -0
- package/build/checkout/narrow/types.js.map +1 -0
- package/build/checkout/narrow.d.ts +8 -0
- package/build/checkout/narrow.d.ts.map +1 -0
- package/build/checkout/narrow.js +47 -0
- package/build/checkout/narrow.js.map +1 -0
- package/build/checkout/protocols.d.ts +8 -0
- package/build/checkout/protocols.d.ts.map +1 -0
- package/build/checkout/protocols.js +28 -0
- package/build/checkout/protocols.js.map +1 -0
- package/build/checkout/types.d.ts +29 -0
- package/build/checkout/types.d.ts.map +1 -0
- package/build/checkout/types.js +2 -0
- package/build/checkout/types.js.map +1 -0
- package/build/consts.d.ts +242 -25
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +377 -24
- package/build/consts.js.map +1 -1
- package/build/consts.local.d.ts +20 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +23 -0
- package/build/consts.local.js.map +1 -0
- package/build/consumer/cancel.d.ts +11 -0
- package/build/consumer/cancel.d.ts.map +1 -0
- package/build/consumer/cancel.js +33 -0
- package/build/consumer/cancel.js.map +1 -0
- package/build/consumer/consts.d.ts +20 -0
- package/build/consumer/consts.d.ts.map +1 -0
- package/build/consumer/consts.js +39 -0
- package/build/consumer/consts.js.map +1 -0
- package/build/consumer/consts.local.d.ts +7 -0
- package/build/consumer/consts.local.d.ts.map +1 -0
- package/build/consumer/consts.local.js +13 -0
- package/build/consumer/consts.local.js.map +1 -0
- package/build/consumer/copy/types.d.ts +56 -0
- package/build/consumer/copy/types.d.ts.map +1 -0
- package/build/consumer/copy/types.js +2 -0
- package/build/consumer/copy/types.js.map +1 -0
- package/build/consumer/copy.d.ts +22 -0
- package/build/consumer/copy.d.ts.map +1 -0
- package/build/consumer/copy.js +87 -0
- package/build/consumer/copy.js.map +1 -0
- package/build/consumer/deadline/types.d.ts +30 -0
- package/build/consumer/deadline/types.d.ts.map +1 -0
- package/build/consumer/deadline/types.js +2 -0
- package/build/consumer/deadline/types.js.map +1 -0
- package/build/consumer/deadline.d.ts +12 -0
- package/build/consumer/deadline.d.ts.map +1 -0
- package/build/consumer/deadline.js +44 -0
- package/build/consumer/deadline.js.map +1 -0
- package/build/consumer/fifo/types.d.ts +17 -0
- package/build/consumer/fifo/types.d.ts.map +1 -0
- package/build/consumer/fifo/types.js +2 -0
- package/build/consumer/fifo/types.js.map +1 -0
- package/build/consumer/fifo.d.ts +4 -0
- package/build/consumer/fifo.d.ts.map +1 -0
- package/build/consumer/fifo.js +34 -0
- package/build/consumer/fifo.js.map +1 -0
- package/build/consumer/index.d.ts +18 -0
- package/build/consumer/index.d.ts.map +1 -0
- package/build/consumer/index.js +11 -0
- package/build/consumer/index.js.map +1 -0
- package/build/consumer/policy/types.d.ts +20 -0
- package/build/consumer/policy/types.d.ts.map +1 -0
- package/build/consumer/policy/types.js +2 -0
- package/build/consumer/policy/types.js.map +1 -0
- package/build/consumer/policy.d.ts +17 -0
- package/build/consumer/policy.d.ts.map +1 -0
- package/build/consumer/policy.js +91 -0
- package/build/consumer/policy.js.map +1 -0
- package/build/consumer/protocols.d.ts +20 -0
- package/build/consumer/protocols.d.ts.map +1 -0
- package/build/consumer/protocols.js +70 -0
- package/build/consumer/protocols.js.map +1 -0
- package/build/consumer/refund/types.d.ts +27 -0
- package/build/consumer/refund/types.d.ts.map +1 -0
- package/build/consumer/refund/types.js +2 -0
- package/build/consumer/refund/types.js.map +1 -0
- package/build/consumer/refund.d.ts +9 -0
- package/build/consumer/refund.d.ts.map +1 -0
- package/build/consumer/refund.js +112 -0
- package/build/consumer/refund.js.map +1 -0
- package/build/consumer/refusal.d.ts +10 -0
- package/build/consumer/refusal.d.ts.map +1 -0
- package/build/consumer/refusal.js +35 -0
- package/build/consumer/refusal.js.map +1 -0
- package/build/consumer/revive/types.d.ts +19 -0
- package/build/consumer/revive/types.d.ts.map +1 -0
- package/build/consumer/revive/types.js +2 -0
- package/build/consumer/revive/types.js.map +1 -0
- package/build/consumer/revive.d.ts +13 -0
- package/build/consumer/revive.d.ts.map +1 -0
- package/build/consumer/revive.js +43 -0
- package/build/consumer/revive.js.map +1 -0
- package/build/consumer/types.d.ts +196 -0
- package/build/consumer/types.d.ts.map +1 -0
- package/build/consumer/types.js +2 -0
- package/build/consumer/types.js.map +1 -0
- package/build/consumer/types.local.d.ts +11 -0
- package/build/consumer/types.local.d.ts.map +1 -0
- package/build/consumer/types.local.js +2 -0
- package/build/consumer/types.local.js.map +1 -0
- package/build/countries.d.ts +3 -0
- package/build/countries.d.ts.map +1 -0
- package/build/countries.js +4 -0
- package/build/countries.js.map +1 -0
- package/build/entitled.d.ts +14 -0
- package/build/entitled.d.ts.map +1 -0
- package/build/entitled.js +17 -0
- package/build/entitled.js.map +1 -0
- package/build/entitlement/types.d.ts +29 -0
- package/build/entitlement/types.d.ts.map +1 -0
- package/build/entitlement/types.js +2 -0
- package/build/entitlement/types.js.map +1 -0
- package/build/entitlement.d.ts +12 -0
- package/build/entitlement.d.ts.map +1 -0
- package/build/entitlement.js +64 -0
- package/build/entitlement.js.map +1 -0
- package/build/errors.d.ts +189 -0
- package/build/errors.d.ts.map +1 -1
- package/build/errors.js +361 -0
- package/build/errors.js.map +1 -1
- package/build/estimate/types.d.ts +34 -0
- package/build/estimate/types.d.ts.map +1 -0
- package/build/estimate/types.js +2 -0
- package/build/estimate/types.js.map +1 -0
- package/build/estimate.d.ts +11 -0
- package/build/estimate.d.ts.map +1 -0
- package/build/estimate.js +76 -0
- package/build/estimate.js.map +1 -0
- package/build/i18n/consumer-rights/be.json +131 -0
- package/build/i18n/consumer-rights/de.json +131 -0
- package/build/i18n/consumer-rights/en.json +131 -0
- package/build/i18n/consumer-rights/es.json +131 -0
- package/build/i18n/consumer-rights/fr.json +131 -0
- package/build/i18n/consumer-rights/pl.json +131 -0
- package/build/i18n/consumer-rights/ru.json +131 -0
- package/build/i18n/consumer-rights/uk.json +131 -0
- package/build/i18n/errors/be.json +30 -0
- package/build/i18n/errors/de.json +30 -0
- package/build/i18n/errors/en.json +30 -0
- package/build/i18n/errors/es.json +30 -0
- package/build/i18n/errors/fr.json +30 -0
- package/build/i18n/errors/pl.json +30 -0
- package/build/i18n/errors/ru.json +30 -0
- package/build/i18n/errors/uk.json +30 -0
- package/build/i18n/fr.json +39 -0
- package/build/i18n.js +53 -8
- package/build/i18n.js.map +1 -1
- package/build/index.d.ts +19 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +12 -1
- package/build/index.js.map +1 -1
- package/build/limit/types.d.ts +44 -0
- package/build/limit/types.d.ts.map +1 -0
- package/build/limit/types.js +2 -0
- package/build/limit/types.js.map +1 -0
- package/build/limit.d.ts +23 -0
- package/build/limit.d.ts.map +1 -0
- package/build/limit.js +97 -0
- package/build/limit.js.map +1 -0
- package/build/model/checkout.d.ts +2 -3
- package/build/model/checkout.d.ts.map +1 -1
- package/build/model/checkout.js +12 -7
- package/build/model/checkout.js.map +1 -1
- package/build/model/consts.d.ts +15 -0
- package/build/model/consts.d.ts.map +1 -0
- package/build/model/consts.js +193 -0
- package/build/model/consts.js.map +1 -0
- package/build/model/consts.local.d.ts +35 -0
- package/build/model/consts.local.d.ts.map +1 -0
- package/build/model/consts.local.js +65 -0
- package/build/model/consts.local.js.map +1 -0
- package/build/model/consumer.d.ts +23 -0
- package/build/model/consumer.d.ts.map +1 -0
- package/build/model/consumer.js +272 -0
- package/build/model/consumer.js.map +1 -0
- package/build/model/estimate.d.ts +5 -0
- package/build/model/estimate.d.ts.map +1 -0
- package/build/model/estimate.js +69 -0
- package/build/model/estimate.js.map +1 -0
- package/build/model/index.d.ts +7 -2
- package/build/model/index.d.ts.map +1 -1
- package/build/model/index.js +7 -2
- package/build/model/index.js.map +1 -1
- package/build/model/limit.d.ts +7 -0
- package/build/model/limit.d.ts.map +1 -0
- package/build/model/limit.js +32 -0
- package/build/model/limit.js.map +1 -0
- package/build/model/plan.d.ts.map +1 -1
- package/build/model/plan.js +24 -11
- package/build/model/plan.js.map +1 -1
- package/build/model/portal.d.ts +4 -0
- package/build/model/portal.d.ts.map +1 -0
- package/build/model/portal.js +22 -0
- package/build/model/portal.js.map +1 -0
- package/build/model/pricing.d.ts +4 -0
- package/build/model/pricing.d.ts.map +1 -0
- package/build/model/pricing.js +31 -0
- package/build/model/pricing.js.map +1 -0
- package/build/model/view.d.ts +3 -0
- package/build/model/view.d.ts.map +1 -0
- package/build/model/view.js +15 -0
- package/build/model/view.js.map +1 -0
- package/build/pricing/types.d.ts +13 -0
- package/build/pricing/types.d.ts.map +1 -0
- package/build/pricing/types.js +2 -0
- package/build/pricing/types.js.map +1 -0
- package/build/pricing.d.ts +13 -0
- package/build/pricing.d.ts.map +1 -0
- package/build/pricing.js +74 -0
- package/build/pricing.js.map +1 -0
- package/build/promo/types.d.ts +14 -0
- package/build/promo/types.d.ts.map +1 -0
- package/build/promo/types.js +2 -0
- package/build/promo/types.js.map +1 -0
- package/build/promo.d.ts +7 -0
- package/build/promo.d.ts.map +1 -0
- package/build/promo.js +25 -0
- package/build/promo.js.map +1 -0
- package/build/regions/types.d.ts +32 -0
- package/build/regions/types.d.ts.map +1 -0
- package/build/regions/types.js +2 -0
- package/build/regions/types.js.map +1 -0
- package/build/regions.d.ts +15 -0
- package/build/regions.d.ts.map +1 -0
- package/build/regions.js +43 -0
- package/build/regions.js.map +1 -0
- package/build/service.d.ts.map +1 -1
- package/build/service.js +24 -9
- package/build/service.js.map +1 -1
- package/build/types.d.ts +619 -52
- package/build/types.d.ts.map +1 -1
- package/build/types.local.d.ts +4 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/build/view/types.d.ts +33 -0
- package/build/view/types.d.ts.map +1 -0
- package/build/view/types.js +2 -0
- package/build/view/types.js.map +1 -0
- package/build/view.d.ts +13 -0
- package/build/view.d.ts.map +1 -0
- package/build/view.js +78 -0
- package/build/view.js.map +1 -0
- package/package.json +14 -12
- package/src/advertise.ts +13 -0
- package/src/checkout/consts.ts +1 -0
- package/src/checkout/index.ts +5 -0
- package/src/checkout/narrow/types.ts +27 -0
- package/src/checkout/narrow.ts +63 -0
- package/src/checkout/protocols.ts +39 -0
- package/src/checkout/types.ts +27 -0
- package/src/consts.local.ts +34 -0
- package/src/consts.ts +417 -24
- package/src/consumer/cancel.ts +40 -0
- package/src/consumer/consts.local.ts +16 -0
- package/src/consumer/consts.ts +46 -0
- package/src/consumer/copy/types.ts +54 -0
- package/src/consumer/copy.ts +121 -0
- package/src/consumer/deadline/types.ts +30 -0
- package/src/consumer/deadline.ts +61 -0
- package/src/consumer/fifo/types.ts +17 -0
- package/src/consumer/fifo.ts +42 -0
- package/src/consumer/index.ts +17 -0
- package/src/consumer/policy/types.ts +20 -0
- package/src/consumer/policy.ts +101 -0
- package/src/consumer/protocols.ts +116 -0
- package/src/consumer/refund/types.ts +27 -0
- package/src/consumer/refund.ts +136 -0
- package/src/consumer/refusal.ts +35 -0
- package/src/consumer/revive/types.ts +23 -0
- package/src/consumer/revive.ts +82 -0
- package/src/consumer/types.local.ts +10 -0
- package/src/consumer/types.ts +189 -0
- package/src/countries.ts +5 -0
- package/src/entitled.ts +20 -0
- package/src/entitlement/types.ts +29 -0
- package/src/entitlement.ts +86 -0
- package/src/errors.ts +445 -0
- package/src/estimate/types.ts +34 -0
- package/src/estimate.ts +90 -0
- package/src/i18n/consumer-rights/be.json +131 -0
- package/src/i18n/consumer-rights/de.json +131 -0
- package/src/i18n/consumer-rights/en.json +131 -0
- package/src/i18n/consumer-rights/es.json +131 -0
- package/src/i18n/consumer-rights/fr.json +131 -0
- package/src/i18n/consumer-rights/pl.json +131 -0
- package/src/i18n/consumer-rights/ru.json +131 -0
- package/src/i18n/consumer-rights/uk.json +131 -0
- package/src/i18n/errors/be.json +30 -0
- package/src/i18n/errors/de.json +30 -0
- package/src/i18n/errors/en.json +30 -0
- package/src/i18n/errors/es.json +30 -0
- package/src/i18n/errors/fr.json +30 -0
- package/src/i18n/errors/pl.json +30 -0
- package/src/i18n/errors/ru.json +30 -0
- package/src/i18n/errors/uk.json +30 -0
- package/src/i18n/fr.json +39 -0
- package/src/i18n.ts +58 -8
- package/src/index.ts +19 -2
- package/src/limit/types.ts +41 -0
- package/src/limit.ts +132 -0
- package/src/model/checkout.ts +12 -7
- package/src/model/consts.local.ts +83 -0
- package/src/model/consts.ts +206 -0
- package/src/model/consumer.ts +294 -0
- package/src/model/estimate.ts +73 -0
- package/src/model/index.ts +7 -2
- package/src/model/limit.ts +36 -0
- package/src/model/plan.ts +25 -12
- package/src/model/portal.ts +25 -0
- package/src/model/pricing.ts +34 -0
- package/src/model/view.ts +17 -0
- package/src/pricing/types.ts +13 -0
- package/src/pricing.ts +110 -0
- package/src/promo/types.ts +18 -0
- package/src/promo.ts +46 -0
- package/src/regions/types.ts +42 -0
- package/src/regions.ts +85 -0
- package/src/service.ts +32 -15
- package/src/types.local.ts +5 -0
- package/src/types.ts +669 -49
- package/src/view/types.ts +39 -0
- package/src/view.ts +119 -0
- package/tests/checkout-narrow.spec.ts +75 -0
- package/tests/consumer-copy.spec.ts +378 -0
- package/tests/consumer-deadline.spec.ts +85 -0
- package/tests/consumer-fifo.spec.ts +61 -0
- package/tests/consumer-protocols.spec.ts +103 -0
- package/tests/consumer-refund.spec.ts +134 -0
- package/tests/consumer-regions.spec.ts +140 -0
- package/tests/consumer-wire.spec.ts +170 -0
- package/tests/contract.spec.ts +183 -0
- package/tests/entitlement.spec.ts +103 -0
- package/tests/errors.spec.ts +168 -0
- package/tests/estimate.spec.ts +139 -0
- package/tests/limit.spec.ts +117 -0
- package/tests/pricing.spec.ts +30 -0
- package/tests/tsconfig.json +11 -0
- package/tests/view.spec.ts +130 -0
- package/tsconfig.json +6 -1
- package/build/.gitkeep +0 -0
- package/src/model/subscription.ts +0 -63
- package/src/model/utils.ts +0 -32
- package/src/modules.ts +0 -43
|
@@ -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,wBAAwB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,cAAc,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC1c,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACzG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEhD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9C,iDAAiD;AACjD,MAAM,WAAW,QAAQ;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;CACjC;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AAExD,MAAM,WAA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ACxE,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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"types.local.js","sourceRoot":"","sources":["../../src/consumer/types.local.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/entitlement/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PermissionSet } from '@owlmeans/auth';
|
|
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(…)` */
|
|
7
|
+
export declare const parseEntitlementParam: (param: string) => EntitlementParam;
|
|
8
|
+
/** @deprecated compat:factory-refactor — use `entitlementParamHelper.formatEntitlementParam(…)` */
|
|
9
|
+
export declare const formatEntitlementParam: (parsed: EntitlementParam) => string;
|
|
10
|
+
/** @deprecated compat:factory-refactor — use `entitlementParamHelper.hasEntitlement(…)` */
|
|
11
|
+
export declare const hasEntitlement: (capabilities: PermissionSet[] | undefined, param: string) => boolean;
|
|
12
|
+
//# sourceMappingURL=entitlement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
}
|
|
14
|
+
}
|
|
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) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (typeof param !== 'string') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
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 }));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [...new Set(list)];
|
|
54
|
+
};
|
|
55
|
+
return { parseEntitlementParam, formatEntitlementParam, hasEntitlement, entitlementList };
|
|
56
|
+
};
|
|
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);
|
|
64
|
+
//# sourceMappingURL=entitlement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlement.js","sourceRoot":"","sources":["../src/entitlement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIpD,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAA2B,EAAE;IACvE,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAoB,EAAE;QAChE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACzC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACjC,MAAM,MAAM,GAAqB,KAAK,IAAI,CAAC;YACzC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE;YACxE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;QAE1B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YACtC,IAAI,CAAC,MAAM,CAAC,KAAK,C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D,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,YAAyC,EAAE,KAAa,EAAW,EAAE,CAClG,sBAAsB,CAAC,cAAc,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA"}
|
package/build/errors.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ResilientError } from '@owlmeans/error';
|
|
2
|
+
import { AuthForbidden } from '@owlmeans/auth';
|
|
3
|
+
import type { BillingCountryLockedDetails, CheckoutLimitExceededDetails, LimitExhaustedDetails, PerformanceConsentRequiredDetails } from './types.js';
|
|
2
4
|
export declare class PaymentError extends ResilientError {
|
|
3
5
|
static typeName: string;
|
|
4
6
|
constructor(message?: string);
|
|
@@ -15,6 +17,17 @@ export declare class PaygateMappingError extends PaygateError {
|
|
|
15
17
|
static typeName: string;
|
|
16
18
|
constructor(message?: string);
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A webhook delivery whose signature is missing or verifies against no known secret. The sender is
|
|
22
|
+
* refused as a client error (400): a forged or unsigned POST at a public hook is not a server fault,
|
|
23
|
+
* and answering 500 would page operators for it and invite the sender to retry it.
|
|
24
|
+
*/
|
|
25
|
+
export declare class PaygateSignatureError extends PaygateError {
|
|
26
|
+
static typeName: string;
|
|
27
|
+
/** Read by the HTTP boundary (`server-api` `declaredErrorStatus`). */
|
|
28
|
+
static httpStatus: number;
|
|
29
|
+
constructor();
|
|
30
|
+
}
|
|
18
31
|
export declare class ProductError extends PaymentError {
|
|
19
32
|
static typeName: string;
|
|
20
33
|
constructor(message?: string);
|
|
@@ -39,4 +52,180 @@ export declare class UnknownSubscription extends SubscriptionError {
|
|
|
39
52
|
static typeName: string;
|
|
40
53
|
constructor(message?: string);
|
|
41
54
|
}
|
|
55
|
+
export declare class LimitUnknown extends ProductError {
|
|
56
|
+
static typeName: string;
|
|
57
|
+
constructor(message?: string);
|
|
58
|
+
}
|
|
59
|
+
export declare class LimitMisdeclared extends ProductError {
|
|
60
|
+
static typeName: string;
|
|
61
|
+
constructor(message?: string);
|
|
62
|
+
}
|
|
63
|
+
export declare class PlanRequired extends ProductError {
|
|
64
|
+
static typeName: string;
|
|
65
|
+
constructor(message?: string);
|
|
66
|
+
}
|
|
67
|
+
export declare class PlanRankConflict extends ProductError {
|
|
68
|
+
static typeName: string;
|
|
69
|
+
constructor(message?: string);
|
|
70
|
+
}
|
|
71
|
+
export declare class WebhookSetupError extends PaygateError {
|
|
72
|
+
static typeName: string;
|
|
73
|
+
constructor(message?: string);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The entity has nothing the requested portal flow can act on — no paygate customer, no entitling
|
|
77
|
+
* subscription, no plan or item to change to. The entity's own state, not a fault: an HTTP boundary
|
|
78
|
+
* that honours `httpStatus` (`@owlmeans/server-api`) answers 409 Conflict.
|
|
79
|
+
*/
|
|
80
|
+
export declare class PortalUnavailable extends PaygateError {
|
|
81
|
+
static typeName: string;
|
|
82
|
+
static httpStatus: number;
|
|
83
|
+
constructor(message?: string);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The entity's plan does not allow the request.
|
|
87
|
+
*
|
|
88
|
+
* Extends `AuthForbidden` so an HTTP boundary answers 403, never 500. Only `type` and `message`
|
|
89
|
+
* survive a marshal round trip, so each subclass packs its fields into the message and rebuilds
|
|
90
|
+
* them in `finalizeUnmarshal()`.
|
|
91
|
+
*/
|
|
92
|
+
export declare class EntitlementRefusal extends AuthForbidden {
|
|
93
|
+
static typeName: string;
|
|
94
|
+
constructor(message?: string);
|
|
95
|
+
}
|
|
96
|
+
/** None of the capability parameters (OR'd) is granted. Message marker `capability-required:<a|b>`. */
|
|
97
|
+
export declare class CapabilityRequired extends EntitlementRefusal {
|
|
98
|
+
static typeName: string;
|
|
99
|
+
/** The refused parameters, as the gate took them. */
|
|
100
|
+
params: string[];
|
|
101
|
+
constructor(params?: string | string[]);
|
|
102
|
+
private applyFields;
|
|
103
|
+
finalizeUnmarshal(): void;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A limit has no room left. Message marker `limit-exhausted:<key>:<used>/<limit>[:<resetsAt ISO>]`.
|
|
107
|
+
*/
|
|
108
|
+
export declare class LimitExhausted extends EntitlementRefusal {
|
|
109
|
+
static typeName: string;
|
|
110
|
+
limitKey: string;
|
|
111
|
+
used: number;
|
|
112
|
+
limit: number;
|
|
113
|
+
resetsAt?: Date;
|
|
114
|
+
/** The packed marker body of a refusal. */
|
|
115
|
+
static encode(details: LimitExhaustedDetails): string;
|
|
116
|
+
constructor(details: LimitExhaustedDetails);
|
|
117
|
+
/** A packed marker body (`LimitExhausted.encode`) or a marshaled message — the error registry's path. */
|
|
118
|
+
constructor(message: string);
|
|
119
|
+
private applyFields;
|
|
120
|
+
finalizeUnmarshal(): void;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A consumer-rights fault — a misdeclared policy (`policy:<field>`), a missing usage meter or
|
|
124
|
+
* mailer, a copy template without a value (`copy:<path>`). Declares no status: 500.
|
|
125
|
+
*/
|
|
126
|
+
export declare class ConsumerRightsError extends PaymentError {
|
|
127
|
+
static typeName: string;
|
|
128
|
+
constructor(message?: string);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The consumer's own position refuses the request — never a fault. Deliberately NOT an
|
|
132
|
+
* `AuthForbidden`: an HTTP boundary tests that family first, and a 403 would hide the declared
|
|
133
|
+
* 428/409 a client acts on.
|
|
134
|
+
*/
|
|
135
|
+
export declare class ConsumerRightsRefusal extends ConsumerRightsError {
|
|
136
|
+
static typeName: string;
|
|
137
|
+
constructor(message?: string);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Billed work would spend credits of a purchase still inside its withdrawal window, and the
|
|
141
|
+
* consumer has not expressly requested performance. HTTP 428. Marker
|
|
142
|
+
* `performance-consent-required:<pending>[:<deadline ISO>]`.
|
|
143
|
+
*/
|
|
144
|
+
export declare class PerformanceConsentRequired extends ConsumerRightsRefusal {
|
|
145
|
+
static typeName: string;
|
|
146
|
+
static httpStatus: number;
|
|
147
|
+
pending: number;
|
|
148
|
+
deadline?: Date;
|
|
149
|
+
static encode(details: PerformanceConsentRequiredDetails): string;
|
|
150
|
+
constructor(details: PerformanceConsentRequiredDetails);
|
|
151
|
+
/** A packed marker body (`encode`) or a marshaled message — the error registry's path. */
|
|
152
|
+
constructor(message: string);
|
|
153
|
+
private applyFields;
|
|
154
|
+
finalizeUnmarshal(): void;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A subscription checkout needs a fresh express start request bound to this plan. HTTP 428.
|
|
158
|
+
* Marker `subscription-start-required:<encodeURIComponent(planSku)>`.
|
|
159
|
+
*/
|
|
160
|
+
export declare class SubscriptionStartRequired extends ConsumerRightsRefusal {
|
|
161
|
+
static typeName: string;
|
|
162
|
+
static httpStatus: number;
|
|
163
|
+
planSku: string;
|
|
164
|
+
static encode(planSku: string): string;
|
|
165
|
+
/** `planSku` as is, or a packed marker body / marshaled message (the registry's path). */
|
|
166
|
+
constructor(planSku?: string | {
|
|
167
|
+
planSku: string;
|
|
168
|
+
});
|
|
169
|
+
/** A string that already is a marker (the registry path) passes through unencoded. */
|
|
170
|
+
private static encodeLoose;
|
|
171
|
+
private applyFields;
|
|
172
|
+
finalizeUnmarshal(): void;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The entity's billing country is fixed and the request declared another. HTTP 409. Marker
|
|
176
|
+
* `billing-country-locked:<country>[:<requested>]`.
|
|
177
|
+
*/
|
|
178
|
+
export declare class BillingCountryLocked extends ConsumerRightsRefusal {
|
|
179
|
+
static typeName: string;
|
|
180
|
+
static httpStatus: number;
|
|
181
|
+
country: string;
|
|
182
|
+
requested?: string;
|
|
183
|
+
static encode(details: BillingCountryLockedDetails): string;
|
|
184
|
+
constructor(details: BillingCountryLockedDetails);
|
|
185
|
+
constructor(message: string);
|
|
186
|
+
private applyFields;
|
|
187
|
+
finalizeUnmarshal(): void;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The named purchase cannot be withdrawn from (`WithdrawalUnavailableReason`). HTTP 409. Marker
|
|
191
|
+
* `withdrawal-unavailable:<reason>`. Never raised on the public page, which discloses nothing.
|
|
192
|
+
*/
|
|
193
|
+
export declare class WithdrawalUnavailable extends ConsumerRightsRefusal {
|
|
194
|
+
static typeName: string;
|
|
195
|
+
static httpStatus: number;
|
|
196
|
+
reason: string;
|
|
197
|
+
constructor(reason?: string);
|
|
198
|
+
private applyFields;
|
|
199
|
+
finalizeUnmarshal(): void;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Nothing to cancel in-app (`CancellationUnavailableReason`). HTTP 409. Marker
|
|
203
|
+
* `cancellation-unavailable:<reason>`.
|
|
204
|
+
*/
|
|
205
|
+
export declare class CancellationUnavailable extends ConsumerRightsRefusal {
|
|
206
|
+
static typeName: string;
|
|
207
|
+
static httpStatus: number;
|
|
208
|
+
reason: string;
|
|
209
|
+
constructor(reason?: string);
|
|
210
|
+
private applyFields;
|
|
211
|
+
finalizeUnmarshal(): void;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The amount is above what this entity may buy now (a narrowing of the plan's policy). HTTP 409.
|
|
215
|
+
* Marker `checkout-limit-exceeded:<encodeURIComponent(reason)>:<maximumMinor>:<currency>[:<ISO>]`.
|
|
216
|
+
* A payment refusal, not a consumer-rights one.
|
|
217
|
+
*/
|
|
218
|
+
export declare class CheckoutLimitExceeded extends PaymentError {
|
|
219
|
+
static typeName: string;
|
|
220
|
+
static httpStatus: number;
|
|
221
|
+
reason: string;
|
|
222
|
+
maximumMinor: number;
|
|
223
|
+
currency: string;
|
|
224
|
+
resetsAt?: Date;
|
|
225
|
+
static encode(details: CheckoutLimitExceededDetails): string;
|
|
226
|
+
constructor(details: CheckoutLimitExceededDetails);
|
|
227
|
+
constructor(message: string);
|
|
228
|
+
private applyFields;
|
|
229
|
+
finalizeUnmarshal(): void;
|
|
230
|
+
}
|
|
42
231
|
//# sourceMappingURL=errors.d.ts.map
|
package/build/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAA;AAErJ,qBAAa,YAAa,SAAQ,cAAc;IAC9C,OAAuB,QAAQ,EAAE,MAAM,CAAiB;IAExD,YAAY,OAAO,GAAE,MAAgB,EAEpC;CACF;AAED,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAuB,QAAQ,EAAE,MAAM,CAAoC;IAE3E,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;AAED,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAuB,QAAQ,EAAE,MAAM,CAAoC;IAE3E,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;AAED,qBAAa,mBAAoB,SAAQ,YAAY;IACnD,OAAuB,QAAQ,EAAE,MAAM,CAAoC;IAE3E,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;AAED;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,OAAuB,QAAQ,EAAE,MAAM,CAAsC;IAC7E,sEAAsE;IACtE,OAAc,UAAU,EAAE,MAAM,CAAM;IAEtC,cAGC;CACF;AAED,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAuB,QAAQ,EAAE,MAAM,CAAoC;IAE3E,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;A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