@rededor/site-front-end-lib 0.0.3 → 0.0.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/directives/index.mjs +3 -0
- package/esm2022/lib/directives/rdsite-link/rdsite-link.directive.mjs +131 -0
- package/esm2022/lib/directives/rdsite-phone-modal/rdsite-phone-modal.directive.mjs +52 -0
- package/esm2022/lib/enums/RdsiteModalComponentStyle.enum.mjs +9 -0
- package/esm2022/lib/enums/RdsiteModalDrawerComponentStyle.enum.mjs +6 -0
- package/esm2022/lib/enums/index.mjs +6 -0
- package/esm2022/lib/helpers/formatPhone.func.mjs +29 -0
- package/esm2022/lib/pipes/index.mjs +2 -0
- package/esm2022/lib/pipes/phone/phone.pipe.mjs +18 -0
- package/esm2022/lib/services/index.mjs +4 -1
- package/esm2022/lib/services/modal/modal.service.mjs +56 -0
- package/esm2022/lib/services/modal-drawer/modal-drawer.service.mjs +42 -0
- package/esm2022/lib/services/phone/phone.service.mjs +32 -0
- package/esm2022/lib/services/seo/seo.service.mjs +30 -30
- package/esm2022/lib/tokens/LibConfig.mjs +2 -2
- package/esm2022/public-api.mjs +6 -4
- package/fesm2022/rededor-site-front-end-lib.mjs +382 -31
- package/fesm2022/rededor-site-front-end-lib.mjs.map +1 -1
- package/lib/directives/index.d.ts +2 -0
- package/lib/directives/rdsite-link/rdsite-link.directive.d.ts +31 -0
- package/lib/directives/rdsite-phone-modal/rdsite-phone-modal.directive.d.ts +17 -0
- package/lib/enums/RdsiteModalComponentStyle.enum.d.ts +7 -0
- package/lib/enums/RdsiteModalDrawerComponentStyle.enum.d.ts +4 -0
- package/lib/enums/index.d.ts +5 -0
- package/lib/helpers/formatPhone.func.d.ts +1 -0
- package/lib/pipes/index.d.ts +1 -0
- package/lib/pipes/phone/phone.pipe.d.ts +7 -0
- package/lib/services/index.d.ts +3 -0
- package/lib/services/modal/modal.service.d.ts +31 -0
- package/lib/services/modal-drawer/modal-drawer.service.d.ts +37 -0
- package/lib/services/phone/phone.service.d.ts +13 -0
- package/lib/services/seo/seo.service.d.ts +1 -1
- package/lib/tokens/LibConfig.d.ts +2 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, Inject, PLATFORM_ID, Optional, makeStateKey, Component, CUSTOM_ELEMENTS_SCHEMA, HostBinding } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Injectable, Inject, PLATFORM_ID, Optional, makeStateKey, Component, CUSTOM_ELEMENTS_SCHEMA, HostBinding, Directive, Input, HostListener, Pipe } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/common';
|
|
4
4
|
import { isPlatformBrowser, isPlatformServer, DOCUMENT, CommonModule } from '@angular/common';
|
|
5
5
|
import algoliasearch from 'algoliasearch';
|
|
@@ -9,6 +9,7 @@ import { HttpHeaders } from '@angular/common/http';
|
|
|
9
9
|
import * as i2$1 from 'ngx-device-detector';
|
|
10
10
|
import * as he from 'he';
|
|
11
11
|
import * as i1$1 from '@angular/platform-browser';
|
|
12
|
+
import * as i1$2 from '@angular/router';
|
|
12
13
|
|
|
13
14
|
// Configura a lib com informações especificas de cada projeto.
|
|
14
15
|
const LIB_CONFIG = new InjectionToken('libConfig');
|
|
@@ -384,6 +385,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
384
385
|
args: [LIB_CONFIG]
|
|
385
386
|
}] }, { type: i1.HttpClient }, { type: i2$1.DeviceDetectorService }] });
|
|
386
387
|
|
|
388
|
+
class AbstractModalComponent {
|
|
389
|
+
}
|
|
390
|
+
class ModalService {
|
|
391
|
+
constructor() {
|
|
392
|
+
this.reference = null;
|
|
393
|
+
}
|
|
394
|
+
open() {
|
|
395
|
+
this.reference?.open();
|
|
396
|
+
}
|
|
397
|
+
setReference(element) {
|
|
398
|
+
this.reference = element;
|
|
399
|
+
}
|
|
400
|
+
setHeader(header) {
|
|
401
|
+
if (!this.reference)
|
|
402
|
+
return;
|
|
403
|
+
this.reference.modalHeader = header;
|
|
404
|
+
}
|
|
405
|
+
setTitle(title) {
|
|
406
|
+
if (!this.reference)
|
|
407
|
+
return;
|
|
408
|
+
this.reference.modalTitle = title;
|
|
409
|
+
}
|
|
410
|
+
setContent(content, context = {}) {
|
|
411
|
+
if (!this.reference)
|
|
412
|
+
return;
|
|
413
|
+
this.reference.modalContent = content;
|
|
414
|
+
this.reference.modalContentContext = context;
|
|
415
|
+
}
|
|
416
|
+
setActions(actions) {
|
|
417
|
+
if (!this.reference)
|
|
418
|
+
return;
|
|
419
|
+
this.reference.modalActions = actions;
|
|
420
|
+
}
|
|
421
|
+
setStyle(style) {
|
|
422
|
+
if (!this.reference)
|
|
423
|
+
return;
|
|
424
|
+
this.reference.componentStyle = style;
|
|
425
|
+
}
|
|
426
|
+
setDefaultPhoneModal(modal) {
|
|
427
|
+
this.defaultPhoneModal = modal;
|
|
428
|
+
}
|
|
429
|
+
close() {
|
|
430
|
+
this.reference?.close();
|
|
431
|
+
}
|
|
432
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
433
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ModalService, providedIn: 'root' }); }
|
|
434
|
+
}
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ModalService, decorators: [{
|
|
436
|
+
type: Injectable,
|
|
437
|
+
args: [{
|
|
438
|
+
providedIn: 'root',
|
|
439
|
+
}]
|
|
440
|
+
}] });
|
|
441
|
+
|
|
442
|
+
class AbstractModalDrawerComponent {
|
|
443
|
+
}
|
|
444
|
+
class ModalDrawerService {
|
|
445
|
+
constructor() {
|
|
446
|
+
this.reference = null;
|
|
447
|
+
}
|
|
448
|
+
open() {
|
|
449
|
+
this.reference?.openSheet();
|
|
450
|
+
}
|
|
451
|
+
setReference(element) {
|
|
452
|
+
this.reference = element;
|
|
453
|
+
}
|
|
454
|
+
setContent(content) {
|
|
455
|
+
if (!this.reference)
|
|
456
|
+
return;
|
|
457
|
+
this.reference.modalContent = content;
|
|
458
|
+
}
|
|
459
|
+
setStyle(style) {
|
|
460
|
+
if (!this.reference)
|
|
461
|
+
return;
|
|
462
|
+
this.reference.componentStyle = style;
|
|
463
|
+
}
|
|
464
|
+
setHeight(value) {
|
|
465
|
+
if (!this.reference)
|
|
466
|
+
return;
|
|
467
|
+
this.reference.maxHeight = value;
|
|
468
|
+
}
|
|
469
|
+
close() {
|
|
470
|
+
this.reference?.closeSheet();
|
|
471
|
+
}
|
|
472
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ModalDrawerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
473
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ModalDrawerService, providedIn: 'root' }); }
|
|
474
|
+
}
|
|
475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ModalDrawerService, decorators: [{
|
|
476
|
+
type: Injectable,
|
|
477
|
+
args: [{
|
|
478
|
+
providedIn: 'root',
|
|
479
|
+
}]
|
|
480
|
+
}] });
|
|
481
|
+
|
|
387
482
|
class NguCarouselService {
|
|
388
483
|
constructor() {
|
|
389
484
|
this._defaultCarouselConfig = {
|
|
@@ -463,6 +558,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
463
558
|
}]
|
|
464
559
|
}] });
|
|
465
560
|
|
|
561
|
+
class PhoneService {
|
|
562
|
+
constructor(document) {
|
|
563
|
+
this.document = document;
|
|
564
|
+
this.telRegex = /tel:/;
|
|
565
|
+
this.consultaExameRegex = /(consulta|exame)/gi;
|
|
566
|
+
this.phoneModalIsAllowed = true; // variavel utilizada para permitir/bloquear o modal de telefone
|
|
567
|
+
}
|
|
568
|
+
/** Verifica se o 'href' é de telefone e se a janela está em tamanho desktop */
|
|
569
|
+
isPhoneModal(href) {
|
|
570
|
+
const width = this.document.defaultView?.innerWidth ?? 0;
|
|
571
|
+
const SMALL_BREAKPOINT = 718;
|
|
572
|
+
return this.telRegex.test(href) && width > SMALL_BREAKPOINT;
|
|
573
|
+
}
|
|
574
|
+
isConsultaOuExame(label = '') {
|
|
575
|
+
return this.consultaExameRegex.test(label);
|
|
576
|
+
}
|
|
577
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PhoneService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
578
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PhoneService, providedIn: 'root' }); }
|
|
579
|
+
}
|
|
580
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PhoneService, decorators: [{
|
|
581
|
+
type: Injectable,
|
|
582
|
+
args: [{
|
|
583
|
+
providedIn: 'root',
|
|
584
|
+
}]
|
|
585
|
+
}], ctorParameters: () => [{ type: Document, decorators: [{
|
|
586
|
+
type: Inject,
|
|
587
|
+
args: [DOCUMENT]
|
|
588
|
+
}] }] });
|
|
589
|
+
|
|
466
590
|
var unidades = [
|
|
467
591
|
{
|
|
468
592
|
path: "/acreditar/",
|
|
@@ -32417,9 +32541,9 @@ class SeoService {
|
|
|
32417
32541
|
this.jsonTagId = 'seoJSON';
|
|
32418
32542
|
this.breadcrumbsJsonTagId = 'breadcrumbsJSON';
|
|
32419
32543
|
this.unidade = null;
|
|
32420
|
-
this.unidadeName =
|
|
32421
|
-
this.unidadePath =
|
|
32422
|
-
this.unidadeSlug =
|
|
32544
|
+
this.unidadeName = '';
|
|
32545
|
+
this.unidadePath = '';
|
|
32546
|
+
this.unidadeSlug = '';
|
|
32423
32547
|
}
|
|
32424
32548
|
setFullSeo(data) {
|
|
32425
32549
|
this.setTitle(data.title.text, !!data.title.sub);
|
|
@@ -32512,7 +32636,7 @@ class SeoService {
|
|
|
32512
32636
|
this.setMetaTag('twitter:site', url, 'name');
|
|
32513
32637
|
this.setMetaTag('twitter:title', title, 'name');
|
|
32514
32638
|
this.setMetaTag('twitter:description', description, 'name');
|
|
32515
|
-
this.setMetaTag(
|
|
32639
|
+
this.setMetaTag('twitter:image', img ?? '', 'name');
|
|
32516
32640
|
}
|
|
32517
32641
|
/**
|
|
32518
32642
|
* Define tags de redes sociais (Twitter e Open Graph)
|
|
@@ -32635,9 +32759,9 @@ class SeoService {
|
|
|
32635
32759
|
const pagePath = this.location.path();
|
|
32636
32760
|
return `${siteurl}${pagePath}`;
|
|
32637
32761
|
}
|
|
32638
|
-
url = url.filter(u => u !== this.unidadePath);
|
|
32762
|
+
url = url.filter((u) => u !== this.unidadePath);
|
|
32639
32763
|
const unidadePath = this.getUnidadePath();
|
|
32640
|
-
const fullPath = `${unidadePath}/${url.join(
|
|
32764
|
+
const fullPath = `${unidadePath}/${url.join('/').replace(/^\/?/, '')}`;
|
|
32641
32765
|
return `${siteurl}/${fullPath}`.replace(/\/$/, '');
|
|
32642
32766
|
}
|
|
32643
32767
|
/** Cria tag script para o JSON de SEO */
|
|
@@ -32711,9 +32835,9 @@ class SeoService {
|
|
|
32711
32835
|
};
|
|
32712
32836
|
}
|
|
32713
32837
|
getUnidadePath() {
|
|
32714
|
-
let unidadePath =
|
|
32838
|
+
let unidadePath = '';
|
|
32715
32839
|
if (this.unidade && this.unidadePath) {
|
|
32716
|
-
unidadePath = this.unidade?.path ===
|
|
32840
|
+
unidadePath = this.unidade?.path === '/' ? '' : this.unidadePath?.substring(0, this.unidadePath?.length - 1);
|
|
32717
32841
|
}
|
|
32718
32842
|
return unidadePath;
|
|
32719
32843
|
}
|
|
@@ -32783,51 +32907,51 @@ class SeoService {
|
|
|
32783
32907
|
const siteurl = getSiteUrl(this.libConfig?.siteUrl, this.libConfig?.siteSufix);
|
|
32784
32908
|
const unidadeSlug = this.unidadeSlug;
|
|
32785
32909
|
let converted = urlFromWpApi.replace(apiUrl, siteurl);
|
|
32786
|
-
if (unidadeSlug !==
|
|
32910
|
+
if (unidadeSlug !== '/' && converted.includes(`/${unidadeSlug}/`)) {
|
|
32787
32911
|
converted = converted.replace(`/${unidadeSlug}/`, `${this.unidadePath}`);
|
|
32788
32912
|
}
|
|
32789
32913
|
return converted;
|
|
32790
32914
|
}
|
|
32791
32915
|
getPostContent(post) {
|
|
32792
|
-
const content = post.acf.rdsl_post_content.find((content) => content.acf_fc_layout ===
|
|
32793
|
-
return content
|
|
32916
|
+
const content = post.acf['rdsl_post_content'] ? post.acf.rdsl_post_content.find((content) => content.acf_fc_layout === 'text_html') : null;
|
|
32917
|
+
return content?.content || post.content.rendered || '';
|
|
32794
32918
|
}
|
|
32795
32919
|
addArticleScript(post, scriptName) {
|
|
32796
32920
|
const postContent = this.getPostContent(post);
|
|
32797
|
-
const postHeaderImage = post.acf[
|
|
32921
|
+
const postHeaderImage = post.acf['rdsl_post_header_img']
|
|
32798
32922
|
? {
|
|
32799
|
-
url: post.acf[
|
|
32800
|
-
width: post.acf[
|
|
32801
|
-
height: post.acf[
|
|
32923
|
+
url: post.acf['rdsl_post_header_img'].url,
|
|
32924
|
+
width: post.acf['rdsl_post_header_img'].width,
|
|
32925
|
+
height: post.acf['rdsl_post_header_img'].height,
|
|
32802
32926
|
}
|
|
32803
32927
|
: null;
|
|
32804
32928
|
const structuredData = {
|
|
32805
|
-
|
|
32806
|
-
|
|
32929
|
+
'@context': 'https://schema.org',
|
|
32930
|
+
'@type': 'Article',
|
|
32807
32931
|
mainEntityOfPage: `${getSiteUrl(this.libConfig?.siteUrl, this.libConfig?.siteSufix)}${this.location.path()}`,
|
|
32808
32932
|
headline: post.title?.rendered,
|
|
32809
32933
|
datePublished: post.date_gmt,
|
|
32810
32934
|
publisher: {
|
|
32811
|
-
|
|
32812
|
-
name:
|
|
32935
|
+
'@type': 'Organization',
|
|
32936
|
+
name: 'Rede D’Or',
|
|
32813
32937
|
},
|
|
32814
32938
|
description: post.title?.rendered,
|
|
32815
32939
|
articleBody: removeHtmlTags(he.decode(postContent)),
|
|
32816
32940
|
dateModified: post.modified_gmt,
|
|
32817
32941
|
image: {
|
|
32818
|
-
|
|
32819
|
-
url: postHeaderImage?.url || post.featured_media_path ||
|
|
32820
|
-
height: postHeaderImage?.height ||
|
|
32821
|
-
width: postHeaderImage?.width ||
|
|
32942
|
+
'@type': 'ImageObject',
|
|
32943
|
+
url: postHeaderImage?.url || post.featured_media_path || '',
|
|
32944
|
+
height: postHeaderImage?.height || '',
|
|
32945
|
+
width: postHeaderImage?.width || '',
|
|
32822
32946
|
},
|
|
32823
32947
|
author: {
|
|
32824
|
-
|
|
32825
|
-
name:
|
|
32948
|
+
'@type': 'Organization',
|
|
32949
|
+
name: 'Rede D’Or',
|
|
32826
32950
|
},
|
|
32827
|
-
wordcount: postContent.split(
|
|
32951
|
+
wordcount: postContent.split(' ').length,
|
|
32828
32952
|
};
|
|
32829
|
-
const script = this.document.createElement(
|
|
32830
|
-
script.type =
|
|
32953
|
+
const script = this.document.createElement('script');
|
|
32954
|
+
script.type = 'application/ld+json';
|
|
32831
32955
|
script.id = scriptName;
|
|
32832
32956
|
script.innerHTML = JSON.stringify(structuredData);
|
|
32833
32957
|
this.document.head.appendChild(script);
|
|
@@ -32836,7 +32960,7 @@ class SeoService {
|
|
|
32836
32960
|
const script = this.document.getElementById(scriptName);
|
|
32837
32961
|
script?.remove();
|
|
32838
32962
|
}
|
|
32839
|
-
setUnidade({ unidade = null, unidadeName =
|
|
32963
|
+
setUnidade({ unidade = null, unidadeName = '', unidadePath = '', unidadeSlug = '' }) {
|
|
32840
32964
|
this.unidade = unidade;
|
|
32841
32965
|
this.unidadeName = unidadeName;
|
|
32842
32966
|
this.unidadePath = unidadePath;
|
|
@@ -33048,6 +33172,227 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
33048
33172
|
|
|
33049
33173
|
// Components
|
|
33050
33174
|
|
|
33175
|
+
var RdsiteModalComponentStyle;
|
|
33176
|
+
(function (RdsiteModalComponentStyle) {
|
|
33177
|
+
RdsiteModalComponentStyle["DEFAULT"] = "default";
|
|
33178
|
+
RdsiteModalComponentStyle["ALERT"] = "alert";
|
|
33179
|
+
RdsiteModalComponentStyle["LIGHT"] = "light";
|
|
33180
|
+
RdsiteModalComponentStyle["DOCTORCARD"] = "doctor-card";
|
|
33181
|
+
RdsiteModalComponentStyle["HOMESLIDE"] = "home-slide";
|
|
33182
|
+
})(RdsiteModalComponentStyle || (RdsiteModalComponentStyle = {}));
|
|
33183
|
+
|
|
33184
|
+
const formatPhone = (phone) => {
|
|
33185
|
+
if (!phone)
|
|
33186
|
+
return '';
|
|
33187
|
+
const cleanPhone = phone.replace(/[^0-9]/gi, '');
|
|
33188
|
+
let formatedPhone = '';
|
|
33189
|
+
if (cleanPhone.length === 12) {
|
|
33190
|
+
formatedPhone = cleanPhone.replace(/(\d{3})?(\d{5})?(\d{4})/, '($1) $2-$3');
|
|
33191
|
+
}
|
|
33192
|
+
else if (cleanPhone.length === 11) {
|
|
33193
|
+
formatedPhone = cleanPhone.replace(/(\d{2})?(\d{5})?(\d{4})/, '($1) $2-$3');
|
|
33194
|
+
}
|
|
33195
|
+
else if (cleanPhone.length === 10) {
|
|
33196
|
+
formatedPhone = cleanPhone.replace(/(\d{2})?(\d{4})?(\d{4})/, '($1) $2-$3');
|
|
33197
|
+
}
|
|
33198
|
+
else if (cleanPhone.length === 9) {
|
|
33199
|
+
formatedPhone = cleanPhone.replace(/(\d{5})?(\d{4})/, '$1-$2');
|
|
33200
|
+
}
|
|
33201
|
+
else if (cleanPhone.length === 8) {
|
|
33202
|
+
formatedPhone = cleanPhone.replace(/(\d{4})?(\d{4})/, '$1-$2');
|
|
33203
|
+
}
|
|
33204
|
+
else if (cleanPhone.length === 7) {
|
|
33205
|
+
formatedPhone = cleanPhone.replace(/(\d{3})?(\d{4})/, '$1-$2');
|
|
33206
|
+
}
|
|
33207
|
+
else {
|
|
33208
|
+
formatedPhone = cleanPhone;
|
|
33209
|
+
}
|
|
33210
|
+
return formatedPhone;
|
|
33211
|
+
};
|
|
33212
|
+
|
|
33213
|
+
class RdsitePhoneModalDirective {
|
|
33214
|
+
constructor(modalService, platformId, element, phoneService) {
|
|
33215
|
+
this.modalService = modalService;
|
|
33216
|
+
this.platformId = platformId;
|
|
33217
|
+
this.element = element;
|
|
33218
|
+
this.phoneService = phoneService;
|
|
33219
|
+
this.rdsitephonemodal = null;
|
|
33220
|
+
this.allowedTags = ['A', 'CURA-BUTTON', 'CURA-BUTTON-OUTLINE', 'CURA-BUTTON-TRANSPARENT'];
|
|
33221
|
+
}
|
|
33222
|
+
// Intercepta cliques em telefones e aplica comportamentos diferentes em tamanho desktop.
|
|
33223
|
+
onClick(event) {
|
|
33224
|
+
if (!isPlatformBrowser(this.platformId) || !this.allowedTags.includes(this.element?.nativeElement?.tagName) || !this.phoneService.phoneModalIsAllowed)
|
|
33225
|
+
return;
|
|
33226
|
+
const href = this.element?.nativeElement?.getAttribute('href') ?? '';
|
|
33227
|
+
if (this.phoneService.isPhoneModal(href)) {
|
|
33228
|
+
this.openPhoneModal(event, href);
|
|
33229
|
+
}
|
|
33230
|
+
}
|
|
33231
|
+
openPhoneModal(event, href) {
|
|
33232
|
+
event.preventDefault();
|
|
33233
|
+
event.stopPropagation();
|
|
33234
|
+
this.modalService.setContent(this.rdsitephonemodal || this.modalService.defaultPhoneModal, { phone: formatPhone(href) });
|
|
33235
|
+
this.modalService.setStyle(RdsiteModalComponentStyle.DEFAULT);
|
|
33236
|
+
this.modalService.open();
|
|
33237
|
+
}
|
|
33238
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdsitePhoneModalDirective, deps: [{ token: ModalService }, { token: PLATFORM_ID }, { token: i0.ElementRef }, { token: PhoneService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
33239
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.11", type: RdsitePhoneModalDirective, isStandalone: true, selector: "[rdsitephonemodal]", inputs: { rdsitephonemodal: "rdsitephonemodal" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 }); }
|
|
33240
|
+
}
|
|
33241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdsitePhoneModalDirective, decorators: [{
|
|
33242
|
+
type: Directive,
|
|
33243
|
+
args: [{
|
|
33244
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
33245
|
+
selector: '[rdsitephonemodal]',
|
|
33246
|
+
standalone: true,
|
|
33247
|
+
}]
|
|
33248
|
+
}], ctorParameters: () => [{ type: ModalService }, { type: undefined, decorators: [{
|
|
33249
|
+
type: Inject,
|
|
33250
|
+
args: [PLATFORM_ID]
|
|
33251
|
+
}] }, { type: i0.ElementRef }, { type: PhoneService }], propDecorators: { rdsitephonemodal: [{
|
|
33252
|
+
type: Input
|
|
33253
|
+
}], onClick: [{
|
|
33254
|
+
type: HostListener,
|
|
33255
|
+
args: ['click', ['$event']]
|
|
33256
|
+
}] } });
|
|
33257
|
+
|
|
33258
|
+
class RdsiteLinkDirective {
|
|
33259
|
+
constructor(router, platformId, document, libConfig, element, phoneService, rdsitePhoneModalDirective) {
|
|
33260
|
+
this.router = router;
|
|
33261
|
+
this.platformId = platformId;
|
|
33262
|
+
this.document = document;
|
|
33263
|
+
this.libConfig = libConfig;
|
|
33264
|
+
this.element = element;
|
|
33265
|
+
this.phoneService = phoneService;
|
|
33266
|
+
this.rdsitePhoneModalDirective = rdsitePhoneModalDirective;
|
|
33267
|
+
this.externalRegex = /^http:|https:|tel:|www\.|mailto:/;
|
|
33268
|
+
this.telRegex = /tel:/;
|
|
33269
|
+
this.siteUrlList = ['rededorsaoluiz', 'rededorlabs'];
|
|
33270
|
+
this.allowedTags = ['A', 'CURA-BUTTON', 'CURA-BUTTON-OUTLINE', 'CURA-BUTTON-TRANSPARENT'];
|
|
33271
|
+
this.anchorAdjustment = null;
|
|
33272
|
+
this.phonemodal = null;
|
|
33273
|
+
}
|
|
33274
|
+
onClick(event) {
|
|
33275
|
+
event.preventDefault();
|
|
33276
|
+
if (!isPlatformBrowser(this.platformId) || !this.allowedTags.includes(this.element?.nativeElement?.tagName))
|
|
33277
|
+
return;
|
|
33278
|
+
const href = this.element?.nativeElement?.getAttribute('href') ?? '';
|
|
33279
|
+
if (this.isPhone(href)) {
|
|
33280
|
+
this.phoneClicked({
|
|
33281
|
+
href,
|
|
33282
|
+
event,
|
|
33283
|
+
element: this.element,
|
|
33284
|
+
phonemodal: this.phonemodal,
|
|
33285
|
+
});
|
|
33286
|
+
}
|
|
33287
|
+
else if (this.isExternalUrl(href)) {
|
|
33288
|
+
const target = this.isSiteUrl(href) ? '_self' : '_blank';
|
|
33289
|
+
window.open(href, target);
|
|
33290
|
+
}
|
|
33291
|
+
else if (href.startsWith('#')) {
|
|
33292
|
+
this.scrollToAnchor(href);
|
|
33293
|
+
}
|
|
33294
|
+
else {
|
|
33295
|
+
this.navigateTo(href);
|
|
33296
|
+
}
|
|
33297
|
+
}
|
|
33298
|
+
isPhone(href) {
|
|
33299
|
+
return this.telRegex.test(href);
|
|
33300
|
+
}
|
|
33301
|
+
phoneClicked(value) {
|
|
33302
|
+
const { href, event, element, phonemodal } = value;
|
|
33303
|
+
if (this.phoneService.isPhoneModal(href)) {
|
|
33304
|
+
if (this.phoneService.isConsultaOuExame(element?.nativeElement?.getAttribute('title'))) {
|
|
33305
|
+
this.rdsitePhoneModalDirective.rdsitephonemodal = phonemodal ?? null;
|
|
33306
|
+
}
|
|
33307
|
+
this.rdsitePhoneModalDirective.openPhoneModal(event, href);
|
|
33308
|
+
}
|
|
33309
|
+
else {
|
|
33310
|
+
window.open(href, '_blank');
|
|
33311
|
+
}
|
|
33312
|
+
}
|
|
33313
|
+
isExternalUrl(href) {
|
|
33314
|
+
return this.externalRegex.test(href);
|
|
33315
|
+
}
|
|
33316
|
+
isSiteUrl(href) {
|
|
33317
|
+
const exception = '/paciente';
|
|
33318
|
+
return this.siteUrlList.find((url) => href.includes(url) && !href.includes(exception));
|
|
33319
|
+
}
|
|
33320
|
+
scrollToAnchor(href) {
|
|
33321
|
+
if (href === '#')
|
|
33322
|
+
return;
|
|
33323
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
33324
|
+
const docElement = this.document.documentElement;
|
|
33325
|
+
let adjustment = 0;
|
|
33326
|
+
if (this.libConfig.customAnchorAdjustment) {
|
|
33327
|
+
adjustment = this.libConfig.customAnchorAdjustment(this.document);
|
|
33328
|
+
}
|
|
33329
|
+
if (this.anchorAdjustment) {
|
|
33330
|
+
adjustment = this.anchorAdjustment;
|
|
33331
|
+
}
|
|
33332
|
+
const bodyTop = this.document?.body?.getBoundingClientRect()?.top ?? 0;
|
|
33333
|
+
const hrefTop = this.document?.querySelector(href)?.getBoundingClientRect()?.top ?? 0;
|
|
33334
|
+
const scrollTop = bodyTop * -1 + hrefTop - adjustment;
|
|
33335
|
+
docElement.scrollTo({ top: scrollTop, behavior: 'smooth' });
|
|
33336
|
+
}
|
|
33337
|
+
}
|
|
33338
|
+
navigateTo(href) {
|
|
33339
|
+
const siteBasePath = this.libConfig.siteSufix ?? '';
|
|
33340
|
+
const noBaseHref = href.includes(siteBasePath) ? href.replace(siteBasePath, '') : href;
|
|
33341
|
+
const [path, query] = noBaseHref.split('?');
|
|
33342
|
+
const queryParams = {};
|
|
33343
|
+
if (query) {
|
|
33344
|
+
const queryArray = query.split('&');
|
|
33345
|
+
queryArray.forEach((q) => {
|
|
33346
|
+
const arr = q.split('=');
|
|
33347
|
+
queryParams[arr[0]] = arr[1];
|
|
33348
|
+
});
|
|
33349
|
+
}
|
|
33350
|
+
this.router.navigate([path], { queryParams: queryParams });
|
|
33351
|
+
}
|
|
33352
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdsiteLinkDirective, deps: [{ token: i1$2.Router }, { token: PLATFORM_ID }, { token: DOCUMENT }, { token: LIB_CONFIG }, { token: i0.ElementRef }, { token: PhoneService }, { token: RdsitePhoneModalDirective }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
33353
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.11", type: RdsiteLinkDirective, isStandalone: true, selector: "[rdsitelink]", inputs: { anchorAdjustment: "anchorAdjustment", phonemodal: "phonemodal" }, host: { listeners: { "click": "onClick($event)" } }, providers: [RdsitePhoneModalDirective], ngImport: i0 }); }
|
|
33354
|
+
}
|
|
33355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: RdsiteLinkDirective, decorators: [{
|
|
33356
|
+
type: Directive,
|
|
33357
|
+
args: [{
|
|
33358
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
33359
|
+
selector: '[rdsitelink]',
|
|
33360
|
+
providers: [RdsitePhoneModalDirective],
|
|
33361
|
+
standalone: true,
|
|
33362
|
+
}]
|
|
33363
|
+
}], ctorParameters: () => [{ type: i1$2.Router }, { type: undefined, decorators: [{
|
|
33364
|
+
type: Inject,
|
|
33365
|
+
args: [PLATFORM_ID]
|
|
33366
|
+
}] }, { type: Document, decorators: [{
|
|
33367
|
+
type: Inject,
|
|
33368
|
+
args: [DOCUMENT]
|
|
33369
|
+
}] }, { type: undefined, decorators: [{
|
|
33370
|
+
type: Inject,
|
|
33371
|
+
args: [LIB_CONFIG]
|
|
33372
|
+
}] }, { type: i0.ElementRef }, { type: PhoneService }, { type: RdsitePhoneModalDirective }], propDecorators: { anchorAdjustment: [{
|
|
33373
|
+
type: Input
|
|
33374
|
+
}], phonemodal: [{
|
|
33375
|
+
type: Input
|
|
33376
|
+
}], onClick: [{
|
|
33377
|
+
type: HostListener,
|
|
33378
|
+
args: ['click', ['$event']]
|
|
33379
|
+
}] } });
|
|
33380
|
+
|
|
33381
|
+
class PhonePipe {
|
|
33382
|
+
transform(phone) {
|
|
33383
|
+
return formatPhone(phone);
|
|
33384
|
+
}
|
|
33385
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PhonePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
33386
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: PhonePipe, isStandalone: true, name: "phone" }); }
|
|
33387
|
+
}
|
|
33388
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: PhonePipe, decorators: [{
|
|
33389
|
+
type: Pipe,
|
|
33390
|
+
args: [{
|
|
33391
|
+
name: 'phone',
|
|
33392
|
+
standalone: true,
|
|
33393
|
+
}]
|
|
33394
|
+
}] });
|
|
33395
|
+
|
|
33051
33396
|
var Estados;
|
|
33052
33397
|
(function (Estados) {
|
|
33053
33398
|
Estados["AC"] = "Acre";
|
|
@@ -33090,6 +33435,12 @@ var EnumDoencaTaxonomyCat;
|
|
|
33090
33435
|
EnumDoencaTaxonomyCat["SINTOMA"] = "sintomas";
|
|
33091
33436
|
})(EnumDoencaTaxonomyCat || (EnumDoencaTaxonomyCat = {}));
|
|
33092
33437
|
|
|
33438
|
+
var RdsiteModalDrawerComponentStyle;
|
|
33439
|
+
(function (RdsiteModalDrawerComponentStyle) {
|
|
33440
|
+
RdsiteModalDrawerComponentStyle["DEFAULT"] = "default";
|
|
33441
|
+
RdsiteModalDrawerComponentStyle["DRAWERDOCTOR"] = "doctor-card";
|
|
33442
|
+
})(RdsiteModalDrawerComponentStyle || (RdsiteModalDrawerComponentStyle = {}));
|
|
33443
|
+
|
|
33093
33444
|
/*
|
|
33094
33445
|
* Public API Surface of site-front-end-lib
|
|
33095
33446
|
*/
|
|
@@ -33099,5 +33450,5 @@ var EnumDoencaTaxonomyCat;
|
|
|
33099
33450
|
* Generated bundle index. Do not edit.
|
|
33100
33451
|
*/
|
|
33101
33452
|
|
|
33102
|
-
export { AlgoliaService, CuraService, EnumDoencaTaxonomy, EnumDoencaTaxonomyCat, Estados, HttpClientService, IconCuraDefaultType, LIB_CONFIG, LogService, NguCarouselService, REQUEST, RESPONSE, SSR_CURA_API, SeoService, ServerResponseService, SiteBackendService, SsrLoadingService, TestComponent, TransferStateService, getSiteUrl, removeDuplicateObjectsFromArray, removeDuplicateValuesFromArray, removeHtmlTags, toQueryParams };
|
|
33453
|
+
export { AbstractModalComponent, AbstractModalDrawerComponent, AlgoliaService, CuraService, EnumDoencaTaxonomy, EnumDoencaTaxonomyCat, Estados, HttpClientService, IconCuraDefaultType, LIB_CONFIG, LogService, ModalDrawerService, ModalService, NguCarouselService, PhonePipe, PhoneService, REQUEST, RESPONSE, RdsiteLinkDirective, RdsiteModalComponentStyle, RdsiteModalDrawerComponentStyle, RdsitePhoneModalDirective, SSR_CURA_API, SeoService, ServerResponseService, SiteBackendService, SsrLoadingService, TestComponent, TransferStateService, getSiteUrl, removeDuplicateObjectsFromArray, removeDuplicateValuesFromArray, removeHtmlTags, toQueryParams };
|
|
33103
33454
|
//# sourceMappingURL=rededor-site-front-end-lib.mjs.map
|