@feelflow/ffid-sdk 2.3.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.
- package/dist/{chunk-KXX5RZKI.cjs → chunk-R36QED6A.cjs} +21 -4
- package/dist/{chunk-W4FW7Z3F.js → chunk-SNJS23L7.js} +21 -4
- package/dist/components/index.cjs +7 -7
- package/dist/components/index.js +1 -1
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +21 -4
- package/dist/server/index.d.cts +21 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.js +21 -4
- package/package.json +1 -1
|
@@ -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.
|
|
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() {
|
|
@@ -1488,13 +1500,15 @@ function createContractWizardMethods(deps) {
|
|
|
1488
1500
|
return buildWizardUrl(baseUrl, flow, {
|
|
1489
1501
|
service: serviceCode,
|
|
1490
1502
|
subscription: subscriptionId,
|
|
1491
|
-
redirect: options?.redirect
|
|
1503
|
+
redirect: options?.redirect,
|
|
1504
|
+
org: options?.organizationId
|
|
1492
1505
|
});
|
|
1493
1506
|
}
|
|
1494
1507
|
function getSubscribeUrl(options) {
|
|
1495
1508
|
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1496
1509
|
service: serviceCode,
|
|
1497
|
-
redirect: options?.redirect
|
|
1510
|
+
redirect: options?.redirect,
|
|
1511
|
+
org: options?.organizationId
|
|
1498
1512
|
});
|
|
1499
1513
|
}
|
|
1500
1514
|
function redirectToSubscribe(options) {
|
|
@@ -1521,7 +1535,8 @@ function createContractWizardMethods(deps) {
|
|
|
1521
1535
|
function getResubscribeUrl(options) {
|
|
1522
1536
|
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1523
1537
|
service: options?.serviceCode ?? serviceCode,
|
|
1524
|
-
redirect: options?.redirect
|
|
1538
|
+
redirect: options?.redirect,
|
|
1539
|
+
org: options?.organizationId
|
|
1525
1540
|
});
|
|
1526
1541
|
}
|
|
1527
1542
|
function redirectToResubscribe(options) {
|
|
@@ -1771,6 +1786,7 @@ function createFFIDClient(config) {
|
|
|
1771
1786
|
subscribe,
|
|
1772
1787
|
changePlan,
|
|
1773
1788
|
cancelSubscription,
|
|
1789
|
+
cancelPendingDowngrade,
|
|
1774
1790
|
previewPlanChange
|
|
1775
1791
|
} = createSubscriptionMethods({
|
|
1776
1792
|
fetchWithAuth,
|
|
@@ -1850,6 +1866,7 @@ function createFFIDClient(config) {
|
|
|
1850
1866
|
subscribe,
|
|
1851
1867
|
changePlan,
|
|
1852
1868
|
cancelSubscription,
|
|
1869
|
+
cancelPendingDowngrade,
|
|
1853
1870
|
previewPlanChange,
|
|
1854
1871
|
verifyAccessToken,
|
|
1855
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.
|
|
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() {
|
|
@@ -1486,13 +1498,15 @@ function createContractWizardMethods(deps) {
|
|
|
1486
1498
|
return buildWizardUrl(baseUrl, flow, {
|
|
1487
1499
|
service: serviceCode,
|
|
1488
1500
|
subscription: subscriptionId,
|
|
1489
|
-
redirect: options?.redirect
|
|
1501
|
+
redirect: options?.redirect,
|
|
1502
|
+
org: options?.organizationId
|
|
1490
1503
|
});
|
|
1491
1504
|
}
|
|
1492
1505
|
function getSubscribeUrl(options) {
|
|
1493
1506
|
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1494
1507
|
service: serviceCode,
|
|
1495
|
-
redirect: options?.redirect
|
|
1508
|
+
redirect: options?.redirect,
|
|
1509
|
+
org: options?.organizationId
|
|
1496
1510
|
});
|
|
1497
1511
|
}
|
|
1498
1512
|
function redirectToSubscribe(options) {
|
|
@@ -1519,7 +1533,8 @@ function createContractWizardMethods(deps) {
|
|
|
1519
1533
|
function getResubscribeUrl(options) {
|
|
1520
1534
|
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1521
1535
|
service: options?.serviceCode ?? serviceCode,
|
|
1522
|
-
redirect: options?.redirect
|
|
1536
|
+
redirect: options?.redirect,
|
|
1537
|
+
org: options?.organizationId
|
|
1523
1538
|
});
|
|
1524
1539
|
}
|
|
1525
1540
|
function redirectToResubscribe(options) {
|
|
@@ -1769,6 +1784,7 @@ function createFFIDClient(config) {
|
|
|
1769
1784
|
subscribe,
|
|
1770
1785
|
changePlan,
|
|
1771
1786
|
cancelSubscription,
|
|
1787
|
+
cancelPendingDowngrade,
|
|
1772
1788
|
previewPlanChange
|
|
1773
1789
|
} = createSubscriptionMethods({
|
|
1774
1790
|
fetchWithAuth,
|
|
@@ -1848,6 +1864,7 @@ function createFFIDClient(config) {
|
|
|
1848
1864
|
subscribe,
|
|
1849
1865
|
changePlan,
|
|
1850
1866
|
cancelSubscription,
|
|
1867
|
+
cancelPendingDowngrade,
|
|
1851
1868
|
previewPlanChange,
|
|
1852
1869
|
verifyAccessToken,
|
|
1853
1870
|
getSubscribeUrl,
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
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
|
|
9
|
+
get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkR36QED6A_cjs.FFIDLoginButton; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkR36QED6A_cjs.FFIDOrganizationSwitcher; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkR36QED6A_cjs.FFIDSubscriptionBadge; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkR36QED6A_cjs.FFIDUserMenu; }
|
|
30
30
|
});
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-
|
|
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
|
|
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 } =
|
|
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
|
|
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
|
|
78
|
+
get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementBadge; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkR36QED6A_cjs.FFIDAnnouncementList; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkR36QED6A_cjs.FFIDLoginButton; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkR36QED6A_cjs.FFIDOrganizationSwitcher; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkR36QED6A_cjs.FFIDProvider; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkR36QED6A_cjs.FFIDSubscriptionBadge; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
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
|
|
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
|
|
110
|
+
get: function () { return chunkR36QED6A_cjs.createFFIDAnnouncementsClient; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkR36QED6A_cjs.createFFIDClient; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "createTokenStore", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkR36QED6A_cjs.createTokenStore; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkR36QED6A_cjs.generateCodeChallenge; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkR36QED6A_cjs.generateCodeVerifier; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkR36QED6A_cjs.retrieveCodeVerifier; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkR36QED6A_cjs.storeCodeVerifier; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "useFFID", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkR36QED6A_cjs.useFFID; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunkR36QED6A_cjs.useFFIDAnnouncements; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "useSubscription", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunkR36QED6A_cjs.useSubscription; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "withSubscription", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
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) */
|
|
@@ -339,6 +353,8 @@ type ContractWizardFlowType = 'new-subscription' | 'resubscribe' | 'change-plan'
|
|
|
339
353
|
interface ContractWizardSubscribeOptions {
|
|
340
354
|
/** URL to redirect back to after completion */
|
|
341
355
|
redirect?: string;
|
|
356
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
357
|
+
organizationId?: string;
|
|
342
358
|
}
|
|
343
359
|
/** Options for the resubscribe wizard flow */
|
|
344
360
|
interface ContractWizardResubscribeOptions {
|
|
@@ -346,11 +362,15 @@ interface ContractWizardResubscribeOptions {
|
|
|
346
362
|
serviceCode?: string;
|
|
347
363
|
/** URL to redirect back to after completion */
|
|
348
364
|
redirect?: string;
|
|
365
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
366
|
+
organizationId?: string;
|
|
349
367
|
}
|
|
350
368
|
/** Options for wizard flows that operate on an existing subscription */
|
|
351
369
|
interface ContractWizardSubscriptionOptions {
|
|
352
370
|
/** URL to redirect back to after completion */
|
|
353
371
|
redirect?: string;
|
|
372
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
373
|
+
organizationId?: string;
|
|
354
374
|
}
|
|
355
375
|
|
|
356
376
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
@@ -397,6 +417,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
397
417
|
subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
|
|
398
418
|
changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
|
|
399
419
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
420
|
+
cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
|
|
400
421
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
401
422
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
402
423
|
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
@@ -708,4 +729,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
|
|
|
708
729
|
/** Type of the FFID Announcements client */
|
|
709
730
|
type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
|
|
710
731
|
|
|
711
|
-
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) */
|
|
@@ -339,6 +353,8 @@ type ContractWizardFlowType = 'new-subscription' | 'resubscribe' | 'change-plan'
|
|
|
339
353
|
interface ContractWizardSubscribeOptions {
|
|
340
354
|
/** URL to redirect back to after completion */
|
|
341
355
|
redirect?: string;
|
|
356
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
357
|
+
organizationId?: string;
|
|
342
358
|
}
|
|
343
359
|
/** Options for the resubscribe wizard flow */
|
|
344
360
|
interface ContractWizardResubscribeOptions {
|
|
@@ -346,11 +362,15 @@ interface ContractWizardResubscribeOptions {
|
|
|
346
362
|
serviceCode?: string;
|
|
347
363
|
/** URL to redirect back to after completion */
|
|
348
364
|
redirect?: string;
|
|
365
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
366
|
+
organizationId?: string;
|
|
349
367
|
}
|
|
350
368
|
/** Options for wizard flows that operate on an existing subscription */
|
|
351
369
|
interface ContractWizardSubscriptionOptions {
|
|
352
370
|
/** URL to redirect back to after completion */
|
|
353
371
|
redirect?: string;
|
|
372
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
373
|
+
organizationId?: string;
|
|
354
374
|
}
|
|
355
375
|
|
|
356
376
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
@@ -397,6 +417,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
397
417
|
subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
|
|
398
418
|
changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
|
|
399
419
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
420
|
+
cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
|
|
400
421
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
401
422
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
402
423
|
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
@@ -708,4 +729,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
|
|
|
708
729
|
/** Type of the FFID Announcements client */
|
|
709
730
|
type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
|
|
710
731
|
|
|
711
|
-
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-
|
|
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-
|
|
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
|
|
package/dist/server/index.cjs
CHANGED
|
@@ -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.
|
|
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() {
|
|
@@ -1471,13 +1483,15 @@ function createContractWizardMethods(deps) {
|
|
|
1471
1483
|
return buildWizardUrl(baseUrl, flow, {
|
|
1472
1484
|
service: serviceCode,
|
|
1473
1485
|
subscription: subscriptionId,
|
|
1474
|
-
redirect: options?.redirect
|
|
1486
|
+
redirect: options?.redirect,
|
|
1487
|
+
org: options?.organizationId
|
|
1475
1488
|
});
|
|
1476
1489
|
}
|
|
1477
1490
|
function getSubscribeUrl(options) {
|
|
1478
1491
|
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1479
1492
|
service: serviceCode,
|
|
1480
|
-
redirect: options?.redirect
|
|
1493
|
+
redirect: options?.redirect,
|
|
1494
|
+
org: options?.organizationId
|
|
1481
1495
|
});
|
|
1482
1496
|
}
|
|
1483
1497
|
function redirectToSubscribe(options) {
|
|
@@ -1504,7 +1518,8 @@ function createContractWizardMethods(deps) {
|
|
|
1504
1518
|
function getResubscribeUrl(options) {
|
|
1505
1519
|
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1506
1520
|
service: options?.serviceCode ?? serviceCode,
|
|
1507
|
-
redirect: options?.redirect
|
|
1521
|
+
redirect: options?.redirect,
|
|
1522
|
+
org: options?.organizationId
|
|
1508
1523
|
});
|
|
1509
1524
|
}
|
|
1510
1525
|
function redirectToResubscribe(options) {
|
|
@@ -1754,6 +1769,7 @@ function createFFIDClient(config) {
|
|
|
1754
1769
|
subscribe,
|
|
1755
1770
|
changePlan,
|
|
1756
1771
|
cancelSubscription,
|
|
1772
|
+
cancelPendingDowngrade,
|
|
1757
1773
|
previewPlanChange
|
|
1758
1774
|
} = createSubscriptionMethods({
|
|
1759
1775
|
fetchWithAuth,
|
|
@@ -1833,6 +1849,7 @@ function createFFIDClient(config) {
|
|
|
1833
1849
|
subscribe,
|
|
1834
1850
|
changePlan,
|
|
1835
1851
|
cancelSubscription,
|
|
1852
|
+
cancelPendingDowngrade,
|
|
1836
1853
|
previewPlanChange,
|
|
1837
1854
|
verifyAccessToken,
|
|
1838
1855
|
getSubscribeUrl,
|
package/dist/server/index.d.cts
CHANGED
|
@@ -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) */
|
|
@@ -602,6 +616,8 @@ type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
|
|
|
602
616
|
interface ContractWizardSubscribeOptions {
|
|
603
617
|
/** URL to redirect back to after completion */
|
|
604
618
|
redirect?: string;
|
|
619
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
620
|
+
organizationId?: string;
|
|
605
621
|
}
|
|
606
622
|
/** Options for the resubscribe wizard flow */
|
|
607
623
|
interface ContractWizardResubscribeOptions {
|
|
@@ -609,11 +625,15 @@ interface ContractWizardResubscribeOptions {
|
|
|
609
625
|
serviceCode?: string;
|
|
610
626
|
/** URL to redirect back to after completion */
|
|
611
627
|
redirect?: string;
|
|
628
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
629
|
+
organizationId?: string;
|
|
612
630
|
}
|
|
613
631
|
/** Options for wizard flows that operate on an existing subscription */
|
|
614
632
|
interface ContractWizardSubscriptionOptions {
|
|
615
633
|
/** URL to redirect back to after completion */
|
|
616
634
|
redirect?: string;
|
|
635
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
636
|
+
organizationId?: string;
|
|
617
637
|
}
|
|
618
638
|
|
|
619
639
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
@@ -701,6 +721,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
701
721
|
subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
|
|
702
722
|
changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
|
|
703
723
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
724
|
+
cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
|
|
704
725
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
705
726
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
706
727
|
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -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) */
|
|
@@ -602,6 +616,8 @@ type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
|
|
|
602
616
|
interface ContractWizardSubscribeOptions {
|
|
603
617
|
/** URL to redirect back to after completion */
|
|
604
618
|
redirect?: string;
|
|
619
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
620
|
+
organizationId?: string;
|
|
605
621
|
}
|
|
606
622
|
/** Options for the resubscribe wizard flow */
|
|
607
623
|
interface ContractWizardResubscribeOptions {
|
|
@@ -609,11 +625,15 @@ interface ContractWizardResubscribeOptions {
|
|
|
609
625
|
serviceCode?: string;
|
|
610
626
|
/** URL to redirect back to after completion */
|
|
611
627
|
redirect?: string;
|
|
628
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
629
|
+
organizationId?: string;
|
|
612
630
|
}
|
|
613
631
|
/** Options for wizard flows that operate on an existing subscription */
|
|
614
632
|
interface ContractWizardSubscriptionOptions {
|
|
615
633
|
/** URL to redirect back to after completion */
|
|
616
634
|
redirect?: string;
|
|
635
|
+
/** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
|
|
636
|
+
organizationId?: string;
|
|
617
637
|
}
|
|
618
638
|
|
|
619
639
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
@@ -701,6 +721,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
701
721
|
subscribe: (params: FFIDSubscribeParams) => Promise<FFIDApiResponse<FFIDSubscribeResponse>>;
|
|
702
722
|
changePlan: (params: FFIDChangePlanParams) => Promise<FFIDApiResponse<FFIDChangePlanResponse>>;
|
|
703
723
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
724
|
+
cancelPendingDowngrade: (subscriptionId: string) => Promise<FFIDApiResponse<FFIDCancelPendingDowngradeResponse>>;
|
|
704
725
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
705
726
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
706
727
|
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
package/dist/server/index.js
CHANGED
|
@@ -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.
|
|
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() {
|
|
@@ -1470,13 +1482,15 @@ function createContractWizardMethods(deps) {
|
|
|
1470
1482
|
return buildWizardUrl(baseUrl, flow, {
|
|
1471
1483
|
service: serviceCode,
|
|
1472
1484
|
subscription: subscriptionId,
|
|
1473
|
-
redirect: options?.redirect
|
|
1485
|
+
redirect: options?.redirect,
|
|
1486
|
+
org: options?.organizationId
|
|
1474
1487
|
});
|
|
1475
1488
|
}
|
|
1476
1489
|
function getSubscribeUrl(options) {
|
|
1477
1490
|
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1478
1491
|
service: serviceCode,
|
|
1479
|
-
redirect: options?.redirect
|
|
1492
|
+
redirect: options?.redirect,
|
|
1493
|
+
org: options?.organizationId
|
|
1480
1494
|
});
|
|
1481
1495
|
}
|
|
1482
1496
|
function redirectToSubscribe(options) {
|
|
@@ -1503,7 +1517,8 @@ function createContractWizardMethods(deps) {
|
|
|
1503
1517
|
function getResubscribeUrl(options) {
|
|
1504
1518
|
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1505
1519
|
service: options?.serviceCode ?? serviceCode,
|
|
1506
|
-
redirect: options?.redirect
|
|
1520
|
+
redirect: options?.redirect,
|
|
1521
|
+
org: options?.organizationId
|
|
1507
1522
|
});
|
|
1508
1523
|
}
|
|
1509
1524
|
function redirectToResubscribe(options) {
|
|
@@ -1753,6 +1768,7 @@ function createFFIDClient(config) {
|
|
|
1753
1768
|
subscribe,
|
|
1754
1769
|
changePlan,
|
|
1755
1770
|
cancelSubscription,
|
|
1771
|
+
cancelPendingDowngrade,
|
|
1756
1772
|
previewPlanChange
|
|
1757
1773
|
} = createSubscriptionMethods({
|
|
1758
1774
|
fetchWithAuth,
|
|
@@ -1832,6 +1848,7 @@ function createFFIDClient(config) {
|
|
|
1832
1848
|
subscribe,
|
|
1833
1849
|
changePlan,
|
|
1834
1850
|
cancelSubscription,
|
|
1851
|
+
cancelPendingDowngrade,
|
|
1835
1852
|
previewPlanChange,
|
|
1836
1853
|
verifyAccessToken,
|
|
1837
1854
|
getSubscribeUrl,
|