opscms-analytics-plugin 1.0.1 → 1.0.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.3
4
+
5
+ The GA4 server secret is readable again by the ga4-send-event action: the field returned the mask to every caller, so server events would have been sent with "••••••••" as the API secret. It now gives the real value, decrypted, to the one caller that asks for it (context.preventMasking) and the mask to everyone else. No database change.
6
+
7
+ ## 1.0.2
8
+
9
+ The plugin's release list names 1.0.1, so the version the admin shows is the package's. No other change.
10
+
3
11
  ## 1.0.1
4
12
 
5
13
  A site admin's tracking ID, Tag Manager ID and server address are checked when saved: each must have the shape a real one has, so nothing that could end a string or a tag in the inline snippet is accepted (the server address must be https, with no login in it). Empty stays allowed.
package/dist/index.js CHANGED
@@ -64,6 +64,27 @@ function serverUrlProblem(value) {
64
64
 
65
65
  // src/AnalyticsIntegrations.ts
66
66
  var ANALYTICS_INTEGRATIONS = "analytics-integrations";
67
+ function apiSecretField() {
68
+ const field = (0, import_opscms_sdk.secretField)(ANALYTICS_INTEGRATIONS, "apiSecret", {
69
+ label: "API secret",
70
+ description: "Server secret: the GA4 Measurement Protocol API secret.",
71
+ condition: (_data, siblingData) => siblingData?.provider === "google"
72
+ });
73
+ return {
74
+ ...field,
75
+ hooks: {
76
+ ...field.hooks,
77
+ afterRead: [
78
+ ({ value, req, context }) => {
79
+ if (typeof value !== "string" || !value) return value;
80
+ const asked = (req?.context ?? context)?.preventMasking === true;
81
+ if (!asked) return import_opscms_sdk.SETTINGS_MASK;
82
+ return value.startsWith("enc:") ? (0, import_opscms_sdk.platform)().secrets.decrypt(value) : value;
83
+ }
84
+ ]
85
+ }
86
+ };
87
+ }
67
88
  var onlySuperAdminField = ({ req }) => req?.user?.role === "super-admin";
68
89
  var AnalyticsIntegrations = {
69
90
  slug: ANALYTICS_INTEGRATIONS,
@@ -123,11 +144,7 @@ var AnalyticsIntegrations = {
123
144
  // Server-side secret: the GA4 Measurement Protocol api_secret. Encrypted at rest under the site's key and shown masked; the real value is read only by the
124
145
  // ga4-send-event workflow action, which asks for it explicitly (`context.preventMasking`). Anyone else, an anonymous request to the platform's public content
125
146
  // delivery API included, gets the mask: the field fails CLOSED.
126
- (0, import_opscms_sdk.secretField)(ANALYTICS_INTEGRATIONS, "apiSecret", {
127
- label: "API secret",
128
- description: "Server secret: the GA4 Measurement Protocol API secret.",
129
- condition: (_data, siblingData) => siblingData?.provider === "google"
130
- }),
147
+ apiSecretField(),
131
148
  {
132
149
  name: "serverUrl",
133
150
  type: "text",
@@ -193,6 +210,25 @@ var analyticsManifest = (0, import_opscms_sdk2.definePluginManifest)({
193
210
  category: "analytics",
194
211
  icon: "icon.svg",
195
212
  releases: [
213
+ {
214
+ version: "1.0.3",
215
+ date: "2026-11-17",
216
+ notes: ['The GA4 server secret is readable again by the ga4-send-event action: the field returned the mask to every caller, so server events would have been sent with "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" as the API secret. It now gives the real value, decrypted, to the one caller that asks for it (context.preventMasking) and the mask to everyone else. No database change.']
217
+ },
218
+ {
219
+ version: "1.0.2",
220
+ date: "2026-11-16",
221
+ notes: [
222
+ "The version the admin shows is the package's own (this release lists the one before it)."
223
+ ]
224
+ },
225
+ {
226
+ version: "1.0.1",
227
+ date: "2026-11-16",
228
+ notes: [
229
+ "A site admin's tracking ID, Tag Manager ID and server address are checked when saved: each must have the shape a real one has, so nothing that could end a string or a tag in the inline snippet is accepted (the server address must be https, with no login in it)."
230
+ ]
231
+ },
196
232
  {
197
233
  version: "1.0.0",
198
234
  date: "2026-11-05",
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { definePlugin } from "opscms-sdk";
3
3
 
4
4
  // src/AnalyticsIntegrations.ts
5
- import { access, secretField, tenancy } from "opscms-sdk";
5
+ import { access, platform, secretField, SETTINGS_MASK, tenancy } from "opscms-sdk";
6
6
 
7
7
  // src/integrationValues.ts
8
8
  var ID = /^[A-Za-z0-9._:/-]{1,100}$/;
@@ -31,6 +31,27 @@ function serverUrlProblem(value) {
31
31
 
32
32
  // src/AnalyticsIntegrations.ts
33
33
  var ANALYTICS_INTEGRATIONS = "analytics-integrations";
34
+ function apiSecretField() {
35
+ const field = secretField(ANALYTICS_INTEGRATIONS, "apiSecret", {
36
+ label: "API secret",
37
+ description: "Server secret: the GA4 Measurement Protocol API secret.",
38
+ condition: (_data, siblingData) => siblingData?.provider === "google"
39
+ });
40
+ return {
41
+ ...field,
42
+ hooks: {
43
+ ...field.hooks,
44
+ afterRead: [
45
+ ({ value, req, context }) => {
46
+ if (typeof value !== "string" || !value) return value;
47
+ const asked = (req?.context ?? context)?.preventMasking === true;
48
+ if (!asked) return SETTINGS_MASK;
49
+ return value.startsWith("enc:") ? platform().secrets.decrypt(value) : value;
50
+ }
51
+ ]
52
+ }
53
+ };
54
+ }
34
55
  var onlySuperAdminField = ({ req }) => req?.user?.role === "super-admin";
35
56
  var AnalyticsIntegrations = {
36
57
  slug: ANALYTICS_INTEGRATIONS,
@@ -90,11 +111,7 @@ var AnalyticsIntegrations = {
90
111
  // Server-side secret: the GA4 Measurement Protocol api_secret. Encrypted at rest under the site's key and shown masked; the real value is read only by the
91
112
  // ga4-send-event workflow action, which asks for it explicitly (`context.preventMasking`). Anyone else, an anonymous request to the platform's public content
92
113
  // delivery API included, gets the mask: the field fails CLOSED.
93
- secretField(ANALYTICS_INTEGRATIONS, "apiSecret", {
94
- label: "API secret",
95
- description: "Server secret: the GA4 Measurement Protocol API secret.",
96
- condition: (_data, siblingData) => siblingData?.provider === "google"
97
- }),
114
+ apiSecretField(),
98
115
  {
99
116
  name: "serverUrl",
100
117
  type: "text",
@@ -160,6 +177,25 @@ var analyticsManifest = definePluginManifest({
160
177
  category: "analytics",
161
178
  icon: "icon.svg",
162
179
  releases: [
180
+ {
181
+ version: "1.0.3",
182
+ date: "2026-11-17",
183
+ notes: ['The GA4 server secret is readable again by the ga4-send-event action: the field returned the mask to every caller, so server events would have been sent with "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" as the API secret. It now gives the real value, decrypted, to the one caller that asks for it (context.preventMasking) and the mask to everyone else. No database change.']
184
+ },
185
+ {
186
+ version: "1.0.2",
187
+ date: "2026-11-16",
188
+ notes: [
189
+ "The version the admin shows is the package's own (this release lists the one before it)."
190
+ ]
191
+ },
192
+ {
193
+ version: "1.0.1",
194
+ date: "2026-11-16",
195
+ notes: [
196
+ "A site admin's tracking ID, Tag Manager ID and server address are checked when saved: each must have the shape a real one has, so nothing that could end a string or a tag in the inline snippet is accepted (the server address must be https, with no login in it)."
197
+ ]
198
+ },
163
199
  {
164
200
  version: "1.0.0",
165
201
  date: "2026-11-05",
@@ -172,13 +208,13 @@ var analyticsManifest = definePluginManifest({
172
208
  });
173
209
 
174
210
  // src/marketingActions.ts
175
- import { platform } from "opscms-sdk";
211
+ import { platform as platform2 } from "opscms-sdk";
176
212
  var HTTP_TIMEOUT_MS = 8e3;
177
213
  function resolveParams(mapping, ctx) {
178
214
  const out = {};
179
215
  for (const [key, tpl] of Object.entries(mapping ?? {})) {
180
216
  if (typeof tpl === "string") {
181
- const resolved = platform().notifications.renderTemplate(tpl, ctx);
217
+ const resolved = platform2().notifications.renderTemplate(tpl, ctx);
182
218
  if (resolved !== void 0 && resolved !== null && resolved !== "") out[key] = String(resolved);
183
219
  }
184
220
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opscms-analytics-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Per-site analytics for an OpsCMS platform: each site's own Google, Matomo, Plausible, Fathom, Umami, PostHog or custom settings, and the server-side GA4 workflow action.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",