@cavuno/board 1.22.0 → 1.24.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/dist/index.mjs CHANGED
@@ -109,7 +109,7 @@ async function clearSession(storage) {
109
109
  }
110
110
 
111
111
  // src/version.ts
112
- var SDK_VERSION = "1.22.0";
112
+ var SDK_VERSION = "1.24.0";
113
113
 
114
114
  // src/client.ts
115
115
  function isRawBody(body) {
@@ -1764,6 +1764,329 @@ function meNamespace(client) {
1764
1764
  { ...options, method: "DELETE", query }
1765
1765
  );
1766
1766
  }
1767
+ },
1768
+ /**
1769
+ * The authenticated board user's messaging inbox (doc 34 / ADR-0053).
1770
+ * The v1 surface is polled REST — there is no realtime primitive; poll
1771
+ * `list` / `listMessages` / `unreadCount` on an interval (3–5s is the
1772
+ * reference cadence) for near-live updates.
1773
+ */
1774
+ conversations: {
1775
+ /**
1776
+ * List my conversations (each page sorted most-recent-activity-first;
1777
+ * cross-page cursor order is approximate — see the API docs). `archived:
1778
+ * true` returns the archived view. Poll for inbox liveness.
1779
+ *
1780
+ * @example
1781
+ * const { data } = await board.me.conversations.list({ limit: 20 });
1782
+ */
1783
+ list(query, options) {
1784
+ return client.fetch("/me/conversations", {
1785
+ ...options,
1786
+ query
1787
+ });
1788
+ },
1789
+ /**
1790
+ * The count of distinct conversations with an unread message — the
1791
+ * inbox badge. Poll for liveness.
1792
+ *
1793
+ * @example
1794
+ * const { count } = await board.me.conversations.unreadCount();
1795
+ */
1796
+ unreadCount(options) {
1797
+ return client.fetch(
1798
+ "/me/conversations/unread-count",
1799
+ options
1800
+ );
1801
+ },
1802
+ /**
1803
+ * A conversation's header — live-resolved counterparty identity, the
1804
+ * viewer's role, and the viewer's last-read pointer. The messages are a
1805
+ * separate paginated call (`listMessages`).
1806
+ *
1807
+ * @example
1808
+ * const convo = await board.me.conversations.retrieve(id);
1809
+ */
1810
+ retrieve(id, options) {
1811
+ return client.fetch(
1812
+ `/me/conversations/${encodeURIComponent(id)}`,
1813
+ options
1814
+ );
1815
+ },
1816
+ /**
1817
+ * A conversation's messages, oldest-first (append order). Unsent
1818
+ * messages are tombstones (empty `body`, `deletedAt` set). Poll for the
1819
+ * live thread.
1820
+ *
1821
+ * @example
1822
+ * const { data } = await board.me.conversations.listMessages(id, { limit: 50 });
1823
+ */
1824
+ listMessages(id, query, options) {
1825
+ return client.fetch(
1826
+ `/me/conversations/${encodeURIComponent(id)}/messages`,
1827
+ { ...options, query }
1828
+ );
1829
+ },
1830
+ /**
1831
+ * Cold-initiate a conversation with a candidate (employer-only).
1832
+ * Converges on the existing thread. Returns the created message.
1833
+ *
1834
+ * @example
1835
+ * const msg = await board.me.conversations.start({ candidateBoardUserId, body: 'Hi!' });
1836
+ */
1837
+ start(body, options) {
1838
+ return client.fetch("/me/conversations", {
1839
+ ...options,
1840
+ method: "POST",
1841
+ body
1842
+ });
1843
+ },
1844
+ /**
1845
+ * Message an applicant from the ATS (application context, outside the
1846
+ * talent paywall). Returns the created message.
1847
+ *
1848
+ * @example
1849
+ * const msg = await board.me.conversations.startAboutApplication({ applicationId, body: '…' });
1850
+ */
1851
+ startAboutApplication(body, options) {
1852
+ return client.fetch("/me/conversations/about-application", {
1853
+ ...options,
1854
+ method: "POST",
1855
+ body
1856
+ });
1857
+ },
1858
+ /**
1859
+ * Reply in an existing conversation. Returns the created message.
1860
+ *
1861
+ * @example
1862
+ * const msg = await board.me.conversations.reply(id, { body: 'Sounds good' });
1863
+ */
1864
+ reply(id, body, options) {
1865
+ return client.fetch(
1866
+ `/me/conversations/${encodeURIComponent(id)}/reply`,
1867
+ { ...options, method: "POST", body }
1868
+ );
1869
+ },
1870
+ /**
1871
+ * Mark a conversation read for the viewer. Idempotent.
1872
+ *
1873
+ * @example
1874
+ * await board.me.conversations.markRead(id);
1875
+ */
1876
+ markRead(id, options) {
1877
+ return client.fetch(
1878
+ `/me/conversations/${encodeURIComponent(id)}/read`,
1879
+ { ...options, method: "POST" }
1880
+ );
1881
+ },
1882
+ /**
1883
+ * Archive a conversation for the viewer (per-side). Idempotent.
1884
+ *
1885
+ * @example
1886
+ * await board.me.conversations.archive(id);
1887
+ */
1888
+ archive(id, options) {
1889
+ return client.fetch(
1890
+ `/me/conversations/${encodeURIComponent(id)}/archive`,
1891
+ { ...options, method: "POST" }
1892
+ );
1893
+ },
1894
+ /**
1895
+ * Move an archived conversation back to the main inbox. Idempotent.
1896
+ *
1897
+ * @example
1898
+ * await board.me.conversations.unarchive(id);
1899
+ */
1900
+ unarchive(id, options) {
1901
+ return client.fetch(
1902
+ `/me/conversations/${encodeURIComponent(id)}/unarchive`,
1903
+ { ...options, method: "POST" }
1904
+ );
1905
+ },
1906
+ /**
1907
+ * The existing employer↔candidate conversation id (or null). Tier-3
1908
+ * talent-contact helper — route to an existing thread instead of opening
1909
+ * a composer.
1910
+ *
1911
+ * @example
1912
+ * const { conversationId } = await board.me.conversations.findExisting({ candidateBoardUserId });
1913
+ */
1914
+ findExisting(query, options) {
1915
+ return client.fetch(
1916
+ "/me/conversations/find-existing",
1917
+ { ...options, query }
1918
+ );
1919
+ }
1920
+ },
1921
+ /**
1922
+ * Blocking (doc 34 §E): list / add / remove blocks + a Tier-3 status check.
1923
+ */
1924
+ blocks: {
1925
+ /**
1926
+ * The users I've blocked.
1927
+ *
1928
+ * @example
1929
+ * const { data } = await board.me.blocks.list();
1930
+ */
1931
+ list(options) {
1932
+ return client.fetch("/me/blocks", options);
1933
+ },
1934
+ /**
1935
+ * Block a user (silent). Idempotent.
1936
+ *
1937
+ * @example
1938
+ * await board.me.blocks.create({ boardUserId });
1939
+ */
1940
+ create(body, options) {
1941
+ return client.fetch("/me/blocks", {
1942
+ ...options,
1943
+ method: "POST",
1944
+ body
1945
+ });
1946
+ },
1947
+ /**
1948
+ * Unblock a user. Idempotent.
1949
+ *
1950
+ * @example
1951
+ * await board.me.blocks.remove(boardUserId);
1952
+ */
1953
+ remove(boardUserId, options) {
1954
+ return client.fetch(
1955
+ `/me/blocks/${encodeURIComponent(boardUserId)}`,
1956
+ { ...options, method: "DELETE" }
1957
+ );
1958
+ },
1959
+ /**
1960
+ * Whether I've blocked a user (Tier-3 helper).
1961
+ *
1962
+ * @example
1963
+ * const { blocked } = await board.me.blocks.status(boardUserId);
1964
+ */
1965
+ status(boardUserId, options) {
1966
+ return client.fetch(
1967
+ `/me/blocks/${encodeURIComponent(boardUserId)}`,
1968
+ options
1969
+ );
1970
+ }
1971
+ },
1972
+ /**
1973
+ * Message-scoped actions (doc 34 §E): edit / unsend your own messages
1974
+ * (15-minute window), and report a message addressed to you.
1975
+ */
1976
+ messages: {
1977
+ /**
1978
+ * Edit one of your own messages (within the 15-minute window). Returns
1979
+ * the updated message.
1980
+ *
1981
+ * @example
1982
+ * const msg = await board.me.messages.edit(id, { body: 'fixed typo' });
1983
+ */
1984
+ edit(id, body, options) {
1985
+ return client.fetch(`/me/messages/${encodeURIComponent(id)}`, {
1986
+ ...options,
1987
+ method: "PATCH",
1988
+ body
1989
+ });
1990
+ },
1991
+ /**
1992
+ * Unsend (soft-delete) one of your own messages (within the 15-minute
1993
+ * window). Idempotent. Returns the tombstoned message (empty `body`).
1994
+ *
1995
+ * @example
1996
+ * await board.me.messages.unsend(id);
1997
+ */
1998
+ unsend(id, options) {
1999
+ return client.fetch(`/me/messages/${encodeURIComponent(id)}`, {
2000
+ ...options,
2001
+ method: "DELETE"
2002
+ });
2003
+ },
2004
+ /**
2005
+ * Report a message addressed to you for moderation. Auto-blocks the
2006
+ * author.
2007
+ *
2008
+ * @example
2009
+ * const { blocked } = await board.me.messages.report(id, { reason: 'spam' });
2010
+ */
2011
+ report(id, body, options) {
2012
+ return client.fetch(
2013
+ `/me/messages/${encodeURIComponent(id)}/report`,
2014
+ { ...options, method: "POST", body }
2015
+ );
2016
+ }
2017
+ },
2018
+ /**
2019
+ * The candidate job-access paywall — the authenticated money flow (doc 36 /
2020
+ * ADR-0056). Enumerate offers publicly with `board.paywall.offers()`, then
2021
+ * `checkout` here; poll `retrieveCheckout` until complete and confirm with
2022
+ * `grant`. The SDK stays Stripe-agnostic — `checkout` returns a mount kit
2023
+ * and the frontend brings `@stripe/stripe-js`.
2024
+ */
2025
+ access: {
2026
+ /**
2027
+ * Start an embedded checkout for one offer and return a connected-account
2028
+ * mount kit `{ sessionId, clientSecret, stripeAccountId, publishableKey,
2029
+ * offerType }`. `returnPath` is a safe relative path. Requires a candidate
2030
+ * profile.
2031
+ *
2032
+ * @example
2033
+ * const kit = await board.me.access.checkout({
2034
+ * offerKey: 'monthly',
2035
+ * returnPath: '/account/access',
2036
+ * colorMode: 'light',
2037
+ * });
2038
+ * const stripe = await loadStripe(kit.publishableKey, {
2039
+ * stripeAccount: kit.stripeAccountId,
2040
+ * });
2041
+ */
2042
+ checkout(body, options) {
2043
+ return client.fetch("/me/access/checkout", {
2044
+ ...options,
2045
+ method: "POST",
2046
+ body
2047
+ });
2048
+ },
2049
+ /**
2050
+ * Poll a checkout session's state: `open` (re-mountable via
2051
+ * `clientSecret`), `complete`, or `expired`. On `complete`, re-read
2052
+ * `grant()` to confirm entitlement.
2053
+ *
2054
+ * @example
2055
+ * const s = await board.me.access.retrieveCheckout(kit.sessionId);
2056
+ */
2057
+ retrieveCheckout(sessionId, options) {
2058
+ return client.fetch(
2059
+ `/me/access/checkout/${encodeURIComponent(sessionId)}`,
2060
+ options
2061
+ );
2062
+ },
2063
+ /**
2064
+ * The viewer's candidate-access entitlement — always resolves (no-access
2065
+ * is `{ hasAccess: false, … }`, not an error). Gate the ungated jobs
2066
+ * listing on `hasAccess`.
2067
+ *
2068
+ * @example
2069
+ * const { hasAccess } = await board.me.access.grant();
2070
+ */
2071
+ grant(options) {
2072
+ return client.fetch("/me/access/grant", options);
2073
+ },
2074
+ /**
2075
+ * Open a Stripe billing-portal session to manage a recurring subscription
2076
+ * (only when the grant's `offerType` is `recurring`). Optional
2077
+ * `returnPath` threads through to Stripe's return URL.
2078
+ *
2079
+ * @example
2080
+ * const { url } = await board.me.access.portal({ returnPath: '/account' });
2081
+ * location.href = url;
2082
+ */
2083
+ portal(body, options) {
2084
+ return client.fetch("/me/access/portal", {
2085
+ ...options,
2086
+ method: "POST",
2087
+ body
2088
+ });
2089
+ }
1767
2090
  }
