ng-easycommerce 0.0.655-beta.1 → 0.0.655

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +1 -1
  2. package/bundles/ng-easycommerce.umd.js +741 -376
  3. package/bundles/ng-easycommerce.umd.js.map +1 -1
  4. package/bundles/ng-easycommerce.umd.min.js +1 -1
  5. package/bundles/ng-easycommerce.umd.min.js.map +1 -1
  6. package/esm2015/lib/ec-component/footer-ec/footer-ec.component.js +174 -5
  7. package/esm2015/lib/ec-component/widgets-ec/price-ec/price-ec.component.js +3 -3
  8. package/esm2015/lib/interfaces/footer.types.js +1 -0
  9. package/esm2015/lib/services/footer/footer.adapters.js +72 -0
  10. package/esm2015/lib/services/footer/footer.pick.js +8 -0
  11. package/esm2015/lib/services/footer/footer.service.js +115 -0
  12. package/esm2015/public-api.js +4 -1
  13. package/esm5/lib/ec-component/footer-ec/footer-ec.component.js +174 -5
  14. package/esm5/lib/ec-component/widgets-ec/price-ec/price-ec.component.js +3 -3
  15. package/esm5/lib/interfaces/footer.types.js +1 -0
  16. package/esm5/lib/services/footer/footer.adapters.js +73 -0
  17. package/esm5/lib/services/footer/footer.pick.js +8 -0
  18. package/esm5/lib/services/footer/footer.service.js +123 -0
  19. package/esm5/public-api.js +4 -1
  20. package/fesm2015/ng-easycommerce.js +726 -378
  21. package/fesm2015/ng-easycommerce.js.map +1 -1
  22. package/fesm5/ng-easycommerce.js +736 -379
  23. package/fesm5/ng-easycommerce.js.map +1 -1
  24. package/lib/ec-component/footer-ec/footer-ec.component.d.ts +58 -1
  25. package/lib/interfaces/footer.types.d.ts +96 -0
  26. package/lib/services/footer/footer.adapters.d.ts +24 -0
  27. package/lib/services/footer/footer.pick.d.ts +3 -0
  28. package/lib/services/footer/footer.service.d.ts +28 -0
  29. package/ng-easycommerce.metadata.json +1 -1
  30. package/package.json +1 -1
  31. package/public-api.d.ts +4 -0
@@ -4,10 +4,18 @@ import { Constants } from '../../core.consts';
4
4
  import { Menu } from '../../interfaces/navbar-items';
5
5
  import { OptionsService } from '../../services/options.service';
6
6
  import { ParametersService } from '../../services/parameters.service';
