hemfixarna-web-components 1.7.0 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/hemfixarna-address_15.cjs.entry.js +56 -48
  2. package/dist/cjs/hemfixarna-address_15.cjs.entry.js.map +1 -1
  3. package/dist/cjs/hemfixarna-category.cjs.entry.js +1 -1
  4. package/dist/cjs/hemfixarna-components.cjs.js +1 -1
  5. package/dist/cjs/hemfixarna-service.cjs.entry.js +1 -1
  6. package/dist/cjs/{index-4695c475.js → index-6af772cf.js} +8 -1
  7. package/dist/cjs/index-6af772cf.js.map +1 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js +12 -37
  10. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -1
  11. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +53 -7
  12. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
  13. package/dist/collection/components/hemfixarna-component/hemfixarna.css +20 -0
  14. package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js +6 -1
  15. package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js.map +1 -1
  16. package/dist/collection/store/index.js +7 -0
  17. package/dist/collection/store/index.js.map +1 -1
  18. package/dist/esm/hemfixarna-address_15.entry.js +56 -48
  19. package/dist/esm/hemfixarna-address_15.entry.js.map +1 -1
  20. package/dist/esm/hemfixarna-category.entry.js +1 -1
  21. package/dist/esm/hemfixarna-components.js +1 -1
  22. package/dist/esm/hemfixarna-service.entry.js +1 -1
  23. package/dist/esm/{index-113a6b21.js → index-8282f88e.js} +8 -1
  24. package/dist/esm/index-8282f88e.js.map +1 -0
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
  27. package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
  28. package/dist/hemfixarna-components/p-8cc96dd9.entry.js +2 -0
  29. package/dist/hemfixarna-components/{p-a3d759d9.js → p-b397b966.js} +2 -2
  30. package/dist/hemfixarna-components/p-b397b966.js.map +1 -0
  31. package/dist/hemfixarna-components/{p-12dbf4e6.entry.js → p-e8800c3b.entry.js} +2 -2
  32. package/dist/hemfixarna-components/p-fb43b148.entry.js +2 -0
  33. package/dist/hemfixarna-components/p-fb43b148.entry.js.map +1 -0
  34. package/dist/types/components/hemfixarna-checkout/hemfixarna-checkout.d.ts +0 -4
  35. package/dist/types/components/hemfixarna-component/hemfixarna-component.d.ts +3 -0
  36. package/dist/types/components.d.ts +2 -0
  37. package/dist/types/store/index.d.ts +2 -0
  38. package/package.json +3 -2
  39. package/readme.md +1 -0
  40. package/dist/cjs/index-4695c475.js.map +0 -1
  41. package/dist/esm/index-113a6b21.js.map +0 -1
  42. package/dist/hemfixarna-components/p-7c122f15.entry.js +0 -2
  43. package/dist/hemfixarna-components/p-a3d759d9.js.map +0 -1
  44. package/dist/hemfixarna-components/p-a9845efc.entry.js +0 -2
  45. package/dist/hemfixarna-components/p-a9845efc.entry.js.map +0 -1
  46. /package/dist/hemfixarna-components/{p-7c122f15.entry.js.map → p-8cc96dd9.entry.js.map} +0 -0
  47. /package/dist/hemfixarna-components/{p-12dbf4e6.entry.js.map → p-e8800c3b.entry.js.map} +0 -0
@@ -28,6 +28,8 @@ type StateType = {
28
28
  parentCategory: CustomerCategory | CustomerSubCategory;
29
29
  checkoutInvoice: boolean;
30
30
  maleri: boolean;
31
+ selectSource: boolean;
32
+ showSourcePasswordPrompt: boolean;
31
33
  };
32
34
  declare const state: StateType;
33
35
  export default state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hemfixarna-web-components",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "author": "Afonso <info@afonso.se> (http://afonso.se)",
5
5
  "description": "Web components to integrate with hemfixarna api",
6
6
  "main": "dist/index.cjs.js",
@@ -26,7 +26,8 @@
26
26
  "start": "stencil build --dev --watch --serve",
27
27
  "test": "stencil test --spec --e2e",
28
28
  "test.watch": "stencil test --spec --e2e --watchAll",
29
- "generate": "stencil generate"
29
+ "generate": "stencil generate",
30
+ "purge": "node ./purge.js"
30
31
  },