1768
2091
  };
1769
2092
  }
@@ -1792,6 +2115,27 @@ function passwordNamespace(client) {
1792
2115
  };
1793
2116
  }
1794
2117
 
2118
+ // src/namespaces/paywall.ts
2119
+ function paywallNamespace(client) {
2120
+ return {
2121
+ /**
2122
+ * List the board's enabled candidate-access paywall offers (public) — the
2123
+ * pricing tiers a candidate picks before starting checkout
2124
+ * (`board.me.access.checkout`). Returns `[]` when the paywall is disabled.
2125
+ * The internal Stripe price id is never exposed.
2126
+ *
2127
+ * @example
2128
+ * const { data } = await board.paywall.offers();
2129
+ */
2130
+ offers(options) {
2131
+ return client.fetch(
2132
+ "/paywall/offers/enabled",
2133
+ options
2134
+ );
2135
+ }
2136
+ };
2137
+ }
2138
+
1795
2139
  // src/namespaces/plans.ts
1796
2140
  function plansNamespace(client) {
1797
2141
  return {
@@ -2068,7 +2412,8 @@ function createBoardClient(options) {
2068
2412
  jobPosting: jobPostingNamespace(client),
2069
2413
  salaries: salariesNamespace(client),
2070
2414
  talent: talentNamespace(client),
2071
- plans: plansNamespace(client)
2415
+ plans: plansNamespace(client),
2416
+ paywall: paywallNamespace(client)
2072
2417
  };
2073
2418
  }
2074
2419
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavuno/board",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "description": "Typed isomorphic client for the Cavuno Board API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.22.0",
2
+ "version": "1.24.0",
3
3
  "skills": [
4
4
  {
5
5
  "name": "cavuno-board-auth",