import { ChooseYourDeliveryListener, DeliveryOptionButton } from "./choose-your-delivery";
/**
* 'choose_your_scent' - triggered when the user clicks a scent option on a product page.
* Supports the new and old PDP widgets and most GemPages product templates.
* @class
* @extends ChooseYourDeliveryListener
*/
export class ChooseYourScentListener extends ChooseYourDeliveryListener {
eventName = "choose_your_scent";
selectors = [
`.op-scent-select`,
`div[data-name="Choose Your Scent"] span[data-value]`,
`[data-name="Scent"] [data-value]`,
`.cof-scent-select`
];
createOptionButton(_, element) {
return new ScentButton(element);
}
}
/**
* Option button for scent options.
* @class
* @param {HTMLElement} btn - The button element.
* @extends DeliveryOptionButton
*/
class ScentButton extends DeliveryOptionButton {
get option() {
return this.btn.innerText.split(' ').filter(word => word).join(' ');;
}
}