@feelflow/ffid-sdk 2.12.1 → 2.14.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.
@@ -756,8 +756,34 @@ function createMembersMethods(deps) {
756
756
  return { listMembers, updateMemberRole, removeMember };
757
757
  }
758
758
 
759
+ // src/client/profile-methods.ts
760
+ var EXT_PROFILE_ENDPOINT = "/api/v1/users/ext/me";
761
+ function createProfileMethods(deps) {
762
+ const { fetchWithAuth, createError } = deps;
763
+ async function getProfile() {
764
+ return fetchWithAuth(EXT_PROFILE_ENDPOINT);
765
+ }
766
+ async function updateProfile(data) {
767
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
768
+ return {
769
+ error: createError("VALIDATION_ERROR", "data \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059")
770
+ };
771
+ }
772
+ if (Object.keys(data).length === 0) {
773
+ return {
774
+ error: createError("VALIDATION_ERROR", "\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
775
+ };
776
+ }
777
+ return fetchWithAuth(EXT_PROFILE_ENDPOINT, {
778
+ method: "PUT",
779
+ body: JSON.stringify(data)
780
+ });
781
+ }
782
+ return { getProfile, updateProfile };
783
+ }
784
+
759
785
  // src/client/version-check.ts
760
- var SDK_VERSION = "2.12.1";
786
+ var SDK_VERSION = "2.14.0";
761
787
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
762
788
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
763
789
  function sdkHeaders() {
@@ -2128,6 +2154,10 @@ function createFFIDClient(config) {
2128
2154
  createError,
2129
2155
  serviceCode: config.serviceCode
2130
2156
  });
