{"version":3,"file":"shared_wishlist-BS5oYE9D.js","sources":["../../../app/javascript/apps/shared_wishlist/app.vue","../../../app/javascript/apps/shared_wishlist/store/wishlist/main.js","../../../app/javascript/apps/shared_wishlist/store/main.js","../../../app/javascript/apps/shared_wishlist/plugins/constants.js","../../../app/javascript/entrypoints/shared_wishlist.js"],"sourcesContent":["\n\n\n\n\n","import wishlistStorage from '@ProductWishlist/services/storage.js'\n\nfunction getWihslitItems() {\n const element = document.querySelector('.frcp-wishlist-page')\n\n return JSON.parse(element.dataset.wishlistItems)\n}\n\nfunction getItems() {\n let storedWishlist = getWihslitItems()\n let items = []\n\n Object.entries(storedWishlist).forEach(([productHandle, variantIds]) => {\n variantIds.forEach((variantId) => {\n items.push([productHandle, variantId])\n })\n })\n\n return items\n}\n\nfunction removeItem(array, productHandle, variantId) {\n return array.filter(function (item) {\n return (item[0] != productHandle) || (item[1] != variantId)\n })\n}\n\nfunction getSharedUrls() {\n const urls = {}\n urls[frcp.wishlist.sharePageList] = window.location.href\n return urls\n}\n\nconst state = {\n items: getItems(),\n showList: frcp.wishlist.sharePageList,\n sharedUrls: getSharedUrls(),\n socialAppIds: frcp.wishlist.socialAppIds,\n}\n\nconst mutations = {\n delete: (state, options) => {\n const productHandle = options['handle']\n const variantId = options['variantId']\n\n return state.items = removeItem(state.items, productHandle, variantId)\n },\n setSharedUrl: (state, url) => state.sharedUrl = url\n}\n\nexport default {\n namespaced: true,\n state,\n mutations\n}\n","import { createStore } from 'vuex'\nimport wishlistModule from './wishlist/main.js'\nimport productsModule from '@CustomerPage/store/products/main.js'\n\nexport default createStore({\n state: {\n profile: frcp.wishlist.profile\n },\n modules: {\n wishlist: wishlistModule,\n products: productsModule,\n }\n});\n","import fetchWrapper from '@CustomerPage/services/fetch_wrapper'\n\nexport default {\n install: (app, options) => {\n app.config.globalProperties.$constants = {\n mobileScreenWidth: 767,\n }\n\n app.config.globalProperties.$settings = window.frcp.wishlist.settings\n\n app.config.globalProperties.$customMethods = {\n stayOnPageAfterWishlistAdded: function () {\n if (frcp.customerPage.sharedBySameCustomer) window.location.reload()\n }\n }\n\n app.config.globalProperties.$fetch = fetchWrapper.jsonClient\n app.config.globalProperties.$httpFetch = fetchWrapper.httpClient\n }\n}\n","import { createApp } from 'vue'\n\nimport App from '@SharedWishlist/app.vue'\nimport store from '@SharedWishlist/store/main.js'\nimport '@JS/shared/styles/variables.scss'\nimport constantsPlugin from '@SharedWishlist/plugins/constants.js'\nimport swal from '@CustomerPage/plugins/swal2.js'\nimport TranslationsPlugin from '@CustomerPage/plugins/translations.js'\nimport MoneyFormatPlugin from '@CustomerPage/plugins/money_format.js'\nimport utilsMixins from '@CustomerPage/plugins/utils_mixin.js'\n\n\nconst initApp = () => {\n window.frcpWLShare = createApp(App)\n\n frcpWLShare.use(store)\n frcpWLShare.use(constantsPlugin)\n frcpWLShare.use(MoneyFormatPlugin)\n frcpWLShare.use(utilsMixins, { settings: frcp.customerPage.settings })\n frcpWLShare.use(TranslationsPlugin)\n frcpWLShare.use(swal)\n const el = document.querySelector('.frcp-wishlist-page')\n\n const appWrapper = document.createElement('div')\n appWrapper.id = 'frcp_wishlist_share_app'\n frcpWLShare.mount(appWrapper)\n el.classList.remove('frcp-wishlist-page--loading')\n el.append(appWrapper)\n}\n\nif (document.readyState !== 'loading') {\n initApp()\n} else {\n document.addEventListener('DOMContentLoaded', initApp)\n}\n"],"names":["_sfc_main","Wishlist","eventDispatcher","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_component_Wishlist","getWihslitItems","element","getItems","storedWishlist","items","productHandle","variantIds","variantId","removeItem","array","item","getSharedUrls","urls","state","mutations","options","url","wishlistModule","store","createStore","productsModule","constantsPlugin","app","fetchWrapper","initApp","createApp","App","MoneyFormatPlugin","utilsMixins","TranslationsPlugin","swal","el","appWrapper"],"mappings":"wpBAaE,MAAKA,EAAU,CACb,WAAY,CAAE,SAAAC,CAAU,EACxB,SAAU,CACR,KAAK,UAAU,IAAM,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