@colixsystems/widget-sdk 0.343.2 → 0.345.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.
package/README.md CHANGED
@@ -75,8 +75,8 @@ The data layer lives in **four separate domain-client packages**, each instantia
75
75
  | **DIRECTORY** | `useInvites(query)` (optional: query) | `{ invites, loading, error, refetch, resend, revoke }` | `directory.invites.*` — `users.write:*` + the SystemAcl `users.write` capability (the whole invite surface, list included). `query` is `{ status?, q?, app_user_id?, limit?, offset? }` with `status` ∈ `pending \| accepted \| revoked \| expired \| not_sent \| open \| all` (endpoint default `all`; `open` = `pending`, `not_sent` or `expired`); `q` matches the invite's name or email, `app_user_id` returns the invites reserving that user id. `resend(inviteId)` sends the invitation — the first send of a `not_sent` one included. |
76
76
  | **DIRECTORY** | `useBankIdLink()` | `{ linked, available, status, qr, message, startLink, refresh, cancel, unlink, refetchStatus, … }` | `directory.bankid.*` — no scope (JWT-gated self-service). While `pending`, render `qr` in an `<Image>` (`bankid-order-not-shown` otherwise). |
77
77
  | **FILESTORE** (`ctx.filestore`) | `usePdfExport({ spaceType, folderId })` (optional: spaceType, folderId) | `{ openPdf, opening, canOpenPdf, exportToPdf, exporting, error, lastExported }` | `ctx.filestore.files.renderPdf` + `ctx.device.pdfViewer`, `ctx.filestore.files.exportPdf` — `files.write:*`. `openPdf(html, { fileName? })` renders the HTML to a PDF server-side and OPENS it (web: PDF tab; native: print / share sheet) without saving. `exportToPdf(html, { fileName?, folderId? })` renders it and saves it as a file (`application/pdf`). Same server-side renderer on web + native. |
78
- | **PAYMENTS** (`ctx.payments`) | `useAccessPlans()` | `{ plans, loading, error, purchaseAvailable, purchase, cancel, refresh }` | `ctx.payments.{listAccessPlans,purchaseAccessPlan,cancelAccessPlan}` — `payments.charge:appUser`. Plans selling access to restricted pages; `purchase(planId)` names only the plan, the server sets price and group. `purchaseAvailable` is `false` in an iOS / Android build (digital goods need store billing): show a visible not-available state. |
79
- | **PAYMENTS** (`ctx.payments`) | `useAppSubscription()` | `{ subscription, loading, error, cancel, refresh }` | `ctx.payments.{getAppSubscription,cancelAppSubscription}` — `payments.charge:appUser`. The signed-in user's subscription to a paid app (`{ active, renews, access_ends_at }`); `cancel()` stops it renewing, and access runs to `access_ends_at`. |
78
+ | **PAYMENTS** (`ctx.payments`) | `useAccessPlans()` | `{ plans, loading, error, purchaseAvailable, purchase, cancel, refresh }` | `ctx.payments.{listAccessPlans,purchaseAccessPlan,cancelAccessPlan}` — `payments.charge:appUser`. Plans selling access to restricted pages; `purchase(planId)` names only the plan, the server sets price and group. A held plan's `member_since` is when the user became a member (first paid charge, else when access was granted). `purchaseAvailable` is `false` in an iOS / Android build (digital goods need store billing): show a visible not-available state. |
79
+ | **PAYMENTS** (`ctx.payments`) | `useAppSubscription()` | `{ subscription, loading, error, cancel, refresh }` | `ctx.payments.{getAppSubscription,cancelAppSubscription}` — `payments.charge:appUser`. The signed-in user's subscription to a paid app (`{ active, renews, access_ends_at, member_since }`); `cancel()` stops it renewing, and access runs to `access_ends_at`. `member_since` is when they became a subscriber. |
80
80
  | **PAYMENTS** (`ctx.payments`) | `usePayments()` | `{ requestPayment, getPayment, requestGuestPayment, getGuestPayment }` | `ctx.payments.*` — `payments.charge:appUser`; guest checkout (`requestGuestPayment`, a visitor with no account buying physical goods for an order they created) also `payments.charge:guest`. `requestPayment` requires `kind` (`"physical"` \| `"service"` \| `"digital"`): what is sold. A call without it is a publish-blocking `payment-kind-required` finding. A `"digital"` charge is refused in an iOS or Android build (`DIGITAL_SALE_NEEDS_STORE_BILLING`). Selling an order (goods, a booking, a ticket)? Create its row first and pass `order: { table_id, record_id }`, in a table with a payment-status column: only the payment marks the order paid, so never write a paid status yourself (a `payment-status-written` finding). The server refuses an order it cannot settle with `ORDER_NOT_FOUND`, `ORDER_NOT_PAYABLE` or `ORDER_ALREADY_PAID`, none retryable. Rejects with `PaymentError { code, message, retryable }`; when `retryable` is `false` show `message` and drop the retry. Charges are accepted ONLY in the currency the workspace sells in — omit `currency` and the platform applies it (a disagreeing literal is a publish-blocking `payment-currency` finding). |
81
81
  | **NOTIFICATIONS** (`ctx.notifications`) | `useSendNotification()` | `{ send, sending, error }` | `ctx.notifications.send` — `notifications.send:appUser`. `send({ recipient_user_id, title, body, link?, payload? })` notifies one app user in the same workspace; call from an event handler (never render); rejects with `NotificationError`. |
82
82
  | **NOTIFICATIONS** (`ctx.notifications`) | `useRecordMutes(tableId)` | `{ isMuted, loading, error, refetch }` | `ctx.notifications.mutes` — no scope. Which records of one table the signed-in user has muted, in one request for a whole list; `isMuted(recordId)` turns false when a timed mute lapses, and a `useRecordMute` write shows at once. |
@@ -91,7 +91,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
91
91
 
92
92
  ## Status
93
93
 
