@feelflow/ffid-sdk 4.2.0 → 5.0.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/README.md +35 -0
- package/dist/FFIDCookieLink-B-9ggxsL.d.cts +864 -0
- package/dist/FFIDCookieLink-B-9ggxsL.d.ts +864 -0
- package/dist/chunk-CISVLEY5.js +1727 -0
- package/dist/{chunk-U4XDH7TI.cjs → chunk-CJA3XQUF.cjs} +36 -3
- package/dist/chunk-PAQ4GZXN.cjs +1787 -0
- package/dist/{chunk-WI645CPU.js → chunk-XAPFTOZN.js} +36 -3
- 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/consent/index.cjs +242 -0
- package/dist/consent/index.d.cts +166 -0
- package/dist/consent/index.d.ts +166 -0
- package/dist/consent/index.js +1 -0
- package/dist/{ffid-client-CUOFknXy.d.ts → ffid-client-BaStAONh.d.ts} +20 -1
- package/dist/{ffid-client-CKMGqqPi.d.cts → ffid-client-DgprK2ec.d.cts} +20 -1
- package/dist/{index-DXgTH5vK.d.cts → index-CInGR4I9.d.cts} +16 -1
- package/dist/{index-DXgTH5vK.d.ts → index-CInGR4I9.d.ts} +16 -1
- package/dist/index.cjs +97 -32
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +3 -2
- package/dist/server/index.cjs +134 -3
- package/dist/server/index.d.cts +151 -3
- package/dist/server/index.d.ts +151 -3
- package/dist/server/index.js +128 -4
- package/dist/server/test/index.d.cts +1 -1
- package/dist/server/test/index.d.ts +1 -1
- package/package.json +8 -2
|
@@ -708,6 +708,7 @@ function createSubscriptionMethods(deps) {
|
|
|
708
708
|
var EXT_MEMBERS_ENDPOINT = "/api/v1/organizations/ext/members";
|
|
709
709
|
function createMembersMethods(deps) {
|
|
710
710
|
const { fetchWithAuth, createError, serviceCode } = deps;
|
|
711
|
+
const assignableRoles = /* @__PURE__ */ new Set(["admin", "member", "viewer"]);
|
|
711
712
|
function buildQuery(organizationId) {
|
|
712
713
|
return new URLSearchParams({ organizationId, serviceCode }).toString();
|
|
713
714
|
}
|
|
@@ -721,6 +722,37 @@ function createMembersMethods(deps) {
|
|
|
721
722
|
`${EXT_MEMBERS_ENDPOINT}?${buildQuery(params.organizationId)}`
|
|
722
723
|
);
|
|
723
724
|
}
|
|
725
|
+
function normalizeAddMemberArgs(paramsOrOrganizationId, data) {
|
|
726
|
+
if (typeof paramsOrOrganizationId === "string") {
|
|
727
|
+
const params = {
|
|
728
|
+
organizationId: paramsOrOrganizationId,
|
|
729
|
+
email: data?.email ?? ""
|
|
730
|
+
};
|
|
731
|
+
if (data?.role !== void 0) params.role = data.role;
|
|
732
|
+
return params;
|
|
733
|
+
}
|
|
734
|
+
return paramsOrOrganizationId;
|
|
735
|
+
}
|
|
736
|
+
async function addMember(paramsOrOrganizationId, data) {
|
|
737
|
+
const params = normalizeAddMemberArgs(paramsOrOrganizationId, data);
|
|
738
|
+
if (!params.organizationId || !params.email) {
|
|
739
|
+
return {
|
|
740
|
+
error: createError("VALIDATION_ERROR", "organizationId \u3068 email \u306F\u5FC5\u9808\u3067\u3059")
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
if (params.role !== void 0 && !assignableRoles.has(params.role)) {
|
|
744
|
+
return {
|
|
745
|
+
error: createError("VALIDATION_ERROR", "role \u306F admin\u3001member\u3001viewer \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044")
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
return fetchWithAuth(
|
|
749
|
+
`${EXT_MEMBERS_ENDPOINT}?${buildQuery(params.organizationId)}`,
|
|
750
|
+
{
|
|
751
|
+
method: "POST",
|
|
752
|
+
body: JSON.stringify({ email: params.email, role: params.role })
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
}
|
|
724
756
|
async function updateMemberRole(params) {
|
|
725
757
|
if (!params.organizationId || !params.userId) {
|
|
726
758
|
return {
|
|
@@ -753,7 +785,7 @@ function createMembersMethods(deps) {
|
|
|
753
785
|
}
|
|
754
786
|
);
|
|
755
787
|
}
|
|
756
|
-
return { listMembers, updateMemberRole, removeMember };
|
|
788
|
+
return { listMembers, addMember, updateMemberRole, removeMember };
|
|
757
789
|
}
|
|
758
790
|
|
|
759
791
|
// src/client/profile-methods.ts
|
|
@@ -806,7 +838,7 @@ function createProfileMethods(deps) {
|
|
|
806
838
|
}
|
|
807
839
|
|
|
808
840
|
// src/client/version-check.ts
|
|
809
|
-
var SDK_VERSION = "
|
|
841
|
+
var SDK_VERSION = "5.0.0";
|
|
810
842
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
811
843
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
812
844
|
function sdkHeaders() {
|
|
@@ -2595,7 +2627,7 @@ function createFFIDClient(config) {
|
|
|
2595
2627
|
fetchWithAuth,
|
|
2596
2628
|
createError
|
|
2597
2629
|
});
|
|
2598
|
-
const { listMembers, updateMemberRole, removeMember } = createMembersMethods({
|
|
2630
|
+
const { listMembers, addMember, updateMemberRole, removeMember } = createMembersMethods({
|
|
2599
2631
|
fetchWithAuth,
|
|
2600
2632
|
createError,
|
|
2601
2633
|
serviceCode: config.serviceCode
|
|
@@ -2679,6 +2711,7 @@ function createFFIDClient(config) {
|
|
|
2679
2711
|
checkServiceAccess,
|
|
2680
2712
|
requireServiceAccess,
|
|
2681
2713
|
listMembers,
|
|
2714
|
+
addMember,
|
|
2682
2715
|
updateMemberRole,
|
|
2683
2716
|
removeMember,
|
|
2684
2717
|
getProfile,
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCJA3XQUF_cjs = require('../chunk-CJA3XQUF.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 chunkCJA3XQUF_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkCJA3XQUF_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkCJA3XQUF_cjs.FFIDInquiryForm; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkCJA3XQUF_cjs.FFIDLoginButton; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkCJA3XQUF_cjs.FFIDOrganizationSwitcher; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkCJA3XQUF_cjs.FFIDSubscriptionBadge; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkCJA3XQUF_cjs.FFIDUserMenu; }
|
|
34
34
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { S as FFIDAnnouncementBadge, av as FFIDAnnouncementBadgeClassNames, aw as FFIDAnnouncementBadgeProps, T as FFIDAnnouncementList, ax as FFIDAnnouncementListClassNames, ay as FFIDAnnouncementListProps, a0 as FFIDInquiryForm, a1 as FFIDInquiryFormCategoryItem, a2 as FFIDInquiryFormClassNames, a3 as FFIDInquiryFormLegalLayout, a4 as FFIDInquiryFormOrganization, a5 as FFIDInquiryFormPlaceholderContext, a6 as FFIDInquiryFormPrefill, a7 as FFIDInquiryFormProps, a8 as FFIDInquiryFormSubmitData, a9 as FFIDInquiryFormSubmitResult, ab as FFIDLoginButton, az as FFIDLoginButtonProps, ah as FFIDOrganizationSwitcher, aA as FFIDOrganizationSwitcherClassNames, aB as FFIDOrganizationSwitcherProps, am as FFIDSubscriptionBadge, aC as FFIDSubscriptionBadgeClassNames, aD as FFIDSubscriptionBadgeProps, ao as FFIDUserMenu, aE as FFIDUserMenuClassNames, aF as FFIDUserMenuProps } from '../index-CInGR4I9.cjs';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { S as FFIDAnnouncementBadge, av as FFIDAnnouncementBadgeClassNames, aw as FFIDAnnouncementBadgeProps, T as FFIDAnnouncementList, ax as FFIDAnnouncementListClassNames, ay as FFIDAnnouncementListProps, a0 as FFIDInquiryForm, a1 as FFIDInquiryFormCategoryItem, a2 as FFIDInquiryFormClassNames, a3 as FFIDInquiryFormLegalLayout, a4 as FFIDInquiryFormOrganization, a5 as FFIDInquiryFormPlaceholderContext, a6 as FFIDInquiryFormPrefill, a7 as FFIDInquiryFormProps, a8 as FFIDInquiryFormSubmitData, a9 as FFIDInquiryFormSubmitResult, ab as FFIDLoginButton, az as FFIDLoginButtonProps, ah as FFIDOrganizationSwitcher, aA as FFIDOrganizationSwitcherClassNames, aB as FFIDOrganizationSwitcherProps, am as FFIDSubscriptionBadge, aC as FFIDSubscriptionBadgeClassNames, aD as FFIDSubscriptionBadgeProps, ao as FFIDUserMenu, aE as FFIDUserMenuClassNames, aF as FFIDUserMenuProps } from '../index-CInGR4I9.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-
|
|
1
|
+
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-XAPFTOZN.js';
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPAQ4GZXN_cjs = require('../chunk-PAQ4GZXN.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "ALL_DENIED_EXCEPT_NECESSARY", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkPAQ4GZXN_cjs.ALL_DENIED_EXCEPT_NECESSARY; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "CONSENT_COOKIE_MAX_AGE_SEC", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkPAQ4GZXN_cjs.CONSENT_COOKIE_MAX_AGE_SEC; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "CONSENT_COOKIE_NAME", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkPAQ4GZXN_cjs.CONSENT_COOKIE_NAME; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "CONSENT_SESSION_STORAGE_KEY", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkPAQ4GZXN_cjs.CONSENT_SESSION_STORAGE_KEY; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "COOKIE_VERSION", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkPAQ4GZXN_cjs.COOKIE_VERSION; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "DEFAULT_CONSENT_ERROR_MESSAGES", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkPAQ4GZXN_cjs.DEFAULT_CONSENT_ERROR_MESSAGES; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "DEFAULT_MERGE_WARNING_MESSAGES", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkPAQ4GZXN_cjs.DEFAULT_MERGE_WARNING_MESSAGES; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "DEVICE_ID_LOCAL_STORAGE_KEY", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkPAQ4GZXN_cjs.DEVICE_ID_LOCAL_STORAGE_KEY; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "DEVICE_ID_SESSION_STORAGE_KEY", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkPAQ4GZXN_cjs.DEVICE_ID_SESSION_STORAGE_KEY; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "DeviceIdSchema", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkPAQ4GZXN_cjs.DeviceIdSchema; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "FFIDAnalyticsProvider", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDAnalyticsProvider; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "FFIDConsentCategoriesSchema", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentCategoriesSchema; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "FFIDConsentCategoryCodeSchema", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentCategoryCodeSchema; }
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "FFIDConsentCategoryMetadataSchema", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentCategoryMetadataSchema; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "FFIDConsentContext", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentContext; }
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "FFIDConsentError", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentError; }
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, "FFIDConsentMergeStrategySchema", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentMergeStrategySchema; }
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "FFIDConsentMergeWarningSchema", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentMergeWarningSchema; }
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "FFIDConsentSourceSchema", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentSourceSchema; }
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "FFIDConsentStateSchema", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentStateSchema; }
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "FFIDConsentUpdateSchema", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDConsentUpdateSchema; }
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "FFIDCookieBanner", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDCookieBanner; }
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "FFIDCookieLink", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDCookieLink; }
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(exports, "FFIDCookiePolicySchema", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDCookiePolicySchema; }
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "FFIDCookieSettings", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDCookieSettings; }
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(exports, "FFIDInternalConsentSourceSchema", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDInternalConsentSourceSchema; }
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(exports, "FFIDPublicConsentSourceSchema", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFIDPublicConsentSourceSchema; }
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(exports, "FFID_CONSENT_ERROR_CODES", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFID_CONSENT_ERROR_CODES; }
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(exports, "FFID_CONSENT_NOT_DECIDED_STATE", {
|
|
120
|
+
enumerable: true,
|
|
121
|
+
get: function () { return chunkPAQ4GZXN_cjs.FFID_CONSENT_NOT_DECIDED_STATE; }
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(exports, "GetCategoriesWireSchema", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () { return chunkPAQ4GZXN_cjs.GetCategoriesWireSchema; }
|
|
126
|
+
});
|
|
127
|
+
Object.defineProperty(exports, "GetConsentMeWireSchema", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function () { return chunkPAQ4GZXN_cjs.GetConsentMeWireSchema; }
|
|
130
|
+
});
|
|
131
|
+
Object.defineProperty(exports, "GetDocumentWireSchema", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () { return chunkPAQ4GZXN_cjs.GetDocumentWireSchema; }
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, "PostConsentRequestSchema", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () { return chunkPAQ4GZXN_cjs.PostConsentRequestSchema; }
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(exports, "PostConsentWireSchema", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function () { return chunkPAQ4GZXN_cjs.PostConsentWireSchema; }
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(exports, "PostSyncRequestSchema", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function () { return chunkPAQ4GZXN_cjs.PostSyncRequestSchema; }
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(exports, "PostSyncWireSchema", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () { return chunkPAQ4GZXN_cjs.PostSyncWireSchema; }
|
|
150
|
+
});
|
|
151
|
+
Object.defineProperty(exports, "PostWithdrawWireSchema", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () { return chunkPAQ4GZXN_cjs.PostWithdrawWireSchema; }
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(exports, "clearConsentSessionMirror", {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function () { return chunkPAQ4GZXN_cjs.clearConsentSessionMirror; }
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, "clearDeviceId", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () { return chunkPAQ4GZXN_cjs.clearDeviceId; }
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(exports, "createConsentClient", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function () { return chunkPAQ4GZXN_cjs.createConsentClient; }
|
|
166
|
+
});
|
|
167
|
+
Object.defineProperty(exports, "createGtagBridge", {
|
|
168
|
+
enumerable: true,
|
|
169
|
+
get: function () { return chunkPAQ4GZXN_cjs.createGtagBridge; }
|
|
170
|
+
});
|
|
171
|
+
Object.defineProperty(exports, "decodeConsentCookie", {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
get: function () { return chunkPAQ4GZXN_cjs.decodeConsentCookie; }
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(exports, "deleteConsentCookie", {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function () { return chunkPAQ4GZXN_cjs.deleteConsentCookie; }
|
|
178
|
+
});
|
|
179
|
+
Object.defineProperty(exports, "encodeConsentCookie", {
|
|
180
|
+
enumerable: true,
|
|
181
|
+
get: function () { return chunkPAQ4GZXN_cjs.encodeConsentCookie; }
|
|
182
|
+
});
|
|
183
|
+
Object.defineProperty(exports, "generateDeviceId", {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
get: function () { return chunkPAQ4GZXN_cjs.generateDeviceId; }
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(exports, "getOrCreateDeviceId", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function () { return chunkPAQ4GZXN_cjs.getOrCreateDeviceId; }
|
|
190
|
+
});
|
|
191
|
+
Object.defineProperty(exports, "isUuidV7", {
|
|
192
|
+
enumerable: true,
|
|
193
|
+
get: function () { return chunkPAQ4GZXN_cjs.isUuidV7; }
|
|
194
|
+
});
|
|
195
|
+
Object.defineProperty(exports, "isValidDeviceId", {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
get: function () { return chunkPAQ4GZXN_cjs.isValidDeviceId; }
|
|
198
|
+
});
|
|
199
|
+
Object.defineProperty(exports, "mapCategoriesToGtagParams", {
|
|
200
|
+
enumerable: true,
|
|
201
|
+
get: function () { return chunkPAQ4GZXN_cjs.mapCategoriesToGtagParams; }
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(exports, "mapConsentWireToState", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: function () { return chunkPAQ4GZXN_cjs.mapConsentWireToState; }
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(exports, "mapMeWireToState", {
|
|
208
|
+
enumerable: true,
|
|
209
|
+
get: function () { return chunkPAQ4GZXN_cjs.mapMeWireToState; }
|
|
210
|
+
});
|
|
211
|
+
Object.defineProperty(exports, "mapSyncWireToResult", {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function () { return chunkPAQ4GZXN_cjs.mapSyncWireToResult; }
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(exports, "mapWithdrawWireToState", {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: function () { return chunkPAQ4GZXN_cjs.mapWithdrawWireToState; }
|
|
218
|
+
});
|
|
219
|
+
Object.defineProperty(exports, "readConsentCookie", {
|
|
220
|
+
enumerable: true,
|
|
221
|
+
get: function () { return chunkPAQ4GZXN_cjs.readConsentCookie; }
|
|
222
|
+
});
|
|
223
|
+
Object.defineProperty(exports, "readConsentSessionMirror", {
|
|
224
|
+
enumerable: true,
|
|
225
|
+
get: function () { return chunkPAQ4GZXN_cjs.readConsentSessionMirror; }
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(exports, "useFFIDConsent", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function () { return chunkPAQ4GZXN_cjs.useFFIDConsent; }
|
|
230
|
+
});
|
|
231
|
+
Object.defineProperty(exports, "useFFIDConsentPreferences", {
|
|
232
|
+
enumerable: true,
|
|
233
|
+
get: function () { return chunkPAQ4GZXN_cjs.useFFIDConsentPreferences; }
|
|
234
|
+
});
|
|
235
|
+
Object.defineProperty(exports, "writeConsentCookie", {
|
|
236
|
+
enumerable: true,
|
|
237
|
+
get: function () { return chunkPAQ4GZXN_cjs.writeConsentCookie; }
|
|
238
|
+
});
|
|
239
|
+
Object.defineProperty(exports, "writeConsentSessionMirror", {
|
|
240
|
+
enumerable: true,
|
|
241
|
+
get: function () { return chunkPAQ4GZXN_cjs.writeConsentSessionMirror; }
|
|
242
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { F as FFIDConsentResult, a as FFIDConsentState, b as FFIDConsentUpdate, c as FFIDConsentCategories, d as FFIDConsentSyncResult, e as FFIDConsentCategoryMetadata, f as FFIDCookiePolicy, P as PostConsentWire, G as GetConsentMeWire, g as PostSyncWire, h as PostWithdrawWire } from '../FFIDCookieLink-B-9ggxsL.cjs';
|
|
2
|
+
export { A as ALL_DENIED_EXCEPT_NECESSARY, C as CONSENT_COOKIE_MAX_AGE_SEC, i as CONSENT_COOKIE_NAME, j as CONSENT_SESSION_STORAGE_KEY, k as COOKIE_VERSION, D as DEFAULT_CONSENT_ERROR_MESSAGES, l as DEFAULT_MERGE_WARNING_MESSAGES, m as DeviceIdSchema, n as FFIDAnalyticsProvider, o as FFIDAnalyticsProviderProps, p as FFIDConsentCategoriesSchema, q as FFIDConsentCategoryCode, r as FFIDConsentCategoryCodeSchema, s as FFIDConsentCategoryMetadataSchema, t as FFIDConsentContext, u as FFIDConsentContextValue, v as FFIDConsentError, w as FFIDConsentErrorCode, x as FFIDConsentMergeStrategy, y as FFIDConsentMergeStrategySchema, z as FFIDConsentMergeWarning, B as FFIDConsentMergeWarningSchema, E as FFIDConsentSource, H as FFIDConsentSourceSchema, I as FFIDConsentStateSchema, J as FFIDConsentUpdateSchema, K as FFIDCookieBanner, L as FFIDCookieBannerClassNames, M as FFIDCookieBannerProps, N as FFIDCookieLink, O as FFIDCookieLinkProps, Q as FFIDCookiePolicySchema, R as FFIDCookieSettings, S as FFIDCookieSettingsClassNames, T as FFIDCookieSettingsProps, U as FFIDInternalConsentSource, V as FFIDInternalConsentSourceSchema, W as FFIDPublicConsentSource, X as FFIDPublicConsentSourceSchema, Y as FFID_CONSENT_ERROR_CODES, Z as FFID_CONSENT_NOT_DECIDED_STATE, _ as GetCategoriesWire, $ as GetCategoriesWireSchema, a0 as GetConsentMeWireSchema, a1 as GetDocumentWire, a2 as GetDocumentWireSchema, a3 as GtagBridge, a4 as GtagBridgeOptions, a5 as PostConsentRequest, a6 as PostConsentRequestSchema, a7 as PostConsentWireSchema, a8 as PostSyncRequest, a9 as PostSyncRequestSchema, aa as PostSyncWireSchema, ab as PostWithdrawWireSchema, ac as UseFFIDConsentPreferencesReturn, ad as UseFFIDConsentReturn, ae as clearConsentSessionMirror, af as createGtagBridge, ag as decodeConsentCookie, ah as deleteConsentCookie, ai as encodeConsentCookie, aj as mapCategoriesToGtagParams, ak as readConsentCookie, al as readConsentSessionMirror, am as useFFIDConsent, an as useFFIDConsentPreferences, ao as writeConsentCookie, ap as writeConsentSessionMirror } from '../FFIDCookieLink-B-9ggxsL.cjs';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Cookie Consent — Device ID generation and persistence.
|
|
8
|
+
*
|
|
9
|
+
* Spec §5.3 / §6.5:
|
|
10
|
+
* - 36-char UUIDv7 (time-ordered) stored in `localStorage:ffid_device_id`
|
|
11
|
+
* - sessionStorage ephemeral fallback when localStorage is unavailable
|
|
12
|
+
* (Safari Private Browsing, ITP cookie partition edge cases, etc.)
|
|
13
|
+
* - Server validates against `DeviceIdSchema` (UUIDv4 or UUIDv7 accepted).
|
|
14
|
+
*
|
|
15
|
+
* UUIDv7 layout (RFC 9562):
|
|
16
|
+
* - 48 bits: unix milliseconds (big-endian)
|
|
17
|
+
* - 4 bits: version (0b0111)
|
|
18
|
+
* - 12 bits: random
|
|
19
|
+
* - 2 bits: variant (0b10)
|
|
20
|
+
* - 62 bits: random
|
|
21
|
+
*
|
|
22
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §5.3, §6.5
|
|
23
|
+
*/
|
|
24
|
+
declare const DEVICE_ID_LOCAL_STORAGE_KEY = "ffid_device_id";
|
|
25
|
+
declare const DEVICE_ID_SESSION_STORAGE_KEY = "ffid_device_id_ephemeral";
|
|
26
|
+
/**
|
|
27
|
+
* Generate a UUIDv7 string. Falls back to crypto.randomUUID() (v4) if
|
|
28
|
+
* `crypto.getRandomValues` is unavailable.
|
|
29
|
+
*/
|
|
30
|
+
declare function generateDeviceId(): string;
|
|
31
|
+
declare function isValidDeviceId(id: string): boolean;
|
|
32
|
+
declare function isUuidV7(id: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Return existing device ID or create + persist a new one.
|
|
35
|
+
*
|
|
36
|
+
* Persistence order: localStorage (preferred) → sessionStorage (ephemeral
|
|
37
|
+
* fallback). If neither is available the ID is still returned but not
|
|
38
|
+
* persisted; the caller can pass it in headers but each call will get a fresh
|
|
39
|
+
* value (acceptable degradation per spec §5.3).
|
|
40
|
+
*
|
|
41
|
+
* Falling through to ephemeral triggers a one-time `console.warn` so the
|
|
42
|
+
* operator can debug Safari Private Browsing / quota / ITP cases without
|
|
43
|
+
* silently breaking the shared-device merge UX.
|
|
44
|
+
*/
|
|
45
|
+
declare function getOrCreateDeviceId(): string;
|
|
46
|
+
/** Clear all stored device IDs (used by full withdrawal flows + tests). */
|
|
47
|
+
declare function clearDeviceId(): void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Cookie Consent — FFID API client (6 endpoints, Zod-validated).
|
|
51
|
+
*
|
|
52
|
+
* All responses are safe-parsed against `*WireSchema`. Parse failures or
|
|
53
|
+
* network errors are mapped to `FFIDConsentError` so consumers receive a
|
|
54
|
+
* uniform error surface via `Result<T>` returns.
|
|
55
|
+
*
|
|
56
|
+
* **HTTP 429 auto-retry** (spec §5.6): one transparent retry with
|
|
57
|
+
* `Retry-After + ±20% jitter`. On the second 429 (or any other error) the
|
|
58
|
+
* mapped `FFIDConsentError` surfaces to `Result.error`.
|
|
59
|
+
*
|
|
60
|
+
* Auth:
|
|
61
|
+
* - `X-Service-Api-Key`: required for all endpoints (spec §5.2).
|
|
62
|
+
* - `X-FFID-Device-Id`: required for write paths (`/consent`, `/sync`,
|
|
63
|
+
* `/withdraw`) and recommended for reads.
|
|
64
|
+
* - `Authorization: Bearer <jwt>`: required only for `/sync`; optional for
|
|
65
|
+
* other endpoints. When present, server links the row to the user_id.
|
|
66
|
+
*
|
|
67
|
+
* Refs: docs/02-design/COOKIE_CONSENT.md §5 + §8
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
interface ConsentClientOptions {
|
|
71
|
+
/** FFID API base URL, e.g., `https://id.feelflow.net`. */
|
|
72
|
+
baseUrl: string;
|
|
73
|
+
/**
|
|
74
|
+
* Service API key that scopes this client to a registered FFID service.
|
|
75
|
+
* Surfaced through the `X-Service-Api-Key` header on every request.
|
|
76
|
+
*/
|
|
77
|
+
serviceApiKey: string;
|
|
78
|
+
/** Resolves the current Bearer token, or null when the user is logged out. */
|
|
79
|
+
getAccessToken?: () => string | null | Promise<string | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Resolves the device ID (UUIDv7). MUST return a non-empty string; the
|
|
82
|
+
* SDK throws `auth_failure` if this returns empty (state-not-ready guard).
|
|
83
|
+
*/
|
|
84
|
+
getDeviceId: () => string;
|
|
85
|
+
/**
|
|
86
|
+
* Optional fetch implementation override. Defaults to global `fetch`.
|
|
87
|
+
* Useful for SSR contexts and tests.
|
|
88
|
+
*/
|
|
89
|
+
fetchImpl?: typeof fetch;
|
|
90
|
+
/**
|
|
91
|
+
* Optional language code for `/categories` and `/document` (defaults to 'ja').
|
|
92
|
+
* The server falls back to JA when EN content is missing.
|
|
93
|
+
*/
|
|
94
|
+
defaultLang?: 'ja' | 'en';
|
|
95
|
+
/**
|
|
96
|
+
* Maximum number of auto-retries on HTTP 429 (default: 1, per spec §5.6).
|
|
97
|
+
* Set to 0 to disable.
|
|
98
|
+
*/
|
|
99
|
+
maxAutoRetry429?: number;
|
|
100
|
+
}
|
|
101
|
+
interface FFIDConsentClient {
|
|
102
|
+
/** `GET /api/v1/ext/consent/me` */
|
|
103
|
+
getMe(signal?: AbortSignal): Promise<FFIDConsentResult<FFIDConsentState>>;
|
|
104
|
+
/** `POST /api/v1/ext/consent` (banner / preference_center submit) */
|
|
105
|
+
submit(categories: Required<FFIDConsentUpdate>, source: 'banner' | 'preference_center', cookiePolicyVersion: string, signal?: AbortSignal): Promise<FFIDConsentResult<FFIDConsentState>>;
|
|
106
|
+
/** `POST /api/v1/ext/consent/sync` */
|
|
107
|
+
sync(localConsent: (FFIDConsentCategories & {
|
|
108
|
+
cookiePolicyVersion: string;
|
|
109
|
+
}) | null, signal?: AbortSignal): Promise<FFIDConsentResult<FFIDConsentSyncResult>>;
|
|
110
|
+
/** `POST /api/v1/ext/consent/withdraw` */
|
|
111
|
+
withdraw(signal?: AbortSignal): Promise<FFIDConsentResult<FFIDConsentState>>;
|
|
112
|
+
/** `GET /api/v1/ext/consent/categories` */
|
|
113
|
+
getCategories(lang?: 'ja' | 'en', signal?: AbortSignal): Promise<FFIDConsentResult<FFIDConsentCategoryMetadata[]>>;
|
|
114
|
+
/** `GET /api/v1/ext/consent/document` */
|
|
115
|
+
getDocument(lang?: 'ja' | 'en', signal?: AbortSignal): Promise<FFIDConsentResult<FFIDCookiePolicy>>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Factory function returning a configured client. Idiomatic to the rest of
|
|
119
|
+
* the SDK (see `createFFIDClient`, `createKVCacheAdapter` etc.) — avoids
|
|
120
|
+
* exposing a class so the API surface stays narrow.
|
|
121
|
+
*/
|
|
122
|
+
declare function createConsentClient(opts: ConsentClientOptions): FFIDConsentClient;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Cookie Consent — wire ↔ consumer type mappers.
|
|
126
|
+
*
|
|
127
|
+
* Routes return snake_case envelopes ("wire" types); React consumers expect
|
|
128
|
+
* the camelCase discriminated union (`FFIDConsentState`, see spec §6.4).
|
|
129
|
+
* Map at the SDK boundary so consumer code never touches snake_case keys.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Convert `GET /me` wire response to the SDK consumer's discriminated union.
|
|
134
|
+
*
|
|
135
|
+
* When `consent` is null the server hasn't recorded any decision yet — emit
|
|
136
|
+
* the "no decision" branch with `default_state` (or hard-coded default-deny)
|
|
137
|
+
* as the categories.
|
|
138
|
+
*
|
|
139
|
+
* When `consent` is non-null but the server doesn't surface the original
|
|
140
|
+
* source (spec §6.4 wire schema omits `source` on `/me`), we report
|
|
141
|
+
* `persisted_unknown` to signal "decision is on file but its origin label is
|
|
142
|
+
* not available" — distinct from `sdk_default` which means "no decision yet".
|
|
143
|
+
*/
|
|
144
|
+
declare function mapMeWireToState(wire: GetConsentMeWire): FFIDConsentState;
|
|
145
|
+
/**
|
|
146
|
+
* Convert a `POST /consent` response into a consumer state. The submission
|
|
147
|
+
* `source` is supplied by the caller because the wire envelope echoes the
|
|
148
|
+
* stored row but not the original `source` field.
|
|
149
|
+
*/
|
|
150
|
+
declare function mapConsentWireToState(wire: PostConsentWire, source: 'banner' | 'preference_center'): FFIDConsentState;
|
|
151
|
+
/**
|
|
152
|
+
* Convert a `POST /withdraw` response into a consumer state. Withdrawal sets
|
|
153
|
+
* all optional categories to false (DB CHECK invariant per spec §4.1).
|
|
154
|
+
*/
|
|
155
|
+
declare function mapWithdrawWireToState(wire: PostWithdrawWire): FFIDConsentState;
|
|
156
|
+
/**
|
|
157
|
+
* Convert a `POST /sync` response into the structured sync result. SDK
|
|
158
|
+
* consumers should always read `warning` and surface non-null values to the
|
|
159
|
+
* user per spec §5.3 (silent merge forbidden).
|
|
160
|
+
*
|
|
161
|
+
* `wire.merge_strategy` and `wire.warning` are already typed via Zod-derived
|
|
162
|
+
* `PostSyncWire`, so no `as` cast is needed at this boundary.
|
|
163
|
+
*/
|
|
164
|
+
declare function mapSyncWireToResult(wire: PostSyncWire): FFIDConsentSyncResult;
|
|
165
|
+
|
|
166
|
+
export { type ConsentClientOptions, DEVICE_ID_LOCAL_STORAGE_KEY, DEVICE_ID_SESSION_STORAGE_KEY, FFIDConsentCategories, FFIDConsentCategoryMetadata, type FFIDConsentClient, FFIDConsentResult, FFIDConsentState, FFIDConsentSyncResult, FFIDConsentUpdate, FFIDCookiePolicy, GetConsentMeWire, PostConsentWire, PostSyncWire, PostWithdrawWire, clearDeviceId, createConsentClient, generateDeviceId, getOrCreateDeviceId, isUuidV7, isValidDeviceId, mapConsentWireToState, mapMeWireToState, mapSyncWireToResult, mapWithdrawWireToState };
|