31
32
  "dependencies": {
32
33
  "@stencil/core": "^3.0.0",
package/readme.md CHANGED
@@ -18,6 +18,7 @@ First of all you need to be added to the npm package to authorize. Ask Adin or R
18
18
  2. Run yarn deploy
19
19
  3. Open the testprod.html to see that the prod runs properly
20
20
  4. Run npm publish
21
+ 5. To revalidate the cache (script is cached for 7 days on jsdelivr) run yarn purge
21
22
 
22
23
  # How to add a new customer
23
24
 
@@ -1 +0,0 @@
1
- {"file":"index-4695c475.js","mappings":";;;;AAEA,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,KAAK;AAC9C,IAAI,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACpC,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACnC,KAAK;AACL,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrC,QAAQ,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAK;AACL,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK;AAC7B,IAAI,IAAI,SAAS,CAAC;AAClB,IAAI,OAAO,CAAC,GAAG,IAAI,KAAK;AACxB,QAAQ,IAAI,SAAS,EAAE;AACvB,YAAY,YAAY,CAAC,SAAS,CAAC,CAAC;AACpC,SAAS;AACT,QAAQ,SAAS,GAAG,UAAU,CAAC,MAAM;AACrC,YAAY,SAAS,GAAG,CAAC,CAAC;AAC1B,YAAY,EAAE,CAAC,GAAG,IAAI,CA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G,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;EACtE,IAAI,QAAQ,EAAE;IACZ,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC;IAChC,OAAO;GACR;EACD,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE,QAAQ;EAC3C,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,QAAQ;IAAE,OAAO;EACzC,IAAK,QAAgC,CAAC,MAAM,EAAE;IAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAM,QAAgC,CAAC,MAAM,CAAC,CAAC;IACtG,IAAI,MAAM,EAAE;MACV,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC;MAC9B,OAAO;KACR;GACF;EACD,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAC9B,CAAC,CAAC;;;;","names":["getRenderingRef","forceUpdate"],"sources":["./node_modules/@stencil/store/dist/index.mjs","./src/store/index.ts"],"sourcesContent":["import { getRenderingRef, forceUpdate } from '@stencil/core';\n\nconst appendToMap = (map, propName, value) => {\n const items = map.get(propName);\n if (!items) {\n map.set(propName, [value]);\n }\n else if (!items.includes(value)) {\n items.push(value);\n }\n};\nconst debounce = (fn, ms) => {\n let timeoutId;\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n timeoutId = 0;\n fn(...args);\n }, ms);\n };\n};\n\n/**\n * Check if a possible element isConnected.\n * The property might not be there, so we check for it.\n *\n * We want it to return true if isConnected is not a property,\n * otherwise we would remove these elements and would not update.\n *\n * Better leak in Edge than to be useless.\n */\nconst isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;\nconst cleanupElements = debounce((map) => {\n for (let key of map.keys()) {\n map.set(key, map.get(key).filter(isConnected));\n }\n}, 2000);\nconst stencilSubscription = () => {\n if (typeof getRenderingRef !== 'function') {\n // If we are not in a stencil project, we do nothing.\n // This function is not really exported by @stencil/core.\n return {};\n }\n const elmsToUpdate = new Map();\n return {\n dispose: () => elmsToUpdate.clear(),\n get: (propName) => {\n const elm = getRenderingRef();\n if (elm) {\n appendToMap(elmsToUpdate, propName, elm);\n }\n },\n set: (propName) => {\n const elements = elmsToUpdate.get(propName);\n if (elements) {\n elmsToUpdate.set(propName, elements.filter(forceUpdate));\n }\n cleanupElements(elmsToUpdate);\n },\n reset: () => {\n elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));\n cleanupElements(elmsToUpdate);\n },\n };\n};\n\nconst unwrap = (val) => (typeof val === 'function' ? val() : val);\nconst createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {\n const unwrappedState = unwrap(defaultState);\n let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));\n const handlers = {\n dispose: [],\n get: [],\n set: [],\n reset: [],\n };\n const reset = () => {\n var _a;\n // When resetting the state, the default state may be a function - unwrap it to invoke it.\n // otherwise, the state won't be properly reset\n states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));\n handlers.reset.forEach((cb) => cb());\n };\n const dispose = () => {\n // Call first dispose as resetting the state would\n // cause less updates ;)\n handlers.dispose.forEach((cb) => cb());\n reset();\n };\n const get = (propName) => {\n handlers.get.forEach((cb) => cb(propName));\n return states.get(propName);\n };\n const set = (propName, value) => {\n const oldValue = states.get(propName);\n if (shouldUpdate(value, oldValue, propName)) {\n states.set(propName, value);\n handlers.set.forEach((cb) => cb(propName, value, oldValue));\n }\n };\n const state = (typeof Proxy === 'undefined'\n ? {}\n : new Proxy(unwrappedState, {\n get(_, propName) {\n return get(propName);\n },\n ownKeys(_) {\n return Array.from(states.keys());\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n has(_, propName) {\n return states.has(propName);\n },\n set(_, propName, value) {\n set(propName, value);\n return true;\n },\n }));\n const on = (eventName, callback) => {\n handlers[eventName].push(callback);\n return () => {\n removeFromArray(handlers[eventName], callback);\n };\n };\n const onChange = (propName, cb) => {\n const unSet = on('set', (key, newValue) => {\n if (key === propName) {\n cb(newValue);\n }\n });\n // We need to unwrap the defaultState because it might be a function.\n // Otherwise we might not be sending the right reset value.\n const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));\n return () => {\n unSet();\n unReset();\n };\n };\n const use = (...subscriptions) => {\n const unsubs = subscriptions.reduce((unsubs, subscription) => {\n if (subscription.set) {\n unsubs.push(on('set', subscription.set));\n }\n if (subscription.get) {\n unsubs.push(on('get', subscription.get));\n }\n if (subscription.reset) {\n unsubs.push(on('reset', subscription.reset));\n }\n if (subscription.dispose) {\n unsubs.push(on('dispose', subscription.dispose));\n }\n return unsubs;\n }, []);\n return () => unsubs.forEach((unsub) => unsub());\n };\n const forceUpdate = (key) => {\n const oldValue = states.get(key);\n handlers.set.forEach((cb) => cb(key, oldValue, oldValue));\n };\n return {\n state,\n get,\n set,\n on,\n onChange,\n use,\n dispose,\n reset,\n forceUpdate,\n };\n};\nconst removeFromArray = (array, item) => {\n const index = array.indexOf(item);\n if (index >= 0) {\n array[index] = array[array.length - 1];\n array.length--;\n }\n};\n\nconst createStore = (defaultState, shouldUpdate) => {\n const map = createObservableMap(defaultState, shouldUpdate);\n map.use(stencilSubscription());\n return map;\n};\n\nexport { createObservableMap, createStore };\n","import { createStore } from '@stencil/store';\nimport { OnChangeHandler } from '@stencil/store/dist/types';\nimport { Business, CartItem, Category, Customer, CustomerCategory, CustomerSubCategory, GreenOptions, Product, RotOptions, RutOptions, Service, User, WpOptions } from '../types';\nimport { CreditSafeUser } from '../types/felixtypes';\n\ntype StateType = {\n step: number;\n selectedCategory: Category | null;\n selectedService: Service | null;\n selectedProduct: Product | null;\n cart: Array<CartItem>;\n business: Business | 'undefined';\n options: WpOptions | null;\n rut: boolean;\n rot: boolean;\n green: boolean;\n token: string | null;\n checkoutStep: number;\n checkoutEdit: boolean;\n user: User | null;\n creditSafeUser: CreditSafeUser | null;\n modal: {\n title?: string;\n text: string[];\n } | null;\n rutOptions: RutOptions | null;\n rotOptions: RotOptions | null;\n greenOptions: GreenOptions | null;\n customer: Customer | null;\n selectedCustomerCategory: CustomerCategory | CustomerSubCategory | null;\n parentCategory: CustomerCategory | CustomerSubCategory;\n checkoutInvoice: boolean;\n maleri: boolean;\n};\n\nconst {\n state,\n onChange,\n}: {\n state: StateType;\n onChange: OnChangeHandler<StateType>;\n} = createStore({\n step: 1,\n checkoutStep: 1,\n checkoutEdit: false,\n selectedCategory: null,\n selectedService: null,\n selectedProduct: null,\n cart: [],\n business: 'undefined',\n options: null,\n rut: true,\n rot: true,\n green: true,\n token: null,\n user: null,\n modal: null,\n rutOptions: null,\n rotOptions: null,\n greenOptions: null,\n customer: null,\n selectedCustomerCategory: null,\n parentCategory: null,\n creditSafeUser: null,\n checkoutInvoice: false,\n maleri: false,\n sources: null,\n});\n\nonChange('cart', cart => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));\n});\n\nonChange('user', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));\n});\n\nonChange('creditSafeUser', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));\n});\n\nonChange('selectedProduct', product => {\n if (!state.customer || !product) return;\n const categories = [...state.customer.categories, ...state.customer.categories.map(c => c.sub_categories ?? [])].flat();\n const category = categories.find(c => c && c.id === product.category);\n if (category) {\n state.parentCategory = category;\n return;\n }\n state.parentCategory = null;\n});\n\nonChange('selectedCustomerCategory', category => {\n if (!state.customer || !category) return;\n if ((category as CustomerSubCategory).parent) {\n const parent = state.customer.categories.find(c => c.id === (category as CustomerSubCategory).parent);\n if (parent) {\n state.parentCategory = parent;\n return;\n }\n }\n state.parentCategory = null;\n});\n\nexport default state;\n"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"index-113a6b21.js","mappings":";;AAEA,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,KAAK;AAC9C,IAAI,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACpC,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACnC,KAAK;AACL,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACrC,QAAQ,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1B,KAAK;AACL,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK;AAC7B,IAAI,IAAI,SAAS,CAAC;AAClB,IAAI,OAAO,CAAC,GAAG,IAAI,KAAK;AACxB,QAAQ,IAAI,SAAS,EAAE;AACvB,YAAY,YAAY,CAAC,SAAS,CAAC,CAAC;AACpC,SAAS;AACT,QAAQ,SAAS,GAAG,UAAU,CAAC,MAAM;AACrC,YAAY,SAAS,GAAG,CAAC,CAAC;AAC1B,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK,CAAC;AACN,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAG,CAAC,YAAY,KAAK,EAAE,aAAa,IAAI,YAAY,CAAC,IAAI,YAAY,CAAC,WAAW,CAAC;AACnG,MAAM,eAAe,GAAG,QAAQ,CAAC,CAAC,GAAG,KAAK;AAC1C,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE;AAChC,QAAQ,GAAG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AK,QAAgC,CAAC,MAAM,EAAE;IAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAM,QAAgC,CAAC,MAAM,CAAC,CAAC;IACtG,IAAI,MAAM,EAAE;MACV,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC;MAC9B,OAAO;KACR;GACF;EACD,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAC9B,CAAC,CAAC;;;;","names":[],"sources":["./node_modules/@stencil/store/dist/index.mjs","./src/store/index.ts"],"sourcesContent":["import { getRenderingRef, forceUpdate } from '@stencil/core';\n\nconst appendToMap = (map, propName, value) => {\n const items = map.get(propName);\n if (!items) {\n map.set(propName, [value]);\n }\n else if (!items.includes(value)) {\n items.push(value);\n }\n};\nconst debounce = (fn, ms) => {\n let timeoutId;\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n timeoutId = 0;\n fn(...args);\n }, ms);\n };\n};\n\n/**\n * Check if a possible element isConnected.\n * The property might not be there, so we check for it.\n *\n * We want it to return true if isConnected is not a property,\n * otherwise we would remove these elements and would not update.\n *\n * Better leak in Edge than to be useless.\n */\nconst isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;\nconst cleanupElements = debounce((map) => {\n for (let key of map.keys()) {\n map.set(key, map.get(key).filter(isConnected));\n }\n}, 2000);\nconst stencilSubscription = () => {\n if (typeof getRenderingRef !== 'function') {\n // If we are not in a stencil project, we do nothing.\n // This function is not really exported by @stencil/core.\n return {};\n }\n const elmsToUpdate = new Map();\n return {\n dispose: () => elmsToUpdate.clear(),\n get: (propName) => {\n const elm = getRenderingRef();\n if (elm) {\n appendToMap(elmsToUpdate, propName, elm);\n }\n },\n set: (propName) => {\n const elements = elmsToUpdate.get(propName);\n if (elements) {\n elmsToUpdate.set(propName, elements.filter(forceUpdate));\n }\n cleanupElements(elmsToUpdate);\n },\n reset: () => {\n elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));\n cleanupElements(elmsToUpdate);\n },\n };\n};\n\nconst unwrap = (val) => (typeof val === 'function' ? val() : val);\nconst createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {\n const unwrappedState = unwrap(defaultState);\n let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));\n const handlers = {\n dispose: [],\n get: [],\n set: [],\n reset: [],\n };\n const reset = () => {\n var _a;\n // When resetting the state, the default state may be a function - unwrap it to invoke it.\n // otherwise, the state won't be properly reset\n states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));\n handlers.reset.forEach((cb) => cb());\n };\n const dispose = () => {\n // Call first dispose as resetting the state would\n // cause less updates ;)\n handlers.dispose.forEach((cb) => cb());\n reset();\n };\n const get = (propName) => {\n handlers.get.forEach((cb) => cb(propName));\n return states.get(propName);\n };\n const set = (propName, value) => {\n const oldValue = states.get(propName);\n if (shouldUpdate(value, oldValue, propName)) {\n states.set(propName, value);\n handlers.set.forEach((cb) => cb(propName, value, oldValue));\n }\n };\n const state = (typeof Proxy === 'undefined'\n ? {}\n : new Proxy(unwrappedState, {\n get(_, propName) {\n return get(propName);\n },\n ownKeys(_) {\n return Array.from(states.keys());\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n has(_, propName) {\n return states.has(propName);\n },\n set(_, propName, value) {\n set(propName, value);\n return true;\n },\n }));\n const on = (eventName, callback) => {\n handlers[eventName].push(callback);\n return () => {\n removeFromArray(handlers[eventName], callback);\n };\n };\n const onChange = (propName, cb) => {\n const unSet = on('set', (key, newValue) => {\n if (key === propName) {\n cb(newValue);\n }\n });\n // We need to unwrap the defaultState because it might be a function.\n // Otherwise we might not be sending the right reset value.\n const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));\n return () => {\n unSet();\n unReset();\n };\n };\n const use = (...subscriptions) => {\n const unsubs = subscriptions.reduce((unsubs, subscription) => {\n if (subscription.set) {\n unsubs.push(on('set', subscription.set));\n }\n if (subscription.get) {\n unsubs.push(on('get', subscription.get));\n }\n if (subscription.reset) {\n unsubs.push(on('reset', subscription.reset));\n }\n if (subscription.dispose) {\n unsubs.push(on('dispose', subscription.dispose));\n }\n return unsubs;\n }, []);\n return () => unsubs.forEach((unsub) => unsub());\n };\n const forceUpdate = (key) => {\n const oldValue = states.get(key);\n handlers.set.forEach((cb) => cb(key, oldValue, oldValue));\n };\n return {\n state,\n get,\n set,\n on,\n onChange,\n use,\n dispose,\n reset,\n forceUpdate,\n };\n};\nconst removeFromArray = (array, item) => {\n const index = array.indexOf(item);\n if (index >= 0) {\n array[index] = array[array.length - 1];\n array.length--;\n }\n};\n\nconst createStore = (defaultState, shouldUpdate) => {\n const map = createObservableMap(defaultState, shouldUpdate);\n map.use(stencilSubscription());\n return map;\n};\n\nexport { createObservableMap, createStore };\n","import { createStore } from '@stencil/store';\nimport { OnChangeHandler } from '@stencil/store/dist/types';\nimport { Business, CartItem, Category, Customer, CustomerCategory, CustomerSubCategory, GreenOptions, Product, RotOptions, RutOptions, Service, User, WpOptions } from '../types';\nimport { CreditSafeUser } from '../types/felixtypes';\n\ntype StateType = {\n step: number;\n selectedCategory: Category | null;\n selectedService: Service | null;\n selectedProduct: Product | null;\n cart: Array<CartItem>;\n business: Business | 'undefined';\n options: WpOptions | null;\n rut: boolean;\n rot: boolean;\n green: boolean;\n token: string | null;\n checkoutStep: number;\n checkoutEdit: boolean;\n user: User | null;\n creditSafeUser: CreditSafeUser | null;\n modal: {\n title?: string;\n text: string[];\n } | null;\n rutOptions: RutOptions | null;\n rotOptions: RotOptions | null;\n greenOptions: GreenOptions | null;\n customer: Customer | null;\n selectedCustomerCategory: CustomerCategory | CustomerSubCategory | null;\n parentCategory: CustomerCategory | CustomerSubCategory;\n checkoutInvoice: boolean;\n maleri: boolean;\n};\n\nconst {\n state,\n onChange,\n}: {\n state: StateType;\n onChange: OnChangeHandler<StateType>;\n} = createStore({\n step: 1,\n checkoutStep: 1,\n checkoutEdit: false,\n selectedCategory: null,\n selectedService: null,\n selectedProduct: null,\n cart: [],\n business: 'undefined',\n options: null,\n rut: true,\n rot: true,\n green: true,\n token: null,\n user: null,\n modal: null,\n rutOptions: null,\n rotOptions: null,\n greenOptions: null,\n customer: null,\n selectedCustomerCategory: null,\n parentCategory: null,\n creditSafeUser: null,\n checkoutInvoice: false,\n maleri: false,\n sources: null,\n});\n\nonChange('cart', cart => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));\n});\n\nonChange('user', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));\n});\n\nonChange('creditSafeUser', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));\n});\n\nonChange('selectedProduct', product => {\n if (!state.customer || !product) return;\n const categories = [...state.customer.categories, ...state.customer.categories.map(c => c.sub_categories ?? [])].flat();\n const category = categories.find(c => c && c.id === product.category);\n if (category) {\n state.parentCategory = category;\n return;\n }\n state.parentCategory = null;\n});\n\nonChange('selectedCustomerCategory', category => {\n if (!state.customer || !category) return;\n if ((category as CustomerSubCategory).parent) {\n const parent = state.customer.categories.find(c => c.id === (category as CustomerSubCategory).parent);\n if (parent) {\n state.parentCategory = parent;\n return;\n }\n }\n state.parentCategory = null;\n});\n\nexport default state;\n"],"version":3}
@@ -1,2 +0,0 @@
1
- import{r,h as a}from"./p-32a8152b.js";import{s as e}from"./p-a3d759d9.js";const s=class{constructor(a){r(this,a)}setSelectedService(r){e.selectedService=r;e.step=3}render(){return a("div",null,a("h2",null,e.selectedCategory.name),a("div",{class:"hemfixarna_categories--wrapper"},a("div",null,a("ul",{class:"hemfixarna_categories"},e.selectedCategory.services.sort(((r,a)=>r.post_title<a.post_title?-1:1)).map((r=>{var e;return a("hemfixarna-box",{post:r,icon:(e=r.icon.url)!==null&&e!==void 0?e:r.icon,postTitle:r.post_title})})))),a("hemfixarna-info",null)))}};export{s as hemfixarna_category};
2
- //# sourceMappingURL=p-7c122f15.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["appendToMap","map","propName","value","items","get","set","includes","push","debounce","fn","ms","timeoutId","args","clearTimeout","setTimeout","isConnected","maybeElement","cleanupElements","key","keys","filter","stencilSubscription","getRenderingRef","elmsToUpdate","Map","dispose","clear","elm","elements","forceUpdate","reset","forEach","elms","unwrap","val","createObservableMap","defaultState","shouldUpdate","a","b","unwrappedState","states","Object","entries","handlers","_a","cb","oldValue","state","Proxy","_","ownKeys","Array","from","getOwnPropertyDescriptor","enumerable","configurable","has","on","eventName","callback","removeFromArray","onChange","unSet","newValue","unReset","use","subscriptions","unsubs","reduce","subscription","unsub","array","item","index","indexOf","length","createStore","step","checkoutStep","checkoutEdit","selectedCategory","selectedService","selectedProduct","cart","business","options","rut","rot","green","token","user","modal","rutOptions","rotOptions","greenOptions","customer","selectedCustomerCategory","parentCategory","creditSafeUser","checkoutInvoice","maleri","sources","window","sessionStorage","setItem","JSON","stringify","product","categories","c","sub_categories","flat","category","find","id","parent"],"sources":["./node_modules/@stencil/store/dist/index.mjs","./src/store/index.ts"],"sourcesContent":["import { getRenderingRef, forceUpdate } from '@stencil/core';\n\nconst appendToMap = (map, propName, value) => {\n const items = map.get(propName);\n if (!items) {\n map.set(propName, [value]);\n }\n else if (!items.includes(value)) {\n items.push(value);\n }\n};\nconst debounce = (fn, ms) => {\n let timeoutId;\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n timeoutId = 0;\n fn(...args);\n }, ms);\n };\n};\n\n/**\n * Check if a possible element isConnected.\n * The property might not be there, so we check for it.\n *\n * We want it to return true if isConnected is not a property,\n * otherwise we would remove these elements and would not update.\n *\n * Better leak in Edge than to be useless.\n */\nconst isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;\nconst cleanupElements = debounce((map) => {\n for (let key of map.keys()) {\n map.set(key, map.get(key).filter(isConnected));\n }\n}, 2000);\nconst stencilSubscription = () => {\n if (typeof getRenderingRef !== 'function') {\n // If we are not in a stencil project, we do nothing.\n // This function is not really exported by @stencil/core.\n return {};\n }\n const elmsToUpdate = new Map();\n return {\n dispose: () => elmsToUpdate.clear(),\n get: (propName) => {\n const elm = getRenderingRef();\n if (elm) {\n appendToMap(elmsToUpdate, propName, elm);\n }\n },\n set: (propName) => {\n const elements = elmsToUpdate.get(propName);\n if (elements) {\n elmsToUpdate.set(propName, elements.filter(forceUpdate));\n }\n cleanupElements(elmsToUpdate);\n },\n reset: () => {\n elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));\n cleanupElements(elmsToUpdate);\n },\n };\n};\n\nconst unwrap = (val) => (typeof val === 'function' ? val() : val);\nconst createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {\n const unwrappedState = unwrap(defaultState);\n let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));\n const handlers = {\n dispose: [],\n get: [],\n set: [],\n reset: [],\n };\n const reset = () => {\n var _a;\n // When resetting the state, the default state may be a function - unwrap it to invoke it.\n // otherwise, the state won't be properly reset\n states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));\n handlers.reset.forEach((cb) => cb());\n };\n const dispose = () => {\n // Call first dispose as resetting the state would\n // cause less updates ;)\n handlers.dispose.forEach((cb) => cb());\n reset();\n };\n const get = (propName) => {\n handlers.get.forEach((cb) => cb(propName));\n return states.get(propName);\n };\n const set = (propName, value) => {\n const oldValue = states.get(propName);\n if (shouldUpdate(value, oldValue, propName)) {\n states.set(propName, value);\n handlers.set.forEach((cb) => cb(propName, value, oldValue));\n }\n };\n const state = (typeof Proxy === 'undefined'\n ? {}\n : new Proxy(unwrappedState, {\n get(_, propName) {\n return get(propName);\n },\n ownKeys(_) {\n return Array.from(states.keys());\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n has(_, propName) {\n return states.has(propName);\n },\n set(_, propName, value) {\n set(propName, value);\n return true;\n },\n }));\n const on = (eventName, callback) => {\n handlers[eventName].push(callback);\n return () => {\n removeFromArray(handlers[eventName], callback);\n };\n };\n const onChange = (propName, cb) => {\n const unSet = on('set', (key, newValue) => {\n if (key === propName) {\n cb(newValue);\n }\n });\n // We need to unwrap the defaultState because it might be a function.\n // Otherwise we might not be sending the right reset value.\n const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));\n return () => {\n unSet();\n unReset();\n };\n };\n const use = (...subscriptions) => {\n const unsubs = subscriptions.reduce((unsubs, subscription) => {\n if (subscription.set) {\n unsubs.push(on('set', subscription.set));\n }\n if (subscription.get) {\n unsubs.push(on('get', subscription.get));\n }\n if (subscription.reset) {\n unsubs.push(on('reset', subscription.reset));\n }\n if (subscription.dispose) {\n unsubs.push(on('dispose', subscription.dispose));\n }\n return unsubs;\n }, []);\n return () => unsubs.forEach((unsub) => unsub());\n };\n const forceUpdate = (key) => {\n const oldValue = states.get(key);\n handlers.set.forEach((cb) => cb(key, oldValue, oldValue));\n };\n return {\n state,\n get,\n set,\n on,\n onChange,\n use,\n dispose,\n reset,\n forceUpdate,\n };\n};\nconst removeFromArray = (array, item) => {\n const index = array.indexOf(item);\n if (index >= 0) {\n array[index] = array[array.length - 1];\n array.length--;\n }\n};\n\nconst createStore = (defaultState, shouldUpdate) => {\n const map = createObservableMap(defaultState, shouldUpdate);\n map.use(stencilSubscription());\n return map;\n};\n\nexport { createObservableMap, createStore };\n","import { createStore } from '@stencil/store';\nimport { OnChangeHandler } from '@stencil/store/dist/types';\nimport { Business, CartItem, Category, Customer, CustomerCategory, CustomerSubCategory, GreenOptions, Product, RotOptions, RutOptions, Service, User, WpOptions } from '../types';\nimport { CreditSafeUser } from '../types/felixtypes';\n\ntype StateType = {\n step: number;\n selectedCategory: Category | null;\n selectedService: Service | null;\n selectedProduct: Product | null;\n cart: Array<CartItem>;\n business: Business | 'undefined';\n options: WpOptions | null;\n rut: boolean;\n rot: boolean;\n green: boolean;\n token: string | null;\n checkoutStep: number;\n checkoutEdit: boolean;\n user: User | null;\n creditSafeUser: CreditSafeUser | null;\n modal: {\n title?: string;\n text: string[];\n } | null;\n rutOptions: RutOptions | null;\n rotOptions: RotOptions | null;\n greenOptions: GreenOptions | null;\n customer: Customer | null;\n selectedCustomerCategory: CustomerCategory | CustomerSubCategory | null;\n parentCategory: CustomerCategory | CustomerSubCategory;\n checkoutInvoice: boolean;\n maleri: boolean;\n};\n\nconst {\n state,\n onChange,\n}: {\n state: StateType;\n onChange: OnChangeHandler<StateType>;\n} = createStore({\n step: 1,\n checkoutStep: 1,\n checkoutEdit: false,\n selectedCategory: null,\n selectedService: null,\n selectedProduct: null,\n cart: [],\n business: 'undefined',\n options: null,\n rut: true,\n rot: true,\n green: true,\n token: null,\n user: null,\n modal: null,\n rutOptions: null,\n rotOptions: null,\n greenOptions: null,\n customer: null,\n selectedCustomerCategory: null,\n parentCategory: null,\n creditSafeUser: null,\n checkoutInvoice: false,\n maleri: false,\n sources: null,\n});\n\nonChange('cart', cart => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));\n});\n\nonChange('user', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));\n});\n\nonChange('creditSafeUser', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));\n});\n\nonChange('selectedProduct', product => {\n if (!state.customer || !product) return;\n const categories = [...state.customer.categories, ...state.customer.categories.map(c => c.sub_categories ?? [])].flat();\n const category = categories.find(c => c && c.id === product.category);\n if (category) {\n state.parentCategory = category;\n return;\n }\n state.parentCategory = null;\n});\n\nonChange('selectedCustomerCategory', category => {\n if (!state.customer || !category) return;\n if ((category as CustomerSubCategory).parent) {\n const parent = state.customer.categories.find(c => c.id === (category as CustomerSubCategory).parent);\n if (parent) {\n state.parentCategory = parent;\n return;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- import{r as n,h as t,g as i,F as e,a as s}from"./p-32a8152b.js";import{s as a}from"./p-a3d759d9.js";import{B as r,W as o}from"./p-cfdc93e9.js";const l=n=>n.split(" ").reduce(((n,t)=>{if(t.length<=2){return n+t.slice(0,1)+"* "}else{return n+t.slice(0,1)+"*".repeat(t.length-2)+t.slice(-1)+" "}}),"");const h=n=>{if(!n)return;n.scrollTo({top:0,behavior:"smooth"})};const c=class{constructor(i){n(this,i);this.handleSubmit=n=>{n.preventDefault();const t=this.street.length>0;if(!t){this.streetError="Ange en gatuadress"}const i=this.zip.length>0;const e=/^\s*\d[\d\s]*$/.test(this.zip);if(!e){this.zipError="Postnummer får endast innehålla siffror"}if(!i){this.zipError="Ange ett postnummer"}const s=/^[^\d\s]{2,}$/.test(this.town);if(!s){this.townError="Ange en ort"}if(t&&i&&s&&e){a.user=Object.assign(Object.assign({},a.user),{street:this.street,zip:this.zip,town:this.town});a.checkoutStep=2;a.checkoutEdit=false;const n=this.el.closest(".hemfixarna_content");h(n)}};this.handleChangeStreet=n=>{this.streetError=null;this.street=this.street===a.user.street?"":n.target.value};this.handleChangeZip=n=>{this.zipError=null;this.zip=this.zip===a.user.zip?"":n.target.value};this.handleChangeTown=n=>{this.townError=null;this.town=this.town===a.user.town?"":n.target.value};this.render=()=>t("form",{class:"hemfixarna_address",onSubmit:n=>this.handleSubmit(n)},t("div",null,t("input",{class:`${this.street.length?"input_active":""}`,onInput:this.handleChangeStreet,type:"text",name:"street",value:this.street===a.user.street?l(this.street):this.street}),t("label",{htmlFor:"street"},"Gatuaddress ")),this.streetError&&t("span",null,this.streetError),t("div",null,t("input",{class:`${this.zip.length?"input_active":""}`,onInput:this.handleChangeZip,type:"tel",name:"zip",value:this.zip===a.user.zip?l(this.zip):this.zip}),t("label",{htmlFor:"zip"},"Postnummer ")),this.zipError&&t("span",null,this.zipError),t("div",null,t("input",{class:`${this.town.length?"input_active":""}`,onInput:this.handleChangeTown,type:"text",name:"town",value:this.town===a.user.town?l(this.town):this.town}),t("label",{htmlFor:"town"},"Ort ")),this.townError&&t("span",null,this.townError),t("input",{type:"submit",value:"Fortsätt"}));this.street="";this.streetError=null;this.zip="";this.zipError=null;this.town="";this.townError=null}componentWillLoad(){if(a.user){this.street=a.user.street;this.zip=a.user.zip;this.town=a.user.town}}get el(){return i(this)}};const p=n=>Math.ceil(n/2);const d=n=>Math.ceil(n*.7);const u=n=>Math.ceil(n*.5);const f=(n,t,i=1)=>{if(n.rot&&a.rot){return d((t||n.price)*i)}else if(n.rut&&a.rut){return p((t||n.price)*i)}else if(n.green&&a.green){return u((t||n.price)*i)}else{return(t||n.price)*i}};const m=n=>{if(n.rot){return d(n.price)}else if(n.rut&&a.rut){return p(n.price)}else{return n.price}};const x=(n,t,i=1)=>{if(t.rot&&a.rot){return d(n.price*i)}else if(t.rut&&a.rut){return p(n.price*i)}else{return n.price*i}};const g=()=>{if(!a.cart)return{rut:0,rot:0,green:0};const n=a.cart.some((n=>n.rut&&n.start_fee));const t=a.cart.some((n=>n.rot&&n.start_fee));const i=a.cart.some((n=>n.green&&n.start_fee));const e=a.rut?p(a.options.start_fee):a.options.start_fee*1;const s=a.rot?d(a.options.start_fee):a.options.start_fee*1;const r=a.green?u(a.options.start_fee):a.options.start_fee*1;return{rut:n?e:0,rot:t?s:0,green:i?r:0,length:[n,t,i].filter((n=>n)).length}};const v=n=>{const t=n.parts.reduce(((n,t)=>n+t.price*t.amount),0);return f(n,n.price*n.amount+t)};const b=()=>{const n=a.cart.reduce(((n,t)=>t.rot?n+v(t):n),0)+g().rot;const t=a.cart.reduce(((n,t)=>{const i=t.parts.reduce(((n,t)=>n+t.price*t.amount),0);return t.rot?n+t.price*t.amount+i:n}),0)+Number(a.options.start_fee);return t-n};const _=()=>{const n=a.cart.reduce(((n,t)=>t.rut?n+v(t):n),0)+g().rut;const t=a.cart.reduce(((n,t)=>{const i=t.parts.reduce(((n,t)=>n+t.price*t.amount),0);return t.rut?n+t.price*t.amount+i:n}),0)+Number(a.options.start_fee);return t-n};const w=()=>{const n=a.cart.reduce(((n,t)=>t.green?n+v(t):n),0)+g().green;const t=a.cart.reduce(((n,t)=>{const i=t.parts.reduce(((n,t)=>n+t.price*t.amount),0);return t.green?n+t.price*t.amount+i:n}),0)+Number(a.options.start_fee);return t-n};const y=()=>a.cart.reduce(((n,t)=>n+v(t)),0)+g().rot+g().rut;const k=n=>n.post_name!==undefined;const C=n=>Object.values(r).includes(n);const $=class{constructor(t){n(this,t);this.post=undefined;this.category=undefined;this.icon=undefined;this.postTitle=undefined}setTaxonomy(n){if(n){if((n===null||n===void 0?void 0:n.taxonomy)==="service_cat"){a.selectedCategory=n;a.step=2}else if((n===null||n===void 0?void 0:n.post_type)==="service"){a.selectedService=n;a.step=3}else if((n===null||n===void 0?void 0:n.post_type)==="ikea_product"){a.selectedProduct=n;a.step=4}const t=this.el.closest(".hemfixarna_content");h(t)}}setProduct(){a.selectedProduct=this.category;a.step=4;a.selectedCustomerCategory=null;const n=this.el.closest(".hemfixarna_content");h(n)}render(){return this.category?t(e,null,k(this.category)?t("li",{onClick:()=>this.setProduct()},t("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.post_name}),t("div",null,t("p",null,this.category.title),!this.category.invoice?t("p",{class:"price"},"Från ",f(this.category),"kr"):null)):t("li",{onClick:()=>a.selectedCustomerCategory=this.category},t("img",{class:"hemfixarna_logo",height:82,src:this.category.icon,alt:this.category.name}),t("div",null,t("p",null,this.category.name)))):t("li",{onClick:()=>this.setTaxonomy(this.post)},this.post.icon&&t("img",{class:"hemfixarna_logo",height:82,src:this.icon,alt:this.postTitle}),t("div",null,t("p",null,this.postTitle),a.step===3&&t("p",{class:"price"},"Från ",f(this.post),"kr")))}get el(){return i(this)}};const z=class{constructor(t){n(this,t);this.triggerScrollTotop=()=>{const n=this.el.nextSibling;h(n)};this.closeModal=undefined}getCartLength(){return a.cart.reduce(((n,t)=>n+t.amount),0)}handleCartClick(){var n;if((n=a.cart)===null||n===void 0?void 0:n.length){a.step=5;this.triggerScrollTotop()}}handleHomePageClick(){a.step=1;a.parentCategory=null;a.selectedCustomerCategory=null;this.triggerScrollTotop();setTimeout((()=>{a.selectedCategory=null;a.selectedProduct=null;a.maleri=null;a.selectedService=null}),200)}render(){const n=s(`./assets/hemfixarna.svg`);const i=s(`./assets/close.svg`);const e=s(`./assets/cart.svg`);const r=s(`./assets/back.svg`);return t("div",null,t("div",{class:"hemfixarna_crumbs"},t("div",{class:"hemfixarna_crumbs--links"},t("img",{onClick:()=>this.handleHomePageClick(),src:n,width:110}),t("img",{onClick:()=>this.closeModal(),class:"close",src:i,width:32}),t("div",null,t("button",{onClick:()=>this.handleHomePageClick()},"Alla tjänster"))),t("div",{class:"hemfixarna_crumbs--right"},t("hemfixarna-contact",null),t("div",{onClick:()=>this.handleCartClick(),class:`cart ${this.getCartLength()>0?"cart_active":""}`},t("img",{src:e,width:24}),t("span",null,this.getCartLength())))),[3,4].includes(a.step)&&!a.customer&&t("button",{class:"hemfixarna_crumbs--back",onClick:()=>{a.step=a.step===4?3:2}},t("img",{width:24,src:r,alt:"back arrow"}),t("span",null,"Se allt ",a.step===4?a.selectedService.post_title:a.selectedCategory.name)),!a.parentCategory&&a.step&&a.selectedCustomerCategory&&t("button",{class:"hemfixarna_crumbs--back",onClick:()=>{a.step=1;a.selectedCustomerCategory=null;a.selectedProduct=null;a.maleri=null}},t("img",{width:24,src:r,alt:"back arrow"}),t("span",null,"Se alla tjänster")),a.parentCategory&&a.step<5&&t("button",{class:"hemfixarna_crumbs--back",onClick:()=>{a.step=1;a.selectedCustomerCategory=a.parentCategory;a.selectedProduct=null;a.maleri=null}},t("img",{width:24,src:r,alt:"back arrow"}),t("span",null,"Se allt ",a.parentCategory.name)))}get el(){return i(this)}};const j=class{constructor(t){n(this,t)}render(){const n=s(`./assets/back.svg`);return t("div",{class:"hemfixarna_cart"},t("div",{class:"hemfixarna_cart--left"},t("h2",null,a.checkoutStep===2&&!a.checkoutEdit&&t("button",{onClick:()=>{a.checkoutStep=1}},t("img",{width:24,src:n,alt:"back arrow"})),"Din bokning"),t("hemfixarna-orderrows",null)),t("div",{class:"hemfixarna_cart--right"},t("h2",null,a.checkoutStep===2&&!a.checkoutEdit&&t("button",{onClick:()=>{a.checkoutStep=1}},t("img",{width:24,src:n,alt:"back arrow"})),"Dina uppgifter"),t("hemfixarna-checkout",null),t("hemfixarna-info",null)))}};const S="hemfixarna-partner.vercel.app";const I=()=>{if(window.location.href.includes("vercel.app")&&!window.location.href.includes(S)){return"https://hemfixare.dev.afonso.se"}else{return"https://hemfixarna.se"}};const T=()=>{if(typeof process!=="undefined"&&process.env&&process.env.API_URL){return process.env.API_URL}return I()};const O=()=>{if(window.location.href.includes("vercel.app")){return"https://hemfixare-lookup-dev.vercel.app/api"}else{return"https://hemfixare-lookup.vercel.app/api"}};const M=()=>{if(typeof process!=="undefined"&&process.env&&process.env.CREDIT_SAFE_API_URL){return process.env.CREDIT_SAFE_API_URL}return O()};const D=`${T()}/wp-json/headless`;async function L(n,t){const i=await fetch(n,t);const e=await i.json();return e}const N=async n=>{try{const t=await fetch(`${D}/customer/${n}`);return await t.json()}catch(n){console.log(n)}};const A=async({id:n,password:t})=>{try{const i=await fetch(`${D}/customer/login`,{method:"POST",body:JSON.stringify({id:n,password:t}),headers:{"Content-Type":"application/json"}});return i.status}catch(n){console.log(n)}};const F=async()=>{try{const n=await fetch(`${D}/webcoptions`);return await n.json()}catch(n){console.log(n)}};const P=async()=>{try{const n=await L(`${D}/rut`);return n}catch(n){console.log(n)}};const V=async()=>{try{const n=await fetch(`${D}/rot`);return await n.json()}catch(n){console.log(n)}};const K=async()=>{try{const n=await fetch(`${D}/green-discount`);return await n.json()}catch(n){console.log(n)}};const R=async n=>{try{const t=await fetch(`${D}/weborder`,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}});return await t.json()}catch(n){console.log(n)}};const E=`${T()}/wp-json/felix`;const H=async n=>{try{return await L(`${E}/createperson`,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}})}catch(n){console.log(n)}};const B=class{constructor(i){n(this,i);this.handleChangeDate=n=>{this.dateError=null;this.date=n.target.value};this.handleChangeTerms=()=>{this.generalError=null};this.sendOrder=async()=>{var n,t,i,e;if(this.loading)return;this.loading=true;let s={firstName:a.creditSafeUser.firstName,lastName:a.creditSafeUser.lastName,street:a.user.street,zip:a.user.zip,town:a.user.town,ssn:a.user.ssn,email:a.user.email,phone:a.user.phone,url:`${a.business===r.string?"string":a.business}-webk`,date:this.date,products:[...a.cart.map((n=>{const t=n.parts.map((n=>({id:String(n.id),name:n.name,quantity:n.amount,rut:0,rot:0})));return[{id:String(n.id),name:n.name,quantity:n.amount,rot:n.rot?1:0,rut:n.rut?1:0},...t]}))].flat(),creditSafe:a.creditSafeUser,customer:a.business,id_source:"",id_sub_source:"",seller_id:(n=this.sellerID)!==null&&n!==void 0?n:"",referral_id:(t=this.RefferalID)!==null&&t!==void 0?t:""};const o=await H(s);if(!o||!((e=(i=o.response)===null||i===void 0?void 0:i.scriptResult)===null||e===void 0?void 0:e.includes("OK"))){s=Object.assign(Object.assign({},s),{felixStatus:"error"})}else{s=Object.assign(Object.assign({},s),{felixStatus:"success"})}try{const{data:n,status:t}=await R(s);if(n&&t&&t===200){a.step=6;const n=this.el.closest(".hemfixarna_content");h(n)}else{this.generalError="Något gick fel, försök igen senare"}}catch(n){this.generalError="Något gick fel, försök igen senare"}this.loading=false};this.handleSubmit=n=>{n.preventDefault();this.generalError=null;const t=this.date.length>0;if(!t){this.dateError="Ange ett giltigt datum"}const i=Array.from(this.el.querySelectorAll('input[type="checkbox"]'));const e=i.find((n=>!n.checked));if(e){this.generalError="Du måste godkänna villkoren"}if(t&&!e){this.sendOrder()}};this.handleKeyDown=n=>{this.enteredPin+=n.key;const t="+0033";if(this.enteredPin.length===t.length){if(this.enteredPin===t){localStorage.setItem("show_sources","true");this.showSources=true;window.removeEventListener("keydown",this.handleKeyDown)}this.enteredPin=""}clearTimeout(this.pinTimeout);this.pinTimeout=setTimeout((()=>this.enteredPin=""),5e3)};this.render=()=>{var n;const i=s(`./assets/date.svg`);const r=s(`./assets/down.svg`);const o=s(`./assets/spinner.gif`);if(a.checkoutEdit){return t("hemfixarna-address",null)}else if(a.checkoutStep===1){return t("hemfixarna-getuser",null)}else if(a.checkoutStep===2){return t("div",{class:"mb-2"},t("div",{class:"hemfixarna_addressinfo"},t("div",null,t("p",null,l(a.user.firstName)),t("p",null,l(a.user.lastName)),t("p",null,a.user.email),t("p",null,a.user.phone)),t("div",null,t("p",null,l(a.user.street)),t("p",null,l(a.user.zip)),t("p",null,l(a.user.town))),t("button",{onClick:()=>a.checkoutEdit=true},"Behöver du ändra adressen?")),t("form",{onSubmit:n=>this.handleSubmit(n)},t("div",null,t("img",{src:i,width:24}),t("input",{class:`${this.date.length?"input_active":""}`,min:(new Date).toISOString().split("T")[0],onChange:n=>this.handleChangeDate(n),type:"date",name:"date",value:this.date}),t("label",{htmlFor:"date"},"Tidigaste datum för hembesök"),t("img",{src:r,width:24})),this.dateError&&t("span",null,this.dateError),a.customer.source&&this.showSources?t(e,null,t("p",null,"Inloggad som:",t("strong",null," ",a.customer.source.fieldData.So01_Name)),t("label",null,"Säljare (SäljarId)",t("input",{type:"text",value:this.sellerID,onChange:n=>this.sellerID=n.target.value})),t("label",null,"PartnerOrderID (RefferalID)",t("input",{type:"text",value:this.RefferalID,onChange:n=>this.RefferalID=n.target.value})),((n=a.customer.source.sub_sources)===null||n===void 0?void 0:n.length)?t("div",null,t("select",{onChange:n=>this.selectedSubSource=n.target.value},t("option",{disabled:true,selected:true,value:"null"},"Välj underkälla"),a.customer.source.sub_sources.map((n=>t("option",{value:n["So_SubSource::_id"]},n["So_SubSource::Sus01_Name"]))))):t("h4",null,"Det finns inga underkällor att välja")):null,t("label",{class:"hemfixarna_checkbox"},t("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),t("span",{innerHTML:a.options.terms})),a.cart.filter((n=>{var t;return(t=n.terms_checkout)===null||t===void 0?void 0:t.length})).map((n=>t(e,null,t("label",{class:"hemfixarna_checkbox"},t("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),t("span",null,n.terms_checkout))))),this.generalError&&t("span",null,this.generalError),t("div",{class:this.loading?"loading":""},t("input",{type:"submit",value:this.loading?"":"Skicka bokning"}),t("img",{width:20,height:20,src:o,alt:"spinner"}))))}};this.date="";this.dateError=null;this.generalError=null;this.loading=false;this.enteredPin="";this.selectedSubSource=null;this.partnerOrderId=null;this.showSources=false;this.sellerID=null;this.RefferalID=null}componentWillLoad(){if(Boolean(a.user&&a.user.street)){a.checkoutStep=2}if(a.customer&&a.customer.source){window.addEventListener("keydown",this.handleKeyDown)}const n=localStorage.getItem("show_sources");if(n){this.showSources=true}}disconnectedCallback(){window.removeEventListener("keydown",this.handleKeyDown)}get el(){return i(this)}};const W='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap");\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n* {\n box-sizing: border-box;\n}\n\n:host {\n font-family: "Inter", sans-serif;\n}\n:host input[type=text] {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host .mb-2 {\n margin-bottom: 32px;\n}\n:host button {\n color: #474444;\n}\n:host form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n position: relative;\n}\n:host form button {\n position: absolute;\n right: 0;\n top: -1rem;\n}\n:host form img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n pointer-events: none;\n}\n:host form img:first-of-type {\n left: 16px;\n}\n:host form img:last-of-type {\n right: 16px;\n}\n:host form span {\n margin-top: -8px;\n color: #ec6632;\n}\n:host form p {\n text-align: center;\n}\n:host form p {\n margin: 0;\n}\n:host form div {\n position: relative;\n}\n:host form div label {\n pointer-events: none;\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n background: #fff;\n padding: 4px;\n transition: 0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n}\n:host form div input {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host form div input:focus ~ label,\n:host form div .input_active ~ label {\n top: 0;\n transform: translateY(-50%);\n background: linear-gradient(180deg, #fffaf2 50%, #fff 50%);\n}\n:host form select {\n padding: 0.75rem 1rem;\n width: 100%;\n}\n:host h1 {\n font-size: 24px;\n font-weight: 400;\n line-height: 32px;\n letter-spacing: -3%;\n text-align: left;\n margin: 0 0 8px;\n}\n:host h2 {\n margin: 0 0 24px;\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -3%;\n}\n:host p {\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna {\n width: 100%;\n /* Hide default HTML checkbox */\n /* The slider */\n}\n:host .hemfixarna_contact {\n display: flex;\n gap: 16px;\n}\n:host .hemfixarna_contact a {\n display: flex;\n align-items: center;\n gap: 8px;\n color: #474444;\n text-decoration: none;\n font-weight: 600;\n font-size: 13px;\n}\n:host .hemfixarna_contact a:hover {\n text-decoration: underline;\n}\n:host .hemfixarna_contact--horizontal span {\n display: none;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_contact--horizontal span {\n display: initial;\n }\n}\n:host .hemfixarna_painting {\n opacity: 0;\n padding: 0 1rem;\n animation: fadeIn 0.5s forwards 0.3s;\n}\n:host .hemfixarna_painting > h2,\n:host .hemfixarna_painting p {\n text-align: center;\n padding: 0 16px;\n}\n:host .hemfixarna_painting > h2 {\n margin: 0 0 8px;\n}\n:host .hemfixarna_partnerlogo {\n max-height: 50px;\n min-height: 45px;\n object-fit: contain;\n max-width: 150px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_partnerlogo {\n max-width: 200px;\n }\n}\n:host .hemfixarna_nav {\n position: absolute;\n top: 0;\n width: 100dvw;\n left: 0;\n height: 80px;\n z-index: 9999;\n}\n:host .hemfixarna_nav--links {\n display: none !important;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav--links {\n display: flex !important;\n }\n}\n:host .hemfixarna_nav--links a {\n color: #ec6632;\n text-decoration: none;\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: 56px;\n padding: 8px 32px;\n text-transform: capitalize;\n}\n:host .hemfixarna_nav > div {\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 16px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav > div {\n padding: 0 32px;\n }\n}\n:host .hemfixarna_nav > div > div {\n display: flex;\n gap: 32px;\n justify-content: space-between;\n}\n:host .hemfixarna_nav > div > img {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: -1;\n}\n:host .hemfixarna_nav a {\n text-decoration: none;\n}\n:host .hemfixarna_nav p {\n color: #474444;\n}\n:host .hemfixarna_nav p.with-bg {\n color: #fff;\n}\n:host .hemfixarna_standalone .hemfixarna_backdrop {\n background: #fffaf2;\n opacity: 1;\n}\n:host .hemfixarna_standalone .hemfixarna_modal {\n top: 80px;\n transform: translateX(-50%);\n border: none;\n height: calc(100dvh - 80px);\n opacity: 0;\n}\n:host .hemfixarna_standalone .hemfixarna_modal--open {\n opacity: 1;\n}\n:host .hemfixarna .switch {\n position: relative;\n display: inline-block;\n width: 40px;\n height: 20px;\n}\n:host .hemfixarna .switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n:host .hemfixarna .slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 34px;\n}\n:host .hemfixarna .slider:before {\n position: absolute;\n content: "";\n height: 18px;\n width: 18px;\n left: 2px;\n bottom: 1px;\n background-color: white;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 50%;\n}\n:host .hemfixarna input:checked + .slider {\n background-color: #fcd9c9;\n}\n:host .hemfixarna input:focus + .slider {\n box-shadow: 0 0 1px #fcd9c9;\n}\n:host .hemfixarna input:checked + .slider:before {\n -webkit-transform: translateX(18px);\n -ms-transform: translateX(18px);\n transform: translateX(18px);\n background: #ec6632;\n}\n:host .hemfixarna_maleribox {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n width: 100%;\n min-height: 132px;\n padding: 24px;\n display: flex;\n align-items: center;\n gap: 24px;\n text-align: left;\n}\n:host .hemfixarna_maleribox:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_checkbox {\n display: grid;\n grid-template-columns: 40px auto;\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna_checkbox > span {\n transform: translateY(6px);\n}\n:host .hemfixarna_checkbox span,\n:host .hemfixarna_checkbox span p {\n color: #474444;\n font-size: 14px;\n}\n:host .hemfixarna_checkbox p {\n text-align: left;\n}\n:host .hemfixarna_info {\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 32px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n border-radius: 4px;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_info h2 {\n margin: 0;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_info {\n position: sticky;\n top: 0;\n }\n}\n:host .hemfixarna_infomodal {\n position: absolute;\n top: 40%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 100%;\n max-width: 80%;\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n padding: 32px;\n z-index: 99;\n border-radius: 4px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n:host .hemfixarna_infomodal p,\n:host .hemfixarna_infomodal h4 {\n margin: 0;\n}\n:host .hemfixarna_infomodal button {\n background: #ec6632;\n color: #fff;\n border-radius: 60px;\n font-size: 16px;\n padding: 8px 16px;\n}\n:host .hemfixarna_addressinfo {\n padding: 16px 16px 64px;\n border: 1px solid #fcd9c9;\n position: relative;\n margin-bottom: 32px;\n display: grid;\n grid-template-columns: 1fr;\n gap: 8px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_addressinfo {\n grid-template-columns: 1fr 1fr;\n }\n}\n:host .hemfixarna_addressinfo button {\n position: absolute;\n bottom: 16px;\n right: 16px;\n font-weight: 500;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n:host .hemfixarna_part {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: grid;\n padding: 16px;\n grid-template-columns: auto 75px;\n}\n:host .hemfixarna_counter {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_counter span {\n padding: 0 8px;\n}\n:host .hemfixarna_counter img {\n cursor: pointer;\n}\n:host .hemfixarna_counter img:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_description {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_description ul {\n list-style: disc;\n padding-right: 12px;\n transform: translateX(12px);\n}\n:host .hemfixarna_description--hidden {\n max-height: 140px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n}\n:host .hemfixarna_description--hidden::after {\n content: "";\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 128px;\n background: linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2);\n}\n:host .hemfixarna_terms {\n font-size: 14px;\n}\n:host .hemfixarna_terms a {\n color: inherit;\n}\n:host .hemfixarna_logo {\n height: 64px;\n}\n:host .hemfixarna_box {\n padding: 16px;\n display: flex;\n align-items: center;\n width: 100%;\n box-sizing: border-box;\n border-radius: 4px;\n gap: 16px 8px;\n border-radius: 4px;\n gap: 16px 8px;\n}\n:host .hemfixarna_box p,\n:host .hemfixarna_box span {\n font-size: 15px;\n}\n:host .hemfixarna_box .underline {\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n:host .hemfixarna_box .pointer {\n cursor: pointer;\n}\n:host .hemfixarna_box .p-s {\n font-size: 12px;\n}\n:host .hemfixarna_box > div {\n display: grid;\n gap: 8px;\n}\n:host .hemfixarna_box--standard {\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_box--alternative, :host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n background: transparent;\n border: 1px solid #e3e3e3;\n}\n:host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725);\n}\n:host .hemfixarna_box--alternative_3 {\n justify-content: center;\n}\n:host .hemfixarna_altbtn {\n display: flex !important;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n margin-left: auto;\n}\n:host .hemfixarna_btn {\n margin-left: auto;\n}\n:host .hemfixarna_btn, :host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n border: none;\n border-radius: 60px;\n font-weight: 600;\n letter-spacing: 0.5px;\n line-height: 20px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_btn:not(.disabled):hover, :host .hemfixarna_buy:not(.disabled):hover,\n:host .hemfixarna input[type=submit]:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna div:has(> input[type=submit]) {\n position: relative;\n}\n:host .hemfixarna div:has(> input[type=submit]) input {\n cursor: pointer;\n}\n:host .hemfixarna div:has(> input[type=submit]) img {\n display: none;\n}\n:host .hemfixarna .loading {\n cursor: default;\n opacity: 0.6;\n}\n:host .hemfixarna .loading > img {\n display: initial !important;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n:host .hemfixarna_btn {\n font-size: 14px;\n background: #c84e18;\n color: #fff;\n padding: 16px 24px;\n white-space: nowrap;\n position: relative;\n}\n:host .hemfixarna_btn span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_btn span {\n background: #25a710;\n color: #fff;\n right: 0 !important;\n}\n:host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n font-size: 21px;\n background: #25a710;\n color: #fff;\n padding: 16px 24px;\n}\n:host .hemfixarna .disabled {\n opacity: 0.5;\n cursor: default;\n}\n:host .hemfixarna_modal {\n position: fixed;\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n border-radius: 4px;\n top: 50%;\n left: 50%;\n z-index: 1000;\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n transform: translate(-50%, -50%) scale(0.7);\n opacity: 0;\n height: 92%;\n width: 92%;\n max-width: 920px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n:host .hemfixarna_modal--open {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n}\n:host .hemfixarna_backdrop {\n z-index: 999;\n position: fixed;\n background: #474444;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n opacity: 0;\n transition: transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946);\n}\n:host .hemfixarna_backdrop--open {\n opacity: 0.3;\n}\n:host .hemfixarna_order {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n background-repeat: no-repeat !important;\n background-size: cover !important;\n background-position: center !important;\n display: grid;\n grid-template-columns: 1fr 1fr;\n padding: 48px 32px 64px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_order {\n grid-template-columns: 1fr;\n grid-template-rows: 0 auto;\n }\n}\n:host .hemfixarna_order > div:last-of-type {\n background: #fffaf2;\n padding: 32px;\n display: flex;\n flex-direction: column;\n max-height: 100%;\n overflow: auto;\n}\n:host .hemfixarna_order img {\n cursor: pointer;\n}\n:host .hemfixarna_order button {\n margin: 16px 0;\n padding: 0;\n text-decoration: underline;\n text-underline-offset: 2px;\n font-size: 14px;\n font-weight: 600;\n}\n:host .hemfixarna_cart {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart {\n grid-template-columns: 1fr;\n gap: 0;\n }\n}\n:host .hemfixarna_cart--right h2, :host .hemfixarna_cart--left h2 {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_cart--right h2 img, :host .hemfixarna_cart--left h2 img {\n margin-top: 3.2px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_cart--left h2 button {\n display: none;\n }\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart--right h2 button {\n display: none;\n }\n}\n:host .hemfixarna_cart--startfee {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot div {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_cart--additional {\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 16px;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--additional p {\n font-size: 14px;\n}\n:host .hemfixarna_cart--additional strong {\n text-decoration: underline;\n text-underline-offset: 2px;\n cursor: pointer;\n position: relative;\n}\n:host .hemfixarna_cart--additional strong img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n right: -24px;\n}\n:host .hemfixarna_cart--price {\n border-top: 1px solid #fcd9c9;\n padding: 16px;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--price h3 {\n margin: 0;\n}\n:host .hemfixarna_cart--item {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 16px 0;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--item span {\n font-size: 12px;\n}\n:host .hemfixarna_cart--item > div {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--item > div > div {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n:host .hemfixarna_cart--item > div button {\n color: #ec6632;\n}\n:host .hemfixarna_categories {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n:host .hemfixarna_categories--wrapper {\n gap: 32px;\n display: grid;\n grid-template-columns: 1fr 1fr;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_categories--wrapper {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_categories li {\n position: relative;\n background: #fff;\n border-radius: 4px;\n min-height: 132px;\n padding: 24px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n align-items: center;\n gap: 24px;\n cursor: pointer;\n}\n:host .hemfixarna_categories li:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_categories li > button {\n height: 100%;\n width: 100%;\n}\n:host .hemfixarna_categories li .price {\n font-weight: 700;\n}\n:host .hemfixarna_content {\n height: 100%;\n overflow: auto;\n padding: 0 32px 64px;\n}\n:host .hemfixarna_content--5 {\n padding-top: 16px;\n}\n:host .hemfixarna_content--painting {\n padding: 0;\n overflow: initial;\n}\n:host .hemfixarna_crumbs {\n position: relative;\n padding: 16px 24px;\n border-bottom: 1px solid #fcd9c9;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_crumbs--back {\n padding: 16px 24px 8px;\n display: flex;\n align-items: center;\n gap: 8px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs--back:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_crumbs img {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .close {\n position: absolute;\n right: -16px;\n top: -16px;\n z-index: 9;\n -webkit-transform: translate3d(0, 0, 0);\n}\n:host .hemfixarna_crumbs .cart {\n display: flex;\n padding-left: 16px;\n position: relative;\n}\n:host .hemfixarna_crumbs .cart img {\n cursor: inherit;\n}\n:host .hemfixarna_crumbs .cart span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_crumbs .cart_active {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .cart_active span {\n background: #25a710;\n color: #fff;\n}\n:host .hemfixarna_crumbs--links {\n display: flex;\n align-items: center;\n gap: 16px;\n overflow: auto;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_crumbs--links {\n -ms-overflow-style: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar {\n display: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar-button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs--right {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_crumbs button {\n white-space: nowrap;\n background: #f1ded6;\n border-radius: 64px;\n padding: 12px 16px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.3px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs button:not(.active):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n@media (max-width: 768px) {\n :host .hemfixarna_crumbs button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs .active {\n background: #fffaf2;\n cursor: default;\n}\n:host .hemfixarna_features {\n gap: 12px !important;\n}\n:host .hemfixarna_features li {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_address {\n margin-bottom: 16px;\n}\n:host .hemfixarna_product {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_product--link {\n font-weight: 700;\n color: #474444;\n text-underline-offset: 4px;\n}\n:host .hemfixarna_product--left {\n gap: 32px;\n}\n:host .hemfixarna_product--right {\n gap: 32px;\n}\n:host .hemfixarna_product--price {\n margin-top: 4px;\n font-weight: 700;\n}\n:host .hemfixarna_product--total {\n text-align: center;\n margin: -16px 0;\n font-size: 21px;\n line-height: 28px;\n}\n:host .hemfixarna_product--item {\n background: #fff;\n padding: 16px;\n display: grid;\n grid-template-columns: auto 75px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_product--grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--grid {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_product--grid > div {\n display: flex;\n flex-direction: column;\n}\n:host .hemfixarna_product--grid ul {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n:host .hemfixarna_product p {\n margin: 0;\n}\n:host .hemfixarna_product--top {\n display: flex;\n gap: 32px;\n}\n:host .hemfixarna_product--top img {\n object-fit: contain;\n}\n:host .hemfixarna_product--top > div {\n width: 100%;\n}\n:host .hemfixarna_product--top > div h1 {\n max-width: 80%;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--top > div h1 {\n max-width: 100%;\n }\n}\n:host .hemfixarna_product--top h4 {\n margin-bottom: 8px;\n}\n:host h5,\n:host p {\n margin: 0;\n}\n:host input[type=submit] {\n cursor: pointer;\n}\n:host input[type=date] ~ label {\n left: 56px;\n}\n:host input[type=date] {\n border: 1px solid #fcd9c9;\n padding-left: 64px;\n}\n:host input[type=checkbox] {\n height: 18px;\n width: 18px;\n border: 1px solid #fcd9c9;\n}\n:host input[type=checkbox]:checked {\n background: red;\n}\n:host input[type=date]::-webkit-calendar-picker-indicator {\n background: transparent;\n bottom: 0;\n color: transparent;\n cursor: pointer;\n height: auto;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n width: auto;\n}\n:host button,\n:host a {\n cursor: pointer;\n background: none;\n border: none;\n}\n:host ul {\n list-style: none;\n margin: 0;\n padding: 0;\n}';const U=class{constructor(t){n(this,t);this.triggerScrollTotop=()=>{const n=this.el.shadowRoot.querySelector(".hemfixarna_content");h(n)};this.modal=false;this.showModal=false;this.product=null;this.id=undefined;this.business=undefined;this.widgetStyle=o.standard;this.buttonColor=undefined;this.buttonBg=undefined;this.proppedProduct=null}loadCategoryOrProduct(n){this.proppedProduct=null;if(n.startsWith("c-")){const t=[...a.customer.categories,...a.customer.categories.map((n=>{var t;return(t=n.sub_categories)!==null&&t!==void 0?t:[]}))].flat();const i=t.find((t=>t&&t.id===n.replace("c-","")));if(i){a.selectedCustomerCategory=i;a.step=2}}else{const t=a.customer.categories.map((n=>n.show_products?n.products:n.sub_categories?n.sub_categories.map((n=>n.products)):[])).flat().flat();const i=t.find((t=>t&&t.fields.ID===parseInt(n)));if(i){a.selectedProduct=i.fields;a.step=4;this.proppedProduct=i.fields}}}async watchIdChange(n){if(n&&a.customer){if(n==="maleri"){a.maleri=true;a.step=4}else{this.loadCategoryOrProduct(n)}}}async componentWillLoad(){a.business=this.business;const n=window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);if(n){a.cart=JSON.parse(n)}const t=window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);if(t){a.user=JSON.parse(t)}const i=window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);if(i){a.creditSafeUser=JSON.parse(i)}const[e,s,r,o]=await Promise.all([F(),P(),V(),K()]);try{const n=await N(this.business);if((n===null||n===void 0?void 0:n.code)==="not_found"){console.warn("customer not found")}else if(n){a.customer=n;if(this.id){if(this.id==="maleri"){a.maleri=true;a.step=4}else{this.loadCategoryOrProduct(this.id)}}}}catch(n){console.warn("customer not found")}a.rotOptions=r;a.rutOptions=s;a.greenOptions=o;a.options=e}openModal(){this.modal=true;setTimeout((()=>{this.showModal=true}),50)}closeModal(){this.showModal=false;setTimeout((()=>{this.modal=false}),200)}handleClick(n){if((n===null||n===void 0?void 0:n.composedPath()[0]).classList.contains("hemfixarna_backdrop")){this.closeModal()}const t=this.el.shadowRoot.querySelector(".hemfixarna_infomodal");if(t){const i=t.contains(n.composedPath()[0]);if(!i){a.modal=null}}}getCartLength(){return a.cart.reduce(((n,t)=>n+t.amount),0)}render(){var n,i,r,l,h,c,p,d,u,f,x,g;const v=s(`./assets/hemfixarna.svg`);const b=s(`./assets/pensel.svg`);const _=s(`./assets/montering.svg`);return t("div",{class:"hemfixarna"},t("div",{class:`hemfixarna_box hemfixarna_box--${this.widgetStyle}`},[o.alternative_2,o.alternative_3].includes(this.widgetStyle)?t("img",{src:this.id==="maleri"?b:_,alt:"montering logo",width:32,height:32}):null,t("div",null,t("div",null,t("p",{onClick:()=>this.openModal(),class:`pointer ${[o.alternative_2,o.alternative_3].includes(this.widgetStyle)&&a.selectedProduct?"underline":""}`},this.id==="maleri"?t("span",null,"Beräkna fast pris på måleri & tapetsering här"):t(e,null,!a.selectedCustomerCategory&&!this.product&&!this.proppedProduct?t(e,null,((n=a.customer)===null||n===void 0?void 0:n.widget_title)?t("span",null,a.customer.widget_title):t("span",null,"Montering/Installation - ",t("strong",{class:"underline"},"se priser här"))):t(e,null,((i=this.product)===null||i===void 0?void 0:i.title)||((r=this.proppedProduct)===null||r===void 0?void 0:r.title)||((l=a.selectedCustomerCategory)===null||l===void 0?void 0:l.widget_title)||t("span",null,"Montering",t("wbr",null),"/Installation ",(c=(h=a.selectedCustomerCategory)===null||h===void 0?void 0:h.name)!==null&&c!==void 0?c:"på plats"," - ",t("strong",{class:"underline"},"se priser här")),this.proppedProduct&&!((p=this.product)===null||p===void 0?void 0:p.invoice)&&!((d=this.proppedProduct)===null||d===void 0?void 0:d.invoice)?t("span",null," från"," ",t("strong",null,m(this.proppedProduct||this.product),"kr")):null)))),this.widgetStyle===o.standard?t("img",{src:v,width:104}):null,this.widgetStyle===o.alternative?t("span",{class:"p-s"},"Utförs av ",t("strong",null,"Hemfixarna")):null),[o.standard,o.alternative].includes(this.widgetStyle)?t("button",{onClick:()=>this.openModal(),class:"hemfixarna_btn",style:{color:((u=this.buttonColor)===null||u===void 0?void 0:u.startsWith("#"))||!((f=this.buttonColor)===null||f===void 0?void 0:f.length)?this.buttonColor:`#${this.buttonColor}`,backgroundColor:((x=this.buttonBg)===null||x===void 0?void 0:x.startsWith("#"))||!((g=this.buttonBg)===null||g===void 0?void 0:g.length)?this.buttonBg:`#${this.buttonBg}`}},"Beställ här",this.getCartLength()>0&&t("span",null,this.getCartLength())):null,o.alternative_2===this.widgetStyle?t("div",{class:"hemfixarna_altbtn"},t("strong",{class:"p-s"},"Utförs av"),t("img",{src:v,alt:"hemfixarna logo",width:98})):null),this.modal&&t("div",null,t("div",{class:`hemfixarna_modal ${this.showModal?"hemfixarna_modal--open":""}`},a.modal&&t("div",{class:"hemfixarna_infomodal"},a.modal.title&&t("h2",null,a.modal.title),a.modal.text.map((n=>t("p",{innerHTML:n}))),t("div",null,t("button",{onClick:()=>a.modal=null},"Stäng"))),a.customer&&t("hemfixarna-breadcrumbs",{closeModal:()=>this.closeModal()}),t("div",{class:`hemfixarna_content hemfixarna_content--${a.step} ${a.step===4&&a.maleri?"hemfixarna_content--painting":""}`},a.step<4&&t("hemfixarna-start",null),a.step===4&&t("hemfixarna-product",null),a.step===5&&t("hemfixarna-cart",null),a.step===6&&t("hemfixarna-order",null))),t("div",{class:`hemfixarna_backdrop ${this.showModal?"hemfixarna_backdrop--open":""}`})))}static get assetsDirs(){return["assets"]}get el(){return i(this)}static get watchers(){return{id:["watchIdChange"]}}};U.style=W;const J=class{constructor(t){n(this,t);this.vertical=false}render(){return t("div",{class:`hemfixarna_contact ${this.vertical?"hemfixarna_contact--vertical":"hemfixarna_contact--horizontal"}`},t("a",{href:"tel:0770-220 720"},t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M7 4V20H17V4H7ZM6 2H18C18.5523 2 19 2.44772 19 3V21C19 21.5523 18.5523 22 18 22H6C5.44772 22 5 21.5523 5 21V3C5 2.44772 5.44772 2 6 2ZM12 17C12.5523 17 13 17.4477 13 18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18C11 17.4477 11.4477 17 12 17Z",fill:"#C84E18"})),t("span",null,"0770-220 720")),t("a",{href:"https://hemfixarna.se/kundservice/",target:"_blank"},t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("g",{"clip-path":"url(#clip0_1001_894)"},t("path",{d:"M21 12.22C21 6.73 16.74 3 12 3C7.31 3 3 6.65 3 12.28C2.4 12.62 2 13.26 2 14V16C2 17.1 2.9 18 4 18H5V11.9C5 8.03 8.13 4.9 12 4.9C15.87 4.9 19 8.03 19 11.9V19H11V21H19C20.1 21 21 20.1 21 19V17.78C21.59 17.47 22 16.86 22 16.14V13.84C22 13.14 21.59 12.53 21 12.22Z",fill:"#C84E18"}),t("path",{d:"M9 14C9.55228 14 10 13.5523 10 13C10 12.4477 9.55228 12 9 12C8.44772 12 8 12.4477 8 13C8 13.5523 8.44772 14 9 14Z",fill:"#C84E18"}),t("path",{d:"M15 14C15.5523 14 16 13.5523 16 13C16 12.4477 15.5523 12 15 12C14.4477 12 14 12.4477 14 13C14 13.5523 14.4477 14 15 14Z",fill:"#C84E18"}),t("path",{d:"M18 11.03C17.52 8.18 15.04 6 12.05 6C9.01997 6 5.75997 8.51 6.01997 12.45C8.48997 11.44 10.35 9.24 10.88 6.56C12.19 9.19 14.88 11 18 11.03Z",fill:"#C84E18"})),t("defs",null,t("clipPath",{id:"clip0_1001_894"},t("rect",{width:"24",height:"24",fill:"white"})))),t("span",null,"Kundservice")))}};const Z='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); :host{font-family:"Inter", sans-serif}:host .hemfixarna_widgetstyles label{cursor:pointer}:host .hemfixarna_widgetstyles>div{display:flex;gap:1rem}:host .hemfixarna_widgetstyles h5{margin:1rem 0}:host .hemfixarna_example{margin-bottom:16px;background:#000;padding:16px;color:#fff;display:flex;justify-content:space-between;cursor:pointer;max-width:500px;box-sizing:border-box;position:relative}:host .hemfixarna_example--tooltip{background:#000;top:-48px;font-size:16px;left:40%;color:white;padding:8px;position:absolute;opacity:0}:host .hemfixarna_example--tooltip::after{content:"";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#000 transparent transparent transparent}:host .hemfixarna_example:hover .hemfixarna_example--tooltip{opacity:1}:host .hemfixarna_example p{font-size:14px}:host .hemfixarna_example img{filter:invert(1)}:host .hemfixarna_install{display:grid;gap:8px;margin-top:16px}:host .hemfixarna_product--label{background:#e1e0f5}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:8px}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:3.2px 9.6px;border-radius:10px;margin-right:8px;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;border-bottom:1px solid black}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div:not(.hemfixarna_hosted){grid-template-columns:1fr 1fr}:host .hemfixarna_hosted .hemfixarna_scripts{display:none}:host>div{display:grid;gap:32px;width:100%;height:100vh;place-items:center;overflow:hidden;padding:16px 32px;box-sizing:border-box}:host>div>*{width:100%}:host>div>div{max-width:500px}:host>div ul{margin:0;padding:0;list-style:none}:host>div ul ul{gap:1px;display:grid}:host>div ul li{padding-left:16px;background:#fff}';const X=class{constructor(t){n(this,t);this.debounce=null;this.cdnLink='<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"><\/script>';this.selectedSlug=undefined;this.selectedID=undefined;this.tooltipText="Kopiera till urklipp";this.tree=null;this.customer=null;this.widgetStyle=o.standard;this.buttonBg="";this.buttonColor="";this.partner=undefined;this.colorAccessibility=undefined;this.loggedIn=false;this.loginError=false}debouncedFunction(){if(this.debounce!==null){clearTimeout(this.debounce);this.debounce=null}this.debounce=window.setTimeout((()=>{this.checkColorAccessibility();this.debounce=null}),1500)}async checkColorAccessibility(){const n="#fff";const t="#c84e18";const i=this.buttonBg.length?this.buttonBg.startsWith("#")?this.buttonBg:`#${this.buttonBg}`:t;const e=this.buttonColor.length?this.buttonColor.startsWith("#")?this.buttonColor:`#${this.buttonColor}`:n;try{const n=await fetch("https://www.aremycolorsaccessible.com/api/are-they",{mode:"cors",method:"POST",body:JSON.stringify({colors:[i,e]})});if(!n){throw new Error("Network response was not ok")}const t=await n.json();if(t&&t){this.colorAccessibility=t}}catch(n){console.warn("Error fetching color accessibility:",n)}}getColor(n){switch(n){case"AAA":return"green";case"AA":return"orange";case"A":return"yellow";case"Fail":return"red";default:return"black"}}async componentWillLoad(){const n=window.location.pathname.replace("/","");if(!C(n)&&n)return;this.partner=n?n:r.kund;const t=await N(this.partner);if(t.code!=="not_found"&&t){this.customer=t;if(!this.customer.password_protected||window.localStorage.getItem(`${this.customer.ID}-loggedin`)){this.loggedIn=true}}}getExample(){return`<hemfixarna-component business="${this.partner}"${this.selectedSlug?` slug="${this.selectedSlug}" `:""}${this.selectedID?` id="${this.selectedID}" `:""} ${this.widgetStyle===o.standard?"":`widget-style="${this.widgetStyle}"`} ${this.buttonColor.length?`button-color="${this.buttonColor}"`:""} ${this.buttonBg.length?`button-bg="${this.buttonBg}"`:""}></hemfixarna-component>`}copyExample(){navigator.clipboard.writeText(this.getExample());this.tooltipText="Snippet kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyCdn(){navigator.clipboard.writeText(this.cdnLink);this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyNpmInstall(){navigator.clipboard.writeText("npm i hemfixarna-web-components");this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}showMaleri(){var n;const t=(n=this.customer)===null||n===void 0?void 0:n.categories.map((n=>n.sub_categories?n.sub_categories:n)).flat();return t===null||t===void 0?void 0:t.some((n=>n.add_painting))}async handleLogin(){const n=document.querySelector("hemfixarna-demo");const t=n.shadowRoot;const i=t.querySelector('input[type="password"]');const e=i.value;this.loginError=false;try{const n=await A({id:this.customer.ID,password:e});if(n===200){this.loggedIn=true;window.localStorage.setItem(`${this.customer.ID}-loggedin`,"true")}else{this.loginError=true}}catch(n){console.log(n);this.loginError=true}}render(){var n;const i=s(`./assets/copy.png`);return this.customer?t(e,null,this.loggedIn?t("div",{class:((n=this.customer)===null||n===void 0?void 0:n.at_hemfixarna)?"hemfixarna_hosted":""},t("div",{class:"hemfixarna_scripts"},t("div",{onClick:()=>this.copyExample(),class:"hemfixarna_example"},t("p",null,this.getExample()),t("img",{src:i,height:20}),t("span",{class:"hemfixarna_example--tooltip"},this.tooltipText)),t("hemfixarna-component",{business:this.partner,buttonBg:this.buttonBg,buttonColor:this.buttonColor,widgetStyle:this.widgetStyle,id:this.selectedID}),t("div",{class:"hemfixarna_install"},t("div",{onClick:()=>this.copyCdn(),class:"hemfixarna_example"},t("p",null,this.cdnLink),t("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),t("img",{src:i,height:20}))),t("div",{class:"hemfixarna_widgetstyles"},t("h5",null,"Widget styles"),t("div",null,Object.values(o).map((n=>t("label",{key:n},t("input",{type:"radio",value:n,checked:this.widgetStyle===n,onChange:()=>this.widgetStyle=n}),n)))),t("div",null,t("div",null,t("h5",null,"Button background color"),t("input",{type:"text",value:this.buttonBg,onInput:n=>this.buttonBg=n.target.value})),t("div",null,t("h5",null,"Button text color"),t("input",{type:"text",value:this.buttonColor,onInput:n=>this.buttonColor=n.target.value})))),t("span",null,"Write an hexa code no # needed"),this.colorAccessibility?t("div",null,t("h5",null,"Tillgänglighetsrapport"),t("div",null,t("strong",null,"Liten text:"),t("span",{style:{color:this.getColor(this.colorAccessibility.small)}},this.colorAccessibility.small),t("br",null),t("strong",null,"Fet text:"),t("span",{style:{color:this.getColor(this.colorAccessibility.bold)}},this.colorAccessibility.bold),t("br",null),t("strong",null,"Stor text:"),t("span",{style:{color:this.getColor(this.colorAccessibility.large)}},this.colorAccessibility.large),t("br",null),t("strong",null,"Kontrastförhållande:")," ",this.colorAccessibility.contrast)):null),t("ul",{class:"hemfixarna_categories"},t("div",null,this.customer.logo?t("div",{style:{width:"100%",display:"flex",justifyContent:"center"}},t("img",{style:{maxWidth:"250px",height:"auto",margin:"0 auto 2rem"},src:this.customer.logo.url,alt:this.customer.post_title})):null,this.showMaleri()?t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},t("div",null,t("p",null,"Måleriverktyget"),t("span",null,"maleri")),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText("maleri")},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${T()}/partner/${this.customer.post_name}?id=maleri`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID="maleri"},"Ladda måleri")))):null,this.customer.categories.map((n=>t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},t("div",null,t("p",null,n.name),t("span",null,`c-${n.id}`)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(`c-${n.id}`)},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${T()}/partner/${this.customer.post_name}?id=c-${n.id}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=`c-${n.id}`},"Ladda kategori"))),n.show_products&&n.products?t("ul",null,n.products.map((n=>t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},t("div",null,t("p",null,n.fields.title),t("span",null,n.fields.ID)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(String(n.fields.ID))},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${T()}/partner/${this.customer.post_name}?id=${n.fields.ID}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=String(n.fields.ID)},"Ladda produkt"))))))):t("ul",null,n.sub_categories&&n.sub_categories.map((i=>t("li",null,t("div",{class:"hemfixarna_categories--label"},t("div",null,t("p",null,i.name),t("span",null,`c-${i.id}`)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(`c-${i.id}`)},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${T()}/partner/${this.customer.post_name}?id=c-${n.id}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=`c-${i.id}`},"Ladda kategori"))),t("ul",null,i.products.map((n=>t("li",null,t("div",{class:"hemfixarna_categories--label hemfixarna_product--label"},t("div",null,t("p",null,n.fields.title),t("span",null,n.fields.ID)),t("div",null,t("button",{onClick:()=>navigator.clipboard.writeText(String(n.fields.ID))},"Kopiera ID"),this.customer.at_hemfixarna?t("button",{onClick:()=>navigator.clipboard.writeText(`${T()}/partner/${this.customer.post_name}?id=${n.fields.ID}`)},"Kopiera URL"):t("button",{onClick:()=>this.selectedID=String(n.fields.ID)},"Ladda produkt"))))))))))))))))):t("div",null,t("form",{onSubmit:n=>{n.preventDefault();this.handleLogin()},style:{display:"flex",flexDirection:"column",gap:"1rem",maxWidth:"300px",margin:"auto",padding:"20px",border:"1px solid #ccc",borderRadius:"5px",gridColumn:"span 2"}},t("input",{type:"password",placeholder:"Lösenord"}),t("button",{type:"submit"},"Logga in"),this.loginError&&t("span",null,"Fel lösenord")))):t("h1",{style:{textAlign:"center",margin:"auto",padding:"20px",fontSize:"24px",fontWeight:"bold",color:"red"}},"No customer found")}static get watchers(){return{buttonBg:["debouncedFunction"],buttonColor:["debouncedFunction"]}}};X.style=Z;var Y=class extends Error{constructor(){super("Invalid swedish personal identity number")}};var q=(n,t)=>{const i=n.getTime()-t.getTime();return i<0?-1:i>0?1:i};var G=(n,t)=>{const i=q(n,t);const e=Math.abs(n.getFullYear()-t.getFullYear());n.setFullYear(n.getFullYear()-i*e);const s=q(n,t)===-i;const a=i*(e-+s);return a===0?0:a};var Q=n=>{let t=0;n+="";for(let i=0,e=n.length;i<e;i++){let e=parseInt(n[i]);e*=2-i%2;if(e>9){e-=9}t+=e}return Math.ceil(t/10)*10-t};var nn=(n,t,i)=>{t-=1;const e=new Date(n,t,i);return!(e.getFullYear()!==n||e.getMonth()!==t||e.getDate()!==i)};var tn=class{constructor(n,t){this._century="";this._fullYear="";this._year="";this._month="";this._day="";this._sep="";this._num="";this._check="";this.parse(n,{allowCoordinationNumber:true,allowInterimNumber:false,...t})}get century(){return this._century}get fullYear(){return this._fullYear}get year(){return this._year}get month(){return this._month}get day(){return this._day}get sep(){return this._sep}get num(){return this._num}get check(){return this._check}static parse(n,t){return new tn(n,t)}static valid(n,t){try{tn.parse(n,t);return true}catch(n){return false}}parse(n,t){if(n.length<10||n.length>13){throw new Y}const i=/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;const e=i.exec(n);if(!e){throw new Y}const s=e[1];const a=e[2];const r=e[3];const o=e[4];const l=e[5];const h=e[6];const c=e[7];if(typeof s==="undefined"||!s.length){const n=new Date;let t=0;if(l==="+"){this._sep="+";t=n.getFullYear()-100}else{this._sep="-";t=n.getFullYear()}this._century=(""+(t-(t-parseInt(a))%100)).substr(0,2)}else{this._century=s;if((new Date).getFullYear()-parseInt(s+a,10)<100){this._sep="-"}else{this._sep="+"}}this._year=a;this._fullYear=this._century+a;this._month=r;this._day=o;this._num=h;this._check=c;if(!this.valid()){throw new Y}if(!(t==null?void 0:t.allowCoordinationNumber)&&this.isCoordinationNumber()){throw new Y}if(!(t==null?void 0:t.allowInterimNumber)&&this.isInterimNumber()){throw new Y}}valid(){const n=Q(this.year+this.month+this.day+this.num.replace(/[TRSUWXJKLMN]/,"1"))===+this.check&&!!this.check;if(n&&nn(parseInt(this.century+this.year),+this.month,+this.day)){return n}return n&&nn(parseInt(this.century+this.year),+this.month,+this.day-60)}format(n=false){if(n){return`${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`}return`${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`}getAge(){const n=this.getDate();return G(new Date(Date.now()),n)}getDate(){let n=+this.day;if(this.isCoordinationNumber()){n-=60}const t=this.century+this.year+"-"+this.month+"-"+(n<10?"0"+n:n);return new Date(t)}isInterimNumber(){return/[TRSUWXJKLMN]/.test(this.num[0])}isCoordinationNumber(){return nn(parseInt(this.century+this.year),+this.month,+this.day-60)}isFemale(){return!this.isMale()}isMale(){const n=parseInt(this.num.substr(-1));return n%2===1}};var en=tn;function sn(n,t,i){return i={path:t,exports:{},require:function(n,t){return an()}},n(i,i.exports),i.exports}function an(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var rn=sn((function(n,t){Object.defineProperty(t,"__esModule",{value:true});t.utf8=void 0;t.utf8={encode:i,decode:e};function i(n){n=n.replace(/\r\n/g,"\n");var t="";for(var i=0;i<n.length;i++){var e=n.charCodeAt(i);if(e<128){t+=String.fromCharCode(e)}else if(e>127&&e<2048){t+=String.fromCharCode(e>>6|192);t+=String.fromCharCode(e&63|128)}else{t+=String.fromCharCode(e>>12|224);t+=String.fromCharCode(e>>6&63|128);t+=String.fromCharCode(e&63|128)}}return t}function e(n){var t="";var i=0;var e=0;var s=0;var a=0;while(i<n.length){e=n.charCodeAt(i);if(e<128){t+=String.fromCharCode(e);i++}else if(e>191&&e<224){s=n.charCodeAt(i+1);t+=String.fromCharCode((e&31)<<6|s&63);i+=2}else{s=n.charCodeAt(i+1);a=n.charCodeAt(i+2);t+=String.fromCharCode((e&15)<<12|(s&63)<<6|a&63);i+=3}}return t}}));var on=sn((function(n,t){Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;function i(n){var t=[];var i;var e;var a;var r;var o;var l;var m;var x;var g;var v=7;var b=12;var _=17;var w=22;var y=5;var k=9;var C=14;var $=20;var z=4;var j=11;var S=16;var I=23;var T=6;var O=10;var M=15;var D=21;var L=rn.utf8.encode(n);t=u(L);l=1732584193;m=4023233417;x=2562383102;g=271733878;for(i=0;i<t.length;i+=16){e=l;a=m;r=x;o=g;l=h(l,m,x,g,t[i+0],v,3614090360);g=h(g,l,m,x,t[i+1],b,3905402710);x=h(x,g,l,m,t[i+2],_,606105819);m=h(m,x,g,l,t[i+3],w,3250441966);l=h(l,m,x,g,t[i+4],v,4118548399);g=h(g,l,m,x,t[i+5],b,1200080426);x=h(x,g,l,m,t[i+6],_,2821735955);m=h(m,x,g,l,t[i+7],w,4249261313);l=h(l,m,x,g,t[i+8],v,1770035416);g=h(g,l,m,x,t[i+9],b,2336552879);x=h(x,g,l,m,t[i+10],_,4294925233);m=h(m,x,g,l,t[i+11],w,2304563134);l=h(l,m,x,g,t[i+12],v,1804603682);g=h(g,l,m,x,t[i+13],b,4254626195);x=h(x,g,l,m,t[i+14],_,2792965006);m=h(m,x,g,l,t[i+15],w,1236535329);l=c(l,m,x,g,t[i+1],y,4129170786);g=c(g,l,m,x,t[i+6],k,3225465664);x=c(x,g,l,m,t[i+11],C,643717713);m=c(m,x,g,l,t[i+0],$,3921069994);l=c(l,m,x,g,t[i+5],y,3593408605);g=c(g,l,m,x,t[i+10],k,38016083);x=c(x,g,l,m,t[i+15],C,3634488961);m=c(m,x,g,l,t[i+4],$,3889429448);l=c(l,m,x,g,t[i+9],y,568446438);g=c(g,l,m,x,t[i+14],k,3275163606);x=c(x,g,l,m,t[i+3],C,4107603335);m=c(m,x,g,l,t[i+8],$,1163531501);l=c(l,m,x,g,t[i+13],y,2850285829);g=c(g,l,m,x,t[i+2],k,4243563512);x=c(x,g,l,m,t[i+7],C,1735328473);m=c(m,x,g,l,t[i+12],$,2368359562);l=p(l,m,x,g,t[i+5],z,4294588738);g=p(g,l,m,x,t[i+8],j,2272392833);x=p(x,g,l,m,t[i+11],S,1839030562);m=p(m,x,g,l,t[i+14],I,4259657740);l=p(l,m,x,g,t[i+1],z,2763975236);g=p(g,l,m,x,t[i+4],j,1272893353);x=p(x,g,l,m,t[i+7],S,4139469664);m=p(m,x,g,l,t[i+10],I,3200236656);l=p(l,m,x,g,t[i+13],z,681279174);g=p(g,l,m,x,t[i+0],j,3936430074);x=p(x,g,l,m,t[i+3],S,3572445317);m=p(m,x,g,l,t[i+6],I,76029189);l=p(l,m,x,g,t[i+9],z,3654602809);g=p(g,l,m,x,t[i+12],j,3873151461);x=p(x,g,l,m,t[i+15],S,530742520);m=p(m,x,g,l,t[i+2],I,3299628645);l=d(l,m,x,g,t[i+0],T,4096336452);g=d(g,l,m,x,t[i+7],O,1126891415);x=d(x,g,l,m,t[i+14],M,2878612391);m=d(m,x,g,l,t[i+5],D,4237533241);l=d(l,m,x,g,t[i+12],T,1700485571);g=d(g,l,m,x,t[i+3],O,2399980690);x=d(x,g,l,m,t[i+10],M,4293915773);m=d(m,x,g,l,t[i+1],D,2240044497);l=d(l,m,x,g,t[i+8],T,1873313359);g=d(g,l,m,x,t[i+15],O,4264355552);x=d(x,g,l,m,t[i+6],M,2734768916);m=d(m,x,g,l,t[i+13],D,1309151649);l=d(l,m,x,g,t[i+4],T,4149444226);g=d(g,l,m,x,t[i+11],O,3174756917);x=d(x,g,l,m,t[i+2],M,718787259);m=d(m,x,g,l,t[i+9],D,3951481745);l=s(l,e);m=s(m,a);x=s(x,r);g=s(g,o)}return f(l)+f(m)+f(x)+f(g)}t.generate=i;function e(n,t){return n<<t|n>>>32-t}function s(n,t){var i;var e;var s;var a;var r;s=n&2147483648;a=t&2147483648;i=n&1073741824;e=t&1073741824;r=(n&1073741823)+(t&1073741823);if(i&e){return r^2147483648^s^a}if(i|e){if(r&1073741824){return r^3221225472^s^a}else{return r^1073741824^s^a}}else{return r^s^a}}function a(n,t,i){return n&t|~n&i}function r(n,t,i){return n&i|t&~i}function o(n,t,i){return n^t^i}function l(n,t,i){return t^(n|~i)}function h(n,t,i,r,o,l,h){n=s(n,s(s(a(t,i,r),o),h));return s(e(n,l),t)}function c(n,t,i,a,o,l,h){n=s(n,s(s(r(t,i,a),o),h));return s(e(n,l),t)}function p(n,t,i,a,r,l,h){n=s(n,s(s(o(t,i,a),r),h));return s(e(n,l),t)}function d(n,t,i,a,r,o,h){n=s(n,s(s(l(t,i,a),r),h));return s(e(n,o),t)}function u(n){var t;var i=n.length;var e=i+8;var s=(e-e%64)/64;var a=(s+1)*16;var r=Array(a-1);var o=0;var l=0;while(l<i){t=(l-l%4)/4;o=l%4*8;r[t]=r[t]|n.charCodeAt(l)<<o;l++}t=(l-l%4)/4;o=l%4*8;r[t]=r[t]|128<<o;r[a-2]=i<<3;r[a-1]=i>>>29;return r}function f(n){var t="";var i="";var e;var s;for(s=0;s<=3;s++){e=n>>>s*8&255;i="0"+e.toString(16);t=t+i.substr(i.length-2,2)}return t}}));var ln=sn((function(n,t){Object.defineProperty(t,"__esModule",{value:true});t.MD5=t.generate=void 0;var i=on;Object.defineProperty(t,"generate",{enumerable:true,get:function(){return i.generate}});t.MD5={generate:on.generate}}));const hn=async n=>{const t=await fetch(M(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:n,hash:ln.MD5.generate(String.fromCharCode(83,101,67,82,101,116)+n)})});const i=await t.json();return i};const cn=class{constructor(i){n(this,i);this.handleChangeEmail=n=>{this.emailError=null;this.email=n.target.value};this.handleChangePhone=n=>{this.phoneError=null;this.phone=n.target.value};this.handleChangessn=n=>{this.ssnError=null;this.ssn=n.target.value};this.handleSubmit=async n=>{n.preventDefault();const t=new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);const i=t.test(this.email);if(!i){this.emailError="Ange en giltig e-postadress"}const e=/^[\d\s()+-]{6,}$/.test(this.phone);if(!e){this.phoneError="Ange ett giltigt telefonnummer"}const s=en.valid(this.ssn);if(!s){this.ssnError="Ange ett giltigt personnummer"}else if(s){const n=en.parse(this.ssn).format(true);this.ssn=[n.slice(0,8),"-",n.slice(8)].join("")}if(i&&e&&s){try{const n=await hn(this.ssn);if(n){a.creditSafeUser=n;a.checkoutStep=2;a.user=Object.assign(Object.assign({},n),{email:this.email,phone:this.phone,ssn:this.ssn})}else{this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer"}}catch(n){this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer";console.log(n)}finally{const n=this.el.closest(".hemfixarna_content");h(n)}}};this.render=()=>t("form",{class:"mb-2",onSubmit:n=>this.handleSubmit(n)},t("div",null,t("input",{class:`${this.email.length?"input_active":""}`,onChange:n=>this.handleChangeEmail(n),type:"email",name:"email",value:this.email}),t("label",{htmlFor:"email"},"E-post ")),this.emailError&&t("span",null,this.emailError),t("div",null,t("input",{class:`${this.phone.length?"input_active":""}`,onChange:n=>this.handleChangePhone(n),type:"tel",name:"phone",value:this.phone}),t("label",{htmlFor:"phone"},"Mobiltelefon ")),this.phoneError&&t("span",null,this.phoneError),t("div",null,t("input",{class:`${this.ssn.length?"input_active":""}`,onChange:n=>this.handleChangessn(n),type:"tel",name:"ssn",value:this.ssn}),t("label",{htmlFor:"phone"},"Personnummer*")),this.ssnError&&t("span",null,this.ssnError),t("input",{type:"submit",value:"Fortsätt*"}),t("p",null,"*Vi hämtar din adress"));this.email="";this.emailError=null;this.phone="";this.phoneError=null;this.ssn="";this.ssnError=null}componentWillLoad(){if(a.user){this.email=a.user.email;this.phone=a.user.phone;this.ssn=a.user.ssn}}get el(){return i(this)}};const pn=class{constructor(t){n(this,t);this.logo=s(`./assets/hemfixarna.svg`)}render(){var n,i;const r=s(`./assets/checked.svg`);return t("div",{class:"hemfixarna_info"},a.step<5?t(e,null,t("h2",null,a.customer.info_title),t("p",null,a.customer.info_text)):t("h2",null,a.customer.checkout_title),t("ul",{class:"hemfixarna_features"},a.step<5?t(e,null,((n=a.customer.trust_badges)===null||n===void 0?void 0:n.length)?t(e,null,a.customer.trust_badges.map((n=>t("li",{key:n.text},t("img",{src:r,alt:"checked"}),t("p",null,n.text))))):t(e,null,a.options.trust.map((n=>t("li",{key:n.trust_badge},t("img",{src:r,alt:"checked"}),t("p",null,n.trust_badge)))))):t(e,null,(i=a.customer.checkout_trust_badges)===null||i===void 0?void 0:i.map((n=>t("li",{key:n.text},t("img",{src:r,alt:"checked"}),t("p",null,n.text)))))),t("img",{src:this.logo,width:200,alt:"hemfixarna"}),t("a",{class:"hemfixarna_product--link",target:"_blank",href:a.options.link.url},a.options.link.title))}};const dn=':host .invoice{gap:16px;display:grid}:host .invoice form>span{text-align:center;padding:16px 0}:host .invoice img{right:unset;left:unset;position:initial;transform:none}:host .invoice label{cursor:pointer;font-size:14px;display:flex;align-items:flex-start;padding:16px 0}:host .invoice label input{margin:0 5px 0 0;accent-color:#ea662c}:host .invoice-preview{display:flex;gap:4px}:host .invoice-preview div{position:relative}:host .invoice-preview div button{position:absolute;top:0;right:0;padding:0}:host .invoice-preview div button img{width:24px;height:24px}:host .invoice-preview div>img{width:100px;height:80px;object-fit:cover}:host .invoice input[type=email],:host .invoice input[type=tel],:host .invoice textarea{padding:16px;border:1px solid #fcd9c9;font-size:16px}:host .invoice textarea{resize:none;height:200px;font-family:"Inter", sans-serif}:host .invoice div:has(>input[type=file]){display:flex;align-items:center;justify-content:center;cursor:pointer;background:#fff;border:1px solid #fcd9c9;padding:32px 16px;gap:16px}:host .invoice div:has(>input[type=file]) span{color:#000;font-size:12px}:host .invoice input[type=file]{display:none}';const un=`${T()}/wp-json/headless`;const fn=class{constructor(t){n(this,t);this.formError=null;this.displayImages=[];this.formImages=[];this.formState="initial"}isValidEmail(n){const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return t.test(n)}componentDidRender(){const n=this.el.querySelector("form");if(n){n.addEventListener("input",(()=>{this.formError=null}))}}disconnectedCallback(){const n=this.el.querySelector("form");if(n){n.removeEventListener("input",(()=>{this.formError=null}))}}async submit(n){var t;n.preventDefault();this.formState="loading";this.formError=null;const i=n.currentTarget.elements;const e={description:i.descriptionInput.value.length?i.descriptionInput.value:null,email:i.emailInput.value.length?i.emailInput.value:null,tel:i.telInput.value.length?i.telInput.value:null,terms:(t=i.termsInput)===null||t===void 0?void 0:t.checked};if(!e.description){this.formError="Vänligen fyll i formulärtexten";this.formState="initial";return}if(!e.email||!this.isValidEmail(e.email)){this.formError="Vänligen ange en giltig e-postadress";this.formState="initial";return}if(!e.tel){this.formError="Vänligen ange ditt telefonnummer";this.formState="initial";return}if(a.selectedProduct.terms_show_checkbox&&!e.terms){this.formError="Vänligen acceptera villkoren";this.formState="initial";return}const s=new FormData;s.append("text",e.description);s.append("email",e.email);s.append("phone",e.tel);s.append("customer",a.business);this.formImages.forEach((n=>{s.append("images[]",n)}));s.append("product",JSON.stringify({title:a.selectedProduct.title,amount:1,has_rut:a.selectedProduct.rut,has_rot:a.selectedProduct.rot,has_green:a.selectedProduct.green,ID:a.selectedProduct.ID,parts:[]}));try{const n=await fetch(`${un}/saveinvoiceproduct`,{method:"POST",body:s});const{response:t}=await n.json();if(t.code===200){a.checkoutInvoice=true;a.step=6}else{this.formError="Vi kan inte ta emot din beställning just nu";this.formState="initial"}}catch(n){this.formError="Vi kan inte ta emot din beställning just nu";this.formState="initial"}}handleImageDrop(n){n.preventDefault();const t=n.dataTransfer.files;for(let n=0;n<t.length;n++){const i=t[n];if(i.type.startsWith("image/")){const n=new FileReader;n.onload=()=>{this.displayImages=[...this.displayImages,n.result];this.formImages=[...this.formImages,i]};n.readAsDataURL(i)}}}handleFileInputChange(n){n.preventDefault();const t=n.target.files;for(let n=0;n<t.length;n++){const i=t[n];if(i.type.startsWith("image/")){const n=new FileReader;n.onload=()=>{this.displayImages=[...this.displayImages,n.result];this.formImages=[...this.formImages,i]};n.readAsDataURL(i)}}}handleImageClick(){this.el.querySelector(".hemfixarna-file-upload").click()}preventDragOver(n){n.preventDefault()}removeImage(n){this.displayImages=this.displayImages.filter(((t,i)=>i!==n));this.formImages=this.formImages.filter(((t,i)=>i!==n))}render(){const n=s(`./assets/drag-drop.svg`);return t("div",{class:"invoice"},t("p",null,a.selectedProduct.invoice_description),t("form",{onSubmit:n=>this.submit(n)},t("textarea",{name:"descriptionInput",placeholder:"Beskriv ditt ärende"}),t("div",{role:"button","aria-label":"upload image",onDragOver:n=>this.preventDragOver(n),onDrop:n=>this.handleImageDrop(n),onClick:()=>this.handleImageClick()},t("img",{src:n,alt:"hemfixarna_logo",width:24}),t("div",null,t("p",null,"Bifoga ev bilder"),t("span",null,"(dra bilder hit)")),t("input",{onChange:n=>this.handleFileInputChange(n),class:"hemfixarna-file-upload",accept:"image/*",type:"file",multiple:true,name:"fileInput"})),t("div",{class:"invoice-preview"},this.displayImages.map(((n,i)=>t("div",{key:i},t("img",{src:n,alt:"uploaded image"}),t("button",{onClick:()=>this.removeImage(i)},t("img",{src:s(`./assets/close.svg`),alt:"close"})))))),t("input",{placeholder:"E-post",type:"email",name:"emailInput"}),t("input",{placeholder:"Telefonnummer",type:"tel",name:"telInput"}),a.selectedProduct.terms_show_checkbox?t("label",null,t("input",{type:"checkbox",name:"termsInput"}),a.selectedProduct.terms):null,this.formError?t("span",null,this.formError):null,t("input",{type:"submit",value:this.formState==="loading"?"Skickar":"Kontakta mig"})))}get el(){return i(this)}};fn.style=dn;const mn=class{constructor(i){n(this,i);this.render=()=>t("div",{style:{background:`url(${a.options.thank_you_image})`},class:"hemfixarna_order"},t("div",null),t("div",null,t("h2",null,a.checkoutInvoice?"Tack för din förfrågan":"Tack för din bokning"),a.checkoutInvoice?t("p",null,"Vi återkommer inom kort till dig på angivet telefonnummer eller epost"):null,a.checkoutInvoice?t("div",null):t("hemfixarna-orderrows",{cart:false}),t("span",{onClick:()=>this.resetShop()},t("button",null,"Gör en ny bokning")),t("hemfixarna-info",null)))}resetShop(){a.step=1;a.cart=[];a.selectedCategory=null;a.selectedService=null;a.selectedProduct=null;a.maleri=null;a.checkoutStep=1}disconnectedCallback(){this.resetShop()}};const xn=class{constructor(t){n(this,t);this.cart=true}goToProduct(n){const t=a.customer.categories.map((n=>n.show_products?n.products:n.sub_categories?n.sub_categories.map((n=>n.products)):[])).flat().flat();const i=t.find((t=>t&&t.fields.ID===n));if(i){a.selectedProduct=i.fields;a.step=4}}openRot(){a.modal={title:a.rotOptions.rot_start_fee_heading,text:[a.rotOptions.rot_start_fee_text,a.rotOptions.rot_start_fee_text_secondary]}}openRut(){a.modal={title:a.rutOptions.rut_start_fee_heading,text:[a.rutOptions.rut_start_fee_text,a.rutOptions.rut_start_fee_text_secondary]}}openGreen(){a.modal={title:a.greenOptions.green_start_fee_heading,text:[a.greenOptions.green_start_fee_text,a.greenOptions.green_start_fee_text_secondary]}}getDiscountedInfo(n){if(n.rut&&a.rut){return" (efter RUT-avdrag)"}else if(n.rot&&a.rot){return" (efter ROT-avdrag)"}else if(n.green&&a.green){return" (efter Grön teknik avdrag)"}else{return""}}render(){const n=s(`./assets/info.svg`);return t(e,null,t("ul",{class:"hemfixarna_cart--items"},a.cart.map((n=>{var i;return t("li",{class:"hemfixarna_cart--item"},t("div",null,t("div",null,n.icon&&t("img",{width:30,src:(i=n.icon.url)!==null&&i!==void 0?i:n.icon,alt:n.name}),t("p",null,t("strong",null,n.amount,"x "),n.name)),this.cart&&t("button",{onClick:()=>this.goToProduct(n.id)},"Ändra")),t("p",null,t("strong",null,f(n,n.price,n.amount),"kr"),t("span",null,this.getDiscountedInfo(n))),n.parts.length>0&&t("ul",null,n.parts.map((i=>t("li",null,t("p",null,t("strong",null,i.amount,"x "),i.name),t("p",null,t("strong",null,x(i,n,i.amount),"kr")))))))}))),t("div",{class:"hemfixarna_cart--additional"},t("div",null,g().rot>0&&t("div",{class:"hemfixarna_cart--startfee"},t("p",null,t("strong",{onClick:()=>this.openRot()},a.rotOptions.rot_start_fee_heading,t("img",{height:16,src:n,alt:"info monteringsavgift"}))),t("p",null,g().rot,"kr")),g().rut>0&&t("div",{class:"hemfixarna_cart--startfee"},t("p",null,t("strong",{onClick:()=>this.openRut()},a.rutOptions.rut_start_fee_heading,t("img",{height:16,src:n,alt:"info monteringsavgift"}))),t("p",null,g().rut,"kr")),g().green>0&&t("div",{class:"hemfixarna_cart--startfee"},t("p",null,t("strong",{onClick:()=>this.openGreen()},a.greenOptions.green_start_fee_heading,t("img",{height:16,src:n,alt:"info monteringsavgift"}))),t("p",null,g().green,"kr"))),a.cart.find((n=>n.rot))&&t("div",{class:"hemfixarna_cart--rutrot"},t("div",null,this.cart&&t("label",{class:"switch"},t("input",{checked:a.rot,onChange:()=>a.rot=!a.rot,type:"checkbox"}),t("span",{class:"slider"})),t("p",null,"ROT-avdrag")),t("p",null,"(-",a.rot?b():0,"kr)")),a.cart.find((n=>n.rut))&&t("div",{class:"hemfixarna_cart--rutrot"},t("div",null,t("label",{class:"switch"},t("input",{onChange:()=>a.rut=!a.rut,checked:a.rut,type:"checkbox"}),t("span",{class:"slider"})),t("p",null,"RUT-avdrag")),t("p",null,"(-",a.rut?_():0,"kr)")),a.cart.find((n=>n.green))&&t("div",{class:"hemfixarna_cart--rutrot"},t("div",null,t("label",{class:"switch"},t("input",{onChange:()=>a.green=!a.green,checked:a.green,type:"checkbox"}),t("span",{class:"slider"})),t("p",null,"Grön teknik avdrag")),t("p",null,"(-",a.green?w():0,"kr)"))),t("div",{class:"hemfixarna_cart--price"},t("h2",null,"Totalbelopp: "),t("h2",null,y(),"kr")))}};const gn="";const vn=class{constructor(t){n(this,t);this.amount=0;this.hideDescription=true}addProduct(){const n=a.cart.find((n=>n.id===a.selectedProduct.ID));if(n){n.amount++;a.cart=[...a.cart]}else{a.cart=[...a.cart,{id:a.selectedProduct.ID,rut:a.selectedProduct.rut,rot:a.selectedProduct.rot,green:a.selectedProduct.green,amount:1,parts:[],price:a.selectedProduct.price,name:a.selectedProduct.title,start_fee:!a.selectedProduct.hide_start_fee,terms_checkout:a.selectedProduct.terms_checkout,icon:a.selectedProduct.icon}]}}removeProduct(){const n=a.cart.find((n=>n.id===a.selectedProduct.ID));if(n&&n.amount>1){n.amount--;a.cart=[...a.cart]}else{a.cart=a.cart.filter((n=>n.id!==a.selectedProduct.ID))}}addPart(n){var t;const i=a.cart.find((n=>n.id===a.selectedProduct.ID));if(i){const e=i.parts.find((t=>t.id===n.ID));if(e){e.amount++;i.parts=[...i.parts]}else{i.parts=[...i.parts,{id:n.ID,amount:1,price:n.price,name:(t=n.title)!==null&&t!==void 0?t:n.title}]}a.cart=[...a.cart.filter((n=>n.id!==i.id)),i]}}removePart(n){const t=a.cart.find((n=>n.id===a.selectedProduct.ID));if(t){const i=t.parts.find((t=>t.id===n.ID));if(i&&i.amount>1){i.amount--;t.parts=[...t.parts]}else{t.parts=t.parts.filter((t=>t.id!==n.ID))}a.cart=[...a.cart.filter((n=>n.id!==t.id)),t]}}goToCart(){const n=a.cart.find((n=>n.id===a.selectedProduct.ID));if(n){a.step=5;const n=this.el.closest(".hemfixarna_content");h(n)}}getAmount(){var n;return((n=a.cart.find((n=>n.id===a.selectedProduct.ID)))===null||n===void 0?void 0:n.amount)||0}getPartAmount(n){var t;const i=a.cart.find((n=>n.id===a.selectedProduct.ID));return((t=i===null||i===void 0?void 0:i.parts.find((t=>t.id===n)))===null||t===void 0?void 0:t.amount)||0}getTotalPrice(){let n=0;const t=a.cart.find((n=>n.id===a.selectedProduct.ID));if(t){const i=t.parts.reduce(((n,t)=>{const i=a.selectedProduct.parts.find((n=>n.ID===t.id));if(i){return n+i.price*t.amount}return n}),0);n=a.selectedProduct.price*t.amount+i}else{n=a.selectedProduct.price}return f(a.selectedProduct,n)}componentDidRender(){const n=document.createElement("link");n.setAttribute("rel","stylesheet");n.setAttribute("href","https://painting-frontend.vercel.app/static/css/main.css");const t=document.createElement("link");t.setAttribute("rel","stylesheet");t.setAttribute("href","https://painting-frontend.vercel.app/fonts.css");const i=()=>{const e=this.el.getElementsByTagName("hemfixare-calculator");if(e.length>0&&e[0].shadowRoot!==null){e[0].shadowRoot.appendChild(n);e[0].shadowRoot.appendChild(t)}else{setTimeout(i,1)}};i()}render(){var n,i,o;const l=s(`./assets/checked.svg`);const h=s(`./assets/plus.svg`);const c=s(`./assets/minus.svg`);if(a.maleri){return t("div",{class:"hemfixarna_painting"},t("script",{type:"text/javascript",src:["localhost","vercel"].some((n=>window.location.href.includes(n)))?"https://painting-dev.vercel.app/static/js/main.js":"https://painting-frontend.vercel.app/static/js/main.js",defer:true,async:true}),t("hemfixare-calculator",{title:a.options.maleri_title,subtitle:a.options.maleri_text,modal:"true",customer:a.business===r.string?"string":a.business}))}return a.selectedProduct?t("div",{class:"hemfixarna_product"},t("div",{class:"hemfixarna_product--top"},a.selectedProduct.icon&&t("img",{width:80,src:(n=a.selectedProduct.icon.url)!==null&&n!==void 0?n:a.selectedProduct.icon,alt:a.selectedProduct.title}),t("div",null,t("h1",null,a.selectedProduct.title),!a.selectedProduct.invoice?t("h2",null,f(a.selectedProduct)," kr/st"):t("h2",null,a.selectedProduct.invoice_price))),t("div",{class:"hemfixarna_product--grid"},t("div",{class:"hemfixarna_product--left"},((i=a.selectedProduct.list)===null||i===void 0?void 0:i.length)&&t("ul",{class:"hemfixarna_features"},a.selectedProduct.list.map((n=>t("li",{key:n.bullet},t("img",{src:l,alt:"checked"}),t("p",null,n.bullet))))),a.selectedProduct.description&&t("p",{onClick:()=>this.hideDescription=false,class:`hemfixarna_description ${this.hideDescription?"hemfixarna_description--hidden":""}`,innerHTML:a.selectedProduct.description})),t("div",{class:"hemfixarna_product--right"},a.selectedProduct.invoice?t("hemfixarna-invoice",null):t(e,null,t("ul",null,t("li",{class:"hemfixarna_product--item"},t("div",null,t("p",null,a.selectedProduct.title),t("p",{class:"hemfixarna_product--price"},f(a.selectedProduct),"kr/st")),t("div",{class:"hemfixarna_counter"},t("img",{class:`${this.getAmount()===0?"disabled":""}`,src:c,onClick:()=>this.removeProduct()}),t("span",null,this.getAmount()),t("img",{src:h,onClick:()=>this.addProduct()}))),((o=a.selectedProduct.parts)===null||o===void 0?void 0:o.length)&&a.selectedProduct.parts.map((n=>{var i;return t("li",{class:"hemfixarna_part"},t("div",null,t("p",null,(i=n.title)!==null&&i!==void 0?i:n.title),t("p",{class:"hemfixarna_product--price"},x(n,a.selectedProduct),"kr/st")),t("div",{class:"hemfixarna_counter"},t("img",{class:`${this.getPartAmount(n.ID)===0?"disabled":""}`,src:c,onClick:()=>this.removePart(n)}),t("span",null,this.getPartAmount(n.ID)),t("img",{class:`${this.getAmount()===0?"disabled":""}`,src:h,onClick:()=>this.addPart(n)})))}))),t("h4",{class:"hemfixarna_product--total"},"Totalt ",this.getTotalPrice()," kr"),t("button",{onClick:()=>this.goToCart(),class:`hemfixarna_buy ${this.getAmount()===0?"disabled":""}`},"Fortsätt")),!a.selectedProduct.hide_start_fee&&(a.selectedProduct.rot||a.selectedProduct.rut)&&a.rutOptions&&a.rotOptions&&t("p",{class:"hemfixarna_terms"},t("strong",null,a.selectedProduct.rot?a.rotOptions.rot_start_fee_heading:a.rutOptions.rut_start_fee_heading),t("br",null),t("span",{innerHTML:a.selectedProduct.rot?a.rotOptions.rot_start_fee_text:a.rutOptions.rut_start_fee_text})),a.options&&t("hemfixarna-info",null)))):null}get el(){return i(this)}};vn.style=gn;const bn=class{constructor(t){n(this,t);this.tree=undefined;this.slug=undefined}isMainCategory(n){return n.show_products!==undefined}handleMaleriClick(){a.step=4;a.maleri=true}render(){var n;const i=s("./assets/gubbe-pensel.svg");return a.customer?t("div",null,t("h2",null,a.selectedCustomerCategory?a.selectedCustomerCategory.name:"Alla tjänster"),t("div",{class:"hemfixarna_categories--wrapper"},t("ul",{class:"hemfixarna_categories"},((n=a.selectedCustomerCategory)===null||n===void 0?void 0:n.add_painting)?t("button",{onClick:()=>this.handleMaleriClick(),class:"hemfixarna_maleribox"},t("img",{height:64,src:i,alt:"Måleri Logotyp"}),t("p",null,"Beräkna fast pris på måleri & tapetsering här")):null,a.selectedCustomerCategory?this.isMainCategory(a.selectedCustomerCategory)&&a.selectedCustomerCategory.sub_categories&&!a.selectedCustomerCategory.show_products?a.selectedCustomerCategory.sub_categories.map((n=>t("hemfixarna-box",{category:n}))):a.selectedCustomerCategory.products?a.selectedCustomerCategory.products.map((n=>t("hemfixarna-box",{category:n.fields}))):null:a.customer.categories.map((n=>t("hemfixarna-box",{category:n})))),t("hemfixarna-info",null))):t("div",null,t("h2",null,"Alla tjänster"),t("div",{class:"hemfixarna_categories--wrapper"},t("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.sort(((n,t)=>n.name<t.name?-1:1)).map((n=>{var i;return t("hemfixarna-box",{post:n,icon:(i=n.icon.url)!==null&&i!==void 0?i:n.icon,postTitle:n.name})}))),t("hemfixarna-info",null)))}};export{c as hemfixarna_address,$ as hemfixarna_box,z as hemfixarna_breadcrumbs,j as hemfixarna_cart,B as hemfixarna_checkout,U as hemfixarna_component,J as hemfixarna_contact,X as hemfixarna_demo,cn as hemfixarna_getuser,pn as hemfixarna_info,fn as hemfixarna_invoice,mn as hemfixarna_order,xn as hemfixarna_orderrows,vn as hemfixarna_product,bn as hemfixarna_start};
2
- //# sourceMappingURL=p-a9845efc.entry.js.map