@genesislcap/pbc-notify-ui 15.14.0 → 15.14.2

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.
Files changed (16) hide show
  1. package/dist/custom-elements.json +937 -953
  2. package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.d.ts +2 -1
  3. package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.d.ts.map +1 -1
  4. package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.d.ts +1 -0
  5. package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.d.ts.map +1 -1
  6. package/dist/dts/react.d.ts +9 -9
  7. package/dist/dts/services/system.service.d.ts.map +1 -1
  8. package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.js +4 -4
  9. package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.js +27 -13
  10. package/dist/esm/services/system.service.js +37 -12
  11. package/dist/react.cjs +6 -6
  12. package/dist/react.mjs +5 -5
  13. package/package.json +23 -23
  14. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.ts +5 -4
  15. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.ts +27 -14
  16. package/src/services/system.service.ts +39 -12
@@ -1,5 +1,6 @@
1
1
  import { GenesisElement } from '@genesislcap/web-core';
2
2
  import { ConditionBuilderEntity } from '../../../../../../notify.types';
3
+ import { Field } from '../../../../../../services/system.service';
3
4
  import { ParameterBuilderEntity } from '../template-dialog.types';
4
5
  /**
5
6
  * Condition builder for template notification rules.
@@ -11,7 +12,7 @@ import { ParameterBuilderEntity } from '../template-dialog.types';
11
12
  export declare class TemplateConditionBuilder extends GenesisElement {
12
13
  condition: ConditionBuilderEntity;
13
14
  parameters: Array<ParameterBuilderEntity>;
14
- fields: Array<string>;
15
+ fields: Field[];
15
16
  isFirst: boolean;
16
17
  joinOperator: string;
17
18
  leftValue: any;
@@ -1 +1 @@
1
- {"version":3,"file":"template-condition-builder.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AACxF,OAAO,EACL,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;;;;;GAMG;AACH,qBAKa,wBAAyB,SAAQ,cAAc;IACpD,SAAS,EAAE,sBAAsB,CAAC;IAClC,UAAU,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAM;IAC/C,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAIrB,OAAO,EAAE,OAAO,CAAS;IACzB,YAAY,EAAE,MAAM,CAAoB;IAExC,SAAS,EAAE,GAAG,CAAQ;IACtB,cAAc,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;IAEhC,eAAe,EAAE,MAAM,CAAQ;IAC/B,aAAa,EAAE,MAAM,CAAuB;IAC5C,cAAc,EAAE,MAAM,CAAQ;IAC9B,gBAAgB,EAAE,MAAM,CAAQ;IAChC,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;IACjC,qBAAqB,EAAE,MAAM,EAAE,CAAM;IAEjD,eAAe;IAIT,gBAAgB;IAuBtB,mBAAmB;IASnB,iBAAiB;IAiBjB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,kBAAkB;IAa1B,aAAa;IASb,sBAAsB;IAetB,OAAO,CAAC,eAAe;IAiBvB,gBAAgB;IAmBhB,OAAO,CAAC,gBAAgB;IAuBxB,oBAAoB;IA6BpB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,qBAAqB;IAI7B,qBAAqB;IASrB,uBAAuB;IASvB,4BAA4B;IAgB5B,aAAa,IAAI,MAAM,EAAE;CAI1B"}
1
+ {"version":3,"file":"template-condition-builder.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EACL,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAGlE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;;;;;GAMG;AACH,qBAKa,wBAAyB,SAAQ,cAAc;IAC9C,SAAS,EAAE,sBAAsB,CAAC;IAClC,UAAU,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAM;IAC/C,MAAM,EAAE,KAAK,EAAE,CAAM;IAIrB,OAAO,EAAE,OAAO,CAAS;IACzB,YAAY,EAAE,MAAM,CAAoB;IAExC,SAAS,EAAE,GAAG,CAAQ;IACtB,cAAc,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;IAEhC,eAAe,EAAE,MAAM,CAAQ;IAC/B,aAAa,EAAE,MAAM,CAAuB;IAC5C,cAAc,EAAE,MAAM,CAAQ;IAC9B,gBAAgB,EAAE,MAAM,CAAQ;IAChC,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,CAAM;IACjC,qBAAqB,EAAE,MAAM,EAAE,CAAM;IAEjD,eAAe;IAIT,gBAAgB;IAuBtB,mBAAmB;IASnB,iBAAiB;IAiBjB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,kBAAkB;IAa1B,aAAa;IASb,sBAAsB;IAetB,OAAO,CAAC,eAAe;IAiBvB,gBAAgB;IAmBhB,OAAO,CAAC,gBAAgB;IAuBxB,oBAAoB;IA6BpB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,qBAAqB;IAI7B,qBAAqB;IASrB,uBAAuB;IASvB,4BAA4B;IAgB5B,aAAa,IAAI,MAAM,EAAE;CAI1B"}
@@ -68,6 +68,7 @@ export declare class TemplateDialog extends TemplateDialog_base {
68
68
  resources: Array<string>;
69
69
  fields: Array<Field>;
70
70
  topics: Array<string>;
71
+ private hydrating;
71
72
  private requiredFields;
72
73
  get isAlertSoundEditMode(): boolean;
73
74
  get alertSoundEntityId(): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"template-dialog.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAiB,cAAc,EAAwB,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAEL,aAAa,EAGb,UAAU,EACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAW3E,OAAO,EAAE,sBAAsB,EAAY,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/F;;;;;GAKG;AACH,qBAKa,cAAe,SAAQ,mBAAyC;IAC1D,eAAe,EAAE,eAAe,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IAEtC,MAAM,EAAE,KAAK,CAAC;IACF,kBAAkB,EAAE,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CACrF;IAEP,OAAO,CAAC,UAAU,CAAgB;IACtB,IAAI,EAAE,MAAM,CAAQ;IACpB,WAAW,EAAE,MAAM,CAAQ;IAC3B,MAAM,MAAQ;IACd,OAAO,MAAQ;IACf,QAAQ,EAAE,MAAM,CAAM;IACtB,KAAK,EAAE,MAAM,CAAM;IACnB,QAAQ,EAAE,MAAM,CAAM;IACtB,UAAU,EAAE,UAAU,EAAE,CAAqB;IAE7C,UAAU,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAM;IAC/C,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAM;IAItC,oBAAoB,EAAE,MAAM,CAAM;IAElC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAC9B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAM;IAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAEvC,OAAO,CAAC,cAAc,CAAkE;IAExF,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAED,IAAI,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAEtC;IAED,IAAI,uBAAuB,IAAI,QAAQ,GAAG,KAAK,CAI9C;IAEY,UAAU,CAAC,MAAM,EAAE,GAAG;IAoBnC,KAAK;YAyBS,cAAc;YAUd,YAAY;IAyB1B,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,oBAAoB;IAc5B,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED,MAAM;IAwBN,OAAO,CAAC,oBAAoB;IAwC5B,gBAAgB,CAAC,QAAQ,KAAA;IAUnB,eAAe;IAOrB,YAAY;IAKZ,QAAQ;IAKR,aAAa,CAAC,eAAe,EAAE,aAAa;IAI5C,eAAe,CAAC,gBAAgB,EAAE,aAAa;IAW/C,YAAY;IAIZ,aAAa,CAAC,eAAe,EAAE,sBAAsB;IAIrD,eAAe,CAAC,gBAAgB,EAAE,sBAAsB;IAYxD,IACW,sBAAsB,IAAI,OAAO,CAE3C;CACF"}
1
+ {"version":3,"file":"template-dialog.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAiB,cAAc,EAAwB,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAEL,aAAa,EAGb,UAAU,EACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAW3E,OAAO,EAAE,sBAAsB,EAAY,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/F;;;;;GAKG;AACH,qBAKa,cAAe,SAAQ,mBAAyC;IAC1D,eAAe,EAAE,eAAe,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IAEtC,MAAM,EAAE,KAAK,CAAC;IACF,kBAAkB,EAAE,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CACrF;IAEP,OAAO,CAAC,UAAU,CAAgB;IACtB,IAAI,EAAE,MAAM,CAAQ;IACpB,WAAW,EAAE,MAAM,CAAQ;IAC3B,MAAM,MAAQ;IACd,OAAO,MAAQ;IACf,QAAQ,EAAE,MAAM,CAAM;IACtB,KAAK,EAAE,MAAM,CAAM;IACnB,QAAQ,EAAE,MAAM,CAAM;IACtB,UAAU,EAAE,UAAU,EAAE,CAAqB;IAE7C,UAAU,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAM;IAC/C,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAM;IAItC,oBAAoB,EAAE,MAAM,CAAM;IAElC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAC9B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAM;IAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IACvC,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,cAAc,CAAkE;IAExF,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAED,IAAI,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAEtC;IAED,IAAI,uBAAuB,IAAI,QAAQ,GAAG,KAAK,CAI9C;IAEY,UAAU,CAAC,MAAM,EAAE,GAAG;IA4BnC,KAAK;YAyBS,cAAc;YAUd,YAAY;IAyB1B,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,oBAAoB;IAc5B,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED,MAAM;IAwBN,OAAO,CAAC,oBAAoB;IAwC5B,gBAAgB,CAAC,QAAQ,KAAA;IAUnB,eAAe;IAWrB,YAAY;IAKZ,QAAQ;IAKR,aAAa,CAAC,eAAe,EAAE,aAAa;IAI5C,eAAe,CAAC,gBAAgB,EAAE,aAAa;IAW/C,YAAY;IAIZ,aAAa,CAAC,eAAe,EAAE,sBAAsB;IAIrD,eAAe,CAAC,gBAAgB,EAAE,sBAAsB;IAYxD,IACW,sBAAsB,IAAI,OAAO,CAE3C;CACF"}
@@ -79,6 +79,15 @@ export declare const FoundationInbox: React.ForwardRefExoticComponent<
79
79
  >;
80
80
  export type FoundationInboxRef = FoundationInboxWC;
81
81
 
82
+ export declare const FoundationNotificationDashboard: React.ForwardRefExoticComponent<
83
+ React.PropsWithChildren<
84
+ Omit<PublicOf<FoundationNotificationDashboardWC>, 'children' | 'style'> &
85
+ HTMLWCProps & {
86
+ }
87
+ > & React.RefAttributes<FoundationNotificationDashboardWC>
88
+ >;
89
+ export type FoundationNotificationDashboardRef = FoundationNotificationDashboardWC;
90
+
82
91
  export declare const FoundationSoundsPanel: React.ForwardRefExoticComponent<
83
92
  React.PropsWithChildren<
84
93
  Omit<PublicOf<FoundationSoundsPanelWC>, 'children' | 'style'> &
@@ -97,15 +106,6 @@ export declare const FoundationSounds: React.ForwardRefExoticComponent<
97
106
  >;
98
107
  export type FoundationSoundsRef = FoundationSoundsWC;
99
108
 
100
- export declare const FoundationNotificationDashboard: React.ForwardRefExoticComponent<
101
- React.PropsWithChildren<
102
- Omit<PublicOf<FoundationNotificationDashboardWC>, 'children' | 'style'> &
103
- HTMLWCProps & {
104
- }
105
- > & React.RefAttributes<FoundationNotificationDashboardWC>
106
- >;
107
- export type FoundationNotificationDashboardRef = FoundationNotificationDashboardWC;
108
-
109
109
  export declare const FoundationInboxCounter: React.ForwardRefExoticComponent<
110
110
  React.PropsWithChildren<
111
111
  Omit<PublicOf<FoundationInboxCounterWC>, 'children' | 'style'> &
@@ -1 +1 @@
1
- {"version":3,"file":"system.service.d.ts","sourceRoot":"","sources":["../../../src/services/system.service.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAClC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;CAC/C;AAgCD,eAAO,MAAM,aAAa,qEAEzB,CAAC"}
1
+ {"version":3,"file":"system.service.d.ts","sourceRoot":"","sources":["../../../src/services/system.service.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAClC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;CAC/C;AA2DD,eAAO,MAAM,aAAa,qEAEzB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
2
  import { FieldTypeEnum } from '@genesislcap/foundation-comms';
3
- import { attr, customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
+ import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
4
4
  import { JoinOperator, LogicalOperator, RightCriteria, nullAndBlankLogicalOperatorValues, } from '../../../../../../notify.types';
5
5
  import { logger } from '../../../../../../utils';
6
6
  import { ConditionBuilderStyles } from '../../../../styles/condition-builder.styles';
@@ -261,13 +261,13 @@ let TemplateConditionBuilder = class TemplateConditionBuilder extends GenesisEle
261
261
  }
262
262
  };
263
263
  __decorate([
264
- attr
264
+ observable
265
265
  ], TemplateConditionBuilder.prototype, "condition", void 0);
266
266
  __decorate([
267
- attr
267
+ observable
268
268
  ], TemplateConditionBuilder.prototype, "parameters", void 0);
269
269
  __decorate([
270
- attr
270
+ observable
271
271
  ], TemplateConditionBuilder.prototype, "fields", void 0);
272
272
  __decorate([
273
273
  observable
@@ -39,6 +39,7 @@ let TemplateDialog = class TemplateDialog extends AlertSoundAttachmentMixin(Gene
39
39
  this.resources = [];
40
40
  this.fields = [];
41
41
  this.topics = [];
42
+ this.hydrating = false;
42
43
  this.requiredFields = () => [this.name, this.description, this.header, this.message];
43
44
  }
44
45
  get isAlertSoundEditMode() {
@@ -54,21 +55,31 @@ let TemplateDialog = class TemplateDialog extends AlertSoundAttachmentMixin(Gene
54
55
  }
55
56
  openDialog(params) {
56
57
  return __awaiter(this, void 0, void 0, function* () {
57
- this.topics = yield this.notifyService.getNotifyRouteTopics();
58
- this.resources = yield this.systemService.getResources(); // TODO: Tables + Views
59
58
  this.templateDialogMode = params.mode;
60
- switch (params.mode) {
61
- case TemplateDialogMode.CREATE:
62
- yield this.createTemplate();
63
- break;
64
- case TemplateDialogMode.EDIT:
65
- yield this.editTemplate(params.data);
66
- break;
67
- default:
68
- logger.error('Error on TemplateDialogMode');
69
- break;
70
- }
59
+ this.hydrating = true;
71
60
  this.dialog.show();
61
+ try {
62
+ this.topics = yield this.notifyService.getNotifyRouteTopics();
63
+ this.resources = yield this.systemService.getResources(); // TODO: Tables + Views
64
+ switch (params.mode) {
65
+ case TemplateDialogMode.CREATE:
66
+ yield this.createTemplate();
67
+ break;
68
+ case TemplateDialogMode.EDIT:
69
+ yield this.editTemplate(params.data);
70
+ break;
71
+ default:
72
+ logger.error('Error on TemplateDialogMode');
73
+ break;
74
+ }
75
+ }
76
+ catch (error) {
77
+ logger.error('Failed to initialize template dialog', error);
78
+ this.close();
79
+ }
80
+ finally {
81
+ this.hydrating = false;
82
+ }
72
83
  });
73
84
  }
74
85
  close() {
@@ -210,6 +221,9 @@ let TemplateDialog = class TemplateDialog extends AlertSoundAttachmentMixin(Gene
210
221
  }
211
222
  resourceChanged() {
212
223
  return __awaiter(this, void 0, void 0, function* () {
224
+ if (this.hydrating) {
225
+ return;
226
+ }
213
227
  this.conditions = [DynamicRuleUtils.createEmptyCondition()];
214
228
  this.fields = yield this.systemService.getFields(this.resource);
215
229
  this.refreshExpressionPreview();
@@ -1,6 +1,25 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
2
  import { Connect } from '@genesislcap/foundation-comms';
3
3
  import { DI } from '@genesislcap/web-core';
4
+ function schemaDefinitionToField(name, def) {
5
+ var _a, _b;
6
+ const raw = def && typeof def === 'object' ? def : {};
7
+ const oneOf = Array.isArray(raw.oneOf) ? raw.oneOf : [];
8
+ const concrete = (_a = oneOf.find((option) => {
9
+ if (!option || typeof option !== 'object') {
10
+ return false;
11
+ }
12
+ return option.type !== 'null';
13
+ })) !== null && _a !== void 0 ? _a : raw;
14
+ const genesisType = typeof concrete.genesisType === 'string' ? concrete.genesisType : undefined;
15
+ const jsonType = typeof concrete.type === 'string' ? concrete.type : undefined;
16
+ const enumValues = Array.isArray(concrete.enum) ? concrete.enum.map(String) : null;
17
+ return {
18
+ FIELD_NAME: name,
19
+ FIELD_TYPE: ((_b = genesisType !== null && genesisType !== void 0 ? genesisType : jsonType) !== null && _b !== void 0 ? _b : 'STRING').toUpperCase(),
20
+ FIELD_VALUES: enumValues,
21
+ };
22
+ }
4
23
  class SystemServiceImpl {
5
24
  getResources() {
6
25
  return __awaiter(this, void 0, void 0, function* () {
@@ -12,21 +31,27 @@ class SystemServiceImpl {
12
31
  }
13
32
  getFields(resource) {
14
33
  return __awaiter(this, void 0, void 0, function* () {
34
+ var _a, _b;
15
35
  if (!resource) {
16
36
  return [];
17
37
  }
18
- const response = yield this.connect.request('SYSTEM_ENTITY_FIELDS', {
19
- REQUEST: {
20
- ENTITY_NAME: resource,
21
- },
22
- });
23
- return response.REPLY.sort((a, b) => a.NAME.localeCompare(b.NAME)).map((entity) => ({
24
- FIELD_NAME: entity.NAME,
25
- FIELD_TYPE: entity.TYPE,
26
- // Enum fields expose their allowed values (space-separated) so the condition
27
- // builder can render a multiselect for them.
28
- FIELD_VALUES: entity.VALUES ? entity.VALUES.split(' ').filter((v) => v.length) : null,
29
- }));
38
+ try {
39
+ const schema = yield this.connect.getJSONSchema(resource);
40
+ const reply = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.OUTBOUND) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.REPLY;
41
+ if (!reply || typeof reply === 'boolean') {
42
+ return [];
43
+ }
44
+ const items = Array.isArray(reply.items) ? reply.items[0] : reply.items;
45
+ if (!items || typeof items === 'boolean' || !items.properties) {
46
+ return [];
47
+ }
48
+ return Object.entries(items.properties)
49
+ .map(([name, def]) => schemaDefinitionToField(name, def))
50
+ .sort((a, b) => a.FIELD_NAME.localeCompare(b.FIELD_NAME));
51
+ }
52
+ catch (_c) {
53
+ return [];
54
+ }
30
55
  });
31
56
  }
32
57
  }
package/dist/react.cjs CHANGED
@@ -52,6 +52,11 @@ const FoundationInbox = React.forwardRef(function FoundationInbox(props, ref) {
52
52
  return React.createElement(customElements.getName(FoundationInboxWC) ?? 'foundation-inbox', { ...rest, ref }, children);
53
53
  });
54
54
 
55
+ const FoundationNotificationDashboard = React.forwardRef(function FoundationNotificationDashboard(props, ref) {
56
+ const { children, ...rest } = props;
57
+ return React.createElement(customElements.getName(FoundationNotificationDashboardWC) ?? 'foundation-notification-dashboard', { ...rest, ref }, children);
58
+ });
59
+
55
60
  const FoundationSoundsPanel = React.forwardRef(function FoundationSoundsPanel(props, ref) {
56
61
  const { children, ...rest } = props;
57
62
  return React.createElement(customElements.getName(FoundationSoundsPanelWC) ?? 'foundation-sounds-panel', { ...rest, ref }, children);
@@ -62,11 +67,6 @@ const FoundationSounds = React.forwardRef(function FoundationSounds(props, ref)
62
67
  return React.createElement(customElements.getName(FoundationSoundsWC) ?? 'foundation-sounds', { ...rest, ref }, children);
63
68
  });
64
69
 
65
- const FoundationNotificationDashboard = React.forwardRef(function FoundationNotificationDashboard(props, ref) {
66
- const { children, ...rest } = props;
67
- return React.createElement(customElements.getName(FoundationNotificationDashboardWC) ?? 'foundation-notification-dashboard', { ...rest, ref }, children);
68
- });
69
-
70
70
  const FoundationInboxCounter = React.forwardRef(function FoundationInboxCounter(props, ref) {
71
71
  const { children, ...rest } = props;
72
72
  return React.createElement(customElements.getName(FoundationInboxCounterWC) ?? 'foundation-inbox-counter', { ...rest, ref }, children);
@@ -313,9 +313,9 @@ const TemplateConditionGroup = React.forwardRef(function TemplateConditionGroup(
313
313
  module.exports = {
314
314
  ReconciliationSandbox,
315
315
  FoundationInbox,
316
+ FoundationNotificationDashboard,
316
317
  FoundationSoundsPanel,
317
318
  FoundationSounds,
318
- FoundationNotificationDashboard,
319
319
  FoundationInboxCounter,
320
320
  FoundationInboxFlyout,
321
321
  InboxSubscription,
package/dist/react.mjs CHANGED
@@ -50,6 +50,11 @@ export const FoundationInbox = React.forwardRef(function FoundationInbox(props,
50
50
  return React.createElement(customElements.getName(FoundationInboxWC) ?? 'foundation-inbox', { ...rest, ref }, children);
51
51
  });
52
52
 
53
+ export const FoundationNotificationDashboard = React.forwardRef(function FoundationNotificationDashboard(props, ref) {
54
+ const { children, ...rest } = props;
55
+ return React.createElement(customElements.getName(FoundationNotificationDashboardWC) ?? 'foundation-notification-dashboard', { ...rest, ref }, children);
56
+ });
57
+
53
58
  export const FoundationSoundsPanel = React.forwardRef(function FoundationSoundsPanel(props, ref) {
54
59
  const { children, ...rest } = props;
55
60
  return React.createElement(customElements.getName(FoundationSoundsPanelWC) ?? 'foundation-sounds-panel', { ...rest, ref }, children);
@@ -60,11 +65,6 @@ export const FoundationSounds = React.forwardRef(function FoundationSounds(props
60
65
  return React.createElement(customElements.getName(FoundationSoundsWC) ?? 'foundation-sounds', { ...rest, ref }, children);
61
66
  });
62
67
 
63
- export const FoundationNotificationDashboard = React.forwardRef(function FoundationNotificationDashboard(props, ref) {
64
- const { children, ...rest } = props;
65
- return React.createElement(customElements.getName(FoundationNotificationDashboardWC) ?? 'foundation-notification-dashboard', { ...rest, ref }, children);
66
- });
67
-
68
68
  export const FoundationInboxCounter = React.forwardRef(function FoundationInboxCounter(props, ref) {
69
69
  const { children, ...rest } = props;
70
70
  return React.createElement(customElements.getName(FoundationInboxCounterWC) ?? 'foundation-inbox-counter', { ...rest, ref }, children);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/pbc-notify-ui",
3
3
  "description": "Genesis PBC Notify UI",
4
- "version": "15.14.0",
4
+ "version": "15.14.2",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "workspaces": [
7
7
  "client"
@@ -81,30 +81,30 @@
81
81
  "@commitlint/cli": "^19.2.1",
82
82
  "@commitlint/config-conventional": "^19.1.0",
83
83
  "@commitlint/format": "^19.0.3",
84
- "@genesislcap/design-system-configurator": "15.14.0",
85
- "@genesislcap/eslint-config": "15.14.0",
86
- "@genesislcap/eslint-stylelint-builder": "15.14.0",
87
- "@genesislcap/foundation-testing": "15.14.0",
88
- "@genesislcap/genx": "15.14.0",
89
- "@genesislcap/prettier-config": "15.14.0",
90
- "@genesislcap/stylelint-config": "15.14.0",
91
- "@genesislcap/vite-builder": "15.14.0",
92
- "@genesislcap/webpack-builder": "15.14.0",
84
+ "@genesislcap/design-system-configurator": "15.14.2",
85
+ "@genesislcap/eslint-config": "15.14.2",
86
+ "@genesislcap/eslint-stylelint-builder": "15.14.2",
87
+ "@genesislcap/foundation-testing": "15.14.2",
88
+ "@genesislcap/genx": "15.14.2",
89
+ "@genesislcap/prettier-config": "15.14.2",
90
+ "@genesislcap/stylelint-config": "15.14.2",
91
+ "@genesislcap/vite-builder": "15.14.2",
92
+ "@genesislcap/webpack-builder": "15.14.2",
93
93
  "dayjs": "^1.11.7"
94
94
  },
95
95
  "dependencies": {
96
- "@genesislcap/foundation-comms": "15.14.0",
97
- "@genesislcap/foundation-criteria": "15.14.0",
98
- "@genesislcap/foundation-entity-management": "15.14.0",
99
- "@genesislcap/foundation-forms": "15.14.0",
100
- "@genesislcap/foundation-layout": "15.14.0",
101
- "@genesislcap/foundation-logger": "15.14.0",
102
- "@genesislcap/foundation-notifications": "15.14.0",
103
- "@genesislcap/foundation-ui": "15.14.0",
104
- "@genesislcap/foundation-utils": "15.14.0",
105
- "@genesislcap/rapid-design-system": "15.14.0",
106
- "@genesislcap/rapid-grid-pro": "15.14.0",
107
- "@genesislcap/web-core": "15.14.0",
96
+ "@genesislcap/foundation-comms": "15.14.2",
97
+ "@genesislcap/foundation-criteria": "15.14.2",
98
+ "@genesislcap/foundation-entity-management": "15.14.2",
99
+ "@genesislcap/foundation-forms": "15.14.2",
100
+ "@genesislcap/foundation-layout": "15.14.2",
101
+ "@genesislcap/foundation-logger": "15.14.2",
102
+ "@genesislcap/foundation-notifications": "15.14.2",
103
+ "@genesislcap/foundation-ui": "15.14.2",
104
+ "@genesislcap/foundation-utils": "15.14.2",
105
+ "@genesislcap/rapid-design-system": "15.14.2",
106
+ "@genesislcap/rapid-grid-pro": "15.14.2",
107
+ "@genesislcap/web-core": "15.14.2",
108
108
  "lodash.debounce": "^4.0.8",
109
109
  "rxjs": "^7.5.4"
110
110
  },
@@ -112,5 +112,5 @@
112
112
  "access": "public"
113
113
  },
114
114
  "customElements": "dist/custom-elements.json",
115
- "gitHead": "d84656a0872b2274be6f6b20a87a28504b48ed2a"
115
+ "gitHead": "bd1cb4a789548d9c7c6777f8adb7bce3f43c3317"
116
116
  }
@@ -1,5 +1,5 @@
1
1
  import { FieldTypeEnum } from '@genesislcap/foundation-comms';
2
- import { attr, customElement, GenesisElement, observable } from '@genesislcap/web-core';
2
+ import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
3
  import {
4
4
  ConditionBuilderEntity,
5
5
  JoinOperator,
@@ -7,6 +7,7 @@ import {
7
7
  RightCriteria,
8
8
  nullAndBlankLogicalOperatorValues,
9
9
  } from '../../../../../../notify.types';
10
+ import { Field } from '../../../../../../services/system.service';
10
11
  import { logger } from '../../../../../../utils';
11
12
  import { ConditionBuilderStyles } from '../../../../styles/condition-builder.styles';
12
13
  import { ParameterBuilderEntity } from '../template-dialog.types';
@@ -25,9 +26,9 @@ import { TemplateConditionBuilderTemplate } from './template-condition-builder.t
25
26
  styles: ConditionBuilderStyles,
26
27
  })
27
28
  export class TemplateConditionBuilder extends GenesisElement {
28
- @attr condition: ConditionBuilderEntity;
29
- @attr parameters: Array<ParameterBuilderEntity> = [];
30
- @attr fields: Array<string> = [];
29
+ @observable condition: ConditionBuilderEntity;
30
+ @observable parameters: Array<ParameterBuilderEntity> = [];
31
+ @observable fields: Field[] = [];
31
32
 
32
33
  // Whether this is the first row in the condition list - it has nothing to
33
34
  // join to, so the AND/OR selector is hidden for it.
@@ -64,6 +64,7 @@ export class TemplateDialog extends AlertSoundAttachmentMixin(GenesisElement) {
64
64
  @observable resources: Array<string> = [];
65
65
  @observable fields: Array<Field> = [];
66
66
  @observable topics: Array<string> = [];
67
+ private hydrating = false;
67
68
 
68
69
  private requiredFields = () => [this.name, this.description, this.header, this.message];
69
70
 
@@ -82,23 +83,31 @@ export class TemplateDialog extends AlertSoundAttachmentMixin(GenesisElement) {
82
83
  }
83
84
 
84
85
  public async openDialog(params: any) {
85
- this.topics = await this.notifyService.getNotifyRouteTopics();
86
- this.resources = await this.systemService.getResources(); // TODO: Tables + Views
87
86
  this.templateDialogMode = params.mode;
87
+ this.hydrating = true;
88
+ this.dialog.show();
88
89
 
89
- switch (params.mode) {
90
- case TemplateDialogMode.CREATE:
91
- await this.createTemplate();
92
- break;
93
- case TemplateDialogMode.EDIT:
94
- await this.editTemplate(params.data);
95
- break;
96
- default:
97
- logger.error('Error on TemplateDialogMode');
98
- break;
90
+ try {
91
+ this.topics = await this.notifyService.getNotifyRouteTopics();
92
+ this.resources = await this.systemService.getResources(); // TODO: Tables + Views
93
+
94
+ switch (params.mode) {
95
+ case TemplateDialogMode.CREATE:
96
+ await this.createTemplate();
97
+ break;
98
+ case TemplateDialogMode.EDIT:
99
+ await this.editTemplate(params.data);
100
+ break;
101
+ default:
102
+ logger.error('Error on TemplateDialogMode');
103
+ break;
104
+ }
105
+ } catch (error) {
106
+ logger.error('Failed to initialize template dialog', error);
107
+ this.close();
108
+ } finally {
109
+ this.hydrating = false;
99
110
  }
100
-
101
- this.dialog.show();
102
111
  }
103
112
 
104
113
  close() {
@@ -262,6 +271,10 @@ export class TemplateDialog extends AlertSoundAttachmentMixin(GenesisElement) {
262
271
  }
263
272
 
264
273
  async resourceChanged() {
274
+ if (this.hydrating) {
275
+ return;
276
+ }
277
+
265
278
  this.conditions = [DynamicRuleUtils.createEmptyCondition()];
266
279
  this.fields = await this.systemService.getFields(this.resource);
267
280
  this.refreshExpressionPreview();
@@ -12,6 +12,27 @@ export interface SystemService {
12
12
  getFields(resource: string): Promise<Field[]>;
13
13
  }
14
14
 
15
+ function schemaDefinitionToField(name: string, def: unknown): Field {
16
+ const raw = def && typeof def === 'object' ? (def as Record<string, unknown>) : {};
17
+ const oneOf = Array.isArray(raw.oneOf) ? raw.oneOf : [];
18
+ const concrete =
19
+ (oneOf.find((option) => {
20
+ if (!option || typeof option !== 'object') {
21
+ return false;
22
+ }
23
+ return (option as Record<string, unknown>).type !== 'null';
24
+ }) as Record<string, unknown> | undefined) ?? raw;
25
+ const genesisType = typeof concrete.genesisType === 'string' ? concrete.genesisType : undefined;
26
+ const jsonType = typeof concrete.type === 'string' ? concrete.type : undefined;
27
+ const enumValues = Array.isArray(concrete.enum) ? concrete.enum.map(String) : null;
28
+
29
+ return {
30
+ FIELD_NAME: name,
31
+ FIELD_TYPE: (genesisType ?? jsonType ?? 'STRING').toUpperCase(),
32
+ FIELD_VALUES: enumValues,
33
+ };
34
+ }
35
+
15
36
  class SystemServiceImpl implements SystemService {
16
37
  @Connect private connect: Connect;
17
38
 
@@ -27,18 +48,24 @@ class SystemServiceImpl implements SystemService {
27
48
  return [];
28
49
  }
29
50
 
30
- const response = await this.connect.request('SYSTEM_ENTITY_FIELDS', {
31
- REQUEST: {
32
- ENTITY_NAME: resource,
33
- },
34
- });
35
- return response.REPLY.sort((a, b) => a.NAME.localeCompare(b.NAME)).map((entity) => ({
36
- FIELD_NAME: entity.NAME,
37
- FIELD_TYPE: entity.TYPE,
38
- // Enum fields expose their allowed values (space-separated) so the condition
39
- // builder can render a multiselect for them.
40
- FIELD_VALUES: entity.VALUES ? entity.VALUES.split(' ').filter((v: string) => v.length) : null,
41
- }));
51
+ try {
52
+ const schema = await this.connect.getJSONSchema(resource);
53
+ const reply = schema?.OUTBOUND?.properties?.REPLY;
54
+ if (!reply || typeof reply === 'boolean') {
55
+ return [];
56
+ }
57
+
58
+ const items = Array.isArray(reply.items) ? reply.items[0] : reply.items;
59
+ if (!items || typeof items === 'boolean' || !items.properties) {
60
+ return [];
61
+ }
62
+
63
+ return Object.entries(items.properties)
64
+ .map(([name, def]) => schemaDefinitionToField(name, def))
65
+ .sort((a, b) => a.FIELD_NAME.localeCompare(b.FIELD_NAME));
66
+ } catch {
67
+ return [];
68
+ }
42
69
  }
43
70
  }
44
71