@rededor/site-front-end-lib 20.0.0-alpha.6 → 20.0.0-alpha.7
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/components/cta-wrapper/index.d.ts +3 -1
- package/components/footer/index.d.ts +6 -1
- package/components/section-navigation/index.d.ts +2 -0
- package/components/sidebar-navigation/index.d.ts +6 -1
- package/components/sticky-navigation/index.d.ts +6 -3
- package/core/index.d.ts +2 -0
- package/fesm2022/rededor-site-front-end-lib-components-banner.mjs +2 -2
- package/fesm2022/rededor-site-front-end-lib-components-banner.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-cta-wrapper.mjs +7 -3
- package/fesm2022/rededor-site-front-end-lib-components-cta-wrapper.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-error.mjs +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-error.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-filter-letter-and-terms.mjs +2 -2
- package/fesm2022/rededor-site-front-end-lib-components-filter-letter-and-terms.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-footer.mjs +3 -2
- package/fesm2022/rededor-site-front-end-lib-components-footer.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-section-navigation.mjs +7 -2
- package/fesm2022/rededor-site-front-end-lib-components-section-navigation.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-sidebar-navigation.mjs +17 -7
- package/fesm2022/rededor-site-front-end-lib-components-sidebar-navigation.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-components-sticky-navigation.mjs +17 -9
- package/fesm2022/rededor-site-front-end-lib-components-sticky-navigation.mjs.map +1 -1
- package/fesm2022/rededor-site-front-end-lib-core.mjs +32 -6
- package/fesm2022/rededor-site-front-end-lib-core.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -4,15 +4,17 @@ import { RdsiteLinkDirective } from '@rededor/site-front-end-lib/core';
|
|
|
4
4
|
import { CuraApiService } from '@rededor/site-front-end-lib/cura/api';
|
|
5
5
|
import { CuraParagraphComponent } from '@rededor/site-front-end-lib/cura/texts/cura-paragraph';
|
|
6
6
|
import { CuraIconComponent } from '@rededor/site-front-end-lib/cura/icons/cura-icon';
|
|
7
|
+
import { Router } from '@angular/router';
|
|
7
8
|
|
|
8
9
|
class StickyNavigationComponent {
|
|
9
10
|
constructor() {
|
|
10
11
|
this.curaApiService = inject(CuraApiService);
|
|
12
|
+
this.router = inject(Router);
|
|
11
13
|
this.sections = signal([], ...(ngDevMode ? [{ debugName: "sections" }] : []));
|
|
12
14
|
this.config = signal(undefined, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
13
15
|
this.activeSection = signal('', ...(ngDevMode ? [{ debugName: "activeSection" }] : []));
|
|
14
|
-
this.isOpen = false;
|
|
15
|
-
this.selectedIndex = 0;
|
|
16
|
+
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
17
|
+
this.selectedIndex = signal(0, ...(ngDevMode ? [{ debugName: "selectedIndex" }] : []));
|
|
16
18
|
this.anchorAdjustment = input(0, ...(ngDevMode ? [{ debugName: "anchorAdjustment" }] : []));
|
|
17
19
|
this.title = input('Nesta página', ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
18
20
|
this.ariaLabel = input('Navegação da página', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
@@ -49,23 +51,29 @@ class StickyNavigationComponent {
|
|
|
49
51
|
const elementTop = element.getBoundingClientRect().top + window.scrollY;
|
|
50
52
|
const currentScroll = window.scrollY + pageHeaderHeight + stickybarHeight + this.padding();
|
|
51
53
|
if (currentScroll >= elementTop) {
|
|
52
|
-
this.selectedIndex
|
|
53
|
-
if (this.sections()?.[this.selectedIndex]) {
|
|
54
|
-
this.activeSection.set(this.sections()?.[this.selectedIndex]?.id);
|
|
54
|
+
this.selectedIndex.set(index);
|
|
55
|
+
if (this.sections()?.[this.selectedIndex()]) {
|
|
56
|
+
this.activeSection.set(this.sections()?.[this.selectedIndex()]?.id);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
});
|
|
58
60
|
}
|
|
61
|
+
getPath(sectionId) {
|
|
62
|
+
return `${this.router.url}#${sectionId}`;
|
|
63
|
+
}
|
|
59
64
|
onSectionClick(event) {
|
|
60
|
-
|
|
61
|
-
this.
|
|
65
|
+
this.sectionChange.emit(event);
|
|
66
|
+
this.toggleOpen();
|
|
67
|
+
}
|
|
68
|
+
toggleOpen() {
|
|
69
|
+
this.isOpen.update((value) => !value);
|
|
62
70
|
}
|
|
63
71
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StickyNavigationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
64
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.2", type: StickyNavigationComponent, isStandalone: true, selector: "nav[rdsite-sticky-navigation]", inputs: { anchorAdjustment: { classPropertyName: "anchorAdjustment", publicName: "anchorAdjustment", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, navigationSections: { classPropertyName: "navigationSections", publicName: "navigationSections", isSignal: false, isRequired: true, transformFunction: null }, navigationConfig: { classPropertyName: "navigationConfig", publicName: "navigationConfig", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { sectionChange: "sectionChange" }, host: { listeners: { "window:scroll": "onWindowScroll()" }, properties: { "style": "this.styleBinding" } }, viewQueries: [{ propertyName: "anchorsEl", predicate: ["anchorEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<nav class=\"rdsite-sticky-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\
|
|
72
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.2", type: StickyNavigationComponent, isStandalone: true, selector: "nav[rdsite-sticky-navigation]", inputs: { anchorAdjustment: { classPropertyName: "anchorAdjustment", publicName: "anchorAdjustment", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, navigationSections: { classPropertyName: "navigationSections", publicName: "navigationSections", isSignal: false, isRequired: true, transformFunction: null }, navigationConfig: { classPropertyName: "navigationConfig", publicName: "navigationConfig", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { sectionChange: "sectionChange" }, host: { listeners: { "window:scroll": "onWindowScroll()" }, properties: { "style": "this.styleBinding" } }, viewQueries: [{ propertyName: "anchorsEl", predicate: ["anchorEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<nav class=\"rdsite-sticky-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n @if (title()) {\n <div class=\"title-bar\" (click)=\"toggleOpen()\" [attr.aria-expanded]=\"isOpen()\" role=\"button\" tabindex=\"0\" (keydown.enter)=\"toggleOpen()\">\n <cura-paragraph size=\"small\" [attr.color]=\"isOpen() ? 'neutraldark' : 'primary-base'\" margin-block=\"8px\">\n <b>{{ title() }}</b>\n </cura-paragraph>\n <cura-icon [attr.name]=\"isOpen() ? 'up' : 'down'\" size=\"16\" [attr.color]=\"isOpen() ? 'neutraldark' : 'primary-base'\"></cura-icon>\n </div>\n @if (sections().length && !isOpen()) {\n <cura-paragraph size=\"xsmall\" margin-block=\"8px\" color=\"neutral-black\">\n <b>{{ sections()[selectedIndex()].title }}</b>\n </cura-paragraph>\n }\n }\n\n @if (isOpen()) {\n <ul class=\"menu\" [class.open]=\"isOpen()\" role=\"menubar\">\n @for (section of sections(); track section.id) {\n <li role=\"none\">\n <cura-paragraph size=\"xsmall\" margin-block=\"8px\" [color]=\"activeSection() === section.id ? 'neutral-black' : 'primary-base'\">\n <a\n id=\"anchor-{{ section.id }}\"\n class=\"rdsite-sticky-link\"\n role=\"menuitem\"\n [href]=\"getPath(section.id)\"\n rdsitelink\n (click)=\"onSectionClick({ id: section.id, title: section.title })\"\n [anchorAdjustment]=\"anchorAdjustment()\"\n [attr.aria-current]=\"activeSection() === section.id ? 'page' : null\"\n [attr.aria-label]=\"'Navegar para ' + section.title\"\n >\n <b>{{ section.title }}</b>\n </a>\n </cura-paragraph>\n </li>\n }\n </ul>\n }\n</nav>\n", styles: ["nav{border-radius:2px;background:var(--neutral-purewhite);box-shadow:0 1px 4px #26262629;padding:8px 20px}nav *{font-family:var(--font-family)}nav .title-bar{display:flex;justify-content:space-between;align-items:center;cursor:pointer}nav ul.menu{display:flex;flex-direction:column;overflow:hidden;max-height:0;opacity:0;transform:scaleY(0);transform-origin:top;transition:max-height .3s ease,transform .3s ease,opacity .3s ease}nav ul.menu.open{max-height:fit-content;transform:scaleY(1);opacity:1}nav ul.menu li{width:100%}nav ul.menu li cura-paragraph,nav ul.menu li a{text-align:left}nav ul.menu li a{color:unset}\n"], dependencies: [{ kind: "directive", type: RdsiteLinkDirective, selector: "[rdsitelink]", inputs: ["anchorAdjustment", "anchorExtraAdjustment", "phonemodal"] }, { kind: "component", type: CuraParagraphComponent, selector: "cura-paragraph", inputs: ["size", "spotColor", "color", "marginBlock", "lineHeight", "textOverflow"] }, { kind: "component", type: CuraIconComponent, selector: "cura-icon", inputs: ["name", "color", "size", "iconset", "disabled"] }] }); }
|
|
65
73
|
}
|
|
66
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StickyNavigationComponent, decorators: [{
|
|
67
75
|
type: Component,
|
|
68
|
-
args: [{ selector: 'nav[rdsite-sticky-navigation]', imports: [RdsiteLinkDirective, CuraParagraphComponent, CuraIconComponent], template: "<nav class=\"rdsite-sticky-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\
|
|
76
|
+
args: [{ selector: 'nav[rdsite-sticky-navigation]', imports: [RdsiteLinkDirective, CuraParagraphComponent, CuraIconComponent], template: "<nav class=\"rdsite-sticky-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n @if (title()) {\n <div class=\"title-bar\" (click)=\"toggleOpen()\" [attr.aria-expanded]=\"isOpen()\" role=\"button\" tabindex=\"0\" (keydown.enter)=\"toggleOpen()\">\n <cura-paragraph size=\"small\" [attr.color]=\"isOpen() ? 'neutraldark' : 'primary-base'\" margin-block=\"8px\">\n <b>{{ title() }}</b>\n </cura-paragraph>\n <cura-icon [attr.name]=\"isOpen() ? 'up' : 'down'\" size=\"16\" [attr.color]=\"isOpen() ? 'neutraldark' : 'primary-base'\"></cura-icon>\n </div>\n @if (sections().length && !isOpen()) {\n <cura-paragraph size=\"xsmall\" margin-block=\"8px\" color=\"neutral-black\">\n <b>{{ sections()[selectedIndex()].title }}</b>\n </cura-paragraph>\n }\n }\n\n @if (isOpen()) {\n <ul class=\"menu\" [class.open]=\"isOpen()\" role=\"menubar\">\n @for (section of sections(); track section.id) {\n <li role=\"none\">\n <cura-paragraph size=\"xsmall\" margin-block=\"8px\" [color]=\"activeSection() === section.id ? 'neutral-black' : 'primary-base'\">\n <a\n id=\"anchor-{{ section.id }}\"\n class=\"rdsite-sticky-link\"\n role=\"menuitem\"\n [href]=\"getPath(section.id)\"\n rdsitelink\n (click)=\"onSectionClick({ id: section.id, title: section.title })\"\n [anchorAdjustment]=\"anchorAdjustment()\"\n [attr.aria-current]=\"activeSection() === section.id ? 'page' : null\"\n [attr.aria-label]=\"'Navegar para ' + section.title\"\n >\n <b>{{ section.title }}</b>\n </a>\n </cura-paragraph>\n </li>\n }\n </ul>\n }\n</nav>\n", styles: ["nav{border-radius:2px;background:var(--neutral-purewhite);box-shadow:0 1px 4px #26262629;padding:8px 20px}nav *{font-family:var(--font-family)}nav .title-bar{display:flex;justify-content:space-between;align-items:center;cursor:pointer}nav ul.menu{display:flex;flex-direction:column;overflow:hidden;max-height:0;opacity:0;transform:scaleY(0);transform-origin:top;transition:max-height .3s ease,transform .3s ease,opacity .3s ease}nav ul.menu.open{max-height:fit-content;transform:scaleY(1);opacity:1}nav ul.menu li{width:100%}nav ul.menu li cura-paragraph,nav ul.menu li a{text-align:left}nav ul.menu li a{color:unset}\n"] }]
|
|
69
77
|
}], propDecorators: { navigationSections: [{
|
|
70
78
|
type: Input,
|
|
71
79
|
args: [{ required: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rededor-site-front-end-lib-components-sticky-navigation.mjs","sources":["../../../projects/site-front-end-lib/components/sticky-navigation/sticky-navigation.component.ts","../../../projects/site-front-end-lib/components/sticky-navigation/sticky-navigation.component.html","../../../projects/site-front-end-lib/components/sticky-navigation/rededor-site-front-end-lib-components-sticky-navigation.ts"],"sourcesContent":["import { Component, ElementRef, Input, signal, HostListener, HostBinding, inject, input, output, viewChildren } from '@angular/core';\
|
|
1
|
+
{"version":3,"file":"rededor-site-front-end-lib-components-sticky-navigation.mjs","sources":["../../../projects/site-front-end-lib/components/sticky-navigation/sticky-navigation.component.ts","../../../projects/site-front-end-lib/components/sticky-navigation/sticky-navigation.component.html","../../../projects/site-front-end-lib/components/sticky-navigation/rededor-site-front-end-lib-components-sticky-navigation.ts"],"sourcesContent":["import { Component, ElementRef, Input, signal, HostListener, HostBinding, inject, input, output, viewChildren } from '@angular/core';\nimport { RdsiteLinkDirective, SectionNavigationConfig, SectionNavigationData } from '@rededor/site-front-end-lib/core';\nimport { CuraApiService } from '@rededor/site-front-end-lib/cura/api';\nimport { CuraParagraphComponent } from '@rededor/site-front-end-lib/cura/texts/cura-paragraph';\nimport { CuraIconComponent } from '@rededor/site-front-end-lib/cura/icons/cura-icon';\nimport { Router } from '@angular/router';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'nav[rdsite-sticky-navigation]',\n imports: [RdsiteLinkDirective, CuraParagraphComponent, CuraIconComponent],\n templateUrl: './sticky-navigation.component.html',\n styleUrl: './sticky-navigation.component.scss',\n})\nexport class StickyNavigationComponent {\n private curaApiService = inject(CuraApiService);\n private router = inject(Router);\n\n public readonly sections = signal<SectionNavigationData[]>([]);\n readonly config = signal<SectionNavigationConfig | undefined>(undefined);\n readonly activeSection = signal<string>('');\n readonly isOpen = signal<boolean>(false);\n public selectedIndex = signal<number>(0);\n\n readonly anchorAdjustment = input(0);\n readonly title = input('Nesta página');\n readonly ariaLabel = input('Navegação da página');\n readonly padding = input(20);\n\n @Input({ required: true })\n set navigationSections(value: SectionNavigationData[]) {\n if (!value?.length) {\n throw new Error('O SectionNavigationComponent requer pelo menos uma seção.');\n }\n this.sections.set(value);\n\n if (!this.activeSection()) {\n this.activeSection.set(value[0].id);\n }\n }\n\n @Input()\n set navigationConfig(value: SectionNavigationConfig) {\n this.config.set(value);\n }\n\n readonly anchorsEl = viewChildren<ElementRef<HTMLAnchorElement>>('anchorEl');\n readonly sectionChange = output<SectionNavigationData>();\n\n @HostListener('window:scroll')\n onWindowScroll(): void {\n this.windowScroll();\n }\n\n @HostBinding('style') styleBinding = {\n '--neutral-purewhite': this.curaApiService.theme.colors.getColor('neutral-purewhite'),\n '--font-family': this.curaApiService.theme.fonts.getFamily(''),\n };\n\n private windowScroll(): void {\n const pageHeaderHeight = document.querySelector<HTMLElement>('header')?.offsetHeight || 0;\n const stickybarHeight = document.querySelector<HTMLElement>('.rdsite-sticky-navigation')?.offsetHeight || 0;\n\n this.sections()?.forEach((section, index) => {\n const element = document.querySelector<HTMLElement>(`#${section.id}`);\n if (!element) return;\n\n const elementTop = element.getBoundingClientRect().top + window.scrollY;\n const currentScroll = window.scrollY + pageHeaderHeight + stickybarHeight + this.padding();\n\n if (currentScroll >= elementTop) {\n this.selectedIndex.set(index);\n if (this.sections()?.[this.selectedIndex()]) {\n this.activeSection.set(this.sections()?.[this.selectedIndex()]?.id);\n }\n }\n });\n }\n\n getPath(sectionId: string): string {\n return `${this.router.url}#${sectionId}`;\n }\n\n onSectionClick(event: SectionNavigationData) {\n this.sectionChange.emit(event);\n this.toggleOpen();\n }\n\n toggleOpen(): void {\n this.isOpen.update((value) => !value);\n }\n}\n","<nav class=\"rdsite-sticky-navigation\" [attr.aria-label]=\"ariaLabel()\" [style.top.px]=\"config()?.offsetTop || 0\">\n @if (title()) {\n <div class=\"title-bar\" (click)=\"toggleOpen()\" [attr.aria-expanded]=\"isOpen()\" role=\"button\" tabindex=\"0\" (keydown.enter)=\"toggleOpen()\">\n <cura-paragraph size=\"small\" [attr.color]=\"isOpen() ? 'neutraldark' : 'primary-base'\" margin-block=\"8px\">\n <b>{{ title() }}</b>\n </cura-paragraph>\n <cura-icon [attr.name]=\"isOpen() ? 'up' : 'down'\" size=\"16\" [attr.color]=\"isOpen() ? 'neutraldark' : 'primary-base'\"></cura-icon>\n </div>\n @if (sections().length && !isOpen()) {\n <cura-paragraph size=\"xsmall\" margin-block=\"8px\" color=\"neutral-black\">\n <b>{{ sections()[selectedIndex()].title }}</b>\n </cura-paragraph>\n }\n }\n\n @if (isOpen()) {\n <ul class=\"menu\" [class.open]=\"isOpen()\" role=\"menubar\">\n @for (section of sections(); track section.id) {\n <li role=\"none\">\n <cura-paragraph size=\"xsmall\" margin-block=\"8px\" [color]=\"activeSection() === section.id ? 'neutral-black' : 'primary-base'\">\n <a\n id=\"anchor-{{ section.id }}\"\n class=\"rdsite-sticky-link\"\n role=\"menuitem\"\n [href]=\"getPath(section.id)\"\n rdsitelink\n (click)=\"onSectionClick({ id: section.id, title: section.title })\"\n [anchorAdjustment]=\"anchorAdjustment()\"\n [attr.aria-current]=\"activeSection() === section.id ? 'page' : null\"\n [attr.aria-label]=\"'Navegar para ' + section.title\"\n >\n <b>{{ section.title }}</b>\n </a>\n </cura-paragraph>\n </li>\n }\n </ul>\n }\n</nav>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAca,yBAAyB,CAAA;AAPtC,IAAA,WAAA,GAAA;AAQU,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAEf,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAA0B,EAAE,oDAAC;AACrD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAsC,SAAS,kDAAC;AAC/D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAS,EAAE,yDAAC;AAClC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAU,KAAK,kDAAC;AACjC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAS,CAAC,yDAAC;AAE/B,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAC,CAAC,4DAAC;AAC3B,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,cAAc,iDAAC;AAC7B,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,qBAAqB,qDAAC;AACxC,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,EAAE,mDAAC;AAmBnB,QAAA,IAAA,CAAA,SAAS,GAAG,YAAY,CAAgC,UAAU,qDAAC;QACnE,IAAA,CAAA,aAAa,GAAG,MAAM,EAAyB;AAOlC,QAAA,IAAA,CAAA,YAAY,GAAG;AACnC,YAAA,qBAAqB,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC;AACrF,YAAA,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAA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,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAI7D,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAPrC,SAAS;AAEE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,+BAA+B,WAChC,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,CAAC,EAAA,QAAA,EAAA,8xDAAA,EAAA,MAAA,EAAA,CAAA,6mBAAA,CAAA,EAAA;8BAoBrE,kBAAkB,EAAA,CAAA;sBADrB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAarB,gBAAgB,EAAA,CAAA;sBADnB;gBASD,cAAc,EAAA,CAAA;sBADb,YAAY;uBAAC,eAAe;gBAKP,YAAY,EAAA,CAAA;sBAAjC,WAAW;uBAAC,OAAO;;;AEtDtB;;AAEG;;;;"}
|
|
@@ -234,9 +234,10 @@ class RdsiteLinkDirective {
|
|
|
234
234
|
event.preventDefault();
|
|
235
235
|
if (!isPlatformBrowser(this.platformId) || !this.allowedTags.includes(this.element?.nativeElement?.tagName))
|
|
236
236
|
return;
|
|
237
|
-
|
|
237
|
+
let href = this.element?.nativeElement?.getAttribute('href') ?? '';
|
|
238
238
|
if (!href)
|
|
239
239
|
return;
|
|
240
|
+
href = this.verifyUtm(href);
|
|
240
241
|
if (this.isPhone(href)) {
|
|
241
242
|
this.phoneClicked({
|
|
242
243
|
href,
|
|
@@ -264,6 +265,22 @@ class RdsiteLinkDirective {
|
|
|
264
265
|
}
|
|
265
266
|
this.navigateTo(href);
|
|
266
267
|
}
|
|
268
|
+
verifyUtm(href) {
|
|
269
|
+
if (!href.includes('/paciente'))
|
|
270
|
+
return href;
|
|
271
|
+
if (isPlatformBrowser(this.platformId) && typeof window !== 'undefined') {
|
|
272
|
+
const currentUrl = new URL(window.location.href);
|
|
273
|
+
const utmParams = Array.from(currentUrl.searchParams.entries()).filter(([key]) => key.startsWith('utm_'));
|
|
274
|
+
if (utmParams.length === 0)
|
|
275
|
+
return href;
|
|
276
|
+
const targetUrl = new URL(href);
|
|
277
|
+
utmParams.forEach(([key, value]) => targetUrl.searchParams.set(key, value));
|
|
278
|
+
return targetUrl.toString();
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
return href;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
267
284
|
isPhone(href) {
|
|
268
285
|
return this.telRegex.test(href);
|
|
269
286
|
}
|
|
@@ -299,11 +316,16 @@ class RdsiteLinkDirective {
|
|
|
299
316
|
return this.siteUrlList.find((url) => href.includes(url) && !href.includes(exception));
|
|
300
317
|
}
|
|
301
318
|
isAnchor(href) {
|
|
302
|
-
return href.
|
|
319
|
+
return href.includes('#');
|
|
320
|
+
}
|
|
321
|
+
getAnchor(url) {
|
|
322
|
+
const hashIndex = url.indexOf('#');
|
|
323
|
+
return hashIndex !== -1 ? url.substring(hashIndex) : '';
|
|
303
324
|
}
|
|
304
325
|
scrollToAnchor(href) {
|
|
305
326
|
if (href === '#')
|
|
306
327
|
return;
|
|
328
|
+
const anchor = this.getAnchor(href);
|
|
307
329
|
if (isPlatformBrowser(this.platformId)) {
|
|
308
330
|
const docElement = this.document.documentElement;
|
|
309
331
|
let adjustment = 0;
|
|
@@ -317,7 +339,7 @@ class RdsiteLinkDirective {
|
|
|
317
339
|
adjustment += this.anchorExtraAdjustment();
|
|
318
340
|
}
|
|
319
341
|
const bodyTop = this.document?.body?.getBoundingClientRect()?.top ?? 0;
|
|
320
|
-
const hrefTop = this.document?.querySelector(
|
|
342
|
+
const hrefTop = this.document?.querySelector(anchor)?.getBoundingClientRect()?.top ?? 0;
|
|
321
343
|
const scrollTop = bodyTop * -1 + hrefTop - adjustment;
|
|
322
344
|
docElement.scrollTo({ top: scrollTop, behavior: 'smooth' });
|
|
323
345
|
}
|
|
@@ -585,8 +607,10 @@ class ErrorInterceptor {
|
|
|
585
607
|
this.platformId = inject(PLATFORM_ID);
|
|
586
608
|
}
|
|
587
609
|
intercept(req, next) {
|
|
610
|
+
const queryParams = req.params.keys().length ? `?${req.params.toString()}` : '';
|
|
611
|
+
const requestUrl = `${req.url}${queryParams}`;
|
|
588
612
|
return next.handle(req).pipe(catchError((error) => {
|
|
589
|
-
this.logService.logMsg(`REQUEST ERROR => ${req.method} ${
|
|
613
|
+
this.logService.logMsg(`REQUEST ERROR => ${req.method} ${requestUrl}`, 'ERROR_INTERCEPTOR');
|
|
590
614
|
if (isPlatformBrowser(this.platformId) && !req.url.includes('/log/error')) {
|
|
591
615
|
const errorMessage = typeof error === 'string' ? error : error instanceof Error ? error.message : JSON.stringify(error);
|
|
592
616
|
this.siteBackendService
|
|
@@ -617,12 +641,14 @@ class LogInterceptor {
|
|
|
617
641
|
intercept(req, next) {
|
|
618
642
|
const requestId = v4();
|
|
619
643
|
const startTime = Date.now();
|
|
620
|
-
|
|
644
|
+
const queryParams = req.params.keys().length ? `?${req.params.toString()}` : '';
|
|
645
|
+
const requestUrl = `${req.url}${queryParams}`;
|
|
646
|
+
this.logService.logMsg(`REQUEST ${requestId} => ${req.method} ${requestUrl}`, 'INTERCEPTOR');
|
|
621
647
|
return next.handle(req).pipe(tap((response) => {
|
|
622
648
|
const res = response;
|
|
623
649
|
if (res?.status) {
|
|
624
650
|
const elapsedTime = differenceInMilliseconds(Date.now(), startTime);
|
|
625
|
-
this.logService.logMsg(`RESPONSE ${requestId} => ${req.method} ${
|
|
651
|
+
this.logService.logMsg(`RESPONSE ${requestId} => ${req.method} ${requestUrl} | Duração: ${elapsedTime}ms | Status: ${res.status} - ${res.statusText} | Body: ${!!res.body}`, 'INTERCEPTOR');
|
|
626
652
|
}
|
|
627
653
|
}));
|
|
628
654
|
}
|