hemfixarna-web-components 1.7.1 → 1.7.3
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_15.cjs.entry.js +55 -47
- package/dist/cjs/hemfixarna-address_15.cjs.entry.js.map +1 -1
- package/dist/cjs/hemfixarna-byggmax.cjs.entry.js +2 -1
- package/dist/cjs/hemfixarna-byggmax.cjs.entry.js.map +1 -1
- package/dist/cjs/hemfixarna-category.cjs.entry.js +1 -1
- package/dist/cjs/hemfixarna-components.cjs.js +1 -1
- package/dist/cjs/hemfixarna-service.cjs.entry.js +1 -1
- package/dist/cjs/{index-4695c475.js → index-6af772cf.js} +8 -1
- package/dist/cjs/index-6af772cf.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +19 -1
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -1
- package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js +12 -37
- package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +52 -6
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna.css +20 -0
- package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js +6 -1
- package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js.map +1 -1
- package/dist/collection/store/index.js +7 -0
- package/dist/collection/store/index.js.map +1 -1
- package/dist/esm/hemfixarna-address_15.entry.js +55 -47
- package/dist/esm/hemfixarna-address_15.entry.js.map +1 -1
- package/dist/esm/hemfixarna-byggmax.entry.js +2 -1
- package/dist/esm/hemfixarna-byggmax.entry.js.map +1 -1
- package/dist/esm/hemfixarna-category.entry.js +1 -1
- package/dist/esm/hemfixarna-components.js +1 -1
- package/dist/esm/hemfixarna-service.entry.js +1 -1
- package/dist/esm/{index-113a6b21.js → index-8282f88e.js} +8 -1
- package/dist/esm/index-8282f88e.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
- package/dist/hemfixarna-components/p-8cc96dd9.entry.js +2 -0
- package/dist/hemfixarna-components/p-a63a6a56.entry.js +2 -0
- package/dist/hemfixarna-components/p-a63a6a56.entry.js.map +1 -0
- package/dist/hemfixarna-components/{p-a3d759d9.js → p-b397b966.js} +2 -2
- package/dist/hemfixarna-components/p-b397b966.js.map +1 -0
- package/dist/hemfixarna-components/{p-12dbf4e6.entry.js → p-e8800c3b.entry.js} +2 -2
- package/dist/hemfixarna-components/p-fb43b148.entry.js +2 -0
- package/dist/hemfixarna-components/p-fb43b148.entry.js.map +1 -0
- package/dist/types/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.d.ts +1 -0
- package/dist/types/components/hemfixarna-checkout/hemfixarna-checkout.d.ts +0 -4
- package/dist/types/components/hemfixarna-component/hemfixarna-component.d.ts +3 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/store/index.d.ts +2 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/cjs/index-4695c475.js.map +0 -1
- package/dist/esm/index-113a6b21.js.map +0 -1
- package/dist/hemfixarna-components/p-7c122f15.entry.js +0 -2
- package/dist/hemfixarna-components/p-9b1e6bc2.entry.js +0 -2
- package/dist/hemfixarna-components/p-9b1e6bc2.entry.js.map +0 -1
- package/dist/hemfixarna-components/p-9df46508.entry.js +0 -2
- package/dist/hemfixarna-components/p-9df46508.entry.js.map +0 -1
- package/dist/hemfixarna-components/p-a3d759d9.js.map +0 -1
- /package/dist/hemfixarna-components/{p-7c122f15.entry.js.map → p-8cc96dd9.entry.js.map} +0 -0
- /package/dist/hemfixarna-components/{p-12dbf4e6.entry.js.map → p-e8800c3b.entry.js.map} +0 -0
@@ -14,9 +14,10 @@ const MyComponent = class {
|
|
14
14
|
this.widgetStyle = index$1.WidgetStyle.standard;
|
15
15
|
this.buttonColor = undefined;
|
16
16
|
this.buttonBg = undefined;
|
17
|
+
this.slug = undefined;
|
17
18
|
}
|
18
19
|
render() {
|
19
|
-
return (index.h("hemfixarna-component", { id: this.id, business: index$1.Business.byggmax, widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor }));
|
20
|
+
return (index.h("hemfixarna-component", { slug: this.slug, id: this.id, business: index$1.Business.byggmax, widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor }));
|
20
21
|
}
|
21
22
|
};
|
22
23
|
MyComponent.style = hemfixarnaByggmaxCss;
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"hemfixarna-byggmax.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCQlB,WAAW;;;;uBAEcA,mBAAW,CAAC,QAAQ
|
1
|
+
{"file":"hemfixarna-byggmax.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCQlB,WAAW;;;;uBAEcA,mBAAW,CAAC,QAAQ;;;;;EAKxD,MAAM;IACJ,QACEC,kCACE,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,QAAQ,EAAEC,gBAAQ,CAAC,OAAO,EAC1B,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,WAAW,EAAE,IAAI,CAAC,WAAW,GACP,EACxB;GACH;;;;;;","names":["WidgetStyle","h","Business"],"sources":["./src/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.scss?tag=hemfixarna-byggmax&encapsulation=shadow","./src/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.tsx"],"sourcesContent":["","import { Component, Prop, h } from '@stencil/core';\nimport { Business, WidgetStyle } from '../../../types';\n\n@Component({\n tag: 'hemfixarna-byggmax',\n styleUrl: 'hemfixarna-byggmax.scss',\n shadow: true,\n})\nexport class MyComponent {\n @Prop() id?: string;\n @Prop() widgetStyle?: WidgetStyle = WidgetStyle.standard;\n @Prop() buttonColor?: string;\n @Prop() buttonBg?: string;\n @Prop() slug?: string;\n\n render() {\n return (\n <hemfixarna-component\n slug={this.slug}\n id={this.id}\n business={Business.byggmax}\n widgetStyle={this.widgetStyle}\n buttonBg={this.buttonBg}\n buttonColor={this.buttonColor}\n ></hemfixarna-component>\n );\n }\n}\n"],"version":3}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-b83343b9.js');
|
6
|
-
const index$1 = require('./index-
|
6
|
+
const index$1 = require('./index-6af772cf.js');
|
7
7
|
|
8
8
|
const HemfixarnaCategory = class {
|
9
9
|
constructor(hostRef) {
|
@@ -20,7 +20,7 @@ const patchBrowser = () => {
|
|
20
20
|
};
|
21
21
|
|
22
22
|
patchBrowser().then(options => {
|
23
|
-
return index.bootstrapLazy([["hemfixarna-address_15.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32],"widgetStyle":[32],"buttonBg":[32],"buttonColor":[32],"partner":[32],"colorAccessibility":[32],"loggedIn":[32],"loginError":[32]}],[1,"hemfixarna-component",{"id":[1],"business":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"],"modal":[32],"showModal":[32],"product":[32],"proppedProduct":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart"],[0,"hemfixarna-order"],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-breadcrumbs",{"closeModal":[16]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32],"loading":[32],"enteredPin":[32],"selectedSubSource":[32],"partnerOrderId":[32],"
|
23
|
+
return index.bootstrapLazy([["hemfixarna-address_15.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32],"widgetStyle":[32],"buttonBg":[32],"buttonColor":[32],"partner":[32],"colorAccessibility":[32],"loggedIn":[32],"loginError":[32]}],[1,"hemfixarna-component",{"id":[1],"slug":[1],"business":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"],"modal":[32],"showModal":[32],"product":[32],"proppedProduct":[32],"loginSourceError":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart"],[0,"hemfixarna-order"],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-breadcrumbs",{"closeModal":[16]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32],"loading":[32],"enteredPin":[32],"selectedSubSource":[32],"partnerOrderId":[32],"sellerID":[32],"RefferalID":[32]}],[0,"hemfixarna-contact",{"vertical":[4]}],[0,"hemfixarna-invoice",{"formError":[32],"displayImages":[32],"formImages":[32],"formState":[32]}],[0,"hemfixarna-address",{"street":[32],"streetError":[32],"zip":[32],"zipError":[32],"town":[32],"townError":[32]}],[0,"hemfixarna-getuser",{"email":[32],"emailError":[32],"phone":[32],"phoneError":[32],"ssn":[32],"ssnError":[32]}],[0,"hemfixarna-orderrows",{"cart":[4]}],[0,"hemfixarna-box",{"post":[16],"category":[16],"icon":[1],"postTitle":[1,"post-title"]}],[0,"hemfixarna-info"]]],["hemfixarna-byggmax.cjs",[[1,"hemfixarna-byggmax",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"],"slug":[1]}]]],["hemfixarna-doro.cjs",[[1,"hemfixarna-doro",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-elfa.cjs",[[1,"hemfixarna-elfa",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-fargvaruhuset.cjs",[[1,"hemfixarna-fargvaruhuset",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-flyttsmart.cjs",[[1,"hemfixarna-flyttsmart",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-forebygg.cjs",[[1,"hemfixarna-forebygg",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-hornbach.cjs",[[1,"hemfixarna-hornbach",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-kbygg.cjs",[[1,"hemfixarna-kbygg",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-klint.cjs",[[1,"hemfixarna-klint",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-kund.cjs",[[1,"hemfixarna-kund",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-norrgavel.cjs",[[1,"hemfixarna-norrgavel",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-power.cjs",[[1,"hemfixarna-power",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-skanska.cjs",[[1,"hemfixarna-skanska",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-sparfonster.cjs",[[1,"hemfixarna-sparfonster",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-string-furniture.cjs",[[1,"hemfixarna-string-furniture",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-superfront.cjs",[[1,"hemfixarna-superfront",{"id":[1],"loadFromQuery":[1,"load-from-query"],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-tesla.cjs",[[1,"hemfixarna-tesla",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-traningspartner.cjs",[[1,"hemfixarna-traningspartner",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-zaptec.cjs",[[1,"hemfixarna-zaptec",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-category.cjs",[[0,"hemfixarna-category"]]],["hemfixarna-service.cjs",[[0,"hemfixarna-service"]]]], options);
|
24
24
|
});
|
25
25
|
|
26
26
|
exports.setNonce = index.setNonce;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-b83343b9.js');
|
6
|
-
const index$1 = require('./index-
|
6
|
+
const index$1 = require('./index-6af772cf.js');
|
7
7
|
|
8
8
|
const HemfixarnaService = class {
|
9
9
|
constructor(hostRef) {
|
@@ -219,6 +219,8 @@ const { state, onChange, } = createStore({
|
|
219
219
|
checkoutInvoice: false,
|
220
220
|
maleri: false,
|
221
221
|
sources: null,
|
222
|
+
selectSource: false,
|
223
|
+
showSourcePasswordPrompt: false,
|
222
224
|
});
|
223
225
|
onChange('cart', cart => {
|
224
226
|
window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
|
@@ -229,6 +231,11 @@ onChange('user', user => {
|
|
229
231
|
onChange('creditSafeUser', user => {
|
230
232
|
window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));
|
231
233
|
});
|
234
|
+
onChange('selectSource', selectSource => {
|
235
|
+
if (selectSource) {
|
236
|
+
localStorage.setItem('select_source', 'true');
|
237
|
+
}
|
238
|
+
});
|
232
239
|
onChange('selectedProduct', product => {
|
233
240
|
if (!state.customer || !product)
|
234
241
|
return;
|
@@ -255,4 +262,4 @@ onChange('selectedCustomerCategory', category => {
|
|
255
262
|
|
256
263
|
exports.state = state;
|
257
264
|
|
258
|
-
//# sourceMappingURL=index-
|
265
|
+
//# sourceMappingURL=index-6af772cf.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"index-6af772cf.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;AAC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AC,CAAC;AAEH,QAAQ,CAAC,iBAAiB,EAAE,OAAO;EACjC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,OAAO;IAAE,OAAO;EACxC,MAAM,UAAU,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,cAAI,OAAA,MAAA,CAAC,CAAC,cAAc,mCAAI,EAAE,CAAA,EAAA,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;EACxH,MAAM,QAAQ,GAAG,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 selectSource: boolean;\n showSourcePasswordPrompt: 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 selectSource: false,\n showSourcePasswordPrompt: 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('selectSource', selectSource => {\n if (selectSource) {\n localStorage.setItem('select_source', 'true');\n }\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}
|
package/dist/cjs/loader.cjs.js
CHANGED
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
16
16
|
return patchEsm().then(() => {
|
17
|
-
return index.bootstrapLazy([["hemfixarna-address_15.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32],"widgetStyle":[32],"buttonBg":[32],"buttonColor":[32],"partner":[32],"colorAccessibility":[32],"loggedIn":[32],"loginError":[32]}],[1,"hemfixarna-component",{"id":[1],"business":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"],"modal":[32],"showModal":[32],"product":[32],"proppedProduct":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart"],[0,"hemfixarna-order"],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-breadcrumbs",{"closeModal":[16]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32],"loading":[32],"enteredPin":[32],"selectedSubSource":[32],"partnerOrderId":[32],"
|
17
|
+
return index.bootstrapLazy([["hemfixarna-address_15.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32],"widgetStyle":[32],"buttonBg":[32],"buttonColor":[32],"partner":[32],"colorAccessibility":[32],"loggedIn":[32],"loginError":[32]}],[1,"hemfixarna-component",{"id":[1],"slug":[1],"business":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"],"modal":[32],"showModal":[32],"product":[32],"proppedProduct":[32],"loginSourceError":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart"],[0,"hemfixarna-order"],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-breadcrumbs",{"closeModal":[16]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32],"loading":[32],"enteredPin":[32],"selectedSubSource":[32],"partnerOrderId":[32],"sellerID":[32],"RefferalID":[32]}],[0,"hemfixarna-contact",{"vertical":[4]}],[0,"hemfixarna-invoice",{"formError":[32],"displayImages":[32],"formImages":[32],"formState":[32]}],[0,"hemfixarna-address",{"street":[32],"streetError":[32],"zip":[32],"zipError":[32],"town":[32],"townError":[32]}],[0,"hemfixarna-getuser",{"email":[32],"emailError":[32],"phone":[32],"phoneError":[32],"ssn":[32],"ssnError":[32]}],[0,"hemfixarna-orderrows",{"cart":[4]}],[0,"hemfixarna-box",{"post":[16],"category":[16],"icon":[1],"postTitle":[1,"post-title"]}],[0,"hemfixarna-info"]]],["hemfixarna-byggmax.cjs",[[1,"hemfixarna-byggmax",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"],"slug":[1]}]]],["hemfixarna-doro.cjs",[[1,"hemfixarna-doro",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-elfa.cjs",[[1,"hemfixarna-elfa",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-fargvaruhuset.cjs",[[1,"hemfixarna-fargvaruhuset",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-flyttsmart.cjs",[[1,"hemfixarna-flyttsmart",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-forebygg.cjs",[[1,"hemfixarna-forebygg",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-hornbach.cjs",[[1,"hemfixarna-hornbach",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-kbygg.cjs",[[1,"hemfixarna-kbygg",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-klint.cjs",[[1,"hemfixarna-klint",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-kund.cjs",[[1,"hemfixarna-kund",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-norrgavel.cjs",[[1,"hemfixarna-norrgavel",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-power.cjs",[[1,"hemfixarna-power",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-skanska.cjs",[[1,"hemfixarna-skanska",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-sparfonster.cjs",[[1,"hemfixarna-sparfonster",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-string-furniture.cjs",[[1,"hemfixarna-string-furniture",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-superfront.cjs",[[1,"hemfixarna-superfront",{"id":[1],"loadFromQuery":[1,"load-from-query"],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-tesla.cjs",[[1,"hemfixarna-tesla",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-traningspartner.cjs",[[1,"hemfixarna-traningspartner",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-zaptec.cjs",[[1,"hemfixarna-zaptec",{"id":[1],"widgetStyle":[1,"widget-style"],"buttonColor":[1,"button-color"],"buttonBg":[1,"button-bg"]}]]],["hemfixarna-category.cjs",[[0,"hemfixarna-category"]]],["hemfixarna-service.cjs",[[0,"hemfixarna-service"]]]], options);
|
18
18
|
});
|
19
19
|
};
|
20
20
|
|
@@ -6,9 +6,10 @@ export class MyComponent {
|
|
6
6
|
this.widgetStyle = WidgetStyle.standard;
|
7
7
|
this.buttonColor = undefined;
|
8
8
|
this.buttonBg = undefined;
|
9
|
+
this.slug = undefined;
|
9
10
|
}
|
10
11
|
render() {
|
11
|
-
return (h("hemfixarna-component", { id: this.id, business: Business.byggmax, widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor }));
|
12
|
+
return (h("hemfixarna-component", { slug: this.slug, id: this.id, business: Business.byggmax, widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor }));
|
12
13
|
}
|
13
14
|
static get is() { return "hemfixarna-byggmax"; }
|
14
15
|
static get encapsulation() { return "shadow"; }
|
@@ -97,6 +98,23 @@ export class MyComponent {
|
|
97
98
|
},
|
98
99
|
"attribute": "button-bg",
|
99
100
|
"reflect": false
|
101
|
+
},
|
102
|
+
"slug": {
|
103
|
+
"type": "string",
|
104
|
+
"mutable": false,
|
105
|
+
"complexType": {
|
106
|
+
"original": "string",
|
107
|
+
"resolved": "string",
|
108
|
+
"references": {}
|
109
|
+
},
|
110
|
+
"required": false,
|
111
|
+
"optional": true,
|
112
|
+
"docs": {
|
113
|
+
"tags": [],
|
114
|
+
"text": ""
|
115
|
+
},
|
116
|
+
"attribute": "slug",
|
117
|
+
"reflect": false
|
100
118
|
}
|
101
119
|
};
|
102
120
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hemfixarna-byggmax.js","sourceRoot":"","sources":["../../../../src/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOvD,MAAM,OAAO,WAAW;;;uBAEc,WAAW,CAAC,QAAQ
|
1
|
+
{"version":3,"file":"hemfixarna-byggmax.js","sourceRoot":"","sources":["../../../../src/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOvD,MAAM,OAAO,WAAW;;;uBAEc,WAAW,CAAC,QAAQ;;;;;EAKxD,MAAM;IACJ,OAAO,CACL,4BACE,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAC1B,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,WAAW,EAAE,IAAI,CAAC,WAAW,GACP,CACzB,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport { Business, WidgetStyle } from '../../../types';\n\n@Component({\n tag: 'hemfixarna-byggmax',\n styleUrl: 'hemfixarna-byggmax.scss',\n shadow: true,\n})\nexport class MyComponent {\n @Prop() id?: string;\n @Prop() widgetStyle?: WidgetStyle = WidgetStyle.standard;\n @Prop() buttonColor?: string;\n @Prop() buttonBg?: string;\n @Prop() slug?: string;\n\n render() {\n return (\n <hemfixarna-component\n slug={this.slug}\n id={this.id}\n business={Business.byggmax}\n widgetStyle={this.widgetStyle}\n buttonBg={this.buttonBg}\n buttonColor={this.buttonColor}\n ></hemfixarna-component>\n );\n }\n}\n"]}
|
@@ -82,6 +82,7 @@ export class HemfixarnaCheckout {
|
|
82
82
|
this.loading = false;
|
83
83
|
};
|
84
84
|
this.handleSubmit = (e) => {
|
85
|
+
var _a;
|
85
86
|
e.preventDefault();
|
86
87
|
this.generalError = null;
|
87
88
|
const validDate = this.date.length > 0;
|
@@ -93,34 +94,20 @@ export class HemfixarnaCheckout {
|
|
93
94
|
if (notValidTerms) {
|
94
95
|
this.generalError = 'Du måste godkänna villkoren';
|
95
96
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
if (state.customer.source && state.selectSource) {
|
98
|
+
if (!this.sellerID) {
|
99
|
+
this.generalError = 'Ange säljare';
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
if (((_a = state.customer.source.sub_sources) === null || _a === void 0 ? void 0 : _a.length) && !this.selectedSubSource) {
|
103
|
+
this.generalError = 'Välj underkälla';
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
}
|
106
107
|
if (validDate && !notValidTerms) {
|
107
108
|
this.sendOrder();
|
108
109
|
}
|
109
110
|
};
|
110
|
-
this.handleKeyDown = (event) => {
|
111
|
-
this.enteredPin += event.key;
|
112
|
-
const correctPin = '+0033';
|
113
|
-
if (this.enteredPin.length === correctPin.length) {
|
114
|
-
if (this.enteredPin === correctPin) {
|
115
|
-
localStorage.setItem('show_sources', 'true');
|
116
|
-
this.showSources = true;
|
117
|
-
window.removeEventListener('keydown', this.handleKeyDown);
|
118
|
-
}
|
119
|
-
this.enteredPin = '';
|
120
|
-
}
|
121
|
-
clearTimeout(this.pinTimeout);
|
122
|
-
this.pinTimeout = setTimeout(() => (this.enteredPin = ''), 5000);
|
123
|
-
};
|
124
111
|
this.render = () => {
|
125
112
|
var _a;
|
126
113
|
const dateLogo = getAssetPath(`./assets/date.svg`);
|
@@ -133,7 +120,7 @@ export class HemfixarnaCheckout {
|
|
133
120
|
return h("hemfixarna-getuser", null);
|
134
121
|
}
|
135
122
|
else if (state.checkoutStep === 2) {
|
136
|
-
return (h("div", { class: "mb-2" }, h("div", { class: "hemfixarna_addressinfo" }, h("div", null, h("p", null, hideField(state.user.firstName)), h("p", null, hideField(state.user.lastName)), h("p", null, state.user.email), h("p", null, state.user.phone)), h("div", null, h("p", null, hideField(state.user.street)), h("p", null, hideField(state.user.zip)), h("p", null, hideField(state.user.town))), h("button", { onClick: () => (state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), h("form", { onSubmit: e => this.handleSubmit(e) }, h("div", null, h("img", { src: dateLogo, width: 24 }), h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), h("img", { src: down, width: 24 })), this.dateError && h("span", null, this.dateError), state.customer.source &&
|
123
|
+
return (h("div", { class: "mb-2" }, h("div", { class: "hemfixarna_addressinfo" }, h("div", null, h("p", null, hideField(state.user.firstName)), h("p", null, hideField(state.user.lastName)), h("p", null, state.user.email), h("p", null, state.user.phone)), h("div", null, h("p", null, hideField(state.user.street)), h("p", null, hideField(state.user.zip)), h("p", null, hideField(state.user.town))), h("button", { onClick: () => (state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), h("form", { onSubmit: e => this.handleSubmit(e) }, h("div", null, h("img", { src: dateLogo, width: 24 }), h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), h("img", { src: down, width: 24 })), this.dateError && h("span", null, this.dateError), state.customer.source && state.selectSource ? (h(Fragment, null, h("p", null, "Inloggad som:", h("strong", null, " ", state.customer.source.fieldData.So01_Name)), h("label", null, "S\u00E4ljare (S\u00E4ljarId)", h("input", { type: "text", value: this.sellerID, onChange: e => (this.sellerID = e.target.value) })), h("label", null, "PartnerOrderID (RefferalID)", h("input", { type: "text", value: this.RefferalID, onChange: e => (this.RefferalID = e.target.value) })), ((_a = state.customer.source.sub_sources) === null || _a === void 0 ? void 0 : _a.length) ? (h("div", null, h("select", { onChange: e => (this.selectedSubSource = e.target.value) }, h("option", { disabled: true, selected: true, value: "null" }, "V\u00E4lj underk\u00E4lla"), state.customer.source.sub_sources.map(sub => (h("option", { value: sub['So_SubSource::_id'] }, sub['So_SubSource::Sus01_Name'])))))) : (h("p", null, "Det finns inga underk\u00E4llor att v\u00E4lja")))) : null, h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", { innerHTML: state.options.terms })), state.cart
|
137
124
|
.filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
|
138
125
|
.map(item => (h(Fragment, null, h("label", { class: "hemfixarna_checkbox" }, h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), h("span", null, item.terms_checkout))))), this.generalError && h("span", null, this.generalError), h("div", { class: this.loading ? 'loading' : '' }, h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
|
139
126
|
}
|
@@ -145,7 +132,6 @@ export class HemfixarnaCheckout {
|
|
145
132
|
this.enteredPin = '';
|
146
133
|
this.selectedSubSource = null;
|
147
134
|
this.partnerOrderId = null;
|
148
|
-
this.showSources = false;
|
149
135
|
this.sellerID = null;
|
150
136
|
this.RefferalID = null;
|
151
137
|
}
|
@@ -153,16 +139,6 @@ export class HemfixarnaCheckout {
|
|
153
139
|
if (Boolean(state.user && state.user.street)) {
|
154
140
|
state.checkoutStep = 2;
|
155
141
|
}
|
156
|
-
if (state.customer && state.customer.source) {
|
157
|
-
window.addEventListener('keydown', this.handleKeyDown);
|
158
|
-
}
|
159
|
-
const showSources = localStorage.getItem('show_sources');
|
160
|
-
if (showSources) {
|
161
|
-
this.showSources = true;
|
162
|
-
}
|
163
|
-
}
|
164
|
-
disconnectedCallback() {
|
165
|
-
window.removeEventListener('keydown', this.handleKeyDown);
|
166
142
|
}
|
167
143
|
static get is() { return "hemfixarna-checkout"; }
|
168
144
|
static get states() {
|
@@ -174,7 +150,6 @@ export class HemfixarnaCheckout {
|
|
174
150
|
"enteredPin": {},
|
175
151
|
"selectedSubSource": {},
|
176
152
|
"partnerOrderId": {},
|
177
|
-
"showSources": {},
|
178
153
|
"sellerID": {},
|
179
154
|
"RefferalID": {}
|
180
155
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3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AE,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAC,SAAS,GAAG,CACtD,CACD,CACH,CACP,CAAC;OACH;IACH,CAAC,CAAC;gBAnPsB,EAAE;qBACU,IAAI;wBACD,IAAI;mBACxB,KAAK;sBACM,EAAE;6BAGY,IAAI;0BACP,IAAI;uBACtB,KAAK;oBACO,IAAI;sBACF,IAAI;;EAyHzC,iBAAiB;IACf,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;MAC5C,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;KACxB;IACD,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;MAC3C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;KACxD;IACD,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACzD,IAAI,WAAW,EAAE;MACf,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;KACzB;EACH,CAAC;EAED,oBAAoB;IAClB,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;EAC5D,CAAC;;;;;;;;;;;;;;;CAiGF","sourcesContent":["import { Component, Element, Fragment, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business } from '../../types';\nimport { postOrder } from '../../utils/api';\nimport { FelixOrder, postPerson } from '../../utils/felixApi';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-checkout',\n shadow: false,\n})\nexport class HemfixarnaCheckout {\n @State() date: string = '';\n @State() dateError: string | null = null;\n @State() generalError: string | null = null;\n @State() loading = false;\n @State() enteredPin: string = '';\n @Element() private el: HTMLElement;\n private pinTimeout: any;\n @State() selectedSubSource: string | null = null;\n @State() partnerOrderId: string | null = null;\n @State() showSources = false;\n @State() sellerID: string | null = null;\n @State() RefferalID: string | null = null;\n\n handleChangeDate = (e: Event) => {\n this.dateError = null;\n this.date = (e.target as HTMLInputElement).value;\n };\n\n handleChangeTerms = () => {\n this.generalError = null;\n };\n\n sendOrder = async () => {\n if (this.loading) return;\n this.loading = true;\n let order: FelixOrder = {\n firstName: state.creditSafeUser.firstName,\n lastName: state.creditSafeUser.lastName,\n street: state.user.street,\n zip: state.user.zip,\n town: state.user.town,\n ssn: state.user.ssn,\n email: state.user.email,\n phone: state.user.phone,\n url: `${state.business === Business.string ? 'string' : state.business}-webk`,\n date: this.date,\n products: [\n ...state.cart.map(item => {\n const parts = item.parts.map(part => ({\n id: String(part.id),\n name: part.name,\n quantity: part.amount,\n rut: 0,\n rot: 0,\n }));\n return [\n {\n id: String(item.id),\n name: item.name,\n quantity: item.amount,\n rot: item.rot ? 1 : 0,\n rut: item.rut ? 1 : 0,\n },\n ...parts,\n ];\n }),\n ].flat(),\n creditSafe: state.creditSafeUser,\n customer: state.business,\n id_source: '',\n id_sub_source: '',\n seller_id: this.sellerID ?? '',\n referral_id: this.RefferalID ?? '',\n };\n\n const felixOrder = await postPerson(order);\n if (!felixOrder || !felixOrder.response?.scriptResult?.includes('OK')) {\n order = { ...order, felixStatus: 'error' };\n } else {\n order = { ...order, felixStatus: 'success' };\n }\n\n try {\n const { data: orderConfirm, status } = await postOrder(order);\n if (orderConfirm && status && status === 200) {\n state.step = 6;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n } else {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n } catch (error) {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n this.loading = false;\n };\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n this.generalError = null;\n const validDate = this.date.length > 0;\n if (!validDate) {\n this.dateError = 'Ange ett giltigt datum';\n }\n const checkBoxes = Array.from(this.el.querySelectorAll('input[type=\"checkbox\"]'));\n const notValidTerms = checkBoxes.find(i => !(i as HTMLInputElement).checked);\n if (notValidTerms) {\n this.generalError = 'Du måste godkänna villkoren';\n }\n // if (state.customer.source) {\n // if (!this.sellerID) {\n // this.generalError = 'Ange säljare';\n // return;\n // }\n // if (state.customer.source.sub_sources?.length && !this.selectedSubSource) {\n // this.generalError = 'Välj underkälla';\n // return;\n // }\n // }\n if (validDate && !notValidTerms) {\n this.sendOrder();\n }\n };\n\n handleKeyDown = (event: KeyboardEvent) => {\n this.enteredPin += event.key;\n\n const correctPin = '+0033';\n\n if (this.enteredPin.length === correctPin.length) {\n if (this.enteredPin === correctPin) {\n localStorage.setItem('show_sources', 'true');\n this.showSources = true;\n window.removeEventListener('keydown', this.handleKeyDown);\n }\n this.enteredPin = '';\n }\n\n clearTimeout(this.pinTimeout);\n this.pinTimeout = setTimeout(() => (this.enteredPin = ''), 5000);\n };\n\n componentWillLoad() {\n if (Boolean(state.user && state.user.street)) {\n state.checkoutStep = 2;\n }\n if (state.customer && state.customer.source) {\n window.addEventListener('keydown', this.handleKeyDown);\n }\n const showSources = localStorage.getItem('show_sources');\n if (showSources) {\n this.showSources = true;\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('keydown', this.handleKeyDown);\n }\n\n render = () => {\n const dateLogo = getAssetPath(`./assets/date.svg`);\n const down = getAssetPath(`./assets/down.svg`);\n const loading = getAssetPath(`./assets/spinner.gif`);\n\n if (state.checkoutEdit) {\n return <hemfixarna-address />;\n } else if (state.checkoutStep === 1) {\n return <hemfixarna-getuser />;\n } else if (state.checkoutStep === 2) {\n return (\n <div class=\"mb-2\">\n <div class=\"hemfixarna_addressinfo\">\n <div>\n <p>{hideField(state.user.firstName)}</p>\n <p>{hideField(state.user.lastName)}</p>\n <p>{state.user.email}</p>\n <p>{state.user.phone}</p>\n </div>\n <div>\n <p>{hideField(state.user.street)}</p>\n <p>{hideField(state.user.zip)}</p>\n <p>{hideField(state.user.town)}</p>\n </div>\n <button onClick={() => (state.checkoutEdit = true)}>Behöver du ändra adressen?</button>\n </div>\n <form onSubmit={e => this.handleSubmit(e)}>\n <div>\n <img src={dateLogo} width={24} />\n <input\n class={`${this.date.length ? 'input_active' : ''}`}\n min={new Date().toISOString().split('T')[0]}\n onChange={e => this.handleChangeDate(e)}\n type=\"date\"\n name=\"date\"\n value={this.date}\n />\n <label htmlFor=\"date\">Tidigaste datum för hembesök</label>\n <img src={down} width={24} />\n </div>\n {this.dateError && <span>{this.dateError}</span>}\n {state.customer.source && this.showSources ? (\n <Fragment>\n <p>\n Inloggad som:\n <strong> {state.customer.source.fieldData.So01_Name}</strong>\n </p>\n <label>\n Säljare (SäljarId)\n <input type=\"text\" value={this.sellerID} onChange={e => (this.sellerID = (e.target as HTMLInputElement).value)} />\n </label>\n <label>\n PartnerOrderID (RefferalID)\n <input type=\"text\" value={this.RefferalID} onChange={e => (this.RefferalID = (e.target as HTMLInputElement).value)} />\n </label>\n {state.customer.source.sub_sources?.length ? (\n <div>\n <select onChange={e => (this.selectedSubSource = (e.target as HTMLSelectElement).value)}>\n <option disabled selected value=\"null\">\n Välj underkälla\n </option>\n {state.customer.source.sub_sources.map(sub => (\n <option value={sub['So_SubSource::_id']}>{sub['So_SubSource::Sus01_Name']}</option>\n ))}\n </select>\n </div>\n ) : (\n <h4>Det finns inga underkällor att välja</h4>\n )}\n </Fragment>\n ) : null}\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span innerHTML={state.options.terms} />\n </label>\n {state.cart\n .filter(i => i.terms_checkout?.length)\n .map(item => (\n <Fragment>\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span>{item.terms_checkout}</span>\n </label>\n </Fragment>\n ))}\n {this.generalError && <span>{this.generalError}</span>}\n <div class={this.loading ? 'loading' : ''}>\n <input type=\"submit\" value={this.loading ? '' : 'Skicka bokning'} />\n <img width={20} height={20} src={loading} alt=\"spinner\" />\n </div>\n </form>\n </div>\n );\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;;;CAiGF","sourcesContent":["import { Component, Element, Fragment, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business } from '../../types';\nimport { postOrder } from '../../utils/api';\nimport { FelixOrder, postPerson } from '../../utils/felixApi';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-checkout',\n shadow: false,\n})\nexport class HemfixarnaCheckout {\n @State() date: string = '';\n @State() dateError: string | null = null;\n @State() generalError: string | null = null;\n @State() loading = false;\n @State() enteredPin: string = '';\n @Element() private el: HTMLElement;\n @State() selectedSubSource: string | null = null;\n @State() partnerOrderId: string | null = null;\n @State() sellerID: string | null = null;\n @State() RefferalID: string | null = null;\n\n handleChangeDate = (e: Event) => {\n this.dateError = null;\n this.date = (e.target as HTMLInputElement).value;\n };\n\n handleChangeTerms = () => {\n this.generalError = null;\n };\n\n sendOrder = async () => {\n if (this.loading) return;\n this.loading = true;\n let order: FelixOrder = {\n firstName: state.creditSafeUser.firstName,\n lastName: state.creditSafeUser.lastName,\n street: state.user.street,\n zip: state.user.zip,\n town: state.user.town,\n ssn: state.user.ssn,\n email: state.user.email,\n phone: state.user.phone,\n url: `${state.business === Business.string ? 'string' : state.business}-webk`,\n date: this.date,\n products: [\n ...state.cart.map(item => {\n const parts = item.parts.map(part => ({\n id: String(part.id),\n name: part.name,\n quantity: part.amount,\n rut: 0,\n rot: 0,\n }));\n return [\n {\n id: String(item.id),\n name: item.name,\n quantity: item.amount,\n rot: item.rot ? 1 : 0,\n rut: item.rut ? 1 : 0,\n },\n ...parts,\n ];\n }),\n ].flat(),\n creditSafe: state.creditSafeUser,\n customer: state.business,\n id_source: '',\n id_sub_source: '',\n seller_id: this.sellerID ?? '',\n referral_id: this.RefferalID ?? '',\n };\n\n const felixOrder = await postPerson(order);\n if (!felixOrder || !felixOrder.response?.scriptResult?.includes('OK')) {\n order = { ...order, felixStatus: 'error' };\n } else {\n order = { ...order, felixStatus: 'success' };\n }\n\n try {\n const { data: orderConfirm, status } = await postOrder(order);\n if (orderConfirm && status && status === 200) {\n state.step = 6;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n } else {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n } catch (error) {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n this.loading = false;\n };\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n this.generalError = null;\n const validDate = this.date.length > 0;\n if (!validDate) {\n this.dateError = 'Ange ett giltigt datum';\n }\n const checkBoxes = Array.from(this.el.querySelectorAll('input[type=\"checkbox\"]'));\n const notValidTerms = checkBoxes.find(i => !(i as HTMLInputElement).checked);\n if (notValidTerms) {\n this.generalError = 'Du måste godkänna villkoren';\n }\n if (state.customer.source && state.selectSource) {\n if (!this.sellerID) {\n this.generalError = 'Ange säljare';\n return;\n }\n if (state.customer.source.sub_sources?.length && !this.selectedSubSource) {\n this.generalError = 'Välj underkälla';\n return;\n }\n }\n if (validDate && !notValidTerms) {\n this.sendOrder();\n }\n };\n\n componentWillLoad() {\n if (Boolean(state.user && state.user.street)) {\n state.checkoutStep = 2;\n }\n }\n\n render = () => {\n const dateLogo = getAssetPath(`./assets/date.svg`);\n const down = getAssetPath(`./assets/down.svg`);\n const loading = getAssetPath(`./assets/spinner.gif`);\n\n if (state.checkoutEdit) {\n return <hemfixarna-address />;\n } else if (state.checkoutStep === 1) {\n return <hemfixarna-getuser />;\n } else if (state.checkoutStep === 2) {\n return (\n <div class=\"mb-2\">\n <div class=\"hemfixarna_addressinfo\">\n <div>\n <p>{hideField(state.user.firstName)}</p>\n <p>{hideField(state.user.lastName)}</p>\n <p>{state.user.email}</p>\n <p>{state.user.phone}</p>\n </div>\n <div>\n <p>{hideField(state.user.street)}</p>\n <p>{hideField(state.user.zip)}</p>\n <p>{hideField(state.user.town)}</p>\n </div>\n <button onClick={() => (state.checkoutEdit = true)}>Behöver du ändra adressen?</button>\n </div>\n <form onSubmit={e => this.handleSubmit(e)}>\n <div>\n <img src={dateLogo} width={24} />\n <input\n class={`${this.date.length ? 'input_active' : ''}`}\n min={new Date().toISOString().split('T')[0]}\n onChange={e => this.handleChangeDate(e)}\n type=\"date\"\n name=\"date\"\n value={this.date}\n />\n <label htmlFor=\"date\">Tidigaste datum för hembesök</label>\n <img src={down} width={24} />\n </div>\n {this.dateError && <span>{this.dateError}</span>}\n {state.customer.source && state.selectSource ? (\n <Fragment>\n <p>\n Inloggad som:\n <strong> {state.customer.source.fieldData.So01_Name}</strong>\n </p>\n <label>\n Säljare (SäljarId)\n <input type=\"text\" value={this.sellerID} onChange={e => (this.sellerID = (e.target as HTMLInputElement).value)} />\n </label>\n <label>\n PartnerOrderID (RefferalID)\n <input type=\"text\" value={this.RefferalID} onChange={e => (this.RefferalID = (e.target as HTMLInputElement).value)} />\n </label>\n {state.customer.source.sub_sources?.length ? (\n <div>\n <select onChange={e => (this.selectedSubSource = (e.target as HTMLSelectElement).value)}>\n <option disabled selected value=\"null\">\n Välj underkälla\n </option>\n {state.customer.source.sub_sources.map(sub => (\n <option value={sub['So_SubSource::_id']}>{sub['So_SubSource::Sus01_Name']}</option>\n ))}\n </select>\n </div>\n ) : (\n <p>Det finns inga underkällor att välja</p>\n )}\n </Fragment>\n ) : null}\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span innerHTML={state.options.terms} />\n </label>\n {state.cart\n .filter(i => i.terms_checkout?.length)\n .map(item => (\n <Fragment>\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span>{item.terms_checkout}</span>\n </label>\n </Fragment>\n ))}\n {this.generalError && <span>{this.generalError}</span>}\n <div class={this.loading ? 'loading' : ''}>\n <input type=\"submit\" value={this.loading ? '' : 'Skicka bokning'} />\n <img width={20} height={20} src={loading} alt=\"spinner\" />\n </div>\n </form>\n </div>\n );\n }\n };\n}\n"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Fragment, getAssetPath, h } from '@stencil/core';
|
2
2
|
import state from '../../store';
|
3
3
|
import { WidgetStyle } from '../../types';
|
4
|
-
import { getCustomer, getGreenDiscount, getOptions, getRot, getRut } from '../../utils/api';
|
4
|
+
import { getCustomer, getGreenDiscount, getOptions, getRot, getRut, loginCustomer } from '../../utils/api';
|
5
5
|
import { getProductPriceWithRotAndRut } from '../../utils/calc';
|
6
6
|
import { scrollToTop } from '../../utils/scroll';
|
7
7
|
export class HemfixarnaComponent {
|
@@ -14,11 +14,13 @@ export class HemfixarnaComponent {
|
|
14
14
|
this.showModal = false;
|
15
15
|
this.product = null;
|
16
16
|
this.id = undefined;
|
17
|
+
this.slug = undefined;
|
17
18
|
this.business = undefined;
|
18
19
|
this.widgetStyle = WidgetStyle.standard;
|
19
20
|
this.buttonColor = undefined;
|
20
21
|
this.buttonBg = undefined;
|
21
22
|
this.proppedProduct = null;
|
23
|
+
this.loginSourceError = null;
|
22
24
|
}
|
23
25
|
loadCategoryOrProduct(id) {
|
24
26
|
this.proppedProduct = null;
|
@@ -76,13 +78,14 @@ export class HemfixarnaComponent {
|
|
76
78
|
}
|
77
79
|
else if (customer) {
|
78
80
|
state.customer = customer;
|
79
|
-
|
80
|
-
|
81
|
+
const id = this.id || this.slug;
|
82
|
+
if (id) {
|
83
|
+
if (id === 'maleri') {
|
81
84
|
state.maleri = true;
|
82
85
|
state.step = 4;
|
83
86
|
}
|
84
87
|
else {
|
85
|
-
this.loadCategoryOrProduct(
|
88
|
+
this.loadCategoryOrProduct(id);
|
86
89
|
}
|
87
90
|
}
|
88
91
|
}
|
@@ -94,6 +97,9 @@ export class HemfixarnaComponent {
|
|
94
97
|
state.rutOptions = rut;
|
95
98
|
state.greenOptions = greenDiscount;
|
96
99
|
state.options = options;
|
100
|
+
if (localStorage.getItem('select_source')) {
|
101
|
+
state.selectSource = true;
|
102
|
+
}
|
97
103
|
}
|
98
104
|
// Open close modal && click outside event
|
99
105
|
openModal() {
|
@@ -120,6 +126,25 @@ export class HemfixarnaComponent {
|
|
120
126
|
}
|
121
127
|
}
|
122
128
|
}
|
129
|
+
async handleLogin() {
|
130
|
+
this.loginSourceError = null;
|
131
|
+
const passwordInput = this.el.shadowRoot.querySelector('input[type="password"]');
|
132
|
+
const password = passwordInput.value;
|
133
|
+
try {
|
134
|
+
const status = await loginCustomer({ id: state.customer.ID, password: password });
|
135
|
+
if (status === 200) {
|
136
|
+
state.showSourcePasswordPrompt = false;
|
137
|
+
state.selectSource = true;
|
138
|
+
}
|
139
|
+
else {
|
140
|
+
this.loginSourceError = 'Fel lösenord';
|
141
|
+
}
|
142
|
+
}
|
143
|
+
catch (error) {
|
144
|
+
console.log(error);
|
145
|
+
this.loginSourceError = 'Fel lösenord';
|
146
|
+
}
|
147
|
+
}
|
123
148
|
getCartLength() {
|
124
149
|
return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
|
125
150
|
}
|
@@ -131,7 +156,10 @@ export class HemfixarnaComponent {
|
|
131
156
|
return (h("div", { class: `hemfixarna hemfixarna-${this.business}` }, h("div", { class: `hemfixarna_box hemfixarna_box--${this.widgetStyle}` }, [WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) ? (h("img", { src: this.id === 'maleri' ? pensel : monteringLogo, alt: "montering logo", width: 32, height: 32 })) : null, h("div", null, h("div", null, h("p", { onClick: () => this.openModal(), class: `pointer ${[WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) && state.selectedProduct ? 'underline' : ''}` }, this.id === 'maleri' ? (h("span", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r")) : (h(Fragment, null, !state.selectedCustomerCategory && !this.product && !this.proppedProduct ? (h(Fragment, null, ((_a = state.customer) === null || _a === void 0 ? void 0 : _a.widget_title) ? (h("span", null, state.customer.widget_title)) : (h("span", null, "Montering/Installation - ", h("strong", { class: "underline" }, "se priser h\u00E4r"))))) : (h(Fragment, null, ((_b = this.product) === null || _b === void 0 ? void 0 : _b.title) || ((_c = this.proppedProduct) === null || _c === void 0 ? void 0 : _c.title) || ((_d = state.selectedCustomerCategory) === null || _d === void 0 ? void 0 : _d.widget_title) || (h("span", null, "Montering", h("wbr", null), "/Installation ", (_f = (_e = state.selectedCustomerCategory) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : 'på plats', " - ", h("strong", { class: "underline" }, "se priser h\u00E4r"))), this.proppedProduct && !((_g = this.product) === null || _g === void 0 ? void 0 : _g.invoice) && !((_h = this.proppedProduct) === null || _h === void 0 ? void 0 : _h.invoice) ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || this.product), "kr"))) : null)))))), this.widgetStyle === WidgetStyle.standard ? h("img", { src: logo, width: 104 }) : null, this.widgetStyle === WidgetStyle.alternative ? (h("span", { class: "p-s" }, "Utf\u00F6rs av ", h("strong", null, "Hemfixarna"))) : null), [WidgetStyle.standard, WidgetStyle.alternative].includes(this.widgetStyle) ? (h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn", style: {
|
132
157
|
color: ((_j = this.buttonColor) === null || _j === void 0 ? void 0 : _j.startsWith('#')) || !((_k = this.buttonColor) === null || _k === void 0 ? void 0 : _k.length) ? this.buttonColor : `#${this.buttonColor}`,
|
133
158
|
backgroundColor: ((_l = this.buttonBg) === null || _l === void 0 ? void 0 : _l.startsWith('#')) || !((_m = this.buttonBg) === null || _m === void 0 ? void 0 : _m.length) ? this.buttonBg : `#${this.buttonBg}`,
|
134
|
-
} }, "Best\u00E4ll h\u00E4r", this.getCartLength() > 0 && h("span", null, this.getCartLength()))) : null, WidgetStyle.alternative_2 === this.widgetStyle ? (h("div", { class: "hemfixarna_altbtn" }, h("strong", { class: "p-s" }, "Utf\u00F6rs av"), h("img", { src: logo, alt: "hemfixarna logo", width: 98 }))) : null), this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, state.modal.title && h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", { innerHTML: t }))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), state.
|
159
|
+
} }, "Best\u00E4ll h\u00E4r", this.getCartLength() > 0 && h("span", null, this.getCartLength()))) : null, WidgetStyle.alternative_2 === this.widgetStyle ? (h("div", { class: "hemfixarna_altbtn" }, h("strong", { class: "p-s" }, "Utf\u00F6rs av"), h("img", { src: logo, alt: "hemfixarna logo", width: 98 }))) : null), this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, state.modal.title && h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", { innerHTML: t }))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), state.showSourcePasswordPrompt ? (h("div", { class: "hemfixarna_source--pw hemfixarna_infomodal" }, h("form", { onSubmit: e => {
|
160
|
+
e.preventDefault();
|
161
|
+
this.handleLogin();
|
162
|
+
} }, h("input", { type: "password", placeholder: "L\u00F6senord" }), h("input", { type: "submit", value: "Logga in" }), this.loginSourceError && h("span", null, "Fel l\u00F6senord")))) : null, state.customer && h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal() }), h("div", { class: `hemfixarna_content hemfixarna_content--${state.step} ${state.step === 4 && state.maleri ? 'hemfixarna_content--painting' : ''}` }, state.step < 4 && h("hemfixarna-start", null), state.step === 4 && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", null), state.step === 6 && h("hemfixarna-order", null))), h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
|
135
163
|
}
|
136
164
|
static get is() { return "hemfixarna-component"; }
|
137
165
|
static get encapsulation() { return "shadow"; }
|
@@ -165,6 +193,23 @@ export class HemfixarnaComponent {
|
|
165
193
|
"attribute": "id",
|
166
194
|
"reflect": false
|
167
195
|
},
|
196
|
+
"slug": {
|
197
|
+
"type": "string",
|
198
|
+
"mutable": false,
|
199
|
+
"complexType": {
|
200
|
+
"original": "string",
|
201
|
+
"resolved": "string",
|
202
|
+
"references": {}
|
203
|
+
},
|
204
|
+
"required": false,
|
205
|
+
"optional": true,
|
206
|
+
"docs": {
|
207
|
+
"tags": [],
|
208
|
+
"text": ""
|
209
|
+
},
|
210
|
+
"attribute": "slug",
|
211
|
+
"reflect": false
|
212
|
+
},
|
168
213
|
"business": {
|
169
214
|
"type": "string",
|
170
215
|
"mutable": false,
|
@@ -251,7 +296,8 @@ export class HemfixarnaComponent {
|
|
251
296
|
"modal": {},
|
252
297
|
"showModal": {},
|
253
298
|
"product": {},
|
254
|
-
"proppedProduct": {}
|
299
|
+
"proppedProduct": {},
|
300
|
+
"loginSourceError": {}
|
255
301
|
};
|
256
302
|
}
|
257
303
|
static get elementRef() { return "el"; }
|