application-sidebar 1.0.40 → 2.0.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.
@@ -0,0 +1,83 @@
1
+ import { NavMenuItem } from './nav-menu-item';
2
+ export interface RevisedIntelligenceGroupConfig {
3
+ id: string;
4
+ title: string;
5
+ menuIds?: string[];
6
+ routeIds?: string[];
7
+ /**
8
+ * Layout items for this group.
9
+ * - Preferred shorthand: an array of menu id strings, e.g. `["ads_product_360", "amc-platform-web"]`.
10
+ * - Legacy/advanced: full `RevisedGroupMenuConfig` objects with overrides / nested config.
11
+ */
12
+ items?: (RevisedGroupMenuConfig | string)[];
13
+ }
14
+ export interface RevisedGroupMenuConfig {
15
+ menuId: string;
16
+ title?: string;
17
+ badge?: string | null;
18
+ /**
19
+ * Declarative nested nodes (resolved from `navmenu` by `menuId`).
20
+ * Use for a second expansion level under grouped-menus. Omit to use `childMenuIds` or the menu tree from JSON menus.
21
+ */
22
+ children?: RevisedGroupMenuConfig[];
23
+ /** Pull these top-level menus in as `children` of this row (expandable panel + same chevron behavior as other parents). */
24
+ childMenuIds?: string[];
25
+ includeChildMenuIds?: string[];
26
+ excludeChildMenuIds?: string[];
27
+ }
28
+ export interface RevisedSectionConfig {
29
+ id: string;
30
+ title: string;
31
+ type: 'app-tabs' | 'grouped-menus';
32
+ iconSvg?: string;
33
+ appIds?: string[];
34
+ defaultAppId?: string;
35
+ groups?: RevisedIntelligenceGroupConfig[];
36
+ }
37
+ export interface RevisedNavigationConfig {
38
+ /**
39
+ * Present in `sidebar-layout.json` (S3/local) for CMS or rollout flags.
40
+ * Does **not** choose legacy vs sectioned UI — use `useLegacyNavigation` for that.
41
+ */
42
+ enabled?: boolean;
43
+ /**
44
+ * Host apps: set `true` to render the classic expandable per-app sidebar instead of the sectioned layout.
45
+ * Default is the sectioned (new) layout when omitted.
46
+ */
47
+ useLegacyNavigation?: boolean;
48
+ sections?: RevisedSectionConfig[];
49
+ }
50
+ export interface RevisedNavMenuItem extends NavMenuItem {
51
+ ownerAppId?: string;
52
+ sourceMenuId?: string;
53
+ sourceParentId?: string;
54
+ sourcePath?: string[];
55
+ child_routes?: any[];
56
+ children?: RevisedNavMenuItem[];
57
+ }
58
+ export interface RevisedIntelligenceGroup {
59
+ id: string;
60
+ title: string;
61
+ items: RevisedNavMenuItem[];
62
+ }
63
+ export interface RevisedSectionBase {
64
+ id: string;
65
+ title: string;
66
+ type: 'app-tabs' | 'grouped-menus';
67
+ iconSvg?: string;
68
+ }
69
+ export interface RevisedAppTabsSection extends RevisedSectionBase {
70
+ type: 'app-tabs';
71
+ apps: RevisedNavMenuItem[];
72
+ defaultAppId?: string;
73
+ }
74
+ export interface RevisedGroupedSection extends RevisedSectionBase {
75
+ type: 'grouped-menus';
76
+ groups: RevisedIntelligenceGroup[];
77
+ }
78
+ export type RevisedSection = RevisedAppTabsSection | RevisedGroupedSection;
79
+ export interface RevisedNavigationState {
80
+ sections: RevisedSection[];
81
+ globalSettings: RevisedNavMenuItem[];
82
+ communityLinks: RevisedNavMenuItem[];
83
+ }
@@ -2,6 +2,7 @@ import { RestApiService } from './rest-api.services';
2
2
  import { ActivatedRoute } from '@angular/router';
3
3
  import { UrlContextService } from './url-context.service';
4
4
  import { TranslationService } from './translation.service';
