PageSourceSearch

https://hobbii.fi/cdn/shop/t/34/assets/hobbii-product-BmhgILJ5.min.js

js hobbii.fi collected 2026-09-26 08:53:27 UTC 8,395 bytes, 2 lines download raw bytes

1var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,l=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,o=(e,t,n)=>new Promise(((i,r)=>{var a=e=>{try{o(n.next(e))}catch(t){r(t)}},l=e=>{try{o(n.throw(e))}catch(t){r(t)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(a,l);o((n=n.apply(e,t)).next())}));import{d as u}from"./hobbii-pinia-C9rnC9LE.min.js";import{h as c}from"./hobbii-constants-DXYrb0R4.min.js";import{b as s,c as d,aG as p,ad as v}from"./hobbii-country-switcher-BNm3Hsht.min.js";import{j as y,u as b,x as m}from"./hobbii-user-59Q2brLQ.min.js";import{g,f}from"./hobbii-money-formatter-CDf4gx3t.min.js";import{u as h}from"./hobbii-config-BWj0BaFh.min.js";import{b as P,c as S,d as w}from"./hobbii-dom-SvEnDmWr.min.js";import{notifyBugsnagWithContext as O}from"./hobbii-error-2u2rc1Ql.min.js";const I=g('\n  query ProductGroupIdByHandle($handle: String!) {\n    product(handle: $handle) {\n      entityId: metafield(namespace: "hobbii", key: "product_group_id") {\n        value\n      }\n    }\n  }\n'),k=g('\n  query suggestions($query: String!) {\n    predictiveSearch(\n      query: $query\n      types: [PRODUCT]\n      searchableFields: [VARIANTS_SKU]\n    ) {\n      products {\n        id\n        title\n        onlineStoreUrl\n        featuredImage {\n          url\n          altText\n          height\n          width\n        }\n        sanityEntityId: metafield(namespace: "hobbii", key: "entity_id") {\n          value\n        }\n        hobbiiSku: metafield(namespace: "hobbii", key: "sku") {\n          value\n        }\n        openCartId: metafield(namespace: "hobbii", key: "opencart_id") {\n          value\n        }\n      }\n    }\n  }\n'),D=(e,t)=>!e&&t,j=(e,o)=>e?JSON.parse(e).map((e=>{const u=o*e.discount_percentage/100;return((e,i)=>t(e,n(i)))(((e,t)=>{for(var n in t||(t={}))r.call(t,n)&&l(e,n,t[n]);if(i)for(var n of i(t))a.call(t,n)&&l(e,n,t[n]);return e})({},e),{price_before:o,price_unit:o-u})})):null,q=(e,t)=>e.find(((e,n,i)=>{const r=i[n+1];return t>=e.quantity&&(!r||t<r.quantity)})),_=(e,t,n)=>T(e,t,n).price_unit,B=(e=[])=>0===e.length?null:e.reduce(((e,t)=>e.discount_percentage>t.discount_percentage?e:t)),T=(e,t,n)=>{const i=q(e,t);return null!=i?i:{quantity:1,discount_percentage:0,price_unit:n}},A=u("product-quantities",(()=>{const e=s([]),t=s(1),n=d((()=>e.value.length));return{bulkDiscounts:e,quantity:t,selectedBulkDiscount:(n=t.value)=>q(e.value,n),highestDiscountItem:()=>B(e.value),updateQuantity:n=>{t.value=n;if(e.value.length>0){L().updatePriceByQuantity()}},setBulkDiscounts:t=>{e.value=t},bulkDiscountsAvailable:n}})),R=Object.freeze({ProductPage:"productPage"}),U={[R.ProductPage]:{smScreen:4,mdScreen:5,lgScreen:6,xlScreen:7}},C=u("product-options",(()=>{const e=s(null),t=s([]),n=s(null),i=s(!1),r=s(0),a=s(!1),l=d((()=>{var n,i;return null!=(i=null!=(n=e.value)?n:t.value.find((e=>{var t,n;return e.id===(null==(n=null==(t=window.Hobbii)?void 0:t.productPage)?void 0:n.targetVariantId)})))?i:t.value[0]})),o=d((()=>t.value.length>0&&!!n.value)),u=d((()=>{var t;return(null==(t=e.value)?void 0:t.id)?e.value.inStock:c.value&&0!=c.value.length})),c=d((()=>t.value.filter((e=>e.inStock)))),v=d((()=>t.value.filter((e=>!e.inStock)))),y=d((()=>{var t;return o.value&&!!(null==(t=e.value)?void 0:t.id)||!o.value})),b=d((()=>t.value.every((e=>e.discontinued))));return{activeOption:e,options:t,kind:n,showOptionsModal:i,modalOptionsPosition:r,haveDifferentPrices:a,targetVariant:l,productInStock:u,optionsInStock:c,optionsOutOfStock:v,blocksNumberCalculation:e=>{const t=L(),n=P(e),i=S(e),r=w(e),a=t.getStrategy,l=(e=>e in U)(a)?U[a]:U[R.ProductPage];let o=l.smScreen;return r?o=l.mdScreen:n&&!i?o=l.lgScreen:i&&(o=l.xlScreen),o},isOptionSelected:y,updateActiveOption:t=>{const n=L();p("variant",t.id.toString()),e.value=t,E(t.title),(e=>{window.dispatchEvent(new CustomEvent("changed.hobbii.product.image",{detail:{imageUrl:e.consolidatedImageUrl}}))})(t),a.value&&(n.updatePriceByVariant(t),(e=>{const t=document.querySelector("[data-pp-message]");t&&t.setAttribute("data-pp-amount",(e/100).toFixed(2))})(t.price))},productIsDiscontinued:b}})),E=e=>{const t=document.title.split(" - "),n=3===t.length;t.splice(1,n?1:0,e),document.title=t.join(" - ")},L=u("product",(()=>{const e=s(null),t=s(null),n=s(null),i=s(null),r=s(null),a=s(""),l=s(!0),u=s(c.PRODUCT),p=s(null),g=s(null),P=s(null),S=s({initial_unit:null,unit:null,before:null,savings:null}),{updateDOMPricesAndSavings:w,calculateNewPricesByQuantityChange:k,calculateNewPricesByVariantChange:D}=(()=>{const e=L();return{calculateNewPricesByQuantityChange:()=>{var t,n;const i=A(),r=C(),a=i.selectedBulkDiscount();if(e.price.unit=e.price.initial_unit,e.price.before=null,e.price.savings=null,!a)return;let l=r.activeOption;if(!l){const e=null==(n=null==(t=window.Hobbii)?void 0:t.productPage)?void 0:n.targetVariantId;l=e?r.options.find((t=>t.id===e))||null:r.options[0]}a.discount_percentage&&l?(e.price.initial_unit=l.price,e.price.unit=a.price_unit||e.price.initial_unit,e.price.before=l.priceBefore||l.compare_at_price,e.price.savings=(a.price_before||0)-e.price.unit):(e.price.before=null,e.price.savings=null)},calculateNewPricesByVariantChange:t=>{const n=t.priceBefore!==t.price;e.price.initial_unit=t.price,n?(e.price.unit=t.price,e.price.before=t.priceBefore,e.price.savings=(t.priceBefore||0)-(t.price||0)):(e.price.unit=t.priceBefore,e.price.before=null,e.price.savings=null)},updateDOMPricesAndSavings:()=>{var t;const n=C(),i=h(),r=document.querySelector(".js-price"),a=document.querySelector(".js-price-before"),l=document.querySelector(".js-price-wrapper"),o=document.querySelector(".js-points-wrapper"),u=document.querySelector(".js-price-save"),c=document.querySelectorAll(".js-price-from-label");e.price.unit&&(l&&(l.innerHTML=f(null!=(t=e.price.unit)?t:"")),o&&(o.innerHTML=i.calculatedPoints(e.price.unit).toString()));const s=e.price.savings&&e.price.before;if(r&&(s?r.classList.add("special"):r.classList.remove("special")),a&&(s&&e.price.before?(a.classList.remove("hidden"),a.innerHTML=f(e.price.before)):a.classList.add("hidden")),u)if(e.price.savings){u.classList.remove("invisible");const t=u.querySelector("span");t&&(t.innerHTML=f(e.price.savings))}else u.classList.add("invisible");c.length>
10&&(n.activeOption?c.forEach((e=>e.classList.add("hidden"))):c.forEach((e=>e.classList.remove("hidden"))))}}})(),j=d((()=>u.value===c.PATTERN)),q=d((()=>u.value===c.PRODUCT)),_=d((()=>u.value===c.KIT)),B=d((()=>a.value||R.ProductPage)),T=d((()=>i.value||r.value||e.value||void 0)),U=d((()=>!!P.value&&P.value>0));return{purchasable:l,isProduct:q,isPattern:j,productId:e,productName:t,legacyId:i,productGroupId:r,price:S,entityType:u,variantId:n,pointsPrice:P,mainImageUrl:p,relatedPattern:g,isKit:_,patternDownloadUrl:(e,t,n)=>o(null,null,(function*(){var i,r,a;const o=b();if(l.value&&!o.isLogged)return null;t||o.isLogged||O("queryPatternBySku","[DATA-ERROR] - Pattern download will not be tracked. No contactUUID and no session.");try{const{gateway:l}=yield y();return null!=(a=null==(r=null==(i=(yield l.query(m(e,window.Shopify.locale,void 0,{contactUUID:null!=t?t:void 0,countryCode:n}))).data)?void 0:i.patternBySku)?void 0:r.url)?a:null}catch(u){return O("patternDownloadUrl",u,{message:`[DATA-ERROR] - Error on queryPatternBySku (SKU: "${e}", countryCode: "${n}")`}),null}})),getStrategy:B,resolvedEntityId:T,isPointProduct:U,updatePriceByVariant:e=>{A().bulkDiscountsAvailable?(k(),w()):(D(e),w())},updatePriceByQuantity:()=>{A().bulkDiscountsAvailable&&(k(),w())},setRelatedPatternFromKit:()=>o(null,null,(function*(){var e,t,n,i,r,a;if(g.value=null!=(t=null==(e=window.flyQualifiedProductsData)?void 0:e.find((e=>[v.CROCHET,v.KNITTING].includes(e.type))))?t:null,g.value)try{const{storefront:e}=yield y(),t=yield e.query({query:I,variables:{handle:g.value.handle}});g.value.productGroupId=null!=(a=null==(r=null==(i=null==(n=t.data)?void 0:n.product)?void 0:i.entityId)?void 0:r.value)?a:null}catch(l){O("setRelatedPatternFromKit",l,{message:`[DATA-ERROR] - Error on productGroupIdByHandleQuery (handle: "${g.value.handle}")`})}}))}}));export{D as a,j as b,B as c,L as d,C as e,_ as g,k as p,A as u};
2//# sourceMappingURL=hobbii-product-BmhgILJ5.min.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.