@feelflow/ffid-sdk 0.1.0 → 0.2.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/announcements/index.cjs +109 -0
- package/dist/announcements/index.d.cts +165 -0
- package/dist/announcements/index.d.ts +165 -0
- package/dist/announcements/index.js +106 -0
- package/dist/{chunk-YCMQXJOS.cjs → chunk-A6YJDYIX.cjs} +526 -0
- package/dist/chunk-P4MLCG4T.js +4 -0
- package/dist/chunk-P5PPUZGX.cjs +6 -0
- package/dist/{chunk-A63MX52D.js → chunk-VXBUXOLF.js} +522 -1
- package/dist/components/index.cjs +13 -5
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{index-CtBBLbTn.d.cts → index-B92_OuFc.d.cts} +224 -1
- package/dist/{index-CtBBLbTn.d.ts → index-B92_OuFc.d.ts} +224 -1
- package/dist/index.cjs +31 -11
- package/dist/index.d.cts +59 -4
- package/dist/index.d.ts +59 -4
- package/dist/index.js +2 -2
- package/dist/legal/index.cjs +6 -4
- package/dist/legal/index.d.cts +1 -1
- package/dist/legal/index.d.ts +1 -1
- package/dist/legal/index.js +3 -3
- package/dist/webhooks/index.cjs +251 -0
- package/dist/webhooks/index.d.cts +298 -0
- package/dist/webhooks/index.d.ts +298 -0
- package/dist/webhooks/index.js +237 -0
- package/package.json +21 -3
|
@@ -181,6 +181,153 @@ type FFIDApiResponse<T> = {
|
|
|
181
181
|
error: FFIDError;
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* FFID Announcements SDK Type Definitions
|
|
186
|
+
*
|
|
187
|
+
* Types for the FeelFlow ID Announcements SDK.
|
|
188
|
+
* Used by client applications to fetch and display announcements.
|
|
189
|
+
* Issue: #286
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Announcement type values.
|
|
193
|
+
* Uses string union with open extension for forward compatibility.
|
|
194
|
+
*/
|
|
195
|
+
type AnnouncementType = 'maintenance.scheduled' | 'maintenance.reminder' | 'maintenance.started' | 'maintenance.completed' | 'incident.detected' | 'incident.resolved' | 'api.deprecation' | 'api.breaking_change' | 'sdk.update_available' | 'security.advisory' | 'billing.payment_reminder' | 'billing.payment_failed' | 'legal.terms_updated' | 'account.security_alert' | (string & {});
|
|
196
|
+
/** Announcement status (only 'published' is visible via public API) */
|
|
197
|
+
type AnnouncementStatus = 'draft' | 'published' | 'archived';
|
|
198
|
+
/** Single announcement returned from the public API */
|
|
199
|
+
interface Announcement {
|
|
200
|
+
/** Announcement ID (UUID) */
|
|
201
|
+
id: string;
|
|
202
|
+
/** Announcement type */
|
|
203
|
+
type: AnnouncementType;
|
|
204
|
+
/** Title */
|
|
205
|
+
title: string;
|
|
206
|
+
/** Content (Markdown) */
|
|
207
|
+
content: string;
|
|
208
|
+
/** Announcement status */
|
|
209
|
+
status: AnnouncementStatus;
|
|
210
|
+
/** Scheduled maintenance start time (ISO 8601) */
|
|
211
|
+
scheduledAt: string | null;
|
|
212
|
+
/** Maintenance duration in minutes */
|
|
213
|
+
durationMinutes: number | null;
|
|
214
|
+
/** Affected service codes */
|
|
215
|
+
affectedServices: string[];
|
|
216
|
+
/** Notification channels */
|
|
217
|
+
channels: string[];
|
|
218
|
+
/** When the announcement was published (ISO 8601) */
|
|
219
|
+
publishedAt: string | null;
|
|
220
|
+
/** Created timestamp (ISO 8601) */
|
|
221
|
+
createdAt: string;
|
|
222
|
+
/** Updated timestamp (ISO 8601) */
|
|
223
|
+
updatedAt: string;
|
|
224
|
+
}
|
|
225
|
+
/** Response from list announcements endpoint */
|
|
226
|
+
interface AnnouncementListResponse {
|
|
227
|
+
/** List of announcements */
|
|
228
|
+
announcements: Announcement[];
|
|
229
|
+
/** Total number of matching announcements */
|
|
230
|
+
total: number;
|
|
231
|
+
}
|
|
232
|
+
/** Options for listing announcements */
|
|
233
|
+
interface ListAnnouncementsOptions {
|
|
234
|
+
/** Number of items to return (server default: 20, server max: 100) */
|
|
235
|
+
limit?: number;
|
|
236
|
+
/** Offset for pagination (default: 0) */
|
|
237
|
+
offset?: number;
|
|
238
|
+
}
|
|
239
|
+
/** Configuration for the FFID Announcements Client */
|
|
240
|
+
interface FFIDAnnouncementsClientConfig {
|
|
241
|
+
/** FFID API base URL (defaults to https://id.feelflow.co.jp) */
|
|
242
|
+
apiBaseUrl?: string | undefined;
|
|
243
|
+
/** Enable debug logging */
|
|
244
|
+
debug?: boolean | undefined;
|
|
245
|
+
/** Custom logger */
|
|
246
|
+
logger?: FFIDAnnouncementsLogger | undefined;
|
|
247
|
+
}
|
|
248
|
+
/** Logger interface for Announcements SDK */
|
|
249
|
+
interface FFIDAnnouncementsLogger {
|
|
250
|
+
debug: (...args: unknown[]) => void;
|
|
251
|
+
info: (...args: unknown[]) => void;
|
|
252
|
+
warn: (...args: unknown[]) => void;
|
|
253
|
+
error: (...args: unknown[]) => void;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* API response wrapper (discriminated union for type safety)
|
|
257
|
+
*
|
|
258
|
+
* Either data is present (success) or error is present (failure), never both.
|
|
259
|
+
*/
|
|
260
|
+
type FFIDAnnouncementsApiResponse<T> = {
|
|
261
|
+
data: T;
|
|
262
|
+
error?: undefined;
|
|
263
|
+
} | {
|
|
264
|
+
data?: undefined;
|
|
265
|
+
error: FFIDAnnouncementsError;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Known SDK error codes.
|
|
269
|
+
* Uses string union with open extension for forward compatibility with server error codes.
|
|
270
|
+
*/
|
|
271
|
+
type FFIDAnnouncementsErrorCode = 'NETWORK_ERROR' | 'PARSE_ERROR' | 'UNKNOWN_ERROR' | (string & {});
|
|
272
|
+
/** Error from the Announcements SDK */
|
|
273
|
+
interface FFIDAnnouncementsError {
|
|
274
|
+
/** Error code (known SDK codes provide autocomplete; server codes also accepted) */
|
|
275
|
+
code: FFIDAnnouncementsErrorCode;
|
|
276
|
+
/** Human-readable error message */
|
|
277
|
+
message: string;
|
|
278
|
+
}
|
|
279
|
+
/** Server response envelope */
|
|
280
|
+
type FFIDAnnouncementsServerResponse<T> = {
|
|
281
|
+
success: true;
|
|
282
|
+
data: T;
|
|
283
|
+
error?: undefined;
|
|
284
|
+
} | {
|
|
285
|
+
success: false;
|
|
286
|
+
data?: undefined;
|
|
287
|
+
error?: {
|
|
288
|
+
code: string;
|
|
289
|
+
message: string;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/** Options for the useFFIDAnnouncements hook */
|
|
294
|
+
interface UseFFIDAnnouncementsOptions {
|
|
295
|
+
/** Number of items to fetch (default: 20) */
|
|
296
|
+
limit?: number;
|
|
297
|
+
/** Offset for pagination (default: 0) */
|
|
298
|
+
offset?: number;
|
|
299
|
+
/** FFID API base URL (defaults to production) */
|
|
300
|
+
apiBaseUrl?: string;
|
|
301
|
+
/** Enable debug logging */
|
|
302
|
+
debug?: boolean;
|
|
303
|
+
/** Auto-fetch on mount (default: true) */
|
|
304
|
+
enabled?: boolean;
|
|
305
|
+
}
|
|
306
|
+
/** Return type for the useFFIDAnnouncements hook */
|
|
307
|
+
interface UseFFIDAnnouncementsReturn {
|
|
308
|
+
/** List of announcements */
|
|
309
|
+
announcements: Announcement[];
|
|
310
|
+
/** Total number of announcements */
|
|
311
|
+
total: number;
|
|
312
|
+
/** Number of unread announcements */
|
|
313
|
+
unreadCount: number;
|
|
314
|
+
/** Whether data is being loaded */
|
|
315
|
+
isLoading: boolean;
|
|
316
|
+
/** Any error that occurred */
|
|
317
|
+
error: FFIDAnnouncementsError | null;
|
|
318
|
+
/** Refetch announcements */
|
|
319
|
+
refetch: () => Promise<void>;
|
|
320
|
+
/** Mark all announcements as read */
|
|
321
|
+
markAsRead: () => void;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Hook to fetch and manage announcements from FFID Platform
|
|
325
|
+
*
|
|
326
|
+
* Tracks unread count by storing the last read timestamp in localStorage.
|
|
327
|
+
* Announcements published after the last read time are counted as unread.
|
|
328
|
+
*/
|
|
329
|
+
declare function useFFIDAnnouncements(options?: UseFFIDAnnouncementsOptions): UseFFIDAnnouncementsReturn;
|
|
330
|
+
|
|
184
331
|
interface FFIDLoginButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
185
332
|
/** Button content */
|
|
186
333
|
children?: ReactNode;
|
|
@@ -319,4 +466,80 @@ interface FFIDSubscriptionBadgeProps {
|
|
|
319
466
|
*/
|
|
320
467
|
declare function FFIDSubscriptionBadge({ className, classNames, style, showPlanName, labels, render, }: FFIDSubscriptionBadgeProps): react_jsx_runtime.JSX.Element;
|
|
321
468
|
|
|
322
|
-
|
|
469
|
+
/** ClassNames for styling individual parts */
|
|
470
|
+
interface FFIDAnnouncementBadgeClassNames {
|
|
471
|
+
/** The button wrapper element */
|
|
472
|
+
button?: string;
|
|
473
|
+
/** The badge count element */
|
|
474
|
+
badge?: string;
|
|
475
|
+
/** The bell icon SVG */
|
|
476
|
+
icon?: string;
|
|
477
|
+
}
|
|
478
|
+
interface FFIDAnnouncementBadgeProps {
|
|
479
|
+
/** Click handler (e.g., open announcement panel) */
|
|
480
|
+
onClick?: () => void;
|
|
481
|
+
/** Custom class name (applies to button) */
|
|
482
|
+
className?: string;
|
|
483
|
+
/** Class names for individual parts */
|
|
484
|
+
classNames?: FFIDAnnouncementBadgeClassNames;
|
|
485
|
+
/** Custom style for the button */
|
|
486
|
+
style?: CSSProperties;
|
|
487
|
+
/** Options passed to useFFIDAnnouncements */
|
|
488
|
+
announcementOptions?: UseFFIDAnnouncementsOptions;
|
|
489
|
+
/** Icon size in pixels (default: 20) */
|
|
490
|
+
iconSize?: number;
|
|
491
|
+
/** Accessible label (default: 'お知らせ') */
|
|
492
|
+
ariaLabel?: string;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Announcement badge with bell icon and unread count
|
|
496
|
+
*/
|
|
497
|
+
declare function FFIDAnnouncementBadge({ onClick, className, classNames, style, announcementOptions, iconSize, ariaLabel, }: FFIDAnnouncementBadgeProps): react_jsx_runtime.JSX.Element;
|
|
498
|
+
|
|
499
|
+
/** ClassNames for styling individual parts */
|
|
500
|
+
interface FFIDAnnouncementListClassNames {
|
|
501
|
+
/** The list container */
|
|
502
|
+
container?: string;
|
|
503
|
+
/** Each announcement item */
|
|
504
|
+
item?: string;
|
|
505
|
+
/** The type icon */
|
|
506
|
+
icon?: string;
|
|
507
|
+
/** The title text */
|
|
508
|
+
title?: string;
|
|
509
|
+
/** The content text */
|
|
510
|
+
content?: string;
|
|
511
|
+
/** The timestamp */
|
|
512
|
+
timestamp?: string;
|
|
513
|
+
/** Affected service tag */
|
|
514
|
+
serviceTag?: string;
|
|
515
|
+
/** Empty state message */
|
|
516
|
+
empty?: string;
|
|
517
|
+
}
|
|
518
|
+
interface FFIDAnnouncementListProps {
|
|
519
|
+
/** Announcements to display */
|
|
520
|
+
announcements: Announcement[];
|
|
521
|
+
/** Whether data is loading */
|
|
522
|
+
isLoading?: boolean;
|
|
523
|
+
/** Custom class name (applies to container) */
|
|
524
|
+
className?: string;
|
|
525
|
+
/** Class names for individual parts */
|
|
526
|
+
classNames?: FFIDAnnouncementListClassNames;
|
|
527
|
+
/** Custom style for the container */
|
|
528
|
+
style?: CSSProperties;
|
|
529
|
+
/** Date/time formatter (default: Japanese locale) */
|
|
530
|
+
formatDate?: (dateStr: string) => string;
|
|
531
|
+
/** Empty state message */
|
|
532
|
+
emptyMessage?: ReactNode;
|
|
533
|
+
/** Loading state render */
|
|
534
|
+
loadingRender?: ReactNode;
|
|
535
|
+
/** Custom item render */
|
|
536
|
+
renderItem?: (announcement: Announcement) => ReactNode;
|
|
537
|
+
/** Max lines for content preview (0 = hide content) */
|
|
538
|
+
maxContentLines?: number;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Announcement list component
|
|
542
|
+
*/
|
|
543
|
+
declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
|
|
544
|
+
|
|
545
|
+
export { type AnnouncementListResponse as A, type FFIDAnnouncementBadgeClassNames as B, type FFIDAnnouncementBadgeProps as C, type FFIDAnnouncementListClassNames as D, type FFIDAnnouncementListProps as E, type FFIDConfig as F, type FFIDLoginButtonProps as G, type FFIDOrganizationSwitcherClassNames as H, type FFIDOrganizationSwitcherProps as I, type FFIDSubscriptionBadgeClassNames as J, type FFIDSubscriptionBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDUserMenuClassNames as M, type FFIDUserMenuProps as N, type UseFFIDAnnouncementsOptions as U, type FFIDUser as a, type FFIDOrganization as b, type FFIDError as c, type FFIDSubscriptionContextValue as d, type FFIDAnnouncementsClientConfig as e, type FFIDAnnouncementsApiResponse as f, type FFIDAnnouncementsLogger as g, type Announcement as h, type AnnouncementStatus as i, type AnnouncementType as j, FFIDAnnouncementBadge as k, FFIDAnnouncementList as l, type FFIDAnnouncementsError as m, type FFIDAnnouncementsErrorCode as n, type FFIDAnnouncementsServerResponse as o, type FFIDApiResponse as p, type FFIDContextValue as q, type FFIDLogger as r, FFIDLoginButton as s, FFIDOrganizationSwitcher as t, type FFIDSessionResponse as u, type FFIDSubscription as v, FFIDSubscriptionBadge as w, FFIDUserMenu as x, type UseFFIDAnnouncementsReturn as y, useFFIDAnnouncements as z };
|
|
@@ -181,6 +181,153 @@ type FFIDApiResponse<T> = {
|
|
|
181
181
|
error: FFIDError;
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* FFID Announcements SDK Type Definitions
|
|
186
|
+
*
|
|
187
|
+
* Types for the FeelFlow ID Announcements SDK.
|
|
188
|
+
* Used by client applications to fetch and display announcements.
|
|
189
|
+
* Issue: #286
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Announcement type values.
|
|
193
|
+
* Uses string union with open extension for forward compatibility.
|
|
194
|
+
*/
|
|
195
|
+
type AnnouncementType = 'maintenance.scheduled' | 'maintenance.reminder' | 'maintenance.started' | 'maintenance.completed' | 'incident.detected' | 'incident.resolved' | 'api.deprecation' | 'api.breaking_change' | 'sdk.update_available' | 'security.advisory' | 'billing.payment_reminder' | 'billing.payment_failed' | 'legal.terms_updated' | 'account.security_alert' | (string & {});
|
|
196
|
+
/** Announcement status (only 'published' is visible via public API) */
|
|
197
|
+
type AnnouncementStatus = 'draft' | 'published' | 'archived';
|
|
198
|
+
/** Single announcement returned from the public API */
|
|
199
|
+
interface Announcement {
|
|
200
|
+
/** Announcement ID (UUID) */
|
|
201
|
+
id: string;
|
|
202
|
+
/** Announcement type */
|
|
203
|
+
type: AnnouncementType;
|
|
204
|
+
/** Title */
|
|
205
|
+
title: string;
|
|
206
|
+
/** Content (Markdown) */
|
|
207
|
+
content: string;
|
|
208
|
+
/** Announcement status */
|
|
209
|
+
status: AnnouncementStatus;
|
|
210
|
+
/** Scheduled maintenance start time (ISO 8601) */
|
|
211
|
+
scheduledAt: string | null;
|
|
212
|
+
/** Maintenance duration in minutes */
|
|
213
|
+
durationMinutes: number | null;
|
|
214
|
+
/** Affected service codes */
|
|
215
|
+
affectedServices: string[];
|
|
216
|
+
/** Notification channels */
|
|
217
|
+
channels: string[];
|
|
218
|
+
/** When the announcement was published (ISO 8601) */
|
|
219
|
+
publishedAt: string | null;
|
|
220
|
+
/** Created timestamp (ISO 8601) */
|
|
221
|
+
createdAt: string;
|
|
222
|
+
/** Updated timestamp (ISO 8601) */
|
|
223
|
+
updatedAt: string;
|
|
224
|
+
}
|
|
225
|
+
/** Response from list announcements endpoint */
|
|
226
|
+
interface AnnouncementListResponse {
|
|
227
|
+
/** List of announcements */
|
|
228
|
+
announcements: Announcement[];
|
|
229
|
+
/** Total number of matching announcements */
|
|
230
|
+
total: number;
|
|
231
|
+
}
|
|
232
|
+
/** Options for listing announcements */
|
|
233
|
+
interface ListAnnouncementsOptions {
|
|
234
|
+
/** Number of items to return (server default: 20, server max: 100) */
|
|
235
|
+
limit?: number;
|
|
236
|
+
/** Offset for pagination (default: 0) */
|
|
237
|
+
offset?: number;
|
|
238
|
+
}
|
|
239
|
+
/** Configuration for the FFID Announcements Client */
|
|
240
|
+
interface FFIDAnnouncementsClientConfig {
|
|
241
|
+
/** FFID API base URL (defaults to https://id.feelflow.co.jp) */
|
|
242
|
+
apiBaseUrl?: string | undefined;
|
|
243
|
+
/** Enable debug logging */
|
|
244
|
+
debug?: boolean | undefined;
|
|
245
|
+
/** Custom logger */
|
|
246
|
+
logger?: FFIDAnnouncementsLogger | undefined;
|
|
247
|
+
}
|
|
248
|
+
/** Logger interface for Announcements SDK */
|
|
249
|
+
interface FFIDAnnouncementsLogger {
|
|
250
|
+
debug: (...args: unknown[]) => void;
|
|
251
|
+
info: (...args: unknown[]) => void;
|
|
252
|
+
warn: (...args: unknown[]) => void;
|
|
253
|
+
error: (...args: unknown[]) => void;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* API response wrapper (discriminated union for type safety)
|
|
257
|
+
*
|
|
258
|
+
* Either data is present (success) or error is present (failure), never both.
|
|
259
|
+
*/
|
|
260
|
+
type FFIDAnnouncementsApiResponse<T> = {
|
|
261
|
+
data: T;
|
|
262
|
+
error?: undefined;
|
|
263
|
+
} | {
|
|
264
|
+
data?: undefined;
|
|
265
|
+
error: FFIDAnnouncementsError;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Known SDK error codes.
|
|
269
|
+
* Uses string union with open extension for forward compatibility with server error codes.
|
|
270
|
+
*/
|
|
271
|
+
type FFIDAnnouncementsErrorCode = 'NETWORK_ERROR' | 'PARSE_ERROR' | 'UNKNOWN_ERROR' | (string & {});
|
|
272
|
+
/** Error from the Announcements SDK */
|
|
273
|
+
interface FFIDAnnouncementsError {
|
|
274
|
+
/** Error code (known SDK codes provide autocomplete; server codes also accepted) */
|
|
275
|
+
code: FFIDAnnouncementsErrorCode;
|
|
276
|
+
/** Human-readable error message */
|
|
277
|
+
message: string;
|
|
278
|
+
}
|
|
279
|
+
/** Server response envelope */
|
|
280
|
+
type FFIDAnnouncementsServerResponse<T> = {
|
|
281
|
+
success: true;
|
|
282
|
+
data: T;
|
|
283
|
+
error?: undefined;
|
|
284
|
+
} | {
|
|
285
|
+
success: false;
|
|
286
|
+
data?: undefined;
|
|
287
|
+
error?: {
|
|
288
|
+
code: string;
|
|
289
|
+
message: string;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/** Options for the useFFIDAnnouncements hook */
|
|
294
|
+
interface UseFFIDAnnouncementsOptions {
|
|
295
|
+
/** Number of items to fetch (default: 20) */
|
|
296
|
+
limit?: number;
|
|
297
|
+
/** Offset for pagination (default: 0) */
|
|
298
|
+
offset?: number;
|
|
299
|
+
/** FFID API base URL (defaults to production) */
|
|
300
|
+
apiBaseUrl?: string;
|
|
301
|
+
/** Enable debug logging */
|
|
302
|
+
debug?: boolean;
|
|
303
|
+
/** Auto-fetch on mount (default: true) */
|
|
304
|
+
enabled?: boolean;
|
|
305
|
+
}
|
|
306
|
+
/** Return type for the useFFIDAnnouncements hook */
|
|
307
|
+
interface UseFFIDAnnouncementsReturn {
|
|
308
|
+
/** List of announcements */
|
|
309
|
+
announcements: Announcement[];
|
|
310
|
+
/** Total number of announcements */
|
|
311
|
+
total: number;
|
|
312
|
+
/** Number of unread announcements */
|
|
313
|
+
unreadCount: number;
|
|
314
|
+
/** Whether data is being loaded */
|
|
315
|
+
isLoading: boolean;
|
|
316
|
+
/** Any error that occurred */
|
|
317
|
+
error: FFIDAnnouncementsError | null;
|
|
318
|
+
/** Refetch announcements */
|
|
319
|
+
refetch: () => Promise<void>;
|
|
320
|
+
/** Mark all announcements as read */
|
|
321
|
+
markAsRead: () => void;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Hook to fetch and manage announcements from FFID Platform
|
|
325
|
+
*
|
|
326
|
+
* Tracks unread count by storing the last read timestamp in localStorage.
|
|
327
|
+
* Announcements published after the last read time are counted as unread.
|
|
328
|
+
*/
|
|
329
|
+
declare function useFFIDAnnouncements(options?: UseFFIDAnnouncementsOptions): UseFFIDAnnouncementsReturn;
|
|
330
|
+
|
|
184
331
|
interface FFIDLoginButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
185
332
|
/** Button content */
|
|
186
333
|
children?: ReactNode;
|
|
@@ -319,4 +466,80 @@ interface FFIDSubscriptionBadgeProps {
|
|
|
319
466
|
*/
|
|
320
467
|
declare function FFIDSubscriptionBadge({ className, classNames, style, showPlanName, labels, render, }: FFIDSubscriptionBadgeProps): react_jsx_runtime.JSX.Element;
|
|
321
468
|
|
|
322
|
-
|
|
469
|
+
/** ClassNames for styling individual parts */
|
|
470
|
+
interface FFIDAnnouncementBadgeClassNames {
|
|
471
|
+
/** The button wrapper element */
|
|
472
|
+
button?: string;
|
|
473
|
+
/** The badge count element */
|
|
474
|
+
badge?: string;
|
|
475
|
+
/** The bell icon SVG */
|
|
476
|
+
icon?: string;
|
|
477
|
+
}
|
|
478
|
+
interface FFIDAnnouncementBadgeProps {
|
|
479
|
+
/** Click handler (e.g., open announcement panel) */
|
|
480
|
+
onClick?: () => void;
|
|
481
|
+
/** Custom class name (applies to button) */
|
|
482
|
+
className?: string;
|
|
483
|
+
/** Class names for individual parts */
|
|
484
|
+
classNames?: FFIDAnnouncementBadgeClassNames;
|
|
485
|
+
/** Custom style for the button */
|
|
486
|
+
style?: CSSProperties;
|
|
487
|
+
/** Options passed to useFFIDAnnouncements */
|
|
488
|
+
announcementOptions?: UseFFIDAnnouncementsOptions;
|
|
489
|
+
/** Icon size in pixels (default: 20) */
|
|
490
|
+
iconSize?: number;
|
|
491
|
+
/** Accessible label (default: 'お知らせ') */
|
|
492
|
+
ariaLabel?: string;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Announcement badge with bell icon and unread count
|
|
496
|
+
*/
|
|
497
|
+
declare function FFIDAnnouncementBadge({ onClick, className, classNames, style, announcementOptions, iconSize, ariaLabel, }: FFIDAnnouncementBadgeProps): react_jsx_runtime.JSX.Element;
|
|
498
|
+
|
|
499
|
+
/** ClassNames for styling individual parts */
|
|
500
|
+
interface FFIDAnnouncementListClassNames {
|
|
501
|
+
/** The list container */
|
|
502
|
+
container?: string;
|
|
503
|
+
/** Each announcement item */
|
|
504
|
+
item?: string;
|
|
505
|
+
/** The type icon */
|
|
506
|
+
icon?: string;
|
|
507
|
+
/** The title text */
|
|
508
|
+
title?: string;
|
|
509
|
+
/** The content text */
|
|
510
|
+
content?: string;
|
|
511
|
+
/** The timestamp */
|
|
512
|
+
timestamp?: string;
|
|
513
|
+
/** Affected service tag */
|
|
514
|
+
serviceTag?: string;
|
|
515
|
+
/** Empty state message */
|
|
516
|
+
empty?: string;
|
|
517
|
+
}
|
|
518
|
+
interface FFIDAnnouncementListProps {
|
|
519
|
+
/** Announcements to display */
|
|
520
|
+
announcements: Announcement[];
|
|
521
|
+
/** Whether data is loading */
|
|
522
|
+
isLoading?: boolean;
|
|
523
|
+
/** Custom class name (applies to container) */
|
|
524
|
+
className?: string;
|
|
525
|
+
/** Class names for individual parts */
|
|
526
|
+
classNames?: FFIDAnnouncementListClassNames;
|
|
527
|
+
/** Custom style for the container */
|
|
528
|
+
style?: CSSProperties;
|
|
529
|
+
/** Date/time formatter (default: Japanese locale) */
|
|
530
|
+
formatDate?: (dateStr: string) => string;
|
|
531
|
+
/** Empty state message */
|
|
532
|
+
emptyMessage?: ReactNode;
|
|
533
|
+
/** Loading state render */
|
|
534
|
+
loadingRender?: ReactNode;
|
|
535
|
+
/** Custom item render */
|
|
536
|
+
renderItem?: (announcement: Announcement) => ReactNode;
|
|
537
|
+
/** Max lines for content preview (0 = hide content) */
|
|
538
|
+
maxContentLines?: number;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Announcement list component
|
|
542
|
+
*/
|
|
543
|
+
declare function FFIDAnnouncementList({ announcements, isLoading, className, classNames, style, formatDate, emptyMessage, loadingRender, renderItem, maxContentLines, }: FFIDAnnouncementListProps): react_jsx_runtime.JSX.Element;
|
|
544
|
+
|
|
545
|
+
export { type AnnouncementListResponse as A, type FFIDAnnouncementBadgeClassNames as B, type FFIDAnnouncementBadgeProps as C, type FFIDAnnouncementListClassNames as D, type FFIDAnnouncementListProps as E, type FFIDConfig as F, type FFIDLoginButtonProps as G, type FFIDOrganizationSwitcherClassNames as H, type FFIDOrganizationSwitcherProps as I, type FFIDSubscriptionBadgeClassNames as J, type FFIDSubscriptionBadgeProps as K, type ListAnnouncementsOptions as L, type FFIDUserMenuClassNames as M, type FFIDUserMenuProps as N, type UseFFIDAnnouncementsOptions as U, type FFIDUser as a, type FFIDOrganization as b, type FFIDError as c, type FFIDSubscriptionContextValue as d, type FFIDAnnouncementsClientConfig as e, type FFIDAnnouncementsApiResponse as f, type FFIDAnnouncementsLogger as g, type Announcement as h, type AnnouncementStatus as i, type AnnouncementType as j, FFIDAnnouncementBadge as k, FFIDAnnouncementList as l, type FFIDAnnouncementsError as m, type FFIDAnnouncementsErrorCode as n, type FFIDAnnouncementsServerResponse as o, type FFIDApiResponse as p, type FFIDContextValue as q, type FFIDLogger as r, FFIDLoginButton as s, FFIDOrganizationSwitcher as t, type FFIDSessionResponse as u, type FFIDSubscription as v, FFIDSubscriptionBadge as w, FFIDUserMenu as x, type UseFFIDAnnouncementsReturn as y, useFFIDAnnouncements as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkA6YJDYIX_cjs = require('./chunk-A6YJDYIX.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
7
7
|
function withFFIDAuth(Component, options = {}) {
|
|
8
8
|
const WrappedComponent = (props) => {
|
|
9
|
-
const { isLoading, isAuthenticated, login } =
|
|
9
|
+
const { isLoading, isAuthenticated, login } = chunkA6YJDYIX_cjs.useFFIDContext();
|
|
10
10
|
const hasRedirected = react.useRef(false);
|
|
11
11
|
react.useEffect(() => {
|
|
12
12
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -31,38 +31,58 @@ function withFFIDAuth(Component, options = {}) {
|
|
|
31
31
|
|
|
32
32
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkA6YJDYIX_cjs.DEFAULT_API_BASE_URL; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunkA6YJDYIX_cjs.FFIDAnnouncementBadge; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunkA6YJDYIX_cjs.FFIDAnnouncementList; }
|
|
35
43
|
});
|
|
36
44
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
37
45
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkA6YJDYIX_cjs.FFIDLoginButton; }
|
|
39
47
|
});
|
|
40
48
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
41
49
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkA6YJDYIX_cjs.FFIDOrganizationSwitcher; }
|
|
43
51
|
});
|
|
44
52
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
45
53
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkA6YJDYIX_cjs.FFIDProvider; }
|
|
47
55
|
});
|
|
48
56
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
49
57
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkA6YJDYIX_cjs.FFIDSubscriptionBadge; }
|
|
51
59
|
});
|
|
52
60
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
53
61
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkA6YJDYIX_cjs.FFIDUserMenu; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return chunkA6YJDYIX_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return chunkA6YJDYIX_cjs.createFFIDAnnouncementsClient; }
|
|
55
71
|
});
|
|
56
72
|
Object.defineProperty(exports, "useFFID", {
|
|
57
73
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkA6YJDYIX_cjs.useFFID; }
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return chunkA6YJDYIX_cjs.useFFIDAnnouncements; }
|
|
59
79
|
});
|
|
60
80
|
Object.defineProperty(exports, "useSubscription", {
|
|
61
81
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkA6YJDYIX_cjs.useSubscription; }
|
|
63
83
|
});
|
|
64
84
|
Object.defineProperty(exports, "withSubscription", {
|
|
65
85
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkA6YJDYIX_cjs.withSubscription; }
|
|
67
87
|
});
|
|
68
88
|
exports.withFFIDAuth = withFFIDAuth;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, ComponentType, FC } from 'react';
|
|
3
|
-
import { F as FFIDConfig, a as FFIDUser, b as FFIDOrganization, c as FFIDError, d as FFIDSubscriptionContextValue } from './index-
|
|
4
|
-
export {
|
|
3
|
+
import { F as FFIDConfig, a as FFIDUser, b as FFIDOrganization, c as FFIDError, d as FFIDSubscriptionContextValue, e as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, f as FFIDAnnouncementsApiResponse, A as AnnouncementListResponse, g as FFIDAnnouncementsLogger } from './index-B92_OuFc.cjs';
|
|
4
|
+
export { h as Announcement, i as AnnouncementStatus, j as AnnouncementType, k as FFIDAnnouncementBadge, l as FFIDAnnouncementList, m as FFIDAnnouncementsError, n as FFIDAnnouncementsErrorCode, o as FFIDAnnouncementsServerResponse, p as FFIDApiResponse, q as FFIDContextValue, r as FFIDLogger, s as FFIDLoginButton, t as FFIDOrganizationSwitcher, u as FFIDSessionResponse, v as FFIDSubscription, w as FFIDSubscriptionBadge, x as FFIDUserMenu, U as UseFFIDAnnouncementsOptions, y as UseFFIDAnnouncementsReturn, z as useFFIDAnnouncements } from './index-B92_OuFc.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* FFID SDK Shared Constants
|
|
8
8
|
*
|
|
9
|
-
* Constants shared across all SDK entry points
|
|
9
|
+
* Constants shared across all SDK entry points.
|
|
10
10
|
* Centralizing these prevents drift during domain/URL changes.
|
|
11
11
|
*/
|
|
12
12
|
/** Default FFID API base URL (production) */
|
|
@@ -178,4 +178,59 @@ interface WithFFIDAuthOptions {
|
|
|
178
178
|
*/
|
|
179
179
|
declare function withFFIDAuth<P extends object>(Component: ComponentType<P>, options?: WithFFIDAuthOptions): FC<P>;
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
/**
|
|
182
|
+
* FFID Announcements API Client
|
|
183
|
+
*
|
|
184
|
+
* Handles API communication for public announcements.
|
|
185
|
+
* No authentication required - this is a public endpoint.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* import { createFFIDAnnouncementsClient } from '@feelflow/ffid-sdk/announcements'
|
|
190
|
+
*
|
|
191
|
+
* const client = createFFIDAnnouncementsClient({
|
|
192
|
+
* apiBaseUrl: 'https://id.feelflow.co.jp',
|
|
193
|
+
* })
|
|
194
|
+
*
|
|
195
|
+
* const { data, error } = await client.listAnnouncements({ limit: 10 })
|
|
196
|
+
* if (data) {
|
|
197
|
+
* console.log(`Found ${data.total} announcements`)
|
|
198
|
+
* }
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Error codes used by the Announcements SDK
|
|
204
|
+
*/
|
|
205
|
+
declare const FFID_ANNOUNCEMENTS_ERROR_CODES: {
|
|
206
|
+
/** Network request failed (fetch threw) */
|
|
207
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
208
|
+
/** Failed to parse server response as JSON */
|
|
209
|
+
readonly PARSE_ERROR: "PARSE_ERROR";
|
|
210
|
+
/** Server returned error without structured error body */
|
|
211
|
+
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Creates an FFID Announcements API client instance
|
|
215
|
+
*
|
|
216
|
+
* @param config - Client configuration (optional, uses defaults)
|
|
217
|
+
* @returns Announcements client instance
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* const client = createFFIDAnnouncementsClient()
|
|
222
|
+
* const { data, error } = await client.listAnnouncements()
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientConfig): {
|
|
226
|
+
/** List published announcements */
|
|
227
|
+
listAnnouncements: (options?: ListAnnouncementsOptions) => Promise<FFIDAnnouncementsApiResponse<AnnouncementListResponse>>;
|
|
228
|
+
/** Resolved logger instance */
|
|
229
|
+
logger: FFIDAnnouncementsLogger;
|
|
230
|
+
/** API base URL */
|
|
231
|
+
baseUrl: string;
|
|
232
|
+
};
|
|
233
|
+
/** Type of the FFID Announcements client */
|
|
234
|
+
type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
|
|
235
|
+
|
|
236
|
+
export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDConfig, FFIDError, FFIDOrganization, FFIDProvider, type FFIDProviderProps, FFIDSubscriptionContextValue, FFIDUser, FFID_ANNOUNCEMENTS_ERROR_CODES, ListAnnouncementsOptions, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, useFFID, useSubscription, withFFIDAuth, withSubscription };
|