@10x-media/analytics 1.0.0-beta.7 → 1.0.0-beta.8
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 +48 -0
- package/README.md +8 -2
- package/dist/adapters/ga4/ga4.js +3 -2
- package/dist/adapters/ga4/ga4.js.map +1 -1
- package/dist/adapters/plausible/plausible.js +2 -1
- package/dist/adapters/plausible/plausible.js.map +1 -1
- package/dist/capture/slots.js +16 -5
- package/dist/capture/slots.js.map +1 -1
- package/dist/capture/trackerConfig.d.ts +1 -0
- package/dist/capture/trackerConfig.js +28 -3
- package/dist/capture/trackerConfig.js.map +1 -1
- package/dist/charts/BarList.d.ts +15 -1
- package/dist/charts/BarList.js +34 -18
- package/dist/charts/BarList.js.map +1 -1
- package/dist/charts/TrendChart.d.ts +16 -3
- package/dist/charts/TrendChart.js +172 -106
- package/dist/charts/TrendChart.js.map +1 -1
- package/dist/charts/bars.d.ts +2 -0
- package/dist/charts/bars.js +2 -1
- package/dist/charts/bars.js.map +1 -1
- package/dist/charts/bucket.js +10 -1
- package/dist/charts/bucket.js.map +1 -1
- package/dist/charts/spline.js +2 -2
- package/dist/charts/spline.js.map +1 -1
- package/dist/charts/styles.js +18 -1
- package/dist/charts/styles.js.map +1 -1
- package/dist/core/cacheKey.js +13 -1
- package/dist/core/cacheKey.js.map +1 -1
- package/dist/core/contract.d.ts +14 -7
- package/dist/core/contract.js +29 -1
- package/dist/core/contract.js.map +1 -1
- package/dist/core/granularity.js +1 -1
- package/dist/core/options.d.ts +54 -5
- package/dist/core/options.js +59 -2
- package/dist/core/options.js.map +1 -1
- package/dist/core/scopedRead.js +33 -23
- package/dist/core/scopedRead.js.map +1 -1
- package/dist/core/serverEvent.d.ts +42 -0
- package/dist/core/serverEvent.js +12 -0
- package/dist/core/serverEvent.js.map +1 -0
- package/dist/exports/client.d.ts +8 -2
- package/dist/exports/client.js +6 -1
- package/dist/exports/rsc.d.ts +5 -1
- package/dist/exports/rsc.js +6 -3
- package/dist/exports/types.d.ts +12 -4
- package/dist/exports/types.js +2 -2
- package/dist/fields/AnalyticsPanelClient.js +1 -1
- package/dist/fields/AnalyticsPanelField.js +1 -1
- package/dist/fields/AnalyticsStatField.js +2 -2
- package/dist/fields/config/MetricSelectField.js +2 -2
- package/dist/fields/config/MetricSelectField.js.map +1 -1
- package/dist/fields/config/SourceSelectField.js +2 -2
- package/dist/fields/config/SourceSelectField.js.map +1 -1
- package/dist/fields/config/fetchSources.d.ts +5 -1
- package/dist/fields/readForDocument.d.ts +5 -0
- package/dist/fields/readForDocument.js +5 -5
- package/dist/fields/readForDocument.js.map +1 -1
- package/dist/goals/GoalSelectField.d.ts +7 -0
- package/dist/goals/GoalSelectField.js +77 -0
- package/dist/goals/GoalSelectField.js.map +1 -0
- package/dist/goals/collection.js +250 -0
- package/dist/goals/collection.js.map +1 -0
- package/dist/goals/currency.js +14 -0
- package/dist/goals/currency.js.map +1 -0
- package/dist/goals/fetchGoals.d.ts +18 -0
- package/dist/goals/fetchGoals.js +29 -0
- package/dist/goals/fetchGoals.js.map +1 -0
- package/dist/goals/goalField.d.ts +31 -0
- package/dist/goals/goalField.js +56 -0
- package/dist/goals/goalField.js.map +1 -0
- package/dist/goals/goalsEndpoint.d.ts +1 -0
- package/dist/goals/goalsEndpoint.js +55 -0
- package/dist/goals/goalsEndpoint.js.map +1 -0
- package/dist/goals/resolver.d.ts +8 -0
- package/dist/goals/resolver.js +147 -0
- package/dist/goals/resolver.js.map +1 -0
- package/dist/goals/trackGoalAction.d.ts +74 -0
- package/dist/goals/trackGoalAction.js +139 -0
- package/dist/goals/trackGoalAction.js.map +1 -0
- package/dist/goals/useAnalyticsGoals.d.ts +20 -0
- package/dist/goals/useAnalyticsGoals.js +67 -0
- package/dist/goals/useAnalyticsGoals.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +74 -11
- package/dist/index.js.map +1 -1
- package/dist/native/ingest/device.js +11 -3
- package/dist/native/ingest/device.js.map +1 -1
- package/dist/native/ingest/endpoint.d.ts +1 -0
- package/dist/native/ingest/endpoint.js +2 -17
- package/dist/native/ingest/endpoint.js.map +1 -1
- package/dist/native/ingest/normalizeEvent.d.ts +20 -0
- package/dist/native/ingest/normalizeEvent.js +3 -2
- package/dist/native/ingest/normalizeEvent.js.map +1 -1
- package/dist/native/ingest/serverTrack.d.ts +20 -0
- package/dist/native/ingest/serverTrack.js +99 -0
- package/dist/native/ingest/serverTrack.js.map +1 -0
- package/dist/native/ingest/validate.js +27 -0
- package/dist/native/ingest/validate.js.map +1 -0
- package/dist/native/nativeAdapter.d.ts +1 -1
- package/dist/native/nativeAdapter.js +21 -10
- package/dist/native/nativeAdapter.js.map +1 -1
- package/dist/native/retention/pruneTask.js +1 -1
- package/dist/native/rollups/insertIfNew.js +36 -2
- package/dist/native/rollups/insertIfNew.js.map +1 -1
- package/dist/plugin/documentEndpoint.js +27 -9
- package/dist/plugin/documentEndpoint.js.map +1 -1
- package/dist/plugin/paths.js +5 -1
- package/dist/plugin/paths.js.map +1 -1
- package/dist/plugin/queryEndpoint.js +113 -0
- package/dist/plugin/queryEndpoint.js.map +1 -0
- package/dist/plugin/readContextForRequest.js +71 -0
- package/dist/plugin/readContextForRequest.js.map +1 -0
- package/dist/plugin/realtimeEndpoint.js +6 -3
- package/dist/plugin/realtimeEndpoint.js.map +1 -1
- package/dist/plugin/runtime.js +31 -1
- package/dist/plugin/runtime.js.map +1 -1
- package/dist/plugin/scopeFieldBoot.js +22 -0
- package/dist/plugin/scopeFieldBoot.js.map +1 -0
- package/dist/plugin/sourcesEndpoint.js +13 -51
- package/dist/plugin/sourcesEndpoint.js.map +1 -1
- package/dist/plugin/warmTask.js +0 -0
- package/dist/plugin/warmTask.js.map +1 -1
- package/dist/providers/collection.js +15 -9
- package/dist/providers/collection.js.map +1 -1
- package/dist/providers/resolver.js.map +1 -1
- package/dist/query/dates.js +64 -0
- package/dist/query/dates.js.map +1 -0
- package/dist/query/errors.d.ts +17 -0
- package/dist/query/errors.js +10 -0
- package/dist/query/errors.js.map +1 -0
- package/dist/query/fetchQuery.d.ts +59 -0
- package/dist/query/fetchQuery.js +110 -0
- package/dist/query/fetchQuery.js.map +1 -0
- package/dist/query/parse.d.ts +22 -0
- package/dist/query/parse.js +168 -0
- package/dist/query/parse.js.map +1 -0
- package/dist/query/response.d.ts +36 -0
- package/dist/timeframe/tz.js +17 -6
- package/dist/timeframe/tz.js.map +1 -1
- package/dist/translations/ar.js +98 -1
- package/dist/translations/ar.js.map +1 -1
- package/dist/translations/de.js +98 -1
- package/dist/translations/de.js.map +1 -1
- package/dist/translations/en.js +98 -1
- package/dist/translations/en.js.map +1 -1
- package/dist/translations/es.js +98 -1
- package/dist/translations/es.js.map +1 -1
- package/dist/translations/fr.js +98 -1
- package/dist/translations/fr.js.map +1 -1
- package/dist/translations/id.js +98 -1
- package/dist/translations/id.js.map +1 -1
- package/dist/translations/keys.d.ts +97 -0
- package/dist/translations/keys.js +98 -1
- package/dist/translations/keys.js.map +1 -1
- package/dist/translations/ko.js +98 -1
- package/dist/translations/ko.js.map +1 -1
- package/dist/translations/metricKeys.js +1 -1
- package/dist/translations/metricKeys.js.map +1 -1
- package/dist/translations/pt.js +98 -1
- package/dist/translations/pt.js.map +1 -1
- package/dist/translations/ru.js +98 -1
- package/dist/translations/ru.js.map +1 -1
- package/dist/translations/uk.js +98 -1
- package/dist/translations/uk.js.map +1 -1
- package/dist/translations/zh.js +98 -1
- package/dist/translations/zh.js.map +1 -1
- package/dist/view/AnalyticsNavLink.d.ts +19 -0
- package/dist/view/AnalyticsNavLink.js +40 -0
- package/dist/view/AnalyticsNavLink.js.map +1 -0
- package/dist/view/AnalyticsView.d.ts +23 -0
- package/dist/view/AnalyticsView.js +45 -0
- package/dist/view/AnalyticsView.js.map +1 -0
- package/dist/view/AnalyticsViewClient.d.ts +15 -0
- package/dist/view/AnalyticsViewClient.js +189 -0
- package/dist/view/AnalyticsViewClient.js.map +1 -0
- package/dist/view/authRedirect.js +32 -0
- package/dist/view/authRedirect.js.map +1 -0
- package/dist/view/conversionRate.js +18 -0
- package/dist/view/conversionRate.js.map +1 -0
- package/dist/view/dayRange.js +68 -0
- package/dist/view/dayRange.js.map +1 -0
- package/dist/view/gating.d.ts +1 -0
- package/dist/view/gating.js +105 -0
- package/dist/view/gating.js.map +1 -0
- package/dist/view/labels.js +44 -0
- package/dist/view/labels.js.map +1 -0
- package/dist/view/registerView.js +48 -0
- package/dist/view/registerView.js.map +1 -0
- package/dist/view/sections/Breakdowns.js +157 -0
- package/dist/view/sections/Breakdowns.js.map +1 -0
- package/dist/view/sections/EmptyStates.js +92 -0
- package/dist/view/sections/EmptyStates.js.map +1 -0
- package/dist/view/sections/FilterChips.js +41 -0
- package/dist/view/sections/FilterChips.js.map +1 -0
- package/dist/view/sections/GoalsPanel.js +81 -0
- package/dist/view/sections/GoalsPanel.js.map +1 -0
- package/dist/view/sections/OverviewCards.js +65 -0
- package/dist/view/sections/OverviewCards.js.map +1 -0
- package/dist/view/sections/RealtimeStrip.js +77 -0
- package/dist/view/sections/RealtimeStrip.js.map +1 -0
- package/dist/view/sections/Toolbar.js +179 -0
- package/dist/view/sections/Toolbar.js.map +1 -0
- package/dist/view/sections/Trend.js +119 -0
- package/dist/view/sections/Trend.js.map +1 -0
- package/dist/view/sections/styles.js +74 -0
- package/dist/view/sections/styles.js.map +1 -0
- package/dist/view/state.js +206 -0
- package/dist/view/state.js.map +1 -0
- package/dist/view/useViewQueries.js +150 -0
- package/dist/view/useViewQueries.js.map +1 -0
- package/dist/view/viewProps.d.ts +40 -0
- package/dist/view/viewProps.js +90 -0
- package/dist/view/viewProps.js.map +1 -0
- package/dist/widgets/AnalyticsBreakdownWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsBreakdownWidget.js +22 -4
- package/dist/widgets/AnalyticsBreakdownWidget.js.map +1 -1
- package/dist/widgets/AnalyticsGoalsWidget.d.ts +14 -0
- package/dist/widgets/AnalyticsGoalsWidget.js +188 -0
- package/dist/widgets/AnalyticsGoalsWidget.js.map +1 -0
- package/dist/widgets/AnalyticsMetricWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsMetricWidget.js +35 -12
- package/dist/widgets/AnalyticsMetricWidget.js.map +1 -1
- package/dist/widgets/AnalyticsRealtimeWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsRealtimeWidget.js +42 -22
- package/dist/widgets/AnalyticsRealtimeWidget.js.map +1 -1
- package/dist/widgets/AnalyticsTrendWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsTrendWidget.js +51 -15
- package/dist/widgets/AnalyticsTrendWidget.js.map +1 -1
- package/dist/widgets/WidgetViewLink.js +17 -0
- package/dist/widgets/WidgetViewLink.js.map +1 -0
- package/dist/widgets/breakdownTypes.js +28 -1
- package/dist/widgets/breakdownTypes.js.map +1 -1
- package/dist/widgets/cardChrome.js +31 -7
- package/dist/widgets/cardChrome.js.map +1 -1
- package/dist/widgets/range.js +43 -12
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/readForWidget.d.ts +12 -0
- package/dist/widgets/readForWidget.js +6 -5
- package/dist/widgets/readForWidget.js.map +1 -1
- package/dist/widgets/readForWidgetBreakdown.d.ts +15 -0
- package/dist/widgets/readForWidgetBreakdown.js +10 -7
- package/dist/widgets/readForWidgetBreakdown.js.map +1 -1
- package/dist/widgets/readForWidgetGoals.d.ts +57 -0
- package/dist/widgets/readForWidgetGoals.js +126 -0
- package/dist/widgets/readForWidgetGoals.js.map +1 -0
- package/dist/widgets/readForWidgetSeries.d.ts +13 -0
- package/dist/widgets/readForWidgetSeries.js +30 -12
- package/dist/widgets/readForWidgetSeries.js.map +1 -1
- package/dist/widgets/registerWidgets.js +49 -6
- package/dist/widgets/registerWidgets.js.map +1 -1
- package/dist/widgets/types.js +12 -1
- package/dist/widgets/types.js.map +1 -1
- package/dist/widgets/viewLink.d.ts +22 -0
- package/dist/widgets/viewLink.js +83 -0
- package/dist/widgets/viewLink.js.map +1 -0
- package/package.json +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopedRead.js","names":[],"sources":["../../src/core/scopedRead.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport {\n\ttype AnalyticsRuntime,\n\
|
|
1
|
+
{"version":3,"file":"scopedRead.js","names":[],"sources":["../../src/core/scopedRead.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport {\n\ttype AnalyticsRuntime,\n\ttype PlatformReadGate,\n\tplatformReadGate,\n\tresolveRegistryFor,\n\tresolveScopeFor,\n} from '../plugin/runtime'\nimport { type AnalyticsAdapter, PLATFORM_SCOPE } from './contract'\n\nexport type ReadContext =\n\t| {\n\t\t\tok: true\n\t\t\tadapter: AnalyticsAdapter\n\t\t\tscope: string | null\n\t\t\t/** The scope to stamp on the adapter query; undefined for install-wide reads. */\n\t\t\tqueryScope?: string\n\t }\n\t| { ok: false }\n\nexport interface ResolveReadContextArgs {\n\truntime: AnalyticsRuntime\n\treq: PayloadRequest\n\tadapterId?: string\n\t/** Explicit scope override; undefined resolves via the plugin's scopeResolver. */\n\tscope?: string | null\n}\n\nexport interface QueryScopeArgs {\n\truntime: AnalyticsRuntime\n\treq: PayloadRequest\n\t/** The read's resolved scope; `'*'` is the explicit cross-scope marker. */\n\tscope: string | null\n\tadapter: AnalyticsAdapter\n\t/** Shared `platformRead` decision; one is created per call when omitted. */\n\tplatformRead?: PlatformReadGate\n}\n\n/**\n * The scope to stamp on one adapter query, or a refusal. Cross-scope reads fail closed\n * behind `platformRead`: the `'*'` marker, and any scoped read through a shared config\n * adapter that cannot narrow the query to one scope (whether or not it is the designated\n * platform adapter), which would otherwise answer with every scope's data. A tenant's own\n * runtime adapters are never gated. Every read path decides this here, so the widgets and\n * the query endpoint cannot drift apart on what counts as cross-scope.\n */\nexport const resolveQueryScope = async (\n\targs: QueryScopeArgs\n): Promise<{ ok: true; queryScope?: string } | { ok: false }> => {\n\tconst { runtime, req, scope, adapter } = args\n\tconst allowed = args.platformRead ?? platformReadGate(runtime, req)\n\tif (scope === PLATFORM_SCOPE) {\n\t\treturn (await allowed()) ? { ok: true } : { ok: false }\n\t}\n\tif (scope === null) {\n\t\treturn { ok: true }\n\t}\n\tif (runtime.configAdapterIds.has(adapter.id) && !adapter.capabilities.scopedQueries) {\n\t\treturn (await allowed()) ? { ok: true } : { ok: false }\n\t}\n\treturn { ok: true, queryScope: scope }\n}\n\n/**\n * Resolve one read's scope and adapter: explicit scope wins over the request's\n * resolved scope, the registry is resolved per scope, then the adapter is picked\n * by id (or the registry default). Cross-scope reads fail closed behind\n * `platformRead`: an explicit `'*'` scope always, any scoped read through a\n * shared config adapter that cannot narrow the query to one scope (whether or\n * not it is the designated platform adapter), and, on a scoped install, a\n * request that resolves no scope at all. That last case is ambiguous rather\n * than intentionally install-wide (a tenant's scopeResolver returning null\n * usually means \"no tenant selected\", not \"read everything\"), so it fails\n * closed the same way. An explicit `scope: null` override bypasses that gate:\n * it is the trusted server-side caller's path (cron passes, tests), never a\n * request's own resolution. A tenant's own runtime adapters are never gated.\n * Any resolution failure (unknown adapter id, a throwing scopeResolver or\n * provider lookup) degrades to `{ ok: false }` so read paths render their\n * unavailable state instead of throwing.\n */\nexport const resolveReadContext = async (args: ResolveReadContextArgs): Promise<ReadContext> => {\n\tconst { runtime, req, adapterId } = args\n\tconst allowed = platformReadGate(runtime, req)\n\ttry {\n\t\tconst scope = args.scope !== undefined ? args.scope : await resolveScopeFor(runtime, req)\n\t\tif (runtime.scoped && args.scope === undefined && scope === null && !(await allowed())) {\n\t\t\treturn { ok: false }\n\t\t}\n\t\tconst registryScope = scope === PLATFORM_SCOPE ? null : scope\n\t\tconst registry = await resolveRegistryFor(runtime, {\n\t\t\tpayload: req.payload,\n\t\t\treq,\n\t\t\tscope: registryScope,\n\t\t})\n\t\tconst adapter = adapterId ? registry.get(adapterId) : registry.default()\n\t\tconst decision = await resolveQueryScope({\n\t\t\truntime,\n\t\t\treq,\n\t\t\tscope,\n\t\t\tadapter,\n\t\t\tplatformRead: allowed,\n\t\t})\n\t\tif (!decision.ok) {\n\t\t\treturn { ok: false }\n\t\t}\n\t\treturn { ok: true, adapter, scope: registryScope, queryScope: decision.queryScope }\n\t} catch (err) {\n\t\treq.payload.logger?.warn(`analytics: read context resolution failed: ${String(err)}`)\n\t\treturn { ok: false }\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA8CA,MAAa,oBAAoB,OAChC,SACgE;CAChE,MAAM,EAAE,SAAS,KAAK,OAAO,YAAY;CACzC,MAAM,UAAU,KAAK,gBAAgB,iBAAiB,SAAS,GAAG;CAClE,IAAI,UAAA,KACH,OAAQ,MAAM,QAAQ,IAAK,EAAE,IAAI,KAAK,IAAI,EAAE,IAAI,MAAM;CAEvD,IAAI,UAAU,MACb,OAAO,EAAE,IAAI,KAAK;CAEnB,IAAI,QAAQ,iBAAiB,IAAI,QAAQ,EAAE,KAAK,CAAC,QAAQ,aAAa,eACrE,OAAQ,MAAM,QAAQ,IAAK,EAAE,IAAI,KAAK,IAAI,EAAE,IAAI,MAAM;CAEvD,OAAO;EAAE,IAAI;EAAM,YAAY;CAAM;AACtC;;;;;;;;;;;;;;;;;;AAmBA,MAAa,qBAAqB,OAAO,SAAuD;CAC/F,MAAM,EAAE,SAAS,KAAK,cAAc;CACpC,MAAM,UAAU,iBAAiB,SAAS,GAAG;CAC7C,IAAI;EACH,MAAM,QAAQ,KAAK,UAAU,KAAA,IAAY,KAAK,QAAQ,MAAM,gBAAgB,SAAS,GAAG;EACxF,IAAI,QAAQ,UAAU,KAAK,UAAU,KAAA,KAAa,UAAU,QAAQ,CAAE,MAAM,QAAQ,GACnF,OAAO,EAAE,IAAI,MAAM;EAEpB,MAAM,gBAAgB,UAAA,MAA2B,OAAO;EACxD,MAAM,WAAW,MAAM,mBAAmB,SAAS;GAClD,SAAS,IAAI;GACb;GACA,OAAO;EACR,CAAC;EACD,MAAM,UAAU,YAAY,SAAS,IAAI,SAAS,IAAI,SAAS,QAAQ;EACvE,MAAM,WAAW,MAAM,kBAAkB;GACxC;GACA;GACA;GACA;GACA,cAAc;EACf,CAAC;EACD,IAAI,CAAC,SAAS,IACb,OAAO,EAAE,IAAI,MAAM;EAEpB,OAAO;GAAE,IAAI;GAAM;GAAS,OAAO;GAAe,YAAY,SAAS;EAAW;CACnF,SAAS,KAAK;EACb,IAAI,QAAQ,QAAQ,KAAK,8CAA8C,OAAO,GAAG,GAAG;EACpF,OAAO,EAAE,IAAI,MAAM;CACpB;AACD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RawEventInput } from "../native/ingest/normalizeEvent.js";
|
|
2
|
+
import { PayloadRequest } from "payload";
|
|
3
|
+
|
|
4
|
+
//#region src/core/serverEvent.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* One event recorded from server code. The fields a browser event carries mean exactly what
|
|
7
|
+
* they mean on the wire (and go through the same sanitizers); the rest say what the server
|
|
8
|
+
* knows that a browser request would otherwise have said for itself.
|
|
9
|
+
*/
|
|
10
|
+
type ServerEventInput = Pick<RawEventInput, 'type' | 'name' | 'path' | 'hostname' | 'referrer' | 'props' | 'value' | 'currency'> & {
|
|
11
|
+
/**
|
|
12
|
+
* Attribution inputs, overlaid on `opts.req`'s own headers when there is a request.
|
|
13
|
+
* With neither, the event is attributed to the day's synthetic server visitor and
|
|
14
|
+
* reports no device. No IP is ever fabricated.
|
|
15
|
+
*/
|
|
16
|
+
ip?: string;
|
|
17
|
+
userAgent?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Analytics boundary to stamp; null is install-wide. Unset resolves from `opts.req`.
|
|
20
|
+
* Ignored on an unscoped install, and never validated against the scopes that exist.
|
|
21
|
+
*/
|
|
22
|
+
scope?: string | null; /** IANA reporting timezone the rollup day bucket is computed in. */
|
|
23
|
+
timezone?: string; /** Event time; defaults to now. */
|
|
24
|
+
now?: Date;
|
|
25
|
+
};
|
|
26
|
+
interface ServerTrackOptions {
|
|
27
|
+
/** The request the event belongs to: attribution, scope and timezone all come from it. */
|
|
28
|
+
req?: PayloadRequest;
|
|
29
|
+
/**
|
|
30
|
+
* Wait for the write to land. On an install with a write buffer the call otherwise
|
|
31
|
+
* resolves as soon as the event is queued, and a failed flush only reaches the logger.
|
|
32
|
+
*/
|
|
33
|
+
flush?: boolean;
|
|
34
|
+
}
|
|
35
|
+
type ServerTrack = (event: ServerEventInput, opts?: ServerTrackOptions) => Promise<void>;
|
|
36
|
+
/** Thrown instead of dropping the event: a server caller can handle a rejected promise. */
|
|
37
|
+
declare class AnalyticsTrackError extends Error {
|
|
38
|
+
constructor(message: string);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { AnalyticsTrackError, ServerEventInput, ServerTrack, ServerTrackOptions };
|
|
42
|
+
//# sourceMappingURL=serverEvent.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/core/serverEvent.ts
|
|
2
|
+
/** Thrown instead of dropping the event: a server caller can handle a rejected promise. */
|
|
3
|
+
var AnalyticsTrackError = class extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "AnalyticsTrackError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { AnalyticsTrackError };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=serverEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverEvent.js","names":[],"sources":["../../src/core/serverEvent.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport type { RawEventInput } from '../native/ingest/normalizeEvent'\n\n/**\n * One event recorded from server code. The fields a browser event carries mean exactly what\n * they mean on the wire (and go through the same sanitizers); the rest say what the server\n * knows that a browser request would otherwise have said for itself.\n */\nexport type ServerEventInput = Pick<\n\tRawEventInput,\n\t'type' | 'name' | 'path' | 'hostname' | 'referrer' | 'props' | 'value' | 'currency'\n> & {\n\t/**\n\t * Attribution inputs, overlaid on `opts.req`'s own headers when there is a request.\n\t * With neither, the event is attributed to the day's synthetic server visitor and\n\t * reports no device. No IP is ever fabricated.\n\t */\n\tip?: string\n\tuserAgent?: string\n\t/**\n\t * Analytics boundary to stamp; null is install-wide. Unset resolves from `opts.req`.\n\t * Ignored on an unscoped install, and never validated against the scopes that exist.\n\t */\n\tscope?: string | null\n\t/** IANA reporting timezone the rollup day bucket is computed in. */\n\ttimezone?: string\n\t/** Event time; defaults to now. */\n\tnow?: Date\n}\n\nexport interface ServerTrackOptions {\n\t/** The request the event belongs to: attribution, scope and timezone all come from it. */\n\treq?: PayloadRequest\n\t/**\n\t * Wait for the write to land. On an install with a write buffer the call otherwise\n\t * resolves as soon as the event is queued, and a failed flush only reaches the logger.\n\t */\n\tflush?: boolean\n}\n\nexport type ServerTrack = (event: ServerEventInput, opts?: ServerTrackOptions) => Promise<void>\n\n/** Thrown instead of dropping the event: a server caller can handle a rejected promise. */\nexport class AnalyticsTrackError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'AnalyticsTrackError'\n\t}\n}\n"],"mappings":";;AA2CA,IAAa,sBAAb,cAAyC,MAAM;CAC9C,YAAY,SAAiB;EAC5B,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD"}
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { BarList, BarListProps } from "../charts/BarList.js";
|
|
2
|
-
import { TrendChart, TrendChartProps } from "../charts/TrendChart.js";
|
|
2
|
+
import { TrendChart, TrendChartProps, TrendPoint } from "../charts/TrendChart.js";
|
|
3
3
|
import { WireSource } from "../fields/config/fetchSources.js";
|
|
4
4
|
import { MetricSelectField, MetricSelectFieldProps } from "../fields/config/MetricSelectField.js";
|
|
5
5
|
import { SourceSelectField } from "../fields/config/SourceSelectField.js";
|
|
6
6
|
import { useAnalyticsSources } from "../fields/config/useAnalyticsSources.js";
|
|
7
7
|
import { DateRangeField } from "../fields/dateRange/ui.js";
|
|
8
|
+
import { GoalsResponse, WireGoal } from "../goals/fetchGoals.js";
|
|
9
|
+
import { GoalSelectField } from "../goals/GoalSelectField.js";
|
|
10
|
+
import { useAnalyticsGoals } from "../goals/useAnalyticsGoals.js";
|
|
11
|
+
import { QueryFetchError, QueryRequest, buildQueryUrl, fetchQuery } from "../query/fetchQuery.js";
|
|
12
|
+
import { AnalyticsNavLink, AnalyticsNavLinkProps } from "../view/AnalyticsNavLink.js";
|
|
13
|
+
import { AnalyticsViewClient } from "../view/AnalyticsViewClient.js";
|
|
8
14
|
import { RealtimeCounter } from "../widgets/RealtimeCounter.js";
|
|
9
|
-
export { BarList, type BarListProps, DateRangeField, MetricSelectField, type MetricSelectFieldProps, RealtimeCounter, SourceSelectField, TrendChart, type TrendChartProps, type WireSource, useAnalyticsSources };
|
|
15
|
+
export { AnalyticsNavLink, type AnalyticsNavLinkProps, AnalyticsViewClient, BarList, type BarListProps, DateRangeField, GoalSelectField, type GoalsResponse, MetricSelectField, type MetricSelectFieldProps, QueryFetchError, type QueryRequest, RealtimeCounter, SourceSelectField, TrendChart, type TrendChartProps, type TrendPoint, type WireGoal, type WireSource, buildQueryUrl, fetchQuery, useAnalyticsGoals, useAnalyticsSources };
|
package/dist/exports/client.js
CHANGED
|
@@ -5,5 +5,10 @@ import { useAnalyticsSources } from "../fields/config/useAnalyticsSources.js";
|
|
|
5
5
|
import { MetricSelectField } from "../fields/config/MetricSelectField.js";
|
|
6
6
|
import { SourceSelectField } from "../fields/config/SourceSelectField.js";
|
|
7
7
|
import { DateRangeField } from "../fields/dateRange/ui.js";
|
|
8
|
+
import { useAnalyticsGoals } from "../goals/useAnalyticsGoals.js";
|
|
9
|
+
import { GoalSelectField } from "../goals/GoalSelectField.js";
|
|
10
|
+
import { QueryFetchError, buildQueryUrl, fetchQuery } from "../query/fetchQuery.js";
|
|
11
|
+
import { AnalyticsNavLink } from "../view/AnalyticsNavLink.js";
|
|
8
12
|
import { RealtimeCounter } from "../widgets/RealtimeCounter.js";
|
|
9
|
-
|
|
13
|
+
import { AnalyticsViewClient } from "../view/AnalyticsViewClient.js";
|
|
14
|
+
export { AnalyticsNavLink, AnalyticsViewClient, BarList, DateRangeField, GoalSelectField, MetricSelectField, QueryFetchError, RealtimeCounter, SourceSelectField, TrendChart, buildQueryUrl, fetchQuery, useAnalyticsGoals, useAnalyticsSources };
|
package/dist/exports/rsc.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnalyticsFilter, DateRange, DimensionKey, MetricKey } from "../core/contract.js";
|
|
2
2
|
import { CapabilityRequirement } from "../core/capabilities.js";
|
|
3
|
+
import { AnalyticsViewClientProps, ViewGoal } from "../view/viewProps.js";
|
|
3
4
|
import { ReadForWidgetRealtimeArgs, RealtimePoint, WidgetRealtimeResult, WidgetRealtimeStatus, readForWidgetRealtime } from "../widgets/readForWidgetRealtime.js";
|
|
4
5
|
import { TrackerConfig, TrackerSlotConfig } from "../capture/trackerConfig.js";
|
|
5
6
|
import { getTrackerConfig } from "../capture/getTrackerConfig.js";
|
|
@@ -10,10 +11,13 @@ import { ReadForWidgetArgs, WidgetReadResult, WidgetReadStatus, readForWidget }
|
|
|
10
11
|
import { ReadForWidgetSeriesArgs, SeriesPoint, WidgetSeriesResult, readForWidgetSeries } from "../widgets/readForWidgetSeries.js";
|
|
11
12
|
import { FieldReadResult, FieldReadStatus, ReadForFieldArgs, readForField } from "../fields/readForDocument.js";
|
|
12
13
|
import { AnalyticsScripts, AnalyticsScriptsProps } from "../rsc/AnalyticsScripts.js";
|
|
14
|
+
import { AnalyticsView, AnalyticsViewProps } from "../view/AnalyticsView.js";
|
|
13
15
|
import { AnalyticsBreakdownWidget } from "../widgets/AnalyticsBreakdownWidget.js";
|
|
16
|
+
import { AnalyticsGoalsWidget } from "../widgets/AnalyticsGoalsWidget.js";
|
|
14
17
|
import { AnalyticsMetricWidget } from "../widgets/AnalyticsMetricWidget.js";
|
|
15
18
|
import { AnalyticsRealtimeWidget } from "../widgets/AnalyticsRealtimeWidget.js";
|
|
16
19
|
import { AnalyticsTrendWidget } from "../widgets/AnalyticsTrendWidget.js";
|
|
17
20
|
import { cardStyle, labelStyle } from "../widgets/cardChrome.js";
|
|
18
21
|
import { BreakdownRow, ReadForWidgetBreakdownArgs, WidgetBreakdownResult, readForWidgetBreakdown } from "../widgets/readForWidgetBreakdown.js";
|
|
19
|
-
|
|
22
|
+
import { GoalRow, ReadForWidgetGoalsArgs, WidgetGoalsResult, readForWidgetGoals } from "../widgets/readForWidgetGoals.js";
|
|
23
|
+
export { AnalyticsBreakdownWidget, type AnalyticsFilter, AnalyticsGoalsWidget, AnalyticsMetricWidget, AnalyticsPanelField, AnalyticsRealtimeWidget, AnalyticsScripts, type AnalyticsScriptsProps, AnalyticsStatField, AnalyticsTrendWidget, AnalyticsView, type AnalyticsViewClientProps, type AnalyticsViewProps, type BreakdownRow, type CapabilityRequirement, type DateRange, type DimensionKey, type FieldReadResult, type FieldReadStatus, type GoalRow, type MetricKey, type ReadForFieldArgs, type ReadForWidgetArgs, type ReadForWidgetBreakdownArgs, type ReadForWidgetGoalsArgs, type ReadForWidgetRealtimeArgs, type ReadForWidgetSeriesArgs, type RealtimePoint, type SeriesPoint, type TrackerConfig, type TrackerSlotConfig, type ViewGoal, type WidgetBreakdownResult, type WidgetGoalsResult, type WidgetReadResult, type WidgetReadStatus, type WidgetRealtimeResult, type WidgetRealtimeStatus, type WidgetSeriesResult, formatMetricValue, getTrackerConfig, readForField, readForWidget, readForWidgetBreakdown, readForWidgetGoals, readForWidgetRealtime, readForWidgetSeries, cardStyle as widgetCardStyle, labelStyle as widgetLabelStyle };
|
package/dist/exports/rsc.js
CHANGED
|
@@ -3,14 +3,17 @@ import { readForField } from "../fields/readForDocument.js";
|
|
|
3
3
|
import { readForWidgetRealtime } from "../widgets/readForWidgetRealtime.js";
|
|
4
4
|
import { readForWidget } from "../widgets/readForWidget.js";
|
|
5
5
|
import { readForWidgetBreakdown } from "../widgets/readForWidgetBreakdown.js";
|
|
6
|
-
import { getTrackerConfig } from "../capture/getTrackerConfig.js";
|
|
7
6
|
import { formatMetricValue } from "../fields/format.js";
|
|
7
|
+
import { cardStyle, labelStyle } from "../widgets/cardChrome.js";
|
|
8
|
+
import { getTrackerConfig } from "../capture/getTrackerConfig.js";
|
|
8
9
|
import { AnalyticsStatField } from "../fields/AnalyticsStatField.js";
|
|
9
10
|
import { AnalyticsPanelField } from "../fields/AnalyticsPanelField.js";
|
|
10
11
|
import { AnalyticsScripts } from "../rsc/AnalyticsScripts.js";
|
|
11
|
-
import {
|
|
12
|
+
import { AnalyticsView } from "../view/AnalyticsView.js";
|
|
12
13
|
import AnalyticsBreakdownWidget from "../widgets/AnalyticsBreakdownWidget.js";
|
|
14
|
+
import { readForWidgetGoals } from "../widgets/readForWidgetGoals.js";
|
|
15
|
+
import AnalyticsGoalsWidget from "../widgets/AnalyticsGoalsWidget.js";
|
|
13
16
|
import AnalyticsMetricWidget from "../widgets/AnalyticsMetricWidget.js";
|
|
14
17
|
import AnalyticsRealtimeWidget from "../widgets/AnalyticsRealtimeWidget.js";
|
|
15
18
|
import AnalyticsTrendWidget from "../widgets/AnalyticsTrendWidget.js";
|
|
16
|
-
export { AnalyticsBreakdownWidget, AnalyticsMetricWidget, AnalyticsPanelField, AnalyticsRealtimeWidget, AnalyticsScripts, AnalyticsStatField, AnalyticsTrendWidget, formatMetricValue, getTrackerConfig, readForField, readForWidget, readForWidgetBreakdown, readForWidgetRealtime, readForWidgetSeries, cardStyle as widgetCardStyle, labelStyle as widgetLabelStyle };
|
|
19
|
+
export { AnalyticsBreakdownWidget, AnalyticsGoalsWidget, AnalyticsMetricWidget, AnalyticsPanelField, AnalyticsRealtimeWidget, AnalyticsScripts, AnalyticsStatField, AnalyticsTrendWidget, AnalyticsView, formatMetricValue, getTrackerConfig, readForField, readForWidget, readForWidgetBreakdown, readForWidgetGoals, readForWidgetRealtime, readForWidgetSeries, cardStyle as widgetCardStyle, labelStyle as widgetLabelStyle };
|
package/dist/exports/types.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { Goal, GoalMatch, TrackerGoal } from "../goals/types.js";
|
|
2
2
|
import { CaptureClientKind, CaptureSnippet, CaptureSupport, ProxyDescriptor, ProxyRoute, SnippetScript } from "../core/capture.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ServerEventInput, ServerTrack, ServerTrackOptions } from "../core/serverEvent.js";
|
|
4
|
+
import { AdapterContext, AdapterRegisterContext, AnalyticsAdapter, AnalyticsAdapterFactory, AnalyticsCapabilities, AnalyticsFilter, AnalyticsQuery, AnalyticsResult, AnalyticsRow, DIMENSION_KEYS, DateRange, DimensionKey, FILTER_OPERATORS, FilterOperator, Granularity, MetricKey, PLATFORM_SCOPE, RateLimitDescriptor } from "../core/contract.js";
|
|
4
5
|
import { SerializedCapabilities } from "../core/capabilities.js";
|
|
6
|
+
import { QueryError, QueryErrorCode } from "../query/errors.js";
|
|
7
|
+
import { QueryErrorResponse, QueryResponse, QuerySourceRef, SerializedAnalyticsQuery } from "../query/response.js";
|
|
8
|
+
import { QueryRequest } from "../query/fetchQuery.js";
|
|
5
9
|
import { AnalyticsBinding, BindingContext, HostnameResolver, PathResolver } from "../binding/types.js";
|
|
6
|
-
import { AnalyticsPluginOptions, ResolvedAutoCapture } from "../core/options.js";
|
|
7
|
-
import { TrackerConfig, TrackerSlotConfig } from "../capture/trackerConfig.js";
|
|
8
10
|
import { TimeframePreset } from "../timeframe/presets.js";
|
|
11
|
+
import { AnalyticsPluginOptions, AnalyticsViewAccess, AnalyticsViewOptions, ResolvedAutoCapture } from "../core/options.js";
|
|
12
|
+
import { AnalyticsViewClientProps, ViewGoal } from "../view/viewProps.js";
|
|
13
|
+
import { TrackerConfig, TrackerSlotConfig } from "../capture/trackerConfig.js";
|
|
9
14
|
import { AnalyticsFieldsOptions, AnalyticsMetricLabel, AnalyticsMetricLabels, AnalyticsStatOptions, AnalyticsStatRowOptions, AnalyticsTabOptions } from "../fields/factories.js";
|
|
10
|
-
|
|
15
|
+
import { GoalFieldOptions } from "../goals/goalField.js";
|
|
16
|
+
import { GoalActionDefinition, GoalActionRunArgs, TrackGoalActionOptions } from "../goals/trackGoalAction.js";
|
|
17
|
+
import { ParseResult, ParsedQuery } from "../query/parse.js";
|
|
18
|
+
export { AdapterContext, AdapterRegisterContext, AnalyticsAdapter, AnalyticsAdapterFactory, type AnalyticsBinding, AnalyticsCapabilities, type AnalyticsFieldsOptions, AnalyticsFilter, type AnalyticsMetricLabel, type AnalyticsMetricLabels, type AnalyticsPluginOptions, AnalyticsQuery, AnalyticsResult, AnalyticsRow, type AnalyticsStatOptions, type AnalyticsStatRowOptions, type AnalyticsTabOptions, type AnalyticsViewAccess, type AnalyticsViewClientProps, type AnalyticsViewOptions, type BindingContext, CaptureClientKind, CaptureSnippet, CaptureSupport, DIMENSION_KEYS, DateRange, DimensionKey, FILTER_OPERATORS, FilterOperator, type Goal, type GoalActionDefinition, type GoalActionRunArgs, type GoalFieldOptions, type GoalMatch, Granularity, type HostnameResolver, MetricKey, PLATFORM_SCOPE, type ParseResult, type ParsedQuery, type PathResolver, ProxyDescriptor, ProxyRoute, type QueryError, type QueryErrorCode, type QueryErrorResponse, type QueryRequest, type QueryResponse, type QuerySourceRef, RateLimitDescriptor, type ResolvedAutoCapture, type SerializedAnalyticsQuery, type SerializedCapabilities, type ServerEventInput, type ServerTrack, type ServerTrackOptions, SnippetScript, type TimeframePreset, type TrackGoalActionOptions, type TrackerConfig, type TrackerGoal, type TrackerSlotConfig, type ViewGoal };
|
package/dist/exports/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PLATFORM_SCOPE } from "../core/contract.js";
|
|
2
|
-
export { PLATFORM_SCOPE };
|
|
1
|
+
import { DIMENSION_KEYS, FILTER_OPERATORS, PLATFORM_SCOPE } from "../core/contract.js";
|
|
2
|
+
export { DIMENSION_KEYS, FILTER_OPERATORS, PLATFORM_SCOPE };
|
|
@@ -5,8 +5,8 @@ import { TIMEFRAME_PRESETS } from "../timeframe/presets.js";
|
|
|
5
5
|
import { METRIC_KEYS, TIMEFRAME_KEYS } from "../translations/metricKeys.js";
|
|
6
6
|
import { TrendChart } from "../charts/TrendChart.js";
|
|
7
7
|
import { useTranslation as useTranslation$1 } from "../translations/useTranslation.js";
|
|
8
|
-
import { AnalyticsEmptyState, isNewDocumentAnalytics } from "./emptyState.js";
|
|
9
8
|
import { formatMetricValue } from "./format.js";
|
|
9
|
+
import { AnalyticsEmptyState, isNewDocumentAnalytics } from "./emptyState.js";
|
|
10
10
|
import { ComparisonDelta } from "../widgets/ComparisonDelta.js";
|
|
11
11
|
import { bucketSeries } from "../charts/bucket.js";
|
|
12
12
|
import { useCallback, useState } from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { asTranslate } from "../translations/server.js";
|
|
2
|
-
import { readForField } from "./readForDocument.js";
|
|
3
2
|
import { METRIC_KEYS } from "../translations/metricKeys.js";
|
|
3
|
+
import { readForField } from "./readForDocument.js";
|
|
4
4
|
import { resolveMetricLabel } from "./AnalyticsStatField.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/fields/AnalyticsPanelField.tsx
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { keys } from "../translations/keys.js";
|
|
2
2
|
import { asTranslate } from "../translations/server.js";
|
|
3
|
-
import { readForField } from "./readForDocument.js";
|
|
4
3
|
import { METRIC_KEYS, TIMEFRAME_KEYS } from "../translations/metricKeys.js";
|
|
5
|
-
import {
|
|
4
|
+
import { readForField } from "./readForDocument.js";
|
|
6
5
|
import { formatMetricValue } from "./format.js";
|
|
6
|
+
import { AnalyticsEmptyState, isNewDocumentAnalytics } from "./emptyState.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/fields/AnalyticsStatField.tsx
|
|
9
9
|
const resolveMetricLabel = (override, i18n, fallback) => {
|
|
@@ -14,10 +14,10 @@ import { SelectInput, useField, useFormFields } from "@payloadcms/ui";
|
|
|
14
14
|
* narrowing filters out; the read path degrades that case on its own.
|
|
15
15
|
*/
|
|
16
16
|
const MetricSelectField = (props) => {
|
|
17
|
-
const { field, path, readOnly, requires, sourceFieldPath = "dataSource" } = props;
|
|
17
|
+
const { field, path: pathFromProps, readOnly, requires, sourceFieldPath = "dataSource" } = props;
|
|
18
18
|
const { i18n } = useTranslation$1();
|
|
19
19
|
const locale = i18n.language;
|
|
20
|
-
const { setValue, showError, value } = useField({
|
|
20
|
+
const { path, setValue, showError, value } = useField({ potentiallyStalePath: pathFromProps });
|
|
21
21
|
const { sources } = useAnalyticsSources();
|
|
22
22
|
const sourceId = useFormFields(([fields]) => fields?.[sourceFieldPath]?.value);
|
|
23
23
|
const options = narrowMetricOptions({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetricSelectField.js","names":["useTranslation"],"sources":["../../../src/fields/config/MetricSelectField.tsx"],"sourcesContent":["'use client'\n\nimport { type ReactSelectOption, SelectInput, useField, useFormFields } from '@payloadcms/ui'\nimport type { SelectFieldClientProps } from 'payload'\nimport { useMemo } from 'react'\nimport type { CapabilityRequirement } from '../../core/capabilities'\nimport { useTranslation } from '../../translations/useTranslation'\nimport { narrowMetricOptions } from './narrow'\nimport { toSelectOption } from './toSelectOption'\nimport { useAnalyticsSources } from './useAnalyticsSources'\n\nexport type MetricSelectFieldProps = SelectFieldClientProps & {\n\t/** Extra capability requirement (beyond the picked metric) a widget's other config imposes, e.g. a breakdown dimension. */\n\trequires?: Omit<CapabilityRequirement, 'metrics'>\n\t/**\n\t * Path of the sibling source select this picker narrows against, for\n\t * custom widgets whose source field is named differently. Defaults to\n\t * `'dataSource'`.\n\t */\n\tsourceFieldPath?: string\n}\n\n/**\n * Metric picker for scoped widget config: narrows the static option list to\n * what the sibling source field's selected source can actually serve, once\n * the sources endpoint answers. Never clears an already-picked value that\n * narrowing filters out; the read path degrades that case on its own.\n */\nexport const MetricSelectField = (props: MetricSelectFieldProps) => {\n\tconst { field, path, readOnly, requires, sourceFieldPath = 'dataSource' } = props\n\tconst { i18n } = useTranslation()\n\tconst locale = i18n.language\n\tconst { setValue, showError, value } = useField<string>({
|
|
1
|
+
{"version":3,"file":"MetricSelectField.js","names":["useTranslation"],"sources":["../../../src/fields/config/MetricSelectField.tsx"],"sourcesContent":["'use client'\n\nimport { type ReactSelectOption, SelectInput, useField, useFormFields } from '@payloadcms/ui'\nimport type { SelectFieldClientProps } from 'payload'\nimport { useMemo } from 'react'\nimport type { CapabilityRequirement } from '../../core/capabilities'\nimport { useTranslation } from '../../translations/useTranslation'\nimport { narrowMetricOptions } from './narrow'\nimport { toSelectOption } from './toSelectOption'\nimport { useAnalyticsSources } from './useAnalyticsSources'\n\nexport type MetricSelectFieldProps = SelectFieldClientProps & {\n\t/** Extra capability requirement (beyond the picked metric) a widget's other config imposes, e.g. a breakdown dimension. */\n\trequires?: Omit<CapabilityRequirement, 'metrics'>\n\t/**\n\t * Path of the sibling source select this picker narrows against, for\n\t * custom widgets whose source field is named differently. Defaults to\n\t * `'dataSource'`.\n\t */\n\tsourceFieldPath?: string\n}\n\n/**\n * Metric picker for scoped widget config: narrows the static option list to\n * what the sibling source field's selected source can actually serve, once\n * the sources endpoint answers. Never clears an already-picked value that\n * narrowing filters out; the read path degrades that case on its own.\n */\nexport const MetricSelectField = (props: MetricSelectFieldProps) => {\n\tconst { field, path: pathFromProps, readOnly, requires, sourceFieldPath = 'dataSource' } = props\n\tconst { i18n } = useTranslation()\n\tconst locale = i18n.language\n\tconst { path, setValue, showError, value } = useField<string>({\n\t\tpotentiallyStalePath: pathFromProps,\n\t})\n\tconst { sources } = useAnalyticsSources()\n\tconst sourceId = useFormFields(\n\t\t([fields]) => fields?.[sourceFieldPath]?.value as string | undefined\n\t)\n\n\tconst staticOptions = useMemo(\n\t\t() => field.options.map((option) => toSelectOption(option, locale)),\n\t\t[field.options, locale]\n\t)\n\n\tconst options = narrowMetricOptions({\n\t\toptions: staticOptions,\n\t\trequires,\n\t\tsourceId,\n\t\tsources: sources ?? [],\n\t}).map((option) => ({ label: option.label as string, value: option.value }))\n\n\treturn (\n\t\t<SelectInput\n\t\t\tisClearable={false}\n\t\t\tlabel={field.label}\n\t\t\tname={field.name}\n\t\t\tonChange={(selected: ReactSelectOption | ReactSelectOption[]) => {\n\t\t\t\tconst option = Array.isArray(selected) ? selected[0] : selected\n\t\t\t\tsetValue(option ? String(option.value) : null)\n\t\t\t}}\n\t\t\toptions={options}\n\t\t\tpath={path}\n\t\t\treadOnly={readOnly}\n\t\t\trequired={field.required}\n\t\t\tshowError={showError}\n\t\t\tvalue={value}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAa,qBAAqB,UAAkC;CACnE,MAAM,EAAE,OAAO,MAAM,eAAe,UAAU,UAAU,kBAAkB,iBAAiB;CAC3F,MAAM,EAAE,SAASA,iBAAe;CAChC,MAAM,SAAS,KAAK;CACpB,MAAM,EAAE,MAAM,UAAU,WAAW,UAAU,SAAiB,EAC7D,sBAAsB,cACvB,CAAC;CACD,MAAM,EAAE,YAAY,oBAAoB;CACxC,MAAM,WAAW,eACf,CAAC,YAAY,SAAS,kBAAkB,KAC1C;CAOA,MAAM,UAAU,oBAAoB;EACnC,SANqB,cACf,MAAM,QAAQ,KAAK,WAAW,eAAe,QAAQ,MAAM,CAAC,GAClE,CAAC,MAAM,SAAS,MAAM,CAID;EACrB;EACA;EACA,SAAS,WAAW,CAAC;CACtB,CAAC,EAAE,KAAK,YAAY;EAAE,OAAO,OAAO;EAAiB,OAAO,OAAO;CAAM,EAAE;CAE3E,OACC,oBAAC,aAAD;EACC,aAAa;EACb,OAAO,MAAM;EACb,MAAM,MAAM;EACZ,WAAW,aAAsD;GAChE,MAAM,SAAS,MAAM,QAAQ,QAAQ,IAAI,SAAS,KAAK;GACvD,SAAS,SAAS,OAAO,OAAO,KAAK,IAAI,IAAI;EAC9C;EACS;EACH;EACI;EACV,UAAU,MAAM;EACL;EACJ;CACP,CAAA;AAEH"}
|
|
@@ -14,10 +14,10 @@ import { SelectInput, useField } from "@payloadcms/ui";
|
|
|
14
14
|
* emptying the picker.
|
|
15
15
|
*/
|
|
16
16
|
const SourceSelectField = (props) => {
|
|
17
|
-
const { field, path, readOnly } = props;
|
|
17
|
+
const { field, path: pathFromProps, readOnly } = props;
|
|
18
18
|
const { i18n } = useTranslation$1();
|
|
19
19
|
const locale = i18n.language;
|
|
20
|
-
const { setValue, showError, value } = useField({
|
|
20
|
+
const { path, setValue, showError, value } = useField({ potentiallyStalePath: pathFromProps });
|
|
21
21
|
const { sources } = useAnalyticsSources();
|
|
22
22
|
const staticOptions = useMemo(() => field.options.map((option) => toSelectOption(option, locale)), [field.options, locale]);
|
|
23
23
|
const options = sources && sources.length > 0 ? sources.map((source) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceSelectField.js","names":["useTranslation"],"sources":["../../../src/fields/config/SourceSelectField.tsx"],"sourcesContent":["'use client'\n\nimport { type ReactSelectOption, SelectInput, useField } from '@payloadcms/ui'\nimport type { SelectFieldClientProps } from 'payload'\nimport { useMemo } from 'react'\nimport { useTranslation } from '../../translations/useTranslation'\nimport { toSelectOption } from './toSelectOption'\nimport { useAnalyticsSources } from './useAnalyticsSources'\n\n/**\n * Source picker for scoped widget config: starts from the field's static\n * option list and, once the caller-scope sources endpoint answers, replaces\n * it with the live adapter list so a tenant only ever sees sources it can\n * actually read from. A failed fetch keeps the static list rather than\n * emptying the picker.\n */\nexport const SourceSelectField = (props: SelectFieldClientProps) => {\n\tconst { field, path, readOnly } = props\n\tconst { i18n } = useTranslation()\n\tconst locale = i18n.language\n\tconst { setValue, showError, value } = useField<string>({
|
|
1
|
+
{"version":3,"file":"SourceSelectField.js","names":["useTranslation"],"sources":["../../../src/fields/config/SourceSelectField.tsx"],"sourcesContent":["'use client'\n\nimport { type ReactSelectOption, SelectInput, useField } from '@payloadcms/ui'\nimport type { SelectFieldClientProps } from 'payload'\nimport { useMemo } from 'react'\nimport { useTranslation } from '../../translations/useTranslation'\nimport { toSelectOption } from './toSelectOption'\nimport { useAnalyticsSources } from './useAnalyticsSources'\n\n/**\n * Source picker for scoped widget config: starts from the field's static\n * option list and, once the caller-scope sources endpoint answers, replaces\n * it with the live adapter list so a tenant only ever sees sources it can\n * actually read from. A failed fetch keeps the static list rather than\n * emptying the picker.\n */\nexport const SourceSelectField = (props: SelectFieldClientProps) => {\n\tconst { field, path: pathFromProps, readOnly } = props\n\tconst { i18n } = useTranslation()\n\tconst locale = i18n.language\n\tconst { path, setValue, showError, value } = useField<string>({\n\t\tpotentiallyStalePath: pathFromProps,\n\t})\n\tconst { sources } = useAnalyticsSources()\n\n\tconst staticOptions = useMemo(\n\t\t() => field.options.map((option) => toSelectOption(option, locale)),\n\t\t[field.options, locale]\n\t)\n\n\tconst options =\n\t\tsources && sources.length > 0\n\t\t\t? sources.map((source) => ({ value: source.id, label: source.label }))\n\t\t\t: staticOptions\n\n\treturn (\n\t\t<SelectInput\n\t\t\tisClearable={false}\n\t\t\tlabel={field.label}\n\t\t\tname={field.name}\n\t\t\tonChange={(selected: ReactSelectOption | ReactSelectOption[]) => {\n\t\t\t\tconst option = Array.isArray(selected) ? selected[0] : selected\n\t\t\t\tsetValue(option ? String(option.value) : null)\n\t\t\t}}\n\t\t\toptions={options}\n\t\t\tpath={path}\n\t\t\treadOnly={readOnly}\n\t\t\trequired={field.required}\n\t\t\tshowError={showError}\n\t\t\tvalue={value}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAa,qBAAqB,UAAkC;CACnE,MAAM,EAAE,OAAO,MAAM,eAAe,aAAa;CACjD,MAAM,EAAE,SAASA,iBAAe;CAChC,MAAM,SAAS,KAAK;CACpB,MAAM,EAAE,MAAM,UAAU,WAAW,UAAU,SAAiB,EAC7D,sBAAsB,cACvB,CAAC;CACD,MAAM,EAAE,YAAY,oBAAoB;CAExC,MAAM,gBAAgB,cACf,MAAM,QAAQ,KAAK,WAAW,eAAe,QAAQ,MAAM,CAAC,GAClE,CAAC,MAAM,SAAS,MAAM,CACvB;CAEA,MAAM,UACL,WAAW,QAAQ,SAAS,IACzB,QAAQ,KAAK,YAAY;EAAE,OAAO,OAAO;EAAI,OAAO,OAAO;CAAM,EAAE,IACnE;CAEJ,OACC,oBAAC,aAAD;EACC,aAAa;EACb,OAAO,MAAM;EACb,MAAM,MAAM;EACZ,WAAW,aAAsD;GAChE,MAAM,SAAS,MAAM,QAAQ,QAAQ,IAAI,SAAS,KAAK;GACvD,SAAS,SAAS,OAAO,OAAO,KAAK,IAAI,IAAI;EAC9C;EACS;EACH;EACI;EACV,UAAU,MAAM;EACL;EACJ;CACP,CAAA;AAEH"}
|
|
@@ -7,6 +7,10 @@ interface WireSource {
|
|
|
7
7
|
kind: 'config' | 'runtime';
|
|
8
8
|
capabilities: SerializedCapabilities;
|
|
9
9
|
}
|
|
10
|
+
interface SourcesResponse {
|
|
11
|
+
defaultId: string | null;
|
|
12
|
+
sources: WireSource[];
|
|
13
|
+
}
|
|
10
14
|
//#endregion
|
|
11
|
-
export { WireSource };
|
|
15
|
+
export { SourcesResponse, WireSource };
|
|
12
16
|
//# sourceMappingURL=fetchSources.d.ts.map
|
|
@@ -36,6 +36,11 @@ interface ReadForFieldArgs {
|
|
|
36
36
|
now: Date;
|
|
37
37
|
/** Explicit scope override; omitted resolves via the plugin's scopeResolver. */
|
|
38
38
|
scope?: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Reporting timezone the caller already resolved, reused rather than resolved again so
|
|
41
|
+
* a caller-supplied `range` is read in the very timezone it was interpreted in.
|
|
42
|
+
*/
|
|
43
|
+
timezone?: string;
|
|
39
44
|
/** Also read the previous comparable window when the adapter supports comparison. */
|
|
40
45
|
compare?: boolean;
|
|
41
46
|
/** Also read a daily series for the first supported metric when the adapter can. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getRuntime, resolveTimezoneFor } from "../plugin/runtime.js";
|
|
2
|
+
import { resolveTimeframe } from "../timeframe/presets.js";
|
|
2
3
|
import { resolveHostname, resolvePathCached } from "../binding/resolvePath.js";
|
|
3
4
|
import { satisfiesCapabilities } from "../core/capabilities.js";
|
|
4
5
|
import { supportsGranularity } from "../core/granularity.js";
|
|
5
6
|
import { resolveReadContext } from "../core/scopedRead.js";
|
|
6
|
-
import { resolveTimeframe } from "../timeframe/presets.js";
|
|
7
7
|
import { previousWindow } from "../widgets/comparison.js";
|
|
8
8
|
import { fillDailySeries } from "../widgets/readForWidgetSeries.js";
|
|
9
9
|
//#region src/fields/readForDocument.ts
|
|
@@ -30,7 +30,7 @@ const readForField = async (args) => {
|
|
|
30
30
|
status: "not-bound",
|
|
31
31
|
adapterId: adapterId ?? "",
|
|
32
32
|
dateRange,
|
|
33
|
-
timezone: "UTC",
|
|
33
|
+
timezone: args.timezone ?? "UTC",
|
|
34
34
|
...empty
|
|
35
35
|
};
|
|
36
36
|
const binding = runtime.bindings[collectionSlug];
|
|
@@ -38,7 +38,7 @@ const readForField = async (args) => {
|
|
|
38
38
|
status: "not-bound",
|
|
39
39
|
adapterId: adapterId ?? "",
|
|
40
40
|
dateRange,
|
|
41
|
-
timezone: "UTC",
|
|
41
|
+
timezone: args.timezone ?? "UTC",
|
|
42
42
|
...empty
|
|
43
43
|
};
|
|
44
44
|
const ctx = await resolveReadContext({
|
|
@@ -51,10 +51,10 @@ const readForField = async (args) => {
|
|
|
51
51
|
status: "unavailable",
|
|
52
52
|
adapterId: adapterId ?? "",
|
|
53
53
|
dateRange,
|
|
54
|
-
timezone: "UTC",
|
|
54
|
+
timezone: args.timezone ?? "UTC",
|
|
55
55
|
...empty
|
|
56
56
|
};
|
|
57
|
-
const tz = await resolveTimezoneFor(runtime, req, ctx.scope);
|
|
57
|
+
const tz = args.timezone ?? await resolveTimezoneFor(runtime, req, ctx.scope);
|
|
58
58
|
dateRange = range ?? resolveTimeframe(timeframe, now, tz);
|
|
59
59
|
const adapter = ctx.adapter;
|
|
60
60
|
const bindingCtx = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readForDocument.js","names":[],"sources":["../../src/fields/readForDocument.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport { resolveHostname, resolvePathCached } from '../binding/resolvePath'\nimport type { BindingDoc } from '../binding/types'\nimport { satisfiesCapabilities } from '../core/capabilities'\nimport type { AnalyticsAdapter, DateRange, MetricKey } from '../core/contract'\nimport { supportsGranularity } from '../core/granularity'\nimport { resolveReadContext } from '../core/scopedRead'\nimport { getRuntime, resolveTimezoneFor } from '../plugin/runtime'\nimport { resolveTimeframe, type TimeframePreset } from '../timeframe/presets'\nimport { DEFAULT_TIMEZONE } from '../timeframe/tz'\nimport { previousWindow } from '../widgets/comparison'\nimport { fillDailySeries, type SeriesPoint } from '../widgets/readForWidgetSeries'\n\nexport type FieldReadStatus = 'ok' | 'no-path' | 'not-bound' | 'not-configured' | 'unavailable'\n\nexport interface FieldReadResult {\n\tstatus: FieldReadStatus\n\tadapterId: string\n\tdateRange: DateRange\n\t/** The reporting timezone the read resolved in; the trend axis buckets in it. */\n\ttimezone: string\n\tmetrics: Partial<Record<MetricKey, number>>\n\t/** Requested metrics the adapter supports, in request order; the set actually read. */\n\tsupportedMetrics: MetricKey[]\n\t/** Requested metrics the adapter cannot serve, dropped from the read. */\n\tdroppedMetrics: MetricKey[]\n\t/** Previous-window totals, present only when comparison was requested and supported. */\n\tpreviousMetrics?: Partial<Record<MetricKey, number>>\n\t/** The previous comparable window, present only when comparison ran. */\n\tcomparisonRange?: DateRange\n\t/** Per-day series for the first supported metric, present only when requested. */\n\tpoints?: SeriesPoint[]\n}\n\nexport interface ReadForFieldArgs {\n\treq: PayloadRequest\n\tcollectionSlug: string\n\tdata: BindingDoc\n\tmetrics: MetricKey[]\n\ttimeframe: TimeframePreset\n\t/** Overrides the preset window (custom range). */\n\trange?: DateRange\n\tadapterId?: string\n\tnow: Date\n\t/** Explicit scope override; omitted resolves via the plugin's scopeResolver. */\n\tscope?: string | null\n\t/** Also read the previous comparable window when the adapter supports comparison. */\n\tcompare?: boolean\n\t/** Also read a daily series for the first supported metric when the adapter can. */\n\tseries?: boolean\n}\n\n/**\n * Resolve a document's analytics for one display field: look up the runtime, resolve\n * the bound path, capability-gate the requested metrics against the active adapter,\n * then read through the surfacing engine. Returns a discriminated status so the\n * rendering component can show the right empty state without throwing.\n *\n * A metric the adapter does not support is dropped (with one warning per field\n * render), not fatal; `unavailable` is returned only when no requested metric\n * survives or the adapter cannot query per page at all.\n */\nexport const readForField = async (args: ReadForFieldArgs): Promise<FieldReadResult> => {\n\tconst { req, collectionSlug, data, metrics, timeframe, range, adapterId, now } = args\n\tlet dateRange = range ?? resolveTimeframe(timeframe, now)\n\tconst empty = { metrics: {}, supportedMetrics: [], droppedMetrics: [] }\n\tconst runtime = getRuntime(req.payload)\n\tif (!runtime) {\n\t\treturn {\n\t\t\tstatus: 'not-bound',\n\t\t\tadapterId: adapterId ?? '',\n\t\t\tdateRange,\n\t\t\ttimezone: DEFAULT_TIMEZONE,\n\t\t\t...empty,\n\t\t}\n\t}\n\tconst binding = runtime.bindings[collectionSlug]\n\tif (!binding) {\n\t\treturn {\n\t\t\tstatus: 'not-bound',\n\t\t\tadapterId: adapterId ?? '',\n\t\t\tdateRange,\n\t\t\ttimezone: DEFAULT_TIMEZONE,\n\t\t\t...empty,\n\t\t}\n\t}\n\tconst ctx = await resolveReadContext({ runtime, req, adapterId, scope: args.scope })\n\tif (!ctx.ok) {\n\t\treturn {\n\t\t\tstatus: 'unavailable',\n\t\t\tadapterId: adapterId ?? '',\n\t\t\tdateRange,\n\t\t\ttimezone: DEFAULT_TIMEZONE,\n\t\t\t...empty,\n\t\t}\n\t}\n\tconst tz = await resolveTimezoneFor(runtime, req, ctx.scope)\n\tdateRange = range ?? resolveTimeframe(timeframe, now, tz)\n\tconst adapter: AnalyticsAdapter = ctx.adapter\n\tconst bindingCtx = { req, locale: req.locale ?? undefined }\n\tlet path: string | null\n\ttry {\n\t\tpath = await resolvePathCached(binding, data, bindingCtx)\n\t} catch {\n\t\tpath = null\n\t}\n\tif (!path) {\n\t\treturn { status: 'no-path', adapterId: adapter.id, dateRange, timezone: tz, ...empty }\n\t}\n\tif (!adapter.isConfigured()) {\n\t\treturn { status: 'not-configured', adapterId: adapter.id, dateRange, timezone: tz, ...empty }\n\t}\n\tconst supportedMetrics = metrics.filter((m) => adapter.capabilities.metrics.has(m))\n\tconst droppedMetrics = metrics.filter((m) => !adapter.capabilities.metrics.has(m))\n\tif (droppedMetrics.length > 0) {\n\t\treq.payload.logger.warn(\n\t\t\t`analytics: adapter \"${adapter.id}\" does not support metric(s) ${droppedMetrics.join(', ')}; dropped from the \"${collectionSlug}\" display field`\n\t\t)\n\t}\n\tif (\n\t\tsupportedMetrics.length === 0 ||\n\t\t!satisfiesCapabilities(adapter.capabilities, { metrics: supportedMetrics, perPageQuery: true })\n\t) {\n\t\treturn {\n\t\t\tstatus: 'unavailable',\n\t\t\tadapterId: adapter.id,\n\t\t\tdateRange,\n\t\t\ttimezone: tz,\n\t\t\tmetrics: {},\n\t\t\tsupportedMetrics: [],\n\t\t\tdroppedMetrics: metrics,\n\t\t}\n\t}\n\tconst hostname = await resolveHostname(binding, data, bindingCtx)\n\tconst base = { path, hostname, timezone: tz, scope: ctx.queryScope }\n\tconst comparisonRange =\n\t\targs.compare && runtime.comparison && adapter.capabilities.comparison\n\t\t\t? (previousWindow(dateRange, tz) ?? undefined)\n\t\t\t: undefined\n\tconst wantsSeries = args.series && supportsGranularity(adapter.capabilities, 'day')\n\tconst [result, previous, seriesResult] = await Promise.all([\n\t\truntime.engine.read(adapter, { ...base, metrics: supportedMetrics, dateRange }),\n\t\tcomparisonRange\n\t\t\t? runtime.engine.read(adapter, {\n\t\t\t\t\t...base,\n\t\t\t\t\tmetrics: supportedMetrics,\n\t\t\t\t\tdateRange: comparisonRange,\n\t\t\t\t})\n\t\t\t: undefined,\n\t\twantsSeries\n\t\t\t? runtime.engine.read(adapter, {\n\t\t\t\t\t...base,\n\t\t\t\t\tmetrics: [supportedMetrics[0] as MetricKey],\n\t\t\t\t\tdateRange,\n\t\t\t\t\tgranularity: 'day',\n\t\t\t\t})\n\t\t\t: undefined,\n\t])\n\treturn {\n\t\tstatus: 'ok',\n\t\tadapterId: adapter.id,\n\t\tdateRange,\n\t\ttimezone: tz,\n\t\tmetrics: result.totals ?? {},\n\t\tsupportedMetrics,\n\t\tdroppedMetrics,\n\t\tpreviousMetrics: previous ? (previous.totals ?? {}) : undefined,\n\t\tcomparisonRange,\n\t\tpoints: seriesResult\n\t\t\t? fillDailySeries({\n\t\t\t\t\trows: seriesResult.rows,\n\t\t\t\t\tdateRange,\n\t\t\t\t\tmetric: supportedMetrics[0] as MetricKey,\n\t\t\t\t\ttz,\n\t\t\t\t})\n\t\t\t: undefined,\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"readForDocument.js","names":[],"sources":["../../src/fields/readForDocument.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport { resolveHostname, resolvePathCached } from '../binding/resolvePath'\nimport type { BindingDoc } from '../binding/types'\nimport { satisfiesCapabilities } from '../core/capabilities'\nimport type { AnalyticsAdapter, DateRange, MetricKey } from '../core/contract'\nimport { supportsGranularity } from '../core/granularity'\nimport { resolveReadContext } from '../core/scopedRead'\nimport { getRuntime, resolveTimezoneFor } from '../plugin/runtime'\nimport { resolveTimeframe, type TimeframePreset } from '../timeframe/presets'\nimport { DEFAULT_TIMEZONE } from '../timeframe/tz'\nimport { previousWindow } from '../widgets/comparison'\nimport { fillDailySeries, type SeriesPoint } from '../widgets/readForWidgetSeries'\n\nexport type FieldReadStatus = 'ok' | 'no-path' | 'not-bound' | 'not-configured' | 'unavailable'\n\nexport interface FieldReadResult {\n\tstatus: FieldReadStatus\n\tadapterId: string\n\tdateRange: DateRange\n\t/** The reporting timezone the read resolved in; the trend axis buckets in it. */\n\ttimezone: string\n\tmetrics: Partial<Record<MetricKey, number>>\n\t/** Requested metrics the adapter supports, in request order; the set actually read. */\n\tsupportedMetrics: MetricKey[]\n\t/** Requested metrics the adapter cannot serve, dropped from the read. */\n\tdroppedMetrics: MetricKey[]\n\t/** Previous-window totals, present only when comparison was requested and supported. */\n\tpreviousMetrics?: Partial<Record<MetricKey, number>>\n\t/** The previous comparable window, present only when comparison ran. */\n\tcomparisonRange?: DateRange\n\t/** Per-day series for the first supported metric, present only when requested. */\n\tpoints?: SeriesPoint[]\n}\n\nexport interface ReadForFieldArgs {\n\treq: PayloadRequest\n\tcollectionSlug: string\n\tdata: BindingDoc\n\tmetrics: MetricKey[]\n\ttimeframe: TimeframePreset\n\t/** Overrides the preset window (custom range). */\n\trange?: DateRange\n\tadapterId?: string\n\tnow: Date\n\t/** Explicit scope override; omitted resolves via the plugin's scopeResolver. */\n\tscope?: string | null\n\t/**\n\t * Reporting timezone the caller already resolved, reused rather than resolved again so\n\t * a caller-supplied `range` is read in the very timezone it was interpreted in.\n\t */\n\ttimezone?: string\n\t/** Also read the previous comparable window when the adapter supports comparison. */\n\tcompare?: boolean\n\t/** Also read a daily series for the first supported metric when the adapter can. */\n\tseries?: boolean\n}\n\n/**\n * Resolve a document's analytics for one display field: look up the runtime, resolve\n * the bound path, capability-gate the requested metrics against the active adapter,\n * then read through the surfacing engine. Returns a discriminated status so the\n * rendering component can show the right empty state without throwing.\n *\n * A metric the adapter does not support is dropped (with one warning per field\n * render), not fatal; `unavailable` is returned only when no requested metric\n * survives or the adapter cannot query per page at all.\n */\nexport const readForField = async (args: ReadForFieldArgs): Promise<FieldReadResult> => {\n\tconst { req, collectionSlug, data, metrics, timeframe, range, adapterId, now } = args\n\tlet dateRange = range ?? resolveTimeframe(timeframe, now)\n\tconst empty = { metrics: {}, supportedMetrics: [], droppedMetrics: [] }\n\tconst runtime = getRuntime(req.payload)\n\tif (!runtime) {\n\t\treturn {\n\t\t\tstatus: 'not-bound',\n\t\t\tadapterId: adapterId ?? '',\n\t\t\tdateRange,\n\t\t\ttimezone: args.timezone ?? DEFAULT_TIMEZONE,\n\t\t\t...empty,\n\t\t}\n\t}\n\tconst binding = runtime.bindings[collectionSlug]\n\tif (!binding) {\n\t\treturn {\n\t\t\tstatus: 'not-bound',\n\t\t\tadapterId: adapterId ?? '',\n\t\t\tdateRange,\n\t\t\ttimezone: args.timezone ?? DEFAULT_TIMEZONE,\n\t\t\t...empty,\n\t\t}\n\t}\n\tconst ctx = await resolveReadContext({ runtime, req, adapterId, scope: args.scope })\n\tif (!ctx.ok) {\n\t\treturn {\n\t\t\tstatus: 'unavailable',\n\t\t\tadapterId: adapterId ?? '',\n\t\t\tdateRange,\n\t\t\ttimezone: args.timezone ?? DEFAULT_TIMEZONE,\n\t\t\t...empty,\n\t\t}\n\t}\n\tconst tz = args.timezone ?? (await resolveTimezoneFor(runtime, req, ctx.scope))\n\tdateRange = range ?? resolveTimeframe(timeframe, now, tz)\n\tconst adapter: AnalyticsAdapter = ctx.adapter\n\tconst bindingCtx = { req, locale: req.locale ?? undefined }\n\tlet path: string | null\n\ttry {\n\t\tpath = await resolvePathCached(binding, data, bindingCtx)\n\t} catch {\n\t\tpath = null\n\t}\n\tif (!path) {\n\t\treturn { status: 'no-path', adapterId: adapter.id, dateRange, timezone: tz, ...empty }\n\t}\n\tif (!adapter.isConfigured()) {\n\t\treturn { status: 'not-configured', adapterId: adapter.id, dateRange, timezone: tz, ...empty }\n\t}\n\tconst supportedMetrics = metrics.filter((m) => adapter.capabilities.metrics.has(m))\n\tconst droppedMetrics = metrics.filter((m) => !adapter.capabilities.metrics.has(m))\n\tif (droppedMetrics.length > 0) {\n\t\treq.payload.logger.warn(\n\t\t\t`analytics: adapter \"${adapter.id}\" does not support metric(s) ${droppedMetrics.join(', ')}; dropped from the \"${collectionSlug}\" display field`\n\t\t)\n\t}\n\tif (\n\t\tsupportedMetrics.length === 0 ||\n\t\t!satisfiesCapabilities(adapter.capabilities, { metrics: supportedMetrics, perPageQuery: true })\n\t) {\n\t\treturn {\n\t\t\tstatus: 'unavailable',\n\t\t\tadapterId: adapter.id,\n\t\t\tdateRange,\n\t\t\ttimezone: tz,\n\t\t\tmetrics: {},\n\t\t\tsupportedMetrics: [],\n\t\t\tdroppedMetrics: metrics,\n\t\t}\n\t}\n\tconst hostname = await resolveHostname(binding, data, bindingCtx)\n\tconst base = { path, hostname, timezone: tz, scope: ctx.queryScope }\n\tconst comparisonRange =\n\t\targs.compare && runtime.comparison && adapter.capabilities.comparison\n\t\t\t? (previousWindow(dateRange, tz) ?? undefined)\n\t\t\t: undefined\n\tconst wantsSeries = args.series && supportsGranularity(adapter.capabilities, 'day')\n\tconst [result, previous, seriesResult] = await Promise.all([\n\t\truntime.engine.read(adapter, { ...base, metrics: supportedMetrics, dateRange }),\n\t\tcomparisonRange\n\t\t\t? runtime.engine.read(adapter, {\n\t\t\t\t\t...base,\n\t\t\t\t\tmetrics: supportedMetrics,\n\t\t\t\t\tdateRange: comparisonRange,\n\t\t\t\t})\n\t\t\t: undefined,\n\t\twantsSeries\n\t\t\t? runtime.engine.read(adapter, {\n\t\t\t\t\t...base,\n\t\t\t\t\tmetrics: [supportedMetrics[0] as MetricKey],\n\t\t\t\t\tdateRange,\n\t\t\t\t\tgranularity: 'day',\n\t\t\t\t})\n\t\t\t: undefined,\n\t])\n\treturn {\n\t\tstatus: 'ok',\n\t\tadapterId: adapter.id,\n\t\tdateRange,\n\t\ttimezone: tz,\n\t\tmetrics: result.totals ?? {},\n\t\tsupportedMetrics,\n\t\tdroppedMetrics,\n\t\tpreviousMetrics: previous ? (previous.totals ?? {}) : undefined,\n\t\tcomparisonRange,\n\t\tpoints: seriesResult\n\t\t\t? fillDailySeries({\n\t\t\t\t\trows: seriesResult.rows,\n\t\t\t\t\tdateRange,\n\t\t\t\t\tmetric: supportedMetrics[0] as MetricKey,\n\t\t\t\t\ttz,\n\t\t\t\t})\n\t\t\t: undefined,\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmEA,MAAa,eAAe,OAAO,SAAqD;CACvF,MAAM,EAAE,KAAK,gBAAgB,MAAM,SAAS,WAAW,OAAO,WAAW,QAAQ;CACjF,IAAI,YAAY,SAAS,iBAAiB,WAAW,GAAG;CACxD,MAAM,QAAQ;EAAE,SAAS,CAAC;EAAG,kBAAkB,CAAC;EAAG,gBAAgB,CAAC;CAAE;CACtE,MAAM,UAAU,WAAW,IAAI,OAAO;CACtC,IAAI,CAAC,SACJ,OAAO;EACN,QAAQ;EACR,WAAW,aAAa;EACxB;EACA,UAAU,KAAK,YAAA;EACf,GAAG;CACJ;CAED,MAAM,UAAU,QAAQ,SAAS;CACjC,IAAI,CAAC,SACJ,OAAO;EACN,QAAQ;EACR,WAAW,aAAa;EACxB;EACA,UAAU,KAAK,YAAA;EACf,GAAG;CACJ;CAED,MAAM,MAAM,MAAM,mBAAmB;EAAE;EAAS;EAAK;EAAW,OAAO,KAAK;CAAM,CAAC;CACnF,IAAI,CAAC,IAAI,IACR,OAAO;EACN,QAAQ;EACR,WAAW,aAAa;EACxB;EACA,UAAU,KAAK,YAAA;EACf,GAAG;CACJ;CAED,MAAM,KAAK,KAAK,YAAa,MAAM,mBAAmB,SAAS,KAAK,IAAI,KAAK;CAC7E,YAAY,SAAS,iBAAiB,WAAW,KAAK,EAAE;CACxD,MAAM,UAA4B,IAAI;CACtC,MAAM,aAAa;EAAE;EAAK,QAAQ,IAAI,UAAU,KAAA;CAAU;CAC1D,IAAI;CACJ,IAAI;EACH,OAAO,MAAM,kBAAkB,SAAS,MAAM,UAAU;CACzD,QAAQ;EACP,OAAO;CACR;CACA,IAAI,CAAC,MACJ,OAAO;EAAE,QAAQ;EAAW,WAAW,QAAQ;EAAI;EAAW,UAAU;EAAI,GAAG;CAAM;CAEtF,IAAI,CAAC,QAAQ,aAAa,GACzB,OAAO;EAAE,QAAQ;EAAkB,WAAW,QAAQ;EAAI;EAAW,UAAU;EAAI,GAAG;CAAM;CAE7F,MAAM,mBAAmB,QAAQ,QAAQ,MAAM,QAAQ,aAAa,QAAQ,IAAI,CAAC,CAAC;CAClF,MAAM,iBAAiB,QAAQ,QAAQ,MAAM,CAAC,QAAQ,aAAa,QAAQ,IAAI,CAAC,CAAC;CACjF,IAAI,eAAe,SAAS,GAC3B,IAAI,QAAQ,OAAO,KAClB,uBAAuB,QAAQ,GAAG,+BAA+B,eAAe,KAAK,IAAI,EAAE,sBAAsB,eAAe,gBACjI;CAED,IACC,iBAAiB,WAAW,KAC5B,CAAC,sBAAsB,QAAQ,cAAc;EAAE,SAAS;EAAkB,cAAc;CAAK,CAAC,GAE9F,OAAO;EACN,QAAQ;EACR,WAAW,QAAQ;EACnB;EACA,UAAU;EACV,SAAS,CAAC;EACV,kBAAkB,CAAC;EACnB,gBAAgB;CACjB;CAED,MAAM,WAAW,MAAM,gBAAgB,SAAS,MAAM,UAAU;CAChE,MAAM,OAAO;EAAE;EAAM;EAAU,UAAU;EAAI,OAAO,IAAI;CAAW;CACnE,MAAM,kBACL,KAAK,WAAW,QAAQ,cAAc,QAAQ,aAAa,aACvD,eAAe,WAAW,EAAE,KAAK,KAAA,IAClC,KAAA;CACJ,MAAM,cAAc,KAAK,UAAU,oBAAoB,QAAQ,cAAc,KAAK;CAClF,MAAM,CAAC,QAAQ,UAAU,gBAAgB,MAAM,QAAQ,IAAI;EAC1D,QAAQ,OAAO,KAAK,SAAS;GAAE,GAAG;GAAM,SAAS;GAAkB;EAAU,CAAC;EAC9E,kBACG,QAAQ,OAAO,KAAK,SAAS;GAC7B,GAAG;GACH,SAAS;GACT,WAAW;EACZ,CAAC,IACA,KAAA;EACH,cACG,QAAQ,OAAO,KAAK,SAAS;GAC7B,GAAG;GACH,SAAS,CAAC,iBAAiB,EAAe;GAC1C;GACA,aAAa;EACd,CAAC,IACA,KAAA;CACJ,CAAC;CACD,OAAO;EACN,QAAQ;EACR,WAAW,QAAQ;EACnB;EACA,UAAU;EACV,SAAS,OAAO,UAAU,CAAC;EAC3B;EACA;EACA,iBAAiB,WAAY,SAAS,UAAU,CAAC,IAAK,KAAA;EACtD;EACA,QAAQ,eACL,gBAAgB;GAChB,MAAM,aAAa;GACnB;GACA,QAAQ,iBAAiB;GACzB;EACD,CAAC,IACA,KAAA;CACJ;AACD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { keys } from "../translations/keys.js";
|
|
3
|
+
import { useTranslation as useTranslation$1 } from "../translations/useTranslation.js";
|
|
4
|
+
import { useAnalyticsGoals } from "./useAnalyticsGoals.js";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { FieldDescription, SelectInput, useConfig, useField, withCondition } from "@payloadcms/ui";
|
|
8
|
+
import { mergeFieldStyles } from "@payloadcms/ui/shared";
|
|
9
|
+
//#region src/goals/GoalSelectField.tsx
|
|
10
|
+
/** Admin placeholders are a plain string or a locale map; SelectInput wants one string. */
|
|
11
|
+
const resolvePlaceholder = (placeholder, locale) => typeof placeholder === "string" ? placeholder : placeholder?.[locale] ?? placeholder?.en;
|
|
12
|
+
/**
|
|
13
|
+
* Goal picker for a {@link goalField}: lists the config goals merged with the goals
|
|
14
|
+
* collection for the caller's scope and stores the picked goal's slug. While the fetch is
|
|
15
|
+
* in flight the picker renders with no options rather than a notice, so a slow answer
|
|
16
|
+
* never reads as "this install has no goals". Once it settles, an empty scope and a failed
|
|
17
|
+
* fetch each say so below the input, next to the field's own description rather than in
|
|
18
|
+
* place of it, and the picker stays editable either way so a stored slug can still be
|
|
19
|
+
* cleared.
|
|
20
|
+
*/
|
|
21
|
+
const GoalSelectFieldComponent = (props) => {
|
|
22
|
+
const { field, path: pathFromProps, readOnly } = props;
|
|
23
|
+
const { i18n, t } = useTranslation$1();
|
|
24
|
+
const { collection, error, goals } = useAnalyticsGoals();
|
|
25
|
+
const { customComponents: { AfterInput, BeforeInput, Description, Error: ErrorComponent, Label } = {}, disabled, path, setValue, showError, value } = useField({ potentiallyStalePath: pathFromProps });
|
|
26
|
+
const { config: { routes: { admin: adminRoute } } } = useConfig();
|
|
27
|
+
const options = useMemo(() => (goals ?? []).map((goal) => ({
|
|
28
|
+
label: goal.name,
|
|
29
|
+
value: goal.slug
|
|
30
|
+
})), [goals]);
|
|
31
|
+
const style = useMemo(() => mergeFieldStyles(field), [field]);
|
|
32
|
+
const empty = goals !== null && goals.length === 0;
|
|
33
|
+
const manageHref = collection ? `${adminRoute}/collections/${collection.slug}` : null;
|
|
34
|
+
const notice = empty ? /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "field-description",
|
|
36
|
+
children: [t(keys.fieldGoalEmpty), manageHref ? /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("a", {
|
|
37
|
+
href: manageHref,
|
|
38
|
+
children: t(keys.fieldGoalManage)
|
|
39
|
+
})] }) : null]
|
|
40
|
+
}) : error ? /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "field-description",
|
|
42
|
+
children: t(keys.fieldGoalError)
|
|
43
|
+
}) : null;
|
|
44
|
+
return /* @__PURE__ */ jsx(SelectInput, {
|
|
45
|
+
AfterInput,
|
|
46
|
+
BeforeInput,
|
|
47
|
+
className: field.admin?.className,
|
|
48
|
+
Description: notice ? /* @__PURE__ */ jsxs(Fragment, { children: [Description ?? /* @__PURE__ */ jsx(FieldDescription, {
|
|
49
|
+
description: field.admin?.description,
|
|
50
|
+
path
|
|
51
|
+
}), notice] }) : Description,
|
|
52
|
+
description: field.admin?.description,
|
|
53
|
+
Error: ErrorComponent,
|
|
54
|
+
isClearable: !field.required,
|
|
55
|
+
Label,
|
|
56
|
+
label: field.label,
|
|
57
|
+
localized: field.localized,
|
|
58
|
+
name: field.name,
|
|
59
|
+
onChange: (selected) => {
|
|
60
|
+
const option = Array.isArray(selected) ? selected[0] : selected;
|
|
61
|
+
setValue(option?.value ? String(option.value) : null);
|
|
62
|
+
},
|
|
63
|
+
options,
|
|
64
|
+
path,
|
|
65
|
+
placeholder: resolvePlaceholder(field.admin?.placeholder, i18n.language),
|
|
66
|
+
readOnly: readOnly || disabled || field.admin?.readOnly,
|
|
67
|
+
required: field.required,
|
|
68
|
+
showError,
|
|
69
|
+
style,
|
|
70
|
+
value
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const GoalSelectField = withCondition(GoalSelectFieldComponent);
|
|
74
|
+
//#endregion
|
|
75
|
+
export { GoalSelectField };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=GoalSelectField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoalSelectField.js","names":["useTranslation"],"sources":["../../src/goals/GoalSelectField.tsx"],"sourcesContent":["'use client'\n\nimport {\n\tFieldDescription,\n\ttype ReactSelectOption,\n\tSelectInput,\n\tuseConfig,\n\tuseField,\n\twithCondition,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport type { TextFieldClientProps } from 'payload'\nimport { useMemo } from 'react'\nimport { keys } from '../translations/keys'\nimport { useTranslation } from '../translations/useTranslation'\nimport { useAnalyticsGoals } from './useAnalyticsGoals'\n\n/** Admin placeholders are a plain string or a locale map; SelectInput wants one string. */\nconst resolvePlaceholder = (\n\tplaceholder: Record<string, string> | string | undefined,\n\tlocale: string\n): string | undefined =>\n\ttypeof placeholder === 'string' ? placeholder : (placeholder?.[locale] ?? placeholder?.en)\n\n/**\n * Goal picker for a {@link goalField}: lists the config goals merged with the goals\n * collection for the caller's scope and stores the picked goal's slug. While the fetch is\n * in flight the picker renders with no options rather than a notice, so a slow answer\n * never reads as \"this install has no goals\". Once it settles, an empty scope and a failed\n * fetch each say so below the input, next to the field's own description rather than in\n * place of it, and the picker stays editable either way so a stored slug can still be\n * cleared.\n */\nconst GoalSelectFieldComponent = (props: TextFieldClientProps) => {\n\tconst { field, path: pathFromProps, readOnly } = props\n\tconst { i18n, t } = useTranslation()\n\tconst { collection, error, goals } = useAnalyticsGoals()\n\tconst {\n\t\tcustomComponents: { AfterInput, BeforeInput, Description, Error: ErrorComponent, Label } = {},\n\t\tdisabled,\n\t\tpath,\n\t\tsetValue,\n\t\tshowError,\n\t\tvalue,\n\t} = useField<string>({ potentiallyStalePath: pathFromProps })\n\tconst {\n\t\tconfig: {\n\t\t\troutes: { admin: adminRoute },\n\t\t},\n\t} = useConfig()\n\n\tconst options = useMemo(\n\t\t() => (goals ?? []).map((goal) => ({ label: goal.name, value: goal.slug })),\n\t\t[goals]\n\t)\n\tconst style = useMemo(() => mergeFieldStyles(field), [field])\n\n\tconst empty = goals !== null && goals.length === 0\n\tconst manageHref = collection ? `${adminRoute}/collections/${collection.slug}` : null\n\tconst notice = empty ? (\n\t\t<div className=\"field-description\">\n\t\t\t{t(keys.fieldGoalEmpty)}\n\t\t\t{manageHref ? (\n\t\t\t\t<>\n\t\t\t\t\t{' '}\n\t\t\t\t\t<a href={manageHref}>{t(keys.fieldGoalManage)}</a>\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t</div>\n\t) : error ? (\n\t\t<div className=\"field-description\">{t(keys.fieldGoalError)}</div>\n\t) : null\n\n\treturn (\n\t\t<SelectInput\n\t\t\tAfterInput={AfterInput}\n\t\t\tBeforeInput={BeforeInput}\n\t\t\tclassName={field.admin?.className}\n\t\t\tDescription={\n\t\t\t\tnotice ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{Description ?? <FieldDescription description={field.admin?.description} path={path} />}\n\t\t\t\t\t\t{notice}\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tDescription\n\t\t\t\t)\n\t\t\t}\n\t\t\tdescription={field.admin?.description}\n\t\t\tError={ErrorComponent}\n\t\t\tisClearable={!field.required}\n\t\t\tLabel={Label}\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tname={field.name}\n\t\t\tonChange={(selected: ReactSelectOption | ReactSelectOption[]) => {\n\t\t\t\tconst option = Array.isArray(selected) ? selected[0] : selected\n\t\t\t\tsetValue(option?.value ? String(option.value) : null)\n\t\t\t}}\n\t\t\toptions={options}\n\t\t\tpath={path}\n\t\t\tplaceholder={resolvePlaceholder(field.admin?.placeholder, i18n.language)}\n\t\t\treadOnly={readOnly || disabled || field.admin?.readOnly}\n\t\t\trequired={field.required}\n\t\t\tshowError={showError}\n\t\t\tstyle={style}\n\t\t\tvalue={value}\n\t\t/>\n\t)\n}\n\nexport const GoalSelectField = withCondition(GoalSelectFieldComponent)\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,sBACL,aACA,WAEA,OAAO,gBAAgB,WAAW,cAAe,cAAc,WAAW,aAAa;;;;;;;;;;AAWxF,MAAM,4BAA4B,UAAgC;CACjE,MAAM,EAAE,OAAO,MAAM,eAAe,aAAa;CACjD,MAAM,EAAE,MAAM,MAAMA,iBAAe;CACnC,MAAM,EAAE,YAAY,OAAO,UAAU,kBAAkB;CACvD,MAAM,EACL,kBAAkB,EAAE,YAAY,aAAa,aAAa,OAAO,gBAAgB,UAAU,CAAC,GAC5F,UACA,MACA,UACA,WACA,UACG,SAAiB,EAAE,sBAAsB,cAAc,CAAC;CAC5D,MAAM,EACL,QAAQ,EACP,QAAQ,EAAE,OAAO,mBAEf,UAAU;CAEd,MAAM,UAAU,eACR,SAAS,CAAC,GAAG,KAAK,UAAU;EAAE,OAAO,KAAK;EAAM,OAAO,KAAK;CAAK,EAAE,GAC1E,CAAC,KAAK,CACP;CACA,MAAM,QAAQ,cAAc,iBAAiB,KAAK,GAAG,CAAC,KAAK,CAAC;CAE5D,MAAM,QAAQ,UAAU,QAAQ,MAAM,WAAW;CACjD,MAAM,aAAa,aAAa,GAAG,WAAW,eAAe,WAAW,SAAS;CACjF,MAAM,SAAS,QACd,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,EAAE,KAAK,cAAc,GACrB,aACA,qBAAA,UAAA,EAAA,UAAA,CACE,KACD,oBAAC,KAAD;GAAG,MAAM;aAAa,EAAE,KAAK,eAAe;EAAK,CAAA,CAChD,EAAA,CAAA,IACC,IACA;MACF,QACH,oBAAC,OAAD;EAAK,WAAU;YAAqB,EAAE,KAAK,cAAc;CAAO,CAAA,IAC7D;CAEJ,OACC,oBAAC,aAAD;EACa;EACC;EACb,WAAW,MAAM,OAAO;EACxB,aACC,SACC,qBAAA,UAAA,EAAA,UAAA,CACE,eAAe,oBAAC,kBAAD;GAAkB,aAAa,MAAM,OAAO;GAAmB;EAAO,CAAA,GACrF,MACA,EAAA,CAAA,IAEF;EAGF,aAAa,MAAM,OAAO;EAC1B,OAAO;EACP,aAAa,CAAC,MAAM;EACb;EACP,OAAO,MAAM;EACb,WAAW,MAAM;EACjB,MAAM,MAAM;EACZ,WAAW,aAAsD;GAChE,MAAM,SAAS,MAAM,QAAQ,QAAQ,IAAI,SAAS,KAAK;GACvD,SAAS,QAAQ,QAAQ,OAAO,OAAO,KAAK,IAAI,IAAI;EACrD;EACS;EACH;EACN,aAAa,mBAAmB,MAAM,OAAO,aAAa,KAAK,QAAQ;EACvE,UAAU,YAAY,YAAY,MAAM,OAAO;EAC/C,UAAU,MAAM;EACL;EACJ;EACA;CACP,CAAA;AAEH;AAEA,MAAa,kBAAkB,cAAc,wBAAwB"}
|