Skip to content

Commit

Permalink
snowplow track on Share button from detail page and Highlight cards (#…
Browse files Browse the repository at this point in the history
…2147)

* snowplow track on Share button from detail page and Highlight cards

* typo change. Add snowplow to desktop share
  • Loading branch information
yzlucas authored Dec 13, 2024
1 parent bc65168 commit 25f9b88
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
import { Component, Input } from '@angular/core';
import { ProcessedPost } from '../../highlights-widget/highlights-widget.component';
import { snowPlowHelper } from '@app/utils';
import { Router } from '@angular/router';
import { AppConfigService } from '@wf1/core-ui';

@Component({
selector: 'highlights-card',
templateUrl: './highlights-card.component.html',
styleUrls: ['./highlights-card.component.scss']
})
export class HighlightsCardComponent {
@Input() post: ProcessedPost
@Input() post: ProcessedPost;
public snowPlowHelper = snowPlowHelper;

constructor(
private appConfigService: AppConfigService,
private currentRouter: Router
){

}

openLink(link: string){
const url = this.appConfigService.getConfig().application.baseUrl.toString() + this.currentRouter.url.slice(1);

this.snowPlowHelper(url, {
action: 'highlights_card_click',
text: 'Navigate to Highlight Link'
});

if (link) {
window.open(link, '_blank');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { MatDialog } from '@angular/material/dialog';
import { Capacitor, CapacitorHttp } from '@capacitor/core';
import { map } from 'rxjs/operators';
import { Meta, Title } from '@angular/platform-browser';
import { snowPlowHelper } from '@app/utils';

const MAX_CACHE_AGE = 30 * 1000;

export interface Coordinates {
readonly accuracy: number;
readonly altitude: number | null;
Expand All @@ -37,6 +37,7 @@ export interface Position {
providedIn: 'root',
})
export class CommonUtilityService {
snowPlowHelper = snowPlowHelper;
private myLocation;
private locationTime;
private location;
Expand All @@ -53,6 +54,7 @@ export class CommonUtilityService {
private dialog: MatDialog,
private titleService: Title,
private metaService: Meta,
private currentRouter: Router,

) {
setTimeout(() => (this.rofService = injector.get(ReportOfFireService)));
Expand Down Expand Up @@ -363,6 +365,13 @@ export class CommonUtilityService {
}

shareMobile(shareTitle: string) {
const url = this.appConfigService.getConfig().application.baseUrl.toString() + this.currentRouter.url.slice(1);

this.snowPlowHelper(url, {
action: 'share_from_mobile_device',
text: shareTitle
});

const currentUrl = this.appConfigService.getConfig().application.baseUrl.toString() + this.router.url.slice(1);
// contents of the share is out of scope for wfnews-2403. Enhancment should be available in wfnews-2422
const imageUrl = this.appConfigService.getConfig().application.baseUrl.toString() + '/assets/images/share-wildfire.png';
Expand All @@ -381,6 +390,11 @@ export class CommonUtilityService {

openShareWindow(type: string, incidentName: string) {
const url = this.appConfigService.getConfig().application.baseUrl.toString() + this.router.url.slice(1);

this.snowPlowHelper(url, {
action: 'share_from_desktop',
text: `${type}, ${incidentName}`
});
this.dialog.open(ShareDialogComponent, {
panelClass: 'contact-us-dialog',
width: '500px',
Expand Down

0 comments on commit 25f9b88

Please sign in to comment.