@dflat-core/web 1.0.0-beta
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/LICENSE +21 -0
- package/README.md +94 -0
- package/assets/bootswatch.scss +100 -0
- package/assets/buttons.scss +70 -0
- package/assets/components/datagrid.scss +138 -0
- package/assets/components/fonts.scss +24 -0
- package/assets/components/login.scss +59 -0
- package/assets/components/menu.scss +0 -0
- package/assets/components/modals.scss +62 -0
- package/assets/components/select.scss +387 -0
- package/assets/fonts/ErasITC-Bold/ErasITC-Bold.eot +0 -0
- package/assets/fonts/ErasITC-Bold/ErasITC-Bold.svg +748 -0
- package/assets/fonts/ErasITC-Bold/ErasITC-Bold.ttf +0 -0
- package/assets/fonts/ErasITC-Bold/ErasITC-Bold.woff +0 -0
- package/assets/fonts/SegoeUI/SegoeUI.eot +0 -0
- package/assets/fonts/SegoeUI/SegoeUI.svg +15203 -0
- package/assets/fonts/SegoeUI/SegoeUI.ttf +0 -0
- package/assets/fonts/SegoeUI/SegoeUI.woff +0 -0
- package/assets/fonts/SegoeUI/preview.html +132 -0
- package/assets/fonts/SegoeUI/styles.css +7 -0
- package/assets/fonts/SegoeUI-Light/SegoeUI-Light.eot +0 -0
- package/assets/fonts/SegoeUI-Light/SegoeUI-Light.svg +27429 -0
- package/assets/fonts/SegoeUI-Light/SegoeUI-Light.ttf +0 -0
- package/assets/fonts/SegoeUI-Light/SegoeUI-Light.woff +0 -0
- package/assets/fonts/SegoeUI-Light/preview.html +132 -0
- package/assets/fonts/SegoeUI-Light/styles.css +7 -0
- package/assets/forms.scss +342 -0
- package/assets/images/Algerie.png +0 -0
- package/assets/images/Burkina Faso.png +0 -0
- package/assets/images/Cameroun.png +0 -0
- package/assets/images/Cara/303/257bes.png +0 -0
- package/assets/images/Congo.png +0 -0
- package/assets/images/C/303/264te d'Ivoire.png +0 -0
- package/assets/images/France.png +0 -0
- package/assets/images/Gabon.png +0 -0
- package/assets/images/Ile Maurice.png +0 -0
- package/assets/images/LogoMarsow.svg +1 -0
- package/assets/images/Maroc.png +0 -0
- package/assets/images/Menu.svg +3 -0
- package/assets/images/R/303/251union.png +0 -0
- package/assets/images/S/303/251n/303/251gal.png +0 -0
- package/assets/images/Tunisie.png +0 -0
- package/assets/images/Unchecked.svg +25 -0
- package/assets/images/account.svg +3 -0
- package/assets/images/adresslabel1.svg +3 -0
- package/assets/images/adresslabel2.svg +3 -0
- package/assets/images/allergen.svg +3 -0
- package/assets/images/arrow-up-1-9.svg +1 -0
- package/assets/images/attention.svg +3 -0
- package/assets/images/backward.svg +1 -0
- package/assets/images/ban.svg +1 -0
- package/assets/images/book-open.svg +1 -0
- package/assets/images/book-solid.svg +2 -0
- package/assets/images/border-all.svg +1 -0
- package/assets/images/boxes-packing-solid.svg +2 -0
- package/assets/images/calculator-solid.svg +1 -0
- package/assets/images/calendar.svg +3 -0
- package/assets/images/chatting.svg +3 -0
- package/assets/images/check.svg +3 -0
- package/assets/images/checkmark.png +0 -0
- package/assets/images/circle-check-solid.svg +2 -0
- package/assets/images/circle-info.svg +1 -0
- package/assets/images/circle-radiation-solid.svg +2 -0
- package/assets/images/circle-solid.svg +1 -0
- package/assets/images/circlecheck.svg +3 -0
- package/assets/images/circlecross.svg +3 -0
- package/assets/images/circleminus.svg +3 -0
- package/assets/images/circleplus.svg +3 -0
- package/assets/images/circularoption.svg +1 -0
- package/assets/images/circularoptionselected.svg +1 -0
- package/assets/images/classification-tool.svg +3 -0
- package/assets/images/click-collect.svg +1 -0
- package/assets/images/clientlocation.svg +9 -0
- package/assets/images/cloud-arrow-down-solid.svg +1 -0
- package/assets/images/cloud-arrow-up-solid.svg +1 -0
- package/assets/images/contact.svg +3 -0
- package/assets/images/cross.svg +3 -0
- package/assets/images/delivery-square.svg +32 -0
- package/assets/images/delivery.svg +3 -0
- package/assets/images/deliverymanlocation.svg +28 -0
- package/assets/images/dolly-solid.svg +1 -0
- package/assets/images/down.svg +3 -0
- package/assets/images/download.svg +1 -0
- package/assets/images/edition.svg +3 -0
- package/assets/images/email.svg +3 -0
- package/assets/images/emptyheart.svg +3 -0
- package/assets/images/emptystar.svg +3 -0
- package/assets/images/erase.svg +1 -0
- package/assets/images/error.png +0 -0
- package/assets/images/error.svg +1 -0
- package/assets/images/favicon.ico +0 -0
- package/assets/images/file-arrow-down-solid.svg +2 -0
- package/assets/images/file-arrow-up-solid.svg +1 -0
- package/assets/images/file-csv-solid.svg +2 -0
- package/assets/images/file-excel-solid.svg +2 -0
- package/assets/images/file-export-solid.svg +1 -0
- package/assets/images/file-image-solid.svg +2 -0
- package/assets/images/file-invoice-solid.svg +2 -0
- package/assets/images/file-lines-solid.svg +2 -0
- package/assets/images/file-pdf-solid.svg +2 -0
- package/assets/images/file-solid.svg +2 -0
- package/assets/images/file-word-solid.svg +2 -0
- package/assets/images/file-zipper-solid.svg +2 -0
- package/assets/images/files-o.svg +1 -0
- package/assets/images/filter-circle-xmark-solid.svg +1 -0
- package/assets/images/filter-solid.svg +2 -0
- package/assets/images/filter.svg +3 -0
- package/assets/images/filter1.svg +3 -0
- package/assets/images/filter2.svg +3 -0
- package/assets/images/filterdelete.svg +3 -0
- package/assets/images/folder.svg +3 -0
- package/assets/images/forward.svg +1 -0
- package/assets/images/fullheart.svg +3 -0
- package/assets/images/fullstar.svg +3 -0
- package/assets/images/halfstar.svg +3 -0
- package/assets/images/hand-point-down.svg +1 -0
- package/assets/images/hand-point-left.svg +1 -0
- package/assets/images/hand-point-right.svg +1 -0
- package/assets/images/hand-point-up.svg +1 -0
- package/assets/images/history.svg +4 -0
- package/assets/images/home.svg +3 -0
- package/assets/images/info-circle.svg +1 -0
- package/assets/images/information.png +0 -0
- package/assets/images/ingredient.svg +3 -0
- package/assets/images/left.svg +3 -0
- package/assets/images/location.svg +3 -0
- package/assets/images/map-marker.svg +6 -0
- package/assets/images/map.svg +3 -0
- package/assets/images/minus.svg +3 -0
- package/assets/images/neworder.svg +3 -0
- package/assets/images/notification.svg +3 -0
- package/assets/images/ordercollected.svg +3 -0
- package/assets/images/orderconfirmed.svg +8 -0
- package/assets/images/orderdelivered.svg +3 -0
- package/assets/images/orderindelivering.svg +3 -0
- package/assets/images/orderinpreparation.svg +3 -0
- package/assets/images/orderprepared.svg +3 -0
- package/assets/images/orderrefused.svg +8 -0
- package/assets/images/pencil.svg +1 -0
- package/assets/images/picture-editor-V3.svg +11 -0
- package/assets/images/picture-export-v3.svg +5 -0
- package/assets/images/picture-import-v3.svg +5 -0
- package/assets/images/plus-square.svg +1 -0
- package/assets/images/plus.svg +3 -0
- package/assets/images/power-off.svg +1 -0
- package/assets/images/print.svg +3 -0
- package/assets/images/refresh.svg +1 -0
- package/assets/images/return.svg +40 -0
- package/assets/images/right.svg +3 -0
- package/assets/images/sale.svg +3 -0
- package/assets/images/save.svg +2 -0
- package/assets/images/schedule.svg +3 -0
- package/assets/images/search-sprite.png +0 -0
- package/assets/images/search.svg +3 -0
- package/assets/images/selection.svg +3 -0
- package/assets/images/separator_back.png +0 -0
- package/assets/images/setting.svg +3 -0
- package/assets/images/ship-solid.svg +1 -0
- package/assets/images/shoppingbag.svg +3 -0
- package/assets/images/squareoption.svg +1 -0
- package/assets/images/squareoptionselected.svg +1 -0
- package/assets/images/star-of-life-solid.svg +2 -0
- package/assets/images/step-backward.svg +7 -0
- package/assets/images/step-forward.svg +7 -0
- package/assets/images/store-square.svg +19 -0
- package/assets/images/store.png +0 -0
- package/assets/images/store.svg +3 -0
- package/assets/images/storelocation.svg +6 -0
- package/assets/images/table-columns.svg +1 -0
- package/assets/images/tag.svg +22 -0
- package/assets/images/times-circle-solid.svg +1 -0
- package/assets/images/trash-o.svg +3 -0
- package/assets/images/triangle-down.svg +3 -0
- package/assets/images/triangle-up.svg +3 -0
- package/assets/images/truck-solid.svg +1 -0
- package/assets/images/up.svg +3 -0
- package/assets/images/upload.svg +1 -0
- package/assets/images/user-square.svg +10 -0
- package/assets/images/user.svg +13 -0
- package/assets/images/warning.png +0 -0
- package/assets/images/warning.svg +5 -0
- package/assets/images/watch.svg +3 -0
- package/assets/modals.scss +104 -0
- package/assets/property.scss +113 -0
- package/assets/shared.scss +157 -0
- package/assets/site.scss +374 -0
- package/assets/text.scss +162 -0
- package/assets/variables.scss +91 -0
- package/core/index.d.ts +6 -0
- package/core/lib/array.function.d.ts +8 -0
- package/core/lib/core.module.d.ts +9 -0
- package/core/lib/global/EnvironmentBase.d.ts +7 -0
- package/core/lib/nameof.function.d.ts +4 -0
- package/core/lib/services/ensuremoduleloadedonceguard.d.ts +3 -0
- package/core/lib/services/utilities.service.d.ts +87 -0
- package/core-data/index.d.ts +3 -0
- package/core-data/lib/core-data.module.d.ts +7 -0
- package/core-data/lib/services/data-service.d.ts +68 -0
- package/core-data/lib/services/entity-data-service.d.ts +37 -0
- package/core-model/index.d.ts +4 -0
- package/core-model/lib/core-model.module.d.ts +7 -0
- package/core-model/lib/interface.d.ts +140 -0
- package/core-model/lib/model/interface.generated.d.ts +286 -0
- package/core-model/lib/model/model.d.ts +38 -0
- package/core-services/index.d.ts +23 -0
- package/core-services/lib/core-services.module.d.ts +10 -0
- package/core-services/lib/model/model.d.ts +25 -0
- package/core-services/lib/services/app-keys.d.ts +15 -0
- package/core-services/lib/services/appConfig.service.d.ts +8 -0
- package/core-services/lib/services/auth-guard.service.d.ts +18 -0
- package/core-services/lib/services/auth.interceptor.d.ts +15 -0
- package/core-services/lib/services/auth.service.d.ts +67 -0
- package/core-services/lib/services/breadcrumb.service.d.ts +14 -0
- package/core-services/lib/services/busmessage.service.d.ts +19 -0
- package/core-services/lib/services/can-activate-guard.service.d.ts +12 -0
- package/core-services/lib/services/filter.service.d.ts +15 -0
- package/core-services/lib/services/geolocation.service.d.ts +29 -0
- package/core-services/lib/services/headers.service.d.ts +15 -0
- package/core-services/lib/services/hub.service.d.ts +33 -0
- package/core-services/lib/services/local-store-manager.service.d.ts +50 -0
- package/core-services/lib/services/menu.service.d.ts +27 -0
- package/core-services/lib/services/message.service.d.ts +14 -0
- package/core-services/lib/services/notifications.service.d.ts +14 -0
- package/core-services/lib/services/permission.service.d.ts +12 -0
- package/core-services/lib/services/screen.service.d.ts +14 -0
- package/core-services/lib/services/server-url.d.ts +12 -0
- package/core-services/lib/services/string.function.d.ts +1 -0
- package/core-services/lib/services/user.service.d.ts +22 -0
- package/core-ux/index.d.ts +144 -0
- package/core-ux/lib/components/actions/actions-content.component.d.ts +10 -0
- package/core-ux/lib/components/actions/actions.component.d.ts +57 -0
- package/core-ux/lib/components/actions/extended-action/extended-action.component.d.ts +34 -0
- package/core-ux/lib/components/base-editor/base-editor.component.d.ts +93 -0
- package/core-ux/lib/components/base-item-list/base-item-list.component.d.ts +21 -0
- package/core-ux/lib/components/basefilter/basefilter.component.d.ts +275 -0
- package/core-ux/lib/components/breadcrumb/breadcrumb.component.d.ts +12 -0
- package/core-ux/lib/components/datagrid-custom/datagrid-cell/datagrid-cell.component.d.ts +32 -0
- package/core-ux/lib/components/datagrid-custom/datagrid-custom.component.d.ts +159 -0
- package/core-ux/lib/components/datagrid-custom/datagrid-sorter.component.d.ts +15 -0
- package/core-ux/lib/components/datapage/layout-page/page-layout.component.d.ts +13 -0
- package/core-ux/lib/components/datapage/old/old.datapage.component.d.ts +10 -0
- package/core-ux/lib/components/datapage/old-layout-handler.directive.d.ts +31 -0
- package/core-ux/lib/components/dynamic-components/dynamic-field/dynamic-field.component.d.ts +41 -0
- package/core-ux/lib/components/dynamic-components/dynamic-filter/dynamic-filter-extra.component.d.ts +27 -0
- package/core-ux/lib/components/dynamic-components/dynamic-filter/dynamic-filter-panel.component.d.ts +8 -0
- package/core-ux/lib/components/dynamic-components/dynamic-filter/dynamic-filter.component.d.ts +54 -0
- package/core-ux/lib/components/dynamic-components/dynamic-form/dynamic-form.component.d.ts +122 -0
- package/core-ux/lib/components/filtersummary/filtersummary.component.d.ts +27 -0
- package/core-ux/lib/components/form-password/form-password.component.d.ts +9 -0
- package/core-ux/lib/components/grid-row/grid-row.component.d.ts +12 -0
- package/core-ux/lib/components/image-display/image.component.d.ts +20 -0
- package/core-ux/lib/components/input-selector/input-selector.component.d.ts +50 -0
- package/core-ux/lib/components/input-tree-selector/input-tree-selector.component.d.ts +25 -0
- package/core-ux/lib/components/logs/logs.component.d.ts +32 -0
- package/core-ux/lib/components/menu/menu.component.d.ts +39 -0
- package/core-ux/lib/components/menu-dashboard/menu-dashboard.component.d.ts +15 -0
- package/core-ux/lib/components/paginator/paginator.component.d.ts +17 -0
- package/core-ux/lib/components/parameter-field/parameter-field.component.d.ts +13 -0
- package/core-ux/lib/components/parameter-field/parameter-types/base-array-parameter-type.component.d.ts +16 -0
- package/core-ux/lib/components/parameter-field/parameter-types/base-parameter-type.component.d.ts +21 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-bool/parameter-type-bool.component.d.ts +9 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-bool-array/parameter-type-bool-array.component.d.ts +12 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-date/parameter-type-date.component.d.ts +16 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-date-array/parameter-type-date-array.component.d.ts +17 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-number/parameter-type-number.component.d.ts +6 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-number-array/parameter-type-number-array.component.d.ts +6 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-password/parameter-type-password.component.d.ts +9 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-text/parameter-type-text.component.d.ts +7 -0
- package/core-ux/lib/components/parameter-field/parameter-types/parameter-type-text-array/parameter-type-text-array.component.d.ts +6 -0
- package/core-ux/lib/components/property-grid/property-grid.component.d.ts +125 -0
- package/core-ux/lib/components/search-results/search-results.component.d.ts +7 -0
- package/core-ux/lib/components/tab/tab.component.d.ts +14 -0
- package/core-ux/lib/components/tabset/tabset.component.d.ts +15 -0
- package/core-ux/lib/components/text-viewer/text-viewer.component.d.ts +21 -0
- package/core-ux/lib/components/time-picker/time-picker.component.d.ts +27 -0
- package/core-ux/lib/components/tree/tree.component.d.ts +39 -0
- package/core-ux/lib/components/validation-error/validation-error.component.d.ts +8 -0
- package/core-ux/lib/components/wizard/wizard-step/wizard-step.component.d.ts +26 -0
- package/core-ux/lib/components/wizard/wizard.component.d.ts +29 -0
- package/core-ux/lib/core-ux.module.d.ts +102 -0
- package/core-ux/lib/directives/addclass.directive.d.ts +11 -0
- package/core-ux/lib/directives/collapse.directive.d.ts +34 -0
- package/core-ux/lib/directives/draggable.directive.d.ts +39 -0
- package/core-ux/lib/directives/droppable.directive.d.ts +55 -0
- package/core-ux/lib/directives/editMode.directive.d.ts +8 -0
- package/core-ux/lib/directives/focusable.directive.d.ts +16 -0
- package/core-ux/lib/directives/insertion.directive.d.ts +8 -0
- package/core-ux/lib/directives/onEnter.directive.d.ts +11 -0
- package/core-ux/lib/directives/tab-heading.d.ts +8 -0
- package/core-ux/lib/directives/tab-transclude.d.ts +11 -0
- package/core-ux/lib/directives/tooltip.directive.d.ts +16 -0
- package/core-ux/lib/directives/validate-on-enter.directive.d.ts +10 -0
- package/core-ux/lib/directives/viewMode.directive.d.ts +8 -0
- package/core-ux/lib/layout/default/default-layout.d.ts +36 -0
- package/core-ux/lib/layout/login/login-layout.d.ts +9 -0
- package/core-ux/lib/log.service.d.ts +8 -0
- package/core-ux/lib/modals/confirm-modal/confirm-modal.component.d.ts +17 -0
- package/core-ux/lib/modals/dialog/dialog.component.d.ts +57 -0
- package/core-ux/lib/modals/dialog-component.tokens.d.ts +3 -0
- package/core-ux/lib/modals/export-data-modal/export-data-modal.component.d.ts +11 -0
- package/core-ux/lib/modals/track-record-modal/track-record-modal.component.d.ts +21 -0
- package/core-ux/lib/modals/validation-modal/validation-modal.component.d.ts +24 -0
- package/core-ux/lib/model/datagrid.d.ts +194 -0
- package/core-ux/lib/model/model.d.ts +222 -0
- package/core-ux/lib/model/tree.d.ts +12 -0
- package/core-ux/lib/pipes/euro.pipe.d.ts +9 -0
- package/core-ux/lib/pipes/todefine.pipe.d.ts +8 -0
- package/core-ux/lib/pipes/tofixedsizeinteger.pipe.d.ts +8 -0
- package/core-ux/lib/services/action.service.d.ts +42 -0
- package/core-ux/lib/services/alert.service.d.ts +51 -0
- package/core-ux/lib/services/application.service.d.ts +73 -0
- package/core-ux/lib/services/can-deactivate-guard.d.ts +12 -0
- package/core-ux/lib/services/drag.service.d.ts +54 -0
- package/core-ux/lib/services/fire-authentication.service.d.ts +13 -0
- package/core-ux/lib/services/image.service.d.ts +15 -0
- package/core-ux/lib/services/modal-state.service.d.ts +26 -0
- package/core-ux/lib/services/modal.service.d.ts +30 -0
- package/core-ux/lib/services/presentation-profile.token.d.ts +40 -0
- package/core-ux/lib/services/selectorMapperBase.service.d.ts +36 -0
- package/core-ux/lib/v2/components/actions-panel/action-panel.component.d.ts +48 -0
- package/core-ux/lib/v2/components/base-component/base-component.d.ts +80 -0
- package/core-ux/lib/v2/components/cell-renderer/cell-renderer.component.d.ts +11 -0
- package/core-ux/lib/v2/components/data-grid/data-grid.component.d.ts +104 -0
- package/core-ux/lib/v2/components/data-grid/grid-field-descriptor/grid-field.component.d.ts +55 -0
- package/core-ux/lib/v2/components/data-list/data-list.component.d.ts +29 -0
- package/core-ux/lib/v2/components/editor-tab/editor-tab.component.d.ts +15 -0
- package/core-ux/lib/v2/components/editor-tabset/editor-tabset.component.d.ts +18 -0
- package/core-ux/lib/v2/components/field-descriptor/field.component.d.ts +61 -0
- package/core-ux/lib/v2/components/filter-form/filter-form.component.d.ts +12 -0
- package/core-ux/lib/v2/components/filter-summary/filter-summary.component.d.ts +34 -0
- package/core-ux/lib/v2/components/new-editor/new-editor.component.d.ts +66 -0
- package/core-ux/lib/v2/components/new-paginator/new-paginator.component.d.ts +31 -0
- package/core-ux/lib/v2/components/orderable/orderable-modal.component.d.ts +36 -0
- package/core-ux/lib/v2/components/orderable/orderable-modal.service.d.ts +11 -0
- package/core-ux/lib/v2/components/orderable/orderable.interface.d.ts +52 -0
- package/core-ux/lib/v2/components/property-editor/property-editor-component.d.ts +89 -0
- package/core-ux/lib/v2/components/selector/selector-registry.service.d.ts +9 -0
- package/core-ux/lib/v2/components/selector/selector.component.d.ts +33 -0
- package/core-ux/lib/v2/components/selector/selector.model.d.ts +19 -0
- package/core-ux/lib/v2/components/standard-page-layout/standard-page-layout.component.d.ts +29 -0
- package/core-ux/lib/v2/directives/base-shortcut.directive.d.ts +15 -0
- package/core-ux/lib/v2/directives/hide-on-threshold.directive.d.ts +20 -0
- package/core-ux/lib/v2/directives/layout-handler.directive.d.ts +54 -0
- package/core-ux/lib/v2/directives/row-ref.directive.d.ts +21 -0
- package/core-ux/lib/v2/models/aggregation-model.d.ts +8 -0
- package/core-ux/lib/v2/models/contexts/action-context.d.ts +66 -0
- package/core-ux/lib/v2/models/contexts/action-handler-context.d.ts +49 -0
- package/core-ux/lib/v2/models/contexts/base-form-context.d.ts +42 -0
- package/core-ux/lib/v2/models/contexts/change-detection-context.d.ts +41 -0
- package/core-ux/lib/v2/models/contexts/data-context.d.ts +25 -0
- package/core-ux/lib/v2/models/contexts/data-grid-style-context.d.ts +36 -0
- package/core-ux/lib/v2/models/contexts/editor-context.d.ts +30 -0
- package/core-ux/lib/v2/models/contexts/entity-config-context.d.ts +49 -0
- package/core-ux/lib/v2/models/contexts/filter-context.d.ts +49 -0
- package/core-ux/lib/v2/models/contexts/layout-context.d.ts +57 -0
- package/core-ux/lib/v2/models/contexts/logger-context.d.ts +5 -0
- package/core-ux/lib/v2/models/contexts/section-context.d.ts +73 -0
- package/core-ux/lib/v2/models/contexts/selection-context.d.ts +45 -0
- package/core-ux/lib/v2/models/entity-facade.d.ts +35 -0
- package/core-ux/lib/v2/models/guards/facade-load-guard.d.ts +35 -0
- package/core-ux/lib/v2/models/guards/filter-lifecycle-guard.d.ts +29 -0
- package/core-ux/lib/v2/models/states/sorting-state.d.ts +14 -0
- package/core-ux/lib/v2/models/utilities/action-definition.d.ts +38 -0
- package/core-ux/lib/v2/models/utilities/change-utilities.d.ts +11 -0
- package/core-ux/lib/v2/models/utilities/entity-updater.d.ts +11 -0
- package/core-ux/lib/v2/models/utilities/form-wrapper.d.ts +30 -0
- package/core-ux/lib/v2/models/utilities/row-registry.d.ts +15 -0
- package/core-ux/lib/v2/models/utilities/selection-styler.d.ts +15 -0
- package/core-ux/lib/v2/pipes/gridstyle.pipe.d.ts +15 -0
- package/core-ux/lib/v2/services/app-config.service.d.ts +22 -0
- package/core-ux/lib/v2/services/entity-facade-registry.service.d.ts +28 -0
- package/core-ux/lib/v2/services/facade-modal.service.d.ts +21 -0
- package/core-ux/lib/v2/services/layout.service.d.ts +93 -0
- package/core-ux/lib/v2/services/property-change-bus.service.d.ts +9 -0
- package/core-ux/lib/v2/services/selection.service.d.ts +23 -0
- package/core-ux/lib/v2/services/test.service.d.ts +7 -0
- package/core-ux/lib/v2/services/validation.service.d.ts +10 -0
- package/core-ux/lib/v2/services/view-model-loader.service.d.ts +13 -0
- package/fesm2022/dflat-core-web-core-data.mjs +431 -0
- package/fesm2022/dflat-core-web-core-data.mjs.map +1 -0
- package/fesm2022/dflat-core-web-core-model.mjs +245 -0
- package/fesm2022/dflat-core-web-core-model.mjs.map +1 -0
- package/fesm2022/dflat-core-web-core-services.mjs +1568 -0
- package/fesm2022/dflat-core-web-core-services.mjs.map +1 -0
- package/fesm2022/dflat-core-web-core-ux.mjs +16294 -0
- package/fesm2022/dflat-core-web-core-ux.mjs.map +1 -0
- package/fesm2022/dflat-core-web-core.mjs +743 -0
- package/fesm2022/dflat-core-web-core.mjs.map +1 -0
- package/fesm2022/dflat-core-web-system-data.mjs +1031 -0
- package/fesm2022/dflat-core-web-system-data.mjs.map +1 -0
- package/fesm2022/dflat-core-web-system-model.mjs +283 -0
- package/fesm2022/dflat-core-web-system-model.mjs.map +1 -0
- package/fesm2022/dflat-core-web-system-root.mjs +289 -0
- package/fesm2022/dflat-core-web-system-root.mjs.map +1 -0
- package/fesm2022/dflat-core-web-system-ux.mjs +5677 -0
- package/fesm2022/dflat-core-web-system-ux.mjs.map +1 -0
- package/fesm2022/dflat-core-web.mjs +18 -0
- package/fesm2022/dflat-core-web.mjs.map +1 -0
- package/index.d.ts +1 -0
- package/package.json +82 -0
- package/scss/core-ux.scss +5 -0
- package/scss/images/circle-info.svg +1 -0
- package/scss/images/circlecross.svg +3 -0
- package/scss/images/circularoptionselected.svg +1 -0
- package/scss/images/error.png +0 -0
- package/scss/images/filter.svg +2 -0
- package/scss/images/information.png +0 -0
- package/scss/images/pen-solid.svg +1 -0
- package/scss/images/search-sprite.png +0 -0
- package/scss/images/search.svg +3 -0
- package/scss/images/warning.png +0 -0
- package/scss/layout/default/default-layout.scss +270 -0
- package/scss/layout/login/login-layout.scss +204 -0
- package/scss/styles/drag-and-drop.scss +36 -0
- package/scss/styles/forms.scss +94 -0
- package/scss/styles/shared.scss +222 -0
- package/system-data/index.d.ts +50 -0
- package/system-data/lib/data-services/account-service.generated.d.ts +20 -0
- package/system-data/lib/data-services/action-service.generated.d.ts +15 -0
- package/system-data/lib/data-services/address-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/checkout-service.generated.d.ts +13 -0
- package/system-data/lib/data-services/company-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/config-service.generated.d.ts +18 -0
- package/system-data/lib/data-services/country-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/currency-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/custom-field-group-entity-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/custom-field-group-item-service.generated.d.ts +13 -0
- package/system-data/lib/data-services/custom-field-group-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/custom-field-options-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/custom-field-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/error-category-service.generated.d.ts +12 -0
- package/system-data/lib/data-services/exchange-rate-detail-service.generated.d.ts +35 -0
- package/system-data/lib/data-services/exchange-rate-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/file-service.generated.d.ts +26 -0
- package/system-data/lib/data-services/keyword-service.generated.d.ts +12 -0
- package/system-data/lib/data-services/meta-entity-field-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/meta-entity-keyword-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/meta-entity-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/news-service.generated.d.ts +13 -0
- package/system-data/lib/data-services/parameter-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/parameter-value-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/permission-service.generated.d.ts +12 -0
- package/system-data/lib/data-services/permission-view-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/plugin-parameter-value-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/presentation-profile-item-service.generated.d.ts +14 -0
- package/system-data/lib/data-services/presentation-profile-service.generated.d.ts +13 -0
- package/system-data/lib/data-services/rating-service.generated.d.ts +14 -0
- package/system-data/lib/data-services/rating-summary-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/rating-view-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/request-result-service.generated.d.ts +12 -0
- package/system-data/lib/data-services/request-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/resource-key-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/resource-language-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/resource-translation-view-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/role-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/subcompany-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/supplier-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/synchronized-company-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/tva-rate-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/user-account-company-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/user-account-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/user-favorite-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/user-group-definition-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/user-group-service.generated.d.ts +10 -0
- package/system-data/lib/data-services/user-role-service.generated.d.ts +10 -0
- package/system-data/lib/system-data.module.d.ts +9 -0
- package/system-model/index.d.ts +3 -0
- package/system-model/lib/model/interface.generated.d.ts +1162 -0
- package/system-model/lib/model/model.d.ts +11 -0
- package/system-model/lib/system-model.module.d.ts +7 -0
- package/system-root/index.d.ts +5 -0
- package/system-root/lib/system-entity-keys.d.ts +36 -0
- package/system-root/lib/system-menu-item-provider.d.ts +28 -0
- package/system-root/lib/system-menu-service.d.ts +13 -0
- package/system-root/lib/system-permissions.generated.d.ts +128 -0
- package/system-root/lib/system-root.module.d.ts +7 -0
- package/system-ux/index.d.ts +76 -0
- package/system-ux/lib/activate/activate.component.d.ts +36 -0
- package/system-ux/lib/address/address-editor.component.d.ts +12 -0
- package/system-ux/lib/address/address.component.d.ts +15 -0
- package/system-ux/lib/company/company-editor.component.d.ts +12 -0
- package/system-ux/lib/company/company.component.d.ts +19 -0
- package/system-ux/lib/components/image-upload/image-upload.component.d.ts +99 -0
- package/system-ux/lib/config/config-component.d.ts +22 -0
- package/system-ux/lib/config/datawarehouse-supply/dw-supply.component.d.ts +14 -0
- package/system-ux/lib/country/country-editor.component.d.ts +12 -0
- package/system-ux/lib/country/country.component.d.ts +14 -0
- package/system-ux/lib/currency/currency-editor.component.d.ts +12 -0
- package/system-ux/lib/currency/currency.component.d.ts +14 -0
- package/system-ux/lib/custom-field/custom-field-editor.component.d.ts +13 -0
- package/system-ux/lib/custom-field/custom-field.component.d.ts +19 -0
- package/system-ux/lib/custom-field-group/custom-field-group-editor.component.d.ts +14 -0
- package/system-ux/lib/custom-field-group/custom-field-group-entity/custom-field-group-entity-editor.component.d.ts +13 -0
- package/system-ux/lib/custom-field-group/custom-field-group-entity/custom-field-group-entity.component.d.ts +19 -0
- package/system-ux/lib/custom-field-group/custom-field-group-item/custom-field-group-item-editor.component.d.ts +12 -0
- package/system-ux/lib/custom-field-group/custom-field-group-item/custom-field-group-item.component.d.ts +27 -0
- package/system-ux/lib/custom-field-group/custom-field-group.component.d.ts +23 -0
- package/system-ux/lib/custom-field-options/custom-field-options-editor.component.d.ts +17 -0
- package/system-ux/lib/custom-field-options/custom-field-options.component.d.ts +22 -0
- package/system-ux/lib/entity-files/entity-files.component.d.ts +37 -0
- package/system-ux/lib/exchange-rate/exchange-rate-detail.component.d.ts +17 -0
- package/system-ux/lib/exchange-rate/exchange-rate-editor.component.d.ts +25 -0
- package/system-ux/lib/exchange-rate/exchange-rate.component.d.ts +18 -0
- package/system-ux/lib/global-parameter/global-parameter.component.d.ts +15 -0
- package/system-ux/lib/login/login.component.d.ts +37 -0
- package/system-ux/lib/meta-entity/meta-entity.component.d.ts +22 -0
- package/system-ux/lib/meta-entity-field/meta-entity-field-editor.component.d.ts +12 -0
- package/system-ux/lib/meta-entity-field/meta-entity-field.component.d.ts +20 -0
- package/system-ux/lib/news/news-component.d.ts +16 -0
- package/system-ux/lib/news/news-editor.component.d.ts +28 -0
- package/system-ux/lib/permission/permission-component.d.ts +16 -0
- package/system-ux/lib/permission/permission-editor.component.d.ts +12 -0
- package/system-ux/lib/presentation-profile/pp-facade.service.d.ts +39 -0
- package/system-ux/lib/presentation-profile/presentation-profile-action-service.d.ts +16 -0
- package/system-ux/lib/presentation-profile/presentation-profile-column-grid/presentation-profile-column.component.d.ts +73 -0
- package/system-ux/lib/presentation-profile/presentation-profile-column-grid/presentation-profile-items.component.d.ts +50 -0
- package/system-ux/lib/presentation-profile/presentation-profile-resolver.service.d.ts +34 -0
- package/system-ux/lib/presentation-profile/presentation-profile-transformer.d.ts +48 -0
- package/system-ux/lib/presentation-profile/presentation-profile.component.d.ts +16 -0
- package/system-ux/lib/presentation-profile/presentation-profile.service.d.ts +58 -0
- package/system-ux/lib/request/request-editor.component.d.ts +12 -0
- package/system-ux/lib/request/request.component.d.ts +20 -0
- package/system-ux/lib/request-results/request-results.component.d.ts +15 -0
- package/system-ux/lib/reset-password/reset-password.component.d.ts +32 -0
- package/system-ux/lib/resource-key/resource-key.component.d.ts +18 -0
- package/system-ux/lib/resource-language/resource-language.component.d.ts +16 -0
- package/system-ux/lib/resource-language/resourcelanguage-editor.component.d.ts +12 -0
- package/system-ux/lib/resource-translation/resource-translation-editor.component.d.ts +12 -0
- package/system-ux/lib/resource-translation/resource-translation.component.d.ts +16 -0
- package/system-ux/lib/role/role-component.d.ts +14 -0
- package/system-ux/lib/role/role-editor.component.d.ts +27 -0
- package/system-ux/lib/services/custom-field-action-service.d.ts +25 -0
- package/system-ux/lib/services/custom-field-service.d.ts +21 -0
- package/system-ux/lib/services/rates-action-service.d.ts +28 -0
- package/system-ux/lib/services/select-user-company-action-service.d.ts +23 -0
- package/system-ux/lib/services/system-section.service.d.ts +12 -0
- package/system-ux/lib/services/system-selector-mapper.service.d.ts +24 -0
- package/system-ux/lib/services/user-action-service.d.ts +20 -0
- package/system-ux/lib/sub-company/sub-company.component.d.ts +15 -0
- package/system-ux/lib/supplier/supplier-editor.component.d.ts +12 -0
- package/system-ux/lib/supplier/supplier.component.d.ts +16 -0
- package/system-ux/lib/synchronised-company/synchronised-company.component.d.ts +16 -0
- package/system-ux/lib/system-ux.module.d.ts +88 -0
- package/system-ux/lib/tva-rate/tva-rate-detail.component.d.ts +17 -0
- package/system-ux/lib/tva-rate/tva-rate-editor.component.d.ts +25 -0
- package/system-ux/lib/tva-rate/tva-rate.component.d.ts +17 -0
- package/system-ux/lib/user-account/user-account-component.d.ts +18 -0
- package/system-ux/lib/user-account/user-account-editor.component.d.ts +12 -0
- package/system-ux/lib/user-account-profile/user-account-profile.component.d.ts +31 -0
- package/system-ux/lib/user-company/user-company-component.d.ts +21 -0
- package/system-ux/lib/user-group/user-group-definition.component.d.ts +18 -0
- package/system-ux/lib/user-group/user-group-editor.component.d.ts +12 -0
- package/system-ux/lib/user-group/user-group.component.d.ts +16 -0
- package/system-ux/lib/user-permission/user-permission-component.d.ts +14 -0
- package/system-ux/lib/user-role/user-role-component.d.ts +20 -0
|
@@ -0,0 +1,1568 @@
|
|
|
1
|
+
import * as i7 from '@dflat-core/web/core';
|
|
2
|
+
import { Utilities, EnsureModuleLoadedOnceGuard } from '@dflat-core/web/core';
|
|
3
|
+
import { DictionnaryWrapper, UserUpdatedMessage, Notification, User, CoreModelModule, ApiErrorTypes } from '@dflat-core/web/core-model';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i3 from '@angular/common/http';
|
|
6
|
+
import { HttpHeaders, provideHttpClient, withInterceptorsFromDi, HttpErrorResponse } from '@angular/common/http';
|
|
7
|
+
import * as i0 from '@angular/core';
|
|
8
|
+
import { Injectable, EventEmitter, Optional, SkipSelf, NgModule } from '@angular/core';
|
|
9
|
+
import * as i1 from '@angular/router';
|
|
10
|
+
import jwt_decode from 'jwt-decode';
|
|
11
|
+
import { Subject, ReplaySubject, timer, throwError, BehaviorSubject, empty } from 'rxjs';
|
|
12
|
+
import { filter, map, finalize, catchError } from 'rxjs/operators';
|
|
13
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
14
|
+
import * as signalR from '@microsoft/signalr';
|
|
15
|
+
|
|
16
|
+
class AppConfiguration {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.searchText = "";
|
|
19
|
+
this.isSearchAllowed = false;
|
|
20
|
+
}
|
|
21
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AppConfiguration, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
22
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AppConfiguration }); }
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AppConfiguration, decorators: [{
|
|
25
|
+
type: Injectable
|
|
26
|
+
}], ctorParameters: () => [] });
|
|
27
|
+
|
|
28
|
+
class AppKeys {
|
|
29
|
+
static { this.CURRENT_USER = "current_user"; }
|
|
30
|
+
static { this.ACCESS_TOKEN = "access_token"; }
|
|
31
|
+
static { this.REFRESH_TOKEN = "refresh_token"; }
|
|
32
|
+
static { this.TOKEN_EXPIRES_IN = "expires_in"; }
|
|
33
|
+
static { this.REMEMBER_ME = "remember_me"; }
|
|
34
|
+
static { this.PERMISSIONS = "permissions"; }
|
|
35
|
+
static { this.LAST_GEOLOCATIONS = "geolocations"; }
|
|
36
|
+
static { this.REFERENCE_SUPPLIER_ID = "refsuppid"; }
|
|
37
|
+
static { this.USER_COMPANY_ID = "companyid"; }
|
|
38
|
+
static { this.SELECTED_COMPANY = "selectedcompany"; }
|
|
39
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AppKeys, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
40
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AppKeys }); }
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AppKeys, decorators: [{
|
|
43
|
+
type: Injectable
|
|
44
|
+
}] });
|
|
45
|
+
|
|
46
|
+
class BusMessageService {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.message$ = new Subject();
|
|
49
|
+
}
|
|
50
|
+
publish(message) {
|
|
51
|
+
const channel = message.constructor.name;
|
|
52
|
+
this.message$.next({ Channel: channel, Data: message });
|
|
53
|
+
}
|
|
54
|
+
of(messageType) {
|
|
55
|
+
const channel = messageType.name;
|
|
56
|
+
return this.message$.pipe(filter(m => m.Channel === channel), map(m => m.Data));
|
|
57
|
+
}
|
|
58
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BusMessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
59
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BusMessageService }); }
|
|
60
|
+
}
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BusMessageService, decorators: [{
|
|
62
|
+
type: Injectable
|
|
63
|
+
}], ctorParameters: () => [] });
|
|
64
|
+
class NotificationMqService {
|
|
65
|
+
constructor() {
|
|
66
|
+
this.message$ = new Subject();
|
|
67
|
+
}
|
|
68
|
+
publish(message) {
|
|
69
|
+
const defaultchannel = message.entityType;
|
|
70
|
+
this.message$.next({ Channel: defaultchannel, Data: message });
|
|
71
|
+
if (!Utilities.IsUndefined(message.entityId)) {
|
|
72
|
+
const detailchannel = `${message.entityType}-${message.entityId}`;
|
|
73
|
+
this.message$.next({ Channel: detailchannel, Data: message });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
of(channelKey) {
|
|
77
|
+
const channel = channelKey;
|
|
78
|
+
return this.message$.pipe(filter(m => m.Channel === channel), map(m => m.Data));
|
|
79
|
+
}
|
|
80
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NotificationMqService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
81
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NotificationMqService }); }
|
|
82
|
+
}
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NotificationMqService, decorators: [{
|
|
84
|
+
type: Injectable
|
|
85
|
+
}], ctorParameters: () => [] });
|
|
86
|
+
|
|
87
|
+
class LocalStoreManager {
|
|
88
|
+
constructor() {
|
|
89
|
+
this.syncKeys = [];
|
|
90
|
+
this.initEvent = new Subject();
|
|
91
|
+
this.reservedKeys = ['sync_keys', 'addToSyncKeys', 'removeFromSyncKeys',
|
|
92
|
+
'getSessionStorage', 'setSessionStorage', 'addToSessionStorage', 'removeFromSessionStorage', 'clearAllSessionsStorage'];
|
|
93
|
+
this.sessionStorageTransferHandler = (event) => {
|
|
94
|
+
if (!event.newValue)
|
|
95
|
+
return;
|
|
96
|
+
if (event.key == 'getSessionStorage') {
|
|
97
|
+
if (sessionStorage.length) {
|
|
98
|
+
this.localStorageSetItem('setSessionStorage', sessionStorage);
|
|
99
|
+
localStorage.removeItem('setSessionStorage');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (event.key == 'setSessionStorage') {
|
|
103
|
+
if (!this.syncKeys.length)
|
|
104
|
+
this.loadSyncKeys();
|
|
105
|
+
let data = JSON.parse(event.newValue);
|
|
106
|
+
//console.info("Set => Key: Transfer setSessionStorage" + ", data: " + JSON.stringify(data));
|
|
107
|
+
for (let key in data) {
|
|
108
|
+
if (this.syncKeysContains(key))
|
|
109
|
+
this.sessionStorageSetItem(key, JSON.parse(data[key]));
|
|
110
|
+
}
|
|
111
|
+
this.onInit();
|
|
112
|
+
}
|
|
113
|
+
else if (event.key === 'addToSessionStorage') {
|
|
114
|
+
let data = JSON.parse(event.newValue);
|
|
115
|
+
//console.warn("Set => Key: Transfer addToSessionStorage" + ", data: " + JSON.stringify(data));
|
|
116
|
+
this.addToSessionStorageHelper(data["data"], data["key"]);
|
|
117
|
+
}
|
|
118
|
+
else if (event.key === 'removeFromSessionStorage') {
|
|
119
|
+
this.removeFromSessionStorageHelper(event.newValue);
|
|
120
|
+
}
|
|
121
|
+
else if (event.key === 'clearAllSessionsStorage' && sessionStorage.length) {
|
|
122
|
+
this.clearInstanceSessionStorage();
|
|
123
|
+
}
|
|
124
|
+
else if (event.key === 'addToSyncKeys') {
|
|
125
|
+
this.addToSyncKeysHelper(event.newValue);
|
|
126
|
+
}
|
|
127
|
+
else if (event.key === 'removeFromSyncKeys') {
|
|
128
|
+
this.removeFromSyncKeysHelper(event.newValue);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
static { this.syncListenerInitialised = false; }
|
|
133
|
+
static { this.DBKEY_USER_DATA = "user_data"; }
|
|
134
|
+
static { this.DBKEY_SYNC_KEYS = "sync_keys"; }
|
|
135
|
+
//Todo: Implement EventListeners for the various event operations and a SessionStorageEvent for specific data keys
|
|
136
|
+
initialiseStorageSyncListener() {
|
|
137
|
+
if (LocalStoreManager.syncListenerInitialised == true)
|
|
138
|
+
return;
|
|
139
|
+
LocalStoreManager.syncListenerInitialised = true;
|
|
140
|
+
window.addEventListener("storage", this.sessionStorageTransferHandler, false);
|
|
141
|
+
this.syncSessionStorage();
|
|
142
|
+
}
|
|
143
|
+
deinitialiseStorageSyncListener() {
|
|
144
|
+
window.removeEventListener("storage", this.sessionStorageTransferHandler, false);
|
|
145
|
+
LocalStoreManager.syncListenerInitialised = false;
|
|
146
|
+
}
|
|
147
|
+
syncSessionStorage() {
|
|
148
|
+
localStorage.setItem('getSessionStorage', '_dummy');
|
|
149
|
+
localStorage.removeItem('getSessionStorage');
|
|
150
|
+
}
|
|
151
|
+
clearAllStorage() {
|
|
152
|
+
this.clearAllSessionsStorage();
|
|
153
|
+
this.clearLocalStorage();
|
|
154
|
+
}
|
|
155
|
+
clearAllSessionsStorage() {
|
|
156
|
+
this.clearInstanceSessionStorage();
|
|
157
|
+
localStorage.removeItem(LocalStoreManager.DBKEY_SYNC_KEYS);
|
|
158
|
+
localStorage.setItem('clearAllSessionsStorage', '_dummy');
|
|
159
|
+
localStorage.removeItem('clearAllSessionsStorage');
|
|
160
|
+
}
|
|
161
|
+
clearInstanceSessionStorage() {
|
|
162
|
+
sessionStorage.clear();
|
|
163
|
+
this.syncKeys = [];
|
|
164
|
+
}
|
|
165
|
+
clearLocalStorage() {
|
|
166
|
+
localStorage.clear();
|
|
167
|
+
}
|
|
168
|
+
addToSessionStorage(data, key) {
|
|
169
|
+
this.addToSessionStorageHelper(data, key);
|
|
170
|
+
this.addToSyncKeysBackup(key);
|
|
171
|
+
this.localStorageSetItem('addToSessionStorage', { key: key, data: data });
|
|
172
|
+
localStorage.removeItem('addToSessionStorage');
|
|
173
|
+
}
|
|
174
|
+
addToSessionStorageHelper(data, key) {
|
|
175
|
+
this.addToSyncKeysHelper(key);
|
|
176
|
+
this.sessionStorageSetItem(key, data);
|
|
177
|
+
}
|
|
178
|
+
removeFromSessionStorage(keyToRemove) {
|
|
179
|
+
this.removeFromSessionStorageHelper(keyToRemove);
|
|
180
|
+
this.removeFromSyncKeysBackup(keyToRemove);
|
|
181
|
+
localStorage.setItem('removeFromSessionStorage', keyToRemove);
|
|
182
|
+
localStorage.removeItem('removeFromSessionStorage');
|
|
183
|
+
}
|
|
184
|
+
removeFromSessionStorageHelper(keyToRemove) {
|
|
185
|
+
sessionStorage.removeItem(keyToRemove);
|
|
186
|
+
this.removeFromSyncKeysHelper(keyToRemove);
|
|
187
|
+
}
|
|
188
|
+
testForInvalidKeys(key) {
|
|
189
|
+
if (!key)
|
|
190
|
+
throw new Error("key cannot be empty");
|
|
191
|
+
if (this.reservedKeys.some(x => x === key))
|
|
192
|
+
throw new Error(`The storage key "${key}" is reserved and cannot be used. Please use a different key`);
|
|
193
|
+
}
|
|
194
|
+
syncKeysContains(key) {
|
|
195
|
+
return this.syncKeys.some(x => x === key);
|
|
196
|
+
}
|
|
197
|
+
loadSyncKeys() {
|
|
198
|
+
if (this.syncKeys.length)
|
|
199
|
+
return;
|
|
200
|
+
this.syncKeys = this.getSyncKeysFromStorage();
|
|
201
|
+
}
|
|
202
|
+
getSyncKeysFromStorage(defaultValue = []) {
|
|
203
|
+
let data = this.localStorageGetItem(LocalStoreManager.DBKEY_SYNC_KEYS);
|
|
204
|
+
if (data == null)
|
|
205
|
+
return defaultValue;
|
|
206
|
+
else
|
|
207
|
+
return data;
|
|
208
|
+
}
|
|
209
|
+
addToSyncKeys(key) {
|
|
210
|
+
this.addToSyncKeysHelper(key);
|
|
211
|
+
this.addToSyncKeysBackup(key);
|
|
212
|
+
localStorage.setItem('addToSyncKeys', key);
|
|
213
|
+
localStorage.removeItem('addToSyncKeys');
|
|
214
|
+
}
|
|
215
|
+
addToSyncKeysBackup(key) {
|
|
216
|
+
let storedSyncKeys = this.getSyncKeysFromStorage();
|
|
217
|
+
if (!storedSyncKeys.some(x => x === key)) {
|
|
218
|
+
storedSyncKeys.push(key);
|
|
219
|
+
this.localStorageSetItem(LocalStoreManager.DBKEY_SYNC_KEYS, storedSyncKeys);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
removeFromSyncKeysBackup(key) {
|
|
223
|
+
let storedSyncKeys = this.getSyncKeysFromStorage();
|
|
224
|
+
let index = storedSyncKeys.indexOf(key);
|
|
225
|
+
if (index > -1) {
|
|
226
|
+
storedSyncKeys.splice(index, 1);
|
|
227
|
+
this.localStorageSetItem(LocalStoreManager.DBKEY_SYNC_KEYS, storedSyncKeys);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
addToSyncKeysHelper(key) {
|
|
231
|
+
if (!this.syncKeysContains(key))
|
|
232
|
+
this.syncKeys.push(key);
|
|
233
|
+
}
|
|
234
|
+
removeFromSyncKeys(key) {
|
|
235
|
+
this.removeFromSyncKeysHelper(key);
|
|
236
|
+
this.removeFromSyncKeysBackup(key);
|
|
237
|
+
localStorage.setItem('removeFromSyncKeys', key);
|
|
238
|
+
localStorage.removeItem('removeFromSyncKeys');
|
|
239
|
+
}
|
|
240
|
+
removeFromSyncKeysHelper(key) {
|
|
241
|
+
let index = this.syncKeys.indexOf(key);
|
|
242
|
+
if (index > -1) {
|
|
243
|
+
this.syncKeys.splice(index, 1);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
saveSessionData(data, key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
247
|
+
this.testForInvalidKeys(key);
|
|
248
|
+
this.removeFromSyncKeys(key);
|
|
249
|
+
localStorage.removeItem(key);
|
|
250
|
+
this.sessionStorageSetItem(key, data);
|
|
251
|
+
}
|
|
252
|
+
saveSyncedSessionData(data, key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
253
|
+
this.testForInvalidKeys(key);
|
|
254
|
+
localStorage.removeItem(key);
|
|
255
|
+
this.addToSessionStorage(data, key);
|
|
256
|
+
}
|
|
257
|
+
savePermanentData(data, key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
258
|
+
this.testForInvalidKeys(key);
|
|
259
|
+
this.removeFromSessionStorage(key);
|
|
260
|
+
this.localStorageSetItem(key, data);
|
|
261
|
+
}
|
|
262
|
+
moveDataToSessionStorage(key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
263
|
+
this.testForInvalidKeys(key);
|
|
264
|
+
let data = this.getData(key);
|
|
265
|
+
if (data == null)
|
|
266
|
+
return;
|
|
267
|
+
this.saveSessionData(data, key);
|
|
268
|
+
}
|
|
269
|
+
moveDataToSyncedSessionStorage(key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
270
|
+
this.testForInvalidKeys(key);
|
|
271
|
+
let data = this.getData(key);
|
|
272
|
+
if (data == null)
|
|
273
|
+
return;
|
|
274
|
+
this.saveSyncedSessionData(data, key);
|
|
275
|
+
}
|
|
276
|
+
moveDataToPermanentStorage(key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
277
|
+
this.testForInvalidKeys(key);
|
|
278
|
+
let data = this.getData(key);
|
|
279
|
+
if (data == null)
|
|
280
|
+
return;
|
|
281
|
+
this.savePermanentData(data, key);
|
|
282
|
+
}
|
|
283
|
+
exists(key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
284
|
+
let data = sessionStorage.getItem(key);
|
|
285
|
+
if (data == null)
|
|
286
|
+
data = localStorage.getItem(key);
|
|
287
|
+
return data != null;
|
|
288
|
+
}
|
|
289
|
+
getData(key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
290
|
+
this.testForInvalidKeys(key);
|
|
291
|
+
let data = this.sessionStorageGetItem(key);
|
|
292
|
+
if (data == null)
|
|
293
|
+
data = this.localStorageGetItem(key);
|
|
294
|
+
return data;
|
|
295
|
+
}
|
|
296
|
+
getDataObject(key = LocalStoreManager.DBKEY_USER_DATA, isDateType = false) {
|
|
297
|
+
let data = this.getData(key);
|
|
298
|
+
if (data != null) {
|
|
299
|
+
if (isDateType)
|
|
300
|
+
data = new Date(data);
|
|
301
|
+
return data;
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
deleteData(key = LocalStoreManager.DBKEY_USER_DATA) {
|
|
308
|
+
this.testForInvalidKeys(key);
|
|
309
|
+
this.removeFromSessionStorage(key);
|
|
310
|
+
localStorage.removeItem(key);
|
|
311
|
+
}
|
|
312
|
+
localStorageSetItem(key, data) {
|
|
313
|
+
localStorage.setItem(key, JSON.stringify(data));
|
|
314
|
+
}
|
|
315
|
+
sessionStorageSetItem(key, data) {
|
|
316
|
+
sessionStorage.setItem(key, JSON.stringify(data));
|
|
317
|
+
}
|
|
318
|
+
localStorageGetItem(key) {
|
|
319
|
+
return Utilities.JSonTryParse(localStorage.getItem(key));
|
|
320
|
+
}
|
|
321
|
+
sessionStorageGetItem(key) {
|
|
322
|
+
return Utilities.JSonTryParse(sessionStorage.getItem(key));
|
|
323
|
+
}
|
|
324
|
+
onInit() {
|
|
325
|
+
setTimeout(() => {
|
|
326
|
+
this.initEvent.next({});
|
|
327
|
+
this.initEvent.complete();
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
getInitEvent() {
|
|
331
|
+
return this.initEvent.asObservable();
|
|
332
|
+
}
|
|
333
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LocalStoreManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
334
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LocalStoreManager }); }
|
|
335
|
+
}
|
|
336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LocalStoreManager, decorators: [{
|
|
337
|
+
type: Injectable
|
|
338
|
+
}] });
|
|
339
|
+
|
|
340
|
+
class HeadersService {
|
|
341
|
+
constructor(localStorage) {
|
|
342
|
+
this.localStorage = localStorage;
|
|
343
|
+
}
|
|
344
|
+
// for requesting secure data using json
|
|
345
|
+
authJsonHeaders() {
|
|
346
|
+
let result = new HttpHeaders()
|
|
347
|
+
.set('Content-Type', 'application/json')
|
|
348
|
+
.set('Accept', 'application/json')
|
|
349
|
+
.set('Authorization', `Bearer ${this.geJWTToken}`);
|
|
350
|
+
return result;
|
|
351
|
+
}
|
|
352
|
+
// for requesting secure data from a form post
|
|
353
|
+
authFormHeaders() {
|
|
354
|
+
let result = new HttpHeaders()
|
|
355
|
+
.set('Content-Type', 'application/x-www-form-urlencoded')
|
|
356
|
+
.set('Accept', 'application/json')
|
|
357
|
+
.set('Authorization', `Bearer ${this.geJWTToken}`);
|
|
358
|
+
return result;
|
|
359
|
+
}
|
|
360
|
+
authFileUploadHeaders() {
|
|
361
|
+
return new HttpHeaders()
|
|
362
|
+
.set('Authorization', `Bearer ${this.geJWTToken}`);
|
|
363
|
+
}
|
|
364
|
+
// for requesting unsecured data using json
|
|
365
|
+
jsonHeaders() {
|
|
366
|
+
return new HttpHeaders()
|
|
367
|
+
.set('Content-Type', 'application/json')
|
|
368
|
+
.set('Accept', 'application/json');
|
|
369
|
+
}
|
|
370
|
+
// for requesting unsecured data using form post
|
|
371
|
+
contentHeadersV2() {
|
|
372
|
+
return new HttpHeaders()
|
|
373
|
+
.set('Content-Type', 'application/x-www-form-urlencoded')
|
|
374
|
+
.set('Accept', 'application/json');
|
|
375
|
+
}
|
|
376
|
+
get geJWTToken() {
|
|
377
|
+
let result = this.localStorage.getDataObject(AppKeys.ACCESS_TOKEN);
|
|
378
|
+
if (Utilities.IsNil(result))
|
|
379
|
+
return '';
|
|
380
|
+
return result;
|
|
381
|
+
}
|
|
382
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HeadersService, deps: [{ token: LocalStoreManager }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
383
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HeadersService }); }
|
|
384
|
+
}
|
|
385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HeadersService, decorators: [{
|
|
386
|
+
type: Injectable
|
|
387
|
+
}], ctorParameters: () => [{ type: LocalStoreManager }] });
|
|
388
|
+
|
|
389
|
+
class ServerUrl {
|
|
390
|
+
static { this.isProduction = false; }
|
|
391
|
+
// POUR TESTER L'ENVIRONNEMENT DE PROD EN LOCAL DECOMMENTER LES LIGNES
|
|
392
|
+
// static baseUrl = (ServerUrl.isProduction ? 'http://localhost:56407' : 'http://localhost:56407');
|
|
393
|
+
static { this.baseUrl = (ServerUrl.isProduction ? '' : 'http://localhost:56407'); }
|
|
394
|
+
static { this.apiUrl = ServerUrl.baseUrl + '/api'; }
|
|
395
|
+
static { this.hubUrl = ServerUrl.baseUrl + '/hub'; }
|
|
396
|
+
static { this.loginPath = '/Account/Login'; }
|
|
397
|
+
static { this.connectPath = '/Account/Connect'; }
|
|
398
|
+
static { this.registerPath = '/Account/Register'; }
|
|
399
|
+
static { this.activatePath = '/Account/Activate'; }
|
|
400
|
+
static { this.refreshPath = '/Account/RefreshToken'; }
|
|
401
|
+
static { this.disconnectPath = '/Account/Disconnect'; }
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
class PermissionService {
|
|
405
|
+
constructor(localStorage) {
|
|
406
|
+
this.localStorage = localStorage;
|
|
407
|
+
}
|
|
408
|
+
hasPermission(permission) {
|
|
409
|
+
return this.permissions != null && this.permissions.some(p => p === permission) || this.isAdmin;
|
|
410
|
+
}
|
|
411
|
+
get permissions() {
|
|
412
|
+
let permissions = this.localStorage.getDataObject(AppKeys.PERMISSIONS);
|
|
413
|
+
let parsed_permissions = JSON.parse(permissions);
|
|
414
|
+
return parsed_permissions;
|
|
415
|
+
}
|
|
416
|
+
get isAdmin() {
|
|
417
|
+
let parsed = JSON.parse(this.currentUser);
|
|
418
|
+
return parsed && parsed.IsAdmin || false;
|
|
419
|
+
}
|
|
420
|
+
get currentUser() {
|
|
421
|
+
return this.localStorage.getDataObject(AppKeys.CURRENT_USER);
|
|
422
|
+
}
|
|
423
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PermissionService, deps: [{ token: LocalStoreManager }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
424
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PermissionService }); }
|
|
425
|
+
}
|
|
426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PermissionService, decorators: [{
|
|
427
|
+
type: Injectable
|
|
428
|
+
}], ctorParameters: () => [{ type: LocalStoreManager }] });
|
|
429
|
+
|
|
430
|
+
class MenuService {
|
|
431
|
+
constructor(permissionService) {
|
|
432
|
+
this.permissionService = permissionService;
|
|
433
|
+
this.current = new ReplaySubject(1);
|
|
434
|
+
this.hasPermission = (permKey) => {
|
|
435
|
+
if (permKey === undefined)
|
|
436
|
+
return true;
|
|
437
|
+
return this.permissionService.hasPermission(permKey);
|
|
438
|
+
};
|
|
439
|
+
this.hasAnyPermission = (permKeys) => {
|
|
440
|
+
let result = false;
|
|
441
|
+
permKeys.forEach(p => result = result || this.hasPermission(p));
|
|
442
|
+
return result;
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
setCurrent(menu) {
|
|
446
|
+
this.current.next(menu);
|
|
447
|
+
}
|
|
448
|
+
getCurrent() {
|
|
449
|
+
return this.current;
|
|
450
|
+
}
|
|
451
|
+
get permissionRouteMap() {
|
|
452
|
+
if (Utilities.IsNil(this._permissionRouteMap)) {
|
|
453
|
+
this._permissionRouteMap = new DictionnaryWrapper();
|
|
454
|
+
this.getAllMenuItems(true).forEach(item => {
|
|
455
|
+
if (!Utilities.IsNil(item.sublinks)) {
|
|
456
|
+
item.sublinks.forEach(subItem => {
|
|
457
|
+
if (subItem.permissionKey) {
|
|
458
|
+
this._permissionRouteMap.dictionary[subItem.link] = subItem.permissionKey;
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
return this._permissionRouteMap;
|
|
465
|
+
}
|
|
466
|
+
resetPermissionMap() {
|
|
467
|
+
this._permissionRouteMap = undefined;
|
|
468
|
+
}
|
|
469
|
+
hasAccessToThisRoute(url) {
|
|
470
|
+
let menuItems = this.getAccessGrantedMenuItems();
|
|
471
|
+
if (!Utilities.IsNil(menuItems) && menuItems.findIndex(f => f.link === url) >= 0)
|
|
472
|
+
return true;
|
|
473
|
+
if (this.permissionRouteMap.containsKeyOrPartKey(url)) {
|
|
474
|
+
return this.hasPermission(this.permissionRouteMap.getPartKey(url));
|
|
475
|
+
}
|
|
476
|
+
// Le menu n'a pas de permissions associé, on renvoie true
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
pushItem(items, menuItem, isAdmin) {
|
|
480
|
+
if (Utilities.IsNil(menuItem.permissionKey) ||
|
|
481
|
+
isAdmin || this.hasPermission(menuItem.permissionKey)) {
|
|
482
|
+
items.push(menuItem);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
getMenuItems(isAdmin) {
|
|
486
|
+
let results = this.getAllMenuItems(isAdmin);
|
|
487
|
+
for (let i = 0; i < results.length; i++)
|
|
488
|
+
results[i].id = i;
|
|
489
|
+
return this.sortLinks(results);
|
|
490
|
+
}
|
|
491
|
+
sortLinks(links) {
|
|
492
|
+
return links.map(t => { return { ...t, sublinks: this.sortLinksSubLevel(t.sublinks) }; });
|
|
493
|
+
}
|
|
494
|
+
sortLinksSubLevel(links) {
|
|
495
|
+
if (!links)
|
|
496
|
+
return null;
|
|
497
|
+
return links.sort((a, b) => a.title.localeCompare(b.title));
|
|
498
|
+
}
|
|
499
|
+
// private fillmap(map: Map<string,MenuItem>,menuItems: MenuItem[], parent: string = null )
|
|
500
|
+
// {
|
|
501
|
+
// if ( ! Utilities.IsNil(menuItems)) {
|
|
502
|
+
// menuItems.forEach(x =>{
|
|
503
|
+
// if ( ! Utilities.IsNil(parent))
|
|
504
|
+
// parent = parent.concat("/" + x.title);
|
|
505
|
+
// else
|
|
506
|
+
// parent = x.title;
|
|
507
|
+
// map.set(parent,x);
|
|
508
|
+
// this.fillmap(map,x.sublinks,parent);
|
|
509
|
+
// });
|
|
510
|
+
// }
|
|
511
|
+
// return map;
|
|
512
|
+
// }
|
|
513
|
+
// public mergeall(Menus:MenuItem[][]): MenuItem[]
|
|
514
|
+
// {
|
|
515
|
+
// let menuItem = Array<MenuItem>();
|
|
516
|
+
// let map = new Map<string,MenuItem>();
|
|
517
|
+
// Menus.forEach(menuItem => {
|
|
518
|
+
// this.fillmap(map,menuItem,null);
|
|
519
|
+
// });
|
|
520
|
+
// let sortedmap = new Map([...map].sort());
|
|
521
|
+
// sortedmap.forEach(element => {
|
|
522
|
+
// menuItem.push()
|
|
523
|
+
// });
|
|
524
|
+
// return menuItem;
|
|
525
|
+
// }
|
|
526
|
+
merge(Menus) {
|
|
527
|
+
// let titles : string[];
|
|
528
|
+
// if (!(item.title in titles)){
|
|
529
|
+
// titles.push(item.title);
|
|
530
|
+
// menu.push(item);
|
|
531
|
+
// }
|
|
532
|
+
// else{
|
|
533
|
+
let menu = [];
|
|
534
|
+
Menus.forEach(item => {
|
|
535
|
+
let index = menu.findIndex(x => x.title == item.title);
|
|
536
|
+
if (index >= 0)
|
|
537
|
+
menu[index].sublinks = [...menu[index].sublinks, ...item.sublinks];
|
|
538
|
+
else
|
|
539
|
+
menu.push(item);
|
|
540
|
+
});
|
|
541
|
+
return menu;
|
|
542
|
+
}
|
|
543
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MenuService, deps: [{ token: PermissionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
544
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MenuService }); }
|
|
545
|
+
}
|
|
546
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MenuService, decorators: [{
|
|
547
|
+
type: Injectable
|
|
548
|
+
}], ctorParameters: () => [{ type: PermissionService }] });
|
|
549
|
+
|
|
550
|
+
var AuthTokenType;
|
|
551
|
+
(function (AuthTokenType) {
|
|
552
|
+
AuthTokenType[AuthTokenType["AccessToken"] = 0] = "AccessToken";
|
|
553
|
+
AuthTokenType[AuthTokenType["RefreshToken"] = 1] = "RefreshToken";
|
|
554
|
+
})(AuthTokenType || (AuthTokenType = {}));
|
|
555
|
+
class AuthService {
|
|
556
|
+
constructor(headersService, busMsg, httpClient, router, localStorage, menuService, env) {
|
|
557
|
+
this.headersService = headersService;
|
|
558
|
+
this.busMsg = busMsg;
|
|
559
|
+
this.httpClient = httpClient;
|
|
560
|
+
this.router = router;
|
|
561
|
+
this.localStorage = localStorage;
|
|
562
|
+
this.menuService = menuService;
|
|
563
|
+
this.env = env;
|
|
564
|
+
this.baseUrl = this.env.apiUrl;
|
|
565
|
+
this.refreshTokenTimerCheckId = "is_refreshToken_timer_started";
|
|
566
|
+
this.scheduleRefreshToken(this.isLoggedIn, false);
|
|
567
|
+
}
|
|
568
|
+
// After a successful login, save token data into session storage
|
|
569
|
+
// note: use "localStorage" for persistent, browser-wide logins; "sessionStorage" for per-session storage.
|
|
570
|
+
login(username, password, rememberMe) {
|
|
571
|
+
// console.log(`login base url : ${this.baseUrl} (environment is production : ${this.env.production})`);
|
|
572
|
+
let body = JSON.stringify({ "username": username, "password": password });
|
|
573
|
+
let _url = this.baseUrl + ServerUrl.connectPath;
|
|
574
|
+
return this.httpClient.post(_url, body, { headers: this.headersService.authJsonHeaders() }).pipe(map((resp) => {
|
|
575
|
+
// login successful if there's a jwt token in the response
|
|
576
|
+
// let user = (resp as any) as IUserCredential;
|
|
577
|
+
let user = resp;
|
|
578
|
+
if (user && user.AccessToken) {
|
|
579
|
+
// store user details and jwt token in local storage to keep user logged in between page refreshes
|
|
580
|
+
this.saveUserInfos(user, JSON.stringify(user), rememberMe);
|
|
581
|
+
// publish token
|
|
582
|
+
this.busMsg.publish(new UserUpdatedMessage(user.AccessToken));
|
|
583
|
+
// schedule refresh token
|
|
584
|
+
this.scheduleRefreshToken(true, true);
|
|
585
|
+
return user;
|
|
586
|
+
}
|
|
587
|
+
}));
|
|
588
|
+
}
|
|
589
|
+
// After a successful login, save token data into session storage
|
|
590
|
+
// note: use "localStorage" for persistent, browser-wide logins; "sessionStorage" for per-session storage.
|
|
591
|
+
register(captchaToken, firstName, lastName, email, password, rememberMe) {
|
|
592
|
+
// console.log(`login base url : ${this.baseUrl} (environment is production : ${this.env.production})`);
|
|
593
|
+
let body = JSON.stringify({ "CaptchaToken": captchaToken, "FirstName": firstName, "LastName": lastName, "Email": email, "Password": password });
|
|
594
|
+
let _url = this.baseUrl + ServerUrl.registerPath;
|
|
595
|
+
return this.httpClient.post(_url, body, { headers: this.headersService.authJsonHeaders() }).pipe(map((resp) => {
|
|
596
|
+
// login successful if there's a jwt token in the response
|
|
597
|
+
let user = resp;
|
|
598
|
+
if (user && user.AccessToken) {
|
|
599
|
+
// store user details and jwt token in local storage to keep user logged in between page refreshes
|
|
600
|
+
this.saveUserInfos(user, JSON.stringify(user), rememberMe);
|
|
601
|
+
// publish token
|
|
602
|
+
this.busMsg.publish(new UserUpdatedMessage(user.AccessToken));
|
|
603
|
+
// schedule refresh token
|
|
604
|
+
this.scheduleRefreshToken(true, true);
|
|
605
|
+
return user;
|
|
606
|
+
}
|
|
607
|
+
}));
|
|
608
|
+
}
|
|
609
|
+
// Activation d'un utilisateur
|
|
610
|
+
activate(code) {
|
|
611
|
+
// console.log(`login base url : ${this.baseUrl} (environment is production : ${this.env.production})`);
|
|
612
|
+
let body = JSON.stringify({ "ActivationCode": code });
|
|
613
|
+
let _url = this.baseUrl + ServerUrl.activatePath;
|
|
614
|
+
return this.httpClient.post(_url, body, { headers: this.headersService.authJsonHeaders() }).pipe(map((resp) => {
|
|
615
|
+
return resp;
|
|
616
|
+
}));
|
|
617
|
+
}
|
|
618
|
+
saveUserInfos(user, userDetails, rememberMe) {
|
|
619
|
+
// check permissions
|
|
620
|
+
let permissions = user.Permissions || new Array();
|
|
621
|
+
// this.getPermissions(user.AccessToken) || new Array<any>();
|
|
622
|
+
if (rememberMe) {
|
|
623
|
+
this.localStorage.savePermanentData(user.AccessToken, AppKeys.ACCESS_TOKEN);
|
|
624
|
+
this.localStorage.savePermanentData(user.RefreshToken, AppKeys.REFRESH_TOKEN);
|
|
625
|
+
this.localStorage.savePermanentData(userDetails, AppKeys.CURRENT_USER);
|
|
626
|
+
this.localStorage.savePermanentData(JSON.stringify(permissions), AppKeys.PERMISSIONS);
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
this.localStorage.saveSyncedSessionData(user.AccessToken, AppKeys.ACCESS_TOKEN);
|
|
630
|
+
this.localStorage.saveSyncedSessionData(user.RefreshToken, AppKeys.REFRESH_TOKEN);
|
|
631
|
+
this.localStorage.saveSyncedSessionData(userDetails, AppKeys.CURRENT_USER);
|
|
632
|
+
this.localStorage.saveSyncedSessionData(JSON.stringify(permissions), AppKeys.PERMISSIONS);
|
|
633
|
+
}
|
|
634
|
+
if (rememberMe) {
|
|
635
|
+
this.localStorage.savePermanentData(rememberMe, AppKeys.REMEMBER_ME);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
getPermissions(token) {
|
|
639
|
+
let decodedToken = jwt_decode(token);
|
|
640
|
+
let permissions = new Array();
|
|
641
|
+
if (decodedToken.permissions) {
|
|
642
|
+
permissions = Array.isArray(decodedToken.permissions) ? decodedToken.permissions : [decodedToken.permissions];
|
|
643
|
+
}
|
|
644
|
+
return permissions;
|
|
645
|
+
}
|
|
646
|
+
removeUserInfos() {
|
|
647
|
+
this.localStorage.deleteData(AppKeys.ACCESS_TOKEN);
|
|
648
|
+
this.localStorage.deleteData(AppKeys.REFRESH_TOKEN);
|
|
649
|
+
this.localStorage.deleteData(AppKeys.CURRENT_USER);
|
|
650
|
+
this.loginRedirectUrl = '/';
|
|
651
|
+
}
|
|
652
|
+
// called when logging out user; clears tokens from browser
|
|
653
|
+
logout(pseudo) {
|
|
654
|
+
this.disconnect(pseudo);
|
|
655
|
+
}
|
|
656
|
+
disconnect(pseudo) {
|
|
657
|
+
const headers = new HttpHeaders({ "Content-Type": "application/json" });
|
|
658
|
+
const model = { refreshToken: this.refreshToken };
|
|
659
|
+
return this.httpClient
|
|
660
|
+
.post(`${this.baseUrl}${ServerUrl.disconnectPath}`, model, { headers: headers })
|
|
661
|
+
.pipe(map(response => response || {}), finalize(() => {
|
|
662
|
+
this.ensureLogout();
|
|
663
|
+
// navigate to home page
|
|
664
|
+
this.router.navigate(['/']);
|
|
665
|
+
})).subscribe(result => {
|
|
666
|
+
console.log("logout", result);
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
ensureLogout() {
|
|
670
|
+
this.menuService.resetPermissionMap();
|
|
671
|
+
this.busMsg.publish(new UserUpdatedMessage(null));
|
|
672
|
+
this.removeUserInfos();
|
|
673
|
+
this.unscheduleRefreshToken(true);
|
|
674
|
+
}
|
|
675
|
+
redirectLoginUser() {
|
|
676
|
+
let redirect = this.loginRedirectUrl && this.loginRedirectUrl !== '/' ? this.loginRedirectUrl : '/';
|
|
677
|
+
this.loginRedirectUrl = null;
|
|
678
|
+
let urlParamsAndFragment = Utilities.splitInTwo(redirect, '#');
|
|
679
|
+
let urlAndParams = Utilities.splitInTwo(urlParamsAndFragment.firstPart, '?');
|
|
680
|
+
let navigationExtras = {
|
|
681
|
+
fragment: urlParamsAndFragment.secondPart,
|
|
682
|
+
queryParams: Utilities.getQueryParamsFromString(urlAndParams.secondPart),
|
|
683
|
+
queryParamsHandling: "merge"
|
|
684
|
+
};
|
|
685
|
+
this.router.navigate([urlAndParams.firstPart], navigationExtras);
|
|
686
|
+
}
|
|
687
|
+
invalidateCurrentTabId() {
|
|
688
|
+
if (!this.rememberMe) {
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
const currentTabId = this.getCurrentTabId();
|
|
692
|
+
if (this.timerStat && this.timerStat.tabId === currentTabId) {
|
|
693
|
+
this.setRefreshTokenTimerStopped();
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
scheduleRefreshToken(isAuthUserLoggedIn, calledFromLogin) {
|
|
697
|
+
this.unscheduleRefreshToken(false);
|
|
698
|
+
if (!this.isLoggedIn) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const expDateUtc = this.getAccessTokenExpirationDateUtc();
|
|
702
|
+
if (!expDateUtc) {
|
|
703
|
+
throw new Error("This access token has not the `exp` property.");
|
|
704
|
+
}
|
|
705
|
+
const expiresAtUtc = expDateUtc.valueOf();
|
|
706
|
+
const nowUtc = new Date().valueOf();
|
|
707
|
+
// 3s pour empêcher les timers des autres onglets de tourner moins de 3s
|
|
708
|
+
const initialDelay = Math.max(1, expiresAtUtc - nowUtc - 3000);
|
|
709
|
+
const timerSource$ = timer(initialDelay);
|
|
710
|
+
this.refreshTokenSubscription = timerSource$.subscribe(() => {
|
|
711
|
+
if (calledFromLogin || !this.isRefreshTokenTimerStartedInAnotherTab()) {
|
|
712
|
+
this.updateToken();
|
|
713
|
+
}
|
|
714
|
+
else {
|
|
715
|
+
this.scheduleRefreshToken(isAuthUserLoggedIn, false);
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
if (calledFromLogin || !this.isRefreshTokenTimerStartedInAnotherTab()) {
|
|
719
|
+
this.setRefreshTokenTimerStarted();
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
setRefreshTokenTimerStopped() {
|
|
723
|
+
this.localStorage.savePermanentData(JSON.stringify({
|
|
724
|
+
isStarted: false,
|
|
725
|
+
tabId: -1
|
|
726
|
+
}), this.refreshTokenTimerCheckId);
|
|
727
|
+
}
|
|
728
|
+
setRefreshTokenTimerStarted() {
|
|
729
|
+
this.localStorage.savePermanentData(JSON.stringify({
|
|
730
|
+
isStarted: true,
|
|
731
|
+
tabId: this.getCurrentTabId()
|
|
732
|
+
}), this.refreshTokenTimerCheckId);
|
|
733
|
+
}
|
|
734
|
+
deleteRefreshTokenTimerCheckId() {
|
|
735
|
+
this.localStorage.deleteData(this.refreshTokenTimerCheckId);
|
|
736
|
+
}
|
|
737
|
+
isRefreshTokenTimerStartedInAnotherTab() {
|
|
738
|
+
if (!this.rememberMe) {
|
|
739
|
+
return false; // Chaque onglet gère son token (infos stockés dans le local storage)
|
|
740
|
+
}
|
|
741
|
+
const currentTabId = this.getCurrentTabId();
|
|
742
|
+
// console.log("RefreshTokenTimer Check", {
|
|
743
|
+
// refreshTokenTimerCheckId: this.timerStat,
|
|
744
|
+
// currentTabId: currentTabId
|
|
745
|
+
// });
|
|
746
|
+
const isStarted = this.timerStat && this.timerStat.isStarted === true && this.timerStat.tabId !== currentTabId;
|
|
747
|
+
// if (isStarted) {
|
|
748
|
+
// console.log(`RefreshToken timer has already been started in another tab with tabId=${this.timerStat.tabId}.
|
|
749
|
+
// currentTabId=${currentTabId}.`);
|
|
750
|
+
// }
|
|
751
|
+
return isStarted;
|
|
752
|
+
}
|
|
753
|
+
getCurrentTabId() {
|
|
754
|
+
const tabIdToken = "currentTabId";
|
|
755
|
+
let tabId = this.localStorage.getData(tabIdToken);
|
|
756
|
+
if (tabId) {
|
|
757
|
+
return tabId;
|
|
758
|
+
}
|
|
759
|
+
tabId = Math.random();
|
|
760
|
+
this.localStorage.saveSyncedSessionData(tabId, tabIdToken);
|
|
761
|
+
return tabId;
|
|
762
|
+
}
|
|
763
|
+
getAccessTokenExpirationDateUtc() {
|
|
764
|
+
const decoded = this.getDecodedAccessToken();
|
|
765
|
+
if (decoded.exp === undefined) {
|
|
766
|
+
return null;
|
|
767
|
+
}
|
|
768
|
+
const date = new Date(0);
|
|
769
|
+
date.setUTCSeconds(decoded.exp);
|
|
770
|
+
// console.log(`Token Expires at ${date}`);
|
|
771
|
+
return date;
|
|
772
|
+
}
|
|
773
|
+
isAccessTokenTokenExpired() {
|
|
774
|
+
const expirationDateUtc = this.getAccessTokenExpirationDateUtc();
|
|
775
|
+
if (!expirationDateUtc) {
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
return !(expirationDateUtc.valueOf() > new Date().valueOf());
|
|
779
|
+
}
|
|
780
|
+
getDecodedAccessToken() {
|
|
781
|
+
return jwt_decode(this.token);
|
|
782
|
+
}
|
|
783
|
+
isEmptyString(value) {
|
|
784
|
+
return !value || 0 === value.length;
|
|
785
|
+
}
|
|
786
|
+
unscheduleRefreshToken(cancelTimerCheckToken) {
|
|
787
|
+
if (this.refreshTokenSubscription) {
|
|
788
|
+
this.refreshTokenSubscription.unsubscribe();
|
|
789
|
+
}
|
|
790
|
+
if (cancelTimerCheckToken) {
|
|
791
|
+
this.deleteRefreshTokenTimerCheckId();
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
updateToken() {
|
|
795
|
+
console.log(`Entering updateToken()`);
|
|
796
|
+
const headers = new HttpHeaders({ "Content-Type": "application/json" });
|
|
797
|
+
const model = { refreshToken: this.refreshToken };
|
|
798
|
+
return this.httpClient
|
|
799
|
+
.post(`${this.baseUrl}${ServerUrl.refreshPath}`, model, { headers: headers })
|
|
800
|
+
.pipe(map(response => response || {}), catchError((error) => throwError(() => new Error(error.error))))
|
|
801
|
+
.subscribe(resp => {
|
|
802
|
+
// login successful if there's a jwt token in the response
|
|
803
|
+
let user = resp;
|
|
804
|
+
if (user && user.AccessToken) {
|
|
805
|
+
// store user details and jwt token in local storage to keep user logged in between page refreshes
|
|
806
|
+
this.saveUserInfos(user, JSON.stringify(user), this.rememberMe);
|
|
807
|
+
// publish token
|
|
808
|
+
this.busMsg.publish(new UserUpdatedMessage(user.AccessToken));
|
|
809
|
+
this.scheduleRefreshToken(this.isLoggedIn, false);
|
|
810
|
+
return user;
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
hasPermission(permission) {
|
|
815
|
+
return this.permissions != null && this.permissions.some(p => p === permission) || this.isAdmin;
|
|
816
|
+
}
|
|
817
|
+
//#region Fields
|
|
818
|
+
get timerStat() {
|
|
819
|
+
const timerStat_key = this.localStorage.getDataObject(this.refreshTokenTimerCheckId);
|
|
820
|
+
const timerStat = JSON.parse(timerStat_key);
|
|
821
|
+
return timerStat;
|
|
822
|
+
}
|
|
823
|
+
get isLoggedIn() {
|
|
824
|
+
const accessToken = this.token;
|
|
825
|
+
const refreshToken = this.refreshToken;
|
|
826
|
+
const hasTokens = !this.isEmptyString(accessToken) && !this.isEmptyString(refreshToken);
|
|
827
|
+
return hasTokens && !this.isAccessTokenTokenExpired();
|
|
828
|
+
}
|
|
829
|
+
get isAdmin() {
|
|
830
|
+
let parsed = JSON.parse(this.currentUser);
|
|
831
|
+
if (Utilities.IsNil(parsed))
|
|
832
|
+
return false;
|
|
833
|
+
return parsed.IsAdmin || false;
|
|
834
|
+
}
|
|
835
|
+
get pseudo() {
|
|
836
|
+
let parsed = JSON.parse(this.currentUser);
|
|
837
|
+
return parsed.Username || '';
|
|
838
|
+
}
|
|
839
|
+
get userId() {
|
|
840
|
+
let parsed = JSON.parse(this.currentUser);
|
|
841
|
+
return parsed.Id || 0;
|
|
842
|
+
}
|
|
843
|
+
get currentUser() {
|
|
844
|
+
return this.localStorage.getDataObject(AppKeys.CURRENT_USER);
|
|
845
|
+
}
|
|
846
|
+
get rememberMe() {
|
|
847
|
+
return this.localStorage.getDataObject(AppKeys.REMEMBER_ME) === true;
|
|
848
|
+
}
|
|
849
|
+
get token() {
|
|
850
|
+
return this.localStorage.getDataObject(AppKeys.ACCESS_TOKEN);
|
|
851
|
+
}
|
|
852
|
+
get refreshToken() {
|
|
853
|
+
return this.localStorage.getDataObject(AppKeys.REFRESH_TOKEN);
|
|
854
|
+
}
|
|
855
|
+
get permissions() {
|
|
856
|
+
let permissions = this.localStorage.getDataObject(AppKeys.PERMISSIONS);
|
|
857
|
+
let parsed_permissions = JSON.parse(permissions);
|
|
858
|
+
return parsed_permissions;
|
|
859
|
+
}
|
|
860
|
+
get companyId() {
|
|
861
|
+
const decoded = this.getDecodedAccessToken();
|
|
862
|
+
if (Utilities.IsNil(decoded[AppKeys.USER_COMPANY_ID])) {
|
|
863
|
+
return null;
|
|
864
|
+
}
|
|
865
|
+
return decoded[AppKeys.USER_COMPANY_ID];
|
|
866
|
+
}
|
|
867
|
+
get referenceSupplierId() {
|
|
868
|
+
const decoded = this.getDecodedAccessToken();
|
|
869
|
+
if (Utilities.IsNil(decoded[AppKeys.REFERENCE_SUPPLIER_ID])) {
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
return decoded[AppKeys.REFERENCE_SUPPLIER_ID];
|
|
873
|
+
}
|
|
874
|
+
//#endregion
|
|
875
|
+
navigateToHome() {
|
|
876
|
+
this.router.navigate(['/']);
|
|
877
|
+
}
|
|
878
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthService, deps: [{ token: HeadersService }, { token: BusMessageService }, { token: i3.HttpClient }, { token: i1.Router }, { token: LocalStoreManager }, { token: MenuService }, { token: i7.EnvironmentBase }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
879
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthService }); }
|
|
880
|
+
}
|
|
881
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthService, decorators: [{
|
|
882
|
+
type: Injectable
|
|
883
|
+
}], ctorParameters: () => [{ type: HeadersService }, { type: BusMessageService }, { type: i3.HttpClient }, { type: i1.Router }, { type: LocalStoreManager }, { type: MenuService }, { type: i7.EnvironmentBase }] });
|
|
884
|
+
|
|
885
|
+
class AuthGuard {
|
|
886
|
+
constructor(authService, menuService, router) {
|
|
887
|
+
this.authService = authService;
|
|
888
|
+
this.menuService = menuService;
|
|
889
|
+
this.router = router;
|
|
890
|
+
}
|
|
891
|
+
canActivate(route, state) {
|
|
892
|
+
let url = state.url;
|
|
893
|
+
return this.checkLogin(url);
|
|
894
|
+
}
|
|
895
|
+
canActivateChild(route, state) {
|
|
896
|
+
return this.canActivate(route, state);
|
|
897
|
+
}
|
|
898
|
+
canLoad(route) {
|
|
899
|
+
let url = `/${route.path}`;
|
|
900
|
+
return this.checkLogin(url);
|
|
901
|
+
}
|
|
902
|
+
checkLogin(url) {
|
|
903
|
+
if (this.authService.isLoggedIn) {
|
|
904
|
+
if (url === '/accessDenied' || this.authService.isAdmin) {
|
|
905
|
+
return true;
|
|
906
|
+
}
|
|
907
|
+
return this.hasAuthUserAccessToThisRoute(url);
|
|
908
|
+
}
|
|
909
|
+
this.menuService.resetPermissionMap();
|
|
910
|
+
this.authService.loginRedirectUrl = url;
|
|
911
|
+
this.router.navigate(['/login']);
|
|
912
|
+
return false;
|
|
913
|
+
}
|
|
914
|
+
hasAuthUserAccessToThisRoute(returnUrl) {
|
|
915
|
+
if (!this.menuService.hasAccessToThisRoute(Utilities.splitInTwo(returnUrl, '?').firstPart)) {
|
|
916
|
+
this.showAccessDenied(returnUrl);
|
|
917
|
+
return false;
|
|
918
|
+
}
|
|
919
|
+
return true;
|
|
920
|
+
}
|
|
921
|
+
showAccessDenied(returnUrl) {
|
|
922
|
+
this.router.navigate(['/accessDenied']);
|
|
923
|
+
}
|
|
924
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthGuard, deps: [{ token: AuthService }, { token: MenuService }, { token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
925
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthGuard }); }
|
|
926
|
+
}
|
|
927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthGuard, decorators: [{
|
|
928
|
+
type: Injectable
|
|
929
|
+
}], ctorParameters: () => [{ type: AuthService }, { type: MenuService }, { type: i1.Router }] });
|
|
930
|
+
|
|
931
|
+
class BreadcrumbService {
|
|
932
|
+
constructor(title) {
|
|
933
|
+
this.title = title;
|
|
934
|
+
this.initialData = {
|
|
935
|
+
description: '',
|
|
936
|
+
display: false,
|
|
937
|
+
header: '',
|
|
938
|
+
levels: [
|
|
939
|
+
{
|
|
940
|
+
icon: 'clock-o',
|
|
941
|
+
link: ['/'],
|
|
942
|
+
title: 'Default'
|
|
943
|
+
}
|
|
944
|
+
]
|
|
945
|
+
};
|
|
946
|
+
this.current = new ReplaySubject(1);
|
|
947
|
+
this.clear();
|
|
948
|
+
}
|
|
949
|
+
setCurrent(data) {
|
|
950
|
+
if (data.description !== undefined && data.description !== '') {
|
|
951
|
+
this.title.setTitle('Marsow - ' + data.levels[data.levels.length - 1].title);
|
|
952
|
+
}
|
|
953
|
+
else
|
|
954
|
+
this.title.setTitle('Marsow');
|
|
955
|
+
this.current.next(data);
|
|
956
|
+
}
|
|
957
|
+
getCurrent() {
|
|
958
|
+
return this.current;
|
|
959
|
+
}
|
|
960
|
+
clear() {
|
|
961
|
+
this.setCurrent(this.initialData);
|
|
962
|
+
}
|
|
963
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BreadcrumbService, deps: [{ token: i1$1.Title }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
964
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BreadcrumbService }); }
|
|
965
|
+
}
|
|
966
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BreadcrumbService, decorators: [{
|
|
967
|
+
type: Injectable
|
|
968
|
+
}], ctorParameters: () => [{ type: i1$1.Title }] });
|
|
969
|
+
|
|
970
|
+
class FilterService {
|
|
971
|
+
get DisplayFilter() { return this.displayFilter; }
|
|
972
|
+
get Keywords() { return this.keywords; }
|
|
973
|
+
set Keywords(value) { this.keywords = value; }
|
|
974
|
+
constructor() {
|
|
975
|
+
this.displayFilterChangedSubject = new BehaviorSubject(false);
|
|
976
|
+
this.filterChanged$ = this.displayFilterChangedSubject.asObservable();
|
|
977
|
+
this.displayFilter = true;
|
|
978
|
+
this.keywords = '';
|
|
979
|
+
}
|
|
980
|
+
setFilterDisplay(value) {
|
|
981
|
+
if (this.displayFilter != value) {
|
|
982
|
+
this.displayFilter = value;
|
|
983
|
+
// Déclenchement de l'évènement de changement d'affichage du filtre
|
|
984
|
+
this.displayFilterChangedSubject.next(this.displayFilter);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
toggleFilterDisplay() {
|
|
988
|
+
this.displayFilter = !this.displayFilter;
|
|
989
|
+
// Déclenchement de l'évènement de changement d'affichage du filtre
|
|
990
|
+
this.displayFilterChangedSubject.next(this.displayFilter);
|
|
991
|
+
}
|
|
992
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
993
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FilterService }); }
|
|
994
|
+
}
|
|
995
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FilterService, decorators: [{
|
|
996
|
+
type: Injectable
|
|
997
|
+
}], ctorParameters: () => [] });
|
|
998
|
+
|
|
999
|
+
class GeolocationService {
|
|
1000
|
+
constructor(localStore) {
|
|
1001
|
+
this.localStore = localStore;
|
|
1002
|
+
this.positionsHistory = new Array(0);
|
|
1003
|
+
this.positionChanged = new EventEmitter();
|
|
1004
|
+
try {
|
|
1005
|
+
let saveLocations = localStore.getDataObject(AppKeys.LAST_GEOLOCATIONS, false);
|
|
1006
|
+
if (!Utilities.IsNil(saveLocations))
|
|
1007
|
+
this.positionsHistory = saveLocations;
|
|
1008
|
+
}
|
|
1009
|
+
catch { }
|
|
1010
|
+
}
|
|
1011
|
+
getCurrentPosition() {
|
|
1012
|
+
// Retourne la dernière valeur de l'historique
|
|
1013
|
+
if (!Utilities.IsNil(this.positionsHistory) && this.positionsHistory.length > 0)
|
|
1014
|
+
return this.positionsHistory[0];
|
|
1015
|
+
}
|
|
1016
|
+
setCurrentPosition(formattedName, placeId, latitude, longitude) {
|
|
1017
|
+
// Création d'un objet de type NamedPosition
|
|
1018
|
+
let currentPosition = {
|
|
1019
|
+
placeId: placeId,
|
|
1020
|
+
formattedName: formattedName,
|
|
1021
|
+
latitude: latitude,
|
|
1022
|
+
longitude: longitude
|
|
1023
|
+
};
|
|
1024
|
+
// Insertion de la dernière position dans l'historique (on ne garde que les 5 dernières positions)
|
|
1025
|
+
this.positionsHistory.unshift(currentPosition);
|
|
1026
|
+
if (this.positionsHistory.length > 5)
|
|
1027
|
+
this.positionsHistory.pop();
|
|
1028
|
+
// Sauvegarde dans le localStorage
|
|
1029
|
+
this.localStore.savePermanentData(this.positionsHistory, AppKeys.LAST_GEOLOCATIONS);
|
|
1030
|
+
// Déclenchement de l'évènement de changemetn de position courante.
|
|
1031
|
+
this.positionChanged.emit(currentPosition);
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Calcule la distance en mètres entre la position courante et le point dont les coordonnées GPS sont spécifiées en paramètre.
|
|
1035
|
+
* @param latitude Latitude du point
|
|
1036
|
+
* @param longitude Longitude du point
|
|
1037
|
+
* @returns La distance en mètres entre la position courante et le point dont les coordonnées GPS sont spécifiées en paramètre.
|
|
1038
|
+
*/
|
|
1039
|
+
getDistanceToCurrent(latitude, longitude) {
|
|
1040
|
+
// Distance entre les coordonnées spécifiées et la position courante.
|
|
1041
|
+
let position = this.getCurrentPosition();
|
|
1042
|
+
if (Utilities.IsNil(position))
|
|
1043
|
+
return undefined;
|
|
1044
|
+
return this.getDistance(position.latitude, position.longitude, latitude, longitude);
|
|
1045
|
+
}
|
|
1046
|
+
/** Calcule la distance en mètres entre 2 points en coordonnées GPS.
|
|
1047
|
+
* @param latitude1 Latitude du point 1
|
|
1048
|
+
* @param longitude1 Longitude du point 1
|
|
1049
|
+
* @param latitude2 Latitude du point 2
|
|
1050
|
+
* @param longitude2 Longitude du point 2
|
|
1051
|
+
* @returns Une estimation la distance en mètres entre les point GPS 1 et 2 dont les coordonnées sont spécifiées.
|
|
1052
|
+
*/
|
|
1053
|
+
getDistance(latitude1, longitude1, latitude2, longitude2) {
|
|
1054
|
+
// Connaissant la position de deux points A et B sur une sphère, calculer la distance entre eux
|
|
1055
|
+
// revient à calculer l'abscisse curviligne S (AB) sur le grand cercle passant par A et B.
|
|
1056
|
+
// Si l’on considère deux points A et B sur la sphère, de latitudes ϕA et ϕB et de longitudes λA et λB,
|
|
1057
|
+
// alors la distance angulaire en radians SA-B entre A et B est donnée par la relation fondamentale de trigonométrie
|
|
1058
|
+
// sphérique, utilisant dλ = λB – λA :
|
|
1059
|
+
// SA-B = arc cos (sin ϕA sin ϕB + cos ϕA cos ϕB cos dλ)
|
|
1060
|
+
// La distance S en mètres, s’obtient en multipliant SA-B par un rayon de la Terre conventionnel (6 378 137 mètres par exemple).
|
|
1061
|
+
// Conversion en radian
|
|
1062
|
+
let a = latitude1 * Math.PI / 180;
|
|
1063
|
+
let b = longitude1 * Math.PI / 180;
|
|
1064
|
+
let c = latitude2 * Math.PI / 180;
|
|
1065
|
+
let d = longitude2 * Math.PI / 180;
|
|
1066
|
+
// Calcul de la distance en m
|
|
1067
|
+
let e = Math.sin(a) * Math.sin(c) + Math.cos(a) * Math.cos(c) * Math.cos(d - b);
|
|
1068
|
+
let result = 6378137 * Math.acos(e);
|
|
1069
|
+
return result;
|
|
1070
|
+
}
|
|
1071
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GeolocationService, deps: [{ token: LocalStoreManager }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1072
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GeolocationService }); }
|
|
1073
|
+
}
|
|
1074
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GeolocationService, decorators: [{
|
|
1075
|
+
type: Injectable
|
|
1076
|
+
}], ctorParameters: () => [{ type: LocalStoreManager }] });
|
|
1077
|
+
|
|
1078
|
+
class NotificationsService {
|
|
1079
|
+
// public markThreadAsRead: Subject<any> = new Subject<any>();
|
|
1080
|
+
constructor() {
|
|
1081
|
+
this.notificationsList = [];
|
|
1082
|
+
// a stream that publishes new notifications only once
|
|
1083
|
+
this.newNotifications = new Subject();
|
|
1084
|
+
// `notifications` is a stream that emits an array of the most up to date notifications
|
|
1085
|
+
this.notifications = new ReplaySubject(1);
|
|
1086
|
+
// `updates` receives _operations_ to be applied to our `notifications`
|
|
1087
|
+
// it's a way we can perform changes on *all* notifications (that are currently
|
|
1088
|
+
// stored in `notifications`)
|
|
1089
|
+
this.updates = new Subject();
|
|
1090
|
+
// action streams
|
|
1091
|
+
this.create = new Subject();
|
|
1092
|
+
// recois des operation, et les fais sur la liste interne, puis diffuse le resultat sur notifications
|
|
1093
|
+
this.updates.subscribe((ope) => {
|
|
1094
|
+
this.notificationsList = ope(this.notificationsList);
|
|
1095
|
+
this.notifications.next(this.notificationsList);
|
|
1096
|
+
});
|
|
1097
|
+
this.newNotifications.pipe(map(function (notification) {
|
|
1098
|
+
return (notifications) => {
|
|
1099
|
+
return notifications.concat(notification);
|
|
1100
|
+
};
|
|
1101
|
+
}))
|
|
1102
|
+
.subscribe(this.updates);
|
|
1103
|
+
}
|
|
1104
|
+
// an imperative function call to this action stream
|
|
1105
|
+
addNotification(notification) {
|
|
1106
|
+
this.newNotifications.next(notification);
|
|
1107
|
+
}
|
|
1108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NotificationsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1109
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NotificationsService }); }
|
|
1110
|
+
}
|
|
1111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: NotificationsService, decorators: [{
|
|
1112
|
+
type: Injectable
|
|
1113
|
+
}], ctorParameters: () => [] });
|
|
1114
|
+
|
|
1115
|
+
var RequestState;
|
|
1116
|
+
(function (RequestState) {
|
|
1117
|
+
RequestState[RequestState["Pending"] = 0] = "Pending";
|
|
1118
|
+
RequestState[RequestState["InProgress"] = 1] = "InProgress";
|
|
1119
|
+
RequestState[RequestState["Success"] = 2] = "Success";
|
|
1120
|
+
RequestState[RequestState["Error"] = 3] = "Error";
|
|
1121
|
+
RequestState[RequestState["Warning"] = 4] = "Warning";
|
|
1122
|
+
})(RequestState || (RequestState = {}));
|
|
1123
|
+
/*
|
|
1124
|
+
signalR Hub Service.
|
|
1125
|
+
Currently chimera class, both registering to a the marsowHub and registering handlers.
|
|
1126
|
+
TODO Extract handlers elsewhere.
|
|
1127
|
+
*/
|
|
1128
|
+
class HubService {
|
|
1129
|
+
get hubOptions() {
|
|
1130
|
+
let _self = this;
|
|
1131
|
+
var options = {
|
|
1132
|
+
skipNegotiation: true,
|
|
1133
|
+
transport: signalR.HttpTransportType.WebSockets,
|
|
1134
|
+
accessTokenFactory: () => {
|
|
1135
|
+
const token = _self.localStorage.getDataObject(AppKeys.ACCESS_TOKEN);
|
|
1136
|
+
return token;
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
return options;
|
|
1140
|
+
}
|
|
1141
|
+
constructor(localStorage, notificationService, busMsg, mqMsg, authService, env) {
|
|
1142
|
+
this.localStorage = localStorage;
|
|
1143
|
+
this.notificationService = notificationService;
|
|
1144
|
+
this.busMsg = busMsg;
|
|
1145
|
+
this.mqMsg = mqMsg;
|
|
1146
|
+
this.authService = authService;
|
|
1147
|
+
this.env = env;
|
|
1148
|
+
this.hubUrl = this.env.hubUrl;
|
|
1149
|
+
this.hubConnection = null;
|
|
1150
|
+
this.isConnected = false;
|
|
1151
|
+
this.isReconnect = false;
|
|
1152
|
+
this.busMsg.of(UserUpdatedMessage).subscribe(msg => {
|
|
1153
|
+
// log out
|
|
1154
|
+
if (msg.userKey === null) {
|
|
1155
|
+
this.disposeConnection();
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
this.startHub();
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
//TODO REFACTO
|
|
1163
|
+
init() {
|
|
1164
|
+
if (!this.isInit) {
|
|
1165
|
+
this.startHub();
|
|
1166
|
+
this.isInit = true;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
disposeConnection() {
|
|
1170
|
+
if (this.hubConnection) {
|
|
1171
|
+
this.hubConnection.stop();
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
startHub() {
|
|
1175
|
+
// Si la connnexion est déjà active ou qu'un utilisateur n'est pas connecté on ne fait rien.
|
|
1176
|
+
if (this.isConnected || !this.authService.isLoggedIn || this.isConnecting)
|
|
1177
|
+
return;
|
|
1178
|
+
this.isConnecting = true;
|
|
1179
|
+
var options = this.hubOptions;
|
|
1180
|
+
;
|
|
1181
|
+
this.hubConnection = new signalR.HubConnectionBuilder()
|
|
1182
|
+
.withUrl(this.hubUrl, options)
|
|
1183
|
+
.configureLogging(signalR.LogLevel.Trace)
|
|
1184
|
+
.build();
|
|
1185
|
+
this.hubConnection.serverTimeoutInMilliseconds = 30000;
|
|
1186
|
+
this.configure();
|
|
1187
|
+
this.hubConnection
|
|
1188
|
+
.start()
|
|
1189
|
+
.then(() => {
|
|
1190
|
+
console.log('*****Connection started!');
|
|
1191
|
+
this.isConnected = true;
|
|
1192
|
+
this.isConnecting = false;
|
|
1193
|
+
clearInterval(this.timer$);
|
|
1194
|
+
})
|
|
1195
|
+
.catch(err => {
|
|
1196
|
+
console.log('Error while establishing connection :(', err);
|
|
1197
|
+
this.isConnected = false;
|
|
1198
|
+
this.isConnecting = false;
|
|
1199
|
+
clearInterval(this.timer$);
|
|
1200
|
+
this.scheduleStartingHub();
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
configure() {
|
|
1204
|
+
// subscribe to operation log from server
|
|
1205
|
+
this.hubConnection.on('OperationLog', (uid, message) => {
|
|
1206
|
+
this.publishEvents(new Notification({ id: undefined, content: message, class: undefined, entityType: uid, entityId: undefined }));
|
|
1207
|
+
});
|
|
1208
|
+
// subscribe to broadcasted messagse from server
|
|
1209
|
+
this.hubConnection.on('BroadcastMessage', (name, message) => {
|
|
1210
|
+
// console.log(`BroadcastMessage received : ${message}, ${name}`);
|
|
1211
|
+
});
|
|
1212
|
+
//Subscriptions have to be prior the connection start so the server hub knows which 'events' this client is eligible for.
|
|
1213
|
+
this.hubConnection.on("ReportProgress", (name, message, state, entityType, entityId) => {
|
|
1214
|
+
// console.log(`ReportProgress: name: ${name} | message: ${message} | state: ${state} | entityType: ${entityType} | entityId: ${entityId} `);
|
|
1215
|
+
//let end = state === RequestState.Success || state === RequestState.Error || state === RequestState.Warning ;
|
|
1216
|
+
let classNotif = "info";
|
|
1217
|
+
//if (end) {
|
|
1218
|
+
const notif = new Notification({ id: name, content: message, class: classNotif, entityType: entityType, entityId: entityId });
|
|
1219
|
+
this.publishEvents(notif);
|
|
1220
|
+
//}
|
|
1221
|
+
});
|
|
1222
|
+
//Registers a handler that will be invoked when the connection is closed.
|
|
1223
|
+
this.hubConnection.onclose(e => {
|
|
1224
|
+
console.log(`Hub connection closed !`);
|
|
1225
|
+
this.isConnected = false;
|
|
1226
|
+
this.scheduleStartingHub();
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
scheduleStartingHub() {
|
|
1230
|
+
// chaque 30s
|
|
1231
|
+
this.timer$ = setInterval(() => {
|
|
1232
|
+
console.log("retry start hub");
|
|
1233
|
+
this.startHub();
|
|
1234
|
+
}, 30000);
|
|
1235
|
+
}
|
|
1236
|
+
publishEvents(notif) {
|
|
1237
|
+
this.mqMsg.publish(notif);
|
|
1238
|
+
}
|
|
1239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HubService, deps: [{ token: LocalStoreManager }, { token: NotificationsService }, { token: BusMessageService }, { token: NotificationMqService }, { token: AuthService }, { token: i7.EnvironmentBase }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1240
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HubService }); }
|
|
1241
|
+
}
|
|
1242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HubService, decorators: [{
|
|
1243
|
+
type: Injectable
|
|
1244
|
+
}], ctorParameters: () => [{ type: LocalStoreManager }, { type: NotificationsService }, { type: BusMessageService }, { type: NotificationMqService }, { type: AuthService }, { type: i7.EnvironmentBase }] });
|
|
1245
|
+
|
|
1246
|
+
class MessagesService {
|
|
1247
|
+
// public markThreadAsRead: Subject<any> = new Subject<any>();
|
|
1248
|
+
constructor() {
|
|
1249
|
+
this.messagesList = [];
|
|
1250
|
+
// a stream that publishes new messages only once
|
|
1251
|
+
this.newMessages = new Subject();
|
|
1252
|
+
// `messages` is a stream that emits an array of the most up to date messages
|
|
1253
|
+
this.messages = new ReplaySubject(1);
|
|
1254
|
+
// `updates` receives _operations_ to be applied to our `messages`
|
|
1255
|
+
// it's a way we can perform changes on *all* messages (that are currently
|
|
1256
|
+
// stored in `messages`)
|
|
1257
|
+
this.updates = new Subject();
|
|
1258
|
+
// action streams
|
|
1259
|
+
this.create = new Subject();
|
|
1260
|
+
// recois des operation, et les fais sur la liste interne, puis diffuse le resultat sur messages
|
|
1261
|
+
this.updates.subscribe((ope) => {
|
|
1262
|
+
this.messagesList = ope(this.messagesList);
|
|
1263
|
+
this.messages.next(this.messagesList);
|
|
1264
|
+
});
|
|
1265
|
+
this.newMessages.pipe(map(function (message) {
|
|
1266
|
+
return (messages) => {
|
|
1267
|
+
return messages.concat(message);
|
|
1268
|
+
};
|
|
1269
|
+
}))
|
|
1270
|
+
.subscribe(this.updates);
|
|
1271
|
+
}
|
|
1272
|
+
// an imperative function call to this action stream
|
|
1273
|
+
addMessage(message) {
|
|
1274
|
+
this.newMessages.next(message);
|
|
1275
|
+
}
|
|
1276
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MessagesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1277
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MessagesService }); }
|
|
1278
|
+
}
|
|
1279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: MessagesService, decorators: [{
|
|
1280
|
+
type: Injectable
|
|
1281
|
+
}], ctorParameters: () => [] });
|
|
1282
|
+
|
|
1283
|
+
class ScreenService {
|
|
1284
|
+
constructor() {
|
|
1285
|
+
this.screenChanged = new EventEmitter();
|
|
1286
|
+
this.scrollChanged = new EventEmitter();
|
|
1287
|
+
}
|
|
1288
|
+
getScreenConfiguration() {
|
|
1289
|
+
return this.config;
|
|
1290
|
+
}
|
|
1291
|
+
setScreenConfiguration(value) {
|
|
1292
|
+
// Si la valeur passée est vide, on ne fait rien.
|
|
1293
|
+
if (Utilities.IsNil(value))
|
|
1294
|
+
return;
|
|
1295
|
+
// Sinon, on vérifie qu'une des valeurs de configuration a changé
|
|
1296
|
+
if (Utilities.IsNil(this.config)
|
|
1297
|
+
|| this.config.isExtraSmallScreen != value.isExtraSmallScreen
|
|
1298
|
+
|| this.config.isSmallScreen != value.isSmallScreen
|
|
1299
|
+
|| this.config.isLargeScreen != value.isLargeScreen) {
|
|
1300
|
+
this.config = value;
|
|
1301
|
+
// Déclenchement de l'évènement de changemetn de position courante.
|
|
1302
|
+
this.screenChanged.emit(this.config);
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
scroll(elt) {
|
|
1306
|
+
// Déclenchement de l'évènement de scrolling
|
|
1307
|
+
this.scrollChanged.emit(elt);
|
|
1308
|
+
}
|
|
1309
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ScreenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1310
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ScreenService }); }
|
|
1311
|
+
}
|
|
1312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ScreenService, decorators: [{
|
|
1313
|
+
type: Injectable
|
|
1314
|
+
}], ctorParameters: () => [] });
|
|
1315
|
+
|
|
1316
|
+
class UserService {
|
|
1317
|
+
constructor(router, authService) {
|
|
1318
|
+
this.router = router;
|
|
1319
|
+
this.authService = authService;
|
|
1320
|
+
this.userChanged = new EventEmitter();
|
|
1321
|
+
this.current = new ReplaySubject(1);
|
|
1322
|
+
this.editUser = new ReplaySubject(1);
|
|
1323
|
+
}
|
|
1324
|
+
setCurrent(user) {
|
|
1325
|
+
this.current.next(user);
|
|
1326
|
+
this.userChanged.emit(user);
|
|
1327
|
+
}
|
|
1328
|
+
getCurrent() {
|
|
1329
|
+
return this.current;
|
|
1330
|
+
}
|
|
1331
|
+
openEditUser() {
|
|
1332
|
+
this.editUser.next(1);
|
|
1333
|
+
}
|
|
1334
|
+
getEditUser() {
|
|
1335
|
+
return this.editUser;
|
|
1336
|
+
}
|
|
1337
|
+
get AuthenticatedUser() {
|
|
1338
|
+
let user = this.authService.currentUser;
|
|
1339
|
+
let parsed = JSON.parse(user);
|
|
1340
|
+
let login = parsed;
|
|
1341
|
+
if (Utilities.IsNil(login))
|
|
1342
|
+
return undefined;
|
|
1343
|
+
return new User(login);
|
|
1344
|
+
}
|
|
1345
|
+
logout() {
|
|
1346
|
+
const user = new User({});
|
|
1347
|
+
user.IsConnected = false;
|
|
1348
|
+
this.setCurrent(user);
|
|
1349
|
+
this.authService.logout(this.authService.pseudo);
|
|
1350
|
+
}
|
|
1351
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: UserService, deps: [{ token: i1.Router }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1352
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: UserService }); }
|
|
1353
|
+
}
|
|
1354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: UserService, decorators: [{
|
|
1355
|
+
type: Injectable
|
|
1356
|
+
}], ctorParameters: () => [{ type: i1.Router }, { type: AuthService }] });
|
|
1357
|
+
|
|
1358
|
+
// IMPORTANT : DANS LE BUT DE FACILITER LES MERGE ET LA LECTURE DU CODE.
|
|
1359
|
+
// 1. TOUJOURS CONSERVER LE TRI SUR LES IMPORTS
|
|
1360
|
+
// UTILISER L'EXTENSION "TypeScript Import Sorter" DANS VSCODE.
|
|
1361
|
+
// CONFIGURER L'EXTENSION POUR ACTIVER LA MISE EN FORME AUTOMATIQUE A LA SAUVEGARDE
|
|
1362
|
+
// 2. UTILISER CTRL-SHIFT O POUR SUPPRIMER AUTOMATIQUEMENT LES IMPORTS INUTILES
|
|
1363
|
+
// 3. TRIER LES COMPOSANTS OU DEPENDANCES DANS LES DECLARATIONS (IMPORTS, EXPORTS)
|
|
1364
|
+
// SELECTION DU TEXTE PUIS CTRL-SHIFT P, "Sort Lines Ascending"
|
|
1365
|
+
// ON PEUT PARAMETRER DES RACCOURCIS CLAVIER DANS VSCODE
|
|
1366
|
+
// Ensure that CoreServicesModule is only loaded into AppModule
|
|
1367
|
+
class CoreServicesModule extends EnsureModuleLoadedOnceGuard {
|
|
1368
|
+
// Looks for the module in the parent injector to see if it's already been loaded (only want it loaded once)
|
|
1369
|
+
constructor(parentModule) {
|
|
1370
|
+
super(parentModule);
|
|
1371
|
+
}
|
|
1372
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: CoreServicesModule, deps: [{ token: CoreServicesModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1373
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: CoreServicesModule, imports: [CommonModule, CoreModelModule] }); }
|
|
1374
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: CoreServicesModule, providers: [
|
|
1375
|
+
LocalStoreManager,
|
|
1376
|
+
GeolocationService,
|
|
1377
|
+
MessagesService,
|
|
1378
|
+
NotificationsService,
|
|
1379
|
+
PermissionService,
|
|
1380
|
+
UserService,
|
|
1381
|
+
AuthGuard,
|
|
1382
|
+
AuthService,
|
|
1383
|
+
HeadersService,
|
|
1384
|
+
BusMessageService,
|
|
1385
|
+
BreadcrumbService,
|
|
1386
|
+
ScreenService,
|
|
1387
|
+
AppConfiguration,
|
|
1388
|
+
HubService,
|
|
1389
|
+
NotificationMqService,
|
|
1390
|
+
FilterService,
|
|
1391
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
1392
|
+
], imports: [CommonModule, CoreModelModule] }); }
|
|
1393
|
+
}
|
|
1394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: CoreServicesModule, decorators: [{
|
|
1395
|
+
type: NgModule,
|
|
1396
|
+
args: [{ exports: [],
|
|
1397
|
+
declarations: [], imports: [CommonModule, CoreModelModule], providers: [
|
|
1398
|
+
LocalStoreManager,
|
|
1399
|
+
GeolocationService,
|
|
1400
|
+
MessagesService,
|
|
1401
|
+
NotificationsService,
|
|
1402
|
+
PermissionService,
|
|
1403
|
+
UserService,
|
|
1404
|
+
AuthGuard,
|
|
1405
|
+
AuthService,
|
|
1406
|
+
HeadersService,
|
|
1407
|
+
BusMessageService,
|
|
1408
|
+
BreadcrumbService,
|
|
1409
|
+
ScreenService,
|
|
1410
|
+
AppConfiguration,
|
|
1411
|
+
HubService,
|
|
1412
|
+
NotificationMqService,
|
|
1413
|
+
FilterService,
|
|
1414
|
+
provideHttpClient(withInterceptorsFromDi())
|
|
1415
|
+
] }]
|
|
1416
|
+
}], ctorParameters: () => [{ type: CoreServicesModule, decorators: [{
|
|
1417
|
+
type: Optional
|
|
1418
|
+
}, {
|
|
1419
|
+
type: SkipSelf
|
|
1420
|
+
}] }] });
|
|
1421
|
+
|
|
1422
|
+
class AuthInterceptor {
|
|
1423
|
+
constructor(router, injector) {
|
|
1424
|
+
this.router = router;
|
|
1425
|
+
this.injector = injector;
|
|
1426
|
+
}
|
|
1427
|
+
intercept(req, next) {
|
|
1428
|
+
const headersService = this.injector.get(HeadersService);
|
|
1429
|
+
const authService = this.injector.get(AuthService);
|
|
1430
|
+
switch (req.method) {
|
|
1431
|
+
case "GET":
|
|
1432
|
+
req = req.clone({ headers: headersService.authFormHeaders(), withCredentials: true });
|
|
1433
|
+
break;
|
|
1434
|
+
case "POST":
|
|
1435
|
+
// let isFileUpload = req.url.match(/Upload|File/)
|
|
1436
|
+
// let headers;
|
|
1437
|
+
// if (isFileUpload) {
|
|
1438
|
+
// headers = headersService.authFileUploadHeaders();
|
|
1439
|
+
// }
|
|
1440
|
+
// else {
|
|
1441
|
+
// headers = headersService.authJsonHeaders();
|
|
1442
|
+
//}
|
|
1443
|
+
if (req.headers['lazyUpdate'] == null) {
|
|
1444
|
+
req = req.clone({ headers: headersService.authJsonHeaders(), withCredentials: true });
|
|
1445
|
+
}
|
|
1446
|
+
break;
|
|
1447
|
+
default:
|
|
1448
|
+
req = req;
|
|
1449
|
+
break;
|
|
1450
|
+
}
|
|
1451
|
+
const r = req;
|
|
1452
|
+
return next.handle(req).pipe(catchError(err => {
|
|
1453
|
+
console.log(err);
|
|
1454
|
+
if (err instanceof HttpErrorResponse) {
|
|
1455
|
+
// Ignore signalr failure
|
|
1456
|
+
if (r.url.includes("/hub/")) {
|
|
1457
|
+
return empty();
|
|
1458
|
+
}
|
|
1459
|
+
if (err.status === 401 || err.status === 403) {
|
|
1460
|
+
// Ignore login failed
|
|
1461
|
+
if (!(r.url.endsWith("/api/Account/Connect"))) {
|
|
1462
|
+
authService.ensureLogout();
|
|
1463
|
+
this.router.navigate(['/login']);
|
|
1464
|
+
return empty();
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
else if (err.status === 400) {
|
|
1468
|
+
let apiError = {};
|
|
1469
|
+
apiError.ApiErrorType = ApiErrorTypes.UserError;
|
|
1470
|
+
apiError.Message = err.error;
|
|
1471
|
+
this.onError(err, apiError);
|
|
1472
|
+
}
|
|
1473
|
+
else {
|
|
1474
|
+
try {
|
|
1475
|
+
if (err.error instanceof Blob) {
|
|
1476
|
+
err.error.text().then((str => {
|
|
1477
|
+
let apiError = JSON.parse(str);
|
|
1478
|
+
this.onError(err, apiError);
|
|
1479
|
+
}));
|
|
1480
|
+
}
|
|
1481
|
+
else {
|
|
1482
|
+
let apiError = err.error;
|
|
1483
|
+
this.onError(err, apiError);
|
|
1484
|
+
}
|
|
1485
|
+
// if (typeof err.error === "string") {
|
|
1486
|
+
// }
|
|
1487
|
+
// else {
|
|
1488
|
+
// let reader = new FileReader();
|
|
1489
|
+
// reader.addEventListener("loadend",
|
|
1490
|
+
// () => {
|
|
1491
|
+
// let result = reader.result as string;
|
|
1492
|
+
// result = trimChar(result, "\"");
|
|
1493
|
+
// this.onError(err, result);
|
|
1494
|
+
// });
|
|
1495
|
+
// reader.readAsText(err.error);
|
|
1496
|
+
// }
|
|
1497
|
+
}
|
|
1498
|
+
catch (error) {
|
|
1499
|
+
let apiError = {};
|
|
1500
|
+
apiError.ApiErrorType = ApiErrorTypes.UserError;
|
|
1501
|
+
apiError.Message = "Une erreur a été détectée. Merci de contacter le service technique !";
|
|
1502
|
+
this.onError(err, apiError);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
return throwError(err);
|
|
1507
|
+
}));
|
|
1508
|
+
}
|
|
1509
|
+
onError(errResponse, error) {
|
|
1510
|
+
console.log(error.Message);
|
|
1511
|
+
}
|
|
1512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthInterceptor, deps: [{ token: i1.Router }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1513
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthInterceptor }); }
|
|
1514
|
+
}
|
|
1515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AuthInterceptor, decorators: [{
|
|
1516
|
+
type: Injectable
|
|
1517
|
+
}], ctorParameters: () => [{ type: i1.Router }, { type: i0.Injector }] });
|
|
1518
|
+
|
|
1519
|
+
class CanActivateGuard {
|
|
1520
|
+
constructor(router, userService) {
|
|
1521
|
+
this.router = router;
|
|
1522
|
+
this.userService = userService;
|
|
1523
|
+
this.connected = false;
|
|
1524
|
+
this.userService.getCurrent().subscribe((user) => {
|
|
1525
|
+
this.connected = user.IsConnected;
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
canActivate() {
|
|
1529
|
+
if (!this.connected) {
|
|
1530
|
+
this.router.navigate(['login']);
|
|
1531
|
+
}
|
|
1532
|
+
return this.connected;
|
|
1533
|
+
}
|
|
1534
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: CanActivateGuard, deps: [{ token: i1.Router }, { token: UserService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1535
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: CanActivateGuard }); }
|
|
1536
|
+
}
|
|
1537
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: CanActivateGuard, decorators: [{
|
|
1538
|
+
type: Injectable
|
|
1539
|
+
}], ctorParameters: () => [{ type: i1.Router }, { type: UserService }] });
|
|
1540
|
+
|
|
1541
|
+
function trimChar(str, c) {
|
|
1542
|
+
// Escape special char when needed
|
|
1543
|
+
c = c === "]"
|
|
1544
|
+
? "\\]"
|
|
1545
|
+
: c === "\\"
|
|
1546
|
+
? "\\\\"
|
|
1547
|
+
: c;
|
|
1548
|
+
return str.replace(new RegExp(`^[${c}]+|[${c}]+$`, "g"), "");
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
class MenuItem {
|
|
1552
|
+
constructor(title, link, icon, sublinks, permissionKey) {
|
|
1553
|
+
this.external = false;
|
|
1554
|
+
this.target = '';
|
|
1555
|
+
this.title = title;
|
|
1556
|
+
this.link = link;
|
|
1557
|
+
this.icon = icon;
|
|
1558
|
+
this.sublinks = sublinks;
|
|
1559
|
+
this.permissionKey = permissionKey;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* Generated bundle index. Do not edit.
|
|
1565
|
+
*/
|
|
1566
|
+
|
|
1567
|
+
export { AppConfiguration, AppKeys, AuthGuard, AuthInterceptor, AuthService, AuthTokenType, BreadcrumbService, BusMessageService, CanActivateGuard, CoreServicesModule, FilterService, GeolocationService, HeadersService, HubService, LocalStoreManager, MenuItem, MenuService, MessagesService, NotificationMqService, NotificationsService, PermissionService, ScreenService, ServerUrl, UserService, trimChar };
|
|
1568
|
+
//# sourceMappingURL=dflat-core-web-core-services.mjs.map
|