5
+ import { RevisedNavMenuItem, RevisedNavigationState } from '../revised-navigation';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class ApplicationSidebarService {
7
8
  private RestApiService;
@@ -45,6 +46,23 @@ export declare class ApplicationSidebarService {
45
46
  SPONSORED_BRAND_KEYWORD: boolean;
46
47
  };
47
48
  constructor(RestApiService: RestApiService, activatedRoute: ActivatedRoute, translate: TranslationService, urlContextService: UrlContextService);
49
+ /** `true` when the sectioned (new) sidebar should render — default unless host sets `useLegacyNavigation`. */
50
+ isRevisedNavigationEnabled(appDetails?: any): boolean;
51
+ /** `true` when the host requested the classic per-app sidebar via `revisedNavigation.useLegacyNavigation`. */
52
+ isLegacyNavigationEnabled(appDetails?: any): boolean;
53
+ annotateMenusWithSource(menus?: any[]): RevisedNavMenuItem[];
54
+ buildRevisedNavigationState(appDetails: any, appMenus?: any[], globalSettingsMenus?: any[], communityLinks?: any[]): RevisedNavigationState;
55
+ findRevisedMenuById(menuList: RevisedNavMenuItem[], menuId: string): RevisedNavMenuItem;
56
+ findFirstNavigableMenu(menuList?: RevisedNavMenuItem[]): RevisedNavMenuItem;
57
+ private buildRevisedIntelligenceGroups;
58
+ private buildRevisedSections;
59
+ private collectIntelligenceItems;
60
+ private resolveConfiguredGroupItem;
61
+ private filterConfiguredChildren;
62
+ private walkMenus;
63
+ private filterOptimizeApps;
64
+ private annotateMenuTree;
65
+ private cloneMenus;
48
66
  getTypeStatusConfigs(): {
49
67
  SPONSORED_KEYWORD_BIDS: boolean;
50
68
  SPONSORED_PRODUCT_MANUAL_TARGETING_BIDS: boolean;
@@ -67,7 +85,27 @@ export declare class ApplicationSidebarService {
67
85
  COMPETITOR_PRODUCT: boolean;
68
86
  SPONSORED_BRAND_KEYWORD: boolean;
69
87
  };
88
+ /**
89
+ * Optional merge: replace current app’s `children` from `appDetails.listMenus`.
90
+ * Only runs when `listMenus` is a **non-empty** array (empty `[]` is ignored so we don’t wipe menus).
91
+ * Account-based visibility is applied separately and does **not** depend on this flag.
92
+ */
93
+ private hasNonEmptyListMenusMerge;
70
94
  constructChildMenus(menuItems: any): any;
95
+ /** Top-level app id for “Sponsored Ads” in `navmenu` — only this app uses `all_accounts` visibility below. */
96
+ private static readonly SPONSORED_ADS_APP_ID;
97
+ /**
98
+ * Sponsored Ads only — parity with AngularJS `NavMenuService.constructChildMenus` in intentwise-platform-web
99
+ * `src/app/layouts/leftsidenav/leftsidenav.service.js`:
100
+ * - No `currentAccount`: keep only children with `all_accounts === true` (e.g. All Accounts, Signup Overview).
101
+ * - With `currentAccount`: keep only children where `all_accounts` is not truthy (account-scoped items).
102
+ *
103
+ * Applied in `getMenuList` (after optional `constructChildMenus` merge) for `ads_amazon_advertising` only, independent of `listMenus`.
104
+ */
105
+ private filterChildrenByAllAccountsContext;
106
+ private applyAllAccountsVisibilityToAppMenus;
107
+ /** Global Settings: no account → only Account Management (`global_account_mgmt`), same as AngularJS. */
108
+ private trimGlobalSettingsChildrenWhenNoAccount;
71
109
  getMenuList(appDetails: any, menulists: any): any[];
72
110
  getApplicationMenuItem(currentMenuItem: any): any;
73
111
  getGlobalSettingsMenu(appDetails: any, menulists: any): any[];
@@ -100,12 +138,22 @@ export declare class ApplicationSidebarService {
100
138
  checkForvisibilityRolesNotIn(possibleValues: any): boolean;
101
139
  checkForHiddenUserRole(possibleValues: any): boolean;
102
140
  disableForOrgwithReadOnly(possibleValues: any): boolean;
141
+ /**
142
+ * Nav JSON shape for legacy AngularJS admin screens: `link` is the ui-router state prefix (`triangular.*`)
143
+ * and `route` is the hash URL (`#!/...`). Cross-app clicks (e.g. User Access from Walmart) must use `route`
144
+ * plus current `appId`, not `origin/triangular....`.
145
+ * Does not match test fixtures that swap route/link for triangular vs hash.
146
+ */
147
+ shouldUseHashRouteForCrossAppHostNav(menu: {
148
+ route?: string;
149
+ link?: string;
150
+ }): boolean;
103
151
  getHostOriginAndNavigate(route: any, applicationId?: any): void;
104
152
  fetchKeyValue(key: string): any;
105
153
  setActiveRecoCount(count: number): void;
106
154
  isHavingAnyActiveSubs(id: any, subs: any, type: any): boolean;
107
155
  checkSubscriptionActive(subs: any, accType: any, subType: any): boolean;
108
- getApplicationID(): "ads_amazon_content_content_analytics" | "ads_amazon_content_share_of_voice";
156
+ getApplicationID(): "ads_amazon_content_share_of_voice" | "ads_amazon_content_content_analytics";
109
157
  static ɵfac: i0.ɵɵFactoryDeclaration<ApplicationSidebarService, never>;
110
158
  static ɵprov: i0.ɵɵInjectableDeclaration<ApplicationSidebarService>;
111
159
  }
@@ -11,10 +11,22 @@ export declare class RestApiService {
11
11
  private httpOptions;
12
12
  isStructerApiCalled: boolean;
13
13
  constructor(http: HttpClient, cookie: CookieService);
14
+ get menuBucketBaseURL(): string;
14
15
  get menuDownloadURL(): string;
16
+ get sidebarLayoutDownloadURL(): string;
17
+ /**
18
+ * True when using bundled menu + sidebar layout from the repo instead of S3:
19
+ * - `localhost` (Angular dev server)
20
+ * - `apptest.intentwise.com`
21
+ *
22
+ * Not tied to `useProd` — that flag only affects REST `baseURL` / DSP URLs in the constructor,
23
+ * so you can point at prod APIs while still loading nav + layout from the bundle.
24
+ */
25
+ get isLocalMenuSource(): boolean;
15
26
  getRecommendationData(orgId: any, businessId: any, accountId: any): Observable<any>;
16
27
  getStructureAPISupportData(organizationId: string, businessGroupId: string, amsAccountId: string): Observable<any>;
17
28
  getjsonMenulists(applicationDetails: any): Observable<any>;
29
+ getSidebarLayoutConfig(): Observable<any>;
18
30
  static ɵfac: i0.ɵɵFactoryDeclaration<RestApiService, never>;
19
31
  static ɵprov: i0.ɵɵInjectableDeclaration<RestApiService>;
20
32
  }
@@ -0,0 +1,19 @@
1
+ import { RevisedNavigationConfig } from './revised-navigation';
2
+ /**
3
+ * Bundled fallback for `sidebar-layout.json` when the S3 request fails (network, CORS, 4xx/5xx).
4
+ * `RestApiService` always loads from S3 first (`menuBucketBaseURL/sidebar-layout.json`), then falls back here.
5
+ * Edit this file to match `ui-resources/sidebar-layout.json` or to ship a safe default in the bundle.
6
+ *
7
+ * ## Shape (grouped-menus, non-Optimize)
8
+ * - **Sections/groups decide structure, nav JSON decides labels.**
9
+ * - `groups[]`: each block is a **titled** group (`id` + `title` + `items`) or **untitled** flat list (`title` omitted).
10
+ * - Each `items[]` entry: `{ "menuId": "<id from navmenu1>" }`
11
+ * - We **do not** override leaf titles here; names come from `navmenu1` (+ translations).
12
+ * - **Leaf** (no children in nav JSON): one row link.
13
+ * - **Expandable** (menu has `children` in navmenu1): one `mat-expansion-panel` row; children render as links (or a second panel if you use `children` below).
14
+ * - Optional **`children`** / `childMenuIds` / `includeChildMenuIds` are still supported for advanced cases; see `RevisedGroupMenuConfig`.
15
+ * - Group size is dynamic:
16
+ * - `items.length === 1` → rendered as a **single row** under the group title (e.g. Product 360 today).
17
+ * - `items.length > 1` → rendered as a **titled, expandable group** (e.g. Commerce Insights), with one row per item.
18
+ */
19
+ export declare const LOCAL_SIDEBAR_LAYOUT: RevisedNavigationConfig;
@@ -1,46 +1,36 @@
1
1
  export declare const EN_LABELS: {
2
2
  AMAZON_SPONSORED_ADS: string;
3
- INTENTWISE_ANALYTICS_CLOUD: string;
4
- INTENTWISE_EXPLORE: string;
5
- ANALYTICS_CLOUD: string;
6
- EXPLORE: string;
7
- SHARE_OF_VOICE: string;
8
- CONTENT_ANALYTICS: string;
9
3
  AMAZON_DSP: string;
10
- WALMART: string;
11
- CRITEO: string;
12
- INSTACART: string;
13
4
  AMAZON_ATTRIBUTION: string;
14
5
  AMAZON_VENDOR_CENTRAL: string;
15
6
  AMAZON_SELLER_CENTRAL: string;
16
- GLOBAL_SETTINGS: string;
17
- AMAZON_SELLER_ANALYTICS: string;
18
- AMAZON_VENDOR_ANALYTICS: string;
19
- GETTING_STARTED: string;
20
- QUERIES: string;
21
- QUERY_RESULTS: string;
22
- AUDIENCES: string;
23
- INSIGHTS: string;
24
- INSTANCES: string;
25
- DASHBOARD_TEMPLATES: string;
26
- MY_CONNECTIONS: string;
27
- ANALYTICS_LAB: string;
28
- SYSTEM_HEALTH: string;
29
- ACCOUNT_MANAGEMENT: string;
30
- BRAND_TERMS: string;
31
- LABELS: string;
32
- SUB_BRANDS: string;
33
- PRODUCT_META_DATA: string;
7
+ SHARE_OF_VOICE: string;
8
+ CONTENT_ANALYTICS: string;
9
+ INTENTWISE_ANALYTICS_CLOUD: string;
10
+ INTENTWISE_EXPLORE: string;
11
+ CRITEO: string;
12
+ INSTACART: string;
13
+ WALMART: string;
34
14
  SELLER_ANALYTICS_APP: string;
35
15
  VENDOR_ANALYTICS_APP: string;
16
+ SHOPIFY: string;
17
+ GOOGLE_ADS: string;
18
+ TIKTOK_SHOP: string;
19
+ META_ADS: string;
36
20
  HOURLY_METRICS: string;
37
21
  SPONSORED_PRODUCTS: string;
38
22
  SPONSORED_BRANDS: string;
39
23
  SPONSORED_DISPLAY: string;
40
24
  CUSTOM_REPORTS: string;
41
25
  INVENTORY_OVERVIEW: string;
26
+ AMC_INSIGHTS_MENU: string;
27
+ INSIGHTS: string;
42
28
  WHAT_CHANGED: string;
29
+ AUDITS: string;
30
+ MARKET_SHARE_BY_SQP: string;
31
+ PRODUCT_360: string;
43
32
  SETTINGS: string;
33
+ GLOBAL_SETTINGS: string;
44
34
  ALL_ACCOUNTS: string;
45
35
  USER_SETTINGS: string;
46
36
  OVERVIEW: string;
@@ -48,6 +38,7 @@ export declare const EN_LABELS: {
48
38
  CAMPAIGNS: string;
49
39
  AD_GROUPS: string;
50
40
  KEYWORDS: string;
41
+ TARGETING: string;
51
42
  PRODUCT_TARGETING: string;
52
43
  PRODUCTS: string;
53
44
  SEARCH_TERMS: string;
@@ -85,6 +76,41 @@ export declare const EN_LABELS: {
85
76
  AUTOMATED_RULES: string;
86
77
  CHANGE_HISTORY: string;
87
78
  MONTHLY_BUDGET: string;
79
+ BUDGET_MANAGEMENT: string;
80
+ ACCOUNT_MANAGEMENT: string;
81
+ BRAND_TERMS: string;
82
+ LABELS: string;
83
+ SUB_BRANDS: string;
88
84
  CUSTOM_PRODUCT_ATTRIBUTES: string;
89
85
  PRODUCT_COSTS: string;
86
+ PRODUCT_META_DATA: string;
87
+ LOGIN: string;
88
+ AUTHENTICATING: string;
89
+ ENTER_YOUR_PASSWORD: string;
90
+ TERMS_AND_CONDITONS: string;
91
+ PRIVACY_POLICY: string;
92
+ RESET_YOUR_PASSWORD: string;
93
+ RESET_YOUR_PASSWORD_QUESTION: string;
94
+ YOUR_EMAIL: string;
95
+ RESET_PASSWORD: string;
96
+ REMEMBER_THEN_LOGIN_HERE: string;
97
+ ROLL_UP: string;
98
+ SHOW_CHART: string;
99
+ HIDE_CHART: string;
100
+ BY_LABEL: string;
101
+ TODAY: string;
102
+ YESTERDAY: string;
103
+ LAST_7_DAYS: string;
104
+ LAST_14_DAYS: string;
105
+ LAST_30_DAYS: string;
106
+ LAST_60_DAYS: string;
107
+ LAST_90_DAYS: string;
108
+ LAST_120_DAYS: string;
109
+ CURRENT_MONTH: string;
110
+ PREVIOUS_MONTH: string;
111
+ CURRENT_WEEK: string;
112
+ PREVIOUS_WEEK: string;
113
+ YEAR_TO_DATE: string;
114
+ CUSTOM: string;
115
+ COMPARE: string;
90
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "application-sidebar",
3
- "version": "1.0.40",
3
+ "version": "2.0.0",
4
4
  "main": "src/lib/application-sidebar.componenent.ts",
5
5
  "description": "Generate navigation menus based on the application details",
6
6
  "author": "Intentwise",
package/public-api.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './lib/services/application-sidebar.service';
2
2
  export * from './lib/application-sidebar.component';
3
3
  export * from './lib/application-sidebar.module';
4
+ export * from './lib/revised-navigation';