@feelflow/ffid-sdk 2.4.0 → 2.5.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.
@@ -520,6 +520,17 @@ function createSubscriptionMethods(deps) {
520
520
  }
521
521
  );
522
522
  }
523
+ async function cancelPendingDowngrade(subscriptionId) {
524
+ if (!subscriptionId) {
525
+ return {
526
+ error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
527
+ };
528
+ }
529
+ return fetchWithAuth(
530
+ `${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(subscriptionId)}/pending-downgrade`,
531
+ { method: "DELETE" }
532
+ );
533
+ }
523
534
  async function previewPlanChange(params) {
524
535
  if (!params.subscriptionId || !params.planCode) {
525
536
  return {
@@ -543,6 +554,7 @@ function createSubscriptionMethods(deps) {
543
554
  subscribe,
544
555
  changePlan,
545
556
  cancelSubscription,
557
+ cancelPendingDowngrade,
546
558
  previewPlanChange
547
559
  };
548
560
  }
@@ -600,7 +612,7 @@ function createMembersMethods(deps) {
600
612
  }
601
613
 
602
614
  // src/client/version-check.ts
603
- var SDK_VERSION = "2.4.0";
615
+ var SDK_VERSION = "2.5.0";
604
616
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
605
617
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
606
618
  function sdkHeaders() {
@@ -1774,6 +1786,7 @@ function createFFIDClient(config) {
1774
1786
  subscribe,
1775
1787
  changePlan,
1776
1788
  cancelSubscription,
1789
+ cancelPendingDowngrade,
1777
1790
  previewPlanChange
1778
1791
  } = createSubscriptionMethods({
1779
1792
  fetchWithAuth,
@@ -1853,6 +1866,7 @@ function createFFIDClient(config) {
1853
1866
  subscribe,
1854
1867
  changePlan,
1855
1868
  cancelSubscription,
1869
+ cancelPendingDowngrade,
1856
1870
  previewPlanChange,
1857
1871
  verifyAccessToken,
1858
1872
  getSubscribeUrl,
@@ -518,6 +518,17 @@ function createSubscriptionMethods(deps) {
518
518
  }
519
519
  );
520
520
  }
521
+ async function cancelPendingDowngrade(subscriptionId) {
522
+ if (!subscriptionId) {
523
+ return {
524
+ error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
525
+ };
526
+ }
527
+ return fetchWithAuth(
528
+ `${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(subscriptionId)}/pending-downgrade`,
529
+ { method: "DELETE" }
530
+ );
531
+ }
521
532
  async function previewPlanChange(params) {
522
533
  if (!params.subscriptionId || !params.planCode) {
523
534
  return {
@@ -541,6 +552,7 @@ function createSubscriptionMethods(deps) {
541
552
  subscribe,
542
553
  changePlan,
543
554
  cancelSubscription,
555
+ cancelPendingDowngrade,
544
556
  previewPlanChange
545
557
  };
546
558
  }
@@ -598,7 +610,7 @@ function createMembersMethods(deps) {
598
610
  }
599
611
 
600
612
  // src/client/version-check.ts
601
- var SDK_VERSION = "2.4.0";
613
+ var SDK_VERSION = "2.5.0";
602
614
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
603
615
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
604
616
  function sdkHeaders() {
@@ -1772,6 +1784,7 @@ function createFFIDClient(config) {
1772
1784
  subscribe,
1773
1785
  changePlan,
1774
1786
  cancelSubscription,
1787
+ cancelPendingDowngrade,
1775
1788
  previewPlanChange
1776
1789
  } = createSubscriptionMethods({
1777
1790
  fetchWithAuth,
@@ -1851,6 +1864,7 @@ function createFFIDClient(config) {
1851
1864
  subscribe,
1852
1865
  changePlan,
1853
1866
  cancelSubscription,
1867
+ cancelPendingDowngrade,
1854
1868
  previewPlanChange,
1855
1869
  verifyAccessToken,
1856
1870
  getSubscribeUrl,
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkCECTOY4A_cjs = require('../chunk-CECTOY4A.cjs');
3
+ var chunkR36QED6A_cjs = require('../chunk-R36QED6A.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDLoginButton", {
16
16
  enumerable: true,
17
- get: function () { return chunkCECTOY4A_cjs.FFIDLoginButton; }
17
+ get: function () { return chunkR36QED6A_cjs.FFIDLoginButton; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
20
20
  enumerable: true,
21
- get: function () { return chunkCECTOY4A_cjs.FFIDOrganizationSwitcher; }
21
+ get: function () { return chunkR36QED6A_cjs.FFIDOrganizationSwitcher; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
24
24
  enumerable: true,
25
- get: function () { return chunkCECTOY4A_cjs.FFIDSubscriptionBadge; }
25
+ get: function () { return chunkR36QED6A_cjs.FFIDSubscriptionBadge; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDUserMenu", {
28
28
  enumerable: true,
29
- get: function () { return chunkCECTOY4A_cjs.FFIDUserMenu; }
29
+ get: function () { return chunkR36QED6A_cjs.FFIDUserMenu; }
30
30
  });
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-VJHI6RQQ.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-SNJS23L7.js';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkCECTOY4A_cjs = require('./chunk-CECTOY4A.cjs');
3
+ var chunkR36QED6A_cjs = require('./chunk-R36QED6A.cjs');
4
4
  var react = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
@@ -46,7 +46,7 @@ function createKVCacheAdapter(kv) {
46
46
  }
47
47
  function withFFIDAuth(Component, options = {}) {
48
48
  const WrappedComponent = (props) => {
49
- const { isLoading, isAuthenticated, login } = chunkCECTOY4A_cjs.useFFIDContext();
49
+ const { isLoading, isAuthenticated, login } = chunkR36QED6A_cjs.useFFIDContext();
50
50
  const hasRedirected = react.useRef(false);
51
51
  react.useEffect(() => {
52
52
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -71,83 +71,83 @@ function withFFIDAuth(Component, options = {}) {
71
71
 
72
72
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
73
73
  enumerable: true,
74
- get: function () { return chunkCECTOY4A_cjs.DEFAULT_API_BASE_URL; }
74
+ get: function () { return chunkR36QED6A_cjs.DEFAULT_API_BASE_URL; }
75
75
  });
76
76
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
77
77
  enumerable: true,
78
- get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementBadge; }
78
+ get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementBadge; }
79
79
  });
80
80
  Object.defineProperty(exports, "FFIDAnnouncementList", {
81
81
  enumerable: true,
82
- get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementList; }
82
+ get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementList; }
83
83
  });
84
84
  Object.defineProperty(exports, "FFIDLoginButton", {
85
85
  enumerable: true,
86
- get: function () { return chunkCECTOY4A_cjs.FFIDLoginButton; }
86
+ get: function () { return chunkR36QED6A_cjs.FFIDLoginButton; }
87
87
  });
88
88
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
89
89
  enumerable: true,
90
- get: function () { return chunkCECTOY4A_cjs.FFIDOrganizationSwitcher; }
90
+ get: function () { return chunkR36QED6A_cjs.FFIDOrganizationSwitcher; }
91
91
  });
92
92
  Object.defineProperty(exports, "FFIDProvider", {
93
93
  enumerable: true,
94
- get: function () { return chunkCECTOY4A_cjs.FFIDProvider; }
94
+ get: function () { return chunkR36QED6A_cjs.FFIDProvider; }
95
95
  });
96
96
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
97
97
  enumerable: true,
98
- get: function () { return chunkCECTOY4A_cjs.FFIDSubscriptionBadge; }
98
+ get: function () { return chunkR36QED6A_cjs.FFIDSubscriptionBadge; }
99
99
  });
100
100
  Object.defineProperty(exports, "FFIDUserMenu", {
101
101
  enumerable: true,
102
- get: function () { return chunkCECTOY4A_cjs.FFIDUserMenu; }
102
+ get: function () { return chunkR36QED6A_cjs.FFIDUserMenu; }
103
103
  });
104
104
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
105
105
  enumerable: true,
106
- get: function () { return chunkCECTOY4A_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
106
+ get: function () { return chunkR36QED6A_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
107
107
  });
108
108
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
109
109
  enumerable: true,
110
- get: function () { return chunkCECTOY4A_cjs.createFFIDAnnouncementsClient; }
110
+ get: function () { return chunkR36QED6A_cjs.createFFIDAnnouncementsClient; }
111
111
  });
112
112
  Object.defineProperty(exports, "createFFIDClient", {
113
113
  enumerable: true,
114
- get: function () { return chunkCECTOY4A_cjs.createFFIDClient; }
114
+ get: function () { return chunkR36QED6A_cjs.createFFIDClient; }
115
115
  });
116
116
  Object.defineProperty(exports, "createTokenStore", {
117
117
  enumerable: true,
118
- get: function () { return chunkCECTOY4A_cjs.createTokenStore; }
118
+ get: function () { return chunkR36QED6A_cjs.createTokenStore; }
119
119
  });
120
120
  Object.defineProperty(exports, "generateCodeChallenge", {
121
121
  enumerable: true,
122
- get: function () { return chunkCECTOY4A_cjs.generateCodeChallenge; }
122
+ get: function () { return chunkR36QED6A_cjs.generateCodeChallenge; }
123
123
  });
124
124
  Object.defineProperty(exports, "generateCodeVerifier", {
125
125
  enumerable: true,
126
- get: function () { return chunkCECTOY4A_cjs.generateCodeVerifier; }
126
+ get: function () { return chunkR36QED6A_cjs.generateCodeVerifier; }
127
127
  });
128
128
  Object.defineProperty(exports, "retrieveCodeVerifier", {
129
129
  enumerable: true,
130
- get: function () { return chunkCECTOY4A_cjs.retrieveCodeVerifier; }
130
+ get: function () { return chunkR36QED6A_cjs.retrieveCodeVerifier; }
131
131
  });
132
132
  Object.defineProperty(exports, "storeCodeVerifier", {
133
133
  enumerable: true,
134
- get: function () { return chunkCECTOY4A_cjs.storeCodeVerifier; }
134
+ get: function () { return chunkR36QED6A_cjs.storeCodeVerifier; }
135
135
  });
136
136
  Object.defineProperty(exports, "useFFID", {
137
137
  enumerable: true,
138
- get: function () { return chunkCECTOY4A_cjs.useFFID; }
138
+ get: function () { return chunkR36QED6A_cjs.useFFID; }
139
139
  });
140
140
  Object.defineProperty(exports, "useFFIDAnnouncements", {
141
141
  enumerable: true,
142
- get: function () { return chunkCECTOY4A_cjs.useFFIDAnnouncements; }
142
+ get: function () { return chunkR36QED6A_cjs.useFFIDAnnouncements; }
143
143
  });
144
144
  Object.defineProperty(exports, "useSubscription", {
145
145
  enumerable: true,
146
- get: function () { return chunkCECTOY4A_cjs.useSubscription; }
146
+ get: function () { return chunkR36QED6A_cjs.useSubscription; }
147
147
  });
148
148
  Object.defineProperty(exports, "withSubscription", {
149
149
  enumerable: true,
150
- get: function () { return chunkCECTOY4A_cjs.withSubscription; }
150
+ get: function () { return chunkR36QED6A_cjs.withSubscription; }
151
151
  });
152
152
  exports.createKVCacheAdapter = createKVCacheAdapter;
153
153
  exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
package/dist/index.d.cts CHANGED
@@ -257,6 +257,20 @@ interface FFIDCancelSubscriptionResponse {
257
257
  canceledAt: string | null;
258
258
  };
259
259
  }
260
+ /** Response from cancel pending downgrade endpoint */
261
+ interface FFIDCancelPendingDowngradeResponse {
262
+ message: string;
263
+ subscription: {
264
+ id: string;
265
+ organizationId: string;
266
+ serviceCode: string;
267
+ planCode: string;
268
+ billingInterval: FFIDBillingInterval;
269
+ status: FFIDSubscriptionStatus;
270
+ /** Always null after successful cancellation */
271
+ pendingDowngradePlanId: null;
272
+ };
273
+ }
260
274
  /** Parameters for previewing plan change */
261
275
  interface FFIDPreviewPlanChangeParams {
262
276
  /** Subscription ID (UUID) */
@@ -403,6 +417,7 @@ declare function createFFIDClient(config: FFIDConfig): {
403
417
  subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
404
418
  changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
405
419
  cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
420
+ cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
406
421
  previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
407
422
  verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
408
423
  getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
@@ -714,4 +729,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
714
729
  /** Type of the FFID Announcements client */
715
730
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
716
731
 
717
- export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
732
+ export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
package/dist/index.d.ts CHANGED
@@ -257,6 +257,20 @@ interface FFIDCancelSubscriptionResponse {
257
257
  canceledAt: string | null;
258
258
  };
259
259
  }
260
+ /** Response from cancel pending downgrade endpoint */
261
+ interface FFIDCancelPendingDowngradeResponse {
262
+ message: string;
263
+ subscription: {
264
+ id: string;
265
+ organizationId: string;
266
+ serviceCode: string;
267
+ planCode: string;
268
+ billingInterval: FFIDBillingInterval;
269
+ status: FFIDSubscriptionStatus;
270
+ /** Always null after successful cancellation */
271
+ pendingDowngradePlanId: null;
272
+ };
273
+ }
260
274
  /** Parameters for previewing plan change */
261
275
  interface FFIDPreviewPlanChangeParams {
262
276
  /** Subscription ID (UUID) */
@@ -403,6 +417,7 @@ declare function createFFIDClient(config: FFIDConfig): {
403
417
  subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
404
418
  changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
405
419
  cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
420
+ cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
406
421
  previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
407
422
  verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
408
423
  getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
@@ -714,4 +729,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
714
729
  /** Type of the FFID Announcements client */
715
730
  type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
716
731
 
717
- export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
732
+ export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext } from './chunk-VJHI6RQQ.js';
2
- export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-VJHI6RQQ.js';
1
+ import { useFFIDContext } from './chunk-SNJS23L7.js';
2
+ export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-SNJS23L7.js';
3
3
  import { useRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -516,6 +516,17 @@ function createSubscriptionMethods(deps) {
516
516
  }
517
517
  );
518
518
  }
519
+ async function cancelPendingDowngrade(subscriptionId) {
520
+ if (!subscriptionId) {
521
+ return {
522
+ error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
523
+ };
524
+ }
525
+ return fetchWithAuth(
526
+ `${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(subscriptionId)}/pending-downgrade`,
527
+ { method: "DELETE" }
528
+ );
529
+ }
519
530
  async function previewPlanChange(params) {
520
531
  if (!params.subscriptionId || !params.planCode) {
521
532
  return {
@@ -539,6 +550,7 @@ function createSubscriptionMethods(deps) {
539
550
  subscribe,
540
551
  changePlan,
541
552
  cancelSubscription,
553
+ cancelPendingDowngrade,
542
554
  previewPlanChange
543
555
  };
544
556
  }
@@ -596,7 +608,7 @@ function createMembersMethods(deps) {
596
608
  }
597
609
 
598
610
  // src/client/version-check.ts
599
- var SDK_VERSION = "2.4.0";
611
+ var SDK_VERSION = "2.5.0";
600
612
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
601
613
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
602
614
  function sdkHeaders() {
@@ -1757,6 +1769,7 @@ function createFFIDClient(config) {
1757
1769
  subscribe,
1758
1770
  changePlan,
1759
1771
  cancelSubscription,
1772
+ cancelPendingDowngrade,
1760
1773
  previewPlanChange
1761
1774
  } = createSubscriptionMethods({
1762
1775
  fetchWithAuth,
@@ -1836,6 +1849,7 @@ function createFFIDClient(config) {
1836
1849
  subscribe,
1837
1850
  changePlan,
1838
1851
  cancelSubscription,
1852
+ cancelPendingDowngrade,
1839
1853
  previewPlanChange,
1840
1854
  verifyAccessToken,
1841
1855
  getSubscribeUrl,
@@ -186,6 +186,20 @@ interface FFIDCancelSubscriptionResponse {
186
186
  canceledAt: string | null;
187
187
  };
188
188
  }
189
+ /** Response from cancel pending downgrade endpoint */
190
+ interface FFIDCancelPendingDowngradeResponse {
191
+ message: string;
192
+ subscription: {
193
+ id: string;
194
+ organizationId: string;
195
+ serviceCode: string;
196
+ planCode: string;
197
+ billingInterval: FFIDBillingInterval;
198
+ status: FFIDSubscriptionStatus;
199
+ /** Always null after successful cancellation */
200
+ pendingDowngradePlanId: null;
201
+ };
202
+ }
189
203
  /** Parameters for previewing plan change */
190
204
  interface FFIDPreviewPlanChangeParams {
191
205
  /** Subscription ID (UUID) */
@@ -707,6 +721,7 @@ declare function createFFIDClient(config: FFIDConfig): {
707
721
  subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
708
722
  changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
709
723
  cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
724
+ cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
710
725
  previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
711
726
  verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
712
727
  getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
@@ -186,6 +186,20 @@ interface FFIDCancelSubscriptionResponse {
186
186
  canceledAt: string | null;
187
187
  };
188
188
  }
189
+ /** Response from cancel pending downgrade endpoint */
190
+ interface FFIDCancelPendingDowngradeResponse {
191
+ message: string;
192
+ subscription: {
193
+ id: string;
194
+ organizationId: string;
195
+ serviceCode: string;
196
+ planCode: string;
197
+ billingInterval: FFIDBillingInterval;
198
+ status: FFIDSubscriptionStatus;
199
+ /** Always null after successful cancellation */
200
+ pendingDowngradePlanId: null;
201
+ };
202
+ }
189
203
  /** Parameters for previewing plan change */
190
204
  interface FFIDPreviewPlanChangeParams {
191
205
  /** Subscription ID (UUID) */
@@ -707,6 +721,7 @@ declare function createFFIDClient(config: FFIDConfig): {
707
721
  subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
708
722
  changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
709
723
  cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
724
+ cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
710
725
  previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
711
726
  verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
712
727
  getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
@@ -515,6 +515,17 @@ function createSubscriptionMethods(deps) {
515
515
  }
516
516
  );
517
517
  }
518
+ async function cancelPendingDowngrade(subscriptionId) {
519
+ if (!subscriptionId) {
520
+ return {
521
+ error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
522
+ };
523
+ }
524
+ return fetchWithAuth(
525
+ `${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(subscriptionId)}/pending-downgrade`,
526
+ { method: "DELETE" }
527
+ );
528
+ }
518
529
  async function previewPlanChange(params) {
519
530
  if (!params.subscriptionId || !params.planCode) {
520
531
  return {
@@ -538,6 +549,7 @@ function createSubscriptionMethods(deps) {
538
549
  subscribe,
539
550
  changePlan,
540
551
  cancelSubscription,
552
+ cancelPendingDowngrade,
541
553
  previewPlanChange
542
554
  };
543
555
  }
@@ -595,7 +607,7 @@ function createMembersMethods(deps) {
595
607
  }
596
608
 
597
609
  // src/client/version-check.ts
598
- var SDK_VERSION = "2.4.0";
610
+ var SDK_VERSION = "2.5.0";
599
611
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
600
612
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
601
613
  function sdkHeaders() {
@@ -1756,6 +1768,7 @@ function createFFIDClient(config) {
1756
1768
  subscribe,
1757
1769
  changePlan,
1758
1770
  cancelSubscription,
1771
+ cancelPendingDowngrade,
1759
1772
  previewPlanChange
1760
1773
  } = createSubscriptionMethods({
1761
1774
  fetchWithAuth,
@@ -1835,6 +1848,7 @@ function createFFIDClient(config) {
1835
1848
  subscribe,
1836
1849
  changePlan,
1837
1850
  cancelSubscription,
1851
+ cancelPendingDowngrade,
1838
1852
  previewPlanChange,
1839
1853
  verifyAccessToken,
1840
1854
  getSubscribeUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",