@feelflow/ffid-sdk 12.2.2 → 13.0.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/README.md +23 -1
- package/dist/agency/index.cjs +7 -43
- package/dist/agency/index.d.cts +71 -79
- package/dist/agency/index.d.ts +71 -79
- package/dist/agency/index.js +7 -43
- package/dist/chunk-5FNSZ5WN.cjs +26 -0
- package/dist/chunk-D6CCHTHL.cjs +26 -0
- package/dist/chunk-HTFNV6DW.js +22 -0
- package/dist/{chunk-4UCL6JN6.cjs → chunk-IA6JV3TN.cjs} +13 -4
- package/dist/chunk-IQSXIOPK.js +22 -0
- package/dist/{chunk-RZCQ22GH.cjs → chunk-LX4RRB44.cjs} +12 -2
- package/dist/{chunk-OQCNCKJ4.js → chunk-TSFGRZLQ.js} +13 -4
- package/dist/{chunk-S2AEBJRX.js → chunk-ZIJ5SM4O.js} +12 -2
- package/dist/components/index.cjs +9 -8
- package/dist/components/index.js +2 -1
- package/dist/consent/index.cjs +64 -63
- package/dist/consent/index.js +2 -1
- package/dist/{ffid-client-C4Mjg70P.d.cts → ffid-client-CW3siYTe.d.cts} +3 -3
- package/dist/{ffid-client-E9ja3Jus.d.ts → ffid-client-CWvm_T2K.d.ts} +3 -3
- package/dist/index.cjs +115 -114
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/legal/index.cjs +10 -0
- package/dist/legal/index.js +10 -0
- package/dist/server/index.cjs +18 -4
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +18 -4
- package/package.json +2 -2
package/dist/agency/index.d.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
export { D as DEFAULT_API_BASE_URL } from '../constants-Ce2eXQtB.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* FFID の代理店 API が返すエラーコード(13.0.0〜)。
|
|
5
|
+
*
|
|
6
|
+
* FFID 本体の `src/lib/agencies/errors.ts` の `AGENCY_ERROR_CODES` の値を、定義順のまま写したもの。
|
|
7
|
+
* 食い違いは root の `npm run sdk:verify-sync`(`scripts/verify-sdk-constants-sync.ts`)が落とす。
|
|
8
|
+
* サーバーにコードを足したら、同じ PR でここにも足す(足さないと上の同期検査が落ちる)。閉じた union への
|
|
9
|
+
* 追加は網羅的な `switch` / `Record` を書く利用者には破壊的になるので、SDK の版の上げ方は FFID の
|
|
10
|
+
* GIT_WORKFLOW §8.2 に従って判断する。
|
|
11
|
+
*
|
|
12
|
+
* 型(`FFIDAgencyServerErrorCode`)を導くためだけに使い、公開 export にはしない。
|
|
13
|
+
*/
|
|
14
|
+
declare const FFID_AGENCY_SERVER_ERROR_CODES: readonly ["UNAUTHORIZED", "FORBIDDEN", "NOT_AGENCY_MEMBER", "NOT_AGENCY_ADMIN", "NOT_AGENCY_OWNER", "NOT_PLATFORM_OWNER", "SUB_AGENCY_CREATION_REMOVED", "MISSING_REQUIRED_FIELD", "INVALID_AGENCY_NAME", "INVALID_EMAIL", "INVALID_ROLE", "INVALID_AGENCY_ID", "INVALID_MEMBER_ID", "INVALID_ORGANIZATION_ID", "INVALID_COMMISSION_RATE", "INVALID_BILLING_OVERRIDE", "INVALID_STATUS", "INVALID_JSON", "AGENCY_NOT_FOUND", "MEMBER_NOT_FOUND", "USER_NOT_FOUND", "ORGANIZATION_NOT_FOUND", "MAX_HIERARCHY_DEPTH_EXCEEDED", "PARENT_AGENCY_NOT_FOUND", "SUB_AGENCY_NOT_FOUND", "INACTIVE_PARENT_AGENCY", "CIRCULAR_HIERARCHY_DETECTED", "MEMBER_ALREADY_EXISTS", "ORGANIZATION_ALREADY_LINKED", "ORGANIZATION_IS_AGENCY", "ORGANIZATION_LINKED_TO_OTHER_AGENCY", "CANNOT_REMOVE_OWNER", "CANNOT_CHANGE_OWNER_ROLE", "AGENCY_SLUG_EXISTS", "INVALID_BILLING_TYPE", "INVALID_FIELD_TYPE", "INVALID_INVITE_LINK_LABEL", "INVALID_SEARCH_QUERY", "UNKNOWN_SETTINGS_KEY", "BILLING_TYPE_CHANGE_NOT_ALLOWED", "STRIPE_CUSTOMER_REQUIRED", "INVOICE_NOT_FOUND", "INVALID_PAYMENT_TERMS", "INVALID_WHOLESALE_DISCOUNT_RATE", "NO_BILLABLE_ORGANIZATIONS", "INVOICE_FINALIZED_NOT_RECORDED", "INVOICE_SEND_FAILED", "INVALID_PERIOD", "INVALID_INVITE_LINK_LIMIT", "INVITE_LINK_EXPIRED", "INVITE_LINK_NOT_FOUND", "INVITE_LINK_REVOKED", "INVITE_LINK_EXHAUSTED", "ORGANIZATION_SLUG_CONFLICT", "INVALID_ORGANIZATION_SLUG", "INVALID_ORGANIZATION_NAME", "INVALID_BILLING_EMAIL", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSED", "ORGANIZATION_SLUG_RESERVED", "OWNER_ACCOUNT_UNAVAILABLE", "OWNER_ALREADY_SIGNED_IN", "OWNER_EMAIL_UNDELIVERABLE", "WELCOME_EMAIL_RECIPIENT_AMBIGUOUS", "WELCOME_EMAIL_COOLDOWN", "WELCOME_EMAIL_SEND_FAILED", "MISSING_API_KEY", "INVALID_API_KEY_FORMAT", "INVALID_API_KEY", "REVOKED_API_KEY", "EXPIRED_API_KEY", "SERVICE_UNAVAILABLE", "API_KEY_NOT_FOUND", "INVALID_API_KEY_ID", "INVALID_API_KEY_NAME", "INVALID_API_KEY_SCOPE", "INVALID_API_KEY_EXPIRY", "INVALID_WEBHOOK_URL", "INVALID_COLOR", "INVALID_DOMAIN", "DOMAIN_ALREADY_IN_USE", "DOMAIN_VERIFICATION_FAILED", "DOMAIN_NOT_CONFIGURED", "INVALID_COMPANY_NAME", "INVALID_FROM_EMAIL", "FILE_TOO_LARGE", "INVALID_FILE_TYPE", "FILE_UPLOAD_FAILED", "VERCEL_API_ERROR", "INTERNAL_ERROR", "SLUG_GENERATION_EXHAUSTED"];
|
|
15
|
+
|
|
3
16
|
/**
|
|
4
17
|
* FFID Agency SDK Type Definitions
|
|
5
18
|
*
|
|
6
19
|
* Types for the FeelFlow ID Agency Management SDK.
|
|
7
|
-
* Used for managing agencies,
|
|
20
|
+
* Used for managing agencies, organizations, branding,
|
|
8
21
|
* domain, email settings, billing, and hierarchy.
|
|
9
22
|
*/
|
|
23
|
+
|
|
10
24
|
/**
|
|
11
25
|
* Configuration for the FFID Agency Client
|
|
12
26
|
*/
|
|
@@ -31,19 +45,28 @@ type FFIDAgencyStatus = 'active' | 'suspended' | 'inactive';
|
|
|
31
45
|
/**
|
|
32
46
|
* 代理店の課金方式。
|
|
33
47
|
*
|
|
34
|
-
* `'markup'`
|
|
35
|
-
*
|
|
36
|
-
*
|
|
48
|
+
* 13.0.0 で非推奨の `'markup'` を外した(FFID #6507 / #6714)。ただし FFID 側の値と列の削除は #6714 で
|
|
49
|
+
* 別に行うので、それまでは markup の代理店の応答に `'markup'` が届きうる(SDK は応答を実行時に検証しない)。
|
|
50
|
+
* 受け取った値を網羅的に扱う箇所(`switch` / `Record<FFIDAgencyBillingType, …>` の参照)では、想定外の
|
|
51
|
+
* 値の分岐(`default`)を残すこと。
|
|
37
52
|
*/
|
|
38
|
-
type FFIDAgencyBillingType = 'direct' | 'consolidated'
|
|
39
|
-
type FFIDAgencyMemberRole = 'owner' | 'admin' | 'sales' | 'support';
|
|
40
|
-
type FFIDAgencyMemberStatus = 'active' | 'invited' | 'suspended';
|
|
53
|
+
type FFIDAgencyBillingType = 'direct' | 'consolidated';
|
|
41
54
|
type FFIDAgencyBillingOverride = 'default' | 'direct' | 'exempt';
|
|
42
55
|
type FFIDSslStatus = 'pending' | 'active' | 'failed';
|
|
43
56
|
interface FFIDAgency {
|
|
44
57
|
id: string;
|
|
45
58
|
name: string;
|
|
46
59
|
slug: string;
|
|
60
|
+
/**
|
|
61
|
+
* この代理店の実体である組織の ID(FFID #5817。13.0.0 で型に追加。FFID は以前から返している)。
|
|
62
|
+
* 代理店のロールはこの組織での利用者のロールから導出されるので、代理店のメンバーは
|
|
63
|
+
* `createFFIDClient()` の組織メンバー API(`listMembers` など)にこの ID を渡して管理する。
|
|
64
|
+
*
|
|
65
|
+
* ⚠️ `getAgency()` の応答では、FFID は代理店そのものを `data` に入れて返す(値は
|
|
66
|
+
* `result.data.organizationId`)。`FFIDAgencyClient.getAgency` の型が宣言する `{ agency }` の形とは
|
|
67
|
+
* 食い違っている(FFID #7177 で直す)。
|
|
68
|
+
*/
|
|
69
|
+
organizationId: string;
|
|
47
70
|
isPlatformOwner: boolean;
|
|
48
71
|
parentAgencyId: string | null;
|
|
49
72
|
status: FFIDAgencyStatus;
|
|
@@ -65,6 +88,13 @@ interface FFIDAgencyBrandingSettings {
|
|
|
65
88
|
secondaryColor?: string;
|
|
66
89
|
companyName?: string;
|
|
67
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* {@link FFIDAgencyClient.updateBranding} の引数。
|
|
93
|
+
*
|
|
94
|
+
* 13.0.0 で `logoUrl` / `faviconUrl` を外した(FFID #6972 / #6714)。FFID は 2 つを保存しないので、
|
|
95
|
+
* ロゴとファビコンは {@link FFIDAgencyClient.uploadAsset} で変える。
|
|
96
|
+
*/
|
|
97
|
+
type FFIDUpdateAgencyBrandingRequest = Omit<FFIDAgencyBrandingSettings, 'logoUrl' | 'faviconUrl'>;
|
|
68
98
|
interface FFIDAgencyDnsRecord {
|
|
69
99
|
type: string;
|
|
70
100
|
name: string;
|
|
@@ -81,23 +111,6 @@ interface FFIDAgencyEmailSettings {
|
|
|
81
111
|
fromEmail?: string;
|
|
82
112
|
replyTo?: string;
|
|
83
113
|
}
|
|
84
|
-
interface FFIDAgencyMember {
|
|
85
|
-
userId: string;
|
|
86
|
-
email: string;
|
|
87
|
-
displayName: string | null;
|
|
88
|
-
avatarUrl: string | null;
|
|
89
|
-
role: FFIDAgencyMemberRole;
|
|
90
|
-
status: FFIDAgencyMemberStatus;
|
|
91
|
-
joinedAt: string | null;
|
|
92
|
-
invitedAt: string | null;
|
|
93
|
-
}
|
|
94
|
-
interface FFIDAddAgencyMemberRequest {
|
|
95
|
-
email: string;
|
|
96
|
-
role?: FFIDAgencyMemberRole;
|
|
97
|
-
}
|
|
98
|
-
interface FFIDUpdateAgencyMemberRequest {
|
|
99
|
-
role: FFIDAgencyMemberRole;
|
|
100
|
-
}
|
|
101
114
|
interface FFIDAgencyOrganization {
|
|
102
115
|
id: string;
|
|
103
116
|
agencyId: string;
|
|
@@ -106,10 +119,6 @@ interface FFIDAgencyOrganization {
|
|
|
106
119
|
organizationSlug: string;
|
|
107
120
|
billingOverride: FFIDAgencyBillingOverride;
|
|
108
121
|
commissionRate: number | null;
|
|
109
|
-
/** @deprecated markup 課金方式は非推奨(FFID #6507)。帳票用の既存値を読むだけで、更新する API は無い。 */
|
|
110
|
-
markupRate: number | null;
|
|
111
|
-
/** @deprecated markup 課金方式は非推奨(FFID #6507)。帳票用の既存値を読むだけで、更新する API は無い。 */
|
|
112
|
-
markupFixed: number | null;
|
|
113
122
|
/** 組織単位の卸割引率 override(%、0〜100)。null = 代理店デフォルトに従う。 */
|
|
114
123
|
wholesaleDiscountRate: number | null;
|
|
115
124
|
notes: string | null;
|
|
@@ -180,11 +189,6 @@ interface FFIDLinkOrganizationRequest {
|
|
|
180
189
|
wholesaleDiscountRate?: number | null;
|
|
181
190
|
notes?: string;
|
|
182
191
|
}
|
|
183
|
-
interface FFIDCreateSubAgencyRequest {
|
|
184
|
-
name: string;
|
|
185
|
-
contactEmail?: string;
|
|
186
|
-
settings?: FFIDAgencySettings;
|
|
187
|
-
}
|
|
188
192
|
interface FFIDAgencyHierarchyNode {
|
|
189
193
|
agency: FFIDAgency;
|
|
190
194
|
children: FFIDAgencyHierarchyNode[];
|
|
@@ -201,10 +205,6 @@ interface FFIDAgencyBillingConfig {
|
|
|
201
205
|
stripeCustomerId: string | null;
|
|
202
206
|
invoiceEmail: string | null;
|
|
203
207
|
paymentTerms: number | null;
|
|
204
|
-
/** @deprecated markup 課金方式は非推奨(FFID #6507)。帳票用の既存値を読むだけで、更新する API は無い。 */
|
|
205
|
-
defaultMarkupRate: number | null;
|
|
206
|
-
/** @deprecated markup 課金方式は非推奨(FFID #6507)。帳票用の既存値を読むだけで、更新する API は無い。 */
|
|
207
|
-
defaultMarkupFixed: number | null;
|
|
208
208
|
/** 代理店デフォルト卸割引率(%、0〜100)。null = 未設定(定価請求)。 */
|
|
209
209
|
wholesaleDiscountRate: number | null;
|
|
210
210
|
}
|
|
@@ -212,16 +212,6 @@ interface FFIDUpdateAgencyBillingRequest {
|
|
|
212
212
|
billingType?: FFIDAgencyBillingType;
|
|
213
213
|
invoiceEmail?: string;
|
|
214
214
|
paymentTerms?: number;
|
|
215
|
-
/**
|
|
216
|
-
* @deprecated FFID はこの項目を受け付けず、送っても黙って捨てる(FFID #6507)。
|
|
217
|
-
* markup 課金方式は非推奨で、値を更新する手段は無い。
|
|
218
|
-
*/
|
|
219
|
-
defaultMarkupRate?: number;
|
|
220
|
-
/**
|
|
221
|
-
* @deprecated FFID はこの項目を受け付けず、送っても黙って捨てる(FFID #6507)。
|
|
222
|
-
* markup 課金方式は非推奨で、値を更新する手段は無い。
|
|
223
|
-
*/
|
|
224
|
-
defaultMarkupFixed?: number;
|
|
225
215
|
/** 代理店デフォルト卸割引率(%、0〜100)。null で未設定に戻す。 */
|
|
226
216
|
wholesaleDiscountRate?: number | null;
|
|
227
217
|
}
|
|
@@ -269,6 +259,10 @@ interface FFIDAgencyClient {
|
|
|
269
259
|
agencies: FFIDAgency[];
|
|
270
260
|
count: number;
|
|
271
261
|
}>>;
|
|
262
|
+
/**
|
|
263
|
+
* ⚠️ FFID は代理店そのものを `data` に入れて返す(`data.agency` ではない)。この型の `{ agency }` は
|
|
264
|
+
* 実際の応答と食い違っている。代理店クライアントの応答型の総点検は FFID #7177 で 13.x として行う。
|
|
265
|
+
*/
|
|
272
266
|
getAgency(agencyId: string): Promise<FFIDAgencyApiResponse<{
|
|
273
267
|
agency: FFIDAgency;
|
|
274
268
|
}>>;
|
|
@@ -281,19 +275,6 @@ interface FFIDAgencyClient {
|
|
|
281
275
|
updateAgency(agencyId: string, data: FFIDUpdateAgencyRequest): Promise<FFIDAgencyApiResponse<{
|
|
282
276
|
agency: FFIDAgency;
|
|
283
277
|
}>>;
|
|
284
|
-
getMembers(agencyId: string): Promise<FFIDAgencyApiResponse<{
|
|
285
|
-
members: FFIDAgencyMember[];
|
|
286
|
-
count: number;
|
|
287
|
-
}>>;
|
|
288
|
-
addMember(agencyId: string, data: FFIDAddAgencyMemberRequest): Promise<FFIDAgencyApiResponse<{
|
|
289
|
-
member: FFIDAgencyMember;
|
|
290
|
-
}>>;
|
|
291
|
-
updateMember(agencyId: string, userId: string, data: FFIDUpdateAgencyMemberRequest): Promise<FFIDAgencyApiResponse<{
|
|
292
|
-
member: FFIDAgencyMember;
|
|
293
|
-
}>>;
|
|
294
|
-
removeMember(agencyId: string, userId: string): Promise<FFIDAgencyApiResponse<{
|
|
295
|
-
message: string;
|
|
296
|
-
}>>;
|
|
297
278
|
getOrganizations(agencyId: string): Promise<FFIDAgencyApiResponse<{
|
|
298
279
|
organizations: FFIDAgencyOrganization[];
|
|
299
280
|
count: number;
|
|
@@ -318,9 +299,6 @@ interface FFIDAgencyClient {
|
|
|
318
299
|
agencies: FFIDAgency[];
|
|
319
300
|
count: number;
|
|
320
301
|
}>>;
|
|
321
|
-
createSubAgency(agencyId: string, data: FFIDCreateSubAgencyRequest): Promise<FFIDAgencyApiResponse<{
|
|
322
|
-
agency: FFIDAgency;
|
|
323
|
-
}>>;
|
|
324
302
|
getHierarchy(agencyId: string): Promise<FFIDAgencyApiResponse<FFIDAgencyHierarchyResponse>>;
|
|
325
303
|
getBranding(agencyId: string): Promise<FFIDAgencyApiResponse<{
|
|
326
304
|
branding: FFIDAgencyBrandingSettings;
|
|
@@ -329,15 +307,13 @@ interface FFIDAgencyClient {
|
|
|
329
307
|
* ブランディング(色 2 種・会社名)を更新する。
|
|
330
308
|
*
|
|
331
309
|
* FFID は型にないキーを 400 `UNKNOWN_SETTINGS_KEY` で拒否する(FFID #6972。`error.details.fields`
|
|
332
|
-
* にキー名)。`logoUrl` / `faviconUrl`
|
|
333
|
-
* ロゴとファビコンは {@link FFIDAgencyClient.uploadAsset} で変える。
|
|
334
|
-
* 引数の型から次の major 版で外す。
|
|
310
|
+
* にキー名)。`logoUrl` / `faviconUrl` は 13.0.0 で引数の型から外した。FFID は既知のキーとして
|
|
311
|
+
* 受け付けるが**保存しない** — ロゴとファビコンは {@link FFIDAgencyClient.uploadAsset} で変える。
|
|
335
312
|
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* 比べるときは `(error.code as string) === 'UNKNOWN_SETTINGS_KEY'` とする。
|
|
313
|
+
* `UNKNOWN_SETTINGS_KEY` は 13.0.0 で {@link FFIDAgencyErrorCode} に入ったので、
|
|
314
|
+
* `error.code === 'UNKNOWN_SETTINGS_KEY'` とキャストなしで比べられる。
|
|
339
315
|
*/
|
|
340
|
-
updateBranding(agencyId: string, data:
|
|
316
|
+
updateBranding(agencyId: string, data: FFIDUpdateAgencyBrandingRequest): Promise<FFIDAgencyApiResponse<{
|
|
341
317
|
branding: FFIDAgencyBrandingSettings;
|
|
342
318
|
}>>;
|
|
343
319
|
uploadAsset(agencyId: string, file: File, type: FFIDAgencyAssetType): Promise<FFIDAgencyApiResponse<{
|
|
@@ -377,7 +353,21 @@ interface FFIDAgencyClient {
|
|
|
377
353
|
getRevenue(agencyId: string): Promise<FFIDAgencyApiResponse<FFIDAgencyRevenue>>;
|
|
378
354
|
}
|
|
379
355
|
type FFIDAgencySdkErrorCode = 'NETWORK_ERROR' | 'PARSE_ERROR' | 'UNKNOWN_ERROR' | 'VALIDATION_ERROR';
|
|
380
|
-
|
|
356
|
+
/**
|
|
357
|
+
* FFID の代理店 API が返すエラーコード。
|
|
358
|
+
*
|
|
359
|
+
* 13.0.0 から FFID の代理店のエラーコード表 `AGENCY_ERROR_CODES` の全値(`./server-error-codes`)を含む。
|
|
360
|
+
* 12.x までは 6 個だけで、`UNKNOWN_SETTINGS_KEY`(FFID #6972)や `INVALID_FIELD_TYPE` /
|
|
361
|
+
* `MISSING_REQUIRED_FIELD` など、FFID が実際に返すコードが入っていなかった。
|
|
362
|
+
*
|
|
363
|
+
* ⚠️ 代理店 API の応答に載るのはこの表のコードだけではない。共通層の 405 `METHOD_NOT_ALLOWED` や、
|
|
364
|
+
* 請求書の 500 `invalid_db_timestamp` などは表の外で、SDK はそのまま `error.code` に通す。
|
|
365
|
+
* `error.code` を網羅的に扱う箇所では、想定外の値の分岐(`default`)を残すこと。
|
|
366
|
+
*
|
|
367
|
+
* `NOT_FOUND` / `VALIDATION_ERROR` / `CONFLICT` は 12.x から型にあるが、`AGENCY_ERROR_CODES` に無い
|
|
368
|
+
* (`VALIDATION_ERROR` は SDK 自身の入力検査のコードとしても使う)。互換のため残している。
|
|
369
|
+
*/
|
|
370
|
+
type FFIDAgencyServerErrorCode = (typeof FFID_AGENCY_SERVER_ERROR_CODES)[number] | 'NOT_FOUND' | 'VALIDATION_ERROR' | 'CONFLICT';
|
|
381
371
|
type FFIDAgencyErrorCode = FFIDAgencySdkErrorCode | FFIDAgencyServerErrorCode;
|
|
382
372
|
interface FFIDAgencyServerError {
|
|
383
373
|
code: FFIDAgencyErrorCode;
|
|
@@ -435,10 +425,11 @@ type FFIDAgencyApiResponse<T> = {
|
|
|
435
425
|
/**
|
|
436
426
|
* このクライアントが返しうるエラーコード。
|
|
437
427
|
*
|
|
438
|
-
* `FFIDAgencyErrorCode`(SDK
|
|
439
|
-
*
|
|
440
|
-
* `
|
|
441
|
-
*
|
|
428
|
+
* `FFIDAgencyErrorCode`(SDK 内部で定義した閉じた集合)は 13.0.0 から FFID の
|
|
429
|
+
* `AGENCY_ERROR_CODES` の全値を含む(12.x までは `ORGANIZATION_SLUG_CONFLICT` /
|
|
430
|
+
* `INVALID_ORGANIZATION_SLUG` / `REVOKED_API_KEY` なども欠けていた)。それでも、
|
|
431
|
+
* SDK より新しい FFID が足したコードは SDK を上げるまで届きうる。閉じた union のふりを
|
|
432
|
+
* すると、利用者が書いた exhaustive な `switch` が実行時に `default` に落ちる。
|
|
442
433
|
* **開いた集合であることを型で正直に表す。**
|
|
443
434
|
*
|
|
444
435
|
* ⚠️ `types.ts` の `FFIDAgencyServerErrorCode` とは**別物**。あちらは
|
|
@@ -455,9 +446,10 @@ interface FFIDAgencyServerClientError {
|
|
|
455
446
|
/**
|
|
456
447
|
* サーバークライアントの応答。
|
|
457
448
|
*
|
|
458
|
-
* Cookie クライアントの `FFIDAgencyApiResponse` は `code` が閉じた union
|
|
459
|
-
*
|
|
460
|
-
*
|
|
449
|
+
* Cookie クライアントの `FFIDAgencyApiResponse` は `code` が閉じた union
|
|
450
|
+
* (`FFIDAgencyErrorCode`)だが、実際にはサーバーのコードを素通しするので、表の外の
|
|
451
|
+
* コードも届きうる(`FFIDAgencyServerErrorCode` の注記)。こちらは**サーバーのコードを
|
|
452
|
+
* そのまま通す**ことを型でも表すため、開いておく。
|
|
461
453
|
*/
|
|
462
454
|
type FFIDAgencyServerClientResponse<T> = {
|
|
463
455
|
data: T;
|
|
@@ -555,4 +547,4 @@ declare const FFID_AGENCY_ERROR_CODES: {
|
|
|
555
547
|
declare function createFFIDAgencyClient(config?: FFIDAgencyClientConfig): FFIDAgencyClient;
|
|
556
548
|
|
|
557
549
|
export { FFID_AGENCY_ERROR_CODES, createFFIDAgencyClient, createFFIDAgencyServerClient };
|
|
558
|
-
export type {
|
|
550
|
+
export type { FFIDAgency, FFIDAgencyApiResponse, FFIDAgencyAssetType, FFIDAgencyBillingConfig, FFIDAgencyBillingOverride, FFIDAgencyBillingSummary, FFIDAgencyBillingType, FFIDAgencyBrandingSettings, FFIDAgencyClient, FFIDAgencyClientConfig, FFIDAgencyDnsRecord, FFIDAgencyDomainSettings, FFIDAgencyEmailSettings, FFIDAgencyError, FFIDAgencyErrorCode, FFIDAgencyHierarchyNode, FFIDAgencyHierarchyResponse, FFIDAgencyInvoice, FFIDAgencyInvoiceStatus, FFIDAgencyLogger, FFIDAgencyOrganization, FFIDAgencyRevenue, FFIDAgencySdkErrorCode, FFIDAgencyServerClient, FFIDAgencyServerClientConfig, FFIDAgencyServerClientError, FFIDAgencyServerClientErrorCode, FFIDAgencyServerClientResponse, FFIDAgencyServerError, FFIDAgencyServerErrorCode, FFIDAgencyServerResponse, FFIDAgencySettings, FFIDAgencyStatus, FFIDLinkOrganizationRequest, FFIDProvisionOrganizationRequest, FFIDProvisionedOrganization, FFIDSetupDomainRequest, FFIDSslStatus, FFIDUpdateAgencyBillingRequest, FFIDUpdateAgencyBrandingRequest, FFIDUpdateAgencyRequest, FFIDUpdateEmailSettingsRequest, FFIDWelcomeEmailOutcome };
|
package/dist/agency/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CREDENTIAL_REDIRECT_INIT, isRedirectResponse, credentialRedirectMessage } from '../chunk-HTFNV6DW.js';
|
|
1
2
|
import { DEFAULT_API_BASE_URL } from '../chunk-JEVK2XUM.js';
|
|
2
3
|
export { DEFAULT_API_BASE_URL } from '../chunk-JEVK2XUM.js';
|
|
3
4
|
|
|
@@ -112,35 +113,6 @@ function createFFIDAgencyClient(config = {}) {
|
|
|
112
113
|
body: JSON.stringify(data)
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
|
-
async function getMembers(agencyId) {
|
|
116
|
-
const err = validateIds([agencyId, "agencyId"]);
|
|
117
|
-
if (err) return err;
|
|
118
|
-
return fetchWithCredentials(`/${encodeURIComponent(agencyId)}/members`);
|
|
119
|
-
}
|
|
120
|
-
async function addMember(agencyId, data) {
|
|
121
|
-
const err = validateIds([agencyId, "agencyId"]);
|
|
122
|
-
if (err) return err;
|
|
123
|
-
return fetchWithCredentials(`/${encodeURIComponent(agencyId)}/members`, {
|
|
124
|
-
method: "POST",
|
|
125
|
-
body: JSON.stringify(data)
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
async function updateMember(agencyId, userId, data) {
|
|
129
|
-
const err = validateIds([agencyId, "agencyId"], [userId, "userId"]);
|
|
130
|
-
if (err) return err;
|
|
131
|
-
return fetchWithCredentials(
|
|
132
|
-
`/${encodeURIComponent(agencyId)}/members/${encodeURIComponent(userId)}`,
|
|
133
|
-
{ method: "PUT", body: JSON.stringify(data) }
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
async function removeMember(agencyId, userId) {
|
|
137
|
-
const err = validateIds([agencyId, "agencyId"], [userId, "userId"]);
|
|
138
|
-
if (err) return err;
|
|
139
|
-
return fetchWithCredentials(
|
|
140
|
-
`/${encodeURIComponent(agencyId)}/members/${encodeURIComponent(userId)}`,
|
|
141
|
-
{ method: "DELETE" }
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
116
|
async function getOrganizations(agencyId) {
|
|
145
117
|
const err = validateIds([agencyId, "agencyId"]);
|
|
146
118
|
if (err) return err;
|
|
@@ -175,14 +147,6 @@ function createFFIDAgencyClient(config = {}) {
|
|
|
175
147
|
if (err) return err;
|
|
176
148
|
return fetchWithCredentials(`/${encodeURIComponent(agencyId)}/sub-agencies`);
|
|
177
149
|
}
|
|
178
|
-
async function createSubAgency(agencyId, data) {
|
|
179
|
-
const err = validateIds([agencyId, "agencyId"]);
|
|
180
|
-
if (err) return err;
|
|
181
|
-
return fetchWithCredentials(`/${encodeURIComponent(agencyId)}/sub-agencies`, {
|
|
182
|
-
method: "POST",
|
|
183
|
-
body: JSON.stringify(data)
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
150
|
async function getHierarchy(agencyId) {
|
|
187
151
|
const err = validateIds([agencyId, "agencyId"]);
|
|
188
152
|
if (err) return err;
|
|
@@ -288,11 +252,6 @@ function createFFIDAgencyClient(config = {}) {
|
|
|
288
252
|
getAgencies,
|
|
289
253
|
getAgency,
|
|
290
254
|
updateAgency,
|
|
291
|
-
// Members
|
|
292
|
-
getMembers,
|
|
293
|
-
addMember,
|
|
294
|
-
updateMember,
|
|
295
|
-
removeMember,
|
|
296
255
|
// Organizations
|
|
297
256
|
getOrganizations,
|
|
298
257
|
linkOrganization,
|
|
@@ -300,7 +259,6 @@ function createFFIDAgencyClient(config = {}) {
|
|
|
300
259
|
provisionOrganization,
|
|
301
260
|
// Sub-Agencies
|
|
302
261
|
getSubAgencies,
|
|
303
|
-
createSubAgency,
|
|
304
262
|
// Hierarchy
|
|
305
263
|
getHierarchy,
|
|
306
264
|
// Branding
|
|
@@ -361,6 +319,7 @@ function createFFIDAgencyServerClient(config) {
|
|
|
361
319
|
try {
|
|
362
320
|
response = await fetch(url, {
|
|
363
321
|
method: "POST",
|
|
322
|
+
...CREDENTIAL_REDIRECT_INIT,
|
|
364
323
|
headers: {
|
|
365
324
|
"Content-Type": "application/json",
|
|
366
325
|
[AGENCY_API_KEY_HEADER]: apiKey
|
|
@@ -378,6 +337,11 @@ function createFFIDAgencyServerClient(config) {
|
|
|
378
337
|
}
|
|
379
338
|
};
|
|
380
339
|
}
|
|
340
|
+
if (isRedirectResponse(response)) {
|
|
341
|
+
return {
|
|
342
|
+
error: { code: FFID_AGENCY_ERROR_CODES.NETWORK_ERROR, message: credentialRedirectMessage(response) }
|
|
343
|
+
};
|
|
344
|
+
}
|
|
381
345
|
let payload;
|
|
382
346
|
try {
|
|
383
347
|
payload = await response.json();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/shared/credential-redirect.ts
|
|
4
|
+
var CREDENTIAL_REDIRECT_INIT = { redirect: "manual" };
|
|
5
|
+
var HTTP_MOVED_PERMANENTLY = 301;
|
|
6
|
+
var HTTP_FOUND = 302;
|
|
7
|
+
var HTTP_SEE_OTHER = 303;
|
|
8
|
+
var HTTP_TEMPORARY_REDIRECT = 307;
|
|
9
|
+
var HTTP_PERMANENT_REDIRECT = 308;
|
|
10
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([
|
|
11
|
+
HTTP_MOVED_PERMANENTLY,
|
|
12
|
+
HTTP_FOUND,
|
|
13
|
+
HTTP_SEE_OTHER,
|
|
14
|
+
HTTP_TEMPORARY_REDIRECT,
|
|
15
|
+
HTTP_PERMANENT_REDIRECT
|
|
16
|
+
]);
|
|
17
|
+
function isRedirectResponse(response) {
|
|
18
|
+
return response.type === "opaqueredirect" || REDIRECT_STATUSES.has(response.status);
|
|
19
|
+
}
|
|
20
|
+
function credentialRedirectMessage(response) {
|
|
21
|
+
return `\u30B5\u30FC\u30D0\u30FC\u304C\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\uFF08status: ${response.status}\uFF09\u3092\u8FD4\u3057\u305F\u305F\u3081\u3001API \u30AD\u30FC\u3092\u8EE2\u9001\u5148\u3078\u9001\u3089\u305A\u306B\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002\u63A5\u7D9A\u5148 URL \u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.CREDENTIAL_REDIRECT_INIT = CREDENTIAL_REDIRECT_INIT;
|
|
25
|
+
exports.credentialRedirectMessage = credentialRedirectMessage;
|
|
26
|
+
exports.isRedirectResponse = isRedirectResponse;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/shared/credential-redirect.ts
|
|
4
|
+
var CREDENTIAL_REDIRECT_INIT = { redirect: "manual" };
|
|
5
|
+
var HTTP_MOVED_PERMANENTLY = 301;
|
|
6
|
+
var HTTP_FOUND = 302;
|
|
7
|
+
var HTTP_SEE_OTHER = 303;
|
|
8
|
+
var HTTP_TEMPORARY_REDIRECT = 307;
|
|
9
|
+
var HTTP_PERMANENT_REDIRECT = 308;
|
|
10
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([
|
|
11
|
+
HTTP_MOVED_PERMANENTLY,
|
|
12
|
+
HTTP_FOUND,
|
|
13
|
+
HTTP_SEE_OTHER,
|
|
14
|
+
HTTP_TEMPORARY_REDIRECT,
|
|
15
|
+
HTTP_PERMANENT_REDIRECT
|
|
16
|
+
]);
|
|
17
|
+
function isRedirectResponse(response) {
|
|
18
|
+
return response.type === "opaqueredirect" || REDIRECT_STATUSES.has(response.status);
|
|
19
|
+
}
|
|
20
|
+
function credentialRedirectMessage(response) {
|
|
21
|
+
return `\u30B5\u30FC\u30D0\u30FC\u304C\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\uFF08status: ${response.status}\uFF09\u3092\u8FD4\u3057\u305F\u305F\u3081\u3001API \u30AD\u30FC\u3092\u8EE2\u9001\u5148\u3078\u9001\u3089\u305A\u306B\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002\u63A5\u7D9A\u5148 URL \u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.CREDENTIAL_REDIRECT_INIT = CREDENTIAL_REDIRECT_INIT;
|
|
25
|
+
exports.credentialRedirectMessage = credentialRedirectMessage;
|
|
26
|
+
exports.isRedirectResponse = isRedirectResponse;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/shared/credential-redirect.ts
|
|
2
|
+
var CREDENTIAL_REDIRECT_INIT = { redirect: "manual" };
|
|
3
|
+
var HTTP_MOVED_PERMANENTLY = 301;
|
|
4
|
+
var HTTP_FOUND = 302;
|
|
5
|
+
var HTTP_SEE_OTHER = 303;
|
|
6
|
+
var HTTP_TEMPORARY_REDIRECT = 307;
|
|
7
|
+
var HTTP_PERMANENT_REDIRECT = 308;
|
|
8
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([
|
|
9
|
+
HTTP_MOVED_PERMANENTLY,
|
|
10
|
+
HTTP_FOUND,
|
|
11
|
+
HTTP_SEE_OTHER,
|
|
12
|
+
HTTP_TEMPORARY_REDIRECT,
|
|
13
|
+
HTTP_PERMANENT_REDIRECT
|
|
14
|
+
]);
|
|
15
|
+
function isRedirectResponse(response) {
|
|
16
|
+
return response.type === "opaqueredirect" || REDIRECT_STATUSES.has(response.status);
|
|
17
|
+
}
|
|
18
|
+
function credentialRedirectMessage(response) {
|
|
19
|
+
return `\u30B5\u30FC\u30D0\u30FC\u304C\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\uFF08status: ${response.status}\uFF09\u3092\u8FD4\u3057\u305F\u305F\u3081\u3001API \u30AD\u30FC\u3092\u8EE2\u9001\u5148\u3078\u9001\u3089\u305A\u306B\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002\u63A5\u7D9A\u5148 URL \u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { CREDENTIAL_REDIRECT_INIT, credentialRedirectMessage, isRedirectResponse };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunk5FNSZ5WN_cjs = require('./chunk-5FNSZ5WN.cjs');
|
|
3
4
|
var react = require('react');
|
|
4
5
|
var jose = require('jose');
|
|
5
6
|
var zod = require('zod');
|
|
@@ -413,6 +414,7 @@ function createVerifyAccessToken(deps) {
|
|
|
413
414
|
}
|
|
414
415
|
const fetchOptions = {
|
|
415
416
|
method: "POST",
|
|
417
|
+
...chunk5FNSZ5WN_cjs.CREDENTIAL_REDIRECT_INIT,
|
|
416
418
|
credentials: "omit",
|
|
417
419
|
headers: {
|
|
418
420
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
@@ -435,6 +437,9 @@ function createVerifyAccessToken(deps) {
|
|
|
435
437
|
}
|
|
436
438
|
};
|
|
437
439
|
}
|
|
440
|
+
if (chunk5FNSZ5WN_cjs.isRedirectResponse(response)) {
|
|
441
|
+
return { error: { code: errorCodes.NETWORK_ERROR, message: chunk5FNSZ5WN_cjs.credentialRedirectMessage(response) } };
|
|
442
|
+
}
|
|
438
443
|
const upstreamUnavailable = response.status === HTTP_TOO_MANY_REQUESTS || response.status >= HTTP_SERVER_ERROR_MIN && response.status < HTTP_SERVER_ERROR_LIMIT;
|
|
439
444
|
let introspectResponse;
|
|
440
445
|
try {
|
|
@@ -1394,7 +1399,7 @@ var FFID_ORGANIZATION_PROFILE_ERROR_CODES = {
|
|
|
1394
1399
|
};
|
|
1395
1400
|
|
|
1396
1401
|
// src/client/version-check.ts
|
|
1397
|
-
var SDK_VERSION = "
|
|
1402
|
+
var SDK_VERSION = "13.0.1";
|
|
1398
1403
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
1399
1404
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
1400
1405
|
function sdkHeaders() {
|
|
@@ -4263,6 +4268,7 @@ function createFFIDClient(config) {
|
|
|
4263
4268
|
if (authMode === "service-key") {
|
|
4264
4269
|
return {
|
|
4265
4270
|
...options,
|
|
4271
|
+
...chunk5FNSZ5WN_cjs.CREDENTIAL_REDIRECT_INIT,
|
|
4266
4272
|
credentials: "omit",
|
|
4267
4273
|
headers: {
|
|
4268
4274
|
...jsonContentTypeHeader(options.body),
|
|
@@ -4324,6 +4330,9 @@ function createFFIDClient(config) {
|
|
|
4324
4330
|
}
|
|
4325
4331
|
};
|
|
4326
4332
|
}
|
|
4333
|
+
if (fetchOptions.redirect === chunk5FNSZ5WN_cjs.CREDENTIAL_REDIRECT_INIT.redirect && chunk5FNSZ5WN_cjs.isRedirectResponse(response)) {
|
|
4334
|
+
return { error: { code: FFID_ERROR_CODES.NETWORK_ERROR, message: chunk5FNSZ5WN_cjs.credentialRedirectMessage(response) } };
|
|
4335
|
+
}
|
|
4327
4336
|
if (!authOverride && authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
4328
4337
|
const refreshResult = await refreshAccessToken();
|
|
4329
4338
|
if (!refreshResult.error) {
|
|
@@ -4674,16 +4683,16 @@ function createFFIDClient(config) {
|
|
|
4674
4683
|
cancelSubscription,
|
|
4675
4684
|
cancelPendingDowngrade,
|
|
4676
4685
|
previewPlanChange,
|
|
4677
|
-
/** @deprecated 10.0.0: per_seat (praxis) only;
|
|
4686
|
+
/** @deprecated 10.0.0: per_seat (praxis) only; kept while per_seat contracts exist */
|
|
4678
4687
|
previewSeatChange,
|
|
4679
4688
|
verifyAccessToken,
|
|
4680
4689
|
getSubscribeUrl,
|
|
4681
4690
|
redirectToSubscribe,
|
|
4682
4691
|
getChangePlanUrl,
|
|
4683
4692
|
redirectToChangePlan,
|
|
4684
|
-
/** @deprecated 10.0.0: per_seat (praxis) only;
|
|
4693
|
+
/** @deprecated 10.0.0: per_seat (praxis) only; kept while per_seat contracts exist */
|
|
4685
4694
|
getChangeSeatsUrl,
|
|
4686
|
-
/** @deprecated 10.0.0: per_seat (praxis) only;
|
|
4695
|
+
/** @deprecated 10.0.0: per_seat (praxis) only; kept while per_seat contracts exist */
|
|
4687
4696
|
redirectToChangeSeats,
|
|
4688
4697
|
getRecoverPaymentUrl,
|
|
4689
4698
|
redirectToRecoverPayment,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/shared/credential-redirect.ts
|
|
2
|
+
var CREDENTIAL_REDIRECT_INIT = { redirect: "manual" };
|
|
3
|
+
var HTTP_MOVED_PERMANENTLY = 301;
|
|
4
|
+
var HTTP_FOUND = 302;
|
|
5
|
+
var HTTP_SEE_OTHER = 303;
|
|
6
|
+
var HTTP_TEMPORARY_REDIRECT = 307;
|
|
7
|
+
var HTTP_PERMANENT_REDIRECT = 308;
|
|
8
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([
|
|
9
|
+
HTTP_MOVED_PERMANENTLY,
|
|
10
|
+
HTTP_FOUND,
|
|
11
|
+
HTTP_SEE_OTHER,
|
|
12
|
+
HTTP_TEMPORARY_REDIRECT,
|
|
13
|
+
HTTP_PERMANENT_REDIRECT
|
|
14
|
+
]);
|
|
15
|
+
function isRedirectResponse(response) {
|
|
16
|
+
return response.type === "opaqueredirect" || REDIRECT_STATUSES.has(response.status);
|
|
17
|
+
}
|
|
18
|
+
function credentialRedirectMessage(response) {
|
|
19
|
+
return `\u30B5\u30FC\u30D0\u30FC\u304C\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\uFF08status: ${response.status}\uFF09\u3092\u8FD4\u3057\u305F\u305F\u3081\u3001API \u30AD\u30FC\u3092\u8EE2\u9001\u5148\u3078\u9001\u3089\u305A\u306B\u4E2D\u65AD\u3057\u307E\u3057\u305F\u3002\u63A5\u7D9A\u5148 URL \u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { CREDENTIAL_REDIRECT_INIT, credentialRedirectMessage, isRedirectResponse };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunk5FNSZ5WN_cjs = require('./chunk-5FNSZ5WN.cjs');
|
|
3
4
|
var zod = require('zod');
|
|
4
5
|
var react = require('react');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -768,9 +769,9 @@ function createConsentClient(opts) {
|
|
|
768
769
|
return headers;
|
|
769
770
|
}
|
|
770
771
|
async function performFetch(url, init) {
|
|
772
|
+
let res;
|
|
771
773
|
try {
|
|
772
|
-
|
|
773
|
-
return { res };
|
|
774
|
+
res = await fetchImpl(url, init);
|
|
774
775
|
} catch (cause) {
|
|
775
776
|
if (isAbortError(cause)) {
|
|
776
777
|
return {
|
|
@@ -789,6 +790,14 @@ function createConsentClient(opts) {
|
|
|
789
790
|
)
|
|
790
791
|
};
|
|
791
792
|
}
|
|
793
|
+
if (chunk5FNSZ5WN_cjs.isRedirectResponse(res)) {
|
|
794
|
+
return {
|
|
795
|
+
err: new FFIDConsentError("cookie_consent_api_unreachable", chunk5FNSZ5WN_cjs.credentialRedirectMessage(res), {
|
|
796
|
+
httpStatus: res.status
|
|
797
|
+
})
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
return { res };
|
|
792
801
|
}
|
|
793
802
|
async function request(reqOpts, parseFn) {
|
|
794
803
|
const url = `${baseUrl}${reqOpts.path}`;
|
|
@@ -809,6 +818,7 @@ function createConsentClient(opts) {
|
|
|
809
818
|
}
|
|
810
819
|
const init = {
|
|
811
820
|
method: reqOpts.method,
|
|
821
|
+
...chunk5FNSZ5WN_cjs.CREDENTIAL_REDIRECT_INIT,
|
|
812
822
|
headers,
|
|
813
823
|
credentials: "include"
|
|
814
824
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CREDENTIAL_REDIRECT_INIT, isRedirectResponse, credentialRedirectMessage } from './chunk-IQSXIOPK.js';
|
|
1
2
|
import { createContext, useState, useRef, useEffect, useMemo, useCallback, useContext } from 'react';
|
|
2
3
|
import { createRemoteJWKSet, jwtVerify, errors } from 'jose';
|
|
3
4
|
import { z } from 'zod';
|
|
@@ -411,6 +412,7 @@ function createVerifyAccessToken(deps) {
|
|
|
411
412
|
}
|
|
412
413
|
const fetchOptions = {
|
|
413
414
|
method: "POST",
|
|
415
|
+
...CREDENTIAL_REDIRECT_INIT,
|
|
414
416
|
credentials: "omit",
|
|
415
417
|
headers: {
|
|
416
418
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
@@ -433,6 +435,9 @@ function createVerifyAccessToken(deps) {
|
|
|
433
435
|
}
|
|
434
436
|
};
|
|
435
437
|
}
|
|
438
|
+
if (isRedirectResponse(response)) {
|
|
439
|
+
return { error: { code: errorCodes.NETWORK_ERROR, message: credentialRedirectMessage(response) } };
|
|
440
|
+
}
|
|
436
441
|
const upstreamUnavailable = response.status === HTTP_TOO_MANY_REQUESTS || response.status >= HTTP_SERVER_ERROR_MIN && response.status < HTTP_SERVER_ERROR_LIMIT;
|
|
437
442
|
let introspectResponse;
|
|
438
443
|
try {
|
|
@@ -1392,7 +1397,7 @@ var FFID_ORGANIZATION_PROFILE_ERROR_CODES = {
|
|
|
1392
1397
|
};
|
|
1393
1398
|
|
|
1394
1399
|
// src/client/version-check.ts
|
|
1395
|
-
var SDK_VERSION = "
|
|
1400
|
+
var SDK_VERSION = "13.0.1";
|
|
1396
1401
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
1397
1402
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
1398
1403
|
function sdkHeaders() {
|
|
@@ -4261,6 +4266,7 @@ function createFFIDClient(config) {
|
|
|
4261
4266
|
if (authMode === "service-key") {
|
|
4262
4267
|
return {
|
|
4263
4268
|
...options,
|
|
4269
|
+
...CREDENTIAL_REDIRECT_INIT,
|
|
4264
4270
|
credentials: "omit",
|
|
4265
4271
|
headers: {
|
|
4266
4272
|
...jsonContentTypeHeader(options.body),
|
|
@@ -4322,6 +4328,9 @@ function createFFIDClient(config) {
|
|
|
4322
4328
|
}
|
|
4323
4329
|
};
|
|
4324
4330
|
}
|
|
4331
|
+
if (fetchOptions.redirect === CREDENTIAL_REDIRECT_INIT.redirect && isRedirectResponse(response)) {
|
|
4332
|
+
return { error: { code: FFID_ERROR_CODES.NETWORK_ERROR, message: credentialRedirectMessage(response) } };
|
|
4333
|
+
}
|
|
4325
4334
|
if (!authOverride && authMode === "token" && response.status === UNAUTHORIZED_STATUS2) {
|
|
4326
4335
|
const refreshResult = await refreshAccessToken();
|
|
4327
4336
|
if (!refreshResult.error) {
|
|
@@ -4672,16 +4681,16 @@ function createFFIDClient(config) {
|
|
|
4672
4681
|
cancelSubscription,
|
|
4673
4682
|
cancelPendingDowngrade,
|
|
4674
4683
|
previewPlanChange,
|
|
4675
|
-
/** @deprecated 10.0.0: per_seat (praxis) only;
|
|
4684
|
+
/** @deprecated 10.0.0: per_seat (praxis) only; kept while per_seat contracts exist */
|
|
4676
4685
|
previewSeatChange,
|
|
4677
4686
|
verifyAccessToken,
|
|
4678
4687
|
getSubscribeUrl,
|
|
4679
4688
|
redirectToSubscribe,
|
|
4680
4689
|
getChangePlanUrl,
|
|
4681
4690
|
redirectToChangePlan,
|
|
4682
|
-
/** @deprecated 10.0.0: per_seat (praxis) only;
|
|
4691
|
+
/** @deprecated 10.0.0: per_seat (praxis) only; kept while per_seat contracts exist */
|
|
4683
4692
|
getChangeSeatsUrl,
|
|
4684
|
-
/** @deprecated 10.0.0: per_seat (praxis) only;
|
|
4693
|
+
/** @deprecated 10.0.0: per_seat (praxis) only; kept while per_seat contracts exist */
|
|
4685
4694
|
redirectToChangeSeats,
|
|
4686
4695
|
getRecoverPaymentUrl,
|
|
4687
4696
|
redirectToRecoverPayment,
|