7
+ import { Observable } from 'rxjs';
8
+ import { FooterColumnView, FooterExtrasView } from '../../interfaces/footer.types';
9
+ import { toHref, toText } from '../../services/footer/footer.adapters';
10
+ import { FooterService } from '../../services/footer/footer.service';
11
+ import { Router } from '@angular/router';
7
12
  export declare class FooterEcComponent extends ComponentHelper implements OnInit {
8
13
  protected optionsService: OptionsService;
9
14
  paramsService: ParametersService;
10
15
  protected consts: Constants;
16
+ private footerService;
17
+ router: Router;
18
+ private platformId;
11
19
  menuItemsCategories: Menu[];
12
20
  menuItemsSections: Menu[];
13
21
  menuItemsAttributes: Menu[];
@@ -16,8 +24,15 @@ export declare class FooterEcComponent extends ComponentHelper implements OnInit
16
24
  attributes: any[];
17
25
  mediaUrl: string;
18
26
  params: any;
19
- constructor(optionsService: OptionsService, paramsService: ParametersService, consts: Constants);
27
+ /** Columns provenientes del endpoint */
28
+ columns$: Observable<FooterColumnView[]>;
29
+ extras$: Observable<FooterExtrasView | {}>;
30
+ private deviceSub?;
31
+ toHref: typeof toHref;
32
+ toText: typeof toText;
33
+ constructor(optionsService: OptionsService, paramsService: ParametersService, consts: Constants, footerService: FooterService, router: Router, platformId: Object);
20
34
  ngOnInit(): void;
35
+ private getDevice;
21
36
  protected updateCategories: (categories: any) => void;
22
37
  protected updateAttributes: (attributes: any) => void;
23
38
  protected updateMenuItem: (elements: any) => void;
@@ -27,4 +42,46 @@ export declare class FooterEcComponent extends ComponentHelper implements OnInit
27
42
  ecUpdateMenuItemSection: (menuItems: any) => any;
28
43
  ecUpdateMenuItemCategories: (menuItems: any) => any;
29
44
  ecUpdateMenuItemAttributes: (menuItems: any) => any;
45
+ isImageUrl(v?: string): boolean;
46
+ absOrMedia(v: string): string;
47
+ paramValue(it: any): string;
48
+ paramImagePath(it: any): string;
49
+ isImageParam(it: any): boolean;
50
+ sectionPages(item: any): {
51
+ code: string;
52
+ slug: string;
53
+ name: string;
54
+ enabled: boolean;
55
+ }[];
56
+ sectionHasPages(item: any): boolean;
57
+ sectionPageText(page: {
58
+ name: string | null;
59
+ code: string | null;
60
+ }): string;
61
+ sectionPageHref(page: {
62
+ code: string | null;
63
+ }): string;
64
+ logoUrl(extras: any): string;
65
+ legalHtml(extras: any): string;
66
+ fiscalQrUrl(extras: any): string;
67
+ whatsappFloating(extras: any): {
68
+ enabled: boolean;
69
+ url: string;
70
+ imageUrl: string;
71
+ };
72
+ styleFor(it: any): {
73
+ 'font-weight': number;
74
+ 'font-style': string;
75
+ 'text-decoration': string;
76
+ 'font-size.px': any;
77
+ };
78
+ isInternalUrl(url?: string): boolean;
79
+ makeAbsolute(url: string): string;
80
+ openLink(ev: MouseEvent, url: string | null | undefined, target: 'same_tab' | 'new_tab' | 'new_window'): void;
81
+ trackById: (_: number, it: {
82
+ id?: number;
83
+ }) => number;
84
+ trackByPos: (_: number, it: {
85
+ position?: number;
86
+ }) => number;
30
87
  }
