{"version":3,"file":"wishlist-page.js","sources":["../../dev/js/wishlist-page.js"],"sourcesContent":["import { html, repeat } from 'https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js';\nimport { WishlistElement } from 'https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.29.2/wishlist-element.js';\nimport { ProductFormController } from 'https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.29.2/controllers.js';\nimport 'https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.29.2/components/button.js';\nimport 'https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.29.2/components/option-select.js';\nimport 'https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.29.2/components/option-swatches.js';\n\nclass WishlistPage extends WishlistElement {\n static get properties() {\n return {\n moveToCart: { type: Boolean, attribute: 'move-to-cart' },\n loginCtaMode: { type: String, attribute: 'login-cta-mode' },\n variantAutoSelectMode: {\n type: String,\n attribute: 'variant-auto-select-mode',\n },\n showVendor: { type: Boolean, attribute: 'show-vendor' },\n showProductTitle: { type: Boolean, attribute: 'show-product-title' },\n showPrice: { type: Boolean, attribute: 'show-price' },\n showShareButton: { type: Boolean, attribute: 'show-share-button' },\n showBuyAllButton: { type: Boolean, attribute: 'show-buy-all-button' },\n showClearButton: { type: Boolean, attribute: 'show-clear-button' },\n ctaButton: { type: String, attribute: 'cta-button' },\n productOptions: { type: String, attribute: 'product-options' },\n wishlistEmptyLink: { type: String, attribute: 'wishlist-empty-link' },\n };\n }\n\n getStateConfig() {\n return {\n wishlist: true,\n };\n }\n\n render() {\n if (!this.wishlist) {\n return;\n }\n\n return html`\n
\n ${this.renderHeader()}\n
${this.renderWishlistItems()}
\n
\n `;\n }\n\n renderHeader() {\n return html`\n
\n

${this.getTranslation('wishlist_page.title')}

\n ${this.renderWishlistEmptyCallout()} ${this.renderLoginCallout()} ${this.renderControls()}\n
\n `;\n }\n\n renderControls() {\n if (!this.wishlist.items.length) {\n return;\n }\n if (!this.showShareButton && !this.showBuyAllButton && !this.showClearButton) {\n return;\n }\n\n return html`\n
\n ${this.showShareButton\n ? html` `\n : undefined}\n ${this.showBuyAllButton\n ? html`\n \n `\n : undefined}\n ${this.showClearButton\n ? html` `\n : undefined}\n
\n `;\n }\n\n renderWishlistEmptyCallout() {\n if (this.wishlist.items.length) {\n return;\n }\n\n return html`\n
\n

${this.getTranslation('wishlist_page.wishlist_empty_callout_html')}

\n \n ${this.getTranslation('wishlist_page.wishlist_empty_cta')}\n \n
\n `;\n }\n\n renderLoginCallout() {\n if (this.app.customer || !this.wishlist.isMine || !this.wishlist.items.length) {\n return;\n }\n if (this.loginCtaMode === 'DISABLED') {\n return;\n }\n\n return html`\n
\n

\n ${this.getTranslation('wishlist_page.login_callout_html', {\n login_url: this.app.routes.accountLoginUrl,\n register_url: this.app.routes.accountRegisterUrl,\n })}\n

\n
\n `;\n }\n\n renderWishlistItems() {\n if (!this.wishlist.items.length) {\n return;\n }\n\n const wishlistItems = this.wishlist.items.slice().reverse();\n\n return html`\n
\n ${repeat(\n wishlistItems,\n (wishlistItem) => wishlistItem.id,\n (wishlistItem) => html`\n \n `\n )}\n
\n `;\n }\n\n connectedCallback() {\n if (!this.dataset.wishlistId) {\n this.dataset.wishlistId = this.app.theme.getWishlistId(window.location.pathname);\n }\n\n if (this.dataset.wishlistId && this.dataset.wishlistId !== 'mine') {\n this.loadWithoutSession = true;\n }\n\n super.connectedCallback();\n }\n}\n\nclass WishlistProductCard extends WishlistElement {\n static get properties() {\n return {\n wishlist: { type: Object },\n moveToCart: { type: String, attribute: 'move-to-cart' },\n showVendor: { type: Boolean, attribute: 'show-vendor' },\n showProductTitle: { type: Boolean, attribute: 'show-product-title' },\n showPrice: { type: Boolean, attribute: 'show-price' },\n ctaButton: { type: Boolean, attribute: 'cta-button' },\n productOptions: { type: Boolean, attribute: 'product-options' },\n };\n }\n\n constructor() {\n super();\n\n this.form = new ProductFormController(this);\n }\n\n willUpdate(changedProperties) {\n if (changedProperties.has('wishlistItem')) {\n this.form.setProduct({\n product: this.wishlistItem.product,\n selectedVariantId: this.wishlistItem.variantId,\n autoSelect: false,\n });\n }\n }\n\n getStateConfig() {\n return {\n loading: 'lazy',\n wishlistItem: {\n productMetafields: [\n // { namespace: \"custom\", key: \"mykey\" }\n ],\n },\n };\n }\n\n getEventConfig() {\n return {\n 'change .wk-form': async (event) => {\n if (event.target.name === 'quantity') {\n return;\n }\n\n this.form.changeOption({\n input: event.target,\n autoSelect: false,\n });\n\n if (this.form.selectedVariant && this.wishlist.isMine) {\n await this.app.updateWishlistItem({\n wishlistItemId: this.wishlistItem.id,\n changes: {\n variantId: this.form.selectedVariant.id,\n },\n });\n }\n },\n 'submit .wk-form': async (event) => {\n event.preventDefault();\n\n await this.form.addToCart({\n wishlistId: this.wishlist.id,\n wishlistItemId: this.wishlistItem.id,\n });\n\n if (this.moveToCart && this.wishlist.isMine) {\n await this.app.removeWishlistItem({\n wishlistItemId: this.wishlistItem.id,\n });\n }\n\n window.location.href = this.app.routes.cartUrl;\n },\n };\n }\n\n render() {\n if (!this.wishlistItem.product.id) {\n return html`
${this.renderLoadingState()}
`;\n }\n\n if (this.wishlistItem.product.hidden) {\n return html`
${this.renderUnavailableState()}
`;\n }\n\n const product = this.wishlistItem.product;\n const variant = this.form.selectedVariant;\n\n return html`\n
\n \n \n \n
\n ${this.renderVendor({ product, variant })}\n ${this.renderProductTitle({ product, variant })} ${this.renderPrice({ product, variant })}\n
\n ${this.renderProductForm({ product, variant })} ${this.renderRemoveButton()}\n
\n `;\n }\n\n renderVendor({ product }) {\n if (!this.showVendor) {\n return;\n }\n return html`${product.vendor}`;\n }\n\n renderProductTitle({ product, variant }) {\n if (!this.showProductTitle) {\n return;\n }\n return html`\n
\n ${product.title} \n
\n `;\n }\n\n renderPrice({ product, variant }) {\n if (!this.showPrice) {\n return;\n }\n return html`\n
\n ${this.renderComparePrice({ product, variant })}\n ${this.renderCurrentPrice({ product, variant })}\n
\n ${this.renderUnitPrice({ product, variant })}\n `;\n }\n\n renderCurrentPrice({ product, variant }) {\n if (variant) {\n const sale = variant.price < variant.compare_at_price;\n\n return html`\n \n ${this.renderMoney(variant.price)}\n \n `;\n }\n\n if (product.price_min !== product.price_max) {\n return html`\n \n ${this.getTranslation('wishlist_product.from_price_html', {\n price: this.formatMoney(product.price_min),\n })}\n \n `;\n }\n\n return html` ${this.renderMoney(product.price_min)} `;\n }\n\n renderComparePrice({ variant }) {\n if (variant && variant.price < variant.compare_at_price) {\n return html`\n ${this.renderMoney(variant.compare_at_price)} \n `;\n }\n }\n\n renderUnitPrice({ variant }) {\n if (!variant) {\n return;\n }\n\n const unitPrice = variant.unit_price_measurement;\n\n if (!unitPrice) {\n return;\n }\n\n const baseUnit =\n unitPrice.reference_value != 1 ? unitPrice.reference_value : unitPrice.reference_unit;\n\n return html`\n
\n ${this.renderMoney(variant.unit_price)}\n / \n ${baseUnit}\n
\n `;\n }\n\n renderProductForm({ product, variant }) {\n return html`\n \n \n ${this.renderProductOptions()}\n
\n \n \n
\n ${this.renderCta({ product, variant })}\n \n `;\n }\n\n renderCta({ product, variant }) {\n const getCtaText = () => {\n if (this.ctaButton === 'view-product') {\n return this.getTranslation('wishlist_product.view_product');\n }\n if (!variant && this.form.hasSelection) {\n return this.getTranslation('wishlist_product.unavailable');\n } else if (!variant) {\n return this.getTranslation('wishlist_product.select_option', {\n name: this.form.optionsWithValues.find((option) => !option.selectedValue).name,\n });\n }\n\n if (!variant.available) {\n return this.getTranslation('wishlist_product.sold_out');\n }\n\n return this.getTranslation('wishlist_product.add_to_cart');\n };\n\n switch (this.ctaButton) {\n case 'add-to-cart':\n return html`\n \n ${getCtaText()}\n \n \n `;\n case 'view-product':\n return html`\n \n ${getCtaText()}\n \n `;\n default:\n case 'none':\n return null;\n }\n }\n\n renderProductOptions() {\n if (this.form.hasOnlyDefaultVariant) {\n return;\n }\n\n switch (this.productOptions) {\n case 'dropdowns':\n return html`\n
\n ${this.form.optionsWithValues.map(\n (option) =>\n html`\n \n `\n )}\n
\n `;\n case 'swatches':\n return html`\n
\n ${this.form.optionsWithValues.map(\n (option) =>\n html`\n \n `\n )}\n
\n `;\n default:\n case 'none':\n return null;\n }\n }\n\n getColorMap(option) {\n return;\n }\n\n renderLoadingState() {\n return html`\n
\n \n
\n \n `;\n }\n\n renderUnavailableState() {\n return html`\n
\n \n
\n
\n  \n \n ${this.getTranslation('wishlist_page.product_removed_html')}\n \n
\n ${this.renderRemoveButton()}\n `;\n }\n\n renderRemoveButton() {\n if (!this.wishlist.isMine) {\n return;\n }\n\n const floatSettings = {\n reference: this,\n position: {\n placement: 'top-end',\n inset: true,\n },\n };\n\n return html`\n \n `;\n }\n}\n\nexport class RemoveButton extends WishlistElement {\n static get properties() {\n return {\n floating: { type: Object },\n showIcon: { type: Boolean, attribute: 'show-icon' },\n showText: { type: Boolean, attribute: 'show-text' },\n };\n }\n\n getEventConfig() {\n return {\n 'click .wk-button': this.handleClick,\n };\n }\n\n handleClick() {\n return this.app.removeWishlistItem({\n wishlistItemId: this.dataset.wishlistItemId,\n });\n }\n\n render() {\n const text = this.getTranslation('wishlist_page.remove_product');\n const hint = this.getTranslation('wishlist_page.remove_product');\n\n return html`\n \n `;\n }\n}\n\nexport class WishlistAddToCart extends WishlistElement {\n static get properties() {\n return {\n moveToCart: { type: Boolean, attribute: 'move-to-cart' },\n loading: { type: Boolean, state: true },\n };\n }\n\n getStateConfig() {\n return {\n wishlist: true,\n };\n }\n\n getEventConfig() {\n return {\n 'click wk-button': this.handleClick,\n };\n }\n\n async handleClick() {\n this.loading = true;\n\n const { wishlistItems } = await this.app.addAllToCart({\n wishlistId: this.wishlist.id,\n });\n\n if (this.moveToCart && this.wishlist.isMine) {\n // TODO: Remove added items from list\n }\n\n if (wishlistItems.length) {\n window.location.href = this.app.routes.cartUrl;\n }\n\n this.loading = false;\n }\n\n render() {\n const text = this.getTranslation('wishlist_page.add_all_to_cart');\n\n return html`\n \n `;\n }\n}\n\nexport class WishlistShare extends WishlistElement {\n static get properties() {\n return {\n layout: { type: String },\n floating: { type: Object },\n linkCopied: { type: Boolean, state: true },\n };\n }\n\n getStateConfig() {\n return {\n wishlist: true,\n };\n }\n\n getEventConfig() {\n return {\n 'click wk-button': this.handleClick,\n };\n }\n\n async handleClick() {\n const { clipboard } = await this.app.shareWishlist({\n wishlistId: this.wishlist.publicId,\n title: this.getTranslation('wishlist_share.share_title'),\n text: this.getTranslation('wishlist_share.share_message'),\n });\n\n if (clipboard) {\n this.linkCopied = true;\n await new Promise((resolve) => setTimeout(resolve, 2000));\n this.linkCopied = false;\n }\n }\n\n render() {\n const text = this.getTranslation(\n this.linkCopied ? 'wishlist_share.link_copied' : 'wishlist_share.button_label'\n );\n\n return html`\n \n `;\n }\n}\n\nexport class WishlistClear extends WishlistElement {\n getStateConfig() {\n return {\n wishlist: true,\n };\n }\n\n getEventConfig() {\n return {\n 'click wk-button': this.handleClick,\n };\n }\n\n async handleClick() {\n await this.app.clearWishlist();\n }\n\n render() {\n const text = this.getTranslation('wishlist_buttons.clear_wishlist');\n\n return html`\n \n `;\n }\n}\n\ncustomElements.define('wishlist-page', WishlistPage);\ncustomElements.define('wishlist-product-card', WishlistProductCard);\ncustomElements.define('remove-button', RemoveButton);\ncustomElements.define('wishlist-add-to-cart', WishlistAddToCart);\ncustomElements.define('wishlist-share', WishlistShare);\ncustomElements.define('wishlist-clear', WishlistClear);\n"],"names":["WishlistPage","WishlistElement","properties","moveToCart","type","Boolean","attribute","loginCtaMode","String","variantAutoSelectMode","showVendor","showProductTitle","showPrice","showShareButton","showBuyAllButton","showClearButton","ctaButton","productOptions","wishlistEmptyLink","getStateConfig","wishlist","render","this","html","renderHeader","renderWishlistItems","getTranslation","renderWishlistEmptyCallout","renderLoginCallout","renderControls","items","length","id","undefined","app","customer","isMine","login_url","routes","accountLoginUrl","register_url","accountRegisterUrl","wishlistItems","slice","reverse","repeat","wishlistItem","connectedCallback","dataset","wishlistId","theme","getWishlistId","window","location","pathname","loadWithoutSession","super","WishlistProductCard","Object","constructor","form","ProductFormController","willUpdate","changedProperties","has","setProduct","product","selectedVariantId","variantId","autoSelect","loading","productMetafields","getEventConfig","async","event","target","name","changeOption","input","selectedVariant","updateWishlistItem","wishlistItemId","changes","preventDefault","addToCart","removeWishlistItem","href","cartUrl","renderLoadingState","hidden","renderUnavailableState","variant","getProductUrl","getImageUrl","width","height","renderVendor","renderProductTitle","renderPrice","renderProductForm","renderRemoveButton","vendor","title","renderComparePrice","renderCurrentPrice","renderUnitPrice","sale","price","compare_at_price","renderMoney","price_min","price_max","formatMoney","unitPrice","unit_price_measurement","baseUnit","reference_value","reference_unit","unit_price","cartAddUrl","renderProductOptions","renderCta","getCtaText","hasSelection","optionsWithValues","find","option","selectedValue","available","url","hasOnlyDefaultVariant","map","getColorMap","floatSettings","reference","position","placement","inset","RemoveButton","floating","showIcon","showText","handleClick","text","hint","WishlistAddToCart","state","addAllToCart","WishlistShare","layout","linkCopied","clipboard","shareWishlist","publicId","Promise","resolve","setTimeout","WishlistClear","clearWishlist","customElements","define"],"mappings":"+iBAOA,MAAMA,qBAAqBC,gBACzB,qBAAWC,GACT,MAAO,CACLC,WAAY,CAAEC,KAAMC,QAASC,UAAW,gBACxCC,aAAc,CAAEH,KAAMI,OAAQF,UAAW,kBACzCG,sBAAuB,CACrBL,KAAMI,OACNF,UAAW,4BAEbI,WAAY,CAAEN,KAAMC,QAASC,UAAW,eACxCK,iBAAkB,CAAEP,KAAMC,QAASC,UAAW,sBAC9CM,UAAW,CAAER,KAAMC,QAASC,UAAW,cACvCO,gBAAiB,CAAET,KAAMC,QAASC,UAAW,qBAC7CQ,iBAAkB,CAAEV,KAAMC,QAASC,UAAW,uBAC9CS,gBAAiB,CAAEX,KAAMC,QAASC,UAAW,qBAC7CU,UAAW,CAAEZ,KAAMI,OAAQF,UAAW,cACtCW,eAAgB,CAAEb,KAAMI,OAAQF,UAAW,mBAC3CY,kBAAmB,CAAEd,KAAMI,OAAQF,UAAW,uBAEjD,CAED,cAAAa,GACE,MAAO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