Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: sprint 22 deploy to main #250

Merged
merged 62 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
fb0871d
#181 Fix styles of pet-tags/tag-quote and pet-tags/tag-select (#182)
miakobchuk Aug 6, 2024
7ad2286
hotfix for change domain
miakobchuk Aug 7, 2024
4c4d79b
adding additional environment entry to config
miakobchuk Aug 8, 2024
19b96ad
updated trusted site block
miakobchuk Aug 8, 2024
7c16136
Menu links refactoring (#188)
miakobchuk Aug 9, 2024
760d840
PM-361
miakobchuk Aug 13, 2024
ec80ebd
PM-361
miakobchuk Aug 13, 2024
61de609
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Aug 14, 2024
4f3a98a
updated document-based footer
miakobchuk Aug 16, 2024
c646d3a
added x icon for footer
miakobchuk Aug 16, 2024
dd27d15
removed external icon for petmicrochiplookup.org link
miakobchuk Aug 16, 2024
472442a
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Aug 22, 2024
3f7a07e
Merge remote-tracking branch 'refs/remotes/origin/main' into stage
BaDos Aug 30, 2024
433f2fd
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Aug 30, 2024
9b9a03e
Merge remote-tracking branch 'refs/remotes/origin/main' into stage
BaDos Sep 10, 2024
941bf8c
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Sep 10, 2024
ba32c40
24PW: Post Purchase Thank You Page - EDS Build (#201)
hero-dokane Sep 11, 2024
ef8d162
24PW: Post Purchase Thank You Page - EDS Build - QA Feedback Updates …
hero-dokane Sep 12, 2024
dc21b70
24PW: Post Purchase Thank You Page - EDS Build - QA Feedback Updates …
hero-dokane Sep 13, 2024
f155c78
Fixes for the form issues (#205)
BaDos Sep 16, 2024
d06bf4d
Feature/post purchase thank you page (#206)
hero-dokane Sep 16, 2024
9217777
Sync develop into stage (#207)
BaDos Sep 16, 2024
9c7dc18
24PW: Membership V2 Paid Page - EDS Build (#208)
hero-dokane Sep 17, 2024
e386258
24PW: Membership V2 Paid Page - QA Updates (#209)
hero-dokane Sep 17, 2024
9dc8710
Add page /paid/lost-pet-protection (#194)
hero-dokane Sep 18, 2024
1f49990
24PW: Membership V2 Paid Page - QA Updates (#211)
hero-dokane Sep 18, 2024
95c0d6b
Fix config matching (#212)
BaDos Sep 18, 2024
510df5e
Merge remote-tracking branch 'origin/stage' into develop
BaDos Sep 18, 2024
866cd49
24PW: Lost Pet Recovery Paid Page - EDS Build (#210)
hero-dokane Sep 18, 2024
d53e374
Sync develop into stage (#213)
BaDos Sep 18, 2024
909c0f5
Sync develop into stage (#213) (#214)
BaDos Sep 18, 2024
9f26a83
Fix css (#216)
BaDos Sep 25, 2024
510aede
Merge branch 'develop' into stage
fe-lix- Sep 25, 2024
aaec9fa
24PW: New Template - Paid Blog (#219)
hero-dokane Oct 3, 2024
b65b41b
24PW: Pawpack Page - EDS Build (#215)
hero-dokane Oct 3, 2024
c1a242e
Merge remote-tracking branch 'origin/main' into stage
BaDos Oct 3, 2024
68d13c8
Merge remote-tracking branch 'origin/stage' into develop
BaDos Oct 3, 2024
643de65
Added Shipping of Tag to the summary page (#221)
BaDos Oct 4, 2024
316c81e
Sync develop into stage (#220)
hero-dokane Oct 4, 2024
e00a58f
24PW: Pawpack Page - EDS Build - QA Feedback (#222)
hero-dokane Oct 7, 2024
07d5622
Merge branch stage into develop
hero-dokane Oct 7, 2024
31f4da7
WIP on bugfix/mobile-nav-redirect-visibility (#224)
hero-dokane Oct 7, 2024
d533307
Sync develop into stage (#223)
hero-dokane Oct 7, 2024
2392032
24PW: Pet Insurance - Aggregator Widget (#225)
pgilmore-phi Oct 8, 2024
ba35c4d
Revert decorateButtons function, apply callout cta styling (#226)
hero-dokane Oct 8, 2024
d5d7dbe
Sync develop into stage (#227)
hero-dokane Oct 8, 2024
66e50df
Adding thank you page dataLayer object (#230)
pgilmore-phi Oct 11, 2024
1b08b7c
Sync develop into stage (#231)
pgilmore-phi Oct 11, 2024
47026d2
Back sync develop with main (#234)
pgilmore-phi Oct 15, 2024
b99d1fe
Back Sync stage with main (#233)
pgilmore-phi Oct 15, 2024
d2a50c3
Merge feature pm 568 abandon cart changes into develop for testing (#…
pgilmore-phi Oct 15, 2024
95e36b9
Feature pm 568 abandon cart: update species ID ternary condition (#237)
pgilmore-phi Oct 15, 2024
eafd2e3
Salesforce Abandoned Cart: refactored payload (#239)
pgilmore-phi Oct 16, 2024
4bceb66
Salesforce Abandoned Cart: Add upsert on thank you page (#241)
pgilmore-phi Oct 17, 2024
00210f0
Added condition to load paid blog header fragment based on paid blog …
pgilmore-phi Oct 17, 2024
08b8290
wrap tracking data inside ecommerce object (#242)
pgilmore-phi Oct 17, 2024
0117118
dataLayer updates: add currency to purchase event (#243)
pgilmore-phi Oct 18, 2024
b0ba7ac
Hotfix: DL purchase event , adding ecommerce object and currency valu…
pgilmore-phi Oct 18, 2024
896fc64
Sync to sprint deploy: Salesforce Abandoned Cart (#248)
pgilmore-phi Oct 21, 2024
6d53e67
Added condition to load paid blog header fragment based on paid blog …
pgilmore-phi Oct 21, 2024
2bb1678
Merge branch 'stage' into release/sprint-22-deploy
pgilmore-phi Oct 21, 2024
e5f8d20
Merge branch 'main' into release/sprint-22-deploy
pgilmore-phi Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions blocks/header-paid/header-paid.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@ function instrumentTrackingEvents(header) {
}

export default async function decorate(block) {
// default paid header
let baseHeaderUrl = '/fragments/us/header-paid';
if (isCanada) {
baseHeaderUrl = '/fragments/ca/header-paid';
}
// paid blog page header
if (document.body.className.includes('paid-blog-page')) {
baseHeaderUrl = '/fragments/us/header-paid-blog';
if (isCanada) {
baseHeaderUrl = '/fragments/ca/header-paid-blog';
}
}

const headerPaidContent = await loadFragment(baseHeaderUrl);

Expand Down
2 changes: 2 additions & 0 deletions blocks/plans-quote/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Loader from './loader.js';
import APIClient from '../../scripts/24petwatch-api.js';
import {
COOKIE_NAME_SAVED_OWNER_ID,
SS_KEY_FORM_ENTRY_URL,
EMAIL_REGEX,
MICROCHIP_REGEX,
PET_PLANS_LPM_URL,
Expand Down Expand Up @@ -691,6 +692,7 @@ export default function formDecoration(block, apiBaseUrl) {

// remember the critical information for future steps
setCookie(COOKIE_NAME_SAVED_OWNER_ID, formData.ownerId);
sessionStorage.setItem(SS_KEY_FORM_ENTRY_URL, window.location.href);
window.location.href = `.${PET_PLANS_SUMMARY_QUOTE_URL}`; // ex: './summary-quote'
}

Expand Down
64 changes: 64 additions & 0 deletions blocks/plans-quote/summary-quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ import Loader from './loader.js';
import formDecoration from './form.js';
import {
COOKIE_NAME_SAVED_OWNER_ID,
SS_KEY_FORM_ENTRY_URL,
getCookie,
getSelectedProductAdditionalInfo,
getItemInfoFragment,
} from '../../scripts/24petwatch-utils.js';
import { getConfigValue } from '../../scripts/configs.js';

export default async function decorateSummaryQuote(block, apiBaseUrl) {
// initialize form based on results from the previous step
const APIClientObj = new APIClient(apiBaseUrl);
Loader.addLoader();

const salesforceProxyEndpoint = await getConfigValue('salesforce-proxy');
const ownerId = getCookie(COOKIE_NAME_SAVED_OWNER_ID);
const entryURL = sessionStorage.getItem(SS_KEY_FORM_ENTRY_URL);

let ownerData = [];
let petsList = [];
Expand Down Expand Up @@ -73,8 +77,68 @@ export default async function decorateSummaryQuote(block, apiBaseUrl) {
console.log('Failed to get the purchase summary for owner:', ownerData.id, ' status:', status);
}
}

Loader.hideLoader();

async function sendDataToSalesforce(owner, products, pets) {
Loader.showLoader();
if (!owner || !owner.email || !owner.id) {
// eslint-disable-next-line no-console
console.error('invalid owner data');
}

if (!products || !products[0] || !products[0].petID) {
// eslint-disable-next-line no-console
console.error('Invalid selected products data');
}

if (!pets || !pets[0] || !pets[0].petName || !pets[0].speciesId === undefined) {
// eslint-disable-next-line no-console
console.error('Invalid pets list data');
}

if (!entryURL) {
// eslint-disable-next-line no-console
console.error('Invalid entry URL');
}

const payload = {
payload: {
Data: {
ContactKey: ownerData.email,
EmailAddress: ownerData.email,
OrderCompleted: false,
OwnerId: ownerData.id,
PetId: selectedProducts[0].petID,
PetName: petsList[0].petName,
SiteURL: entryURL,
Species: petsList[0].speciesId === 1 ? 'Dog' : 'Cat',
},
EventDefinitionKey: 'APIEvent-6723a35b-b066-640c-1d7b-222f98caa9e1',
ContactKey: ownerData.email,
},
};

const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
};
await fetch(salesforceProxyEndpoint, options);

Loader.hideLoader();
}

// Send data for abandoned cart journey
try {
await sendDataToSalesforce(ownerData, selectedProducts, petsList);
} catch (error) {
// eslint-disable-next-line no-console
console.error('There was an error sending the data to Salesforce', error);
}

function getSelectedProduct(petId) {
return selectedProducts.find((item) => item.petID === petId);
}
Expand Down
36 changes: 36 additions & 0 deletions blocks/thank-you/thank-you.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ import APIClient, { getAPIBaseUrl } from '../../scripts/24petwatch-api.js';
import {
COOKIE_NAME_SAVED_OWNER_ID,
deleteCookie,
SS_KEY_FORM_ENTRY_URL,
CURRENCY_CANADA,
CURRENCY_US,
} from '../../scripts/24petwatch-utils.js';
import { isCanada } from '../../scripts/lib-franklin.js';
import { trackGTMEvent } from '../../scripts/lib-analytics.js';
import { getConfigValue } from '../../scripts/configs.js';

// prep for API calls
const apiBaseUrl = await getAPIBaseUrl();

const APIClientObj = new APIClient(apiBaseUrl);

// salesforce proxy
const salesforceProxyEndpoint = await getConfigValue('salesforce-proxy');

// Sequence of steps to get the owner info from the API

// Step 1 - get the paymentPortalCustomerId from the UUID (aka paymentProcessorId)
Expand Down Expand Up @@ -89,6 +94,8 @@ async function getTransaction(paymentProcessorId) {
export default async function decorate() {
// delete cookie with customer id
deleteCookie(COOKIE_NAME_SAVED_OWNER_ID);
// unset sessionStorage form entry URL
sessionStorage.removeItem(SS_KEY_FORM_ENTRY_URL);

const urlParams = new URLSearchParams(window.location.search);
const paymentProcessorId = urlParams.get('PaymentProcessorCustomerId');
Expand Down Expand Up @@ -180,6 +187,35 @@ export default async function decorate() {
// send the GTM event
trackGTMEvent('purchase', trackingData);

// Salesforce Upsert
async function setUpsertToSalesforce(email) {
const payload = {
payload: {
Data: {
OrderCompleted: true,
},
ContactKey: email,
},
};

const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
};
await fetch(salesforceProxyEndpoint, options);
}

// Send data for abandoned cart journey
try {
await setUpsertToSalesforce(getOwnerDetails.email);
} catch (error) {
// eslint-disable-next-line no-console
console.error('There was an error sending the data to Salesforce', error);
}

const printButton = document.createElement('button');
printButton.classList.add('button');
printButton.innerHTML = 'Print <span class="visually-hidden">this page</span>';
Expand Down
3 changes: 3 additions & 0 deletions scripts/24petwatch-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export function getQueryParam(param, defaultValue = null) {
return urlParams.has(param) ? urlParams.get(param) : defaultValue;
}

// ----- sessionStorage / localStorage helpers -----
export const SS_KEY_FORM_ENTRY_URL = 'formEntryURL';

// ----- cookie helpers -----
export const COOKIE_NAME_FOR_PET_TAGS = 'ph.PetTagQuote';
export const COOKIE_NAME_FOR_PET_PLANS = 'ph.PetPlanQuote';
Expand Down
Loading