@@ -0,0 +1,96 @@
1
+ export declare type DisplayMode = 'both' | 'desktop' | 'mobile';
2
+ export declare type FooterItemType = 'url' | 'section' | 'category' | 'parameter' | 'text';
3
+ export declare type LinkTarget = 'same_tab' | 'new_tab' | 'new_window';
4
+ export interface FooterView {
5
+ channel: string;
6
+ footer: {
7
+ id: number;
8
+ name: string;
9
+ displayMode: DisplayMode;
10
+ };
11
+ columns: FooterColumnView[];
12
+ extras?: FooterExtrasView | null;
13
+ generated_at: string;
14
+ }
15
+ export interface FooterExtrasView {
16
+ logo?: {
17
+ image?: {
18
+ path: string;
19
+ alt?: string | null;
20
+ };
21
+ } | null;
22
+ legal?: {
23
+ html: string;
24
+ } | null;
25
+ fiscalQr?: {
26
+ image?: {
27
+ path: string;
28
+ alt?: string | null;
29
+ };
30
+ } | null;
31
+ whatsappFloating?: {
32
+ url?: string | null;
33
+ image?: {
34
+ path: string;
35
+ alt?: string | null;
36
+ } | null;
37
+ enabled?: boolean;
38
+ } | null;
39
+ }
40
+ export interface FooterColumnView {
41
+ id: number;
42
+ name: string | null;
43
+ position: number;
44
+ items: FooterItemView[];
45
+ }
46
+ export interface FooterItemView {
47
+ id: number;
48
+ type: FooterItemType;
49
+ label: string | null;
50
+ style: {
51
+ bold: boolean;
52
+ italic: boolean;
53
+ underline: boolean;
54
+ fontSize: number | null;
55
+ };
56
+ target: LinkTarget;
57
+ position: number;
58
+ link: FooterItemLink;
59
+ }
60
+ export declare type FooterItemLink = {
61
+ type: 'url';
62
+ url: string;
63
+ } | {
64
+ type: 'section';
65
+ section: {
66
+ id: number;
67
+ code: string;
68
+ name: string | null;
69
+ } | null;
70
+ /** NUEVO: contenido mínimo de la sección que enviamos desde backend */
71
+ content?: {
72
+ pages: Array<{
73
+ code: string | null;
74
+ slug: string | null;
75
+ name: string | null;
76
+ enabled: boolean | null;
77
+ }>;
78
+ } | null;
79
+ } | {
80
+ type: 'category';
81
+ category: {
82
+ id: number;
83
+ code: string | null;
84
+ slug: string | null;
85
+ name: string | null;
86
+ } | null;
87
+ } | {
88
+ type: 'parameter';
89
+ parameter: {
90
+ id: number;
91
+ code: string | null;
92
+ value: string | null;
93
+ } | null;
94
+ } | {
95
+ type: 'text';
96
+ };
@@ -0,0 +1,24 @@
1
+ import { FooterItemView } from "../../interfaces/footer.types";
2
+ export declare function toHref(item: FooterItemView): string;
3
+ export declare function toText(item: FooterItemView): string;
4
+ /** Devuelve el array de páginas de una sección (puede ser []). */
5
+ export declare function getSectionPages(item: FooterItemView): {
6
+ code: string;
7
+ slug: string;
8
+ name: string;
9
+ enabled: boolean;
10
+ }[];
11
+ /** Helper para saber si una sección trae al menos una página habilitada (o cualquiera si no validás enabled). */
12
+ export declare function hasSectionPages(item: FooterItemView, onlyEnabled?: boolean): boolean;
13
+ /**
14
+ * Arma el href de UNA página de sección.
15
+ * @param item FooterItemView de tipo 'section'
16
+ * @param pageCode code de la página (obligatorio)
17
+ * @param sectionsBase base que te da consts.getSectionsRoute(), ej: 'section/' o '/section/'
18
+ */
19
+ export declare function toSectionPageHref(item: FooterItemView, pageCode: string | null | undefined, sectionsBase: string): string;
20
+ /** Texto a mostrar para la página (fallback name -> code). */
21
+ export declare function toSectionPageText(page: {
22
+ name: string | null;
23
+ code: string | null;
24
+ }): string;
@@ -0,0 +1,3 @@
1
+ import { FooterView } from "../../interfaces/footer.types";
2
+ export declare type DeviceKind = 'desktop' | 'mobile';
3
+ export declare function pickFooterForDevice(footers: FooterView[], device: DeviceKind): FooterView | null;
@@ -0,0 +1,28 @@
1
+ import { ConnectionService } from '../../api/connection.service';
2
+ import { Constants } from '../../core.consts';
3
+ import 'rxjs/add/operator/catch';
4
+ import { FooterColumnView, FooterExtrasView } from '../../interfaces/footer.types';
5
+ export declare class FooterService {
6
+ private conn;
7
+ private consts;
8
+ private columnsSubject;
9
+ columns$: import("rxjs").Observable<FooterColumnView[]>;
10
+ private extrasSubject;
11
+ extras$: import("rxjs").Observable<FooterExtrasView>;
12
+ private cachedList;
13
+ private currentDevice;
14
+ private loaded;
15
+ constructor(conn: ConnectionService, consts: Constants);
16
+ footerApi: () => string;
17
+ load(device?: 'desktop' | 'mobile'): void;
18
+ /** Carga UNA SOLA VEZ y cachea todo. Luego aplica según device actual. */
19
+ loadOnce(initialDevice?: 'desktop' | 'mobile'): void;
20
+ /** Cambia el device y re-arma columnas/extras desde el cache (sin API). */
21
+ setDevice(device: 'desktop' | 'mobile'): void;
22
+ /** Recalcula columns/extras para el currentDevice usando el cache. */
23
+ private applyDevice;
24
+ private byPos;
25
+ private getDeviceByWidth;
26
+ private isMobile;
27
+ prefetch(device?: 'desktop' | 'mobile'): Promise<void>;
28
+ }