@feelflow/ffid-sdk 2.5.0 → 2.5.1
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-SNJS23L7.js → chunk-GGPL4Z2O.js} +9 -6
- package/dist/{chunk-R36QED6A.cjs → chunk-PFPIILLQ.cjs} +9 -6
- package/dist/components/index.cjs +7 -7
- package/dist/components/index.js +1 -1
- package/dist/index.cjs +22 -22
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +9 -6
- package/dist/server/index.js +9 -6
- package/package.json +1 -1
|
@@ -449,13 +449,16 @@ function createBillingMethods(deps) {
|
|
|
449
449
|
var EXT_PLANS_ENDPOINT = "/api/v1/subscriptions/ext/plans";
|
|
450
450
|
var EXT_SUBSCRIPTION_ENDPOINT = "/api/v1/subscriptions/ext";
|
|
451
451
|
var EXT_SUBSCRIBE_ENDPOINT = "/api/v1/subscriptions/ext/subscribe";
|
|
452
|
+
function isBlankString(value) {
|
|
453
|
+
return typeof value !== "string" || value.trim() === "";
|
|
454
|
+
}
|
|
452
455
|
function createSubscriptionMethods(deps) {
|
|
453
456
|
const { fetchWithAuth, createError } = deps;
|
|
454
457
|
async function listPlans() {
|
|
455
458
|
return fetchWithAuth(EXT_PLANS_ENDPOINT);
|
|
456
459
|
}
|
|
457
460
|
async function getSubscription(subscriptionId) {
|
|
458
|
-
if (
|
|
461
|
+
if (isBlankString(subscriptionId)) {
|
|
459
462
|
return {
|
|
460
463
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
461
464
|
};
|
|
@@ -485,7 +488,7 @@ function createSubscriptionMethods(deps) {
|
|
|
485
488
|
);
|
|
486
489
|
}
|
|
487
490
|
async function changePlan(params) {
|
|
488
|
-
if (
|
|
491
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
489
492
|
return {
|
|
490
493
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
491
494
|
};
|
|
@@ -502,7 +505,7 @@ function createSubscriptionMethods(deps) {
|
|
|
502
505
|
);
|
|
503
506
|
}
|
|
504
507
|
async function cancelSubscription(params) {
|
|
505
|
-
if (
|
|
508
|
+
if (isBlankString(params.subscriptionId)) {
|
|
506
509
|
return {
|
|
507
510
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
508
511
|
};
|
|
@@ -519,7 +522,7 @@ function createSubscriptionMethods(deps) {
|
|
|
519
522
|
);
|
|
520
523
|
}
|
|
521
524
|
async function cancelPendingDowngrade(subscriptionId) {
|
|
522
|
-
if (
|
|
525
|
+
if (isBlankString(subscriptionId)) {
|
|
523
526
|
return {
|
|
524
527
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
525
528
|
};
|
|
@@ -530,7 +533,7 @@ function createSubscriptionMethods(deps) {
|
|
|
530
533
|
);
|
|
531
534
|
}
|
|
532
535
|
async function previewPlanChange(params) {
|
|
533
|
-
if (
|
|
536
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
534
537
|
return {
|
|
535
538
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
536
539
|
};
|
|
@@ -610,7 +613,7 @@ function createMembersMethods(deps) {
|
|
|
610
613
|
}
|
|
611
614
|
|
|
612
615
|
// src/client/version-check.ts
|
|
613
|
-
var SDK_VERSION = "2.5.
|
|
616
|
+
var SDK_VERSION = "2.5.1";
|
|
614
617
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
615
618
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
616
619
|
function sdkHeaders() {
|
|
@@ -451,13 +451,16 @@ function createBillingMethods(deps) {
|
|
|
451
451
|
var EXT_PLANS_ENDPOINT = "/api/v1/subscriptions/ext/plans";
|
|
452
452
|
var EXT_SUBSCRIPTION_ENDPOINT = "/api/v1/subscriptions/ext";
|
|
453
453
|
var EXT_SUBSCRIBE_ENDPOINT = "/api/v1/subscriptions/ext/subscribe";
|
|
454
|
+
function isBlankString(value) {
|
|
455
|
+
return typeof value !== "string" || value.trim() === "";
|
|
456
|
+
}
|
|
454
457
|
function createSubscriptionMethods(deps) {
|
|
455
458
|
const { fetchWithAuth, createError } = deps;
|
|
456
459
|
async function listPlans() {
|
|
457
460
|
return fetchWithAuth(EXT_PLANS_ENDPOINT);
|
|
458
461
|
}
|
|
459
462
|
async function getSubscription(subscriptionId) {
|
|
460
|
-
if (
|
|
463
|
+
if (isBlankString(subscriptionId)) {
|
|
461
464
|
return {
|
|
462
465
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
463
466
|
};
|
|
@@ -487,7 +490,7 @@ function createSubscriptionMethods(deps) {
|
|
|
487
490
|
);
|
|
488
491
|
}
|
|
489
492
|
async function changePlan(params) {
|
|
490
|
-
if (
|
|
493
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
491
494
|
return {
|
|
492
495
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
493
496
|
};
|
|
@@ -504,7 +507,7 @@ function createSubscriptionMethods(deps) {
|
|
|
504
507
|
);
|
|
505
508
|
}
|
|
506
509
|
async function cancelSubscription(params) {
|
|
507
|
-
if (
|
|
510
|
+
if (isBlankString(params.subscriptionId)) {
|
|
508
511
|
return {
|
|
509
512
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
510
513
|
};
|
|
@@ -521,7 +524,7 @@ function createSubscriptionMethods(deps) {
|
|
|
521
524
|
);
|
|
522
525
|
}
|
|
523
526
|
async function cancelPendingDowngrade(subscriptionId) {
|
|
524
|
-
if (
|
|
527
|
+
if (isBlankString(subscriptionId)) {
|
|
525
528
|
return {
|
|
526
529
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
527
530
|
};
|
|
@@ -532,7 +535,7 @@ function createSubscriptionMethods(deps) {
|
|
|
532
535
|
);
|
|
533
536
|
}
|
|
534
537
|
async function previewPlanChange(params) {
|
|
535
|
-
if (
|
|
538
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
536
539
|
return {
|
|
537
540
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
538
541
|
};
|
|
@@ -612,7 +615,7 @@ function createMembersMethods(deps) {
|
|
|
612
615
|
}
|
|
613
616
|
|
|
614
617
|
// src/client/version-check.ts
|
|
615
|
-
var SDK_VERSION = "2.5.
|
|
618
|
+
var SDK_VERSION = "2.5.1";
|
|
616
619
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
617
620
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
618
621
|
function sdkHeaders() {
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPFPIILLQ_cjs = require('../chunk-PFPIILLQ.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 chunkPFPIILLQ_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDLoginButton; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDOrganizationSwitcher; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDSubscriptionBadge; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkPFPIILLQ_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-GGPL4Z2O.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPFPIILLQ_cjs = require('./chunk-PFPIILLQ.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 } = chunkPFPIILLQ_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 chunkPFPIILLQ_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 chunkPFPIILLQ_cjs.FFIDAnnouncementBadge; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDAnnouncementList; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDLoginButton; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDOrganizationSwitcher; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDProvider; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkPFPIILLQ_cjs.FFIDSubscriptionBadge; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkPFPIILLQ_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 chunkPFPIILLQ_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 chunkPFPIILLQ_cjs.createFFIDAnnouncementsClient; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkPFPIILLQ_cjs.createFFIDClient; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "createTokenStore", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkPFPIILLQ_cjs.createTokenStore; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkPFPIILLQ_cjs.generateCodeChallenge; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkPFPIILLQ_cjs.generateCodeVerifier; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkPFPIILLQ_cjs.retrieveCodeVerifier; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkPFPIILLQ_cjs.storeCodeVerifier; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "useFFID", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkPFPIILLQ_cjs.useFFID; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunkPFPIILLQ_cjs.useFFIDAnnouncements; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "useSubscription", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunkPFPIILLQ_cjs.useSubscription; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "withSubscription", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunkPFPIILLQ_cjs.withSubscription; }
|
|
151
151
|
});
|
|
152
152
|
exports.createKVCacheAdapter = createKVCacheAdapter;
|
|
153
153
|
exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
|
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-GGPL4Z2O.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-GGPL4Z2O.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
|
@@ -447,13 +447,16 @@ function createBillingMethods(deps) {
|
|
|
447
447
|
var EXT_PLANS_ENDPOINT = "/api/v1/subscriptions/ext/plans";
|
|
448
448
|
var EXT_SUBSCRIPTION_ENDPOINT = "/api/v1/subscriptions/ext";
|
|
449
449
|
var EXT_SUBSCRIBE_ENDPOINT = "/api/v1/subscriptions/ext/subscribe";
|
|
450
|
+
function isBlankString(value) {
|
|
451
|
+
return typeof value !== "string" || value.trim() === "";
|
|
452
|
+
}
|
|
450
453
|
function createSubscriptionMethods(deps) {
|
|
451
454
|
const { fetchWithAuth, createError } = deps;
|
|
452
455
|
async function listPlans() {
|
|
453
456
|
return fetchWithAuth(EXT_PLANS_ENDPOINT);
|
|
454
457
|
}
|
|
455
458
|
async function getSubscription(subscriptionId) {
|
|
456
|
-
if (
|
|
459
|
+
if (isBlankString(subscriptionId)) {
|
|
457
460
|
return {
|
|
458
461
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
459
462
|
};
|
|
@@ -483,7 +486,7 @@ function createSubscriptionMethods(deps) {
|
|
|
483
486
|
);
|
|
484
487
|
}
|
|
485
488
|
async function changePlan(params) {
|
|
486
|
-
if (
|
|
489
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
487
490
|
return {
|
|
488
491
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
489
492
|
};
|
|
@@ -500,7 +503,7 @@ function createSubscriptionMethods(deps) {
|
|
|
500
503
|
);
|
|
501
504
|
}
|
|
502
505
|
async function cancelSubscription(params) {
|
|
503
|
-
if (
|
|
506
|
+
if (isBlankString(params.subscriptionId)) {
|
|
504
507
|
return {
|
|
505
508
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
506
509
|
};
|
|
@@ -517,7 +520,7 @@ function createSubscriptionMethods(deps) {
|
|
|
517
520
|
);
|
|
518
521
|
}
|
|
519
522
|
async function cancelPendingDowngrade(subscriptionId) {
|
|
520
|
-
if (
|
|
523
|
+
if (isBlankString(subscriptionId)) {
|
|
521
524
|
return {
|
|
522
525
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
523
526
|
};
|
|
@@ -528,7 +531,7 @@ function createSubscriptionMethods(deps) {
|
|
|
528
531
|
);
|
|
529
532
|
}
|
|
530
533
|
async function previewPlanChange(params) {
|
|
531
|
-
if (
|
|
534
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
532
535
|
return {
|
|
533
536
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
534
537
|
};
|
|
@@ -608,7 +611,7 @@ function createMembersMethods(deps) {
|
|
|
608
611
|
}
|
|
609
612
|
|
|
610
613
|
// src/client/version-check.ts
|
|
611
|
-
var SDK_VERSION = "2.5.
|
|
614
|
+
var SDK_VERSION = "2.5.1";
|
|
612
615
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
613
616
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
614
617
|
function sdkHeaders() {
|
package/dist/server/index.js
CHANGED
|
@@ -446,13 +446,16 @@ function createBillingMethods(deps) {
|
|
|
446
446
|
var EXT_PLANS_ENDPOINT = "/api/v1/subscriptions/ext/plans";
|
|
447
447
|
var EXT_SUBSCRIPTION_ENDPOINT = "/api/v1/subscriptions/ext";
|
|
448
448
|
var EXT_SUBSCRIBE_ENDPOINT = "/api/v1/subscriptions/ext/subscribe";
|
|
449
|
+
function isBlankString(value) {
|
|
450
|
+
return typeof value !== "string" || value.trim() === "";
|
|
451
|
+
}
|
|
449
452
|
function createSubscriptionMethods(deps) {
|
|
450
453
|
const { fetchWithAuth, createError } = deps;
|
|
451
454
|
async function listPlans() {
|
|
452
455
|
return fetchWithAuth(EXT_PLANS_ENDPOINT);
|
|
453
456
|
}
|
|
454
457
|
async function getSubscription(subscriptionId) {
|
|
455
|
-
if (
|
|
458
|
+
if (isBlankString(subscriptionId)) {
|
|
456
459
|
return {
|
|
457
460
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
458
461
|
};
|
|
@@ -482,7 +485,7 @@ function createSubscriptionMethods(deps) {
|
|
|
482
485
|
);
|
|
483
486
|
}
|
|
484
487
|
async function changePlan(params) {
|
|
485
|
-
if (
|
|
488
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
486
489
|
return {
|
|
487
490
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
488
491
|
};
|
|
@@ -499,7 +502,7 @@ function createSubscriptionMethods(deps) {
|
|
|
499
502
|
);
|
|
500
503
|
}
|
|
501
504
|
async function cancelSubscription(params) {
|
|
502
|
-
if (
|
|
505
|
+
if (isBlankString(params.subscriptionId)) {
|
|
503
506
|
return {
|
|
504
507
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
505
508
|
};
|
|
@@ -516,7 +519,7 @@ function createSubscriptionMethods(deps) {
|
|
|
516
519
|
);
|
|
517
520
|
}
|
|
518
521
|
async function cancelPendingDowngrade(subscriptionId) {
|
|
519
|
-
if (
|
|
522
|
+
if (isBlankString(subscriptionId)) {
|
|
520
523
|
return {
|
|
521
524
|
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
522
525
|
};
|
|
@@ -527,7 +530,7 @@ function createSubscriptionMethods(deps) {
|
|
|
527
530
|
);
|
|
528
531
|
}
|
|
529
532
|
async function previewPlanChange(params) {
|
|
530
|
-
if (
|
|
533
|
+
if (isBlankString(params.subscriptionId) || isBlankString(params.planCode)) {
|
|
531
534
|
return {
|
|
532
535
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
533
536
|
};
|
|
@@ -607,7 +610,7 @@ function createMembersMethods(deps) {
|
|
|
607
610
|
}
|
|
608
611
|
|
|
609
612
|
// src/client/version-check.ts
|
|
610
|
-
var SDK_VERSION = "2.5.
|
|
613
|
+
var SDK_VERSION = "2.5.1";
|
|
611
614
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
612
615
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
613
616
|
function sdkHeaders() {
|