Skip to content

Commit

Permalink
Sync to Dev: Feature/pm 563 dl add to cart (#251)
Browse files Browse the repository at this point in the history
* Merge Stage into Main (#228)

* #181 Fix styles of pet-tags/tag-quote and pet-tags/tag-select (#182)

* hotfix for change domain

* adding additional environment entry to config

* updated trusted site block

* Menu links refactoring (#188)

* merge stage into main

* changed links decoration approach

* PM-361

* PM-361

* updated document-based footer

* added x icon for footer

* removed external icon for petmicrochiplookup.org link

* 24PW: Post Purchase Thank You Page - EDS Build (#201)

* Add svg icons

* Fix svg icon name

* Fix svg icon

* Fix svg icon

* Added gray column

* Added autocomplite functionality

* Added fix for autocomplite functionality

* Added validagtors for promocode and zipcode, added loader animation

* Added some validators

* Added some validators

* Handlers/validators refactoring

* enhanced for Canada

* Canadian legal and Canadian icons

* the beginning of the submit execution

* the middle of the submit execution

* the completion of the submit execution

* fix JavaScript linting

* Fix validators for subbmit button

* allow for re-entering Step 1

* Fix validators for breed input

* honor a query param of 'petId' when re-entering Step 1

* strengthen our client API

* Fix validators for zipCode and async problem

* Separate js for the first page

* Fix zip code handler

* Some part of summary-quote

* Added button "Proceed to Payment"

* Small css fixes

* Small fixes for lpm-plus

* Fixed svg classes and added the icon for lpm-plus

* Added fragments with additional info to summary page

* Added loader.js

* Small refctoring

* Move the form to form.js

* Added the form to summary page

* Remove wrong div

* Fixed icons in fragments

* Small cleaning

* Form cleaning

* Improved the chip number validator

* Added isSummaryPage

* Added isSummaryPage

* Improve loader

* Added loader to summary page

* Added isSummaryPage to the form

* Intermediate code for adding a pet on the summary page

* Fix issue with styled icons

* Added form functionality to summary page

* Added pet removing functionality to summary page

* Hide promocode field on summary page

* Fix flow id

* Fix css

* Fix css

* Fixes for CA

* Fixes for linters

* Added promo code functionality

* Fixed parameter for payment url

* Fix promo code functionality

* Fix typo

* Fix styles

* Added header with only logo

* Fix styles

* Improvments for zip code handler

* WIP on feature/post-purchase-thank-you-page

* Fix zip code handler for CA

* Promocode fixes

* Promocode fixes

* WIP on feature/post-purchase-thank-you-page

* Added minus for discount

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* Remove a comment

* Fixed birthday for pets

* WIP on feature/post-purchase-thank-you-page

* Fixed birthday for pets

* Fixed birthday for pets

---------

Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Mike Weis <[email protected]>

* 24PW: Post Purchase Thank You Page - EDS Build - QA Feedback Updates (#203)

* Add svg icons

* Fix svg icon name

* Fix svg icon

* Fix svg icon

* Added gray column

* Added autocomplite functionality

* Added fix for autocomplite functionality

* Added validagtors for promocode and zipcode, added loader animation

* Added some validators

* Added some validators

* Handlers/validators refactoring

* enhanced for Canada

* Canadian legal and Canadian icons

* the beginning of the submit execution

* the middle of the submit execution

* the completion of the submit execution

* fix JavaScript linting

* Fix validators for subbmit button

* allow for re-entering Step 1

* Fix validators for breed input

* honor a query param of 'petId' when re-entering Step 1

* strengthen our client API

* Fix validators for zipCode and async problem

* Separate js for the first page

* Fix zip code handler

* Some part of summary-quote

* Added button "Proceed to Payment"

* Small css fixes

* Small fixes for lpm-plus

* Fixed svg classes and added the icon for lpm-plus

* Added fragments with additional info to summary page

* Added loader.js

* Small refctoring

* Move the form to form.js

* Added the form to summary page

* Remove wrong div

* Fixed icons in fragments

* Small cleaning

* Form cleaning

* Improved the chip number validator

* Added isSummaryPage

* Added isSummaryPage

* Improve loader

* Added loader to summary page

* Added isSummaryPage to the form

* Intermediate code for adding a pet on the summary page

* Fix issue with styled icons

* Added form functionality to summary page

* Added pet removing functionality to summary page

* Hide promocode field on summary page

* Fix flow id

* Fix css

* Fix css

* Fixes for CA

* Fixes for linters

* Added promo code functionality

* Fixed parameter for payment url

* Fix promo code functionality

* Fix typo

* Fix styles

* Added header with only logo

* Fix styles

* Improvments for zip code handler

* WIP on feature/post-purchase-thank-you-page

* Fix zip code handler for CA

* Promocode fixes

* Promocode fixes

* WIP on feature/post-purchase-thank-you-page

* Added minus for discount

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* Remove a comment

* Fixed birthday for pets

* WIP on feature/post-purchase-thank-you-page

* Fixed birthday for pets

* Fixed birthday for pets

* QA feedback updates

* Fix lint issue

---------

Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Mike Weis <[email protected]>

* 24PW: Post Purchase Thank You Page - EDS Build - QA Feedback Updates (#204)

* Add svg icons

* Fix svg icon name

* Fix svg icon

* Fix svg icon

* Added gray column

* Added autocomplite functionality

* Added fix for autocomplite functionality

* Added validagtors for promocode and zipcode, added loader animation

* Added some validators

* Added some validators

* Handlers/validators refactoring

* enhanced for Canada

* Canadian legal and Canadian icons

* the beginning of the submit execution

* the middle of the submit execution

* the completion of the submit execution

* fix JavaScript linting

* Fix validators for subbmit button

* allow for re-entering Step 1

* Fix validators for breed input

* honor a query param of 'petId' when re-entering Step 1

* strengthen our client API

* Fix validators for zipCode and async problem

* Separate js for the first page

* Fix zip code handler

* Some part of summary-quote

* Added button "Proceed to Payment"

* Small css fixes

* Small fixes for lpm-plus

* Fixed svg classes and added the icon for lpm-plus

* Added fragments with additional info to summary page

* Added loader.js

* Small refctoring

* Move the form to form.js

* Added the form to summary page

* Remove wrong div

* Fixed icons in fragments

* Small cleaning

* Form cleaning

* Improved the chip number validator

* Added isSummaryPage

* Added isSummaryPage

* Improve loader

* Added loader to summary page

* Added isSummaryPage to the form

* Intermediate code for adding a pet on the summary page

* Fix issue with styled icons

* Added form functionality to summary page

* Added pet removing functionality to summary page

* Hide promocode field on summary page

* Fix flow id

* Fix css

* Fix css

* Fixes for CA

* Fixes for linters

* Added promo code functionality

* Fixed parameter for payment url

* Fix promo code functionality

* Fix typo

* Fix styles

* Added header with only logo

* Fix styles

* Improvments for zip code handler

* WIP on feature/post-purchase-thank-you-page

* Fix zip code handler for CA

* Promocode fixes

* Promocode fixes

* WIP on feature/post-purchase-thank-you-page

* Added minus for discount

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* Remove a comment

* Fixed birthday for pets

* WIP on feature/post-purchase-thank-you-page

* Fixed birthday for pets

* Fixed birthday for pets

* QA feedback updates

* Fix lint issue

* QA feedback updates

---------

Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Mike Weis <[email protected]>

* Fixes for the form issues (#205)

* Feature/post purchase thank you page (#206)

* Add svg icons

* Fix svg icon name

* Fix svg icon

* Fix svg icon

* Added gray column

* Added autocomplite functionality

* Added fix for autocomplite functionality

* Added validagtors for promocode and zipcode, added loader animation

* Added some validators

* Added some validators

* Handlers/validators refactoring

* enhanced for Canada

* Canadian legal and Canadian icons

* the beginning of the submit execution

* the middle of the submit execution

* the completion of the submit execution

* fix JavaScript linting

* Fix validators for subbmit button

* allow for re-entering Step 1

* Fix validators for breed input

* honor a query param of 'petId' when re-entering Step 1

* strengthen our client API

* Fix validators for zipCode and async problem

* Separate js for the first page

* Fix zip code handler

* Some part of summary-quote

* Added button "Proceed to Payment"

* Small css fixes

* Small fixes for lpm-plus

* Fixed svg classes and added the icon for lpm-plus

* Added fragments with additional info to summary page

* Added loader.js

* Small refctoring

* Move the form to form.js

* Added the form to summary page

* Remove wrong div

* Fixed icons in fragments

* Small cleaning

* Form cleaning

* Improved the chip number validator

* Added isSummaryPage

* Added isSummaryPage

* Improve loader

* Added loader to summary page

* Added isSummaryPage to the form

* Intermediate code for adding a pet on the summary page

* Fix issue with styled icons

* Added form functionality to summary page

* Added pet removing functionality to summary page

* Hide promocode field on summary page

* Fix flow id

* Fix css

* Fix css

* Fixes for CA

* Fixes for linters

* Added promo code functionality

* Fixed parameter for payment url

* Fix promo code functionality

* Fix typo

* Fix styles

* Added header with only logo

* Fix styles

* Improvments for zip code handler

* WIP on feature/post-purchase-thank-you-page

* Fix zip code handler for CA

* Promocode fixes

* Promocode fixes

* WIP on feature/post-purchase-thank-you-page

* Added minus for discount

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* WIP on feature/post-purchase-thank-you-page

* Remove a comment

* Fixed birthday for pets

* WIP on feature/post-purchase-thank-you-page

* Fixed birthday for pets

* Fixed birthday for pets

* QA feedback updates

* Fix lint issue

* QA feedback updates

* QA feedback updates

---------

Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Mike Weis <[email protected]>

* Sync develop into stage (#207)

* 24PW: Membership V2 Paid Page - EDS Build (#208)

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* Datalayer updates for feature/membership-v2-paid-page

* Datalayer updates for feature/membership-v2-paid-page

* Fix lint issues on feature/membership-v2-paid-page

* 24PW: Membership V2 Paid Page - QA Updates  (#209)

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* Datalayer updates for feature/membership-v2-paid-page

* Datalayer updates for feature/membership-v2-paid-page

* Fix lint issues on feature/membership-v2-paid-page

* QA feedback updates on feature/membership-v2-paid-page

* QA feedback updates on feature/membership-v2-paid-page

* Add page /paid/lost-pet-protection (#194)

* WIP on feature/lost-pet-protection-paid-page

* WIP on feature/lost-pet-protection-paid-page

* WIP on feature/lost-pet-protection-paid-page

* WIP on feature/lost-pet-protection-paid-page

* WIP on feature/lost-pet-protection-paid-page

* 24PW: Membership V2 Paid Page - QA Updates (#211)

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* WIP on feature/membership-v2-paid-page

* Datalayer updates for feature/membership-v2-paid-page

* Datalayer updates for feature/membership-v2-paid-page

* Fix lint issues on feature/membership-v2-paid-page

* QA feedback updates on feature/membership-v2-paid-page

* QA feedback updates on feature/membership-v2-paid-page

* QA feedback updates on feature/membership-v2-paid-page

* QA feedback updates on feature/membership-v2-paid-page

* Fix config matching (#212)

* 24PW: Lost Pet Recovery Paid Page - EDS Build (#210)

* WIP on feature/lost-pet-recovery-paid-page

* WIP on feature/lost-pet-recovery-paid-page

* WIP on feature/lost-pet-recovery-paid-page

* WIP on feature/lost-pet-recovery-paid-page

* Fix lint issue

* Sync develop into stage (#213)

* Sync develop into stage (#213) (#214)

* Fix css (#216)

* Sync develop into stage (#220)

* 24PW: New Template - Paid Blog  (#219)
* 24PW: Pawpack Page - EDS Build (#215)
* Added Shipping of Tag to the summary page (#221)

---------

Co-authored-by: Bohdan Korablov <[email protected]>

* Sync develop into stage (#223)

* 24PW: New Template - Paid Blog  (#219)

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* 24PW: Pawpack Page - EDS Build (#215)

* WIP on feature/pawpack-page

* WIP on feature/pawpack-page

* Fix lint issues on feature/pawpack-page

* WIP on feature/pawpack-page

* Added Shipping of Tag to the summary page (#221)

* 24PW: Pawpack Page - EDS Build - QA Feedback (#222)

* WIP on feature/pawpack-page

* WIP on feature/pawpack-page

* Fix lint issues on feature/pawpack-page

* WIP on feature/pawpack-page

* QA feedback on feature/pawpack-page

* QA feedback on feature/pawpack-page

* QA feedback on feature/pawpack-page

* QA feedback on feature/pawpack-page

* WIP on bugfix/mobile-nav-redirect-visibility (#224)

---------

Co-authored-by: Bohdan Korablov <[email protected]>

* Sync develop into stage (#227)

* 24PW: New Template - Paid Blog  (#219)

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* WIP on feature/paid-blog-landing-page

* 24PW: Pawpack Page - EDS Build (#215)

* WIP on feature/pawpack-page

* WIP on feature/pawpack-page

* Fix lint issues on feature/pawpack-page

* WIP on feature/pawpack-page

* Added Shipping of Tag to the summary page (#221)

* 24PW: Pawpack Page - EDS Build - QA Feedback (#222)

* WIP on feature/pawpack-page

* WIP on feature/pawpack-page

* Fix lint issues on feature/pawpack-page

* WIP on feature/pawpack-page

* QA feedback on feature/pawpack-page

* QA feedback on feature/pawpack-page

* QA feedback on feature/pawpack-page

* QA feedback on feature/pawpack-page

* WIP on bugfix/mobile-nav-redirect-visibility (#224)

* 24PW: Pet Insurance - Aggregator Widget (#225)

* Adding widget aggregator block from petplace to 24petwatch

* updating css media query at point iframe size changes, updated id refs

* Revert decorateButtons function, apply callout cta styling (#226)

---------

Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: pgilmore-phi <[email protected]>

---------

Co-authored-by: miakobchuk <[email protected]>
Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: hero-dokane <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Felix Delval <[email protected]>

* Changes from the feature/PM-56724-dl-thank-you (#232)

* WIP on feature/PM-563-dl-add-to-cart

* WIP on feature/PM-563-dl-add-to-cart

* WIP on feature/PM-563-dl-add-to-cart

* WIP on feature/PM-563-dl-add-to-cart

---------

Co-authored-by: pgilmore-phi <[email protected]>
Co-authored-by: miakobchuk <[email protected]>
Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Mike Weis <[email protected]>
Co-authored-by: Felix Delval <[email protected]>
  • Loading branch information
7 people authored Oct 23, 2024
1 parent 07bddf7 commit 50f61d7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
45 changes: 45 additions & 0 deletions blocks/plans-quote/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import APIClient from '../../scripts/24petwatch-api.js';
import {
COOKIE_NAME_SAVED_OWNER_ID,
SS_KEY_FORM_ENTRY_URL,
CURRENCY_CANADA,
CURRENCY_US,
EMAIL_REGEX,
MICROCHIP_REGEX,
PET_PLANS_LPM_URL,
Expand All @@ -19,6 +21,7 @@ import {
getItemInfoFragment,
} from '../../scripts/24petwatch-utils.js';
import { getConfigValue } from '../../scripts/configs.js';
import { trackGTMEvent } from '../../scripts/lib-analytics.js';

const US_LEGAL_HEADER = '';
const US_LEGAL_CONSENT_FOR_PROMO_CONTACT = 'With your 24Pet® microchip, Pethealth Services (USA) Inc. may offer you free lost pet services, as well as exclusive offers, promotions and the latest information from 24Pet regarding microchip services. Additionally, PTZ Insurance Agency, Ltd. including its parents, PetPartners, Inc. and Independence Pet Group, Inc. and their subsidiaries (“collectively PTZ Insurance Agency, Ltd”) may offer you promotions and the latest information from 24Petprotect™ regarding pet insurance services and products. By checking “Continue”, Pethealth Services (USA) Inc. and PTZ Insurance Agency, Ltd. including its parents, PetPartners, Inc. and Independence Pet Group, Inc. and their subsidiaries (“collectively PTZ Insurance Agency, Ltd”) may contact you via commercial electronic messages, automatic telephone dialing systems, prerecorded/automated messages or text messages at the telephone number provided above, including your mobile number. These calls or emails are not a condition of the purchase of any goods or services. You understand that if you choose not to provide your consent, you will not receive the above-mentioned communications or free lost pet services, which includes being contacted with information in the event that your pet goes missing. You may withdraw your consent at any time.';
Expand All @@ -38,6 +41,7 @@ const promoResultKey = await getConfigValue('promo-result');

export default function formDecoration(block, apiBaseUrl) {
// prepare for Canada vs US
const currencyValue = isCanada ? CURRENCY_CANADA : CURRENCY_US;
const zipcodeLabel = isCanada ? 'Postal code*' : 'Zip code*';
const zipcodePlaceholder = isCanada ? 'A1A 1A1' : '00000';
const privacyPolicyURL = isCanada ? '/ca/privacy-policy' : '/privacy-policy';
Expand Down Expand Up @@ -645,6 +649,44 @@ export default function formDecoration(block, apiBaseUrl) {
}
}

function instrumentTrackingStep1() {
const currentPath = window.location.pathname;
let productType = null;

if (currentPath.includes(PET_PLANS_LPM_URL)) {
productType = 'Lifetime Protection Membership';
} else if (currentPath.includes(PET_PLANS_LPM_PLUS_URL)) {
productType = 'Lifetime Protection Membership - PLUS';
} else if (currentPath.includes(PET_PLANS_ANNUAL_URL)) {
productType = 'Annual Protection Membership';
}

// call instrument tracking
const trackingData = {
ecommerce: {
// New GTM dataLayer
product_type: productType, // annual protection membership
items: [
{
item_name: productType,
// coupon: formData.promoCode,
currency: currencyValue,
discount: '', // not available until step 2
item_category: 'membership',
item_variant: '', // okay to be left empty
microchip_number: formData.microchip,
product_type: productType,
price: '', // not available until step 2
quantity: 1,
},
],
},
};

// send the GTM event
trackGTMEvent('add_to_cart', trackingData);
}

async function executeSubmit() {
Loader.showLoader();

Expand Down Expand Up @@ -688,6 +730,9 @@ export default function formDecoration(block, apiBaseUrl) {
return;
}

// call instrument tracking
instrumentTrackingStep1();

Loader.hideLoader();

// remember the critical information for future steps
Expand Down
4 changes: 2 additions & 2 deletions scripts/24petwatch-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const MICROCHIP_REGEX = /^([A-Z0-9]{15}|[A-Z0-9]{10}|[A-Z0-9]{9})$/i;
export const POSTAL_CODE_CANADA_REGEX = /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i;
export const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

export const CURRENCY_CANADA = 'cad';
export const CURRENCY_US = 'usd';
export const CURRENCY_CANADA = 'CAD';
export const CURRENCY_US = 'USD';

// ----- general helpers -----
export function getQueryParam(param, defaultValue = null) {
Expand Down

0 comments on commit 50f61d7

Please sign in to comment.