@momentumcms/plugins-analytics 0.2.0 → 0.4.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/index.cjs +9 -3
- package/index.js +9 -3
- package/lib/analytics-admin-routes.cjs +2043 -0
- package/lib/analytics-admin-routes.js +2130 -0
- package/lib/client/tracker.cjs +541 -0
- package/lib/client/tracker.js +523 -0
- package/lib/collectors/block-field-injector.cjs +206 -0
- package/lib/collectors/block-field-injector.js +179 -0
- package/package.json +60 -55
- package/src/lib/analytics-admin-routes.d.ts +3 -0
- package/CHANGELOG.md +0 -88
- package/LICENSE +0 -21
package/index.cjs
CHANGED
|
@@ -36,6 +36,10 @@ __export(block_tracker_exports, {
|
|
|
36
36
|
attachBlockTracking: () => attachBlockTracking
|
|
37
37
|
});
|
|
38
38
|
function attachBlockTracking(tracker, container) {
|
|
39
|
+
if (typeof document === "undefined" || !document.body) {
|
|
40
|
+
return () => {
|
|
41
|
+
};
|
|
42
|
+
}
|
|
39
43
|
const root = container ?? document.body;
|
|
40
44
|
const impressionsSeen = /* @__PURE__ */ new Set();
|
|
41
45
|
const hoverCooldowns = /* @__PURE__ */ new Map();
|
|
@@ -949,6 +953,9 @@ var MediaCollection = defineCollection({
|
|
|
949
953
|
singular: "Media",
|
|
950
954
|
plural: "Media"
|
|
951
955
|
},
|
|
956
|
+
upload: {
|
|
957
|
+
mimeTypes: ["image/*", "application/pdf", "video/*", "audio/*"]
|
|
958
|
+
},
|
|
952
959
|
admin: {
|
|
953
960
|
useAsTitle: "filename",
|
|
954
961
|
defaultColumns: ["filename", "mimeType", "filesize", "createdAt"]
|
|
@@ -969,7 +976,6 @@ var MediaCollection = defineCollection({
|
|
|
969
976
|
description: "File size in bytes"
|
|
970
977
|
}),
|
|
971
978
|
text("path", {
|
|
972
|
-
required: true,
|
|
973
979
|
label: "Storage Path",
|
|
974
980
|
description: "Path/key where the file is stored",
|
|
975
981
|
admin: {
|
|
@@ -2084,11 +2090,11 @@ function analyticsPlugin(config) {
|
|
|
2084
2090
|
// Browser-safe import paths for the admin config generator
|
|
2085
2091
|
browserImports: {
|
|
2086
2092
|
adminRoutes: {
|
|
2087
|
-
path: "@momentumcms/plugins
|
|
2093
|
+
path: "@momentumcms/plugins-analytics/admin-routes",
|
|
2088
2094
|
exportName: "analyticsAdminRoutes"
|
|
2089
2095
|
},
|
|
2090
2096
|
modifyCollections: {
|
|
2091
|
-
path: "@momentumcms/plugins
|
|
2097
|
+
path: "@momentumcms/plugins-analytics/block-fields",
|
|
2092
2098
|
exportName: "injectBlockAnalyticsFields"
|
|
2093
2099
|
}
|
|
2094
2100
|
},
|
package/index.js
CHANGED
|
@@ -14,6 +14,10 @@ __export(block_tracker_exports, {
|
|
|
14
14
|
attachBlockTracking: () => attachBlockTracking
|
|
15
15
|
});
|
|
16
16
|
function attachBlockTracking(tracker, container) {
|
|
17
|
+
if (typeof document === "undefined" || !document.body) {
|
|
18
|
+
return () => {
|
|
19
|
+
};
|
|
20
|
+
}
|
|
17
21
|
const root = container ?? document.body;
|
|
18
22
|
const impressionsSeen = /* @__PURE__ */ new Set();
|
|
19
23
|
const hoverCooldowns = /* @__PURE__ */ new Map();
|
|
@@ -904,6 +908,9 @@ var MediaCollection = defineCollection({
|
|
|
904
908
|
singular: "Media",
|
|
905
909
|
plural: "Media"
|
|
906
910
|
},
|
|
911
|
+
upload: {
|
|
912
|
+
mimeTypes: ["image/*", "application/pdf", "video/*", "audio/*"]
|
|
913
|
+
},
|
|
907
914
|
admin: {
|
|
908
915
|
useAsTitle: "filename",
|
|
909
916
|
defaultColumns: ["filename", "mimeType", "filesize", "createdAt"]
|
|
@@ -924,7 +931,6 @@ var MediaCollection = defineCollection({
|
|
|
924
931
|
description: "File size in bytes"
|
|
925
932
|
}),
|
|
926
933
|
text("path", {
|
|
927
|
-
required: true,
|
|
928
934
|
label: "Storage Path",
|
|
929
935
|
description: "Path/key where the file is stored",
|
|
930
936
|
admin: {
|
|
@@ -2052,11 +2058,11 @@ function analyticsPlugin(config) {
|
|
|
2052
2058
|
// Browser-safe import paths for the admin config generator
|
|
2053
2059
|
browserImports: {
|
|
2054
2060
|
adminRoutes: {
|
|
2055
|
-
path: "@momentumcms/plugins
|
|
2061
|
+
path: "@momentumcms/plugins-analytics/admin-routes",
|
|
2056
2062
|
exportName: "analyticsAdminRoutes"
|
|
2057
2063
|
},
|
|
2058
2064
|
modifyCollections: {
|
|
2059
|
-
path: "@momentumcms/plugins
|
|
2065
|
+
path: "@momentumcms/plugins-analytics/block-fields",
|
|
2060
2066
|
exportName: "injectBlockAnalyticsFields"
|
|
2061
2067
|
}
|
|
2062
2068
|
},
|