spaps-sdk 1.6.2 → 1.6.3

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/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
8
8
 
9
9
  - No changes yet.
10
10
 
11
+ ## [1.6.2] - 2026-03-29
12
+
13
+ ### Added
14
+
15
+ - Added canonical issue-reporting client methods for end-user create, list, detail, status, update, and reply flows.
16
+
11
17
  ## [1.6.1] - 2026-02-16
12
18
 
13
19
  ### Fixed
package/README.md CHANGED
@@ -1,38 +1,50 @@
1
1
  # spaps-sdk
2
2
 
3
- <a href="https://www.npmjs.com/package/spaps-sdk"><img alt="npm" src="https://img.shields.io/npm/v/spaps-sdk.svg"></a>
4
- <img alt="node" src="https://img.shields.io/badge/node-%3E%3D14-brightgreen">
5
- <img alt="types" src="https://img.shields.io/badge/types-TypeScript-blue">
3
+ TypeScript SDK for the Sweet Potato Authentication & Payment Service.
6
4
 
7
- > Sweet Potato Authentication & Payment Service SDK
5
+ ## TL;DR
8
6
 
9
- Zero-config client for SPAPS authentication, payments, secure messaging, and admin/product workflows.
7
+ **The Problem**: SPAPS consumers need one client that can speak auth, payments, secure messaging, issue reporting, entitlements, and dayrate APIs without rebuilding request plumbing for every app.
10
8
 
11
- ## Quick Facts
9
+ **The Solution**: `spaps-sdk` exposes a typed `SPAPSClient` with source-backed namespaces for the major SPAPS surfaces and a small set of permission helpers for app code.
12
10
 
13
- - Package: `spaps-sdk`
14
- - Latest version: `1.6.1`
15
- - Runtime: `Node.js >=14.0.0`
16
- - Default local API URL: `http://localhost:3301`
11
+ ### Why Use `spaps-sdk`?
12
+
13
+ | Feature | What It Does |
14
+ | --- | --- |
15
+ | Zero-config local mode | Point at `localhost` and the SDK automatically treats it as local mode |
16
+ | Typed namespaces | Use `auth`, `payments`, `sessions`, `secureMessages`, `issueReporting`, `email`, `entitlements`, `dayrate`, `cfo`, and `admin` from one client |
17
+ | Browser and server key support | Configure with `publishableKey`, `secretKey`, or the legacy `apiKey` field |
18
+ | Shared contracts | Re-exports many `spaps-types` definitions so apps can stay on one dependency surface |
17
19
 
18
20
  ## Metadata
19
21
 
20
22
  - `package_name`: `spaps-sdk`
21
- - `latest_version`: `1.6.1`
23
+ - `latest_version`: `1.6.2`
22
24
  - `minimum_runtime`: `Node.js >=14.0.0`
23
25
  - `api_base_url`: `https://api.sweetpotato.dev`
24
26
 
25
27
  ## Installation
26
28
 
29
+ ### npm
30
+
27
31
  ```bash
28
32
  npm install spaps-sdk
29
- # or
30
- yarn add spaps-sdk
31
- # or
33
+ ```
34
+
35
+ ### pnpm
36
+
37
+ ```bash
32
38
  pnpm add spaps-sdk
33
39
  ```
34
40
 
35
- ## Quick Start
41
+ ### yarn
42
+
43
+ ```bash
44
+ yarn add spaps-sdk
45
+ ```
46
+
47
+ ## Quick Example
36
48
 
37
49
  ```typescript
38
50
  import { SPAPSClient } from 'spaps-sdk';
@@ -50,71 +62,50 @@ if (spaps.isAuthenticated()) {
50
62
  }
51
63
  ```
52
64
 
53
- ## Compatibility
54
-
55
- - Node.js (v14+)
56
- - Modern browsers
57
- - TypeScript (types bundled)
58
- - Next.js and React Native
59
-
60
- The SDK includes a `cross-fetch` polyfill for Node environments without native fetch.
61
-
62
65
  ## Configuration
63
66
 
