@colixsystems/widget-sdk 0.344.0 → 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,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
91
91
 
92
92
  ## Status
93
93
 
94
- `v0.344.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**.
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.
95
99
 
96
100
  ### What's new in 0.344.0 (contract 1.281.0)
97
101
 
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",
@@ -7153,7 +7153,10 @@ const CONTRACT = deepFreeze({
7153
7153
  // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7154
7154
  // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7155
7155
  // warning; the widget agent's publish gate blocks on it.
7156
- version: "1.281.0",
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",
7157
7160
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7158
7161
  hooks: HOOKS,
7159
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",
@@ -7148,7 +7148,10 @@ const CONTRACT = deepFreeze({
7148
7148
  // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7149
7149
  // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7150
7150
  // warning; the widget agent's publish gate blocks on it.
7151
- version: "1.281.0",
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",
7152
7155
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7153
7156
  hooks: HOOKS,
7154
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.344.0",
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",
@@ -7148,7 +7148,10 @@ const CONTRACT = deepFreeze({
7148
7148
  // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7149
7149
  // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7150
7150
  // warning; the widget agent's publish gate blocks on it.
7151
- version: "1.281.0",
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",
7152
7155
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7153
7156
  hooks: HOOKS,
7154
7157
  primitives: PRIMITIVES,