@defra/forms-model 4.0.3 → 4.0.4

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.
@@ -3,6 +3,7 @@ export let FormMetricType = /*#__PURE__*/function (FormMetricType) {
3
3
  FormMetricType["OverviewMetric"] = "overview-metric";
4
4
  FormMetricType["TimelineMetric"] = "timeline-metric";
5
5
  FormMetricType["DrilldownMetric"] = "drilldown-metric";
6
+ FormMetricType["FunctionalAreaTotalsMetric"] = "functional-area-totals-metric";
6
7
  return FormMetricType;
7
8
  }({});
8
9
  export let FormMetricName = /*#__PURE__*/function (FormMetricName) {
@@ -14,4 +15,22 @@ export let FormMetricName = /*#__PURE__*/function (FormMetricName) {
14
15
  FormMetricName["TimeToPublish"] = "TimeToPublish";
15
16
  return FormMetricName;
16
17
  }({});
18
+ export let FunctionalAreaType = /*#__PURE__*/function (FunctionalAreaType) {
19
+ FunctionalAreaType["Signin"] = "Signin"; // Add these later as needed
20
+ // CopyAnswers = 'copy-answers',
21
+ // EditAndResubmit = 'edit-and-resubmit'
22
+ return FunctionalAreaType;
23
+ }({});
24
+ export let SigninMetricName = /*#__PURE__*/function (SigninMetricName) {
25
+ SigninMetricName["Registration"] = "Registration";
26
+ SigninMetricName["SuccessfulAuthentication"] = "SuccessfulAuthentication";
27
+ SigninMetricName["TooManyCodeRequests"] = "TooManyCodeRequests";
28
+ SigninMetricName["IncorrectCodeEntered"] = "IncorrectCodeEntered";
29
+ SigninMetricName["AccountDeletion"] = "AccountDeletion";
30
+ SigninMetricName["EmailAddressUpdate"] = "EmailAddressUpdate";
31
+ SigninMetricName["PhoneNumberUpdate"] = "PhoneNumberUpdate"; // Add these when 'forgotten details' journey is implemented
32
+ // ForgottenDetailsJourney = 'ForgottenDetailsJourney',
33
+ // PhoneNumberNotAssociatedWithAccount = 'PhoneNumberNotAssociatedWithAccount'
34
+ return SigninMetricName;
35
+ }({});
17
36
  //# sourceMappingURL=enums.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","names":["FormMetricType","FormMetricName"],"sources":["../../../../src/form/form-metrics/enums.ts"],"sourcesContent":["export enum FormMetricType {\n TotalsMetric = 'totals-metric',\n OverviewMetric = 'overview-metric',\n TimelineMetric = 'timeline-metric',\n DrilldownMetric = 'drilldown-metric'\n}\n\nexport enum FormMetricName {\n NewFormsCreated = 'NewFormsCreated',\n FormsFirstPublished = 'FormsFirstPublished',\n FormsRePublished = 'FormsRePublished',\n Submissions = 'Submissions',\n FormsInDraft = 'FormsInDraft',\n TimeToPublish = 'TimeToPublish'\n}\n"],"mappings":"AAAA,WAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAO1B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"enums.js","names":["FormMetricType","FormMetricName","FunctionalAreaType","SigninMetricName"],"sources":["../../../../src/form/form-metrics/enums.ts"],"sourcesContent":["export enum FormMetricType {\n TotalsMetric = 'totals-metric',\n OverviewMetric = 'overview-metric',\n TimelineMetric = 'timeline-metric',\n DrilldownMetric = 'drilldown-metric',\n FunctionalAreaTotalsMetric = 'functional-area-totals-metric'\n}\n\nexport enum FormMetricName {\n NewFormsCreated = 'NewFormsCreated',\n FormsFirstPublished = 'FormsFirstPublished',\n FormsRePublished = 'FormsRePublished',\n Submissions = 'Submissions',\n FormsInDraft = 'FormsInDraft',\n TimeToPublish = 'TimeToPublish'\n}\n\nexport enum FunctionalAreaType {\n Signin = 'Signin'\n // Add these later as needed\n // CopyAnswers = 'copy-answers',\n // EditAndResubmit = 'edit-and-resubmit'\n}\n\nexport enum SigninMetricName {\n Registration = 'Registration',\n SuccessfulAuthentication = 'SuccessfulAuthentication',\n TooManyCodeRequests = 'TooManyCodeRequests',\n IncorrectCodeEntered = 'IncorrectCodeEntered',\n AccountDeletion = 'AccountDeletion',\n EmailAddressUpdate = 'EmailAddressUpdate',\n PhoneNumberUpdate = 'PhoneNumberUpdate'\n // Add these when 'forgotten details' journey is implemented\n // ForgottenDetailsJourney = 'ForgottenDetailsJourney',\n // PhoneNumberNotAssociatedWithAccount = 'PhoneNumberNotAssociatedWithAccount'\n}\n"],"mappings":"AAAA,WAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAQ1B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAS1B,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB,uBAE5B;EACA;EACA;EAAA,OAJUA,kBAAkB;AAAA;AAO9B,WAAYC,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB,6CAQ1B;EACA;EACA;EAAA,OAVUA,gBAAgB;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-metrics/types.ts"],"sourcesContent":["import { type FormStatus } from '~/src/common/enums.js'\nimport {\n type FormMetricName,\n type FormMetricType\n} from '~/src/form/form-metrics/enums.js'\n\nexport interface FormTotalMetric {\n count?: number\n details?: {\n formId: string\n metricValue?: string | Date | number\n createdAt?: Date\n }\n}\n\nexport interface FormTotalsMetric {\n type: FormMetricType.TotalsMetric\n last7Days?: Record<FormMetricName, FormTotalMetric>\n prev7Days?: Record<FormMetricName, FormTotalMetric>\n last30Days?: Record<FormMetricName, FormTotalMetric>\n prev30Days?: Record<FormMetricName, FormTotalMetric>\n lastYear?: Record<FormMetricName, FormTotalMetric>\n prevYear?: Record<FormMetricName, FormTotalMetric>\n allTime?: Record<FormMetricName, FormTotalMetric>\n liveSubmissions?: Record<string, number>\n draftSubmissions?: Record<string, number>\n daysToPublish?: Record<string, number>\n republished?: Record<string, number>\n language?: string\n updatedAt: Date\n earliestDate: Date\n}\n\nexport interface FormOverviewMetric {\n type: FormMetricType.OverviewMetric\n formId: string\n formStatus: FormStatus\n summaryMetrics: Record<string, number | string | string[]>\n featureMetrics: Record<string, Map<string, number>>\n submissionsCount: number\n updatedAt: Date\n language?: string\n}\n\nexport interface FormTimelineMetric {\n type: FormMetricType.TimelineMetric\n formId: string\n formStatus: FormStatus\n metricName: FormMetricName\n language?: string\n metricValue: number\n createdAt: Date\n}\n\nexport interface FormDrilldownMetric {\n type: FormMetricType.DrilldownMetric\n formId: string\n metricName: FormMetricName\n metricValue: number\n periodName: string\n createdAt: Date\n language?: string\n}\n\nexport type FormMetric =\n | FormTotalsMetric\n | FormOverviewMetric\n | FormTimelineMetric\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-metrics/types.ts"],"sourcesContent":["import { type FormStatus } from '~/src/common/enums.js'\nimport {\n type FormMetricName,\n type FormMetricType,\n type FunctionalAreaType,\n type SigninMetricName\n} from '~/src/form/form-metrics/enums.js'\n\nexport interface FormTotalMetric {\n count?: number\n details?: {\n formId: string\n metricValue?: string | Date | number\n createdAt?: Date\n }\n}\n\nexport interface FormTotalsMetric {\n type: FormMetricType.TotalsMetric\n last7Days?: Record<FormMetricName, FormTotalMetric>\n prev7Days?: Record<FormMetricName, FormTotalMetric>\n last30Days?: Record<FormMetricName, FormTotalMetric>\n prev30Days?: Record<FormMetricName, FormTotalMetric>\n lastYear?: Record<FormMetricName, FormTotalMetric>\n prevYear?: Record<FormMetricName, FormTotalMetric>\n allTime?: Record<FormMetricName, FormTotalMetric>\n liveSubmissions?: Record<string, number>\n draftSubmissions?: Record<string, number>\n daysToPublish?: Record<string, number>\n republished?: Record<string, number>\n language?: string\n updatedAt: Date\n earliestDate: Date\n}\n\nexport interface FormOverviewMetric {\n type: FormMetricType.OverviewMetric\n formId: string\n formStatus: FormStatus\n summaryMetrics: Record<string, number | string | string[]>\n featureMetrics: Record<string, Map<string, number>>\n submissionsCount: number\n updatedAt: Date\n language?: string\n}\n\nexport interface FormTimelineMetric {\n type: FormMetricType.TimelineMetric\n formId: string\n formStatus: FormStatus\n metricName: FormMetricName\n language?: string\n metricValue: number\n createdAt: Date\n}\n\nexport interface FormDrilldownMetric {\n type: FormMetricType.DrilldownMetric\n formId: string\n metricName: FormMetricName\n metricValue: number\n periodName: string\n createdAt: Date\n language?: string\n}\n\nexport type FormMetric =\n | FormTotalsMetric\n | FormOverviewMetric\n | FormTimelineMetric\n\nexport interface SigninTimelineMetric {\n type: FormMetricType.TimelineMetric\n metricName: SigninMetricName\n metricValue: number\n createdAt: Date\n}\n\nexport type FunctionalAreaMetricName = SigninMetricName\n// Add 'copy' and 'edit' metric names as needed\n\nexport interface FunctionalAreaTotalMetric {\n count: number\n}\n\nexport interface FunctionalAreaTotalsMetric {\n type: FormMetricType.FunctionalAreaTotalsMetric\n area: FunctionalAreaType\n last7Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>\n prev7Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>\n last30Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>\n prev30Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>\n lastYear?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>\n prevYear?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>\n allTime?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>\n updatedAt: Date\n earliestDate: Date\n}\n"],"mappings":"","ignoreList":[]}
@@ -2,7 +2,8 @@ export declare enum FormMetricType {
2
2
  TotalsMetric = "totals-metric",
3
3
  OverviewMetric = "overview-metric",
4
4
  TimelineMetric = "timeline-metric",
5
- DrilldownMetric = "drilldown-metric"
5
+ DrilldownMetric = "drilldown-metric",
6
+ FunctionalAreaTotalsMetric = "functional-area-totals-metric"
6
7
  }
7
8
  export declare enum FormMetricName {
8
9
  NewFormsCreated = "NewFormsCreated",
@@ -12,4 +13,16 @@ export declare enum FormMetricName {
12
13
  FormsInDraft = "FormsInDraft",
13
14
  TimeToPublish = "TimeToPublish"
14
15
  }
16
+ export declare enum FunctionalAreaType {
17
+ Signin = "Signin"
18
+ }
19
+ export declare enum SigninMetricName {
20
+ Registration = "Registration",
21
+ SuccessfulAuthentication = "SuccessfulAuthentication",
22
+ TooManyCodeRequests = "TooManyCodeRequests",
23
+ IncorrectCodeEntered = "IncorrectCodeEntered",
24
+ AccountDeletion = "AccountDeletion",
25
+ EmailAddressUpdate = "EmailAddressUpdate",
26
+ PhoneNumberUpdate = "PhoneNumberUpdate"
27
+ }
15
28
  //# sourceMappingURL=enums.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../src/form/form-metrics/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,YAAY,kBAAkB;IAC9B,cAAc,oBAAoB;IAClC,cAAc,oBAAoB;IAClC,eAAe,qBAAqB;CACrC;AAED,oBAAY,cAAc;IACxB,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../src/form/form-metrics/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,YAAY,kBAAkB;IAC9B,cAAc,oBAAoB;IAClC,cAAc,oBAAoB;IAClC,eAAe,qBAAqB;IACpC,0BAA0B,kCAAkC;CAC7D;AAED,oBAAY,cAAc;IACxB,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;CAIlB;AAED,oBAAY,gBAAgB;IAC1B,YAAY,iBAAiB;IAC7B,wBAAwB,6BAA6B;IACrD,mBAAmB,wBAAwB;IAC3C,oBAAoB,yBAAyB;IAC7C,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;CAIxC"}
@@ -1,5 +1,5 @@
1
1
  import { type FormStatus } from '../../common/enums.js';
2
- import { type FormMetricName, type FormMetricType } from '../../form/form-metrics/enums.js';
2
+ import { type FormMetricName, type FormMetricType, type FunctionalAreaType, type SigninMetricName } from '../../form/form-metrics/enums.js';
3
3
  export interface FormTotalMetric {
4
4
  count?: number;
5
5
  details?: {
@@ -54,4 +54,27 @@ export interface FormDrilldownMetric {
54
54
  language?: string;
55
55
  }
56
56
  export type FormMetric = FormTotalsMetric | FormOverviewMetric | FormTimelineMetric;
57
+ export interface SigninTimelineMetric {
58
+ type: FormMetricType.TimelineMetric;
59
+ metricName: SigninMetricName;
60
+ metricValue: number;
61
+ createdAt: Date;
62
+ }
63
+ export type FunctionalAreaMetricName = SigninMetricName;
64
+ export interface FunctionalAreaTotalMetric {
65
+ count: number;
66
+ }
67
+ export interface FunctionalAreaTotalsMetric {
68
+ type: FormMetricType.FunctionalAreaTotalsMetric;
69
+ area: FunctionalAreaType;
70
+ last7Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>;
71
+ prev7Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>;
72
+ last30Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>;
73
+ prev30Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>;
74
+ lastYear?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>;
75
+ prevYear?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>;
76
+ allTime?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>;
77
+ updatedAt: Date;
78
+ earliestDate: Date;
79
+ }
57
80
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-metrics/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAA;AAEzC,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAA;QACpC,SAAS,CAAC,EAAE,IAAI,CAAA;KACjB,CAAA;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC,YAAY,CAAA;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,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AAkB,CAAA;AAEtB,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,cAAc,CAAC,cAAc,CAAA;IACnC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,CAAA;AAGvD,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,cAAc,CAAC,0BAA0B,CAAA;IAC/C,IAAI,EAAE,kBAAkB,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;IACrE,SAAS,EAAE,IAAI,CAAA;IACf,YAAY,EAAE,IAAI,CAAA;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-model#readme",
6
6
  "types": "dist/types/index.d.ts",
@@ -2,7 +2,8 @@ export enum FormMetricType {
2
2
  TotalsMetric = 'totals-metric',
3
3
  OverviewMetric = 'overview-metric',
4
4
  TimelineMetric = 'timeline-metric',
5
- DrilldownMetric = 'drilldown-metric'
5
+ DrilldownMetric = 'drilldown-metric',
6
+ FunctionalAreaTotalsMetric = 'functional-area-totals-metric'
6
7
  }
7
8
 
8
9
  export enum FormMetricName {
@@ -13,3 +14,23 @@ export enum FormMetricName {
13
14
  FormsInDraft = 'FormsInDraft',
14
15
  TimeToPublish = 'TimeToPublish'
15
16
  }
17
+
18
+ export enum FunctionalAreaType {
19
+ Signin = 'Signin'
20
+ // Add these later as needed
21
+ // CopyAnswers = 'copy-answers',
22
+ // EditAndResubmit = 'edit-and-resubmit'
23
+ }
24
+
25
+ export enum SigninMetricName {
26
+ Registration = 'Registration',
27
+ SuccessfulAuthentication = 'SuccessfulAuthentication',
28
+ TooManyCodeRequests = 'TooManyCodeRequests',
29
+ IncorrectCodeEntered = 'IncorrectCodeEntered',
30
+ AccountDeletion = 'AccountDeletion',
31
+ EmailAddressUpdate = 'EmailAddressUpdate',
32
+ PhoneNumberUpdate = 'PhoneNumberUpdate'
33
+ // Add these when 'forgotten details' journey is implemented
34
+ // ForgottenDetailsJourney = 'ForgottenDetailsJourney',
35
+ // PhoneNumberNotAssociatedWithAccount = 'PhoneNumberNotAssociatedWithAccount'
36
+ }
@@ -1,7 +1,9 @@
1
1
  import { type FormStatus } from '~/src/common/enums.js'
2
2
  import {
3
3
  type FormMetricName,
4
- type FormMetricType
4
+ type FormMetricType,
5
+ type FunctionalAreaType,
6
+ type SigninMetricName
5
7
  } from '~/src/form/form-metrics/enums.js'
6
8
 
7
9
  export interface FormTotalMetric {
@@ -66,3 +68,31 @@ export type FormMetric =
66
68
  | FormTotalsMetric
67
69
  | FormOverviewMetric
68
70
  | FormTimelineMetric
71
+
72
+ export interface SigninTimelineMetric {
73
+ type: FormMetricType.TimelineMetric
74
+ metricName: SigninMetricName
75
+ metricValue: number
76
+ createdAt: Date
77
+ }
78
+
79
+ export type FunctionalAreaMetricName = SigninMetricName
80
+ // Add 'copy' and 'edit' metric names as needed
81
+
82
+ export interface FunctionalAreaTotalMetric {
83
+ count: number
84
+ }
85
+
86
+ export interface FunctionalAreaTotalsMetric {
87
+ type: FormMetricType.FunctionalAreaTotalsMetric
88
+ area: FunctionalAreaType
89
+ last7Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>
90
+ prev7Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>
91
+ last30Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>
92
+ prev30Days?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>
93
+ lastYear?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>
94
+ prevYear?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>
95
+ allTime?: Record<FunctionalAreaMetricName, FunctionalAreaTotalMetric>
96
+ updatedAt: Date
97
+ earliestDate: Date
98
+ }