hemfixarna-web-components 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{collection/utils/api.js → hemfixarna-components/api-36f73d0d.js} +6 -4
- package/dist/hemfixarna-components/api-36f73d0d.js.map +1 -0
- package/dist/hemfixarna-components/app-globals-0f993ce5.js +5 -0
- package/dist/hemfixarna-components/app-globals-0f993ce5.js.map +1 -0
- package/dist/{collection/utils/calc.js → hemfixarna-components/calc-4c79b798.js} +6 -3
- package/dist/hemfixarna-components/calc-4c79b798.js.map +1 -0
- package/dist/hemfixarna-components/css-shim-62d2171c.js +6 -0
- package/dist/hemfixarna-components/css-shim-62d2171c.js.map +1 -0
- package/dist/hemfixarna-components/dom-46a68c9b.js +75 -0
- package/dist/hemfixarna-components/dom-46a68c9b.js.map +1 -0
- package/dist/{collection/utils/form.js → hemfixarna-components/form-c53dca29.js} +4 -2
- package/dist/hemfixarna-components/form-c53dca29.js.map +1 -0
- package/dist/{collection/components/hemfixarna-address/hemfixarna-address.js → hemfixarna-components/hemfixarna-address.entry.js} +14 -20
- package/dist/hemfixarna-components/hemfixarna-address.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-box.entry.js +49 -0
- package/dist/hemfixarna-components/hemfixarna-box.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js → hemfixarna-components/hemfixarna-breadcrumbs.entry.js} +13 -84
- package/dist/hemfixarna-components/hemfixarna-breadcrumbs.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js +27 -0
- package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-cart/hemfixarna-cart.js → hemfixarna-components/hemfixarna-cart.entry.js} +11 -31
- package/dist/hemfixarna-components/hemfixarna-cart.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-category.tsx/hemfixarna-category.js → hemfixarna-components/hemfixarna-category.entry.js} +12 -6
- package/dist/hemfixarna-components/hemfixarna-category.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-checkout/hemfixarna-checkout.js → hemfixarna-components/hemfixarna-checkout.entry.js} +38 -33
- package/dist/hemfixarna-components/hemfixarna-checkout.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-component.entry.js +248 -0
- package/dist/hemfixarna-components/hemfixarna-component.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +162 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
- package/dist/{collection/components/hemfixarna-contact/hemfixarna-contact.js → hemfixarna-components/hemfixarna-contact.entry.js} +10 -28
- package/dist/hemfixarna-components/hemfixarna-contact.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-demo/hemfixarna-demo.js → hemfixarna-components/hemfixarna-demo.entry.js} +23 -46
- package/dist/hemfixarna-components/hemfixarna-demo.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-doro.entry.js +23 -0
- package/dist/hemfixarna-components/hemfixarna-doro.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-elfa.entry.js +24 -0
- package/dist/hemfixarna-components/hemfixarna-elfa.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js +23 -0
- package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-getuser.entry.js +770 -0
- package/dist/hemfixarna-components/hemfixarna-getuser.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js +24 -0
- package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-info/hemfixarna-info.js → hemfixarna-components/hemfixarna-info.entry.js} +11 -7
- package/dist/hemfixarna-components/hemfixarna-info.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-invoice/hemfixarna-invoice.js → hemfixarna-components/hemfixarna-invoice.entry.js} +16 -27
- package/dist/hemfixarna-components/hemfixarna-invoice.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-klint.entry.js +20 -0
- package/dist/hemfixarna-components/hemfixarna-klint.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-kund.entry.js +20 -0
- package/dist/hemfixarna-components/hemfixarna-kund.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-order/hemfixarna-order.js → hemfixarna-components/hemfixarna-order.entry.js} +11 -31
- package/dist/hemfixarna-components/hemfixarna-order.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js → hemfixarna-components/hemfixarna-orderrows.entry.js} +12 -50
- package/dist/hemfixarna-components/hemfixarna-orderrows.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-power.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-power.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-product/hemfixarna-product.js → hemfixarna-components/hemfixarna-product.entry.js} +18 -27
- package/dist/hemfixarna-components/hemfixarna-product.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-service/hemfixarna-service.js → hemfixarna-components/hemfixarna-service.entry.js} +12 -6
- package/dist/hemfixarna-components/hemfixarna-service.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-skanska.entry.js +24 -0
- package/dist/hemfixarna-components/hemfixarna-skanska.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js.map +1 -0
- package/dist/{collection/components/hemfixarna-start/hemfixarna-start.js → hemfixarna-components/hemfixarna-start.entry.js} +11 -48
- package/dist/hemfixarna-components/hemfixarna-start.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js +23 -0
- package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-superfront.entry.js +20 -0
- package/dist/hemfixarna-components/hemfixarna-superfront.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-tesla.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-tesla.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js +20 -0
- package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js.map +1 -0
- package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js +21 -0
- package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js.map +1 -0
- package/dist/hemfixarna-components/index-b6a6e994.js +256 -0
- package/dist/hemfixarna-components/index-b6a6e994.js.map +1 -0
- package/dist/{collection/types/index.js → hemfixarna-components/index-d90ad11b.js} +7 -4
- package/dist/hemfixarna-components/index-d90ad11b.js.map +1 -0
- package/dist/hemfixarna-components/index-f1a87cf1.js +3397 -0
- package/dist/{cjs/hemfixarna-address_36.cjs.entry.js.map → hemfixarna-components/index-f1a87cf1.js.map} +1 -1
- package/dist/hemfixarna-components/index.esm.js +1 -0
- package/dist/hemfixarna-components/index.esm.js.map +1 -1
- package/dist/{collection/utils/scroll.js → hemfixarna-components/scroll-6c26b5da.js} +4 -2
- package/dist/hemfixarna-components/scroll-6c26b5da.js.map +1 -0
- package/dist/hemfixarna-components/shadow-css-05e0c1f4.js +389 -0
- package/dist/hemfixarna-components/shadow-css-05e0c1f4.js.map +1 -0
- package/dist/{collection/utils/types.js → hemfixarna-components/types-641c9a1c.js} +6 -3
- package/dist/hemfixarna-components/types-641c9a1c.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/hemfixarna-address_36.cjs.entry.js +0 -2763
- package/dist/cjs/hemfixarna-components.cjs.js +0 -28
- package/dist/cjs/hemfixarna-components.cjs.js.map +0 -1
- package/dist/cjs/index-b83343b9.js +0 -1687
- package/dist/cjs/index-b83343b9.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -4
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -24
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/collection/assets/back.svg +0 -3
- package/dist/collection/assets/cart.svg +0 -10
- package/dist/collection/assets/checked.svg +0 -10
- package/dist/collection/assets/close.svg +0 -5
- package/dist/collection/assets/copy.png +0 -0
- package/dist/collection/assets/date.svg +0 -6
- package/dist/collection/assets/down.svg +0 -3
- package/dist/collection/assets/drag-drop.svg +0 -3
- package/dist/collection/assets/elfa.png +0 -0
- package/dist/collection/assets/gubbe-pensel.svg +0 -1
- package/dist/collection/assets/hemfixarna.svg +0 -11
- package/dist/collection/assets/hornbach/logo.svg +0 -42
- package/dist/collection/assets/hornbach/nav.jpg +0 -0
- package/dist/collection/assets/info.svg +0 -5
- package/dist/collection/assets/kbygg.svg +0 -29
- package/dist/collection/assets/minus.svg +0 -4
- package/dist/collection/assets/montering.svg +0 -15
- package/dist/collection/assets/norrgavel.svg +0 -1
- package/dist/collection/assets/pensel.svg +0 -1
- package/dist/collection/assets/plus.svg +0 -5
- package/dist/collection/assets/spinner.gif +0 -0
- package/dist/collection/assets/tesla.svg +0 -1
- package/dist/collection/assets/zaptec.svg +0 -1
- package/dist/collection/collection-manifest.json +0 -47
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.css +0 -0
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +0 -184
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.css +0 -0
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js +0 -123
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.css +0 -0
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js +0 -142
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js +0 -132
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js +0 -132
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.css +0 -0
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js +0 -123
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.css +0 -0
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js +0 -142
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js +0 -132
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js +0 -113
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js +0 -113
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js +0 -132
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js +0 -131
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.css +0 -0
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js +0 -141
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js +0 -131
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js +0 -123
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string.css +0 -0
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js +0 -113
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js +0 -132
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js +0 -113
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js.map +0 -1
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js +0 -132
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js.map +0 -1
- package/dist/collection/components/hemfixarna-address/hemfixarna-address.js.map +0 -1
- package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +0 -138
- package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +0 -1
- package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +0 -1
- package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +0 -1
- package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js.map +0 -1
- package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +0 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +0 -483
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +0 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna.css +0 -1031
- package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js.map +0 -1
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +0 -135
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +0 -1
- package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js +0 -91
- package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js.map +0 -1
- package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +0 -1
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.css +0 -76
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +0 -1
- package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +0 -1
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +0 -1
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.css +0 -0
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +0 -1
- package/dist/collection/components/hemfixarna-service/hemfixarna-service.js.map +0 -1
- package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +0 -1
- package/dist/collection/index.js +0 -2
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/store/index.js +0 -62
- package/dist/collection/store/index.js.map +0 -1
- package/dist/collection/types/felixtypes.js +0 -3
- package/dist/collection/types/felixtypes.js.map +0 -1
- package/dist/collection/types/index.js.map +0 -1
- package/dist/collection/utils/api.js.map +0 -1
- package/dist/collection/utils/calc.js.map +0 -1
- package/dist/collection/utils/creditSafe.js +0 -18
- package/dist/collection/utils/creditSafe.js.map +0 -1
- package/dist/collection/utils/felixApi.js +0 -18
- package/dist/collection/utils/felixApi.js.map +0 -1
- package/dist/collection/utils/felixFunctions.js +0 -189
- package/dist/collection/utils/felixFunctions.js.map +0 -1
- package/dist/collection/utils/form.js.map +0 -1
- package/dist/collection/utils/scroll.js.map +0 -1
- package/dist/collection/utils/types.js.map +0 -1
- package/dist/esm/hemfixarna-address_36.entry.js +0 -2724
- package/dist/esm/hemfixarna-address_36.entry.js.map +0 -1
- package/dist/esm/hemfixarna-components.js +0 -23
- package/dist/esm/hemfixarna-components.js.map +0 -1
- package/dist/esm/index-8c417125.js +0 -1656
- package/dist/esm/index-8c417125.js.map +0 -1
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js +0 -20
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/hemfixarna-components/p-211cfa04.entry.js +0 -2
- package/dist/hemfixarna-components/p-211cfa04.entry.js.map +0 -1
- package/dist/hemfixarna-components/p-852e7173.js +0 -3
- package/dist/hemfixarna-components/p-852e7173.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
@@ -1,62 +0,0 @@
|
|
1
|
-
import { createStore } from '@stencil/store';
|
2
|
-
const { state, onChange, } = createStore({
|
3
|
-
step: 1,
|
4
|
-
checkoutStep: 1,
|
5
|
-
checkoutEdit: false,
|
6
|
-
selectedCategory: null,
|
7
|
-
selectedService: null,
|
8
|
-
selectedProduct: null,
|
9
|
-
cart: [],
|
10
|
-
business: 'undefined',
|
11
|
-
options: null,
|
12
|
-
rut: true,
|
13
|
-
rot: true,
|
14
|
-
green: true,
|
15
|
-
token: null,
|
16
|
-
user: null,
|
17
|
-
modal: null,
|
18
|
-
rutOptions: null,
|
19
|
-
rotOptions: null,
|
20
|
-
greenOptions: null,
|
21
|
-
customer: null,
|
22
|
-
selectedCustomerCategory: null,
|
23
|
-
parentCategory: null,
|
24
|
-
creditSafeUser: null,
|
25
|
-
checkoutInvoice: false,
|
26
|
-
maleri: false,
|
27
|
-
sources: null,
|
28
|
-
});
|
29
|
-
onChange('cart', cart => {
|
30
|
-
window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
|
31
|
-
});
|
32
|
-
onChange('user', user => {
|
33
|
-
window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));
|
34
|
-
});
|
35
|
-
onChange('creditSafeUser', user => {
|
36
|
-
window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));
|
37
|
-
});
|
38
|
-
onChange('selectedProduct', product => {
|
39
|
-
if (!state.customer || !product)
|
40
|
-
return;
|
41
|
-
const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
|
42
|
-
const category = categories.find(c => c && c.id === product.category);
|
43
|
-
if (category) {
|
44
|
-
state.parentCategory = category;
|
45
|
-
return;
|
46
|
-
}
|
47
|
-
state.parentCategory = null;
|
48
|
-
});
|
49
|
-
onChange('selectedCustomerCategory', category => {
|
50
|
-
if (!state.customer || !category)
|
51
|
-
return;
|
52
|
-
if (category.parent) {
|
53
|
-
const parent = state.customer.categories.find(c => c.id === category.parent);
|
54
|
-
if (parent) {
|
55
|
-
state.parentCategory = parent;
|
56
|
-
return;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
state.parentCategory = null;
|
60
|
-
});
|
61
|
-
export default state;
|
62
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3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Ac,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, GreenOptions, Product, RotOptions, RutOptions, Service, User, WpOptions } from '../types';\nimport { CreditSafeUser } from '../types/felixtypes';\n\ntype StateType = {\n step: number;\n selectedCategory: Category | null;\n selectedService: Service | null;\n selectedProduct: Product | null;\n cart: Array<CartItem>;\n business: Business | 'undefined';\n options: WpOptions | null;\n rut: boolean;\n rot: boolean;\n green: boolean;\n token: string | null;\n checkoutStep: number;\n checkoutEdit: boolean;\n user: User | null;\n creditSafeUser: CreditSafeUser | null;\n modal: {\n title?: string;\n text: string[];\n } | null;\n rutOptions: RutOptions | null;\n rotOptions: RotOptions | null;\n greenOptions: GreenOptions | null;\n customer: Customer | null;\n selectedCustomerCategory: CustomerCategory | CustomerSubCategory | null;\n parentCategory: CustomerCategory | CustomerSubCategory;\n checkoutInvoice: boolean;\n maleri: boolean;\n};\n\nconst {\n state,\n onChange,\n}: {\n state: StateType;\n onChange: OnChangeHandler<StateType>;\n} = createStore({\n step: 1,\n checkoutStep: 1,\n checkoutEdit: false,\n selectedCategory: null,\n selectedService: null,\n selectedProduct: null,\n cart: [],\n business: 'undefined',\n options: null,\n rut: true,\n rot: true,\n green: true,\n token: null,\n user: null,\n modal: null,\n rutOptions: null,\n rotOptions: null,\n greenOptions: null,\n customer: null,\n selectedCustomerCategory: null,\n parentCategory: null,\n creditSafeUser: null,\n checkoutInvoice: false,\n maleri: false,\n sources: null,\n});\n\nonChange('cart', cart => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));\n});\n\nonChange('user', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));\n});\n\nonChange('creditSafeUser', user => {\n window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));\n});\n\nonChange('selectedProduct', product => {\n if (!state.customer || !product) return;\n const categories = [...state.customer.categories, ...state.customer.categories.map(c => c.sub_categories ?? [])].flat();\n const category = categories.find(c => c && c.id === product.category);\n if (category) {\n state.parentCategory = category;\n return;\n }\n state.parentCategory = null;\n});\n\nonChange('selectedCustomerCategory', category => {\n if (!state.customer || !category) return;\n if ((category as CustomerSubCategory).parent) {\n const parent = state.customer.categories.find(c => c.id === (category as CustomerSubCategory).parent);\n if (parent) {\n state.parentCategory = parent;\n return;\n }\n }\n state.parentCategory = null;\n});\n\nexport default state;\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"felixtypes.js","sourceRoot":"","sources":["../../src/types/felixtypes.ts"],"names":[],"mappings":"AA2BA,EAAE,CAAC","sourcesContent":["import { User } from '.';\n\ninterface FelixPerson {\n Pa01_FirstName: string;\n Pa02_LastName: string;\n Pa03_Address1: string;\n Pa04_Address2: string;\n Pa05_Zipcode: string;\n Pa06_City: string;\n Pa07_State: string;\n Pa08_Country: string;\n Pa12_PersonalNo: string;\n Pa20_Email: string;\n Pa30_Phone: string;\n Pa31_Phone2: string;\n Pa11_StatusExternal: string;\n Pa041_AssignmentAddress: string;\n Pa042_AssignmentZipCode: string;\n Pa043_AssignmentCity: string;\n}\n\ninterface GetFelixPersonRes {\n fieldData: FelixPerson;\n portalData: [];\n recordId: string;\n modId: string;\n}\n[];\n\ntype CreditSafeUser = Pick<User, 'firstName' | 'lastName' | 'street' | 'zip' | 'town'>;\n\nexport type { CreditSafeUser, FelixPerson, GetFelixPersonRes };\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAgMA,MAAM,CAAN,IAAY,QAqBX;AArBD,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;EACb,4BAAgB,CAAA;EAChB,mCAAuB,CAAA;EACvB,2CAA+B,CAAA;EAC/B,6BAAiB,CAAA;EACjB,2BAAe,CAAA;EACf,2BAAe,CAAA;EACf,qCAAyB,CAAA;EACzB,qBAAS,CAAA;EACT,uCAA2B,CAAA;EAC3B,2BAAe,CAAA;EACf,+CAAmC,CAAA;EACnC,qCAAyB,CAAA;AAC3B,CAAC,EArBW,QAAQ,KAAR,QAAQ,QAqBnB;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 logo?: Icon;\n partner_url?: string;\n at_hemfixarna: boolean;\n info_title: string;\n widget_title?: string;\n info_text: string;\n checkout_title: string;\n checkout_trust_badges: { text: string }[];\n trust_badges: { text: string }[];\n source?: Source;\n}\n\ninterface CustomerCategory {\n id: string;\n name: string;\n widget_title?: 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 widget_title?: 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 green: 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 green: 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 kbygg = 'k-bygg',\n norrgavel = 'norrgavel',\n fargvaruhuset = 'fargvaruhuset',\n zaptec = 'zaptec',\n tesla = 'tesla',\n klint = 'klint',\n flyttsmart = 'flyttsmart',\n lg = 'lg',\n sparfonster = 'sparfonster',\n power = 'power',\n traningspartner = 'traningspartner',\n superfront = 'superfront',\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\ninterface GreenOptions {\n green_start_fee_heading: string;\n green_start_fee_text: string;\n green_start_fee_text_secondary: string;\n}\n\ninterface SubSource {\n 'recordId': string;\n 'So_SubSource::Sus01_Name': string;\n 'So_SubSource::_id': string;\n 'So_SubSource::_id_Source': string;\n 'modId': string;\n}\n\ninterface FieldData {\n _id: string;\n So01_Name: string;\n So457_Aktiv_ac: number;\n So40_WebSubSource: string | number;\n So39_WebSource: number;\n rec_id: number;\n}\n\ninterface Source {\n fieldData: FieldData;\n sub_sources: SubSource[];\n}\n\ninterface SourcesRespone {\n dataInfo: {\n database: string;\n layout: string;\n table: string;\n totalRecordCount: number;\n foundCount: number;\n returnedCount: number;\n };\n data: Source[];\n}\n\nexport type {\n CartItem,\n CartPart,\n Category,\n Customer,\n CustomerCategory,\n CustomerSubCategory,\n GreenOptions,\n Icon,\n Part,\n Product,\n RotOptions,\n RutOptions,\n Service,\n Source,\n SourcesRespone,\n User,\n WpOptions,\n};\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,wCAAwC,CAAC;AAExH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAI,OAAoB,EAAE,OAAqB;EAChF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;EAC/C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;EACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,WAAW,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;EAC7C,IAAI,CAAC,QAAQ,EAAE;IACb,OAAO;GACR;EACD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EACpC,IAAI;IACF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACnD,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;GACzB;EAAC,OAAO,KAAK,EAAE;IACd,OAAO,C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;IACF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,iBAAiB,CAAC,CAAC;IAClD,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;GACzB;EAAC,OAAO,KAAK,EAAE;IACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;GACpB;AACH,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,KAAK,EAAE,IAAgB,EAAE,EAAE;EAC3C,IAAI;IACF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,WAAW,EAAE;MAC1C,MAAM,EAAE,MAAM;MACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAC1B,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;OACnC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA4E,CAAC;GACtG;EAAC,OAAO,KAAK,EAAE;IACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;GACpB;AACH,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { RotOptions, RutOptions, WpOptions } from '../types';\nimport { FelixOrder } from './felixApi';\n\nconst base = process.env.API_URL ? `${process.env.API_URL}/wp-json/headless` : 'https://hemfixarna.se/wp-json/headless';\n\nexport async function fetchWithType<T>(request: RequestInfo, options?: RequestInit): Promise<T> {\n const response = await fetch(request, options);\n const body = await response.json();\n return body;\n}\n\nconst getTaxonomy = async (endpoint: string) => {\n if (!endpoint) {\n return;\n }\n const type = endpoint.split('/')[0];\n const slug = endpoint.split('/')[1];\n try {\n const res = await fetch(`${base}/${type}/${slug}`);\n return await res.json();\n } catch (error) {\n console.log(error);\n }\n};\n\nconst getCustomer = async (slug: string) => {\n try {\n const res = await fetch(`${base}/customer/${slug}`);\n return await res.json();\n } catch (error) {\n console.log(error);\n }\n};\n\nconst getOptions = async () => {\n try {\n const res = await fetch(`${base}/webcoptions`);\n return (await res.json()) as WpOptions;\n } catch (error) {\n console.log(error);\n }\n};\n\nconst getRut = async () => {\n try {\n const data = await fetchWithType<RutOptions>(`${base}/rut`);\n return data;\n } catch (error) {\n console.log(error);\n }\n};\n\nconst getRot = async () => {\n try {\n const res = await fetch(`${base}/rot`);\n return (await res.json()) as RotOptions;\n } catch (error) {\n console.log(error);\n }\n};\n\nconst getGreenDiscount = async () => {\n try {\n const res = await fetch(`${base}/green-discount`);\n return await res.json();\n } catch (error) {\n console.log(error);\n }\n};\n\nconst postOrder = async (data: FelixOrder) => {\n try {\n const res = await fetch(`${base}/weborder`, {\n method: 'POST',\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n return (await res.json()) as { message: string; post_id: number; data: FelixOrder; status?: number };\n } catch (error) {\n console.log(error);\n }\n};\n\nexport { getCustomer, getGreenDiscount, getOptions, getRot, getRut, getTaxonomy, postOrder };\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"calc.js","sourceRoot":"","sources":["../../src/utils/calc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,UAAU,CAAC;AAG7B,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;EACpC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;EACpC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE;EACtC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,GAAG,EAAE;EAC1B,IAA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B,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;MACjD,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;IACxC,CAAC,EAAE,CAAC,CAAC,CAAC;IACN,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;EACxE,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;EAC1C,OAAO,iBAAiB,GAAG,cAAc,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,GAAG,EAAE;EACzB,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC;AAC/G,CAAC,CAAC;AAEF,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,4BAA4B,EAC5B,WAAW,EACX,cAAc,EACd,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,GACd,CAAC","sourcesContent":["import state from '../store';\nimport { CartItem, CartPart, Part, Product } from '../types';\n\nconst getRutPrice = (price: number) => {\n return Math.ceil(price / 2);\n};\n\nconst getRotPrice = (price: number) => {\n return Math.ceil(price * 0.7);\n};\n\nconst getGreenPrice = (price: number) => {\n return Math.ceil(price * 0.5);\n};\n\nconst getRutStartFee = () => {\n if (!state.options) return 448;\n if (state.rut) {\n return getRutPrice(state.options.start_fee);\n } else {\n return state.options.start_fee;\n }\n};\n\nconst getRotStartFee = () => {\n if (!state.options) return 448;\n if (state.rot) {\n return getRotPrice(state.options.start_fee);\n } else {\n return state.options.start_fee;\n }\n};\n\nconst getProductPrice = (product: Product | CartItem, price?: number, amount: number = 1) => {\n if (product.rot && state.rot) {\n return getRotPrice((price || product.price) * amount);\n } else if (product.rut && state.rut) {\n return getRutPrice((price || product.price) * amount);\n } else if (product.green && state.green) {\n return getGreenPrice((price || product.price) * amount);\n } else {\n return (price || product.price) * amount;\n }\n};\n\nconst getProductPriceWithRotAndRut = (product: Product) => {\n if (product.rot) {\n return getRotPrice(product.price);\n } else if (product.rut && state.rut) {\n return getRutPrice(product.price);\n } else {\n return product.price;\n }\n};\n\nconst getPartPrice = (part: Part | CartPart, product: Product | CartItem, amount: number = 1) => {\n if (product.rot && state.rot) {\n return getRotPrice(part.price * amount);\n } else if (product.rut && state.rut) {\n return getRutPrice(part.price * amount);\n } else {\n return part.price * amount;\n }\n};\n\nconst getStartFee = () => {\n if (!state.cart) return { rut: 0, rot: 0, green: 0 };\n const hasRut = state.cart.some(item => item.rut && item.start_fee);\n const hasRot = state.cart.some(item => item.rot && item.start_fee);\n const hasGreen = state.cart.some(item => item.green && item.start_fee);\n const rutPrice = state.rut ? getRutPrice(state.options.start_fee) : state.options.start_fee * 1;\n const rotPrice = state.rot ? getRotPrice(state.options.start_fee) : state.options.start_fee * 1;\n const greenPrice = state.green ? getGreenPrice(state.options.start_fee) : state.options.start_fee * 1;\n return { rut: hasRut ? rutPrice : 0, rot: hasRot ? rotPrice : 0, green: hasGreen ? greenPrice : 0, length: [hasRut, hasRot, hasGreen].filter(d => d).length };\n // if (hasRut && hasRot) {\n // return { rut: rutPrice, rot: rotPrice, length: 2 };\n // } else if (hasRut) {\n // return { rut: rutPrice, rot: 0, length: 1 };\n // } else if (hasRot) {\n // return { rut: 0, rot: rotPrice, length: 1 };\n // } else {\n // return { rut: 0, rot: 0, length: 0 };\n // }\n};\n\nconst getItemPrice = (item: CartItem) => {\n const partsPrice = item.parts.reduce((acc, curr) => {\n return acc + curr.price * curr.amount;\n }, 0);\n return getProductPrice(item, item.price * item.amount + partsPrice);\n};\n\nconst calculateRot = () => {\n const totalWithRot =\n state.cart.reduce((acc, curr) => {\n return curr.rot ? acc + getItemPrice(curr) : acc;\n }, 0) + getStartFee().rot;\n const totalWithoutRot =\n state.cart.reduce((acc, curr) => {\n const partsPrice = curr.parts.reduce((acc, curr) => {\n return acc + curr.price * curr.amount;\n }, 0);\n return curr.rot ? acc + curr.price * curr.amount + partsPrice : acc;\n }, 0) + Number(state.options.start_fee);\n return totalWithoutRot - totalWithRot;\n};\n\nconst calculateRut = () => {\n const totalWithRut =\n state.cart.reduce((acc, curr) => {\n return curr.rut ? acc + getItemPrice(curr) : acc;\n }, 0) + getStartFee().rut;\n const totalWithoutRut =\n state.cart.reduce((acc, curr) => {\n const partsPrice = curr.parts.reduce((acc, curr) => {\n return acc + curr.price * curr.amount;\n }, 0);\n return curr.rut ? acc + curr.price * curr.amount + partsPrice : acc;\n }, 0) + Number(state.options.start_fee);\n return totalWithoutRut - totalWithRut;\n};\n\nconst calculateGreenDiscount = () => {\n const totalWithGreen =\n state.cart.reduce((acc, curr) => {\n return curr.green ? acc + getItemPrice(curr) : acc;\n }, 0) + getStartFee().green;\n const totalWithoutGreen =\n state.cart.reduce((acc, curr) => {\n const partsPrice = curr.parts.reduce((acc, curr) => {\n return acc + curr.price * curr.amount;\n }, 0);\n return curr.green ? acc + curr.price * curr.amount + partsPrice : acc;\n }, 0) + Number(state.options.start_fee);\n return totalWithoutGreen - totalWithGreen;\n};\n\nconst getTotalPrice = () => {\n return state.cart.reduce((acc, curr) => acc + getItemPrice(curr), 0) + getStartFee().rot + getStartFee().rut;\n};\n\nexport {\n calculateGreenDiscount,\n calculateRot,\n calculateRut,\n getGreenPrice,\n getItemPrice,\n getPartPrice,\n getProductPrice,\n getProductPriceWithRotAndRut,\n getRotPrice,\n getRotStartFee,\n getRutPrice,\n getRutStartFee,\n getStartFee,\n getTotalPrice,\n};\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { MD5 } from 'md5-js-tools';
|
2
|
-
const apiSearch = async (query) => {
|
3
|
-
var _a;
|
4
|
-
const res = await fetch((_a = process.env.CREDIT_SAFE_API_URL) !== null && _a !== void 0 ? _a : 'https://hemfixare-lookup.vercel.app/api', {
|
5
|
-
method: 'POST',
|
6
|
-
headers: {
|
7
|
-
'Content-Type': 'application/json',
|
8
|
-
},
|
9
|
-
body: JSON.stringify({
|
10
|
-
query,
|
11
|
-
hash: MD5.generate(String.fromCharCode(83, 101, 67, 82, 101, 116) + query),
|
12
|
-
}),
|
13
|
-
});
|
14
|
-
const data = await res.json();
|
15
|
-
return data;
|
16
|
-
};
|
17
|
-
export default apiSearch;
|
18
|
-
//# sourceMappingURL=creditSafe.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"creditSafe.js","sourceRoot":"","sources":["../../src/utils/creditSafe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,MAAM,SAAS,GAAG,KAAK,EAAE,KAAa,EAA2B,EAAE;;EACjE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,mBAAmB,mCAAI,yCAAyC,EAAE;IACpG,MAAM,EAAE,MAAM;IACd,OAAO,EAAE;MACP,cAAc,EAAE,kBAAkB;KACnC;IACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;MACnB,KAAK;MACL,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;KAC3E,CAAC;GACH,CAAC,CAAC;EACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;EAC9B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { MD5 } from 'md5-js-tools';\nimport { CreditSafeUser } from '../types/felixtypes';\n\nconst apiSearch = async (query: string): Promise<CreditSafeUser> => {\n const res = await fetch(process.env.CREDIT_SAFE_API_URL ?? 'https://hemfixare-lookup.vercel.app/api', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n query,\n hash: MD5.generate(String.fromCharCode(83, 101, 67, 82, 101, 116) + query),\n }),\n });\n const data = await res.json();\n return data;\n};\n\nexport default apiSearch;\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { fetchWithType } from './api';
|
2
|
-
const base = process.env.API_URL ? `${process.env.API_URL}/wp-json/felix` : 'https://hemfixarna.se/wp-json/felix';
|
3
|
-
const postPerson = async (felixOrder) => {
|
4
|
-
try {
|
5
|
-
return await fetchWithType(`${base}/createperson`, {
|
6
|
-
method: 'POST',
|
7
|
-
body: JSON.stringify(felixOrder),
|
8
|
-
headers: {
|
9
|
-
'Content-Type': 'application/json',
|
10
|
-
},
|
11
|
-
});
|
12
|
-
}
|
13
|
-
catch (error) {
|
14
|
-
console.log(error);
|
15
|
-
}
|
16
|
-
};
|
17
|
-
export { postPerson };
|
18
|
-
//# sourceMappingURL=felixApi.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"felixApi.js","sourceRoot":"","sources":["../../src/utils/felixApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,qCAAqC,CAAC;AAsClH,MAAM,UAAU,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;EAClD,IAAI;IACF,OAAO,MAAM,aAAa,CAcxB,GAAG,IAAI,eAAe,EAAE;MACxB,MAAM,EAAE,MAAM;MACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;MAChC,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;OACnC;KACF,CAAC,CAAC;GACJ;EAAC,OAAO,KAAK,EAAE;IACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;GACpB;AACH,CAAC,CAAC;AAEF,OAAO,EAAc,UAAU,EAAE,CAAC","sourcesContent":["import { fetchWithType } from './api';\n\nconst base = process.env.API_URL ? `${process.env.API_URL}/wp-json/felix` : 'https://hemfixarna.se/wp-json/felix';\n\ninterface FelixOrder {\n firstName: string;\n lastName: string;\n street: string;\n zip: string;\n town: string;\n ssn: string;\n email: string;\n phone: string;\n url: string;\n date: string;\n notes?: string;\n wws?: string;\n referral_id?: string;\n id_source?: string;\n id_sub_source?: string;\n products: {\n id: string;\n name: string;\n quantity: number;\n rut: number;\n rot: number;\n }[];\n creditSafe: {\n firstName: string;\n lastName: string;\n street: string;\n zip: string;\n town: string;\n };\n felixStatus?: 'success' | 'error';\n customer?: string;\n seller_id?: string;\n refferal_id?: string;\n}\n\nconst postPerson = async (felixOrder: FelixOrder) => {\n try {\n return await fetchWithType<\n | {\n response: {\n scriptResult: string;\n scriptError: string;\n };\n messages: [\n {\n code: string;\n message: string;\n },\n ];\n }\n | false\n >(`${base}/createperson`, {\n method: 'POST',\n body: JSON.stringify(felixOrder),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n } catch (error) {\n console.log(error);\n }\n};\n\nexport { FelixOrder, postPerson };\n"]}
|
@@ -1,189 +0,0 @@
|
|
1
|
-
import axios from 'axios';
|
2
|
-
import { Buffer } from 'buffer';
|
3
|
-
import state from '../store';
|
4
|
-
const baseURL = process.env.FELIX_URL || 'https://stage.hemfixare.se/fmi/data/v1/databases/Hemfix_web/sessions';
|
5
|
-
// @ts-ignore
|
6
|
-
window.Buffer = Buffer;
|
7
|
-
let client;
|
8
|
-
async function initializeFelix() {
|
9
|
-
var _a;
|
10
|
-
const auth = Buffer.from('CustomWebForm:aFMZ4iJzoaEBcwskBDxqb4Pb').toString('base64');
|
11
|
-
const res = await apiCall('sessions', 'POST', null, auth);
|
12
|
-
return ((_a = res === null || res === void 0 ? void 0 : res.response) === null || _a === void 0 ? void 0 : _a.token) || null;
|
13
|
-
}
|
14
|
-
async function apiCall(endpoint, method, data, basic = false) {
|
15
|
-
var _a, _b;
|
16
|
-
if (!client) {
|
17
|
-
client = axios.create({
|
18
|
-
baseURL,
|
19
|
-
validateStatus: () => true,
|
20
|
-
});
|
21
|
-
}
|
22
|
-
// console.log(basic);
|
23
|
-
const headers = {
|
24
|
-
'Content-Type': 'application/json',
|
25
|
-
'Authorization': basic ? `Basic ${basic}` : `Bearer ${state.token ? state.token : ''}`,
|
26
|
-
// 'Access-Control-Allow-Origin': 'stage.hemfixare.se',
|
27
|
-
};
|
28
|
-
const config = {
|
29
|
-
method,
|
30
|
-
url: endpoint,
|
31
|
-
headers,
|
32
|
-
data,
|
33
|
-
};
|
34
|
-
try {
|
35
|
-
const response = await client.request(config);
|
36
|
-
return {
|
37
|
-
response: response.data,
|
38
|
-
};
|
39
|
-
}
|
40
|
-
catch (error) {
|
41
|
-
return {
|
42
|
-
error: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status,
|
43
|
-
message: ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) || error.message,
|
44
|
-
};
|
45
|
-
}
|
46
|
-
}
|
47
|
-
async function sendPerson(data) {
|
48
|
-
var _a, _b;
|
49
|
-
// Implement the logic for sending a person
|
50
|
-
const endpoint = 'layouts/pa.Passage/records';
|
51
|
-
const method = 'POST';
|
52
|
-
const fieldData = {
|
53
|
-
// ... Initialize fieldData object with data
|
54
|
-
Pa01_FirstName: 'change',
|
55
|
-
Pa02_LastName: 'change',
|
56
|
-
Pa03_Address1: 'change',
|
57
|
-
Pa04_Address2: 'change',
|
58
|
-
Pa05_Zipcode: 'change',
|
59
|
-
Pa06_City: 'change',
|
60
|
-
Pa07_State: 'change',
|
61
|
-
Pa08_Country: 'change',
|
62
|
-
Pa11_StatusExternal: 'change',
|
63
|
-
Pa12_PersonalNo: 'change',
|
64
|
-
Pa20_Email: 'change',
|
65
|
-
Pa30_Phone: 'change',
|
66
|
-
Pa50_Type: 'change',
|
67
|
-
Pa51_Notes: 'change',
|
68
|
-
Pa041_AssignmentAddress: 'change',
|
69
|
-
Pa042_AssignmentZipCode: 'change',
|
70
|
-
Pa043_AssignmentCity: 'change',
|
71
|
-
};
|
72
|
-
const portalData = {
|
73
|
-
Parameter: [
|
74
|
-
// ... Initialize portalData array with data
|
75
|
-
],
|
76
|
-
};
|
77
|
-
// If products are present in data
|
78
|
-
if (data.products && Array.isArray(data.products)) {
|
79
|
-
// ... Process products and add them to portalData
|
80
|
-
}
|
81
|
-
const requestData = {
|
82
|
-
fieldData,
|
83
|
-
portalData,
|
84
|
-
};
|
85
|
-
const res = await apiCall(endpoint, method, requestData);
|
86
|
-
if ((_a = res === null || res === void 0 ? void 0 : res.response) === null || _a === void 0 ? void 0 : _a.recordId) {
|
87
|
-
// ... Process recordId
|
88
|
-
}
|
89
|
-
return ((_b = res === null || res === void 0 ? void 0 : res.response) === null || _b === void 0 ? void 0 : _b.recordId) || false;
|
90
|
-
}
|
91
|
-
async function checkPerson(ssn, url) {
|
92
|
-
var _a;
|
93
|
-
// Implement the logic for checking a person
|
94
|
-
const endpoint = 'layouts/pa.Passage/records';
|
95
|
-
const method = 'POST';
|
96
|
-
const data = {
|
97
|
-
'fieldData': {
|
98
|
-
Pa50_Type: url,
|
99
|
-
},
|
100
|
-
'script': 'pa.pub.PassageCheckPerson',
|
101
|
-
'script.param': ssn,
|
102
|
-
};
|
103
|
-
const res = await apiCall(endpoint, method, data);
|
104
|
-
return ((_a = res === null || res === void 0 ? void 0 : res.response) === null || _a === void 0 ? void 0 : _a.recordId) || null;
|
105
|
-
}
|
106
|
-
async function getPersonData(id) {
|
107
|
-
var _a;
|
108
|
-
// Implement the logic for getting person data
|
109
|
-
const endpoint = `layouts/pa.PassageGetData/records/${id}`;
|
110
|
-
const method = 'GET';
|
111
|
-
const res = await apiCall(endpoint, method);
|
112
|
-
return ((_a = res === null || res === void 0 ? void 0 : res.response) === null || _a === void 0 ? void 0 : _a.data) || null;
|
113
|
-
}
|
114
|
-
async function updatePerson(data, id) {
|
115
|
-
var _a;
|
116
|
-
// Implement the logic for updating a person
|
117
|
-
const endpoint = `layouts/pa.Passage/records/${id}`;
|
118
|
-
const method = 'PATCH';
|
119
|
-
const fieldData = {
|
120
|
-
// ... Initialize fieldData object with data
|
121
|
-
Pa01_FirstName: 'change',
|
122
|
-
Pa02_LastName: 'change',
|
123
|
-
Pa03_Address1: 'change',
|
124
|
-
Pa04_Address2: 'change',
|
125
|
-
Pa05_Zipcode: 'change',
|
126
|
-
Pa06_City: 'change',
|
127
|
-
Pa07_State: 'change',
|
128
|
-
Pa08_Country: 'change',
|
129
|
-
Pa11_StatusExternal: 'change',
|
130
|
-
Pa12_PersonalNo: 'change',
|
131
|
-
Pa20_Email: 'change',
|
132
|
-
Pa30_Phone: 'change',
|
133
|
-
Pa50_Type: 'change',
|
134
|
-
Pa51_Notes: 'change',
|
135
|
-
Pa041_AssignmentAddress: 'change',
|
136
|
-
Pa042_AssignmentZipCode: 'change',
|
137
|
-
Pa043_AssignmentCity: 'change',
|
138
|
-
};
|
139
|
-
const portalData = {
|
140
|
-
Parameter: [
|
141
|
-
// ... Initialize portalData array with data
|
142
|
-
],
|
143
|
-
};
|
144
|
-
// If products are present in data
|
145
|
-
if (data.products && Array.isArray(data.products)) {
|
146
|
-
// ... Process products and add them to portalData
|
147
|
-
}
|
148
|
-
// If serviceArr is present in data
|
149
|
-
if (data.serviceArr && Array.isArray(data.serviceArr) && !((_a = data.products) === null || _a === void 0 ? void 0 : _a.length)) {
|
150
|
-
// ... Process serviceArr and add them to portalData
|
151
|
-
}
|
152
|
-
// If recievedChanged is "true" in data
|
153
|
-
if (data.recievedChanged) {
|
154
|
-
// ... Add assignment data to fieldData
|
155
|
-
}
|
156
|
-
const requestData = {
|
157
|
-
fieldData,
|
158
|
-
portalData,
|
159
|
-
};
|
160
|
-
const res = await apiCall(endpoint, method, requestData);
|
161
|
-
if ((res === null || res === void 0 ? void 0 : res.message) === 'OK') {
|
162
|
-
// ... Process response
|
163
|
-
return id;
|
164
|
-
}
|
165
|
-
return false;
|
166
|
-
}
|
167
|
-
async function findPricing(data) {
|
168
|
-
// Implement the logic for finding pricing
|
169
|
-
const endpoint = 'layouts/pa.PassagePricing/_find';
|
170
|
-
const method = 'POST';
|
171
|
-
const query = {
|
172
|
-
query: [
|
173
|
-
{
|
174
|
-
As014_WebFormType_c: data,
|
175
|
-
},
|
176
|
-
],
|
177
|
-
};
|
178
|
-
const res = await apiCall(endpoint, method, query);
|
179
|
-
return res;
|
180
|
-
}
|
181
|
-
async function processPassageRecords(data) {
|
182
|
-
// Implement the logic for processing passage records
|
183
|
-
const endpoint = `layouts/pa.Passage/script/pa.pub.ProcessCustomWebForm?script.param=${data}`;
|
184
|
-
const method = 'GET';
|
185
|
-
const res = await apiCall(endpoint, method);
|
186
|
-
return res;
|
187
|
-
}
|
188
|
-
export { checkPerson, findPricing, getPersonData, initializeFelix, processPassageRecords, sendPerson, updatePerson };
|
189
|
-
//# sourceMappingURL=felixFunctions.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"felixFunctions.js","sourceRoot":"","sources":["../../src/utils/felixFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,sEAAsE,CAAC;AAEhH,aAAa;AACb,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AA8CvB,IAAI,MAAqB,CAAC;AAE1B,KAAK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AQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;EACnD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,IAAY;EAC/C,qDAAqD;EACrD,MAAM,QAAQ,GAAG,sEAAsE,IAAI,EAAE,CAAC;EAC9F,MAAM,MAAM,GAAG,KAAK,CAAC;EAErB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC5C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';\nimport { Buffer } from 'buffer';\nimport state from '../store';\nconst baseURL = process.env.FELIX_URL || 'https://stage.hemfixare.se/fmi/data/v1/databases/Hemfix_web/sessions';\n\n// @ts-ignore\nwindow.Buffer = Buffer;\n\ninterface Product {\n [index: number]: string;\n}\n\ninterface Service {\n [index: number]: string;\n}\n\ninterface PortalParameter {\n 'Parameter::Pad001_Name': string;\n 'Parameter::Pad002_Data': string;\n 'Parameter::Pad031_Antal'?: string;\n}\n\ninterface FieldData {\n Pa01_FirstName: string;\n Pa02_LastName: string;\n Pa03_Address1: string;\n Pa04_Address2: string;\n Pa05_Zipcode: string;\n Pa06_City: string;\n Pa07_State: string;\n Pa08_Country: string;\n Pa11_StatusExternal: string;\n Pa12_PersonalNo: string;\n Pa20_Email: string;\n Pa30_Phone: string;\n Pa50_Type: string;\n Pa51_Notes: string;\n Pa041_AssignmentAddress?: string;\n Pa042_AssignmentZipCode?: string;\n Pa043_AssignmentCity?: string;\n}\n\ninterface PortalData {\n Parameter: PortalParameter[];\n}\n\ninterface ApiCallResponse {\n error?: number;\n message?: string;\n response?: Record<string, any>;\n}\n\nlet client: AxiosInstance;\n\nasync function initializeFelix(): Promise<string> {\n const auth = Buffer.from('CustomWebForm:aFMZ4iJzoaEBcwskBDxqb4Pb').toString('base64');\n const res = await apiCall('sessions', 'POST', null, auth);\n return res?.response?.token || null;\n}\n\nasync function apiCall(endpoint: string, method: 'GET' | 'POST' | 'PATCH', data?: any, basic: boolean | string = false): Promise<ApiCallResponse> {\n if (!client) {\n client = axios.create({\n baseURL,\n validateStatus: () => true,\n });\n }\n\n // console.log(basic);\n\n const headers: { [key: string]: string } = {\n 'Content-Type': 'application/json',\n 'Authorization': basic ? `Basic ${basic}` : `Bearer ${state.token ? state.token : ''}`,\n // 'Access-Control-Allow-Origin': 'stage.hemfixare.se',\n };\n\n const config: AxiosRequestConfig = {\n method,\n url: endpoint,\n headers,\n data,\n };\n\n try {\n const response: AxiosResponse = await client.request(config);\n return {\n response: response.data,\n };\n } catch (error) {\n return {\n error: error.response?.status,\n message: error.response?.data || error.message,\n };\n }\n}\n\nasync function sendPerson(data: {\n products: Product[];\n serviceArr: Service[];\n // ... Define the data structure\n}): Promise<string | false> {\n // Implement the logic for sending a person\n const endpoint = 'layouts/pa.Passage/records';\n const method = 'POST';\n\n const fieldData: FieldData = {\n // ... Initialize fieldData object with data\n Pa01_FirstName: 'change',\n Pa02_LastName: 'change',\n Pa03_Address1: 'change',\n Pa04_Address2: 'change',\n Pa05_Zipcode: 'change',\n Pa06_City: 'change',\n Pa07_State: 'change',\n Pa08_Country: 'change',\n Pa11_StatusExternal: 'change',\n Pa12_PersonalNo: 'change',\n Pa20_Email: 'change',\n Pa30_Phone: 'change',\n Pa50_Type: 'change',\n Pa51_Notes: 'change',\n Pa041_AssignmentAddress: 'change',\n Pa042_AssignmentZipCode: 'change',\n Pa043_AssignmentCity: 'change',\n };\n\n const portalData: PortalData = {\n Parameter: [\n // ... Initialize portalData array with data\n ],\n };\n\n // If products are present in data\n if (data.products && Array.isArray(data.products)) {\n // ... Process products and add them to portalData\n }\n\n const requestData = {\n fieldData,\n portalData,\n };\n\n const res = await apiCall(endpoint, method, requestData);\n if (res?.response?.recordId) {\n // ... Process recordId\n }\n return res?.response?.recordId || false;\n}\n\nasync function checkPerson(ssn: string, url: string): Promise<string | null> {\n // Implement the logic for checking a person\n const endpoint = 'layouts/pa.Passage/records';\n const method = 'POST';\n\n const data = {\n 'fieldData': {\n Pa50_Type: url,\n },\n 'script': 'pa.pub.PassageCheckPerson',\n 'script.param': ssn,\n };\n\n const res = await apiCall(endpoint, method, data);\n return res?.response?.recordId || null;\n}\n\nasync function getPersonData(id: string): Promise<any> {\n // Implement the logic for getting person data\n const endpoint = `layouts/pa.PassageGetData/records/${id}`;\n const method = 'GET';\n\n const res = await apiCall(endpoint, method);\n return res?.response?.data || null;\n}\n\nasync function updatePerson(\n data: {\n // ... Define the data structure\n products: Product[];\n serviceArr: Service[];\n recievedChanged: boolean;\n },\n id: string,\n): Promise<string | false> {\n // Implement the logic for updating a person\n const endpoint = `layouts/pa.Passage/records/${id}`;\n const method = 'PATCH';\n\n const fieldData: FieldData = {\n // ... Initialize fieldData object with data\n Pa01_FirstName: 'change',\n Pa02_LastName: 'change',\n Pa03_Address1: 'change',\n Pa04_Address2: 'change',\n Pa05_Zipcode: 'change',\n Pa06_City: 'change',\n Pa07_State: 'change',\n Pa08_Country: 'change',\n Pa11_StatusExternal: 'change',\n Pa12_PersonalNo: 'change',\n Pa20_Email: 'change',\n Pa30_Phone: 'change',\n Pa50_Type: 'change',\n Pa51_Notes: 'change',\n Pa041_AssignmentAddress: 'change',\n Pa042_AssignmentZipCode: 'change',\n Pa043_AssignmentCity: 'change',\n };\n\n const portalData: PortalData = {\n Parameter: [\n // ... Initialize portalData array with data\n ],\n };\n\n // If products are present in data\n if (data.products && Array.isArray(data.products)) {\n // ... Process products and add them to portalData\n }\n\n // If serviceArr is present in data\n if (data.serviceArr && Array.isArray(data.serviceArr) && !data.products?.length) {\n // ... Process serviceArr and add them to portalData\n }\n\n // If recievedChanged is \"true\" in data\n if (data.recievedChanged) {\n // ... Add assignment data to fieldData\n }\n\n const requestData = {\n fieldData,\n portalData,\n };\n\n const res = await apiCall(endpoint, method, requestData);\n if (res?.message === 'OK') {\n // ... Process response\n return id;\n }\n return false;\n}\n\nasync function findPricing(data: string): Promise<any> {\n // Implement the logic for finding pricing\n const endpoint = 'layouts/pa.PassagePricing/_find';\n const method = 'POST';\n\n const query = {\n query: [\n {\n As014_WebFormType_c: data,\n },\n ],\n };\n\n const res = await apiCall(endpoint, method, query);\n return res;\n}\n\nasync function processPassageRecords(data: string): Promise<any> {\n // Implement the logic for processing passage records\n const endpoint = `layouts/pa.Passage/script/pa.pub.ProcessCustomWebForm?script.param=${data}`;\n const method = 'GET';\n\n const res = await apiCall(endpoint, method);\n return res;\n}\n\nexport { checkPerson, findPricing, getPersonData, initializeFelix, processPassageRecords, sendPerson, updatePerson };\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/utils/form.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE;EAClC,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IAC3C,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;MACpB,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;KACtC;SAAM;MACL,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;KACpF;EACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["const hideField = (field: string) => {\n return field.split(' ').reduce((acc, curr) => {\n if (curr.length <= 2) {\n return acc + curr.slice(0, 1) + '* ';\n } else {\n return acc + curr.slice(0, 1) + '*'.repeat(curr.length - 2) + curr.slice(-1) + ' ';\n }\n }, '');\n};\n\nexport { hideField };\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../src/utils/scroll.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,CAAC,EAAuB,EAAE,EAAE;EAC9C,IAAI,CAAC,EAAE;IAAE,OAAO;EAChB,EAAE,CAAC,QAAQ,CAAC;IACV,GAAG,EAAE,CAAC;IACN,QAAQ,EAAE,QAAQ;GACnB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["const scrollToTop = (el: Element | undefined) => {\n if (!el) return;\n el.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n};\n\nexport { scrollToTop };\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkD,MAAM,UAAU,CAAC;AAEpF,MAAM,SAAS,GAAG,CAAC,QAA0D,EAAuB,EAAE;EACpG,OAAQ,QAAoB,CAAC,SAAS,KAAK,SAAS,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAe,EAAuB,EAAE;EAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAmB,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { Business, CustomerCategory, CustomerSubCategory, Product } from '../types';\n\nconst isProduct = (category: CustomerCategory | CustomerSubCategory | Product): category is Product => {\n return (category as Product).post_name !== undefined;\n};\n\nconst isBusiness = (partner: string): partner is Business => {\n return Object.values(Business).includes(partner as Business);\n};\n\nexport { isBusiness, isProduct };\n"]}
|