@antelopejs/dms-saas 0.7.4 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/README.md +2 -2
  2. package/dist/auth/owner-only-permissions-resolver.js +3 -2
  3. package/dist/auth/owner-only-permissions-resolver.js.map +1 -1
  4. package/dist/auth/plan-permissions-resolver.js +6 -3
  5. package/dist/auth/plan-permissions-resolver.js.map +1 -1
  6. package/dist/billing-state/directory.d.ts +2 -0
  7. package/dist/billing-state/directory.js +48 -3
  8. package/dist/billing-state/directory.js.map +1 -1
  9. package/dist/billing-state/past-due-banner.js +2 -0
  10. package/dist/billing-state/past-due-banner.js.map +1 -1
  11. package/dist/billing-state/recovery.js +4 -0
  12. package/dist/billing-state/recovery.js.map +1 -1
  13. package/dist/billing-state/trial-ending-banner.js +1 -0
  14. package/dist/billing-state/trial-ending-banner.js.map +1 -1
  15. package/dist/config/runtime.d.ts +2 -2
  16. package/dist/config/runtime.js +12 -4
  17. package/dist/config/runtime.js.map +1 -1
  18. package/dist/data-api/platformOwner/plans.d.ts +2 -0
  19. package/dist/data-api/platformOwner/plans.js +16 -0
  20. package/dist/data-api/platformOwner/plans.js.map +1 -1
  21. package/dist/frontend-module.d.ts +3 -0
  22. package/dist/frontend-module.js +29 -0
  23. package/dist/frontend-module.js.map +1 -0
  24. package/dist/implementations/dms-saas/billing.d.ts +2 -1
  25. package/dist/implementations/dms-saas/billing.js +15 -0
  26. package/dist/implementations/dms-saas/billing.js.map +1 -1
  27. package/dist/implementations/dms-saas/invoice-line-items.d.ts +2 -2
  28. package/dist/implementations/dms-saas/invoice-line-items.js +6 -6
  29. package/dist/implementations/dms-saas/invoice-line-items.js.map +1 -1
  30. package/dist/index.js +2 -19
  31. package/dist/index.js.map +1 -1
  32. package/dist/invoice-line-items/billing-window.d.ts +6 -2
  33. package/dist/invoice-line-items/billing-window.js.map +1 -1
  34. package/dist/invoice-line-items/recovery/admission.js +2 -5
  35. package/dist/invoice-line-items/recovery/admission.js.map +1 -1
  36. package/dist/invoice-line-items/recovery/process.d.ts +1 -0
  37. package/dist/invoice-line-items/recovery/process.js +119 -47
  38. package/dist/invoice-line-items/recovery/process.js.map +1 -1
  39. package/dist/invoice-line-items/recovery/task.model.js +1 -1
  40. package/dist/invoice-line-items/recovery/task.model.js.map +1 -1
  41. package/dist/invoice-line-items/recovery/task.table.d.ts +2 -2
  42. package/dist/invoice-line-items/recovery/task.table.js +3 -4
  43. package/dist/invoice-line-items/recovery/task.table.js.map +1 -1
  44. package/dist/metrics/revenue.d.ts +15 -3
  45. package/dist/metrics/revenue.js +58 -12
  46. package/dist/metrics/revenue.js.map +1 -1
  47. package/dist/operator-actions/previews.d.ts +1 -1
  48. package/dist/operator-actions/previews.js +13 -6
  49. package/dist/operator-actions/previews.js.map +1 -1
  50. package/dist/pages/platform/dashboard.d.ts +1 -1
  51. package/dist/pages/platform/dashboard.js +13 -10
  52. package/dist/pages/platform/dashboard.js.map +1 -1
  53. package/dist/pages/platform/plans/edit.js +4 -0
  54. package/dist/pages/platform/plans/edit.js.map +1 -1
  55. package/dist/pages/platform/plans/index.js +4 -0
  56. package/dist/pages/platform/plans/index.js.map +1 -1
  57. package/dist/pages/platform/plans/migrations.d.ts +1 -0
  58. package/dist/pages/platform/plans/migrations.js +3 -0
  59. package/dist/pages/platform/plans/migrations.js.map +1 -1
  60. package/dist/pages/platform/segments/edit.js +1 -0
  61. package/dist/pages/platform/segments/edit.js.map +1 -1
  62. package/dist/pages/platform/workspaces/index.js +1 -4
  63. package/dist/pages/platform/workspaces/index.js.map +1 -1
  64. package/dist/pages/tenant/billing.js +1 -2
  65. package/dist/pages/tenant/billing.js.map +1 -1
  66. package/dist/plans/catalogue-summary.d.ts +1 -0
  67. package/dist/plans/catalogue-summary.js +10 -4
  68. package/dist/plans/catalogue-summary.js.map +1 -1
  69. package/dist/plans/catalogue-usage.js +4 -2
  70. package/dist/plans/catalogue-usage.js.map +1 -1
  71. package/dist/plans/plan-audience.d.ts +1 -0
  72. package/dist/plans/plan-audience.js +4 -0
  73. package/dist/plans/plan-audience.js.map +1 -1
  74. package/dist/plans/plan-write.d.ts +9 -3
  75. package/dist/plans/plan-write.js +27 -1
  76. package/dist/plans/plan-write.js.map +1 -1
  77. package/dist/plans/seat-hooks.js +25 -16
  78. package/dist/plans/seat-hooks.js.map +1 -1
  79. package/dist/plans/stripe-sync.js +11 -3
  80. package/dist/plans/stripe-sync.js.map +1 -1
  81. package/dist/routes/platformOwner/credit-notes-issue.js +18 -12
  82. package/dist/routes/platformOwner/credit-notes-issue.js.map +1 -1
  83. package/dist/routes/platformOwner/dashboard.d.ts +4 -8
  84. package/dist/routes/platformOwner/dashboard.js +9 -28
  85. package/dist/routes/platformOwner/dashboard.js.map +1 -1
  86. package/dist/routes/platformOwner/plan-dialogs.js +2 -1
  87. package/dist/routes/platformOwner/plan-dialogs.js.map +1 -1
  88. package/dist/routes/platformOwner/plans.d.ts +5 -26
  89. package/dist/routes/platformOwner/plans.js +48 -18
  90. package/dist/routes/platformOwner/plans.js.map +1 -1
  91. package/dist/routes/platformOwner/workspace-detail.js +4 -2
  92. package/dist/routes/platformOwner/workspace-detail.js.map +1 -1
  93. package/dist/routes/platformOwner/workspace-operator-actions.js +6 -1
  94. package/dist/routes/platformOwner/workspace-operator-actions.js.map +1 -1
  95. package/dist/routes/platformOwner/workspaces-admin.d.ts +1 -1
  96. package/dist/routes/platformOwner/workspaces-admin.js +15 -7
  97. package/dist/routes/platformOwner/workspaces-admin.js.map +1 -1
  98. package/dist/routes/public/public-plan-catalog.js +3 -2
  99. package/dist/routes/public/public-plan-catalog.js.map +1 -1
  100. package/dist/routes/public/register.js +6 -5
  101. package/dist/routes/public/register.js.map +1 -1
  102. package/dist/routes/tenant/billing-portal.js +1 -1
  103. package/dist/routes/tenant/billing-portal.js.map +1 -1
  104. package/dist/routes/tenant/tenant-plan-checkout.js +4 -4
  105. package/dist/routes/tenant/tenant-plan-checkout.js.map +1 -1
  106. package/dist/routes/tenant/tenant-plan-resubscription.js +2 -1
  107. package/dist/routes/tenant/tenant-plan-resubscription.js.map +1 -1
  108. package/dist/routes/tenant/tenant-plan.d.ts +0 -1
  109. package/dist/routes/tenant/tenant-plan.js +20 -20
  110. package/dist/routes/tenant/tenant-plan.js.map +1 -1
  111. package/dist/routes/tenant/workspaces.d.ts +1 -1
  112. package/dist/routes/tenant/workspaces.js +13 -8
  113. package/dist/routes/tenant/workspaces.js.map +1 -1
  114. package/dist/stripe/availability.d.ts +5 -0
  115. package/dist/stripe/availability.js +43 -0
  116. package/dist/stripe/availability.js.map +1 -0
  117. package/dist/stripe/customer-billing.js +2 -0
  118. package/dist/stripe/customer-billing.js.map +1 -1
  119. package/dist/stripe/customer-locale.d.ts +3 -0
  120. package/dist/stripe/customer-locale.js +11 -0
  121. package/dist/stripe/customer-locale.js.map +1 -1
  122. package/dist/stripe/index.d.ts +1 -0
  123. package/dist/stripe/index.js +1 -0
  124. package/dist/stripe/index.js.map +1 -1
  125. package/dist/stripe/payload-shapes.d.ts +6 -0
  126. package/dist/stripe/payload-shapes.js +13 -0
  127. package/dist/stripe/payload-shapes.js.map +1 -1
  128. package/dist/stripe/subscription-cancellation.js +2 -0
  129. package/dist/stripe/subscription-cancellation.js.map +1 -1
  130. package/dist/stripe/sync-plan.js +8 -7
  131. package/dist/stripe/sync-plan.js.map +1 -1
  132. package/dist/stripe/webhook-checkout.js +1 -1
  133. package/dist/stripe/webhook-checkout.js.map +1 -1
  134. package/dist/stripe/webhook-handlers.js +5 -3
  135. package/dist/stripe/webhook-handlers.js.map +1 -1
  136. package/dist/utils/segment-matching.d.ts +4 -3
  137. package/dist/utils/segment-matching.js +29 -13
  138. package/dist/utils/segment-matching.js.map +1 -1
  139. package/dist/workspaces/provisioning.d.ts +0 -1
  140. package/dist/workspaces/provisioning.js +3 -6
  141. package/dist/workspaces/provisioning.js.map +1 -1
  142. package/dist/workspaces/self-serve-creation.d.ts +2 -2
  143. package/dist/workspaces/self-serve-creation.js +12 -6
  144. package/dist/workspaces/self-serve-creation.js.map +1 -1
  145. package/frontend-vue/app/build/period-range.ts +57 -0
  146. package/frontend-vue/app/build/plan-catalog.ts +2 -0
  147. package/frontend-vue/app/build/public/RegistrationPlanCard.vue +1 -2
  148. package/frontend-vue/app/components/BillingIdentityFields.vue +64 -76
  149. package/frontend-vue/app/components/PlanCard.vue +14 -2
  150. package/frontend-vue/app/components/PlanCardPublic.vue +1 -2
  151. package/frontend-vue/app/components/PlanEditorPreview.vue +26 -12
  152. package/frontend-vue/app/components/PlanUpgradeModal.vue +45 -3
  153. package/frontend-vue/app/components/TenantBillingForm.vue +2 -0
  154. package/frontend-vue/app/components/TenantPlanCard.vue +1 -2
  155. package/frontend-vue/app/components/WorkspaceCreateModal.vue +1 -2
  156. package/frontend-vue/app/composables/useBillingAddress.ts +108 -0
  157. package/frontend-vue/app/composables/useBillingCountries.ts +3 -69
  158. package/frontend-vue/app/composables/useBillingIdentity.ts +7 -5
  159. package/frontend-vue/app/composables/usePlanChangeReview.ts +21 -0
  160. package/frontend-vue/app/plugins/billing-data-types.ts +6 -13
  161. package/frontend-vue/i18n/locales/saas-en-GB.json +4 -0
  162. package/frontend-vue/i18n/locales/saas-fr-FR.json +4 -0
  163. package/frontend-vue/i18n/locales/saas-operator-catalog-en-GB.json +9 -2
  164. package/frontend-vue/i18n/locales/saas-operator-catalog-fr-FR.json +9 -2
  165. package/frontend-vue/i18n/locales/saas-operator-workspaces-en-GB.json +7 -2
  166. package/frontend-vue/i18n/locales/saas-operator-workspaces-fr-FR.json +7 -2
  167. package/frontend-vue/i18n/locales/saas-tenant-billing-en-GB.json +5 -7
  168. package/frontend-vue/i18n/locales/saas-tenant-billing-fr-FR.json +5 -7
  169. package/frontend-vue/package.json +1 -1
  170. package/package.json +7 -6
  171. package/skills/dms-saas/SKILL.md +22 -2
  172. package/frontend-vue/app/composables/usePlanDescription.ts +0 -12
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The value of the DMS address input (`DmsInputAddress`, the `AddressType`
3
+ * field): the street split into its name, number and box.
4
+ */
5
+ export interface AddressInputValue {
6
+ streetName: string
7
+ houseNumber?: string
8
+ boxNumber?: string
9
+ addressLine2?: string
10
+ postalCode: string
11
+ city: string
12
+ countrySubdivision?: string
13
+ countryCode: string
14
+ }
15
+
16
+ /** The billing address as the draft and Stripe hold it: one street line. */
17
+ export interface BillingAddressDraft {
18
+ line1: string
19
+ line2: string
20
+ postalCode: string
21
+ city: string
22
+ state: string
23
+ country: string
24
+ }
25
+
26
+ /** The street line split into the parts the address input edits. */
27
+ export interface StreetParts {
28
+ streetName: string
29
+ houseNumber: string
30
+ boxNumber: string
31
+ }
32
+
33
+ // "Rue de l'Ermitage 41", "Rue de l'Ermitage 41/2", "Rue X, 41 bte 2": the
34
+ // number is the last word starting with a digit, a box after it either
35
+ // slashed or named as the address input itself splits it. A line written the
36
+ // other way round ("10 Downing Street") stays the street name, whole.
37
+ const NUMBER_AT_END =
38
+ /^(.+?)[,\s]\s*(\d[^\s/]*)(?:\s*\/\s*(\S+)|\s+(?:bo[iî]te|bus|box|bte)\.?\s*(\S+))?$/i
39
+ const BOX_SEPARATOR = '/'
40
+
41
+ /** Splits a stored street line into the address input's street parts. */
42
+ export function splitStreetLine(line: string): StreetParts {
43
+ const trimmed = line.trim()
44
+ const match = NUMBER_AT_END.exec(trimmed)
45
+ if (!match) return { streetName: trimmed, houseNumber: '', boxNumber: '' }
46
+ return {
47
+ streetName: match[1]?.trim() ?? '',
48
+ houseNumber: match[2] ?? '',
49
+ boxNumber: match[3] ?? match[4] ?? '',
50
+ }
51
+ }
52
+
53
+ /** Joins street parts into one line: "Rue X 41", "Rue X 41/2". */
54
+ export function joinStreetLine(parts: StreetParts): string {
55
+ const number = [parts.houseNumber.trim(), parts.boxNumber.trim()]
56
+ .filter(Boolean)
57
+ .join(BOX_SEPARATOR)
58
+ return [parts.streetName.trim(), number].filter(Boolean).join(' ')
59
+ }
60
+
61
+ function hasSameStreet(left: StreetParts, right: StreetParts): boolean {
62
+ return (
63
+ left.streetName === right.streetName &&
64
+ left.houseNumber === right.houseNumber &&
65
+ left.boxNumber === right.boxNumber
66
+ )
67
+ }
68
+
69
+ /** The address input's value for a stored billing address. */
70
+ export function toAddressInputValue(
71
+ address: BillingAddressDraft,
72
+ ): AddressInputValue {
73
+ return {
74
+ ...splitStreetLine(address.line1),
75
+ addressLine2: address.line2,
76
+ postalCode: address.postalCode,
77
+ city: address.city,
78
+ countrySubdivision: address.state,
79
+ countryCode: address.country,
80
+ }
81
+ }
82
+
83
+ /**
84
+ * The billing address an address input value stands for. The street line is
85
+ * rebuilt only when its parts changed, so editing the city of a line the
86
+ * split could not rebuild word for word ("Rue X, 41 bte 2") leaves it as
87
+ * typed, and leaves the form clean until something really changed.
88
+ */
89
+ export function fromAddressInputValue(
90
+ value: AddressInputValue,
91
+ current: BillingAddressDraft,
92
+ ): BillingAddressDraft {
93
+ const street: StreetParts = {
94
+ streetName: value.streetName ?? '',
95
+ houseNumber: value.houseNumber ?? '',
96
+ boxNumber: value.boxNumber ?? '',
97
+ }
98
+ return {
99
+ line1: hasSameStreet(street, splitStreetLine(current.line1))
100
+ ? current.line1
101
+ : joinStreetLine(street),
102
+ line2: value.addressLine2 ?? '',
103
+ postalCode: value.postalCode ?? '',
104
+ city: value.city ?? '',
105
+ state: value.countrySubdivision ?? '',
106
+ country: (value.countryCode ?? '').toUpperCase(),
107
+ }
108
+ }
@@ -1,74 +1,8 @@
1
- import { computed, type ComputedRef } from "vue";
2
-
3
- export interface BillingCountryItem {
4
- value: string;
5
- label: string;
6
- }
7
-
8
- export interface BillingCountries {
9
- countryItems: ComputedRef<BillingCountryItem[]>;
10
- }
11
-
12
- const BILLING_COUNTRY_CODES = [
13
- "AT",
14
- "BE",
15
- "BG",
16
- "HR",
17
- "CY",
18
- "CZ",
19
- "DK",
20
- "EE",
21
- "FI",
22
- "FR",
23
- "DE",
24
- "GR",
25
- "HU",
26
- "IE",
27
- "IT",
28
- "LV",
29
- "LT",
30
- "LU",
31
- "MT",
32
- "NL",
33
- "PL",
34
- "PT",
35
- "RO",
36
- "SK",
37
- "SI",
38
- "ES",
39
- "SE",
40
- "GB",
41
- "CH",
42
- "NO",
43
- "US",
44
- "CA",
45
- "AU",
46
- "NZ",
47
- ];
48
-
49
1
  /**
50
- * Country choices labelled with their full name in the given locale, sorted
51
- * alphabetically for that locale. The stored value stays the ISO code Stripe
52
- * expects.
53
- *
54
- * @param locale BCP 47 locale the labels are rendered in
2
+ * Full country name for an ISO code, or the code itself when unknown. The
3
+ * billing address picks its country from the DMS address input's list; the
4
+ * stored value stays the ISO code Stripe expects.
55
5
  */