64
- `SPAPSClient` reads config from constructor args first, then environment variables.
65
-
66
- - `SPAPS_API_URL` or `NEXT_PUBLIC_SPAPS_API_URL` - API base URL
67
- - `SPAPS_API_KEY` or `NEXT_PUBLIC_SPAPS_API_KEY` - API key
68
-
69
- ```bash
70
- # Node
71
- export SPAPS_API_URL=https://api.sweetpotato.dev
72
- export SPAPS_API_KEY=spaps_xxx
67
+ Constructor values win over environment variables.
73
68
 
74
- # Next.js
75
- NEXT_PUBLIC_SPAPS_API_URL=https://api.sweetpotato.dev
76
- ```
69
+ | Option | Purpose |
70
+ | --- | --- |
71
+ | `apiUrl` | Base API URL. Localhost enables local mode automatically. |
72
+ | `publishableKey` | Browser-safe key for client-side usage |
73
+ | `secretKey` | Server-side key for full access |
74
+ | `apiKey` | Deprecated legacy key field |
75
+ | `timeout` | Override request timeout |
77
76
 
78
- Local mode auto-detection:
77
+ Relevant environment variables:
79
78
 
80
- - If `apiUrl` is omitted or points to `localhost`/`127.0.0.1`, local mode is enabled.
81
- - In local mode, API key is optional.
79
+ - `SPAPS_API_URL`
80
+ - `NEXT_PUBLIC_SPAPS_API_URL`
81
+ - `SPAPS_API_KEY`
82
+ - `NEXT_PUBLIC_SPAPS_API_KEY`
82
83
 
83
- ## API Surface
84
+ ## Client Surface
84
85
 
85
- - `auth` and top-level auth helpers: password, wallet, magic link, refresh/logout
86
- - `sessions`: current/list/validate/revoke/touch
87
- - `payments`: checkout sessions, products/prices, guest checkout, subscriptions, crypto invoices
88
- - `secureMessages`: create/list secure messages
89
- - `email`: send/list templates/get template/preview template
90
- - `entitlements`: list/check/list by resource
91
- - `admin`: product and price management helpers
92
- - `dayrate`, `cfo`: specialized domain helpers
86
+ | Namespace | What It Covers |
87
+ | --- | --- |
88
+ | `auth` | Password, wallet, magic-link, refresh, and logout flows |
89
+ | `payments` | Checkout sessions, products, prices, subscriptions, and crypto payment helpers |
90
+ | `sessions` | Current session lookup, validation, revocation, and session lifecycle helpers |
91
+ | `secureMessages` | Create and list secure messages |
92
+ | `issueReporting` | Status, history, create, edit, and reply issue-report flows |
93
+ | `email` | Template lookup, previews, and sends |
94
+ | `entitlements` | User and resource entitlement queries |
95
+ | `dayrate` | Availability and booking helpers |
96
+ | `admin` | Product and pricing admin helpers |
97
+ | `cfo` | CFO-specific endpoints |
93
98
 
94
- ## Permission Utilities
99
+ ## Common Flows
95
100
 
96
- ```typescript
97
- import { isAdminAccount, canAccessAdmin, getUserRole } from 'spaps-sdk';
98
-
99
- const isAdmin = isAdminAccount('buildooor@gmail.com');
100
- const role = getUserRole('user@example.com');
101
- const adminCheck = canAccessAdmin({ id: 'u1', email: 'user@example.com' });
102
-
103
- if (adminCheck.allowed) {
104
- // render admin UI
105
- }
106
- ```
107
-
108
- See [PERMISSIONS.md](./PERMISSIONS.md) for React-oriented examples.
109
-
110
- ## Secure Messaging
101
+ ### Typed Secure Messaging
111
102
 
112
103
  ```typescript
113
104
  type SecureMessageMetadata = { urgency: 'low' | 'high'; tags?: string[] };
114
105
 
115
106
  const spaps = new SPAPSClient<SecureMessageMetadata>({
116
107
  apiUrl: 'https://api.sweetpotato.dev',
117
- apiKey: process.env.SPAPS_API_KEY,
108
+ secretKey: process.env.SPAPS_API_KEY,
118
109
  });
119
110
 
120
111
  await spaps.secureMessages.create({
@@ -125,59 +116,113 @@ await spaps.secureMessages.create({
125
116
  });
126
117
  ```
127
118
 
128
- ## Admin API Methods
119
+ ### Shared Issue Reporting
129
120
 
