@tolinax/ayoune-interfaces 2026.40.0 → 2026.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -234,6 +234,7 @@ export declare enum aMN {
234
234
  CustomFunctionLogs = "CustomFunctionLogs",
235
235
  CustomerDashboards = "CustomerDashboards",
236
236
  CustomerDatas = "CustomerDatas",
237
+ CustomerWidgets = "CustomerWidgets",
237
238
  Customers = "Customers",
238
239
  CustomerTokens = "CustomerTokens",
239
240
  CustomVariables = "CustomVariables",
@@ -238,6 +238,7 @@ var aMN;
238
238
  aMN["CustomFunctionLogs"] = "CustomFunctionLogs";
239
239
  aMN["CustomerDashboards"] = "CustomerDashboards";
240
240
  aMN["CustomerDatas"] = "CustomerDatas";
241
+ aMN["CustomerWidgets"] = "CustomerWidgets";
241
242
  aMN["Customers"] = "Customers";
242
243
  aMN["CustomerTokens"] = "CustomerTokens";
243
244
  aMN["CustomVariables"] = "CustomVariables";
@@ -41,6 +41,20 @@ export interface IModelAndRight {
41
41
  singular: string;
42
42
  module: string;
43
43
  right: string;
44
+ /**
45
+ * Additional rights beyond the default `right` + standard `.new|.edit|.delete`
46
+ * extensions. Use for scoped access variants where the base right grants full
47
+ * access and a child right grants a restricted slice.
48
+ *
49
+ * Example: Credentials has `right: "config.credentials"` (full access) plus
50
+ * `childRights: ["config.credentials.consumer"]` — the latter grants
51
+ * read-only access scoped to credentials whose `_consumerID` points to a
52
+ * consumer the user is linked to via editor/editors/team/g_* fields.
53
+ *
54
+ * Admin-rights UI SHOULD enumerate these alongside the base right so they
55
+ * can be granted independently.
56
+ */
57
+ childRights?: string[];
44
58
  readOnly: boolean;
45
59
  importable: boolean;
46
60
  allowDuplicate: boolean;
@@ -55,6 +69,7 @@ export interface IModelAndRight {
55
69
  piiLevel?: PIILevel;
56
70
  availableInSDK?: boolean;
57
71
  sdkOperations?: SDKOperation[];
72
+ allowStreaming?: boolean;
58
73
  }
59
74
  declare const modelsAndRights: IModelAndRight[];
60
75
  export default modelsAndRights;
@@ -762,6 +762,7 @@ const modelsAndRights = [
762
762
  allowDuplicate: false,
763
763
  updateBy: "_id",
764
764
  availableInSDK: false,
765
+ allowStreaming: true,
765
766
  },
766
767
  {
767
768
  plural: "Ads",
@@ -773,6 +774,7 @@ const modelsAndRights = [
773
774
  allowDuplicate: false,
774
775
  updateBy: "_id",
775
776
  availableInSDK: false,
777
+ allowStreaming: true,
776
778
  },
777
779
  {
778
780
  plural: "AdTypes",
@@ -2876,11 +2878,13 @@ const modelsAndRights = [
2876
2878
  singular: "Credential",
2877
2879
  module: "config",
2878
2880
  right: "config.credentials",
2881
+ childRights: ["config.credentials.consumer"],
2879
2882
  readOnly: false,
2880
2883
  importable: false,
2881
2884
  allowDuplicate: false,
2882
2885
  updateBy: "_id",
2883
2886
  availableInSDK: false,
2887
+ piiLevel: "high",
2884
2888
  },
2885
2889
  {
2886
2890
  plural: "Credits",
@@ -2981,6 +2985,52 @@ const modelsAndRights = [
2981
2985
  updateBy: "_id",
2982
2986
  availableInSDK: false,
2983
2987
  },
2988
+ {
2989
+ plural: "CustomerWidgets",
2990
+ singular: "CustomerWidget",
2991
+ module: "reporting",
2992
+ right: "reports.customer-widgets",
2993
+ childRights: [
2994
+ "reports.customer-widgets.ai-create",
2995
+ "reports.customer-widgets.public",
2996
+ ],
2997
+ readOnly: false,
2998
+ importable: false,
2999
+ allowDuplicate: true,
3000
+ updateBy: "_id",
3001
+ labelKey: "model.customerWidget.label",
3002
+ labelPluralKey: "model.customerWidget.labelPlural",
3003
+ descriptionKey: "model.customerWidget.description",
3004
+ piiLevel: "low",
3005
+ availableInSDK: true,
3006
+ sdkOperations: ["find", "findOne", "insert", "update", "count"],
3007
+ allowStreaming: true,
3008
+ actions: [
3009
+ {
3010
+ title: "Render now",
3011
+ action: "render",
3012
+ availability: "both",
3013
+ method: "POST",
3014
+ icon: "refresh",
3015
+ },
3016
+ {
3017
+ title: "Duplicate",
3018
+ action: "duplicate",
3019
+ availability: "single",
3020
+ method: "POST",
3021
+ icon: "content_copy",
3022
+ },
3023
+ {
3024
+ title: "Share public",
3025
+ action: "share-public",
3026
+ availability: "single",
3027
+ method: "POST",
3028
+ icon: "share",
3029
+ },
3030
+ ],
3031
+ searchable: true,
3032
+ searchableFields: ["title", "slug", "labels"],
3033
+ },
2984
3034
  {
2985
3035
  plural: "Customers",
2986
3036
  singular: "Customer",
@@ -5217,6 +5267,7 @@ const modelsAndRights = [
5217
5267
  allowDuplicate: false,
5218
5268
  updateBy: "_id",
5219
5269
  availableInSDK: false,
5270
+ allowStreaming: true,
5220
5271
  },
5221
5272
  {
5222
5273
  plural: "Organics",
@@ -5228,6 +5279,7 @@ const modelsAndRights = [
5228
5279
  allowDuplicate: false,
5229
5280
  updateBy: "_id",
5230
5281
  availableInSDK: false,
5282
+ allowStreaming: true,
5231
5283
  },
5232
5284
  {
5233
5285
  plural: "OutgoingMails",
@@ -5730,6 +5782,7 @@ const modelsAndRights = [
5730
5782
  allowDuplicate: false,
5731
5783
  updateBy: "_id",
5732
5784
  availableInSDK: false,
5785
+ allowStreaming: true,
5733
5786
  },
5734
5787
  {
5735
5788
  plural: "ProductListingAdsResults",
@@ -5741,6 +5794,7 @@ const modelsAndRights = [
5741
5794
  allowDuplicate: false,
5742
5795
  updateBy: "_id",
5743
5796
  availableInSDK: false,
5797
+ allowStreaming: true,
5744
5798
  },
5745
5799
  {
5746
5800
  plural: "ProductLists",
@@ -6386,6 +6440,7 @@ const modelsAndRights = [
6386
6440
  allowDuplicate: false,
6387
6441
  updateBy: "_id",
6388
6442
  availableInSDK: false,
6443
+ allowStreaming: true,
6389
6444
  },
6390
6445
  {
6391
6446
  plural: "ServiceAssignments",
@@ -0,0 +1,57 @@
1
+ import { IDefaultFields } from "./IDefaultFields";
2
+ /**
3
+ * Customer-scoped widget instance. References a template from aYOUneWidgets
4
+ * (or carries an inline chartConfig for ad-hoc / AI-authored widgets) and
5
+ * holds resolved params plus the latest prerender URLs.
6
+ *
7
+ * Added 2026-04-17 as part of the widget prerender / chart-in-email foundation.
8
+ * See: C:\Users\maxim\.claude\plans\widget-foundation-echarts-ssr.md
9
+ */
10
+ export interface ICustomerWidget extends IDefaultFields {
11
+ _customerID: ObjectId;
12
+ _clientID?: ObjectId[];
13
+ _subID?: ObjectId[];
14
+ /** Optional FK to aYOUneWidgets template. Null = ad-hoc / AI-authored. */
15
+ _widgetID?: ObjectId;
16
+ /** Customer-facing name. */
17
+ title?: string;
18
+ /** Stable customer-local slug. Unique per (customerID, slug). */
19
+ slug?: string;
20
+ /** Bound values for the template's paramSchema. */
21
+ params?: Record<string, any>;
22
+ /** Stable hash of (widgetID + sorted params) — cache key for prerenders. */
23
+ paramsHash?: string;
24
+ /**
25
+ * Optional overrides of the template's chartConfig / dataConfig.
26
+ * Under ECharts mode, chartConfig is an EChartsOption JSON.
27
+ */
28
+ chartConfig?: any;
29
+ dataConfig?: any;
30
+ /** Rendered image URLs. Populated by widget-prerender-worker. */
31
+ renderedImageUrl?: {
32
+ svg?: string;
33
+ png?: string;
34
+ };
35
+ /** When the last successful render completed. */
36
+ renderedAt?: Date;
37
+ /** Hash of the input data that produced the cached render. */
38
+ dataHash?: string;
39
+ /** How this widget came to exist — drives rights + audit. */
40
+ source?: "manual" | "ai-copilot" | "template" | "scheduled" | "custom-function";
41
+ /** Per-widget freshness policy (overrides mail template defaults). */
42
+ freshness?: {
43
+ /** Max acceptable age in seconds. */
44
+ maxAgeSeconds?: number;
45
+ /** Refresh on save of matching source collections (requires change-stream hook). */
46
+ refreshOnChangeOf?: string[];
47
+ };
48
+ /** Free-form tags — dashboards use these for filtering / grouping. */
49
+ labels?: string[];
50
+ /** Soft-delete flag — default true. */
51
+ active?: boolean;
52
+ /** Share-public URL token; set only when reports.customer-widgets.public granted + action invoked. */
53
+ publicToken?: string;
54
+ /** User-visible render status — surfaces failures in admin UI. */
55
+ renderStatus?: "pending" | "rendering" | "ready" | "failed";
56
+ renderError?: string;
57
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Parameter schema for widget templates. Declared on IaYOUneWidget.paramSchema[]
3
+ * so instances (ICustomerWidget) can bind concrete values that the render
4
+ * pipeline substitutes into dataConfig filters.
5
+ *
6
+ * Added 2026-04-17 as part of the widget prerender / chart-in-email foundation.
7
+ */
8
+ export interface IWidgetParamSchema {
9
+ /** Machine-readable key used in URL / dataConfig filter bindings. */
10
+ key: string;
11
+ /** Human-readable label for the authoring UI. Supports i18n via core's translate(). */
12
+ label?: string;
13
+ /** Declared value shape. Drives form control selection + validation. */
14
+ type: "string" | "number" | "boolean" | "date" | "daterange" | "locale" | "enum" | "objectid";
15
+ /** Must be supplied when instantiating a widget from this template. */
16
+ required?: boolean;
17
+ /** Default value substituted when an instance doesn't provide its own. */
18
+ default?: any;
19
+ /** For type: "enum" — allowed values with optional labels. */
20
+ enum?: {
21
+ value: any;
22
+ label?: string;
23
+ }[];
24
+ /** For type: "objectid" — which model the id points at (e.g. aMN.Markets). */
25
+ refModel?: string;
26
+ /** Longer description shown as help text in the authoring UI. */
27
+ description?: string;
28
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  import { IDefaultFields } from "./IDefaultFields";
2
+ import { IWidgetParamSchema } from "./IWidgetParamSchema";
2
3
  export interface ILink {
3
4
  state?: string;
4
5
  params?: {
@@ -70,4 +71,24 @@ export interface IaYOUneWidget extends IDefaultFields {
70
71
  publicBeta?: boolean;
71
72
  percentageOfUsers?: number;
72
73
  GA?: boolean;
74
+ /**
75
+ * Optional customer scope. Null / absent = platform template visible to all
76
+ * customers. Set = customer-private template visible only to users of that
77
+ * customer. Added 2026-04-17.
78
+ */
79
+ _customerID?: ObjectId;
80
+ /**
81
+ * Chart render engine. When 'echarts', chartConfig holds a full
82
+ * EChartsOption JSON and is rendered browser-side via ngx-echarts + server
83
+ * -side via echarts SSR + @resvg/resvg-js. Default ('ngx-charts' or unset)
84
+ * preserves the legacy rendering path. Added 2026-04-17.
85
+ */
86
+ renderer?: "echarts" | "ngx-charts";
87
+ /**
88
+ * Parameter schema declaring which bindings an instance (ICustomerWidget)
89
+ * must / may supply (e.g. market, cadence, dateFrom). Consumed by the
90
+ * authoring UI, AI Copilot, and the prerender worker's param resolver.
91
+ * Added 2026-04-17.
92
+ */
93
+ paramSchema?: IWidgetParamSchema[];
73
94
  }
@@ -247,6 +247,7 @@ export * from "./ICustomConfigFile";
247
247
  export * from "./ICustomer";
248
248
  export * from "./ICustomerDashboard";
249
249
  export * from "./ICustomerData";
250
+ export * from "./ICustomerWidget";
250
251
  export * from "./ICustomerToken";
251
252
  export * from "./ICustomVariable";
252
253
  export * from "./ICustomFunctionLog";
@@ -701,6 +702,7 @@ export * from "./IPageBlock";
701
702
  export * from "./IWhatsappLog";
702
703
  export * from "./IWidget";
703
704
  export * from "./IWidgetEmbedSite";
705
+ export * from "./IWidgetParamSchema";
704
706
  export * from "./IWikiPage";
705
707
  export * from "./IWizard";
706
708
  export * from "./IWorkCenter";
@@ -263,6 +263,7 @@ __exportStar(require("./ICustomConfigFile"), exports);
263
263
  __exportStar(require("./ICustomer"), exports);
264
264
  __exportStar(require("./ICustomerDashboard"), exports);
265
265
  __exportStar(require("./ICustomerData"), exports);
266
+ __exportStar(require("./ICustomerWidget"), exports);
266
267
  __exportStar(require("./ICustomerToken"), exports);
267
268
  __exportStar(require("./ICustomVariable"), exports);
268
269
  __exportStar(require("./ICustomFunctionLog"), exports);
@@ -717,6 +718,7 @@ __exportStar(require("./IPageBlock"), exports);
717
718
  __exportStar(require("./IWhatsappLog"), exports);
718
719
  __exportStar(require("./IWidget"), exports);
719
720
  __exportStar(require("./IWidgetEmbedSite"), exports);
721
+ __exportStar(require("./IWidgetParamSchema"), exports);
720
722
  __exportStar(require("./IWikiPage"), exports);
721
723
  __exportStar(require("./IWizard"), exports);
722
724
  __exportStar(require("./IWorkCenter"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolinax/ayoune-interfaces",
3
- "version": "2026.40.0",
3
+ "version": "2026.42.0",
4
4
  "description": "Houses TypeScript interfaces for aYOUne",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",