56
- export function buildBillingCountryItems(locale: string): BillingCountryItem[] {
57
- const names = new Intl.DisplayNames([locale], { type: "region" });
58
- return BILLING_COUNTRY_CODES.map((code) => ({
59
- value: code,
60
- label: names.of(code) ?? code,
61
- })).sort((left, right) => left.label.localeCompare(right.label, locale));
62
- }
63
-
64
- /** Full country name for an ISO code, or the code itself when unknown. */
65
6
  export function formatBillingCountry(code: string, locale: string): string {
66
7
  return new Intl.DisplayNames([locale], { type: "region" }).of(code) ?? code;
67
8
  }
68
-
69
- export function useBillingCountries(): BillingCountries {
70
- const { locale } = useI18n();
71
- return {
72
- countryItems: computed(() => buildBillingCountryItems(locale.value)),
73
- };
74
- }
@@ -16,15 +16,11 @@ export type BillingIdentityField =
16
16
  | 'billingEmail'
17
17
 
18
18
  /** The editable billing identity, as the form holds it. */
19
- export interface BillingIdentityDraft {
19
+ export interface BillingIdentityDraft extends BillingAddressDraft {
20
20
  customerType: CustomerType | null
21
21
  companyName: string
22
22
  vatNumber: string
23
23
  billingEmail: string
24
- country: string
25
- line1: string
26
- postalCode: string
27
- city: string
28
24
  }
29
25
 
30
26
  interface BillingAddress {
@@ -88,8 +84,10 @@ export function emptyBillingIdentityDraft(): BillingIdentityDraft {
88
84
  billingEmail: '',
89
85
  country: '',
90
86
  line1: '',
87
+ line2: '',
91
88
  postalCode: '',
92
89
  city: '',
90
+ state: '',
93
91
  }
94
92
  }
95
93
 
@@ -103,8 +101,10 @@ export function toBillingIdentityDraft(
103
101
  billingEmail: info.billingEmail ?? '',
104
102
  country: info.address?.country ?? '',
105
103
  line1: info.address?.line1 ?? '',
104
+ line2: info.address?.line2 ?? '',
106
105
  postalCode: info.address?.postalCode ?? '',
107
106
  city: info.address?.city ?? '',
107
+ state: info.address?.state ?? '',
108
108
  }
109
109
  }