130
121
  ```typescript
131
- await spaps.admin.createProduct({
132
- name: 'Premium Plan',
133
- category: 'subscription',
134
- description: 'Advanced features',
135
- });
122
+ spaps.setAccessToken('jwt-token');
123
+
124
+ const summary = await spaps.issueReporting.getStatus();
125
+ const history = await spaps.issueReporting.list({ status: 'open' });
126
+
127
+ if (!summary.has_open && history.total === 0) {
128
+ await spaps.issueReporting.create({
129
+ target: {
130
+ component_key: 'patient_protocol_widget',
131
+ component_label: 'Patient Protocol Widget',
132
+ page_url: '/patients/123/protocol',
133
+ metadata: { section: 'daily log' },
134
+ },
135
+ note: 'The save action silently fails after I edit today.',
136
+ reporter_role_hint: 'practitioner',
137
+ });
138
+ }
139
+ ```
136
140
 
137
- await spaps.admin.updateProduct('prod_123', { name: 'Premium Plan Pro' });
141
+ ### Permission Utilities
138
142
 
139
- await spaps.admin.createPrice({
140
- product_id: 'prod_123',
141
- unit_amount: 2999,
142
- currency: 'usd',
143
- interval: 'month',
144
- });
143
+ ```typescript
144
+ import { canAccessAdmin, getUserRole, isAdminAccount } from 'spaps-sdk';
145
+
146
+ const role = getUserRole('user@example.com');
147
+ const adminCheck = canAccessAdmin({ id: 'user_123', email: 'buildooor@gmail.com' });
148
+ const isAdmin = isAdminAccount('buildooor@gmail.com');
149
+
150
+ console.log(role, adminCheck.allowed, isAdmin);
145
151
  ```
146
152
 
147
- ## Helper Methods
153
+ ### Helper Methods
148
154
 
149
155
  ```typescript
150
- spaps.isAuthenticated(); // boolean
151
- spaps.getAccessToken(); // string | undefined
156
+ const spaps = new SPAPSClient({ apiUrl: 'http://localhost:3301' });
157
+
158
+ spaps.isLocalMode();
159
+ spaps.isAuthenticated();
160
+ spaps.getAccessToken();
152
161
  spaps.setAccessToken('token');
153
- spaps.isLocalMode(); // boolean
154
162
  await spaps.health();
155
163
  ```
156
164
 
157
- ## Troubleshooting
158
-
159
- - `401 Unauthorized`: ensure valid access token and API key for non-local mode.
160
- - `403 Forbidden`: account lacks admin role for admin endpoints.
161
- - Local mode confusion: call `spaps.isLocalMode()` and verify `apiUrl`.
162
-
163
165
  ## Development
164
166
 
165
- From repository root:
166
-
167
167
  ```bash
168
168
  cd packages/sdk
169
169
  npm ci
170
170
  npm run build
171
+ npm run typecheck:readme
172
+ npm run test:readme
171
173
  npm run test
174
+ ```
175
+
176
+ ## Troubleshooting
177
+
178
+ ### `401 Unauthorized`
179
+
180
+ Check the access token and key configuration for the environment you are targeting.
181
+
182
+ ### Local mode is not activating
183
+
184
+ Use a localhost URL such as `http://localhost:3301`, or call `spaps.isLocalMode()` to confirm how the SDK resolved the environment.
185
+
186
+ ### Browser app needs limited access
187
+
188
+ Use `publishableKey` instead of a server-side secret key.
189
+
190
+ ## Limitations
191
+
192
+ - The SDK wraps the current SPAPS surface; it is not an exhaustive code-generated client for every backend route.
193
+ - Some admin and entitlement flows still depend on upstream permissions and token context.
194
+ - The legacy `apiKey` constructor field still exists for compatibility, but new integrations should prefer the explicit key fields.
195
+
196
+ ## FAQ
197
+
198
+ ### Does this work in browsers?
199
+
200
+ Yes. The package is designed for both browser and server-side usage.
201
+
202
+ ### Does it include fetch polyfills?
203
+
204
+ Yes. It loads `cross-fetch/polyfill` when `fetch` is unavailable.
205
+
206
+ ### Can I use it without TypeScript?
207
+
208
+ Yes. The runtime works in JavaScript projects and ships bundled type declarations for TS users.
209
+
210
+ ### Does it re-export shared types?
211
+
212
+ Yes. Many `spaps-types` exports are re-exported for convenience.
213
+
214
+ ### How do I validate README-related examples?
215
+
216
+ Run:
217
+
218
+ ```bash
172
219
  npm run typecheck:readme
173
220
  npm run test:readme
174
221
  ```
175
222
 
176
- ## Release
223
+ ## About Contributions
177
224
 
