{"version":3,"file":"storage-C9hoTwqF.js","sources":["../../../app/javascript/apps/product_wishlist/services/requester.js","../../../app/javascript/apps/product_wishlist/services/storage.js"],"sourcesContent":["import fetchWrapper from '@CustomerPage/services/fetch_wrapper'\n\nconst UPDATE_WISHLIST_MUTATION = `\n mutation updateWishlist($input: UpdateWishlistInput!) {\n updateWishlist(input: $input) {\n error\n variantExternalIds\n inWishlist\n productId\n productTitle\n productPrice\n guestId\n list\n }\n}\n`\n\nconst SYNC_GUEST_WISHLIST_MUTATION = `\n mutation syncGuestWishlist($input: SyncGuestWishlistInput!) {\n syncGuestWishlist(input: $input) {\n error\n }\n}\n`\n\nconst ADD_TO_CART_WISHLIST_MUTATION = `\n mutation addToCartWishlist($input: AddToCartWishlistInput!) {\n addToCartWishlist(input: $input) {\n error\n }\n}\n`\n\nconst DELETE_MUTATION = `\n mutation updateWishlist($input: UpdateWishlistInput!) {\n updateWishlist(input: $input) {\n error\n }\n}\n`\n\nconst CREATE_WISHLIST_LIST_MUTATION = `\n mutation createWishlistList($input: CreateWishlistListInput!) {\n createWishlistList(input: $input) {\n error\n list\n }\n}\n`\n\nconst ACTIVATE_WISHLIST_LIST_MUTATION = `\n mutation activateWishlistList($input: ActivateWishlistListInput!) {\n activateWishlistList(input: $input) {\n error\n list\n }\n}\n`\n\nconst APP_PROXI_URL = `${window.frcp.appProxy}/api/graphql`\nconst APP_URL = `${window.frcp.httpsUrl}/api/graphql`\nexport default {\n updateWishlist(input, successCallback, errorCallback) {\n return this.request({ input, query: UPDATE_WISHLIST_MUTATION, queryName: 'updateWishlist', successCallback, errorCallback })\n },\n\n syncGuestWishlist(input, successCallback, errorCallback) {\n return this.request({ input, query: SYNC_GUEST_WISHLIST_MUTATION, queryName: 'syncGuestWishlist', successCallback, errorCallback })\n },\n\n sendAddToCartWishlistRequest(input, successCallback, errorCallback) {\n return this.request({ input, query: ADD_TO_CART_WISHLIST_MUTATION, queryName: 'addToCartWishlist', successCallback, errorCallback })\n },\n\n sentRequestToDeleteWishlistItem(input, successCallback, errorCallback) {\n return this.request({ input, query: DELETE_MUTATION, queryName: 'updateWishlist', successCallback, errorCallback })\n },\n\n sendCreateWihslistListRequest(input, successCallback, errorCallback) {\n return this.request({ input, query: CREATE_WISHLIST_LIST_MUTATION, queryName: 'createWishlistList', successCallback, errorCallback })\n },\n\n sendActivateWishlistListRequest(input, successCallback, errorCallback) {\n return this.request({ input, query: ACTIVATE_WISHLIST_LIST_MUTATION, queryName: 'activateWishlistList', successCallback, errorCallback })\n },\n\n request({ input, query, queryName, successCallback, errorCallback }) {\n const url = window.frcp.useAppProxi ? APP_PROXI_URL : APP_URL\n const body = {\n query: query,\n variables: { input: input },\n }\n\n return fetchWrapper.jsonClient(url, {\n method: 'POST',\n body: body,\n headers: {\n 'x-shop-domain': window.frcp.shopDomain,\n 'x-shop-token': window.frcp.shopToken,\n 'Access-Control-Allow-Origin': '*',\n },\n })\n .then(response => {\n if (response.data[queryName].error) {\n console.log(response.data[queryName].error)\n if (errorCallback) errorCallback(response.data[queryName].error)\n return\n }\n if (successCallback) successCallback(response)\n }).catch(error => {\n console.log(error)\n if (errorCallback) errorCallback(error)\n })\n },\n}\n","import requester from './requester.js'\nexport default {\n update,\n sync,\n activateList,\n createList\n}\n\nconst DEFAULT_LIST = 'default'\nconst EMPTY_GUEST_DATA = {\n guestId: null,\n add: {},\n remove: {}\n}\n\nconst EMPTY_WISHLIST = {\n lists: {\n default: {}\n },\n listNames: [DEFAULT_LIST],\n}\n\n\nfunction update({ handle, variantId, remove, guestId, list } = {}) {\n sync()\n // ensure we store only id's\n variantId = parseInt(variantId)\n frcp.wishlist.profile.id ? updateList(handle, variantId, remove, list) : updateGuest(handle, variantId, remove, guestId, list)\n\n frcp.wishlist.data['updatedAt'] = new Date().valueOf()\n window.localStorage.setItem('frcp_wishlist', JSON.stringify(frcp.wishlist.data))\n}\n\nfunction updateList(handle, variantId, remove, list) {\n list = list || frcp.wishlist.data.activeList\n\n if (remove) {\n let variants = frcp.wishlist.data.lists[list][handle]\n if (!variants) return;\n\n if (variants.length > 1) {\n variants = variants.filter(item => item !== variantId)\n frcp.wishlist.data.lists[list][handle] = variants\n } else {\n delete frcp.wishlist.data.lists[list][handle]\n }\n } else {\n frcp.wishlist.data.lists[list][handle] ||= []\n if (frcp.wishlist.data.lists[list][handle].indexOf(variantId) < 0) {\n frcp.wishlist.data.lists[list][handle].push(variantId)\n }\n }\n}\n\nfunction updateGuest(handle, variantId, remove, guestId, list) {\n frcp.wishlist.data.guest.guestId = guestId\n frcp.wishlist.data.guest.list = list\n if (remove) {\n frcp.wishlist.data.guest.remove[handle] ||= []\n let addedVariants = frcp.wishlist.data.guest.add[handle] || []\n // add it to remove if its not added as guest and is not in removed \n if (addedVariants.indexOf(variantId) < 0 && frcp.wishlist.data.guest.remove[handle].indexOf(variantId) < 0) {\n frcp.wishlist.data.guest.remove[handle].push(variantId)\n }\n\n if (addedVariants.length == 0) return;\n\n addedVariants = addedVariants.filter(item => item !== variantId)\n frcp.wishlist.data.guest.add[handle] = addedVariants\n\n if (frcp.wishlist.data.guest.add[handle].length < 1) delete frcp.wishlist.data.guest.add[handle]\n } else {\n frcp.wishlist.data.guest.add[handle] ||= []\n if (frcp.wishlist.data.guest.add[handle].indexOf(variantId) < 0) {\n frcp.wishlist.data.guest.add[handle].push(variantId)\n }\n\n let variants = frcp.wishlist.data.guest.remove[handle]\n if (!variants) return;\n\n variants = variants.filter(item => item !== variantId)\n frcp.wishlist.data.guest.remove[handle] = variants\n\n if (frcp.wishlist.data.guest.remove[handle].length < 1) delete frcp.wishlist.data.guest.remove[handle]\n }\n}\n\nfunction sync() {\n let localStorageWishlist = window.localStorage.getItem('frcp_wishlist')\n\n if (localStorageWishlist) {\n try {\n localStorageWishlist = JSON.parse(localStorageWishlist)\n } catch (error) {\n localStorageWishlist = EMPTY_WISHLIST\n }\n } else {\n localStorageWishlist = EMPTY_WISHLIST\n }\n\n if (frcp.wishlist.data.updatedAt) {\n frcp.wishlist.data.updatedAt = new Date(frcp.wishlist.data.updatedAt).valueOf()\n }\n\n\n const newCustomer = frcp.wishlist.data.customerId && (localStorageWishlist.customerId != frcp.wishlist.data.customerId)\n const localStorageIsNewer = !frcp.wishlist.data.updatedAt || (localStorageWishlist.updatedAt && (localStorageWishlist.updatedAt > frcp.wishlist.data.updatedAt))\n\n // new custommer log in, we should take the metafields wishlist as correct\n // same customerId or customer is not logged in so we should choose the one updated last \n if (!newCustomer && localStorageIsNewer) {\n frcp.wishlist.data = localStorageWishlist\n }\n\n // guest data can only come from local storage\n frcp.wishlist.data.guest = localStorageWishlist.guest\n\n normalizeMultiList()\n syncGuestAndStore()\n\n return frcp.wishlist.data\n}\n\nfunction normalizeMultiList() {\n frcp.wishlist.data.lists = frcp.wishlist.data.lists || {}\n if (frcp.wishlist.data.items) frcp.wishlist.data.lists[DEFAULT_LIST] = frcp.wishlist.data.items\n\n frcp.wishlist.data.activeList = frcp.wishlist.data.activeList || DEFAULT_LIST\n frcp.wishlist.data.listNames = frcp.wishlist.data.listNames || [DEFAULT_LIST]\n\n frcp.wishlist.data.listNames.forEach(list => {\n frcp.wishlist.data.lists[list] = frcp.wishlist.data.lists[list] || {}\n })\n\n frcp.wishlist.data.sharedWishlistSlugs = frcp.wishlist.data.sharedWishlistSlugs || {}\n if (frcp.wishlist.data.sharedWishlistSlug) frcp.wishlist.data.sharedWishlistSlugs[DEFAULT_LIST] = frcp.wishlist.data.sharedWishlistSlug\n}\n\nfunction syncGuestAndStore() {\n frcp.wishlist.data.guest = frcp.wishlist.data.guest || EMPTY_GUEST_DATA\n if (!frcp.wishlist.profile.id || !frcp.wishlist.data.guest.guestId) {\n window.localStorage.setItem('frcp_wishlist', JSON.stringify(frcp.wishlist.data))\n return\n }\n\n let guestItemsCount = 0\n // ensure that guest list is part of current active lists\n let list = frcp.wishlist.data.guest.list\n if (frcp.wishlist.data.listNames.indexOf(list) < 0) list = frcp.wishlist.data.activeList\n\n // updateList is idenpotent so it can be run multiple times \n Object.keys(frcp.wishlist.data.guest.add).forEach(function (handle) {\n frcp.wishlist.data.guest.add[handle].forEach(variantId => updateList(handle, variantId, false, list))\n guestItemsCount += 1\n })\n\n Object.keys(frcp.wishlist.data.guest.remove).forEach(function (handle) {\n frcp.wishlist.data.guest.remove[handle].forEach(variantId => updateList(handle, variantId, true, list))\n guestItemsCount += 1\n })\n\n if (guestItemsCount == 0) {\n window.localStorage.setItem('frcp_wishlist', JSON.stringify(frcp.wishlist.data))\n return\n }\n\n // on account page this code is run by both wishlist and account page js. It should ran once once\n if (frcp.wishlist.guestSyncing) return;\n frcp.wishlist.guestSyncing = true\n\n const input = {\n customerExternalId: frcp.wishlist.profile.id,\n froonzeToken: frcp.wishlist.profile.froonzeToken,\n guestId: frcp.wishlist.data.guest.guestId,\n add: frcp.wishlist.data.guest.add,\n remove: frcp.wishlist.data.guest.remove,\n list: list,\n }\n\n requester.syncGuestWishlist(\n input,\n () => {\n frcp.wishlist.data.updatedAt = new Date().valueOf()\n frcp.wishlist.data.guest = EMPTY_GUEST_DATA\n window.localStorage.setItem('frcp_wishlist', JSON.stringify(frcp.wishlist.data))\n },\n () => { }\n )\n}\n\nfunction activateList(list) {\n sync()\n frcp.wishlist.data.activeList = list\n if (frcp.wishlist.data.listNames.indexOf(list) < 0) frcp.wishlist.data.listNames.push(list)\n frcp.wishlist.data.updatedAt = new Date().valueOf()\n\n window.localStorage.setItem('frcp_wishlist', JSON.stringify(frcp.wishlist.data))\n}\n\nfunction createList(list) {\n sync()\n if (frcp.wishlist.data.listNames.indexOf(list) < 0) {\n frcp.wishlist.data.listNames.push(list)\n frcp.wishlist.data.updatedAt = new Date().valueOf()\n\n window.localStorage.setItem('frcp_wishlist', JSON.stringify(frcp.wishlist.data))\n }\n}\n"],"names":["UPDATE_WISHLIST_MUTATION","SYNC_GUEST_WISHLIST_MUTATION","ADD_TO_CART_WISHLIST_MUTATION","DELETE_MUTATION","CREATE_WISHLIST_LIST_MUTATION","ACTIVATE_WISHLIST_LIST_MUTATION","APP_PROXI_URL","APP_URL","requester","input","successCallback","errorCallback","query","queryName","url","body","fetchWrapper","response","error","wishlistStorage","update","sync","activateList","createList","DEFAULT_LIST","EMPTY_GUEST_DATA","EMPTY_WISHLIST","handle","variantId","remove","guestId","list","updateList","updateGuest","variants","item","_a","addedVariants","_b","localStorageWishlist","newCustomer","localStorageIsNewer","normalizeMultiList","syncGuestAndStore","guestItemsCount"],"mappings":"gDAEA,MAAMA,EAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAe3BC,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ/BC,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhCC,EAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlBC,EAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShCC,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlCC,EAAgB,GAAG,OAAO,KAAK,QAAQ,eACvCC,EAAU,GAAG,OAAO,KAAK,QAAQ,eACxBC,EAAA,CACb,eAAeC,EAAOC,EAAiBC,EAAe,CACpD,OAAO,KAAK,QAAQ,CAAE,MAAAF,EAAO,MAAOT,EAA0B,UAAW,iBAAkB,gBAAAU,EAAiB,cAAAC,CAAe,CAAA,CAC5H,EAED,kBAAkBF,EAAOC,EAAiBC,EAAe,CACvD,OAAO,KAAK,QAAQ,CAAE,MAAAF,EAAO,MAAOR,EAA8B,UAAW,oBAAqB,gBAAAS,EAAiB,cAAAC,CAAe,CAAA,CACnI,EAED,6BAA6BF,EAAOC,EAAiBC,EAAe,CAClE,OAAO,KAAK,QAAQ,CAAE,MAAAF,EAAO,MAAOP,EAA+B,UAAW,oBAAqB,gBAAAQ,EAAiB,cAAAC,CAAe,CAAA,CACpI,EAED,gCAAgCF,EAAOC,EAAiBC,EAAe,CACrE,OAAO,K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