2157
+ const { getProfile, updateProfile } = createProfileMethods({
2158
+ fetchWithAuth,
2159
+ createError
2160
+ });
2131
2161
  const {
2132
2162
  requestPasswordReset,
2133
2163
  verifyPasswordResetToken,
@@ -2199,6 +2229,8 @@ function createFFIDClient(config) {
2199
2229
  listMembers,
2200
2230
  updateMemberRole,
2201
2231
  removeMember,
2232
+ getProfile,
2233
+ updateProfile,
2202
2234
  createCheckoutSession,
2203
2235
  createPortalSession,
2204
2236
  listPlans,
@@ -8,21 +8,63 @@ export { D as DEFAULT_API_BASE_URL } from '../constants-DvTGHPZn.cjs';
8
8
  * `<FFIDInquiryForm />` and submit through either endpoint.
9
9
  */
10
10
  /**
11
- * Categories surfaced by the default form. Consumers are free to
12
- * pass their own list via `<FFIDInquiryForm categories={...} />`.
11
+ * Legacy 6-value canonical categories. Retained for historical DB rows
12
+ * (the pre-2026 values `general`, `sales`, `support`, `press` still appear
13
+ * in older inquiries) and for 2.x backwards compatibility with SDK
14
+ * consumers that pinned to this exact set.
15
+ *
16
+ * Note: `partnership` and `other` intentionally also appear in
17
+ * {@link FFID_INQUIRY_CATEGORIES_SITE_2026}; the legacy-only subset is
18
+ * `general`, `sales`, `support`, `press`.
19
+ *
20
+ * @deprecated New integrations should use
21
+ * {@link FFID_INQUIRY_CATEGORIES_SITE_2026} (13 values, aligned with
22
+ * feelflow-website-2026 `/contact`). This legacy constant remains
23
+ * exported for 2.x compatibility and may be removed in 3.x.
13
24
  */
14
25
  declare const FFID_INQUIRY_CATEGORIES: readonly ["general", "sales", "support", "partnership", "press", "other"];
26
+ /**
27
+ * Type alias derived from the legacy 6-value list. Still referenced by
28
+ * {@link FFIDInquiryCreateParams.category} so existing callers compile
29
+ * without changes; no `@deprecated` on the type itself because the
30
+ * actionable migration target is the runtime constant above, and
31
+ * propagating `@deprecated` to the type would surface false-positive
32
+ * warnings on public API that deliberately accepts both shapes.
33
+ */
15
34
  type FFIDInquiryCategory = (typeof FFID_INQUIRY_CATEGORIES)[number];
35
+ /**
36
+ * 13-value category list that mirrors feelflow-website-2026
37
+ * `/contact` (`feelflow-site/src/lib/contact-schema.ts` `CATEGORY_OPTIONS`).
38
+ *
39
+ * Source-of-truth ownership: **the site repo is authoritative**; this
40
+ * constant is a delayed-sync snapshot shipped through the SDK so
41
+ * consumers can get autocomplete without depending on the site repo.
42
+ * Drift between site and the FFID admin UI is detected automatically by
43
+ * `scripts/sync-inquiry-categories.ts` (SDK-side drift is a separate
44
+ * follow-up and today is caught only if the SDK snapshot is updated
45
+ * alongside the admin UI constants).
46
+ */
47
+ declare const FFID_INQUIRY_CATEGORIES_SITE_2026: readonly ["consulting", "saas", "development", "agent-hub", "ai-feel-chatbot", "knowledge-db", "biz-simulator", "discussion-board", "realtime-ai", "partnership", "media", "recruiting", "other"];
48
+ type FFIDInquiryCategorySite2026 = (typeof FFID_INQUIRY_CATEGORIES_SITE_2026)[number];
16
49
  /**
17
50
  * Parameters for `client.inquiry.create()`. When submitting from a
18
51
  * server-side SDK (Service API Key), set `source` to a stable
19
52
  * origin string so admins can trace the submission back.
53
+ *
54
+ * `category` accepts any string at the SDK boundary to keep the SDK
55
+ * forward-compatible with new site-side categories added before the SDK
56
+ * re-publishes. FFID ext-endpoint validation (`/api/v1/ext/inquiry`) is
57
+ * lenient — `z.string().max(100).optional()` — so unknown strings flow
58
+ * through to the DB unchanged. Note: the `(string & {})` arm of the
59
+ * union intentionally keeps autocomplete active while allowing arbitrary
60
+ * strings; callers using exhaustive `switch` statements should include
61
+ * a `default` branch.
20
62
  */
21
63
  interface FFIDInquiryCreateParams {
22
64
  email: string;
23
65
  name: string;
24
66
  message: string;
25
- category?: FFIDInquiryCategory | (string & {});
67
+ category?: FFIDInquiryCategorySite2026 | FFIDInquiryCategory | (string & {});
26
68
  company?: string;
27
69
  phone?: string;
28
70
  locale?: 'ja' | 'en';
@@ -738,6 +780,64 @@ interface FFIDUpdateMemberRoleResponse {
738
780
  interface FFIDRemoveMemberResponse {
739
781
  message: string;
740
782
  }
783
+ /**
784
+ * User profile for the authenticated user (returned by `getProfile` / `updateProfile`).
785
+ *
786
+ * Mirrors the FFID backend `UserProfile` shape exposed via
787
+ * `GET /api/v1/users/ext/me` and `PUT /api/v1/users/ext/me`.
788
+ */
789
+ interface FFIDUserProfile {
790
+ /** User ID (UUID) */
791
+ id: string;
792
+ /** Email address */
793
+ email: string;
794
+ /** Display name (nullable when not set) */
795
+ displayName: string | null;
796
+ /** Avatar URL (nullable when not set) */
797
+ avatarUrl: string | null;
798
+ /** Phone number (nullable when not set) */
799
+ phone: string | null;
800
+ /** Company name (nullable when not set) */
801
+ companyName: string | null;
802
+ /** Department (nullable when not set) */
803
+ department: string | null;
804
+ /** Job title (nullable when not set) */
805
+ jobTitle: string | null;
806
+ /** IANA timezone (e.g. 'Asia/Tokyo') */
807
+ timezone: string;
808
+ /** Locale (e.g. 'ja', 'en') */
809
+ locale: string;
810
+ /** Arbitrary user preferences bag */
811
+ preferences: Record<string, unknown>;
812
+ /** Account creation timestamp (ISO 8601) */
813
+ createdAt: string;
814
+ /** Profile last-updated timestamp (ISO 8601) */
815
+ updatedAt: string;
816
+ }
817
+ /**
818
+ * Request payload for `updateProfile`.
819
+ *
820
+ * Mirrors the FFID backend `UpdateUserProfileRequest` shape. All fields are
821
+ * optional — only the supplied keys will be updated (partial update semantics).
822
+ */
823
+ interface FFIDUpdateUserProfileRequest {
824
+ /** Display name */
825
+ displayName?: string;
826
+ /** Phone number */
827
+ phone?: string;
828
+ /** Company name */
829
+ companyName?: string;
830
+ /** Department */
831
+ department?: string;
832
+ /** Job title */
833
+ jobTitle?: string;
834
+ /** IANA timezone */
835
+ timezone?: string;
836
+ /** Locale */
837
+ locale?: string;
838
+ /** Arbitrary user preferences bag */
839
+ preferences?: Record<string, unknown>;
840
+ }
741
841
  /**
742
842
  * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
743
843
  *
@@ -892,6 +992,8 @@ declare function createFFIDClient(config: FFIDConfig): {
892
992
  organizationId: string;
893
993
  userId: string;
894
994
  }) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
995
+ getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
996
+ updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
895
997
  createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
896
998
  createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
897
999
  listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
@@ -8,21 +8,63 @@ export { D as DEFAULT_API_BASE_URL } from '../constants-DvTGHPZn.js';
8
8
  * `<FFIDInquiryForm />` and submit through either endpoint.
9
9
  */
10
10
  /**
11
- * Categories surfaced by the default form. Consumers are free to
12
- * pass their own list via `<FFIDInquiryForm categories={...} />`.
11
+ * Legacy 6-value canonical categories. Retained for historical DB rows
12
+ * (the pre-2026 values `general`, `sales`, `support`, `press` still appear
13
+ * in older inquiries) and for 2.x backwards compatibility with SDK
14
+ * consumers that pinned to this exact set.
15
+ *
16
+ * Note: `partnership` and `other` intentionally also appear in
17
+ * {@link FFID_INQUIRY_CATEGORIES_SITE_2026}; the legacy-only subset is
18
+ * `general`, `sales`, `support`, `press`.
19
+ *
20
+ * @deprecated New integrations should use
21
+ * {@link FFID_INQUIRY_CATEGORIES_SITE_2026} (13 values, aligned with
22
+ * feelflow-website-2026 `/contact`). This legacy constant remains
23
+ * exported for 2.x compatibility and may be removed in 3.x.
13
24
  */
14
25
  declare const FFID_INQUIRY_CATEGORIES: readonly ["general", "sales", "support", "partnership", "press", "other"];
26
+ /**
27
+ * Type alias derived from the legacy 6-value list. Still referenced by
28
+ * {@link FFIDInquiryCreateParams.category} so existing callers compile
29
+ * without changes; no `@deprecated` on the type itself because the
30
+ * actionable migration target is the runtime constant above, and
31
+ * propagating `@deprecated` to the type would surface false-positive
32
+ * warnings on public API that deliberately accepts both shapes.
33
+ */
15
34
  type FFIDInquiryCategory = (typeof FFID_INQUIRY_CATEGORIES)[number];
35
+ /**
36
+ * 13-value category list that mirrors feelflow-website-2026
37
+ * `/contact` (`feelflow-site/src/lib/contact-schema.ts` `CATEGORY_OPTIONS`).
38
+ *
39
+ * Source-of-truth ownership: **the site repo is authoritative**; this
40
+ * constant is a delayed-sync snapshot shipped through the SDK so
41
+ * consumers can get autocomplete without depending on the site repo.
42
+ * Drift between site and the FFID admin UI is detected automatically by
43
+ * `scripts/sync-inquiry-categories.ts` (SDK-side drift is a separate
44
+ * follow-up and today is caught only if the SDK snapshot is updated
45
+ * alongside the admin UI constants).
46
+ */
47
+ declare const FFID_INQUIRY_CATEGORIES_SITE_2026: readonly ["consulting", "saas", "development", "agent-hub", "ai-feel-chatbot", "knowledge-db", "biz-simulator", "discussion-board", "realtime-ai", "partnership", "media", "recruiting", "other"];
48
+ type FFIDInquiryCategorySite2026 = (typeof FFID_INQUIRY_CATEGORIES_SITE_2026)[number];
16
49
  /**
17
50
  * Parameters for `client.inquiry.create()`. When submitting from a
18
51
  * server-side SDK (Service API Key), set `source` to a stable
19
52
  * origin string so admins can trace the submission back.
53
+ *
54
+ * `category` accepts any string at the SDK boundary to keep the SDK
55
+ * forward-compatible with new site-side categories added before the SDK
56
+ * re-publishes. FFID ext-endpoint validation (`/api/v1/ext/inquiry`) is
57
+ * lenient — `z.string().max(100).optional()` — so unknown strings flow
58
+ * through to the DB unchanged. Note: the `(string & {})` arm of the
59
+ * union intentionally keeps autocomplete active while allowing arbitrary
60
+ * strings; callers using exhaustive `switch` statements should include
61
+ * a `default` branch.
20
62
  */
21
63
  interface FFIDInquiryCreateParams {
22
64
  email: string;
23
65
  name: string;
24
66
  message: string;
25
- category?: FFIDInquiryCategory | (string & {});
67
+ category?: FFIDInquiryCategorySite2026 | FFIDInquiryCategory | (string & {});
26
68
  company?: string;
27
69
  phone?: string;
28
70
  locale?: 'ja' | 'en';
@@ -738,6 +780,64 @@ interface FFIDUpdateMemberRoleResponse {
738
780
  interface FFIDRemoveMemberResponse {
739
781
  message: string;
740
782
  }
783
+ /**
784
+ * User profile for the authenticated user (returned by `getProfile` / `updateProfile`).
785
+ *
786
+ * Mirrors the FFID backend `UserProfile` shape exposed via
787
+ * `GET /api/v1/users/ext/me` and `PUT /api/v1/users/ext/me`.
788
+ */
789
+ interface FFIDUserProfile {
790
+ /** User ID (UUID) */
791
+ id: string;
792
+ /** Email address */
793
+ email: string;
794
+ /** Display name (nullable when not set) */
795
+ displayName: string | null;
796
+ /** Avatar URL (nullable when not set) */
797
+ avatarUrl: string | null;
798
+ /** Phone number (nullable when not set) */
799
+ phone: string | null;
800
+ /** Company name (nullable when not set) */
801
+ companyName: string | null;
802
+ /** Department (nullable when not set) */
803
+ department: string | null;
804
+ /** Job title (nullable when not set) */
805
+ jobTitle: string | null;
806
+ /** IANA timezone (e.g. 'Asia/Tokyo') */
807
+ timezone: string;
808
+ /** Locale (e.g. 'ja', 'en') */
809
+ locale: string;
810
+ /** Arbitrary user preferences bag */
811
+ preferences: Record<string, unknown>;
812
+ /** Account creation timestamp (ISO 8601) */
813
+ createdAt: string;
814
+ /** Profile last-updated timestamp (ISO 8601) */
815
+ updatedAt: string;
816
+ }
817
+ /**
818
+ * Request payload for `updateProfile`.
819
+ *
820
+ * Mirrors the FFID backend `UpdateUserProfileRequest` shape. All fields are
821
+ * optional — only the supplied keys will be updated (partial update semantics).
822
+ */
823
+ interface FFIDUpdateUserProfileRequest {
824
+ /** Display name */
825
+ displayName?: string;
826
+ /** Phone number */
827
+ phone?: string;
828
+ /** Company name */
829
+ companyName?: string;
830
+ /** Department */
831
+ department?: string;
832
+ /** Job title */
833
+ jobTitle?: string;
834
+ /** IANA timezone */
835
+ timezone?: string;
836
+ /** Locale */
837
+ locale?: string;
838
+ /** Arbitrary user preferences bag */
839
+ preferences?: Record<string, unknown>;
840
+ }
741
841
  /**
742
842
  * Result of a redirect operation (redirectToLogin / redirectToAuthorize / redirectToLogout)
743
843
  *
@@ -892,6 +992,8 @@ declare function createFFIDClient(config: FFIDConfig): {
892
992
  organizationId: string;
893
993
  userId: string;
894
994
  }) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
995
+ getProfile: () => Promise<FFIDApiResponse<FFIDUserProfile>>;
996
+ updateProfile: (data: FFIDUpdateUserProfileRequest) => Promise<FFIDApiResponse<FFIDUserProfile>>;
895
997
  createCheckoutSession: (params: FFIDCreateCheckoutParams) => Promise<FFIDApiResponse<FFIDCheckoutSessionResponse>>;
896
998
  createPortalSession: (params: FFIDCreatePortalParams) => Promise<FFIDApiResponse<FFIDPortalSessionResponse>>;
897
999
  listPlans: () => Promise<FFIDApiResponse<FFIDListPlansResponse>>;
@@ -755,8 +755,34 @@ function createMembersMethods(deps) {
755
755
  return { listMembers, updateMemberRole, removeMember };
756
756
  }
757
757
 
758
+ // src/client/profile-methods.ts
759
+ var EXT_PROFILE_ENDPOINT = "/api/v1/users/ext/me";
760
+ function createProfileMethods(deps) {
761
+ const { fetchWithAuth, createError } = deps;
762
+ async function getProfile() {
763
+ return fetchWithAuth(EXT_PROFILE_ENDPOINT);
764
+ }
765
+ async function updateProfile(data) {
766
+ if (data === null || typeof data !== "object" || Array.isArray(data)) {
767
+ return {
768
+ error: createError("VALIDATION_ERROR", "data \u306F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059")
769
+ };
770
+ }
771
+ if (Object.keys(data).length === 0) {
772
+ return {
773
+ error: createError("VALIDATION_ERROR", "\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
774
+ };
775
+ }
776
+ return fetchWithAuth(EXT_PROFILE_ENDPOINT, {
777
+ method: "PUT",
778
+ body: JSON.stringify(data)
779
+ });
780
+ }
781
+ return { getProfile, updateProfile };
782
+ }
783
+
758
784
  // src/client/version-check.ts
759
- var SDK_VERSION = "2.12.1";
785
+ var SDK_VERSION = "2.14.0";
760
786
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
761
787
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
762
788
  function sdkHeaders() {
@@ -2127,6 +2153,10 @@ function createFFIDClient(config) {
2127
2153
  createError,
2128
2154
  serviceCode: config.serviceCode
2129
2155
  });
2156
+ const { getProfile, updateProfile } = createProfileMethods({
2157
+ fetchWithAuth,
2158
+ createError
2159
+ });
2130
2160
  const {
2131
2161
  requestPasswordReset,
2132
2162
  verifyPasswordResetToken,
@@ -2198,6 +2228,8 @@ function createFFIDClient(config) {
2198
2228
  listMembers,
2199
2229
  updateMemberRole,
2200
2230
  removeMember,
2231
+ getProfile,
2232
+ updateProfile,
2201
2233
  createCheckoutSession,
2202
2234
  createPortalSession,
2203
2235
  listPlans,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "2.12.1",
3
+ "version": "2.14.0",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",