178
- - Main publish flow: `.github/workflows/publish.yml` (`publish-sdk` job).
179
- - Manual publish flow: `.github/workflows/npm-publish-manual.yml`.
180
- - npm credential source: repository secret `NPM_TOKEN`.
225
+ *About Contributions:* Please don't take this the wrong way, but I do not accept outside contributions for any of my projects. I simply don't have the mental bandwidth to review anything, and it's my name on the thing, so I'm responsible for any problems it causes; thus, the risk-reward is highly asymmetric from my perspective. I'd also have to worry about other "stakeholders," which seems unwise for tools I mostly make for myself for free. Feel free to submit issues, and even PRs if you want to illustrate a proposed fix, but know I won't merge them directly. Instead, I'll have Claude or Codex review submissions via `gh` and independently decide whether and how to address them. Bug reports in particular are welcome. Sorry if this offends, but I want to avoid wasted time and hurt feelings. I understand this isn't in sync with the prevailing open-source ethos that seeks community contributions, but it's the only way I can move at this velocity and keep my sanity.
181
226
 
182
227
  ## License
183
228
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as spaps_types from 'spaps-types';
2
- import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
3
- export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, Price, Product, ProductSyncResult, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
2
+ import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, IssueReportStatusResult, IssueReportStatus, IssueReportListResult, IssueReport, CreateIssueReportRequest, UpdateIssueReportRequest, ReplyIssueReportRequest, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
3
+ export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreateIssueReportRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, IssueReport, IssueReportListResult, IssueReportStatus, IssueReportStatusResult, IssueReportTarget, LinkedIssueReportCase, Price, Product, ProductSyncResult, ReplyIssueReportRequest, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateIssueReportRequest, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
4
4
 
5
5
  /**
6
6
  * Permission checking utilities for SPAPS SDK
@@ -344,6 +344,11 @@ interface EntitlementCheckResult {
344
344
  /** The matching entitlement, if any */
345
345
  entitlement?: Entitlement;
346
346
  }
347
+ interface IssueReportListParams {
348
+ status?: IssueReportStatus;
349
+ limit?: number;
350
+ offset?: number;
351
+ }
347
352
 
348
353
  declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Record<string, any>> {
349
354
  private client;
@@ -429,6 +434,35 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
429
434
  */
430
435
  listByResource: (resourceType: ResourceType, resourceId?: string) => Promise<Entitlement[]>;
431
436
  };
437
+ /**
438
+ * Issue reporting namespace for authenticated end-user issue flows.
439
+ */
440
+ issueReporting: {
441
+ /**
442
+ * Return canonical issue-report summary for the shared floating entrypoint.
443
+ */
444
+ getStatus: () => Promise<IssueReportStatusResult>;
445
+ /**
446
+ * List the caller's issue reports inside the active application scope.
447
+ */
448
+ list: (params?: IssueReportListParams) => Promise<IssueReportListResult>;
449
+ /**
450
+ * Hydrate one canonical issue report by ID.
451
+ */
452
+ get: (issueReportId: string) => Promise<IssueReport>;
453
+ /**
454
+ * Create a new canonical issue report.
455
+ */
456
+ create: (payload: CreateIssueReportRequest) => Promise<IssueReport>;
457
+ /**
458
+ * Update the note for an unresolved issue report.
459
+ */
460
+ update: (issueReportId: string, payload: UpdateIssueReportRequest) => Promise<IssueReport>;
461
+ /**
462
+ * Reply to a resolved or ignored issue report and reopen the linked case.
463
+ */
464
+ reply: (issueReportId: string, payload: ReplyIssueReportRequest) => Promise<IssueReport>;
465
+ };
432
466
  constructor(config?: SPAPSConfig);
433
467
  /** Raw API request helper that returns an ApiResponse-like shape */