110
110
 
@@ -118,8 +118,10 @@ function toRequestBody(draft: BillingIdentityDraft) {
118
118
  address: {
119
119
  country: draft.country,
120
120
  line1: draft.line1,
121
+ line2: draft.line2,
121
122
  postalCode: draft.postalCode,
122
123
  city: draft.city,
124
+ state: draft.state,
123
125
  },
124
126
  }
125
127
  }
@@ -35,6 +35,27 @@ export interface OfferedPlans {
35
35
  tooSmall: OfferedPlanView[]
36
36
  }
37
37
 
38
+ /** Where the checkout dialog stands before it may send the owner to pay. */
39
+ export interface CheckoutReadiness {
40
+ isLoading: boolean
41
+ hasLoadFailed: boolean
42
+ /** Translated reason the preview was refused, null once it priced. */
43
+ previewFailure: string | null
44
+ }
45
+
46
+ /**
47
+ * Whether the checkout dialog may offer the payment page: the identity is
48
+ * loaded and the plan change was not refused while previewed — the checkout
49
+ * itself would refuse it for the same reason.
50
+ */
51
+ export function canContinueToCheckout(readiness: CheckoutReadiness): boolean {
52
+ return (
53
+ !readiness.isLoading &&
54
+ !readiness.hasLoadFailed &&
55
+ readiness.previewFailure === null
56
+ )
57
+ }
58
+
38
59
  /** Something the workspace holds that the target plan does not allow. */