94
- `v0.343.2` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
94
+ `v0.345.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
95
+
96
+ ### What's new in 0.345.0 (contract 1.282.0)
97
+
98
+ **A member's start date.** Each plan from `useAccessPlans()` and the `subscription` from `useAppSubscription()` now carry `member_since`: when the signed-in user became a member, as an ISO time (their first paid charge, else when access was granted: the same date the workspace owner sees in Members), or null when they hold none. Show "Member since" from it with `useI18n().formatDate(plan.member_since)`; never keep a join date in a table of your own, which nothing fills when someone pays. When the user holds several live grants for one plan it is the earliest. The injected payments client returns it from `listAccessPlans()` and `getAppSubscription()` (`@colixsystems/payments-client` 0.8.0). Additive.
99
+
100
+ ### What's new in 0.344.0 (contract 1.281.0)
101
+
102
+ **The linter flags a date shown with a fixed pattern or locale.** A date written with date-fns `format(d, "dd/MM/yyyy")`, `toLocaleDateString("en-GB")`, `new Intl.DateTimeFormat("de-DE")` or a string built from `getDate()` and `getMonth()` reads the same in every app language, and `03/01/2027` is a different day in another country. The new `date-shown-fixed-format` finding names `useI18n().formatDate(value)` as the fix, and `Intl.DateTimeFormat(useI18n().locale, …)` for part of a date. For date-fns it reads `format`, `lightFormat` and date-fns-tz `formatInTimeZone`, imported by name, by default (`date-fns/format`) or as a namespace (`import * as dateFns`). A pattern is flagged when it prints words (`EEE`, `MMM`, `MMMM`, `do`, the localized `P` tokens), which date-fns writes in English unless the call passes a `locale` other than one fixed `date-fns/locale` import, or when it writes a numeric day and month in any order but year-month-day. No finding for: a numeric year-month-day pattern (`yyyy-MM-dd`, `yyyyMMdd`), a date-fns pattern with no day and month and no words (`HH:mm`, `yyyy`), date math (`addDays`, `differenceInDays`), a locale taken from `useI18n().locale`, and a fixed year-first locale (`sv-SE`, `en-CA`, …) with no options or only numeric and `timeZone` options, the usual way to build a local `YYYY-MM-DD` key. Not read: `require("date-fns")` and the curried `date-fns/fp` formatters. It is a **warning**: `appstudio-widget lint` prints it and an uploaded widget still publishes, because the linter reads text and cannot always tell a shown date from a stored one. The in-Studio widget agent's publish gate refuses every lint finding, warnings included, so a widget it writes or edits is repaired before it ships: an edit that touches a widget with its own fixed-pattern date helper rewrites the helper to use `formatDate`. That repair holds even where a widget hard-coded Swedish dates in an app whose language is still English: the date then follows the app's language.
95
103
 
96
104
  ### What's new in 0.343.2 (contract 1.280.0)
97
105
 
package/dist/contract.cjs CHANGED
@@ -2521,7 +2521,7 @@ const HOOKS = [
2521
2521
  signature: "useAccessPlans()",
2522
2522
  returnShape: {
2523
2523
  plans:
2524
- "Array<{ id, name, price_cents, currency, billing: \"one_time\" | \"monthly\", owned, renews, access_ends_at, purchase_available }> // owned: the user holds it; renews: a held monthly plan will charge again; access_ends_at: end of held access without a renewal (null for one-time); purchase_available: this plan can be bought here — false in an iOS/Android build for a plan the workspace does not sell in-app, and for a plan the user holds that is no longer on sale (listed so they can still cancel it)",
2524
+ "Array<{ id, name, price_cents, currency, billing: \"one_time\" | \"monthly\", owned, renews, access_ends_at, member_since, purchase_available }> // owned: the user holds it; renews: a held monthly plan will charge again; access_ends_at: end of held access without a renewal (null for one-time); member_since: the member's start date, their first paid charge, else when access was granted (null when not held; show it with useI18n().formatDate); purchase_available: this plan can be bought here — false in an iOS/Android build for a plan the workspace does not sell in-app, and for a plan the user holds that is no longer on sale (listed so they can still cancel it)",
2525
2525
  loading: "boolean",
2526
2526
  error: "PaymentError | null",
2527
2527
  purchaseAvailable:
@@ -2545,11 +2545,11 @@ const HOOKS = [
2545
2545
  signature: "useAppSubscription()",
2546
2546
  returnShape: {
2547
2547
  subscription:
2548
- "{ active, renews, access_ends_at } | null // the signed-in user's subscription to the app itself (a paid app): active = they hold paid access now; renews = a subscription will charge again (false once cancelled, or when bought in the App Store / Google Play); access_ends_at = when access ends without a renewal (null while it has no end, or when not held)",
2548
+ "{ active, renews, access_ends_at, member_since } | null // the signed-in user's subscription to the app itself (a paid app): active = they hold paid access now; renews = a subscription will charge again (false once cancelled, or when bought in the App Store / Google Play); access_ends_at = when access ends without a renewal (null while it has no end, or when not held); member_since = the subscriber's start date, their first paid charge, else when access was granted (null when not held)",
2549
2549
  loading: "boolean",
2550
2550
  error: "PaymentError | null",
2551
2551
  cancel:
2552
- "() => Promise<{ active, renews: false, access_ends_at }> // stop it renewing; access runs to access_ends_at, nothing is refunded — offer it whenever renews is true",
2552
+ "() => Promise<{ active, renews: false, access_ends_at, member_since }> // stop it renewing; access runs to access_ends_at, nothing is refunded — offer it whenever renews is true",
2553
2553
  refresh: "() => Promise<void>",
2554
2554
  },
2555
2555
  requiredContextSlice: ["payments.getAppSubscription", "payments.cancelAppSubscription"],
@@ -4699,7 +4699,7 @@ const WIDGET_CONTEXT_SHAPE = {
4699
4699
  },
4700
4700
  payments: {
4701
4701
  description:
4702
- "Injected @colixsystems/payments-client instance (REQ-BILL-07-WIDGETPAY). { requestPayment(body) -> Promise<{ id, status }>, getPayment(id) -> Promise<payment>, requestGuestPayment(body) -> Promise<{ id, status }>, getGuestPayment(id) -> Promise<payment>, listAccessPlans() -> Promise<{ data, meta }>, purchaseAccessPlan({ plan_id, return_path? }) -> Promise<{ plan_id, status }>, cancelAccessPlan(planId) -> Promise<{ plan_id, renews, access_ends_at }>, getAppSubscription() -> Promise<{ active, renews, access_ends_at }>, cancelAppSubscription() -> Promise<{ active, renews, access_ends_at }> }; wire is snake_case (amount_cents, return_path, order). Backs usePayments(), useAccessPlans() and useAppSubscription(); requires the payments.charge:appUser scope, and guest checkout (requestGuestPayment, a visitor with no account buying physical goods) also payments.charge:guest. The host opens hosted Checkout itself — same-tab on web, in-app browser on native (or auto-confirms under the mock provider); the charge settles to the workspace owner.",
4702
+ "Injected @colixsystems/payments-client instance (REQ-BILL-07-WIDGETPAY). { requestPayment(body) -> Promise<{ id, status }>, getPayment(id) -> Promise<payment>, requestGuestPayment(body) -> Promise<{ id, status }>, getGuestPayment(id) -> Promise<payment>, listAccessPlans() -> Promise<{ data, meta }>, purchaseAccessPlan({ plan_id, return_path? }) -> Promise<{ plan_id, status }>, cancelAccessPlan(planId) -> Promise<{ plan_id, renews, access_ends_at }>, getAppSubscription() -> Promise<{ active, renews, access_ends_at, member_since }>, cancelAppSubscription() -> Promise<{ active, renews, access_ends_at, member_since }> }; wire is snake_case (amount_cents, return_path, order). Backs usePayments(), useAccessPlans() and useAppSubscription(); requires the payments.charge:appUser scope, and guest checkout (requestGuestPayment, a visitor with no account buying physical goods) also payments.charge:guest. The host opens hosted Checkout itself — same-tab on web, in-app browser on native (or auto-confirms under the mock provider); the charge settles to the workspace owner.",
4703
4703
  required: true,
4704
4704
  fields: {
4705
4705
  requestPayment: "function",
@@ -7149,7 +7149,14 @@ const CONTRACT = deepFreeze({
7149
7149
  // 1.280.0: additive (sc-18010) — connections.add and connections.signIn
7150
7150
  // may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
7151
7151
  // app's administrator to register it first. No token fixes it.
7152
- version: "1.280.0",
7152
+ // 1.281.0: stricter lint (sc-18484) — a date shown with a fixed pattern or
7153
+ // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7154
+ // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7155
+ // warning; the widget agent's publish gate blocks on it.
7156
+ // 1.282.0: additive (sc-18485) — useAccessPlans() plans and
7157
+ // useAppSubscription() subscription carry member_since, the member's start
7158
+ // date: first paid charge, else when access was granted (null when not held).
7159
+ version: "1.282.0",
7153
7160
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7154
7161
  hooks: HOOKS,
7155
7162
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -2516,7 +2516,7 @@ const HOOKS = [
2516
2516
  signature: "useAccessPlans()",
2517
2517
  returnShape: {
2518
2518
  plans:
2519
- "Array<{ id, name, price_cents, currency, billing: \"one_time\" | \"monthly\", owned, renews, access_ends_at, purchase_available }> // owned: the user holds it; renews: a held monthly plan will charge again; access_ends_at: end of held access without a renewal (null for one-time); purchase_available: this plan can be bought here — false in an iOS/Android build for a plan the workspace does not sell in-app, and for a plan the user holds that is no longer on sale (listed so they can still cancel it)",
2519
+ "Array<{ id, name, price_cents, currency, billing: \"one_time\" | \"monthly\", owned, renews, access_ends_at, member_since, purchase_available }> // owned: the user holds it; renews: a held monthly plan will charge again; access_ends_at: end of held access without a renewal (null for one-time); member_since: the member's start date, their first paid charge, else when access was granted (null when not held; show it with useI18n().formatDate); purchase_available: this plan can be bought here — false in an iOS/Android build for a plan the workspace does not sell in-app, and for a plan the user holds that is no longer on sale (listed so they can still cancel it)",
2520
2520
  loading: "boolean",
2521
2521
  error: "PaymentError | null",
2522
2522
  purchaseAvailable:
@@ -2540,11 +2540,11 @@ const HOOKS = [
2540
2540
  signature: "useAppSubscription()",
2541
2541
  returnShape: {
2542
2542
  subscription:
2543
- "{ active, renews, access_ends_at } | null // the signed-in user's subscription to the app itself (a paid app): active = they hold paid access now; renews = a subscription will charge again (false once cancelled, or when bought in the App Store / Google Play); access_ends_at = when access ends without a renewal (null while it has no end, or when not held)",
2543
+ "{ active, renews, access_ends_at, member_since } | null // the signed-in user's subscription to the app itself (a paid app): active = they hold paid access now; renews = a subscription will charge again (false once cancelled, or when bought in the App Store / Google Play); access_ends_at = when access ends without a renewal (null while it has no end, or when not held); member_since = the subscriber's start date, their first paid charge, else when access was granted (null when not held)",
2544
2544
  loading: "boolean",
2545
2545
  error: "PaymentError | null",
2546
2546
  cancel:
2547
- "() => Promise<{ active, renews: false, access_ends_at }> // stop it renewing; access runs to access_ends_at, nothing is refunded — offer it whenever renews is true",
2547
+ "() => Promise<{ active, renews: false, access_ends_at, member_since }> // stop it renewing; access runs to access_ends_at, nothing is refunded — offer it whenever renews is true",
2548
2548
  refresh: "() => Promise<void>",
2549
2549
  },
2550
2550
  requiredContextSlice: ["payments.getAppSubscription", "payments.cancelAppSubscription"],
@@ -4694,7 +4694,7 @@ const WIDGET_CONTEXT_SHAPE = {
4694
4694
  },
4695
4695
  payments: {
4696
4696
  description:
4697
- "Injected @colixsystems/payments-client instance (REQ-BILL-07-WIDGETPAY). { requestPayment(body) -> Promise<{ id, status }>, getPayment(id) -> Promise<payment>, requestGuestPayment(body) -> Promise<{ id, status }>, getGuestPayment(id) -> Promise<payment>, listAccessPlans() -> Promise<{ data, meta }>, purchaseAccessPlan({ plan_id, return_path? }) -> Promise<{ plan_id, status }>, cancelAccessPlan(planId) -> Promise<{ plan_id, renews, access_ends_at }>, getAppSubscription() -> Promise<{ active, renews, access_ends_at }>, cancelAppSubscription() -> Promise<{ active, renews, access_ends_at }> }; wire is snake_case (amount_cents, return_path, order). Backs usePayments(), useAccessPlans() and useAppSubscription(); requires the payments.charge:appUser scope, and guest checkout (requestGuestPayment, a visitor with no account buying physical goods) also payments.charge:guest. The host opens hosted Checkout itself — same-tab on web, in-app browser on native (or auto-confirms under the mock provider); the charge settles to the workspace owner.",
4697
+ "Injected @colixsystems/payments-client instance (REQ-BILL-07-WIDGETPAY). { requestPayment(body) -> Promise<{ id, status }>, getPayment(id) -> Promise<payment>, requestGuestPayment(body) -> Promise<{ id, status }>, getGuestPayment(id) -> Promise<payment>, listAccessPlans() -> Promise<{ data, meta }>, purchaseAccessPlan({ plan_id, return_path? }) -> Promise<{ plan_id, status }>, cancelAccessPlan(planId) -> Promise<{ plan_id, renews, access_ends_at }>, getAppSubscription() -> Promise<{ active, renews, access_ends_at, member_since }>, cancelAppSubscription() -> Promise<{ active, renews, access_ends_at, member_since }> }; wire is snake_case (amount_cents, return_path, order). Backs usePayments(), useAccessPlans() and useAppSubscription(); requires the payments.charge:appUser scope, and guest checkout (requestGuestPayment, a visitor with no account buying physical goods) also payments.charge:guest. The host opens hosted Checkout itself — same-tab on web, in-app browser on native (or auto-confirms under the mock provider); the charge settles to the workspace owner.",
4698
4698
  required: true,
4699
4699
  fields: {
4700
4700
  requestPayment: "function",
@@ -7144,7 +7144,14 @@ const CONTRACT = deepFreeze({
7144
7144
  // 1.280.0: additive (sc-18010) — connections.add and connections.signIn
7145
7145
  // may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
7146
7146
  // app's administrator to register it first. No token fixes it.
7147
- version: "1.280.0",
7147
+ // 1.281.0: stricter lint (sc-18484) — a date shown with a fixed pattern or
7148
+ // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7149
+ // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7150
+ // warning; the widget agent's publish gate blocks on it.
7151
+ // 1.282.0: additive (sc-18485) — useAccessPlans() plans and
7152
+ // useAppSubscription() subscription carry member_since, the member's start
7153
+ // date: first paid charge, else when access was granted (null when not held).
7154
+ version: "1.282.0",
7148
7155
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7149
7156
  hooks: HOOKS,
7150
7157
  primitives: PRIMITIVES,
package/dist/hooks.js CHANGED
@@ -7504,11 +7504,13 @@ export function usePayments() {
7504
7504
  * `{ plans, loading, error, purchaseAvailable, purchase, cancel, refresh }`:
7505
7505
  *
7506
7506
  * plans → [{ id, name, price_cents, currency, billing, owned, renews,
7507
- * access_ends_at, purchase_available }] — `billing` is "one_time" or
7508
- * "monthly"; `owned` is true once the user holds the plan; `renews` while
7509
- * a held monthly plan will charge again; `access_ends_at` is when held
7510
- * access ends without a renewal (null for one-time access);
7511
- * `purchase_available` is whether this plan can be bought here.
7507
+ * access_ends_at, member_since, purchase_available }] — `billing` is
7508
+ * "one_time" or "monthly"; `owned` is true once the user holds the plan;
7509
+ * `renews` while a held monthly plan will charge again; `access_ends_at`
7510
+ * is when held access ends without a renewal (null for one-time access);
7511
+ * `member_since` is the member's start date, their first paid charge,
7512
+ * else when access was granted (null when not held); `purchase_available` is whether this plan can be
7513
+ * bought here.
7512
7514
  * Render the price with `useWorkspaceCurrency().formatMoney(price_cents)`.
7513
7515
  * purchaseAvailable → false where no plan can be bought here: page access is
7514
7516
  * a digital good, and an iOS / Android build sells only the plans the
@@ -7575,11 +7577,12 @@ function _accessPlansState(res) {
7575
7577
  * sc-15342 — the signed-in app user's own subscription to the app itself (a
7576
7578
  * paid app), and the control to stop it renewing.
7577
7579
  *
7578
- * subscription → { active, renews, access_ends_at }. `active`: they hold paid
7579
- * access to the app now; `renews`: a subscription will charge again;
7580
- * `access_ends_at`: when access ends without a renewal (null while it has
7581
- * no end, or when not held).
7582
- * cancel() → Promise<{ active, renews: false, access_ends_at }> — stop the
7580
+ * subscription → { active, renews, access_ends_at, member_since }. `active`:
7581
+ * they hold paid access to the app now; `renews`: a subscription will
7582
+ * charge again; `access_ends_at`: when access ends without a renewal (null
7583
+ * while it has no end, or when not held); `member_since`: their first
7584
+ * paid charge, else when access was granted (null when not held).
7585
+ * cancel() → Promise<{ active, renews: false, access_ends_at, member_since }> — stop the
7583
7586
  * subscription renewing. Access continues until `access_ends_at`, then
7584
7587
  * ends; nothing is refunded. Offer it whenever `renews` is true. Access
7585
7588
  * bought in the App Store or Google Play is cancelled in the store, so it
package/dist/index.d.ts CHANGED
@@ -1713,6 +1713,8 @@ export interface AccessPlan {
1713
1713
  renews: boolean;
1714
1714
  /** ISO time held access ends without a renewal; null for one-time access. */
1715
1715
  access_ends_at: string | null;
1716
+ /** ISO time they became a member: first paid charge, else when access was granted; null when not held. */
1717
+ member_since: string | null;
1716
1718
  /**
1717
1719
  * Whether this plan can be bought here: false in a store build that does not
1718
1720
  * sell it in-app, and for a plan the user holds that is no longer on sale
@@ -1758,6 +1760,8 @@ export interface AppSubscription {
1758
1760
  renews: boolean;
1759
1761
  /** ISO time access ends without a renewal; null while it has no end, or when not held. */
1760
1762
  access_ends_at: string | null;
1763
+ /** ISO time they became a subscriber: first paid charge, else when access was granted; null when not held. */
1764
+ member_since: string | null;
1761
1765
  }
1762
1766
 
1763
1767
  export interface AppSubscriptionApi {
package/dist/linter.cjs CHANGED
@@ -1851,6 +1851,159 @@ function _hardcodedCurrencyLabelRules(source) {
1851
1851
  }
1852
1852
 
1853
1853
 
1854
+ // Story 18484 — a date shown with a fixed pattern or locale reads the same in
1855
+ // every app language, and 03/01/2027 is another day abroad. A `warning`: the
1856
+ // agent's publish gate blocks on every lint finding, so the agent repairs it
1857
+ // there, while an uploaded widget ships with it (text alone cannot tell a
1858
+ // shown date from a stored one). A numeric year-month-day key is data, never flagged.
1859
+ const DATE_FNS_IMPORT_RE =
1860
+ /\bimport\s+(?:\*\s*as\s+([\w$]+)|([\w$]+)|\{([^{}]*)\})\s*from\s*["'](date-fns(?:-tz)?)(\/[\w/-]+)?["']/g;
1861
+ // The pattern's argument position, by formatter name.
1862
+ const DATE_FNS_FORMATTERS = new Map([["format", 1], ["lightFormat", 1], ["formatInTimeZone", 2]]);
1863
+ // Tokens that print words (weekday, month name, localized date, ordinal), English unless given a locale.
1864
+ const DATE_FNS_TEXT_TOKEN_RE = /E|M{3}|L{3}|P|do/;
1865
+ const FIXED_LOCALE_RE = /(\.toLocaleDateString|\bDateTimeFormat)\s*\(\s*(["'])([A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*)\2/g;
1866
+ // Locales whose numeric date is YYYY-MM-DD: the usual idiom for a local date key.
1867
+ const YEAR_FIRST_LOCALES = new Set(["sv", "sv-SE", "en-CA", "fr-CA", "lt", "lt-LT", "en-SE"]);
1868
+ const LOCALE_OPTIONS_RE = /^\s*,\s*\{([^{}]{0,300})\}/;
1869
+ const TEXT_DATE_OPTION_RE = /\bweekday\b|\bera\b|\bmonth\s*:\s*["'](?:long|short|narrow)|\bdateStyle\s*:\s*["'](?:full|long|medium)/;
1870
+ const LOCALE_OPTION_RE = /\blocale\b\s*(?::\s*([\w$]+)(\s*\.)?)?/;
1871
+ const DAY_GETTER_RE = /\.get(?:UTC)?Date\s*\(\s*\)/;
1872
+ const MONTH_GETTER_RE = /\.get(?:UTC)?Month\s*\(\s*\)/;
1873
+ const YEAR_GETTER_RE = /\.get(?:UTC)?FullYear\s*\(\s*\)/;
1874
+ const STRING_BUILD_RE = /\$\{|["'`]\s*\+|\+\s*["'`]|\]\s*\.join\s*\(/;
1875
+ // How far a formatter call's arguments may run.
1876
+ const DATE_ARG_SPAN = 400;
1877
+
1878
+ const CALL_RE = /(?<![\w$.])([\w$]+)\s*\(/g;
1879
+ const MEMBER_CALL_RE = /(?<![\w$.])([\w$]+)\s*\.\s*([\w$]+)\s*\(/g;
1880
+
1881
+ /** date-fns formatter names and namespaces, and the locale objects it was given. */
1882
+ function _dateFnsImports(strings) {
1883
+ const imports = { formatters: new Map(), namespaces: new Set(), locales: new Set(), localeNamespaces: new Set() };
1884
+ for (const [, ns, deflt, named, , subpath = ""] of strings.matchAll(DATE_FNS_IMPORT_RE)) {
1885
+ if (subpath.startsWith("/locale")) {
1886
+ if (ns) imports.localeNamespaces.add(ns);
1887
+ if (deflt) imports.locales.add(deflt);
1888
+ for (const spec of (named || "").split(",")) {
1889
+ const [imported, local] = spec.trim().split(/\s+as\s+/);
1890
+ if (imported) imports.locales.add(local || imported);
1891
+ }
1892
+ continue;
1893
+ }
1894
+ if (ns && !subpath) imports.namespaces.add(ns);
1895
+ if (deflt && DATE_FNS_FORMATTERS.has(subpath.slice(1))) imports.formatters.set(deflt, DATE_FNS_FORMATTERS.get(subpath.slice(1)));
1896
+ for (const spec of (named || "").split(",")) {
1897
+ const [imported, local] = spec.trim().split(/\s+as\s+/);
1898
+ if (DATE_FNS_FORMATTERS.has(imported)) imports.formatters.set(local || imported, DATE_FNS_FORMATTERS.get(imported));
1899
+ }
1900
+ }
1901
+ return imports;
1902
+ }
1903
+
1904
+ /** Where each top-level argument of a call starts, and where the call ends. */
1905
+ function _callArgs(code, openParen) {
1906
+ const limit = Math.min(code.length, openParen + DATE_ARG_SPAN);
1907
+ const starts = [openParen + 1];
1908
+ let depth = 0;
1909
+ for (let i = openParen + 1; i < limit; i += 1) {
1910
+ const ch = code[i];
1911
+ if (ch === "(" || ch === "[" || ch === "{") depth += 1;
1912
+ else if (ch === ")" || ch === "]" || ch === "}") {
1913
+ if (depth === 0) return { starts, end: i };
1914
+ depth -= 1;
1915
+ } else if (ch === "," && depth === 0) starts.push(i + 1);
1916
+ }
1917
+ return { starts, end: limit };
1918
+ }
1919
+
1920
+ const _stringLiteral = (text) => /^\s*(["'`])((?:(?!\1)[^$\\]){1,80})\1/.exec(text)?.[2] ?? null;
1921
+
1922
+ /** True when the call's options pass a locale that is not one fixed date-fns locale. */
1923
+ function _appLocaleOption(options, imports) {
1924
+ const m = LOCALE_OPTION_RE.exec(options);
1925
+ if (!m) return false;
1926
+ if (!m[1]) return true;
1927
+ return !(imports.locales.has(m[1]) || (imports.localeNamespaces.has(m[1]) && m[2]));
1928
+ }
1929
+
1930
+ /** A date-fns pattern that prints words without the app's locale, or a day and month not year-first. */
1931
+ function _fixedDatePattern(pattern, appLocale) {
1932
+ const tokens = pattern.replace(/'[^']*'/g, "");
1933
+ if (DATE_FNS_TEXT_TOKEN_RE.test(tokens)) return !appLocale;
1934
+ const day = tokens.indexOf("d");
1935
+ const month = tokens.search(/[ML]/);
1936
+ if (day < 0 || month < 0) return false;
1937
+ const year = tokens.indexOf("y");
1938
+ return !(year >= 0 && year < month && month < day);
1939
+ }
1940
+
1941
+ /** A literal locale, unless it writes a numeric year-first date (a key) with no words. */
1942
+ function _fixedLocaleCall(strings, locale, after) {
1943
+ if (!YEAR_FIRST_LOCALES.has(locale)) return true;
1944
+ const options = LOCALE_OPTIONS_RE.exec(strings.slice(after, after + DATE_ARG_SPAN));
1945
+ return !!options && TEXT_DATE_OPTION_RE.test(options[1]);
1946
+ }
1947
+
1948
+ function _handBuiltDateLine(codeLine, stringsLine) {
1949
+ const day = codeLine.search(DAY_GETTER_RE);
1950
+ const month = codeLine.search(MONTH_GETTER_RE);
1951
+ if (day < 0 || month < 0 || !STRING_BUILD_RE.test(stringsLine)) return false;
1952
+ const year = codeLine.search(YEAR_GETTER_RE);
1953
+ return day < month || year > day;
1954
+ }
1955
+
1956
+ function _fixedDateFormatRules(source) {
1957
+ const code = _stripNonCode(source);
1958
+ const strings = _stripNonCode(source, { keepStrings: true });
1959
+ const lineAt = _lineCounter(code);
1960
+ const shown = new Map();
1961
+ const report = (index, what) => {
1962
+ const line = lineAt(index);
1963
+ if (!shown.has(line)) shown.set(line, what);
1964
+ };
1965
+ const imports = _dateFnsImports(strings);
1966
+ const checkCall = (m, patternArg) => {
1967
+ const { starts, end } = _callArgs(code, m.index + m[0].length - 1);
1968
+ if (starts.length <= patternArg) return;
1969
+ const pattern = _stringLiteral(strings.slice(starts[patternArg], end));
1970
+ const options = starts.length > patternArg + 1 ? code.slice(starts[patternArg + 1], end) : "";
1971
+ if (pattern && _fixedDatePattern(pattern, _appLocaleOption(options, imports))) report(m.index, `pattern "${pattern}"`);
1972
+ };
1973
+ if (imports.formatters.size > 0) {
1974
+ for (const m of code.matchAll(CALL_RE)) {
1975
+ if (imports.formatters.has(m[1])) checkCall(m, imports.formatters.get(m[1]));
1976
+ }
1977
+ }
1978
+ if (imports.namespaces.size > 0) {
1979
+ for (const m of code.matchAll(MEMBER_CALL_RE)) {
1980
+ if (imports.namespaces.has(m[1]) && DATE_FNS_FORMATTERS.has(m[2])) checkCall(m, DATE_FNS_FORMATTERS.get(m[2]));
1981
+ }
1982
+ }
1983
+ for (const m of strings.matchAll(FIXED_LOCALE_RE)) {
1984
+ if (code.startsWith(m[1], m.index) && _fixedLocaleCall(strings, m[3], m.index + m[0].length)) {
1985
+ report(m.index, `locale "${m[3]}"`);
1986
+ }
1987
+ }
1988
+ const codeLines = code.split("\n");
1989
+ const stringLines = strings.split("\n");
1990
+ let offset = 0;
1991
+ codeLines.forEach((codeLine, i) => {
1992
+ if (_handBuiltDateLine(codeLine, stringLines[i])) report(offset, "day/month order built by hand");
1993
+ offset += codeLine.length + 1;
1994
+ });
1995
+ const lines = source.split(/\r?\n/);
1996
+ return [...shown].sort((a, b) => a[0] - b[0]).map(([line, what]) => ({
1997
+ rule: "date-shown-fixed-format",
1998
+ severity: "warning",
1999
+ label:
2000
+ `shows a date with a fixed ${what}, the same in every app language. Use useI18n().formatDate(value) ` +
2001
+ `({ time: true } adds the time); for part of a date, Intl.DateTimeFormat(useI18n().locale, …). date-fns is for date math.`,
2002
+ line,
2003
+ snippet: (lines[line - 1] || "").trim().slice(0, 200),
2004
+ }));
2005
+ }
2006
+
1854
2007
  // sc-4650 — soft warning: a widget that charges must tell a failure worth
1855
2008
  // retrying from a refusal only the workspace owner can lift. Collapsing every
1856
2009
  // rejection into one "please try again" is what sent payers round an
@@ -4627,6 +4780,7 @@ function lintSource(source, options) {
4627
4780
  findings.push(..._paymentKindRules(source));
4628
4781
  findings.push(..._paymentStatusWrittenRules(source));
4629
4782
  findings.push(..._hardcodedCurrencyLabelRules(source));
4783
+ findings.push(..._fixedDateFormatRules(source));
4630
4784
  findings.push(..._paymentErrorHandlingRules(source));
4631
4785
  findings.push(..._datastoreErrorHandlingRules(source));
4632
4786
  findings.push(..._readErrorHandlingRules(source));
package/dist/linter.js CHANGED
@@ -1846,6 +1846,159 @@ function _hardcodedCurrencyLabelRules(source) {
1846
1846
  }
1847
1847
 
1848
1848
 
1849
+ // Story 18484 — a date shown with a fixed pattern or locale reads the same in
1850
+ // every app language, and 03/01/2027 is another day abroad. A `warning`: the
1851
+ // agent's publish gate blocks on every lint finding, so the agent repairs it
1852
+ // there, while an uploaded widget ships with it (text alone cannot tell a
1853
+ // shown date from a stored one). A numeric year-month-day key is data, never flagged.
1854
+ const DATE_FNS_IMPORT_RE =
1855
+ /\bimport\s+(?:\*\s*as\s+([\w$]+)|([\w$]+)|\{([^{}]*)\})\s*from\s*["'](date-fns(?:-tz)?)(\/[\w/-]+)?["']/g;
1856
+ // The pattern's argument position, by formatter name.
1857
+ const DATE_FNS_FORMATTERS = new Map([["format", 1], ["lightFormat", 1], ["formatInTimeZone", 2]]);
1858
+ // Tokens that print words (weekday, month name, localized date, ordinal), English unless given a locale.
1859
+ const DATE_FNS_TEXT_TOKEN_RE = /E|M{3}|L{3}|P|do/;
1860
+ const FIXED_LOCALE_RE = /(\.toLocaleDateString|\bDateTimeFormat)\s*\(\s*(["'])([A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*)\2/g;
1861
+ // Locales whose numeric date is YYYY-MM-DD: the usual idiom for a local date key.
1862
+ const YEAR_FIRST_LOCALES = new Set(["sv", "sv-SE", "en-CA", "fr-CA", "lt", "lt-LT", "en-SE"]);
1863
+ const LOCALE_OPTIONS_RE = /^\s*,\s*\{([^{}]{0,300})\}/;
1864
+ const TEXT_DATE_OPTION_RE = /\bweekday\b|\bera\b|\bmonth\s*:\s*["'](?:long|short|narrow)|\bdateStyle\s*:\s*["'](?:full|long|medium)/;
1865
+ const LOCALE_OPTION_RE = /\blocale\b\s*(?::\s*([\w$]+)(\s*\.)?)?/;
1866
+ const DAY_GETTER_RE = /\.get(?:UTC)?Date\s*\(\s*\)/;
1867
+ const MONTH_GETTER_RE = /\.get(?:UTC)?Month\s*\(\s*\)/;
1868
+ const YEAR_GETTER_RE = /\.get(?:UTC)?FullYear\s*\(\s*\)/;
1869
+ const STRING_BUILD_RE = /\$\{|["'`]\s*\+|\+\s*["'`]|\]\s*\.join\s*\(/;
1870
+ // How far a formatter call's arguments may run.
1871
+ const DATE_ARG_SPAN = 400;
1872
+
1873
+ const CALL_RE = /(?<![\w$.])([\w$]+)\s*\(/g;
1874
+ const MEMBER_CALL_RE = /(?<![\w$.])([\w$]+)\s*\.\s*([\w$]+)\s*\(/g;
1875
+
1876
+ /** date-fns formatter names and namespaces, and the locale objects it was given. */
1877
+ function _dateFnsImports(strings) {
1878
+ const imports = { formatters: new Map(), namespaces: new Set(), locales: new Set(), localeNamespaces: new Set() };
1879
+ for (const [, ns, deflt, named, , subpath = ""] of strings.matchAll(DATE_FNS_IMPORT_RE)) {
1880
+ if (subpath.startsWith("/locale")) {
1881
+ if (ns) imports.localeNamespaces.add(ns);
1882
+ if (deflt) imports.locales.add(deflt);
1883
+ for (const spec of (named || "").split(",")) {
1884
+ const [imported, local] = spec.trim().split(/\s+as\s+/);
1885
+ if (imported) imports.locales.add(local || imported);
1886
+ }
1887
+ continue;
1888
+ }
1889
+ if (ns && !subpath) imports.namespaces.add(ns);
1890
+ if (deflt && DATE_FNS_FORMATTERS.has(subpath.slice(1))) imports.formatters.set(deflt, DATE_FNS_FORMATTERS.get(subpath.slice(1)));
1891
+ for (const spec of (named || "").split(",")) {
1892
+ const [imported, local] = spec.trim().split(/\s+as\s+/);
1893
+ if (DATE_FNS_FORMATTERS.has(imported)) imports.formatters.set(local || imported, DATE_FNS_FORMATTERS.get(imported));
1894
+ }
1895
+ }
1896
+ return imports;
1897
+ }
1898
+
1899
+ /** Where each top-level argument of a call starts, and where the call ends. */
1900
+ function _callArgs(code, openParen) {
1901
+ const limit = Math.min(code.length, openParen + DATE_ARG_SPAN);
1902
+ const starts = [openParen + 1];
1903
+ let depth = 0;
1904
+ for (let i = openParen + 1; i < limit; i += 1) {
1905
+ const ch = code[i];
1906
+ if (ch === "(" || ch === "[" || ch === "{") depth += 1;
1907
+ else if (ch === ")" || ch === "]" || ch === "}") {
1908
+ if (depth === 0) return { starts, end: i };
1909
+ depth -= 1;
1910
+ } else if (ch === "," && depth === 0) starts.push(i + 1);
1911
+ }
1912
+ return { starts, end: limit };
1913
+ }
1914
+
1915
+ const _stringLiteral = (text) => /^\s*(["'`])((?:(?!\1)[^$\\]){1,80})\1/.exec(text)?.[2] ?? null;
1916
+
1917
+ /** True when the call's options pass a locale that is not one fixed date-fns locale. */
1918
+ function _appLocaleOption(options, imports) {
1919
+ const m = LOCALE_OPTION_RE.exec(options);
1920
+ if (!m) return false;
1921
+ if (!m[1]) return true;
1922
+ return !(imports.locales.has(m[1]) || (imports.localeNamespaces.has(m[1]) && m[2]));
1923
+ }
1924
+
1925
+ /** A date-fns pattern that prints words without the app's locale, or a day and month not year-first. */
1926
+ function _fixedDatePattern(pattern, appLocale) {
1927
+ const tokens = pattern.replace(/'[^']*'/g, "");
1928
+ if (DATE_FNS_TEXT_TOKEN_RE.test(tokens)) return !appLocale;
1929
+ const day = tokens.indexOf("d");
1930
+ const month = tokens.search(/[ML]/);
1931
+ if (day < 0 || month < 0) return false;
1932
+ const year = tokens.indexOf("y");
1933
+ return !(year >= 0 && year < month && month < day);
1934
+ }
1935
+
1936
+ /** A literal locale, unless it writes a numeric year-first date (a key) with no words. */
1937
+ function _fixedLocaleCall(strings, locale, after) {
1938
+ if (!YEAR_FIRST_LOCALES.has(locale)) return true;
1939
+ const options = LOCALE_OPTIONS_RE.exec(strings.slice(after, after + DATE_ARG_SPAN));
1940
+ return !!options && TEXT_DATE_OPTION_RE.test(options[1]);
1941
+ }
1942
+
1943
+ function _handBuiltDateLine(codeLine, stringsLine) {
1944
+ const day = codeLine.search(DAY_GETTER_RE);
1945
+ const month = codeLine.search(MONTH_GETTER_RE);
1946
+ if (day < 0 || month < 0 || !STRING_BUILD_RE.test(stringsLine)) return false;
1947
+ const year = codeLine.search(YEAR_GETTER_RE);
1948
+ return day < month || year > day;
1949
+ }
1950
+
1951
+ function _fixedDateFormatRules(source) {
1952
+ const code = _stripNonCode(source);
1953
+ const strings = _stripNonCode(source, { keepStrings: true });
1954
+ const lineAt = _lineCounter(code);
1955
+ const shown = new Map();
1956
+ const report = (index, what) => {
1957
+ const line = lineAt(index);
1958
+ if (!shown.has(line)) shown.set(line, what);
1959
+ };
1960
+ const imports = _dateFnsImports(strings);
1961
+ const checkCall = (m, patternArg) => {
1962
+ const { starts, end } = _callArgs(code, m.index + m[0].length - 1);
1963
+ if (starts.length <= patternArg) return;
1964
+ const pattern = _stringLiteral(strings.slice(starts[patternArg], end));
1965
+ const options = starts.length > patternArg + 1 ? code.slice(starts[patternArg + 1], end) : "";
1966
+ if (pattern && _fixedDatePattern(pattern, _appLocaleOption(options, imports))) report(m.index, `pattern "${pattern}"`);
1967
+ };
1968
+ if (imports.formatters.size > 0) {
1969
+ for (const m of code.matchAll(CALL_RE)) {
1970
+ if (imports.formatters.has(m[1])) checkCall(m, imports.formatters.get(m[1]));
1971
+ }
1972
+ }
1973
+ if (imports.namespaces.size > 0) {
1974
+ for (const m of code.matchAll(MEMBER_CALL_RE)) {
1975
+ if (imports.namespaces.has(m[1]) && DATE_FNS_FORMATTERS.has(m[2])) checkCall(m, DATE_FNS_FORMATTERS.get(m[2]));
1976
+ }
1977
+ }
1978
+ for (const m of strings.matchAll(FIXED_LOCALE_RE)) {
1979
+ if (code.startsWith(m[1], m.index) && _fixedLocaleCall(strings, m[3], m.index + m[0].length)) {
1980
+ report(m.index, `locale "${m[3]}"`);
1981
+ }
1982
+ }
1983
+ const codeLines = code.split("\n");
1984
+ const stringLines = strings.split("\n");
1985
+ let offset = 0;
1986
+ codeLines.forEach((codeLine, i) => {
1987
+ if (_handBuiltDateLine(codeLine, stringLines[i])) report(offset, "day/month order built by hand");
1988
+ offset += codeLine.length + 1;
1989
+ });
1990
+ const lines = source.split(/\r?\n/);
1991
+ return [...shown].sort((a, b) => a[0] - b[0]).map(([line, what]) => ({
1992
+ rule: "date-shown-fixed-format",
1993
+ severity: "warning",
1994
+ label:
1995
+ `shows a date with a fixed ${what}, the same in every app language. Use useI18n().formatDate(value) ` +
1996
+ `({ time: true } adds the time); for part of a date, Intl.DateTimeFormat(useI18n().locale, …). date-fns is for date math.`,
1997
+ line,
1998
+ snippet: (lines[line - 1] || "").trim().slice(0, 200),
1999
+ }));
2000
+ }
2001
+
1849
2002
  // sc-4650 — soft warning: a widget that charges must tell a failure worth
1850
2003
  // retrying from a refusal only the workspace owner can lift. Collapsing every
1851
2004
  // rejection into one "please try again" is what sent payers round an
@@ -4622,6 +4775,7 @@ export function lintSource(source, options) {
4622
4775
  findings.push(..._paymentKindRules(source));
4623
4776
  findings.push(..._paymentStatusWrittenRules(source));
4624
4777
  findings.push(..._hardcodedCurrencyLabelRules(source));
4778
+ findings.push(..._fixedDateFormatRules(source));
4625
4779
  findings.push(..._paymentErrorHandlingRules(source));
4626
4780
  findings.push(..._datastoreErrorHandlingRules(source));
4627
4781
  findings.push(..._readErrorHandlingRules(source));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.343.2",
3
+ "version": "0.345.0",
4
4
  "description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/contract.js CHANGED
@@ -2516,7 +2516,7 @@ const HOOKS = [
2516
2516
  signature: "useAccessPlans()",
2517
2517
  returnShape: {
2518
2518
  plans:
2519
- "Array<{ id, name, price_cents, currency, billing: \"one_time\" | \"monthly\", owned, renews, access_ends_at, purchase_available }> // owned: the user holds it; renews: a held monthly plan will charge again; access_ends_at: end of held access without a renewal (null for one-time); purchase_available: this plan can be bought here — false in an iOS/Android build for a plan the workspace does not sell in-app, and for a plan the user holds that is no longer on sale (listed so they can still cancel it)",
2519
+ "Array<{ id, name, price_cents, currency, billing: \"one_time\" | \"monthly\", owned, renews, access_ends_at, member_since, purchase_available }> // owned: the user holds it; renews: a held monthly plan will charge again; access_ends_at: end of held access without a renewal (null for one-time); member_since: the member's start date, their first paid charge, else when access was granted (null when not held; show it with useI18n().formatDate); purchase_available: this plan can be bought here — false in an iOS/Android build for a plan the workspace does not sell in-app, and for a plan the user holds that is no longer on sale (listed so they can still cancel it)",
2520
2520
  loading: "boolean",
2521
2521
  error: "PaymentError | null",
2522
2522
  purchaseAvailable:
@@ -2540,11 +2540,11 @@ const HOOKS = [
2540
2540
  signature: "useAppSubscription()",
2541
2541
  returnShape: {
2542
2542
  subscription:
2543
- "{ active, renews, access_ends_at } | null // the signed-in user's subscription to the app itself (a paid app): active = they hold paid access now; renews = a subscription will charge again (false once cancelled, or when bought in the App Store / Google Play); access_ends_at = when access ends without a renewal (null while it has no end, or when not held)",
2543
+ "{ active, renews, access_ends_at, member_since } | null // the signed-in user's subscription to the app itself (a paid app): active = they hold paid access now; renews = a subscription will charge again (false once cancelled, or when bought in the App Store / Google Play); access_ends_at = when access ends without a renewal (null while it has no end, or when not held); member_since = the subscriber's start date, their first paid charge, else when access was granted (null when not held)",
2544
2544
  loading: "boolean",
2545
2545
  error: "PaymentError | null",
2546
2546
  cancel:
2547
- "() => Promise<{ active, renews: false, access_ends_at }> // stop it renewing; access runs to access_ends_at, nothing is refunded — offer it whenever renews is true",
2547
+ "() => Promise<{ active, renews: false, access_ends_at, member_since }> // stop it renewing; access runs to access_ends_at, nothing is refunded — offer it whenever renews is true",
2548
2548
  refresh: "() => Promise<void>",
2549
2549
  },
2550
2550
  requiredContextSlice: ["payments.getAppSubscription", "payments.cancelAppSubscription"],
@@ -4694,7 +4694,7 @@ const WIDGET_CONTEXT_SHAPE = {
4694
4694
  },
4695
4695
  payments: {
4696
4696
  description:
4697
- "Injected @colixsystems/payments-client instance (REQ-BILL-07-WIDGETPAY). { requestPayment(body) -> Promise<{ id, status }>, getPayment(id) -> Promise<payment>, requestGuestPayment(body) -> Promise<{ id, status }>, getGuestPayment(id) -> Promise<payment>, listAccessPlans() -> Promise<{ data, meta }>, purchaseAccessPlan({ plan_id, return_path? }) -> Promise<{ plan_id, status }>, cancelAccessPlan(planId) -> Promise<{ plan_id, renews, access_ends_at }>, getAppSubscription() -> Promise<{ active, renews, access_ends_at }>, cancelAppSubscription() -> Promise<{ active, renews, access_ends_at }> }; wire is snake_case (amount_cents, return_path, order). Backs usePayments(), useAccessPlans() and useAppSubscription(); requires the payments.charge:appUser scope, and guest checkout (requestGuestPayment, a visitor with no account buying physical goods) also payments.charge:guest. The host opens hosted Checkout itself — same-tab on web, in-app browser on native (or auto-confirms under the mock provider); the charge settles to the workspace owner.",
4697
+ "Injected @colixsystems/payments-client instance (REQ-BILL-07-WIDGETPAY). { requestPayment(body) -> Promise<{ id, status }>, getPayment(id) -> Promise<payment>, requestGuestPayment(body) -> Promise<{ id, status }>, getGuestPayment(id) -> Promise<payment>, listAccessPlans() -> Promise<{ data, meta }>, purchaseAccessPlan({ plan_id, return_path? }) -> Promise<{ plan_id, status }>, cancelAccessPlan(planId) -> Promise<{ plan_id, renews, access_ends_at }>, getAppSubscription() -> Promise<{ active, renews, access_ends_at, member_since }>, cancelAppSubscription() -> Promise<{ active, renews, access_ends_at, member_since }> }; wire is snake_case (amount_cents, return_path, order). Backs usePayments(), useAccessPlans() and useAppSubscription(); requires the payments.charge:appUser scope, and guest checkout (requestGuestPayment, a visitor with no account buying physical goods) also payments.charge:guest. The host opens hosted Checkout itself — same-tab on web, in-app browser on native (or auto-confirms under the mock provider); the charge settles to the workspace owner.",
4698
4698
  required: true,
4699
4699
  fields: {
4700
4700
  requestPayment: "function",
@@ -7144,7 +7144,14 @@ const CONTRACT = deepFreeze({
7144
7144
  // 1.280.0: additive (sc-18010) — connections.add and connections.signIn
7145
7145
  // may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
7146
7146
  // app's administrator to register it first. No token fixes it.
7147
- version: "1.280.0",
7147
+ // 1.281.0: stricter lint (sc-18484) — a date shown with a fixed pattern or
7148
+ // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7149
+ // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7150
+ // warning; the widget agent's publish gate blocks on it.
7151
+ // 1.282.0: additive (sc-18485) — useAccessPlans() plans and
7152
+ // useAppSubscription() subscription carry member_since, the member's start
7153
+ // date: first paid charge, else when access was granted (null when not held).
7154
+ version: "1.282.0",
7148
7155
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7149
7156
  hooks: HOOKS,
7150
7157
  primitives: PRIMITIVES,