PageSourceSearch

https://www.alliedschools.com/wp-content/mu-plugins/wp-common-plug…/cl2-products-view.js?ver=2026-09-18-05-14

js alliedschools.com collected 2026-09-29 07:55:29 UTC 25,891 bytes, 649 lines download raw bytes

1/******/ (() => { // webpackBootstrap
2// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
3(() => {
4"use strict";
5
6(function () {
7  'use strict';
8
9  function init() {
10    const on = (selector, eventName, handler) => {
11      document.body.addEventListener(eventName, function (event) {
12        const target = event.target;
13        if (!(target instanceof Element)) {
14          return;
15        }
16        const match = target.closest(selector);
17        if (match) {
18          handler(event, match);
19        }
20      });
21    };
22    const visible = el => !!el && !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
23    const isViewMoreContainerEmpty = container => {
24      if (!container) {
25        return true;
26      }
27      return (container.textContent || '').replace(/\s+/g, ' ').trim() === '';
28    };
29    const syncViewMoreToggleForCard = card => {
30      if (!card) {
31        return;
32      }
33      const viewMoreContainer = card.querySelector('.view-more-container');
34      const toggle = card.querySelector('.toggle-view-more');
35      if (!toggle) {
36        return;
37      }
38      const empty = isViewMoreContainerEmpty(viewMoreContainer);
39      toggle.hidden = empty;
40      if (empty) {
41        toggle.classList.add('collapsed');
42        toggle.setAttribute('aria-expanded', 'false');
43        if (viewMoreContainer) {
44          viewMoreContainer.classList.add('collapse');
45        }
46      }
47    };
48    const syncViewMoreToggles = (root = document) => {
49      root.querySelectorAll('.card').forEach(syncViewMoreToggleForCard);
50    };
51    syncViewMoreToggles();
52    document.addEventListener('colibri:products-updated', () => {
53      syncViewMoreToggles();
54    });
55    if (location.href.indexOf('member-upg=1') !== -1) {
56      /**
57       * if running membership upgrade test (done for Elite on 7/22/2022)
58       * fetch membership status on hover
59       */
60      document.querySelectorAll('.grid-col > .card').forEach(card => {
61        card.addEventListener('mouseenter', function () {
62          const addToCart = card.querySelector(':scope > [data-product-code]');
63          if (addToCart && !addToCart.upsell && !addToCart['is-checking-upsell']) {
64            addToCart.dispatchEvent(new CustomEvent('UPDATE_ADD_TO_CART_BUTTON', {
65              detail: {
66                productCode: addToCart.dataset.productCode || addToCart.getAttribute('data-product-code')
67              },
68              bubbles: true
69            }));
70          }
71        });
72      });
73    }
74
75    /**
76     * Insert a general template for modal (if it is not there yet).
77     *
78     * This is needed to support a general-purpose modal
79     * @note we exclude map modals
80     */
81    if (!document.querySelector('body > .modal:not(.modal--map)')) {
82      const modal = document.createElement('div');
83      modal.className = 'modal';
84      modal.tabIndex = -1;
85      modal.setAttribute('role', 'dialog');
86      modal.innerHTML = '<div class="modal-dialog modal-dialog-centered" role="document">' + '<div class="modal-content">' + '<div class="modal-header">' + '<h5 class="modal-title"></h5>' + '<button type="button" class="close" data-dismiss="modal" aria-label="Close" title="Close">' + '<span aria-hidden="true">&times;</span>' + '</button>' + '</div>' + '<div class="modal-body"></div>' + '</div>' + '</div>';
87      document.body.appendChild(modal);
88    }
89
90    /**
91     * Pop up modals when a link with rel="modal" is clicked
92     */
93    // on( '[rel="modal"]', 'click', ( e, target ) => {
94
95    // 	console.log( e, target );
96
97    // 	if ( e.defaultPrevented ) {
98    // 		return;
99    // 	}
100
101    // 	const card = target.closest( '.card--square' );
102
103    // 	if (
104    // 		!card ||
105    // 		![ 'sellable_done', 'enrollable_done' ].includes(
106    // 			card.getAttribute( 'data-product-status' ) || '',
107    // 		)
108    // 	) {
109    // 		//the regular QuickView modal will be displayed by the global modal logic in cds-modal.js
110    // 		return;
111    // 	}
112
113    // 	const addToCart = card.querySelector( '[data-product-code]' );
114
115    // 	if ( !addToCart ) {
116    // 		return;
117    // 	}
118
119    // 	const productStatus = card.getAttribute( 'data-product-status' ) || '';
120
121    // 	const isProductAction = target.matches( '[data-legacy-add-to-cart]' ) || target.matches( '[data-core-add-to-cart]' );
122
123    // 	/**
124    // 	 * found addToCard button, so this is a card and we need to support Quick View modal
125    // 	 */
126    // 	if (
127    // 		( target.matches( '.card--square' ) || target.matches( '.mode-cta' ) ) &&
128    // 		[ 'sellable_done', 'enrollable_done' ].includes( productStatus )
129    // 	) {
130    // 		e.preventDefault();
131    // 		const ctaSelector = 'sellable_done' === productStatus ? 'data-checkout-url' : 'data-dashboard-url';
132    // 		const url = card.querySelector( '[' + ctaSelector + ']' )?.getAttribute( ctaSelector ) ?? '';
133    // 		if ( url ) {
134    // 			window.location.href = url;
135    // 		} else {
136    // 			console.error( 'No URL found for product', productCode );
137    // 		}
138    // 		return;
139    // 	} else if ( !addToCart.querySelector( ':scope > .is-unknown-state' ) ) {
140    // 		/**
141    // 		 * do not call up the modal if this click is processed already
142    // 		 */
143    // 		if ( target.closest( '[data-legacy-add-to-cart]' ) || target.closest( '[data-core-add-to-cart]' ) ) {
144    // 			if ( target !== addToCart && target.querySelector( 'button' ) ) {
145    // 				target.querySelector( 'button' ).click();
146    // 			} else if ( target.querySelector( 'a[href]' ) ) {
147    // 				window.location.href = target.querySelector( 'a[href]' ).getAttribute( 'href' );
148    // 			}
149    // 			e.preventDefault();
150    // 			return;
151    // 		}
152    // 	} //end of
153
154    // 	e.preventDefault();
155    // } );
156    on('.card .toggle-view-more[aria-expanded="false"]', 'click', (e, target) => {
157      const card = target.closest('.card');
158      const viewMoreContainer = card ? card.querySelector('.view-more-container') : null;
159      if (isViewMoreContainerEmpty(viewMoreContainer)) {
160        syncViewMoreToggleForCard(card);
161        return;
162      }
163      if (target.classList.contains('collapsed')) {
164        const toggle = target.closest('.toggle-view-more');
165        if (toggle) {
166          toggle.classList.remove('collapsed');
167        }
168        if (viewMoreContainer && viewMoreContainer.classList.contains('collapse')) {
169          viewMoreContainer.classList.toggle('collapse');
170        }
171      } else {
172        const toggle = target.closest('.toggle-view-more');
173        if (toggle) {
174          toggle.classList.add('collapsed');
175        }
176        if (viewMoreContainer && !viewMoreContainer.classList.contains('collapse')) {
177          viewMoreContainer.classList.toggle('collapse');
178        }
179      }
180      const addToCart = card ? card.querySelector('[data-product-code]') : null;
181      const productCode = addToCart ? addToCart.dataset.productCode || addToCart.getAttribute('product-code') : null;
182      if (productCode) {
183        window.colibri.utils.pushAnalyticsData(productCode, 'view_item');
184      }
185    });
186    on('.pricing-container .switch input', 'change', function (e, input) {
187      const container = input.closest('.pricing-container');
188      if (!container) {
189        return;
190      }
191      const allInners = Array.from(container.querySelectorAll('.pricing-inner'));
192      const inner = allInners.find(el => visible(el));
193      let invisible = allInners.find(el => !visible(el));
194      if (!invisible && inner) {
195        const next = inner.nextElementSibling;
196        const doc = next?.contentDocument || next?.contentWindow?.document;
197        const fetched = doc ? doc.querySelector('.pricing-inner') : null;
198        if (fetched) {
199          invisible = fetched.cloneNode(true);
200          inner.insertAdjacentElement('afterend', invisible);
201        }
202      }
203      if (inner) {
204        inner.style.display = 'none';
205      }
206      if (invisible) {
207        invisible.style.display = '';
208      }
209
210      //update CTAs on the parent card
211      const productNew = invisible ? invisible.dataset.productCode || invisible.getAttribute('data-product-code') : null;
212      const payTerm = invisible ? invisible.querySelector('.payment-term') : null;
213      const payOptNew = payTerm ? payTerm.dataset.paymentOptionId || payTerm.getAttribute('data-payment-option-id') : null;
214      container.closest('.card')?.querySelectorAll('[data-product-code]').forEach(el => {
215        //We should check if product is available or in the cart already.
216        //note we set "alt-*" to preserve the original product code, be
216cause it can be used for indexing DOM elements.
217        el.dataset.altPaymentOptionId = payOptNew || '';
218        el.dataset.altProductCode = productNew || '';
219        window.dispatchEvent(new CustomEvent('ColibriEvent:INIT_ADD_TO_CART', {
220          detail: el
221        }));
222      });
223    });
224    on('.modal-body .payment-options button', 'click', function (e, button) {
225      var _button$dataset$partn;
226      // function readCookie( name ) {
227      // 	const nameEQ = name + '=';
228      // 	const ca = document.cookie.split( ';' );
229      // 	for ( let i = 0; i < ca.length; i ++ ) {
230      // 		let c = ca[ i ];
231      // 		while ( c.charAt( 0 ) === ' ' ) {
232      // 			c = c.substring( 1, c.length );
233      // 		}
234      // 		if ( c.indexOf( nameEQ ) === 0 ) {
235      // 			return c.substring( nameEQ.length, c.length );
236      // 		}
237      // 	}
238      // 	return null;
239      // }
240
241      function setCookie(name, value, days) {
242        var expires = "";
243        if (days) {
244          var date = new Date();
245          date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
246          expires = "; expires=" + date.toUTCString();
247        }
248        var temp = location.host;
249        temp = temp ? temp.split('.') : '';
250        temp = temp ? temp.reverse() : '';
251        temp = temp ? '.' + temp[1] + '.' + temp[0] : '';
252        const domain = temp ? '; domain=' + temp : '';
253        document.cookie = name + "=" + (value || "") + expires + domain + "; path=/";
254      }
255      function deleteCookie(name) {
256        document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
257      }
258      const prodCode = button.dataset.productCode;
259      const planId = button.dataset.paymentOptionId;
260      const partnerId = button.dataset.partnershipId;
261      const partnerGroupItemId = (_button$dataset$partn = button.dataset.partnershipGroupItemId) !== null && _button$dataset$partn !== void 0 ? _button$dataset$partn : 0;
262      if (partnerId) {
263        setCookie('STYXKEY-partnershipid', partnerId, 1);
264      } else {
265        deleteCookie('STYXKEY-partnershipid');
266      }
267      let url = window.colibri.studentApi + '/cart/items.json?searchResultId=' + prodCode;
268
269      //we would get this from product status check
270      // url += enrollmentId
271      // 	   ? '&enrollmentId=' + enrollmentId
272      // 	   : '';
273
274      url += planId ? '&paymentOptionId=' + planId : '';
275      url += partnerGroupItemId ? '&PartnershipGroupItemId=' + partnerGroupItemId : '';
276      url += '&addedFrom=PaymentPlanModal';
277      fetch(url, {
278        method: 'POST',
279        credentials: 'include',
280        headers: {
281          'Content-Type': 'application/x-www-form-urlencoded'
282        }
283      }).then(() => {
284        window.location.href = window.colibri.cartUrl;
285      }).catch(() => true);
286    });
287
288    // Align buttons on packages when Affirm text is loaded
289    function addAffirmClass() {
290      const affirmBlock = document.querySelector('.affirm-as-low-as');
291      if (!affirmBlock) {
292        return;
293      }
294      const priceElements = document.querySelectorAll('.card .price');
295      function updatePriceElements() {
296        priceElements.forEach(function (element) {
297          element.classList.add('has-affirm');
298        });
299      }
300
301      // Check if Affirm block is updated based on location
302      const mutationCallback = function (mutationsList) {
303        for (const mutation of mutationsList) {
304          if (mutation.type === 'childList' && mutation.target.classList.contains('affirm-as-low-as')) {
305            updatePriceElements();
306          }
307        }
308      };
309      const observer = new MutationObserver(mutationCallback);
310      const observerConfig = {
311        childList: true,
312        subtree: true
313      };
314      observer.observe(affirmBlock, observerConfig);
315    }
316    addAffirmClass();
317  }
318  if (document.readyState === 'loading') {
319    document.addEventListener('DOMContentLoaded', init);
320  } else {
321    init();
322  }
323})();
324})();
325
326// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules.
327(() => {
328function init() {
329  'use strict';
330
331  document.body.addEventListener('click', function (event) {
332    const button = event.target.closest('.card .btn.view-details');
333    if (!button) {
334      return;
335    }
336    button.innerHTML = button.classList.contains('collapsed') ? button.innerHTML.replace(/More/g, 'Less') : button.innerHTML.replace(/Less/g, 'More');
337  });
338}
339if (document.readyState === 'loading') {
340  document.addEventListener('DOMContentLoaded', init);
341} else {
342  init();
343}
344})();
345
346// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules.
347(() => {
348function init() {
349  // Find all elements with the data-toggle-view attribute
350  document.querySelectorAll('[data-toggle-view]').forEach(function (ctrl) {
351    ctrl.addEventListener('click', function () {
352      // Read the selectors from data-attributes
353      var parentSelector = ctrl.dataset.parentSelector;
354      var expandedSelector = ctrl.dataset.expandedSelector;
355      var collapsedSelector = ctrl.dataset.collapsedSelector;
356
357      // Find the container
358      var container = ctrl.closest(parentSelector);
359      if (!container) {
360        return;
361      }
362      if (ctrl.classList.contains('collapsed')) {
363        // Expand
364        ctrl.innerHTML = ctrl.innerHTML.replace(/More/g, 'Less');
365        container.querySelectorAll(expandedSelector).forEach(function (el) {
366          el.classList.remove('d-none');
367        });
368        container.querySelectorAll(collapsedSelector).forEach(function (el) {
369          el.classList.add('d-none');
370        });
371        ctrl.classList.remove('collapsed');
372      } else {
373        // Collapse
374        ctrl.innerHTML = ctrl.innerHTML.replace(/Less/g, 'More');
375        container.querySelectorAll(expandedSelector).forEach(function (el) {
376          el.classList.add('d-none');
377        });
378        container.querySelectorAll(collapsedSelector).forEach(function (el) {
379          el.classList.remove('d-none');
380        });
381        ctrl.classList.add('collapsed');
382      }
383    });
384  });
385}
386if (document.readyState === 'loading') {
387  document.addEventListener('DOMContentLoaded', init);
388} else {
389  init();
390}
391})();
392
393// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules.
394(() => {
395document.addEventListener('DOMContentLoaded', function () {
396  'use strict';
397
398  const body = document.body;
399  const withJq = function (cb) {
400    if (typeof window.jQuery === 'function') {
401      cb(window.jQuery);
402    }
403  };
404  const listenerRegistry = new WeakMap();
405  const normalizePayload = function (detail) {
406    if (!detail) {
407      return detail;
408    }
409    let payload = detail;
410    withJq(function ($) {
411      if (detail instanceof Element) {
412        payload = $(detail);
413      }
414    });
415    return payload;
416  };
417  const addColibriListener = function (target, eventName, handler, options = {}) {
418    const nativeHandler = function (event) {
419      handler(event, event?.detail);
420    };
421    target.addEventListener(eventName, nativeHandler, options);
422    let jqHandler = null;
423    withJq(function ($) {
424      jqHandler = function (event, data) {
425        handler(event, data !== null && data !== void 0 ? data : event?.originalEvent?.detail);
426      };
427      $(target).on(eventName, jqHandler);
428    });
429    if (!listenerRegistry.has(target)) {
430      listenerRegistry.set(target, []);
431    }
432    listenerRegistry.get(target).push({
433      eventName,
434      handler,
435      nativeHandler,
436      jqHandler,
437      options
438    });
439  };
440  const removeColibriListener = function (target, eventName, handler) {
441    const listeners = listenerRegistry.get(target);
442    if (!listeners || !listeners.length) {
443      return;
444    }
445    for (let i = listeners.length - 1; i >= 0; i--) {
446      const item = listeners[i];
447      if (item.eventName !== eventName || item.handler !== handler) {
448        continue;
449      }
450      target.removeEventListener(eventName, item.nativeHandler, item.options);
451      withJq(function ($) {
452        if (item.jqHandler) {
453          $(target).off(eventName, item.jqHandler);
454        }
455      });
456      listeners.splice(i, 1);
457    }
458  };
459  const emitColibriEvent = function (target, eventName, detail, useTriggerHandler = false) {
460    const customEvent = new CustomEvent(eventName, {
461      detail
462    });
463    target.dispatchEvent(customEvent);
464    withJq(function ($) {
465      const payload = normalizePayload(detail);
466      if (useTriggerHandler) {
467        $(target).triggerHandler(eventName, [payload]);
468        return;
469      }
470      $(target).trigger(eventName, [payload]);
471    });
472  };
473  addColibriListener(body, 'ColibriEvent:AFTER_MODAL_UPDATED', function () {
474    // Marketing API product preview + `window.colibri.upsell` own quick-view upsell.
475    if (window.colibri && window.colibri.upsell) {
476      return;
477    }
478    const upsellBlock = document.querySelector('.modal--quick-view .upsell-block');
479    if (!upsellBlock) {
480      return;
481    }
482    upsellBlock.innerHTML = `
483			<p class="upsell-block__text">This course is <b>FREE with Membership!</b></p>
484			<h4 class="upsell-block__name"></h4>
485			<div class="upsell-block__pricing">
486				<div class="price">
487					<span class="price-icon">$</span>
488					<span class="price-amount"></span>
489					<span class="price-period"></span>
490				</div>
491			</div>
492			<div class="btn-wrapper"></div>
493		`;
494    const sourceAddToCart = document.querySelector('.modal--quick-view .product-actions .add-to-cart-container');
495    const btnWrapper = upsellBlock.querySelector('.btn-wrapper');
496    if (!sourceAddToCart || !btnWrapper) {
497      return;
498    }
499    const upsellAddToCart = sourceAddToCart.cloneNode(true);
500    upsellAddToCart.removeAttribute('data-product-code');
501    upsellAddToCart.removeAttribute('data-alt-product-code');
502    upsellAddToCart.removeAttribute('data-partnership-group-item-id');
503    btnWrapper.appendChild(upsellAddToCart);
504  });
505  addColibriListener(body, 'ColibriEvent:AFTER_STATUS_CHECK', function (_event, data) {
506    var _response$Properties$;
507    const upsellBlock = document.querySelector('.modal--quick-view .upsell-block');
508    const upsellCartContainer = upsellBlock?.querySelector('.add-to-cart-container');
509    if (!upsellBlock || !upsellCartContainer) {
510      return;
511    }
512    if (!(data && Array.isArray(data.response) && data.response.length > 0 && data.response[0]?.Properties)) {
513      return;
514    }
515    const response = data.response[0];
516    const upsellMembershipProductCode = response.Properties?.UpsellMembershipProductCode;
517    if (upsellMembershipProductCode && upsellCartContainer.getAttribute('data-product-code') === upsellMembershipProductCode) {
518      return;
519    }
520    if (!upsellMembershipProductCode) {
521      upsellBlock.classList.add('hide');
522      return;
523    }
524    if (upsellCartContainer.getAttribute('data-product-code')) {
525      emitColibriEvent(body, 'ColibriEvent:UNINDEX_ADD_TO_CART', upsellCartContainer);
526    }
527    if (data?.add_to_cart_requested && data.add_to_cart_requested.indexOf(upsellMembershipProductCode) !== -1) {
528      upsellCartContainer.querySelector('.add-to-cart')?.classList.add('hidden');
529      upsellCartContainer.querySelector('.checkout')?.classList.remove('hidden');
530    }
531    const upsellMembershipName = response.Properties?.UpsellMembershipName;
532    const upsellMembershipPrice = (_response$Properties$ = response.Properties?.UpsellMembershipPrice) !== null && _response$Properties$ !== void 0 ? _response$Properties$ : '0';
533    const upsellMembershipMonths = response.Properties?.UpsellMembershipMonths;
534    const upsellMembershipPriceFormatted = parseInt(String(upsellMembershipPrice).replace(/,/g, ''), 10) || 0;
535    const upsellMembershipPriceAffirm = upsellMembershipPriceFormatted * 100;
536    const inMembership = response.Properties?.InMembership;
537    let upsellPricePeriod = '';
538    let affirmMessage = '';
539    if (typeof window.colibri !== 'undefined' && typeof window.colibri.affirmPriceThreshold !== 'undefined' && window.colibri.affirmPriceThreshold <= upsellMembershipPriceFormatted) {
540      affirmMessage = `<div class="affirm-as-low-as" data-page-type="product" data-amount="${upsellMembershipPriceAffirm}"></div>`;
541    }
542    upsellCartContainer.setAttribute('data-product-code', upsellMembershipProductCode);
543    emitColibriEvent(window, 'ColibriEvent:INIT_ALL_ADD_TO_CARTS', upsellBlock, true);
544    if (!inMembership && upsellMembershipProductCode && upsellMembershipName && upsellMembershipPrice) {
545      upsellCartContainer.setAttribute('data-immediate-checkout', '1');
546      const nameEl = upsellBlock.querySelector('.upsell-block__name');
547      const amountEl = upsellBlock.querySelector('.price-amount');
548      const pricingEl = upsellBlock.querySelector('.upsell-block__pricing');
549      if (nameEl) {
550        nameEl.textContent = upsellMembershipName;
551      }
552      if (amountEl) {
553        amountEl.textContent = upsellMembershipPrice;
554      }
555      if (pricingEl && affirmMessage && !upsellBlock.querySelector('.affirm-as-low-as')) {
556        pricingEl.insertAdjacentHTML('afterend', affirmMessage);
557      }
558      const ajaxUrl = window.colibri?.admin_ajax;
559      if (!ajaxUrl) {
560        upsellBlock.classList.add('hide');
561        return;
562      }
563      const url = new URL(ajaxUrl, window.location.origin);
564      url.searchParams.set('action', 'get_upsell_discount');
565      url.searchParams.set('productCode', upsellMembershipProductCode);
566      fetch(url.toString(), {
567        method: 'GET'
568      }).then(function (r) {
569        if (!r.ok) {
570          throw new Error(`HTTP ${r.status}`);
571        }
572        return r.json();
573      }).then(function (ajaxResponse) {
574        var _discountResponse$pay;
575        const discountResponse = ajaxResponse?.data;
576        const pricingNode = upsellBlock.querySelector('.upsell-block__pricing');
577        if (discountResponse?.discounted_price && pricingNode) {
578          var _discountResponse$pro, _discountResponse$pro2;
579          const priceFormatted = discountResponse.discounted_price * 100;
580          let discountedPrice = discountResponse.discounted_price.toString();
581          if (discountedPrice.indexOf('.') !== -1) {
582            const parts = discountedPrice.split('.');
583            if (parts[1].length === 1) {
584              discountedPrice += '0';
585            }
586          }
587          const discountedPriceNode = upsellBlock.querySelector('.discounted-price');
588          const discountedMarkup = `
589							<span class="price-icon">$</span>
590							<span class="price-amount">${discountedPrice}</span>
591							<span class="price-period">${upsellPricePeriod}</span>
592						`;
593          if (!discountedPriceNode) {
594            pricingNode.insertAdjacentHTML('afterbegin', `<div class="discounted-price">${discountedMarkup}</div>`);
595          } else {
596            discountedPriceNode.innerHTML = discountedMarkup;
597          }
598          const affirmNode = upsellBlock.querySelector('.affirm-as-low-as');
599          if (affirmNode) {
600            affirmNode.setAttribute('data-amount', String(priceFormatted));
601          }
602          const displayText = discountResponse.promo_rate_text?.trim() ? 'off with code:' : 'With Promo Code:';
603          const discountInfoNode = upsellBlock.querySelector('.discount-info');
604          const discountMarkup = `
605							<span class="promo-rate">${(_discountResponse$pro = discountResponse.promo_rate_text) !== null && _discountResponse$pro !== void 0 ? _discountResponse$pro : ''}</span>
606							<span class="text-to-display">${displayText}</span>
607							<span class="promo-code-text">${(_discountResponse$pro2 = discountResponse.promo_code_text) !== null && _discountResponse$pro2 !== void 0 ? _discountResponse$pro2 : ''}</span>
608						`;
609          if (!discountInfoNode) {
610            pricingNode.insertAdjacentHTML('beforeend', `<div class="discount-info">${discountMarkup}</div>`);
611          } else {
612            discountInfoNode.innerHTML = discountMarkup;
613          }
614        }
615        upsellCartContainer.setAttribute('data-payment-option-id', String((_discountResponse$pay = discountResponse?.payment_option_id) !== null && _discountResponse$pay !== void 0 ? _discountResponse$pay : 0));
616        upsellBlock.classList.remove('hide');
617        if (discountResponse?.payment_option_id === 0) {
618          upsellPricePeriod = '';
619        } else if (upsellMembershipMonths === '12') {
620          upsellPricePeriod = '/year';
621        } else if (upsellMembershipMonths === '24') {
622          upsellPricePeriod = '/2 years';
623        }
624        const periodEl = upsellBlock.querySelector('.price-period');
625        if (periodEl) {
626          periodEl.textContent = upsellPricePeriod;
627        }
628      }).catch(function (error) {
629        console.log('response error: ', error);
630        upsellBlock.classList.add('hide');
631      });
632    }
633    window.affirm?.ui?.ready?.(() => window.affirm.ui.refresh?.());
634  });
635  const onAddToCartSuccess = function () {
636    const target = document.querySelector('.modal--quick-view');
637    if (!target || !target.querySelector('.upsell-block')) {
638      return;
639    }
640    target.querySelector('.product-actions .add-to-cart button')?.click();
641    removeColibriListener(body, 'ColibriEvent:DO_ADD_TO_CART_SUCCESS', onAddToCartSuccess);
642  };
643  addColibriListener(body, 'ColibriEvent:DO_ADD_TO_CART_SUCCESS', onAddToCartSuccess);
644});
645})();
646
647/******/ })()
648;
649//# sourceMappingURL=cl2-products-view.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.