@feelflow/ffid-sdk 5.10.0 → 5.12.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-IZSL6DI7.cjs → chunk-AOJDV3UO.cjs} +88 -3
- package/dist/{chunk-OJ3OJTIE.js → chunk-KB2JG64Z.js} +88 -4
- package/dist/components/index.cjs +8 -8
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{ffid-client-DRjzfAaS.d.cts → ffid-client-5IprSUVR.d.ts} +169 -42
- package/dist/{ffid-client-gboJROw0.d.ts → ffid-client-Dx4oc4Cw.d.cts} +169 -42
- package/dist/{index-DSvX4q8E.d.cts → index-DqsWKU16.d.cts} +11 -43
- package/dist/{index-DSvX4q8E.d.ts → index-DqsWKU16.d.ts} +11 -43
- package/dist/index.cjs +40 -36
- package/dist/index.d.cts +171 -3
- package/dist/index.d.ts +171 -3
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +78 -3
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +78 -3
- package/dist/server/test/index.d.cts +2 -2
- package/dist/server/test/index.d.ts +2 -2
- package/dist/{types-BYdtyO_2.d.cts → types-BeVl-z12.d.cts} +10 -1
- package/dist/{types-BYdtyO_2.d.ts → types-BeVl-z12.d.ts} +10 -1
- package/dist/webhooks/index.d.cts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -430,6 +430,8 @@ function createVerifyAccessToken(deps) {
|
|
|
430
430
|
// src/client/billing-methods.ts
|
|
431
431
|
var BILLING_CHECKOUT_ENDPOINT = "/api/v1/billing/checkout";
|
|
432
432
|
var BILLING_PORTAL_ENDPOINT = "/api/v1/billing/portal";
|
|
433
|
+
var EXT_INVOICES_ENDPOINT = "/api/v1/billing/ext/invoices";
|
|
434
|
+
var EXT_RETRY_PAYMENT_ENDPOINT = "/api/v1/billing/ext/retry-payment";
|
|
433
435
|
function createBillingMethods(deps) {
|
|
434
436
|
const { fetchWithAuth, createError } = deps;
|
|
435
437
|
async function createCheckoutSession(params) {
|
|
@@ -471,7 +473,31 @@ function createBillingMethods(deps) {
|
|
|
471
473
|
`${BILLING_PORTAL_ENDPOINT}?${query.toString()}`
|
|
472
474
|
);
|
|
473
475
|
}
|
|
474
|
-
|
|
476
|
+
async function listInvoices(params) {
|
|
477
|
+
if (!params.organizationId) {
|
|
478
|
+
return { error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059") };
|
|
479
|
+
}
|
|
480
|
+
const query = new URLSearchParams({ organizationId: params.organizationId });
|
|
481
|
+
return fetchWithAuth(`${EXT_INVOICES_ENDPOINT}?${query.toString()}`);
|
|
482
|
+
}
|
|
483
|
+
async function getInvoice(params) {
|
|
484
|
+
if (!params.invoiceId) {
|
|
485
|
+
return { error: createError("VALIDATION_ERROR", "invoiceId \u306F\u5FC5\u9808\u3067\u3059") };
|
|
486
|
+
}
|
|
487
|
+
return fetchWithAuth(
|
|
488
|
+
`${EXT_INVOICES_ENDPOINT}/${encodeURIComponent(params.invoiceId)}`
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
async function retryPayment(params) {
|
|
492
|
+
if (!params.organizationId) {
|
|
493
|
+
return { error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059") };
|
|
494
|
+
}
|
|
495
|
+
return fetchWithAuth(EXT_RETRY_PAYMENT_ENDPOINT, {
|
|
496
|
+
method: "POST",
|
|
497
|
+
body: JSON.stringify({ organizationId: params.organizationId })
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
return { createCheckoutSession, createPortalSession, listInvoices, getInvoice, retryPayment };
|
|
475
501
|
}
|
|
476
502
|
|
|
477
503
|
// src/client/subscription-methods.ts
|
|
@@ -813,6 +839,45 @@ function createMembersMethods(deps) {
|
|
|
813
839
|
return { listMembers, addMember, updateMemberRole, removeMember };
|
|
814
840
|
}
|
|
815
841
|
|
|
842
|
+
// src/client/seat-methods.ts
|
|
843
|
+
function seatsEndpoint(subscriptionId) {
|
|
844
|
+
return `/api/v1/subscriptions/ext/${encodeURIComponent(subscriptionId)}/seats/assignments`;
|
|
845
|
+
}
|
|
846
|
+
function createSeatMethods(deps) {
|
|
847
|
+
const { fetchWithAuth, createError } = deps;
|
|
848
|
+
async function listSeatAssignments(params) {
|
|
849
|
+
if (!params.subscriptionId) {
|
|
850
|
+
return { error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059") };
|
|
851
|
+
}
|
|
852
|
+
return fetchWithAuth(seatsEndpoint(params.subscriptionId));
|
|
853
|
+
}
|
|
854
|
+
async function assignSeats(params) {
|
|
855
|
+
if (!params.subscriptionId) {
|
|
856
|
+
return { error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059") };
|
|
857
|
+
}
|
|
858
|
+
if (!Array.isArray(params.userIds) || params.userIds.length === 0) {
|
|
859
|
+
return { error: createError("VALIDATION_ERROR", "userIds \u306F 1 \u4EF6\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044") };
|
|
860
|
+
}
|
|
861
|
+
return fetchWithAuth(seatsEndpoint(params.subscriptionId), {
|
|
862
|
+
method: "POST",
|
|
863
|
+
body: JSON.stringify({ userIds: params.userIds })
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
async function unassignSeat(params) {
|
|
867
|
+
if (!params.subscriptionId) {
|
|
868
|
+
return { error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059") };
|
|
869
|
+
}
|
|
870
|
+
if (!params.userId) {
|
|
871
|
+
return { error: createError("VALIDATION_ERROR", "userId \u306F\u5FC5\u9808\u3067\u3059") };
|
|
872
|
+
}
|
|
873
|
+
return fetchWithAuth(
|
|
874
|
+
`${seatsEndpoint(params.subscriptionId)}/${encodeURIComponent(params.userId)}`,
|
|
875
|
+
{ method: "DELETE" }
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
return { listSeatAssignments, assignSeats, unassignSeat };
|
|
879
|
+
}
|
|
880
|
+
|
|
816
881
|
// src/client/profile-methods.ts
|
|
817
882
|
var EXT_PROFILE_ENDPOINT = "/api/v1/users/ext/me";
|
|
818
883
|
function resolveAuthOverride(options, createError) {
|
|
@@ -863,7 +928,7 @@ function createProfileMethods(deps) {
|
|
|
863
928
|
}
|
|
864
929
|
|
|
865
930
|
// src/client/version-check.ts
|
|
866
|
-
var SDK_VERSION = "5.
|
|
931
|
+
var SDK_VERSION = "5.12.0";
|
|
867
932
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
868
933
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
869
934
|
function sdkHeaders() {
|
|
@@ -2608,7 +2673,11 @@ function createFFIDClient(config) {
|
|
|
2608
2673
|
}
|
|
2609
2674
|
return result;
|
|
2610
2675
|
}
|
|
2611
|
-
const { createCheckoutSession, createPortalSession } = createBillingMethods({
|
|
2676
|
+
const { createCheckoutSession, createPortalSession, listInvoices, getInvoice, retryPayment } = createBillingMethods({
|
|
2677
|
+
fetchWithAuth,
|
|
2678
|
+
createError
|
|
2679
|
+
});
|
|
2680
|
+
const { listSeatAssignments, assignSeats, unassignSeat } = createSeatMethods({
|
|
2612
2681
|
fetchWithAuth,
|
|
2613
2682
|
createError
|
|
2614
2683
|
});
|
|
@@ -2717,6 +2786,12 @@ function createFFIDClient(config) {
|
|
|
2717
2786
|
getAnalyticsConfig,
|
|
2718
2787
|
createCheckoutSession,
|
|
2719
2788
|
createPortalSession,
|
|
2789
|
+
listInvoices,
|
|
2790
|
+
getInvoice,
|
|
2791
|
+
retryPayment,
|
|
2792
|
+
listSeatAssignments,
|
|
2793
|
+
assignSeats,
|
|
2794
|
+
unassignSeat,
|
|
2720
2795
|
listPlans,
|
|
2721
2796
|
getSubscription,
|
|
2722
2797
|
subscribe,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-
|
|
2
|
-
import '../../types-
|
|
1
|
+
import { k as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-Dx4oc4Cw.cjs';
|
|
2
|
+
import '../../types-BeVl-z12.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* FFID SDK - Test mode client (E2E / integration test bypass)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-
|
|
2
|
-
import '../../types-
|
|
1
|
+
import { k as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-5IprSUVR.js';
|
|
2
|
+
import '../../types-BeVl-z12.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* FFID SDK - Test mode client (E2E / integration test bypass)
|
|
@@ -49,6 +49,15 @@
|
|
|
49
49
|
* @see /api/v1/subscriptions/ext/check
|
|
50
50
|
* @see docs/03-implementation/EXPIRED_CONTRACT_HANDLING.md
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
declare const EFFECTIVE_SUBSCRIPTION_STATUSES: readonly ["active", "active_canceling", "past_due_grace", "blocked", "canceled", "trial_expired", "expired"];
|
|
53
|
+
/**
|
|
54
|
+
* Derived from {@link EFFECTIVE_SUBSCRIPTION_STATUSES} so the literal set has
|
|
55
|
+
* a runtime representation. The server mirrors the same const in
|
|
56
|
+
* `src/lib/common/subscription-helpers.ts`, and a server-side unit test pins
|
|
57
|
+
* element-equality between the two arrays (#3474) — convention-only sync
|
|
58
|
+
* could drift silently in the server-extending direction (a new server
|
|
59
|
+
* literal would fall through SDK consumers' `switch` defaults).
|
|
60
|
+
*/
|
|
61
|
+
type EffectiveSubscriptionStatus = (typeof EFFECTIVE_SUBSCRIPTION_STATUSES)[number];
|
|
53
62
|
|
|
54
63
|
export type { EffectiveSubscriptionStatus as E };
|
|
@@ -49,6 +49,15 @@
|
|
|
49
49
|
* @see /api/v1/subscriptions/ext/check
|
|
50
50
|
* @see docs/03-implementation/EXPIRED_CONTRACT_HANDLING.md
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
declare const EFFECTIVE_SUBSCRIPTION_STATUSES: readonly ["active", "active_canceling", "past_due_grace", "blocked", "canceled", "trial_expired", "expired"];
|
|
53
|
+
/**
|
|
54
|
+
* Derived from {@link EFFECTIVE_SUBSCRIPTION_STATUSES} so the literal set has
|
|
55
|
+
* a runtime representation. The server mirrors the same const in
|
|
56
|
+
* `src/lib/common/subscription-helpers.ts`, and a server-side unit test pins
|
|
57
|
+
* element-equality between the two arrays (#3474) — convention-only sync
|
|
58
|
+
* could drift silently in the server-extending direction (a new server
|
|
59
|
+
* literal would fall through SDK consumers' `switch` defaults).
|
|
60
|
+
*/
|
|
61
|
+
type EffectiveSubscriptionStatus = (typeof EFFECTIVE_SUBSCRIPTION_STATUSES)[number];
|
|
53
62
|
|
|
54
63
|
export type { EffectiveSubscriptionStatus as E };
|
package/dist/webhooks/index.d.ts
CHANGED