@firecms/core 3.0.0-canary.83 → 3.0.0-canary.85
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/hooks/useProjectLog.d.ts +2 -2
- package/dist/index.es.js +23 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +23 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/datasource.d.ts +9 -6
- package/package.json +11 -11
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -0
- package/src/components/EntityPreview.tsx +1 -0
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +1 -1
- package/src/core/FireCMS.tsx +1 -1
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/hooks/data/useDataSource.tsx +1 -1
- package/src/hooks/useProjectLog.tsx +18 -7
- package/src/internal/useBuildDataSource.ts +2 -2
- package/src/types/auth.tsx +1 -1
- package/src/types/collections.ts +1 -1
- package/src/types/datasource.ts +12 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AuthController, FireCMSPlugin } from "../types";
|
|
1
|
+
import { AuthController, DataSourceDelegate, FireCMSPlugin } from "../types";
|
|
2
2
|
export declare const DEFAULT_SERVER_DEV = "https://api-kdoe6pj3qq-ey.a.run.app";
|
|
3
3
|
export declare const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
|
|
4
4
|
export type AccessResponse = {
|
|
5
5
|
blocked?: boolean;
|
|
6
6
|
message?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function useProjectLog(authController: AuthController, plugins?: FireCMSPlugin<any, any, any>[]): AccessResponse | null;
|
|
8
|
+
export declare function useProjectLog(authController: AuthController, dataSourceDelegate: DataSourceDelegate, plugins?: FireCMSPlugin<any, any, any>[]): AccessResponse | null;
|
package/dist/index.es.js
CHANGED
|
@@ -5169,6 +5169,7 @@ const EntityPreviewContainerInner = React.forwardRef(({
|
|
|
5169
5169
|
},
|
|
5170
5170
|
className: cls(
|
|
5171
5171
|
"bg-white dark:bg-gray-900",
|
|
5172
|
+
"min-h-[42px]",
|
|
5172
5173
|
fullwidth ? "w-full" : "",
|
|
5173
5174
|
"items-center",
|
|
5174
5175
|
hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
|
|
@@ -7141,6 +7142,7 @@ const TableReferenceFieldSuccess = React__default.memo(
|
|
|
7141
7142
|
updateValue(entity ? getReferenceFrom(entity) : null);
|
|
7142
7143
|
}, [updateValue]);
|
|
7143
7144
|
const onMultipleEntitiesSelected = useCallback((entities) => {
|
|
7145
|
+
console.log("onMultipleEntitiesSelected", entities);
|
|
7144
7146
|
updateValue(entities.map((e) => getReferenceFrom(e)));
|
|
7145
7147
|
}, [updateValue]);
|
|
7146
7148
|
const selectedEntityIds = internalValue ? Array.isArray(internalValue) ? internalValue.map((ref) => ref.id) : internalValue.id ? [internalValue.id] : [] : [];
|
|
@@ -14628,7 +14630,7 @@ function DateTimeFieldBinding({
|
|
|
14628
14630
|
DateTimeField,
|
|
14629
14631
|
{
|
|
14630
14632
|
value: internalValue,
|
|
14631
|
-
onChange: (dateValue) => setValue(dateValue
|
|
14633
|
+
onChange: (dateValue) => setValue(dateValue),
|
|
14632
14634
|
size: "medium",
|
|
14633
14635
|
mode: property.mode,
|
|
14634
14636
|
clearable: property.clearable,
|
|
@@ -19167,7 +19169,7 @@ function useBuildDataSource({
|
|
|
19167
19169
|
inputValues: firestoreValues,
|
|
19168
19170
|
properties,
|
|
19169
19171
|
status,
|
|
19170
|
-
timestampNowValue: delegate.currentTime(),
|
|
19172
|
+
timestampNowValue: delegate.currentTime?.() ?? /* @__PURE__ */ new Date(),
|
|
19171
19173
|
setDateToMidnight: delegate.setDateToMidnight
|
|
19172
19174
|
}
|
|
19173
19175
|
) : firestoreValues;
|
|
@@ -19223,7 +19225,7 @@ function useBuildDataSource({
|
|
|
19223
19225
|
filter,
|
|
19224
19226
|
orderBy,
|
|
19225
19227
|
order,
|
|
19226
|
-
isCollectionGroup: Boolean(collection.collectionGroup)
|
|
19228
|
+
isCollectionGroup: Boolean(collection.collectionGroup)
|
|
19227
19229
|
});
|
|
19228
19230
|
} : void 0,
|
|
19229
19231
|
isFilterCombinationValid: useCallback(({
|
|
@@ -19249,8 +19251,13 @@ function useBuildDataSource({
|
|
|
19249
19251
|
};
|
|
19250
19252
|
}
|
|
19251
19253
|
const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
|
|
19252
|
-
async function makeRequest(authController, pluginKeys) {
|
|
19253
|
-
|
|
19254
|
+
async function makeRequest(authController, dataSourceKey, pluginKeys) {
|
|
19255
|
+
let idToken;
|
|
19256
|
+
try {
|
|
19257
|
+
idToken = await authController.getAuthToken();
|
|
19258
|
+
} catch (e) {
|
|
19259
|
+
idToken = null;
|
|
19260
|
+
}
|
|
19254
19261
|
return fetch(
|
|
19255
19262
|
DEFAULT_SERVER + "/access_log",
|
|
19256
19263
|
{
|
|
@@ -19258,24 +19265,29 @@ async function makeRequest(authController, pluginKeys) {
|
|
|
19258
19265
|
method: "POST",
|
|
19259
19266
|
headers: {
|
|
19260
19267
|
"Content-Type": "application/json",
|
|
19261
|
-
Authorization: `Basic ${
|
|
19268
|
+
Authorization: `Basic ${idToken}`
|
|
19262
19269
|
},
|
|
19263
|
-
body: JSON.stringify({
|
|
19270
|
+
body: JSON.stringify({
|
|
19271
|
+
email: authController.user?.email ?? null,
|
|
19272
|
+
datasource: dataSourceKey,
|
|
19273
|
+
plugins: pluginKeys
|
|
19274
|
+
})
|
|
19264
19275
|
}
|
|
19265
19276
|
).then(async (res) => {
|
|
19266
19277
|
return res.json();
|
|
19267
19278
|
});
|
|
19268
19279
|
}
|
|
19269
|
-
function useProjectLog(authController, plugins) {
|
|
19280
|
+
function useProjectLog(authController, dataSourceDelegate, plugins) {
|
|
19270
19281
|
const [accessResponse, setAccessResponse] = useState(null);
|
|
19271
19282
|
const accessedUserRef = useRef(null);
|
|
19283
|
+
const dataSourceKey = dataSourceDelegate.key;
|
|
19272
19284
|
const pluginKeys = plugins?.map((plugin) => plugin.key);
|
|
19273
19285
|
useEffect(() => {
|
|
19274
19286
|
if (authController.user && authController.user.uid !== accessedUserRef.current && !authController.initialLoading) {
|
|
19275
|
-
makeRequest(authController, pluginKeys).then(setAccessResponse);
|
|
19287
|
+
makeRequest(authController, dataSourceKey, pluginKeys).then(setAccessResponse);
|
|
19276
19288
|
accessedUserRef.current = authController.user.uid;
|
|
19277
19289
|
}
|
|
19278
|
-
}, [authController, pluginKeys]);
|
|
19290
|
+
}, [authController, dataSourceKey, pluginKeys]);
|
|
19279
19291
|
return accessResponse;
|
|
19280
19292
|
}
|
|
19281
19293
|
function FireCMS(props) {
|
|
@@ -19317,7 +19329,7 @@ function FireCMS(props) {
|
|
|
19317
19329
|
const analyticsController = useMemo(() => ({
|
|
19318
19330
|
onAnalyticsEvent
|
|
19319
19331
|
}), []);
|
|
19320
|
-
const accessResponse = useProjectLog(authController, plugins);
|
|
19332
|
+
const accessResponse = useProjectLog(authController, dataSourceDelegate, plugins);
|
|
19321
19333
|
if (navigationController.navigationLoadingError) {
|
|
19322
19334
|
return /* @__PURE__ */ jsx(CenteredView, { maxWidth: "md", children: /* @__PURE__ */ jsx(
|
|
19323
19335
|
ErrorView,
|