434
468
  request<T = any>(method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', url: string, data?: any, requiresAuth?: boolean): Promise<{
@@ -895,4 +929,4 @@ declare function createServerClient(secretKey: string, options?: Omit<SPAPSConfi
895
929
  */
896
930
  declare function detectKeyType(key: string): ApiKeyType | null;
897
931
 
898
- export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
932
+ export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type IssueReportListParams, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as spaps_types from 'spaps-types';
2
- import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
3
- export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, Price, Product, ProductSyncResult, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
2
+ import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, IssueReportStatusResult, IssueReportStatus, IssueReportListResult, IssueReport, CreateIssueReportRequest, UpdateIssueReportRequest, ReplyIssueReportRequest, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
3
+ export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreateIssueReportRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, IssueReport, IssueReportListResult, IssueReportStatus, IssueReportStatusResult, IssueReportTarget, LinkedIssueReportCase, Price, Product, ProductSyncResult, ReplyIssueReportRequest, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateIssueReportRequest, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
4
4
 
5
5
  /**
6
6
  * Permission checking utilities for SPAPS SDK
@@ -344,6 +344,11 @@ interface EntitlementCheckResult {
344
344
  /** The matching entitlement, if any */
345
345
  entitlement?: Entitlement;
346
346
  }
347
+ interface IssueReportListParams {
348
+ status?: IssueReportStatus;
349
+ limit?: number;
350
+ offset?: number;
351
+ }
347
352
 
348
353
  declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Record<string, any>> {
349
354
  private client;
@@ -429,6 +434,35 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
429
434
  */
430
435
  listByResource: (resourceType: ResourceType, resourceId?: string) => Promise<Entitlement[]>;
431
436
  };
437
+ /**
438
+ * Issue reporting namespace for authenticated end-user issue flows.
439
+ */
440
+ issueReporting: {
441
+ /**
442
+ * Return canonical issue-report summary for the shared floating entrypoint.
443
+ */
444
+ getStatus: () => Promise<IssueReportStatusResult>;
445
+ /**
446
+ * List the caller's issue reports inside the active application scope.
447
+ */
448
+ list: (params?: IssueReportListParams) => Promise<IssueReportListResult>;
449
+ /**
450
+ * Hydrate one canonical issue report by ID.
451
+ */
452
+ get: (issueReportId: string) => Promise<IssueReport>;
453
+ /**
454
+ * Create a new canonical issue report.
455
+ */
456
+ create: (payload: CreateIssueReportRequest) => Promise<IssueReport>;
457
+ /**
458
+ * Update the note for an unresolved issue report.
459
+ */
460
+ update: (issueReportId: string, payload: UpdateIssueReportRequest) => Promise<IssueReport>;
461
+ /**
462
+ * Reply to a resolved or ignored issue report and reopen the linked case.
463
+ */
464
+ reply: (issueReportId: string, payload: ReplyIssueReportRequest) => Promise<IssueReport>;
465
+ };
432
466
  constructor(config?: SPAPSConfig);
433
467
  /** Raw API request helper that returns an ApiResponse-like shape */
434
468
  request<T = any>(method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', url: string, data?: any, requiresAuth?: boolean): Promise<{
@@ -895,4 +929,4 @@ declare function createServerClient(secretKey: string, options?: Omit<SPAPSConfi
895
929
  */
896
930
  declare function detectKeyType(key: string): ApiKeyType | null;
897
931
 
898
- export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
932
+ export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type IssueReportListParams, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
package/dist/index.js CHANGED
@@ -630,6 +630,79 @@ var SPAPSClient = class {
630
630
  return payload;
631
631
  }
632
632
  };
633
+ /**
634
+ * Issue reporting namespace for authenticated end-user issue flows.
635
+ */
636
+ issueReporting = {
637
+ /**
638
+ * Return canonical issue-report summary for the shared floating entrypoint.
639
+ */
640
+ getStatus: async () => {
641
+ const res = await this.client.get(
642
+ "/api/v1/issue-reports/status",
643
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
644
+ );
645
+ return this.unwrapApiResponse(res, "Failed to get issue report status");
646
+ },
647
+ /**
648
+ * List the caller's issue reports inside the active application scope.
649
+ */
650
+ list: async (params) => {
651
+ const q = new URLSearchParams();
652
+ if (params?.status) q.append("status", params.status);
653
+ if (params?.limit !== void 0) q.append("limit", String(params.limit));
654
+ if (params?.offset !== void 0) q.append("offset", String(params.offset));
655
+ const qs = q.toString();
656
+ const res = await this.client.get(
657
+ `/api/v1/issue-reports${qs ? `?${qs}` : ""}`,
658
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
659
+ );
660
+ return this.unwrapApiResponse(res, "Failed to list issue reports");
661
+ },
662
+ /**
663
+ * Hydrate one canonical issue report by ID.
664
+ */
665
+ get: async (issueReportId) => {
666
+ const res = await this.client.get(
667
+ `/api/v1/issue-reports/${issueReportId}`,
668
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
669
+ );
670
+ return this.unwrapApiResponse(res, "Failed to get issue report");
671
+ },
672
+ /**
673
+ * Create a new canonical issue report.
674
+ */
675
+ create: async (payload) => {
676
+ const res = await this.client.post(
677
+ "/api/v1/issue-reports",
678
+ payload,
679
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
680
+ );
681
+ return this.unwrapApiResponse(res, "Failed to create issue report");
682
+ },
683
+ /**
684
+ * Update the note for an unresolved issue report.
685
+ */
686
+ update: async (issueReportId, payload) => {
687
+ const res = await this.client.patch(
688
+ `/api/v1/issue-reports/${issueReportId}`,
689
+ payload,
690
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
691
+ );
692
+ return this.unwrapApiResponse(res, "Failed to update issue report");
693
+ },
694
+ /**
695
+ * Reply to a resolved or ignored issue report and reopen the linked case.
696
+ */
697
+ reply: async (issueReportId, payload) => {
698
+ const res = await this.client.post(
699
+ `/api/v1/issue-reports/${issueReportId}/replies`,
700
+ payload,
701
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
702
+ );
703
+ return this.unwrapApiResponse(res, "Failed to reply to issue report");
704
+ }
705
+ };
633
706
  constructor(config = {}) {
634
707
  const apiUrl = config.apiUrl || process.env.SPAPS_API_URL || process.env.NEXT_PUBLIC_SPAPS_API_URL;
635
708
  const isBrowser = typeof window !== "undefined";
package/dist/index.mjs CHANGED
@@ -600,6 +600,79 @@ var SPAPSClient = class {
600
600
  return payload;
601
601
  }
602
602
  };
603
+ /**
604
+ * Issue reporting namespace for authenticated end-user issue flows.
605
+ */
606
+ issueReporting = {
607
+ /**
608
+ * Return canonical issue-report summary for the shared floating entrypoint.
609
+ */
610
+ getStatus: async () => {
611
+ const res = await this.client.get(
612
+ "/api/v1/issue-reports/status",
613
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
614
+ );
615
+ return this.unwrapApiResponse(res, "Failed to get issue report status");
616
+ },
617
+ /**
618
+ * List the caller's issue reports inside the active application scope.
619
+ */
620
+ list: async (params) => {
621
+ const q = new URLSearchParams();
622
+ if (params?.status) q.append("status", params.status);
623
+ if (params?.limit !== void 0) q.append("limit", String(params.limit));
624
+ if (params?.offset !== void 0) q.append("offset", String(params.offset));
625
+ const qs = q.toString();
626
+ const res = await this.client.get(
627
+ `/api/v1/issue-reports${qs ? `?${qs}` : ""}`,
628
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
629
+ );
630
+ return this.unwrapApiResponse(res, "Failed to list issue reports");
631
+ },
632
+ /**
633
+ * Hydrate one canonical issue report by ID.
634
+ */
635
+ get: async (issueReportId) => {
636
+ const res = await this.client.get(
637
+ `/api/v1/issue-reports/${issueReportId}`,
638
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
639
+ );
640
+ return this.unwrapApiResponse(res, "Failed to get issue report");
641
+ },
642
+ /**
643
+ * Create a new canonical issue report.
644
+ */
645
+ create: async (payload) => {
646
+ const res = await this.client.post(
647
+ "/api/v1/issue-reports",
648
+ payload,
649
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
650
+ );
651
+ return this.unwrapApiResponse(res, "Failed to create issue report");
652
+ },
653
+ /**
654
+ * Update the note for an unresolved issue report.
655
+ */
656
+ update: async (issueReportId, payload) => {
657
+ const res = await this.client.patch(
658
+ `/api/v1/issue-reports/${issueReportId}`,
659
+ payload,
660
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
661
+ );
662
+ return this.unwrapApiResponse(res, "Failed to update issue report");
663
+ },
664
+ /**
665
+ * Reply to a resolved or ignored issue report and reopen the linked case.
666
+ */
667
+ reply: async (issueReportId, payload) => {
668
+ const res = await this.client.post(
669
+ `/api/v1/issue-reports/${issueReportId}/replies`,
670
+ payload,
671
+ this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
672
+ );
673
+ return this.unwrapApiResponse(res, "Failed to reply to issue report");
674
+ }
675
+ };
603
676
  constructor(config = {}) {
604
677
  const apiUrl = config.apiUrl || process.env.SPAPS_API_URL || process.env.NEXT_PUBLIC_SPAPS_API_URL;
605
678
  const isBrowser = typeof window !== "undefined";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spaps-sdk",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Sweet Potato Authentication & Payment Service SDK - Zero-config client with built-in permission checking, role-based access control, and dayrate scheduling",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",