hemfixarna-web-components 1.3.8 → 1.4.0
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.
- package/dist/cjs/hemfixarna-address_24.cjs.entry.js +69 -17
- package/dist/cjs/hemfixarna-address_24.cjs.entry.js.map +1 -1
- package/dist/collection/assets/gubbe-pensel.svg +1 -0
- package/dist/collection/assets/pensel.svg +1 -0
- package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js +2 -0
- package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +21 -11
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna.css +57 -34
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js +8 -3
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -1
- package/dist/collection/components/hemfixarna-order/hemfixarna-order.js +1 -0
- package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -1
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.css +0 -0
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js +37 -2
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -1
- package/dist/collection/components/hemfixarna-start/hemfixarna-start.js +8 -2
- package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +1 -1
- package/dist/collection/store/index.js +1 -0
- package/dist/collection/store/index.js.map +1 -1
- package/dist/collection/types/index.js.map +1 -1
- package/dist/esm/hemfixarna-address_24.entry.js +69 -17
- package/dist/esm/hemfixarna-address_24.entry.js.map +1 -1
- package/dist/hemfixarna-components/assets/gubbe-pensel.svg +1 -0
- package/dist/hemfixarna-components/assets/pensel.svg +1 -0
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
- package/dist/hemfixarna-components/p-891367c9.entry.js +2 -0
- package/dist/types/components/hemfixarna-demo/hemfixarna-demo.d.ts +1 -0
- package/dist/types/components/hemfixarna-product/hemfixarna-product.d.ts +1 -0
- package/dist/types/components/hemfixarna-start/hemfixarna-start.d.ts +1 -0
- package/dist/types/store/index.d.ts +1 -0
- package/dist/types/types/index.d.ts +8 -4
- package/package.json +3 -2
- package/dist/hemfixarna-components/p-ffa06bf9.entry.js +0 -2
- /package/dist/hemfixarna-components/{p-ffa06bf9.entry.js.map → p-891367c9.entry.js.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hemfixarna-order.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-order/hemfixarna-order.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,MAAM,aAAa,CAAC;AAOhC,MAAM,OAAO,eAAe;;
|
1
|
+
{"version":3,"file":"hemfixarna-order.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-order/hemfixarna-order.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,MAAM,aAAa,CAAC;AAOhC,MAAM,OAAO,eAAe;;IAiB1B,WAAM,GAAG,GAAG,EAAE;MACZ,OAAO,CACL,WAAK,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,eAAe,GAAG,EAAE,EAAE,KAAK,EAAC,kBAAkB;QAC3F,cAAW;QACX;UACE,cAAK,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,sBAAsB,CAAM;UACnF,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,+FAA4E,CAAC,CAAC,CAAC,IAAI;UAC3G,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,cAAW,CAAC,CAAC,CAAC,4BAAsB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAyB;UAClH,YAAM,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE;YACnC,2CAAkC,CAC7B;UACP,uBACE,IAAI,EAAE;cACJ,EAAE,WAAW,EAAE,6DAA6D,EAAE;cAC9E,EAAE,WAAW,EAAE,iEAAiE,EAAE;aACnF,GACD,CACE,CACF,CACP,CAAC;IACJ,CAAC,CAAC;;;EAlCF,SAAS;IACP,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;IAChB,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;EACzB,CAAC;EAED,oBAAoB;IAClB,IAAI,CAAC,SAAS,EAAE,CAAC;EACnB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAuBF","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category } from '../../types';\n\n@Component({\n tag: 'hemfixarna-order',\n shadow: false,\n})\nexport class HemfixarnaOrder {\n @Prop() tree: Category;\n\n resetShop() {\n state.step = 1;\n state.cart = [];\n state.selectedCategory = null;\n state.selectedService = null;\n state.selectedProduct = null;\n state.maleri = null;\n state.checkoutStep = 1;\n }\n\n disconnectedCallback() {\n this.resetShop();\n }\n\n render = () => {\n return (\n <div style={{ background: `url(${state.options.thank_you_image})` }} class=\"hemfixarna_order\">\n <div></div>\n <div>\n <h2>{state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'}</h2>\n {state.checkoutInvoice ? <p>Vi återkommer inom kort till dig på angivet telefonnummer eller epost</p> : null}\n {state.checkoutInvoice ? <div></div> : <hemfixarna-orderrows tree={this.tree} cart={false}></hemfixarna-orderrows>}\n <span onClick={() => this.resetShop()}>\n <button>Gör en ny bokning</button>\n </span>\n <hemfixarna-info\n list={[\n { trust_badge: 'Du kommer bli kontaktad av en Hemfixare för bokning av tid.' },\n { trust_badge: 'När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag.' },\n ]}\n />\n </div>\n </div>\n );\n };\n}\n"]}
|
File without changes
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Fragment, getAssetPath, h } from '@stencil/core';
|
2
2
|
import state from '../../store';
|
3
|
+
import { Business } from '../../types';
|
3
4
|
import { getPartPrice, getProductPrice } from '../../utils/calc';
|
4
5
|
import { scrollToTop } from '../../utils/scroll';
|
5
6
|
export class HemfixarnaProduct {
|
@@ -106,18 +107,52 @@ export class HemfixarnaProduct {
|
|
106
107
|
}
|
107
108
|
return getProductPrice(state.selectedProduct, price);
|
108
109
|
}
|
110
|
+
componentDidRender() {
|
111
|
+
const linkElem = document.createElement('link');
|
112
|
+
linkElem.setAttribute('rel', 'stylesheet');
|
113
|
+
linkElem.setAttribute('href', 'https://painting-frontend.vercel.app/static/css/main.css');
|
114
|
+
const fonts = document.createElement('link');
|
115
|
+
fonts.setAttribute('rel', 'stylesheet');
|
116
|
+
fonts.setAttribute('href', 'https://painting-frontend.vercel.app/fonts.css');
|
117
|
+
const checkAndInjectCSS = () => {
|
118
|
+
const parents = this.el.getElementsByTagName('hemfixare-calculator');
|
119
|
+
if (parents.length > 0 && parents[0].shadowRoot !== null) {
|
120
|
+
parents[0].shadowRoot.appendChild(linkElem);
|
121
|
+
parents[0].shadowRoot.appendChild(fonts);
|
122
|
+
}
|
123
|
+
else {
|
124
|
+
setTimeout(checkAndInjectCSS, 1);
|
125
|
+
}
|
126
|
+
};
|
127
|
+
checkAndInjectCSS();
|
128
|
+
}
|
109
129
|
render() {
|
110
130
|
var _a, _b, _c;
|
111
131
|
const checked = getAssetPath(`./assets/checked.svg`);
|
112
132
|
const plus = getAssetPath(`./assets/plus.svg`);
|
113
133
|
const minus = getAssetPath(`./assets/minus.svg`);
|
114
|
-
|
134
|
+
if (state.maleri) {
|
135
|
+
return (h("div", { class: "hemfixarna_painting" }, h("script", { type: "text/javascript", src: ['localhost', 'vercel'].some(v => window.location.href.includes(v))
|
136
|
+
? 'https://painting-dev.vercel.app/static/js/main.js'
|
137
|
+
: 'https://painting-frontend.vercel.app/static/js/main.js', defer: true, async: true }), h("hemfixare-calculator", { title: state.options.maleri_title, subtitle: state.options.maleri_text, modal: "true", customer: state.business === Business.string ? 'string' : state.business })));
|
138
|
+
}
|
139
|
+
return state.selectedProduct ? (h("div", { class: "hemfixarna_product" }, h("div", { class: "hemfixarna_product--top" }, state.selectedProduct.icon && (h("img", { width: 80, src: (_a = state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : state.selectedProduct.icon, alt: state.selectedProduct.post_title })), h("div", null, h("h1", null, state.selectedProduct.post_title), !state.selectedProduct.invoice ? h("h2", null, getProductPrice(state.selectedProduct), " kr/st") : h("h2", null, state.selectedProduct.invoice_price))), h("div", { class: "hemfixarna_product--grid" }, h("div", { class: "hemfixarna_product--left" }, ((_b = state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (h("ul", { class: "hemfixarna_features" }, state.selectedProduct.list.map(l => (h("li", { key: l.bullet }, h("img", { src: checked, alt: "checked" }), h("p", null, l.bullet)))))), state.selectedProduct.description && (h("p", { onClick: () => (this.hideDescription = false), class: `hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`, innerHTML: state.selectedProduct.description }))), h("div", { class: "hemfixarna_product--right" }, state.selectedProduct.invoice ? (h("hemfixarna-invoice", null)) : (h(Fragment, null, h("ul", null, h("li", { class: "hemfixarna_product--item" }, h("div", null, h("p", null, "Antal ", state.selectedProduct.post_title), h("p", { class: "hemfixarna_product--price" }, getProductPrice(state.selectedProduct), "kr/st")), h("div", { class: "hemfixarna_counter" }, h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removeProduct() }), h("span", null, this.getAmount()), h("img", { src: plus, onClick: () => this.addProduct() }))), ((_c = state.selectedProduct.parts) === null || _c === void 0 ? void 0 : _c.length) &&
|
115
140
|
state.selectedProduct.parts.map(p => {
|
116
141
|
var _a;
|
117
142
|
return (h("li", { class: "hemfixarna_part" }, h("div", null, h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.post_title), h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), h("div", { class: "hemfixarna_counter" }, h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), h("span", null, this.getPartAmount(p.ID)), h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
|
118
|
-
})), h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Forts\u00E4tt"))), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (h("p", { class: "hemfixarna_terms" }, h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), h("br", null), h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && h("hemfixarna-info", { list: state.options.trust })))));
|
143
|
+
})), h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Forts\u00E4tt"))), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (h("p", { class: "hemfixarna_terms" }, h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), h("br", null), h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && h("hemfixarna-info", { list: state.options.trust }))))) : null;
|
119
144
|
}
|
120
145
|
static get is() { return "hemfixarna-product"; }
|
146
|
+
static get originalStyleUrls() {
|
147
|
+
return {
|
148
|
+
"$": ["hemfixarna-product.scss"]
|
149
|
+
};
|
150
|
+
}
|
151
|
+
static get styleUrls() {
|
152
|
+
return {
|
153
|
+
"$": ["hemfixarna-product.css"]
|
154
|
+
};
|
155
|
+
}
|
121
156
|
static get states() {
|
122
157
|
return {
|
123
158
|
"amount": {},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hemfixarna-product.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-product/hemfixarna-product.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,iBAAiB;;kBACF,CAAC;2BACS,IAAI;;EAGxC,UAAU;IACR,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC9E,IAAI,aAAa,EAAE;MACjB,aAAa,CAAC,MAAM,EAAE,CAAC;MACvB,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;KAC9B;SAAM;MACL,KAAK,CAAC,IAAI,GAAG;QACX,GAAG,KAAK,CAAC,IAAI;QACb;U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ACF,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;CACF","sourcesContent":["import { Component, Element, Fragment, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Icon, Part } from '../../types';\nimport { getPartPrice, getProductPrice } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-product',\n shadow: false,\n})\nexport class HemfixarnaProduct {\n @State() amount: number = 0;\n @State() hideDescription: boolean = true;\n @Element() private el: HTMLElement;\n\n addProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n productInCart.amount++;\n state.cart = [...state.cart];\n } else {\n state.cart = [\n ...state.cart,\n {\n id: state.selectedProduct.ID,\n rut: state.selectedProduct.rut,\n rot: state.selectedProduct.rot,\n amount: 1,\n parts: [],\n price: state.selectedProduct.price,\n name: state.selectedProduct.post_title,\n start_fee: !state.selectedProduct.hide_start_fee,\n terms_checkout: state.selectedProduct.terms_checkout,\n icon: state.selectedProduct.icon,\n },\n ];\n }\n }\n\n removeProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart && productInCart.amount > 1) {\n productInCart.amount--;\n state.cart = [...state.cart];\n } else {\n state.cart = state.cart.filter(p => p.id !== state.selectedProduct.ID);\n }\n }\n\n //Handle cart and parts\n addPart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart) {\n partInCart.amount++;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: part.title ?? part.post_title }];\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n removePart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart && partInCart.amount > 1) {\n partInCart.amount--;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n goToCart() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n state.step = 5;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n\n getAmount() {\n return state.cart.find(p => p.id === state.selectedProduct.ID)?.amount || 0;\n }\n\n getPartAmount(partId: number) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n return productInCart?.parts.find(sp => sp.id === partId)?.amount || 0;\n }\n\n getTotalPrice() {\n let price = 0;\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partsPrice = productInCart.parts.reduce((acc, curr) => {\n const part = state.selectedProduct.parts.find(p => p.ID === curr.id);\n if (part) {\n return acc + part.price * curr.amount;\n }\n return acc;\n }, 0);\n price = state.selectedProduct.price * productInCart.amount + partsPrice;\n } else {\n price = state.selectedProduct.price;\n }\n return getProductPrice(state.selectedProduct, price);\n }\n\n render() {\n const checked = getAssetPath(`./assets/checked.svg`);\n const plus = getAssetPath(`./assets/plus.svg`);\n const minus = getAssetPath(`./assets/minus.svg`);\n\n return (\n <div class=\"hemfixarna_product\">\n <div class=\"hemfixarna_product--top\">\n {state.selectedProduct.icon && (\n <img width={80} src={(state.selectedProduct.icon as Icon).url ?? (state.selectedProduct.icon as string)} alt={state.selectedProduct.post_title} />\n )}\n <div>\n <h1>{state.selectedProduct.post_title}</h1>\n {!state.selectedProduct.invoice ? <h2>{getProductPrice(state.selectedProduct)} kr/st</h2> : <h2>{state.selectedProduct.invoice_price}</h2>}\n </div>\n </div>\n\n <div class=\"hemfixarna_product--grid\">\n <div class=\"hemfixarna_product--left\">\n {state.selectedProduct.list?.length && (\n <ul class=\"hemfixarna_features\">\n {state.selectedProduct.list.map(l => (\n <li key={l.bullet}>\n <img src={checked} alt=\"checked\" />\n <p>{l.bullet}</p>\n </li>\n ))}\n </ul>\n )}\n {state.selectedProduct.description && (\n <p\n onClick={() => (this.hideDescription = false)}\n class={`hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`}\n innerHTML={state.selectedProduct.description}\n ></p>\n )}\n </div>\n <div class=\"hemfixarna_product--right\">\n {state.selectedProduct.invoice ? (\n <hemfixarna-invoice />\n ) : (\n <Fragment>\n <ul>\n <li class=\"hemfixarna_product--item\">\n <div>\n <p>Antal {state.selectedProduct.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getProductPrice(state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removeProduct()} />\n <span>{this.getAmount()}</span>\n <img src={plus} onClick={() => this.addProduct()} />\n </div>\n </li>\n {state.selectedProduct.parts?.length &&\n state.selectedProduct.parts.map(p => (\n <li class=\"hemfixarna_part\">\n <div>\n <p>{p.title ?? p.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getPartPrice(p, state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removePart(p)} />\n <span>{this.getPartAmount(p.ID)}</span>\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={plus} onClick={() => this.addPart(p)} />\n </div>\n </li>\n ))}\n </ul>\n <h4 class=\"hemfixarna_product--total\">Totalt {this.getTotalPrice()} kr</h4>\n <button onClick={() => this.goToCart()} class={`hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}`}>\n Fortsätt\n </button>\n </Fragment>\n )}\n {!state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (\n <p class=\"hemfixarna_terms\">\n <strong>{state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading}</strong>\n <br />\n <span innerHTML={state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text}></span>\n </p>\n )}\n {state.options && <hemfixarna-info list={state.options.trust} />}\n </div>\n </div>\n </div>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"hemfixarna-product.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-product/hemfixarna-product.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOjD,MAAM,OAAO,iBAAiB;;kBACF,CAAC;2BACS,IAAI;;EAGxC,UAAU;IACR,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC9E,IAAI,aAAa,EAAE;MACjB,aAAa,CAAC,MAAM,EAAE,CAAC;MACvB,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;KAC9B;SAAM;MACL,KAAK,CAAC,IAAI,GAAG;QACX,GAAG,KAAK,CAAC,IAAI;QACb;UACE,EAAE,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE;UAC5B,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG;UAC9B,GAAG,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG;UAC9B,MAAM,EAAE,CAAC;UACT,KAAK,EAAE,EAAE;UACT,KA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AC,KAAK,CAAC,UAAU,CAAC,kBAAkB,GAAS,CAC7H,CACL;UACA,KAAK,CAAC,OAAO,IAAI,uBAAiB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,CAC5D,CACF,CACF,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;EACX,CAAC;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Fragment, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business, Icon, Part } from '../../types';\nimport { getPartPrice, getProductPrice } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-product',\n styleUrl: 'hemfixarna-product.scss',\n shadow: false,\n})\nexport class HemfixarnaProduct {\n @State() amount: number = 0;\n @State() hideDescription: boolean = true;\n @Element() private el: HTMLElement;\n\n addProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n productInCart.amount++;\n state.cart = [...state.cart];\n } else {\n state.cart = [\n ...state.cart,\n {\n id: state.selectedProduct.ID,\n rut: state.selectedProduct.rut,\n rot: state.selectedProduct.rot,\n amount: 1,\n parts: [],\n price: state.selectedProduct.price,\n name: state.selectedProduct.post_title,\n start_fee: !state.selectedProduct.hide_start_fee,\n terms_checkout: state.selectedProduct.terms_checkout,\n icon: state.selectedProduct.icon,\n },\n ];\n }\n }\n\n removeProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart && productInCart.amount > 1) {\n productInCart.amount--;\n state.cart = [...state.cart];\n } else {\n state.cart = state.cart.filter(p => p.id !== state.selectedProduct.ID);\n }\n }\n\n //Handle cart and parts\n addPart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart) {\n partInCart.amount++;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: part.title ?? part.post_title }];\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n removePart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart && partInCart.amount > 1) {\n partInCart.amount--;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n goToCart() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n state.step = 5;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n\n getAmount() {\n return state.cart.find(p => p.id === state.selectedProduct.ID)?.amount || 0;\n }\n\n getPartAmount(partId: number) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n return productInCart?.parts.find(sp => sp.id === partId)?.amount || 0;\n }\n\n getTotalPrice() {\n let price = 0;\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partsPrice = productInCart.parts.reduce((acc, curr) => {\n const part = state.selectedProduct.parts.find(p => p.ID === curr.id);\n if (part) {\n return acc + part.price * curr.amount;\n }\n return acc;\n }, 0);\n price = state.selectedProduct.price * productInCart.amount + partsPrice;\n } else {\n price = state.selectedProduct.price;\n }\n return getProductPrice(state.selectedProduct, price);\n }\n\n componentDidRender() {\n const linkElem = document.createElement('link');\n linkElem.setAttribute('rel', 'stylesheet');\n linkElem.setAttribute('href', 'https://painting-frontend.vercel.app/static/css/main.css');\n const fonts = document.createElement('link');\n fonts.setAttribute('rel', 'stylesheet');\n fonts.setAttribute('href', 'https://painting-frontend.vercel.app/fonts.css');\n\n const checkAndInjectCSS = () => {\n const parents = this.el.getElementsByTagName('hemfixare-calculator');\n if (parents.length > 0 && parents[0].shadowRoot !== null) {\n parents[0].shadowRoot.appendChild(linkElem);\n parents[0].shadowRoot.appendChild(fonts);\n } else {\n setTimeout(checkAndInjectCSS, 1);\n }\n };\n\n checkAndInjectCSS();\n }\n\n render() {\n const checked = getAssetPath(`./assets/checked.svg`);\n const plus = getAssetPath(`./assets/plus.svg`);\n const minus = getAssetPath(`./assets/minus.svg`);\n\n if (state.maleri) {\n return (\n <div class=\"hemfixarna_painting\">\n <script\n type=\"text/javascript\"\n src={\n ['localhost', 'vercel'].some(v => window.location.href.includes(v))\n ? 'https://painting-dev.vercel.app/static/js/main.js'\n : 'https://painting-frontend.vercel.app/static/js/main.js'\n }\n defer\n async\n ></script>\n <hemfixare-calculator\n title={state.options.maleri_title}\n subtitle={state.options.maleri_text}\n modal=\"true\"\n customer={state.business === Business.string ? 'string' : state.business}\n ></hemfixare-calculator>\n </div>\n );\n }\n\n return state.selectedProduct ? (\n <div class=\"hemfixarna_product\">\n <div class=\"hemfixarna_product--top\">\n {state.selectedProduct.icon && (\n <img width={80} src={(state.selectedProduct.icon as Icon).url ?? (state.selectedProduct.icon as string)} alt={state.selectedProduct.post_title} />\n )}\n <div>\n <h1>{state.selectedProduct.post_title}</h1>\n {!state.selectedProduct.invoice ? <h2>{getProductPrice(state.selectedProduct)} kr/st</h2> : <h2>{state.selectedProduct.invoice_price}</h2>}\n </div>\n </div>\n\n <div class=\"hemfixarna_product--grid\">\n <div class=\"hemfixarna_product--left\">\n {state.selectedProduct.list?.length && (\n <ul class=\"hemfixarna_features\">\n {state.selectedProduct.list.map(l => (\n <li key={l.bullet}>\n <img src={checked} alt=\"checked\" />\n <p>{l.bullet}</p>\n </li>\n ))}\n </ul>\n )}\n {state.selectedProduct.description && (\n <p\n onClick={() => (this.hideDescription = false)}\n class={`hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`}\n innerHTML={state.selectedProduct.description}\n ></p>\n )}\n </div>\n <div class=\"hemfixarna_product--right\">\n {state.selectedProduct.invoice ? (\n <hemfixarna-invoice />\n ) : (\n <Fragment>\n <ul>\n <li class=\"hemfixarna_product--item\">\n <div>\n <p>Antal {state.selectedProduct.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getProductPrice(state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removeProduct()} />\n <span>{this.getAmount()}</span>\n <img src={plus} onClick={() => this.addProduct()} />\n </div>\n </li>\n {state.selectedProduct.parts?.length &&\n state.selectedProduct.parts.map(p => (\n <li class=\"hemfixarna_part\">\n <div>\n <p>{p.title ?? p.post_title}</p>\n <p class=\"hemfixarna_product--price\">{getPartPrice(p, state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removePart(p)} />\n <span>{this.getPartAmount(p.ID)}</span>\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={plus} onClick={() => this.addPart(p)} />\n </div>\n </li>\n ))}\n </ul>\n <h4 class=\"hemfixarna_product--total\">Totalt {this.getTotalPrice()} kr</h4>\n <button onClick={() => this.goToCart()} class={`hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}`}>\n Fortsätt\n </button>\n </Fragment>\n )}\n {!state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (\n <p class=\"hemfixarna_terms\">\n <strong>{state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading}</strong>\n <br />\n <span innerHTML={state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text}></span>\n </p>\n )}\n {state.options && <hemfixarna-info list={state.options.trust} />}\n </div>\n </div>\n </div>\n ) : null;\n }\n}\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { h } from '@stencil/core';
|
1
|
+
import { getAssetPath, h } from '@stencil/core';
|
2
2
|
import state from '../../store';
|
3
3
|
export class HemfixarnaGrid {
|
4
4
|
constructor() {
|
@@ -8,8 +8,14 @@ export class HemfixarnaGrid {
|
|
8
8
|
isMainCategory(category) {
|
9
9
|
return category.show_products !== undefined;
|
10
10
|
}
|
11
|
+
handleMaleriClick() {
|
12
|
+
state.step = 4;
|
13
|
+
state.maleri = true;
|
14
|
+
}
|
11
15
|
render() {
|
12
|
-
|
16
|
+
var _a;
|
17
|
+
const maleriLogo = getAssetPath('./assets/gubbe-pensel.svg');
|
18
|
+
return state.customer ? (h("div", null, h("h2", null, state.selectedCustomerCategory ? state.selectedCustomerCategory.name : 'Alla tjänster'), h("div", { class: "hemfixarna_categories--wrapper" }, h("ul", { class: "hemfixarna_categories" }, ((_a = state.selectedCustomerCategory) === null || _a === void 0 ? void 0 : _a.add_painting) ? (h("button", { onClick: () => this.handleMaleriClick(), class: "hemfixarna_maleribox" }, h("img", { height: 64, src: maleriLogo, alt: "M\u00E5leri Logotyp" }), h("p", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r"))) : null, state.selectedCustomerCategory
|
13
19
|
? this.isMainCategory(state.selectedCustomerCategory) && state.selectedCustomerCategory.sub_categories && !state.selectedCustomerCategory.show_products
|
14
20
|
? state.selectedCustomerCategory.sub_categories.map(c => h("hemfixarna-box", { category: c }))
|
15
21
|
: state.selectedCustomerCategory.products
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hemfixarna-start.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-start/hemfixarna-start.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"hemfixarna-start.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-start/hemfixarna-start.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,MA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BAAwB,CAAC,QAAQ;gBACvC,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,sBAAgB,QAAQ,EAAE,CAAC,CAAC,MAAM,GAAmB,CAAC;gBACzG,CAAC,CAAC,IAAI;YACV,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,sBAAgB,QAAQ,EAAE,CAAC,GAAmB,CAAC,CACnF;QACL,uBAAiB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,CAC1C,CACF,CACP,CAAC,CAAC,CAAC,CACF;MACE,mCAAsB;MACtB,WAAK,KAAK,EAAC,gCAAgC;QACzC,UAAI,KAAK,EAAC,uBAAuB,IAC9B,IAAI,CAAC,IAAI,CAAC,QAAQ;WAChB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;WAC1C,GAAG,CAAC,CAAC,CAAC,EAAE;;UAAC,OAAA,CACR,sBAAgB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAC,CAAC,CAAC,IAAa,CAAC,GAAG,mCAAK,CAAC,CAAC,IAAe,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,GAAmB,CAChH,CAAA;SAAA,CAAC,CACD;QACL,uBAAiB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,CAC1C,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category, CustomerCategory, CustomerSubCategory, Icon } from '../../types';\n\n@Component({\n tag: 'hemfixarna-start',\n shadow: false,\n})\nexport class HemfixarnaGrid {\n @Prop() tree?: Category;\n @Prop() slug?: string;\n\n isMainCategory(category: CustomerCategory | CustomerSubCategory): category is CustomerCategory {\n return (category as CustomerCategory).show_products !== undefined;\n }\n\n handleMaleriClick() {\n state.step = 4;\n state.maleri = true;\n }\n\n render() {\n const maleriLogo = getAssetPath('./assets/gubbe-pensel.svg');\n return state.customer ? (\n <div>\n <h2>{state.selectedCustomerCategory ? state.selectedCustomerCategory.name : 'Alla tjänster'}</h2>\n <div class=\"hemfixarna_categories--wrapper\">\n <ul class=\"hemfixarna_categories\">\n {state.selectedCustomerCategory?.add_painting ? (\n <button onClick={() => this.handleMaleriClick()} class=\"hemfixarna_maleribox\">\n <img height={64} src={maleriLogo} alt=\"Måleri Logotyp\" />\n <p>Beräkna fast pris på måleri & tapetsering här</p>\n </button>\n ) : null}\n {state.selectedCustomerCategory\n ? this.isMainCategory(state.selectedCustomerCategory) && state.selectedCustomerCategory.sub_categories && !state.selectedCustomerCategory.show_products\n ? state.selectedCustomerCategory.sub_categories.map(c => <hemfixarna-box category={c}></hemfixarna-box>)\n : state.selectedCustomerCategory.products\n ? state.selectedCustomerCategory.products.map(c => <hemfixarna-box category={c.fields}></hemfixarna-box>)\n : null\n : state.customer.categories.map(c => <hemfixarna-box category={c}></hemfixarna-box>)}\n </ul>\n <hemfixarna-info list={state.options.trust} />\n </div>\n </div>\n ) : (\n <div>\n <h2>Alla tjänster</h2>\n <div class=\"hemfixarna_categories--wrapper\">\n <ul class=\"hemfixarna_categories\">\n {this.tree.sub_cats\n .sort((a, b) => (a.name < b.name ? -1 : 1))\n .map(c => (\n <hemfixarna-box post={c} icon={(c.icon as Icon).url ?? (c.icon as string)} postTitle={c.name}></hemfixarna-box>\n ))}\n </ul>\n <hemfixarna-info list={state.options.trust} />\n </div>\n </div>\n );\n }\n}\n"]}
|
@@ -21,6 +21,7 @@ const { state, onChange, } = createStore({
|
|
21
21
|
parentCategory: null,
|
22
22
|
creditSafeUser: null,
|
23
23
|
checkoutInvoice: false,
|
24
|
+
maleri: false,
|
24
25
|
});
|
25
26
|
onChange('cart', cart => {
|
26
27
|
window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiC7C,MAAM,EACJ,KAAK,EACL,QAAQ,GACT,GAGG,WAAW,CAAC;EACd,IAAI,EAAE,CAAC;EACP,YAAY,EAAE,CAAC;EACf,YAAY,EAAE,KAAK;EACnB,gBAAgB,EAAE,IAAI;EACtB,eAAe,EAAE,IAAI;EACrB,eAAe,EAAE,IAAI;EACrB,IAAI,EAAE,EAAE;EACR,QAAQ,EAAE,WAAW;EACrB,OAAO,EAAE,IAAI;EACb,GAAG,EAAE,IAAI;EACT,GAAG,EAAE,IAAI;EACT,KAAK,EAAE,IAAI;EACX,IAAI,EAAE,IAAI;EACV,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,IAAI;EAChB,QAAQ,EAAE,IAAI;EACd,wBAAwB,EAAE,IAAI;EAC9B,cAAc,EAAE,IAAI;EACpB,cAAc,EAAE,IAAI;EACpB,eAAe,EAAE,KAAK;EACtB,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;EACtB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc,KAAK,CAAC,QAAQ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3F,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC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AAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,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,CAAC;AAEH,eAAe,KAAK,CAAC","sourcesContent":["import { createStore } from '@stencil/store';\nimport { OnChangeHandler } from '@stencil/store/dist/types';\nimport { Business, CartItem, Category, Customer, CustomerCategory, CustomerSubCategory, 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 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 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 token: null,\n user: null,\n modal: null,\n rutOptions: null,\n rotOptions: null,\n customer: null,\n selectedCustomerCategory: null,\n parentCategory: null,\n creditSafeUser: null,\n checkoutInvoice: false,\n maleri: false,\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"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAkLA,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;EAClB,yBAAa,CAAA;EACb,+BAAmB,CAAA;EACnB,+BAAmB,CAAA;EACnB,uCAA2B,CAAA;EAC3B,iCAAqB,CAAA;EACrB,iCAAqB,CAAA;EACrB,yBAAa,CAAA;EACb,yBAAa,CAAA;AACf,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB;AAED,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;EACrB,oCAAqB,CAAA;EACrB,0CAA2B,CAAA;EAC3B,8CAA+B,CAAA;EAC/B,8CAA+B,CAAA;AACjC,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED,MAAM,CAAN,IAAY,WAEX;AAFD,WAAY,WAAW;EACrB,wCAAyB,CAAA;AAC3B,CAAC,EAFW,WAAW,KAAX,WAAW,QAEtB","sourcesContent":["type Icon = {\n url: string;\n};\n\ninterface Customer {\n ID: number;\n post_title: string;\n post_name: string;\n post_type: string;\n filter: string;\n categories: CustomerCategory[];\n}\n\ninterface CustomerCategory {\n id: string;\n name: string;\n icon: string;\n show_products: boolean;\n products: { fields: Product }[] | false;\n sub_categories: CustomerSubCategory[] | false;\n add_painting: boolean;\n}\n\ninterface CustomerSubCategory {\n id: string;\n name: string;\n icon: string;\n products: { fields: Product }[];\n parent: string;\n add_painting: boolean;\n}\n\ninterface Part {\n ID: number;\n post_author: number;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0 | 1;\n guid: string;\n menu_order: 0;\n post_type: string;\n post_mime_type: string;\n comment_count: number;\n filter: string;\n price: number;\n title: string;\n}\n\ninterface Product {\n ID: number;\n post_author: string;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0;\n guid: string;\n menu_order: 0;\n post_type: string;\n post_mime_type: string;\n comment_count: 0;\n filter: string;\n price: number;\n icon?: Icon | string;\n parts?: Array<Part>;\n list: Array<{ bullet: string }>;\n terms: string;\n terms_checkout: string;\n terms_show_checkbox: boolean;\n rut: boolean;\n rot: boolean;\n hide_start_fee: boolean;\n description: string;\n category: string;\n title: string;\n invoice: string;\n invoice_price: string;\n invoice_description: string;\n}\n\ninterface Service {\n ID: 41857;\n icon?: Icon | string;\n post_author: 34419;\n post_date: Date;\n post_date_gmt: Date;\n post_content: string;\n post_title: string;\n post_excerpt: string;\n post_status: string;\n comment_status: string;\n ping_status: string;\n post_password: string;\n post_name: string;\n to_ping: string;\n pinged: string;\n post_modified: Date;\n post_modified_gmt: Date;\n post_content_filtered: string;\n post_parent: 0;\n guid: string;\n menu_order: 0;\n post_type: 'service';\n post_mime_type: string;\n comment_count: 0;\n filter: string;\n products: Array<Product>;\n}\n\ninterface Category {\n count: number;\n description: string;\n name: string;\n icon?: Icon | string;\n parent: 0 | 1;\n slug: string;\n taxonomy: 'service_cat';\n term_group: 0 | 1;\n term_id: number;\n term_order: string;\n term_taxonomy_id: number;\n sub_cats?: Array<Category>;\n services?: Array<Service>;\n}\n\ninterface WpOptions {\n link: { title: string; url: string };\n trust: { trust_badge: string }[];\n thank_you_image: string;\n start_fee: number;\n terms: string;\n maleri_title: string;\n maleri_text: string;\n}\ninterface CartPart {\n id: number;\n amount: number;\n price: number;\n name: string;\n}\n\ninterface CartItem {\n id: number;\n price: number;\n name: string;\n amount: number;\n parts: CartPart[];\n rut: boolean;\n rot: boolean;\n start_fee: boolean;\n terms_checkout: string;\n icon?: Icon | string;\n}\n\nexport enum Business {\n kund = 'kund',\n byggmax = 'byggmax',\n skanska = 'skanska',\n string = 'string-furniture',\n hornbach = 'hornbach',\n forebygg = 'forebygg',\n doro = 'doro',\n elfa = 'elfa',\n}\n\nexport enum WidgetStyle {\n standard = 'standard',\n alternative = 'alternative',\n alternative_2 = 'alternative_2',\n alternative_3 = 'alternative_3',\n}\n\nexport enum TopCategory {\n byggmax = 'category/bygg',\n}\n\ninterface User {\n email: string;\n phone: string;\n ssn: string;\n firstName: string;\n lastName: string;\n street: string;\n zip: string;\n town: string;\n}\n\ninterface RutOptions {\n rut_start_fee_heading: string;\n rut_start_fee_text: string;\n rut_start_fee_text_secondary: string;\n}\n\ninterface RotOptions {\n rot_start_fee_heading: string;\n rot_start_fee_text: string;\n rot_start_fee_text_secondary: string;\n}\n\nexport type { CartItem, CartPart, Category, Customer, CustomerCategory, CustomerSubCategory, Icon, Part, Product, RotOptions, RutOptions, Service, User, WpOptions };\n"]}
|