39
60
  export interface PlanChangeIncompatibility {
40
61
  code: string
@@ -1,4 +1,5 @@
1
1
  import { defineComponent, h, resolveComponent } from 'vue'
2
+ import { formatPeriodRange } from '../build/period-range'
2
3
  import { billingDocumentTypeKey } from '../composables/useBillingDocumentType'
3
4
  import { parseInvoiceLines } from '../composables/useInvoiceLines'
4
5
  import { formatMinorUnits } from '../composables/useMoneyFormat'
@@ -21,14 +22,6 @@ const PERIOD_FORMAT: Intl.DateTimeFormatOptions = {
21
22
  month: 'long',
22
23
  year: 'numeric',
23
24
  }
24
- const RANGE_FORMAT: Intl.DateTimeFormatOptions = {
25
- day: 'numeric',
26
- month: 'short',
27
- }
28
- const RANGE_FORMAT_WITH_YEAR: Intl.DateTimeFormatOptions = {
29
- ...RANGE_FORMAT,
30
- year: 'numeric',
31
- }
32
25
  const NO_VALUE = '—'
33
26
 
34
27
  type CellRow = Record<string, unknown> | undefined
@@ -44,7 +37,10 @@ function toDate(value: unknown): Date | null {
44
37
  return Number.isNaN(date.getTime()) ? null : date
45
38
  }
46
39
 
47
- /** "Sep 29 – Oct 28", with the years once the period spans two. */
40
+ /**
41
+ * "Sep 29 – Oct 28", with the years once the period spans two, in the
42
+ * reader's time zone like every other date of the console.
43
+ */
48
44
  function formatPeriod(
49
45
  start: unknown,
50
46
  locale: string,
@@ -55,10 +51,7 @@ function formatPeriod(
55
51
  if (!from) return NO_VALUE
56
52
  const endField = (options as PeriodOptions | undefined)?.endField
57
53
  const to = endField ? toDate(row?.[endField]) : null
58
- if (!to) return new Intl.DateTimeFormat(locale, RANGE_FORMAT).format(from)
59
- const isSameYear = from.getFullYear() === to.getFullYear()
60
- const format = isSameYear ? RANGE_FORMAT : RANGE_FORMAT_WITH_YEAR
61
- return new Intl.DateTimeFormat(locale, format).formatRange(from, to)
54
+ return formatPeriodRange(from, to, locale, regionalDateTimeFormat)
62
55
  }
63
56
 
64
57
  /** An amount in minor units, in the row's own currency. */
@@ -103,6 +103,10 @@
103
103
  "not_eligible": "Refund not available",
104
104
  "already_processed": "Refund already processed"
105
105
  },
106
+ "stripe": {
107
+ "unavailable": "Stripe, our payment provider, cannot be reached right now. Nothing was charged; try again in a few minutes.",
108
+ "not_configured": "Payments are not set up on this platform yet. Contact the platform operator."
109
+ },
106
110
  "billing": {
107
111
  "country_required": "Billing country is required",
108
112
  "invalid_return_url": "Invalid return URL",
@@ -103,6 +103,10 @@
103
103
  "not_eligible": "Remboursement non disponible",
104
104
  "already_processed": "Remboursement déjà traité"
105
105
  },
106
+ "stripe": {
107
+ "unavailable": "Stripe, notre prestataire de paiement, est injoignable pour le moment. Rien n’a été débité ; réessayez dans quelques minutes.",
108
+ "not_configured": "Les paiements ne sont pas encore configurés sur cette plateforme. Contactez l’opérateur de la plateforme."
109
+ },
106
110
  "billing": {
107
111
  "country_required": "Le pays de facturation est requis",
108
112
  "invalid_return_url": "URL de retour invalide",
@@ -10,6 +10,8 @@
10
10
  "editor_preview_description": "See the plan card as customers see it and its Stripe sync status while editing",
11
11
  "migrations_attention": "Migrations needing attention",
12
12
  "migrations_attention_description": "See the plan migrations waiting for an operator",
13
+ "migration_toolbar": "Migration live mode",
14
+ "migration_toolbar_description": "Pause or resume the live updates of a running migration and see when it was last read",
13
15
  "migration_header": "Migration header",
14
16
  "migration_header_description": "See where a plan migration stands and retry, export or close it",
15
17
  "migration_totals": "Migration totals",
@@ -130,7 +132,7 @@
130
132
  "on_sale": "Plans on sale",
131
133
  "on_sale_detail": "{public} public · {sales} sales-led",
132
134
  "workspaces": "Workspaces",
133
- "workspaces_detail": "{paying} paying · {free} free · {trialing} in trial",
135
+ "workspaces_detail": "{paying} paying · {free} free · {trialing} in trial · {other} other",
134
136
  "mrr": "Catalogue MRR",
135
137
  "mrr_detail": "Normalised · yearly ÷ 12, seats counted",
136
138
  "mrr_detail_other": "Normalised · plus {other}",
@@ -142,6 +144,8 @@
142
144
  "public": "Public",
143
145
  "hidden": "Hidden",
144
146
  "not_on_sale": "Not on sale",
147
+ "not_on_stripe": "Not on Stripe",
148
+ "not_on_stripe_hint": "This plan has a price but no Stripe price yet: no workspace can subscribe to it until it syncs.",
145
149
  "legacy": "Legacy",
146
150
  "on_sale": "On sale",
147
151
  "more": "More actions",
@@ -174,7 +178,10 @@
174
178
  "limit_error": "A cap must be at least 1 member. For no cap, tick Unlimited.",
175
179
  "notice": {
176
180
  "price_changed": "A new Stripe price was created",
177
- "price_changed_description": "New sign-ups pay the new price. Existing subscribers keep theirs until you migrate them."
181
+ "price_changed_description": "New sign-ups pay the new price. Existing subscribers keep theirs until you migrate them.",
182
+ "stripe_not_synced": "Plan saved, but not synced with Stripe",
183
+ "stripe_not_synced_not_configured": "Stripe is not configured: no workspace can subscribe to this paid plan until it is.",
184
+ "stripe_not_synced_out_of_sync": "Stripe did not take the change. It is retried the next time the plan is offered or when the server starts; until then the plan cannot be subscribed to at its new terms."
178
185
  },
179
186
  "section": {
180
187
  "identity": "Identity",
@@ -10,6 +10,8 @@
10
10
  "editor_preview_description": "Voir la carte de l’offre telle que les clients la voient et son état de synchronisation Stripe pendant l’édition",
11
11
  "migrations_attention": "Migrations à traiter",
12
12
  "migrations_attention_description": "Voir les migrations d’offre qui attendent un opérateur",
13
+ "migration_toolbar": "Mode direct de la migration",
14
+ "migration_toolbar_description": "Mettre en pause ou reprendre le suivi en direct d’une migration en cours et voir quand elle a été lue",
13
15
  "migration_header": "En-tête de la migration",
14
16
  "migration_header_description": "Voir où en est une migration d’offre, la relancer, l’exporter ou la clôturer",
15
17
  "migration_totals": "Totaux de la migration",
@@ -130,7 +132,7 @@
130
132
  "on_sale": "Offres en vente",
131
133
  "on_sale_detail": "{public} publiques · {sales} sur devis",
132
134
  "workspaces": "Espaces de travail",
133
- "workspaces_detail": "{paying} payants · {free} gratuits · {trialing} en essai",
135
+ "workspaces_detail": "{paying} payants · {free} gratuits · {trialing} en essai · {other} autres",
134
136
  "mrr": "MRR du catalogue",
135
137
  "mrr_detail": "Normalisé · annuel ÷ 12, sièges comptés",
136
138
  "mrr_detail_other": "Normalisé · plus {other}",
@@ -142,6 +144,8 @@
142
144
  "public": "Publique",
143
145
  "hidden": "Masquée",
144
146
  "not_on_sale": "Plus en vente",
147
+ "not_on_stripe": "Pas sur Stripe",
148
+ "not_on_stripe_hint": "Cette offre a un prix mais pas encore de prix Stripe : aucun espace ne peut y souscrire avant sa synchronisation.",
145
149
  "legacy": "Ancienne",
146
150
  "on_sale": "En vente",
147
151
  "more": "Plus d’actions",
@@ -174,7 +178,10 @@
174
178
  "limit_error": "Une limite doit être d’au moins 1 membre. Pour aucune limite, cochez Illimité.",
175
179
  "notice": {
176
180
  "price_changed": "Un nouveau prix Stripe a été créé",
177
- "price_changed_description": "Les nouvelles inscriptions paient le nouveau prix. Les abonnés actuels gardent le leur jusqu’à leur migration."
181
+ "price_changed_description": "Les nouvelles inscriptions paient le nouveau prix. Les abonnés actuels gardent le leur jusqu’à leur migration.",
182
+ "stripe_not_synced": "Offre enregistrée, mais non synchronisée avec Stripe",
183
+ "stripe_not_synced_not_configured": "Stripe n’est pas configuré : aucun espace ne peut souscrire à cette offre payante tant qu’il ne l’est pas.",
184
+ "stripe_not_synced_out_of_sync": "Stripe n’a pas pris la modification. Elle est retentée la prochaine fois que l’offre est proposée ou au démarrage du serveur ; d’ici là, l’offre ne peut pas être souscrite à ses nouvelles conditions."
178
185
  },
179
186
  "section": {
180
187
  "identity": "Identité",
@@ -35,7 +35,10 @@
35
35
  "title": "Paid invoices",
36
36
  "description": "Collected and credited, in the reporting currency",
37
37
  "collected": "Collected",
38
- "credited": "Credited / refunded"
38
+ "credited": "Credited / refunded",
39
+ "collected_previous_period": "Collected, previous period",
40
+ "collected_previous_year": "Collected, previous year",
41
+ "collected_compared": "Collected, compared period"
39
42
  },
40
43
  "by_status": {
41
44
  "title": "Workspaces by status",
@@ -45,7 +48,7 @@
45
48
  "plans": {
46
49
  "title": "Plans by MRR",
47
50
  "subtitle": "Normalised MRR each plan brings",
48
- "description": "No workspace · {price} | 1 workspace · {price} | {count} workspaces · {price}",
51
+ "description": "No paying workspace · {price} | 1 paying workspace · {price} | {count} paying workspaces · {price}",
49
52
  "empty": "No plan brings recurring revenue yet.",
50
53
  "open_catalogue": "Catalogue"
51
54
  },
@@ -519,6 +522,8 @@
519
522
  "workspaces": {
520
523
  "create": "Create workspace",
521
524
  "create_description": "Create a workspace for a customer and choose how it is paid",
525
+ "toolbar": "Dashboard toolbar",
526
+ "toolbar_description": "See when the dashboard figures were last read and read them again",
522
527
  "period": "Dashboard period",
523
528
  "period_description": "Choose the period the dashboard figures cover",
524
529
  "attention": "Needs attention",
@@ -35,7 +35,10 @@
35
35
  "title": "Factures payées",
36
36
  "description": "Encaissé et crédité, dans la devise de reporting",
37
37
  "collected": "Encaissé",
38
- "credited": "Crédité / remboursé"
38
+ "credited": "Crédité / remboursé",
39
+ "collected_previous_period": "Encaissé, période précédente",
40
+ "collected_previous_year": "Encaissé, année précédente",
41
+ "collected_compared": "Encaissé, période comparée"
39
42
  },
40
43
  "by_status": {
41
44
  "title": "Espaces par statut",
@@ -45,7 +48,7 @@
45
48
  "plans": {
46
49
  "title": "Offres par MRR",
47
50
  "subtitle": "MRR normalisé apporté par chaque offre",
48
- "description": "Aucun espace · {price} | 1 espace · {price} | {count} espaces · {price}",
51
+ "description": "Aucun espace payant · {price} | 1 espace payant · {price} | {count} espaces payants · {price}",
49
52
  "empty": "Aucune offre n'apporte encore de revenu récurrent.",
50
53
  "open_catalogue": "Catalogue"
51
54
  },
@@ -519,6 +522,8 @@
519
522
  "workspaces": {
520
523
  "create": "Créer un espace",
521
524
  "create_description": "Créer un espace pour un client et choisir comment il est payé",
525
+ "toolbar": "Barre du tableau de bord",
526
+ "toolbar_description": "Voir quand les chiffres du tableau de bord ont été lus et les relire",
522
527
  "period": "Période du tableau de bord",
523
528
  "period_description": "Choisir la période couverte par les chiffres du tableau de bord",
524
529
  "attention": "À traiter",
@@ -192,11 +192,6 @@
192
192
  "pending": "Verification in progress",
193
193
  "unverified": "Not verified"
194
194
  },
195
- "address_line1": "Address",
196
- "postal_code": "Postal code",
197
- "city": "City",
198
- "country": "Country",
199
- "country_placeholder": "Select a country",
200
195
  "billing_email": "Billing email",
201
196
  "billing_email_hint": "Receives invoices and payment reminders.",
202
197
  "sections": {
@@ -225,13 +220,15 @@
225
220
  "postalCode": "Postal code",
226
221
  "city": "City",
227
222
  "country": "Country",
228
- "billingEmail": "Billing email"
223
+ "billingEmail": "Billing email",
224
+ "line2": "Address line 2",
225
+ "state": "State or province"
229
226
  },
230
227
  "errors": {
231
228
  "customerType": "Choose a customer type.",
232
229
  "companyName": "The company name is required.",
233
230
  "country": "Choose the billing country.",
234
- "line1": "The address is required.",
231
+ "line1": "The street is required.",
235
232
  "postalCode": "The postal code is required.",
236
233
  "city": "The city is required.",
237
234
  "billingEmail": "Enter a valid email address."
@@ -387,6 +384,7 @@
387
384
  "excl_tax": "{amount} excl. VAT",
388
385
  "first_charge": "First charge {amount} on {date}, then every {interval}. Cancel before {date} and you pay nothing.",
389
386
  "tax_on_stripe": "VAT is computed on Stripe's payment page from the billing country.",
387
+ "preview_failed": "This plan cannot be paid for right now. Try again later or contact us.",
390
388
  "card_note": "Card entered on Stripe's secure payment page, never stored on our side.",
391
389
  "confirm": "Continue to secure payment"
392
390
  }
@@ -192,11 +192,6 @@
192
192
  "pending": "Vérification en cours",
193
193
  "unverified": "Non vérifié"
194
194
  },
195
- "address_line1": "Adresse",
196
- "postal_code": "Code postal",
197
- "city": "Ville",
198
- "country": "Pays",
199
- "country_placeholder": "Choisissez un pays",
200
195
  "billing_email": "E-mail de facturation",
201
196
  "billing_email_hint": "Reçoit les factures et les relances de paiement.",
202
197
  "sections": {
@@ -225,13 +220,15 @@
225
220
  "postalCode": "Code postal",
226
221
  "city": "Ville",
227
222
  "country": "Pays",
228
- "billingEmail": "E-mail de facturation"
223
+ "billingEmail": "E-mail de facturation",
224
+ "line2": "Complément d'adresse",
225
+ "state": "Région ou province"
229
226
  },
230
227
  "errors": {
231
228
  "customerType": "Choisissez un type de client.",
232
229
  "companyName": "La raison sociale est obligatoire.",
233
230
  "country": "Choisissez le pays de facturation.",
234
- "line1": "L'adresse est obligatoire.",
231
+ "line1": "La rue est obligatoire.",
235
232
  "postalCode": "Le code postal est obligatoire.",
236
233
  "city": "La ville est obligatoire.",
237
234
  "billingEmail": "Saisissez une adresse e-mail valide."
@@ -387,6 +384,7 @@
387
384
  "excl_tax": "{amount} HT",
388
385
  "first_charge": "Premier prélèvement de {amount} le {date}, puis chaque {interval}. Résiliez avant le {date} et vous ne payez rien.",
389
386
  "tax_on_stripe": "La TVA est calculée sur la page de paiement de Stripe d'après le pays de facturation.",
387
+ "preview_failed": "Cette offre ne peut pas être payée pour le moment. Réessayez plus tard ou contactez-nous.",
390
388
  "card_note": "Carte saisie sur la page de paiement sécurisée de Stripe, jamais conservée chez nous.",
391
389
  "confirm": "Continuer vers le paiement sécurisé"
392
390
  }
@@ -6,7 +6,7 @@
6
6
  "license": "Apache-2.0",
7
7
  "packageManager": "pnpm@10.6.5",
8
8
  "engines": {
9
- "@antelopejs/dms-frontend": ">=0.6.3 <0.8.0"
9
+ "@antelopejs/dms-frontend": ">=0.8.0 <0.9.0"
10
10
  },
11
11
  "scripts": {
12
12
  "format": "prettier --write .",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/dms-saas",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "SaaS module for the AntelopeJS DMS: self-service sign-up and pricing, plans that gate features, Stripe billing, workspace settings and a back office.",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -48,19 +48,19 @@
48
48
  "@antelopejs/interface-api": ">=0.0.15 <1.0.0",
49
49
  "@antelopejs/interface-api-util": ">=0.1.3 <1.0.0",
50
50
  "@antelopejs/interface-core": ">=0.2.4 <1.0.0",
51
- "@antelopejs/interface-data-api": ">=0.2.2 <1.0.0",
51
+ "@antelopejs/interface-data-api": ">=0.3.0 <1.0.0",
52
52
  "@antelopejs/interface-database": ">=0.1.10 <1.0.0",
53
53
  "@antelopejs/interface-database-decorators": ">=0.1.9 <1.0.0",
54
- "@antelopejs/interface-dms": ">=0.7.4 <1.0.0",
54
+ "@antelopejs/interface-dms": ">=0.8.0 <1.0.0",
55
55
  "node-cron": "^4.2.1",
56
56
  "stripe": "^22.6.2",
57
57
  "zod": "^3.24.4",
58
- "@antelopejs/interface-dms-saas": "^0.5.1"
58
+ "@antelopejs/interface-dms-saas": "^0.6.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@antelopejs/core": "1.16.0",
62
- "@antelopejs/dms": ">=0.9.6 <1.0.0",
63
- "@antelopejs/dms-frontend": ">=0.6.3 <0.7.0",
62
+ "@antelopejs/dms": ">=0.10.0 <1.0.0",
63
+ "@antelopejs/dms-frontend": ">=0.8.0 <0.9.0",
64
64
  "@antelopejs/mongodb": "1.4.3",
65
65
  "@antelopejs/tooling-configs": ">=0.0.9 <1.0.0",
66
66
  "@types/node": "^24.0.0",
@@ -87,6 +87,7 @@
87
87
  "./skills"
88
88
  ]
89
89
  },
90
+ "dmsFrontend": "dist/frontend-module.js",
90
91
  "scripts": {
91
92
  "build": "pnpm --filter @antelopejs/interface-dms-saas build && rimraf dist && tsc",
92
93
  "test:frontend": "ajs dms verify-source --layer node_modules/@antelopejs/dms/frontend-vue --module frontend-vue",
@@ -17,10 +17,14 @@ User docs: `docs/` of this package, published at https://dms.antelopejs.com/docs
17
17
  - dms-saas 0.6 requires `@antelopejs/dms` >=0.9 (interface-dms 0.7, renderer `@antelopejs/dms-frontend` 0.6);
18
18
  0.5 is the DMS 0.8 line.
19
19
  - `ajs project modules add @antelopejs/dms-saas`; config `stripe.{secretKey,publishableKey,webhookSecret}` from env
20
- (`envOverrides`). Placeholder keys disable Stripe calls (plan sync skipped).
20
+ (`envOverrides`). Placeholder keys disable Stripe calls: plan sync skipped, registration
21
+ takes no card whatever `registration.paymentMethod` says. Stripe refusing the key or unreachable → handled
22
+ `503 saas.errors.stripe.unavailable`, not a 500. A new route that calls Stripe wraps its calls in
23
+ `withStripeAvailability()` and, when it cannot work without Stripe, calls `assertStripeConfigured()` first
24
+ (`503 saas.errors.stripe.not_configured`) — see `src/stripe/availability.ts`.
21
25
  - Stripe webhook endpoint → `/api/saas/webhooks/stripe`, API version `2026-08-26.dahlia`.
22
26
  - Frontend server env: `DMS_AUTH_ESTABLISH_ENDPOINTS=/api/saas/register/finalize`, else sign-ups stay signed out (403).
23
- - `allowedRedirectHosts` for Checkout / billing-portal return URLs (loopback auto-allowed in dev only).
27
+ - `allowedRedirectHosts` for Checkout / billing-portal return URLs: defaults to the DMS `clientBaseUrl` host, a value replaces it (loopback auto-allowed in dev only).
24
28
  - A free plan must exist (or `defaultPlanSlug`): registration opens it, and every workspace without a subscription gets it.
25
29
  - Options: `admissionMode` (`open` | `invitation-only`), `registration.paymentMethod` (`required` default | `optional` | `none`),
26
30
  `publicScreens.{register,pricing}`, `upcomingInvoicePreviewCacheTtlSeconds`, `reportingCurrency`,
@@ -30,9 +34,13 @@ User docs: `docs/` of this package, published at https://dms.antelopejs.com/docs
30
34
 
31
35
  - The `dms-saas.plan-intersection` resolver keeps, per member, roles ∩ plan; the workspace owner gets every plan
32
36
  permission (never `*`). A plan grants exactly the ids it lists: list every component id, not just the page.
37
+ - Role preview (`context.preview` in a resolver): roles ∩ plan with no owner grant and no owner-only screens, `*` kept
38
+ only for a `*` role. Resolvers of your own keyed on the user must read the context the same way.
33
39
  - New project page or block → add its permission ids to the plans that should get it, or tenants lose it.
34
40
  - Seeding plans from code: write name, price, currency, interval, billing mode; leave `paymentProviderRefs` to dms-saas.
41
+ `name`, `description` and `borderLabel` are localized (`{ en, fr }` + `.localize("*")`), never i18n keys; Stripe gets the `en` text.
35
42
  - Features: `displayName` / `tooltip` are localized (`{ en, fr }` + `.localize("*")`), never i18n keys.
43
+ - Plan `description` and `borderLabel` may be `$i18n.key` (translated on every screen); `name` stays plain text.
36
44
 
37
45
  ## Extension points (`@antelopejs/interface-dms-saas`)
38
46
 
@@ -47,10 +55,22 @@ User docs: `docs/` of this package, published at https://dms.antelopejs.com/docs
47
55
  | React to create/suspend/reactivate | `RegisterTenantLifecycleConsumer` from `/tenant-lifecycle` (root namespace `tenantLifecycle`); dedupe by `operationId`; gate on `IsTenantProvisioningCommitted` |
48
56
 
49
57
  Pages you add stay backend-declared blocks; only the missing block is a `CustomComponent`, with `.meta({ name, description, icon })`.
58
+ A page with a period or live data opens with the DMS page toolbar (`pageToolbar()` / `PageToolbar()` from
59
+ `@antelopejs/interface-dms/base`), as the dashboard (period, `rememberKey: "saas"`, no `live`) and the migration detail (`live`, no period) do.
60
+ A period with figures to compare offers `comparisons: ["previous-period", "previous-year", "none"]` (through `pageToolbar()`, several comparisons give the menu on `"previous-period"` by default: set neither `defaultComparison` nor `comparisonControl`); its routes read the window from `compareFrom` / `compareTo` (`readPeriodQuery`), lay comparison series on the current buckets, and send no delta for `comparison=none`.
50
61
 
51
62
  ## Gotchas
52
63
 
53
64
  - `reconciliation_required` (operator actions, migrations, webhooks) is deliberate: never delete records or replay blindly.
65
+ - Stripe is the only billing path: demos and tests use a Stripe **test** account (`sk_test_`/`pk_test_`) with webhooks
66
+ forwarded (`stripe listen --forward-to localhost:5010/api/saas/webhooks/stripe`). Webhooks move checkout → active,
67
+ trial end, failed and recovered payments, cancellation; nothing else advances a trial or a renewal.
68
+ - Without webhooks only the crons move states: 01:00 past due → suspended after `autoSuspendDelayDays` (14) from
69
+ `pastDueSince`; 02:00 complimentary `freeUntil` passed → past due; 04:30 cancelled → workspace **and data deleted**
70
+ `dataRetentionDaysAfterCancellation` (30) days after the subscription's last write (`updatedAt`).
71
+ - Direct table seeds (like the playground): keep dates relative to now, an `active` row without `stripeSubscriptionId`
72
+ is free (0 MRR), fake Stripe ids make Stripe-calling actions fail; call `RecomputeTenantBillingState(tenantId)` after.
73
+ A workspace first published already cancelled counts churn only when it has a paid invoice above 0.
54
74
  - Checkout errors: `422 checkout_rejected` (retry), `503 checkout_unavailable`, `409 checkout_in_progress`.
55
75
  - Upgrading old databases needs manual row fixes (`isComplimentary`, `documentType`, `revision`, `paidUsagePeriods`, localized features).
56
76
  - Passwords follow the DMS policy: letters, digits and `@$!%*?&` only.