@isaiahiroko/tilmart-ngx-apps-buyer 0.2.8 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-brand.module-DQLAKTdh.mjs → isaiahiroko-tilmart-ngx-apps-buyer-brand.module-DU8GIBFh.mjs} +3 -3
  2. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-brand.module-DQLAKTdh.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-brand.module-DU8GIBFh.mjs.map} +1 -1
  3. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-calculator.module-BjV4sLrl.mjs → isaiahiroko-tilmart-ngx-apps-buyer-calculator.module-DxAynSxK.mjs} +71 -7
  4. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-calculator.module-DxAynSxK.mjs.map +1 -0
  5. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-D2Xwziad.mjs → isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-Dq1ngbpa.mjs} +3 -1
  6. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-Dq1ngbpa.mjs.map +1 -0
  7. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-cart.module-bj9TAppU.mjs → isaiahiroko-tilmart-ngx-apps-buyer-cart.module-DIvREuq5.mjs} +3 -3
  8. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-cart.module-bj9TAppU.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-cart.module-DIvREuq5.mjs.map} +1 -1
  9. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-category.module-Gf9LE-CW.mjs → isaiahiroko-tilmart-ngx-apps-buyer-category.module-CgxTYkUU.mjs} +3 -3
  10. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-category.module-Gf9LE-CW.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-category.module-CgxTYkUU.mjs.map} +1 -1
  11. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-checkout.module-C3Ncr5fc.mjs → isaiahiroko-tilmart-ngx-apps-buyer-checkout.module-Yoz8h3wn.mjs} +3 -3
  12. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-checkout.module-C3Ncr5fc.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-checkout.module-Yoz8h3wn.mjs.map} +1 -1
  13. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-compare.module-D3fGfWi4.mjs → isaiahiroko-tilmart-ngx-apps-buyer-compare.module-B_d5jvsY.mjs} +3 -3
  14. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-compare.module-D3fGfWi4.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-compare.module-B_d5jvsY.mjs.map} +1 -1
  15. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-compatibility.module-pA7nau85.mjs → isaiahiroko-tilmart-ngx-apps-buyer-compatibility.module-D2veyYx7.mjs} +2 -2
  16. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-compatibility.module-pA7nau85.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-compatibility.module-D2veyYx7.mjs.map} +1 -1
  17. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-home.module-DxjFpedA.mjs → isaiahiroko-tilmart-ngx-apps-buyer-home.module-C1UfV1hr.mjs} +11 -7
  18. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-home.module-C1UfV1hr.mjs.map +1 -0
  19. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-index-DlZbEVtx.mjs → isaiahiroko-tilmart-ngx-apps-buyer-index-BIeumn-3.mjs} +9 -7
  20. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-index-BIeumn-3.mjs.map +1 -0
  21. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-kit-builder.module-CwAR9vRY.mjs → isaiahiroko-tilmart-ngx-apps-buyer-kit-builder.module-BO5P9UNw.mjs} +2 -2
  22. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-kit-builder.module-CwAR9vRY.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-kit-builder.module-BO5P9UNw.mjs.map} +1 -1
  23. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-kits.module-CMTgfTt_.mjs → isaiahiroko-tilmart-ngx-apps-buyer-kits.module-B2gscV5Y.mjs} +3 -3
  24. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-kits.module-CMTgfTt_.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-kits.module-B2gscV5Y.mjs.map} +1 -1
  25. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-order-confirmation.module-DQOe7rR9.mjs → isaiahiroko-tilmart-ngx-apps-buyer-order-confirmation.module-pW6r6cEu.mjs} +3 -3
  26. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-order-confirmation.module-DQOe7rR9.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-order-confirmation.module-pW6r6cEu.mjs.map} +1 -1
  27. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-product.module-CW7GrAX6.mjs → isaiahiroko-tilmart-ngx-apps-buyer-product.module-FcV12cY_.mjs} +16 -4
  28. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-product.module-FcV12cY_.mjs.map +1 -0
  29. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-request-installer.module-YoohTqgP.mjs +256 -0
  30. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-request-installer.module-YoohTqgP.mjs.map +1 -0
  31. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-runtime.module-DBpKBd7C.mjs → isaiahiroko-tilmart-ngx-apps-buyer-runtime.module-BCxVBmUd.mjs} +2 -2
  32. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-runtime.module-DBpKBd7C.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-runtime.module-BCxVBmUd.mjs.map} +1 -1
  33. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-savings.module-DqkHKzbd.mjs → isaiahiroko-tilmart-ngx-apps-buyer-savings.module-Br_FGJJM.mjs} +2 -2
  34. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-savings.module-DqkHKzbd.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-savings.module-Br_FGJJM.mjs.map} +1 -1
  35. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-search-result-card-CrXlbRUD.mjs → isaiahiroko-tilmart-ngx-apps-buyer-search-result-card-l1ClGgJl.mjs} +2 -1
  36. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-search-result-card-l1ClGgJl.mjs.map +1 -0
  37. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-search.module-CVz-fc7z.mjs → isaiahiroko-tilmart-ngx-apps-buyer-search.module-DgKDk15n.mjs} +3 -3
  38. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-search.module-CVz-fc7z.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-search.module-DgKDk15n.mjs.map} +1 -1
  39. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-track.module-DR4Sv8He.mjs → isaiahiroko-tilmart-ngx-apps-buyer-track.module-CS1VlsPu.mjs} +2 -2
  40. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-track.module-DR4Sv8He.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-track.module-CS1VlsPu.mjs.map} +1 -1
  41. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-use-case.module-DDikDUAV.mjs → isaiahiroko-tilmart-ngx-apps-buyer-use-case.module-DtapiWBx.mjs} +2 -2
  42. package/fesm2022/{isaiahiroko-tilmart-ngx-apps-buyer-use-case.module-DDikDUAV.mjs.map → isaiahiroko-tilmart-ngx-apps-buyer-use-case.module-DtapiWBx.mjs.map} +1 -1
  43. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer.mjs +62 -34
  44. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer.mjs.map +1 -1
  45. package/package.json +1 -1
  46. package/types/isaiahiroko-tilmart-ngx-apps-buyer.d.ts +3 -0
  47. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-calculator.module-BjV4sLrl.mjs.map +0 -1
  48. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-D2Xwziad.mjs.map +0 -1
  49. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-home.module-DxjFpedA.mjs.map +0 -1
  50. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-index-DlZbEVtx.mjs.map +0 -1
  51. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-product.module-CW7GrAX6.mjs.map +0 -1
  52. package/fesm2022/isaiahiroko-tilmart-ngx-apps-buyer-search-result-card-CrXlbRUD.mjs.map +0 -1
@@ -7,7 +7,7 @@ import * as i2 from '@thescaffold/ngx-ui';
7
7
  import { ElementsModule } from '@thescaffold/ngx-ui';
8
8
  import * as i3 from '@isaiahiroko/tilmart-ngx-ui';
9
9
  import { TilmartElementsModule } from '@isaiahiroko/tilmart-ngx-ui';
10
- import { S as SearchResultsComponent, a as SearchResultsModule } from './isaiahiroko-tilmart-ngx-apps-buyer-index-DlZbEVtx.mjs';
10
+ import { S as SearchResultsComponent, a as SearchResultsModule } from './isaiahiroko-tilmart-ngx-apps-buyer-index-BIeumn-3.mjs';
11
11
  import { takeUntil } from 'rxjs';
12
12
  import { S as SeoService } from './isaiahiroko-tilmart-ngx-apps-buyer-seo.service-BAXpRG4P.mjs';
13
13
  import { a as findBrandBySlug } from './isaiahiroko-tilmart-ngx-apps-buyer-taxonomy-DdxSUDs5.mjs';
@@ -53,7 +53,7 @@ class BrandComponent extends BaseDirective {
53
53
  } @else {
54
54
  <x-element-loader></x-element-loader>
55
55
  }
56
- `, isInline: true, styles: [".x-brand-desc{color:var(--color-text-muted);font-size:13.5px;margin:-8px 0 16px;max-width:720px}.x-brand-not-found{padding:48px 16px;text-align:center;color:var(--color-text-muted)}\n"], dependencies: [{ kind: "component", type: i2.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i3.SectionHeaderComponent, selector: "x-tilmart-section-header", inputs: ["title", "actionLabel", "actionUrl", "actionHref"], outputs: ["action"] }, { kind: "component", type: SearchResultsComponent, selector: "x-search-results", inputs: ["categoryId", "brandId", "showFacets"] }] }); }
56
+ `, isInline: true, styles: [".x-brand-desc{color:var(--color-text-muted);font-size:13.5px;margin:-8px 0 16px;max-width:720px}.x-brand-not-found{padding:48px 16px;text-align:center;color:var(--color-text-muted)}\n"], dependencies: [{ kind: "component", type: i2.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i3.SectionHeaderComponent, selector: "x-tilmart-section-header", inputs: ["title", "actionLabel", "actionUrl", "actionQueryParams", "actionHref"], outputs: ["action"] }, { kind: "component", type: SearchResultsComponent, selector: "x-search-results", inputs: ["categoryId", "brandId", "showFacets"] }] }); }
57
57
  }
58
58
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrandComponent, decorators: [{
59
59
  type: Component,
@@ -99,4 +99,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
99
99
  }] });
100
100
 
101
101
  export { BrandModule };
102
- //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-buyer-brand.module-DQLAKTdh.mjs.map
102
+ //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-buyer-brand.module-DU8GIBFh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"isaiahiroko-tilmart-ngx-apps-buyer-brand.module-DQLAKTdh.mjs","sources":["../../../projects/buyer/src/lib/pages/brand/brand.component.ts","../../../projects/buyer/src/lib/pages/brand/brand.module.ts"],"sourcesContent":["import { Component, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { BaseDirective, using } from '@thescaffold/ngx-core';\nimport { takeUntil } from 'rxjs';\nimport { SeoService } from '../../services/seo.service';\nimport { BrandRow, findBrandBySlug } from '../../data/taxonomy';\n\n// CAT-07 — `/b/:slug` (TRD §5.3). `showFacets=false`: `SearchWorkflow`\n// only computes facets for a category-scoped search (P2.1/P2.2 scope\n// note — an unscoped cross-category facet set isn't a real R1 need), so\n// a brand page asking for facets would always render an empty rail.\n@Component({\n standalone: false,\n selector: 'x-brand',\n template: `\n @if (brand) {\n <x-tilmart-section-header [title]=\"brand.name\"></x-tilmart-section-header>\n @if (brand.description) {\n <p class=\"x-brand-desc\">{{ brand.description }}</p>\n }\n <x-search-results [brandId]=\"brand.id\" [showFacets]=\"false\"></x-search-results>\n } @else if (notFound) {\n <div class=\"x-brand-not-found\">Brand not found.</div>\n } @else {\n <x-element-loader></x-element-loader>\n }\n `,\n styles: [\n `\n .x-brand-desc {\n color: var(--color-text-muted);\n font-size: 13.5px;\n margin: -8px 0 16px;\n max-width: 720px;\n }\n .x-brand-not-found {\n padding: 48px 16px;\n text-align: center;\n color: var(--color-text-muted);\n }\n `,\n ],\n})\nexport class BrandComponent extends BaseDirective {\n private readonly route = inject(ActivatedRoute);\n private readonly seo = inject(SeoService);\n\n brand?: BrandRow;\n notFound = false;\n\n override init = () => {\n this.route.paramMap.pipe(takeUntil(this.$)).subscribe((params) => {\n const slug = params.get('slug');\n if (!slug) return;\n this.brand = undefined;\n this.notFound = false;\n findBrandBySlug(this.apiService, slug)\n .pipe(takeUntil(this.$))\n .subscribe(\n using((brand) => {\n this.brand = brand;\n this.notFound = !brand;\n if (brand) void this.seo.apply({ entityType: 'brand', entityId: brand.id });\n }),\n );\n });\n };\n}\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { ElementsModule } from '@thescaffold/ngx-ui';\nimport { TilmartElementsModule } from '@isaiahiroko/tilmart-ngx-ui';\nimport { SearchResultsModule } from '../_shared/search-results';\nimport { BrandComponent } from './brand.component';\n\n@NgModule({\n declarations: [BrandComponent],\n imports: [\n SharedModule,\n ElementsModule,\n TilmartElementsModule,\n SearchResultsModule,\n RouterModule.forChild([{ path: '', component: BrandComponent }]),\n ],\n})\nexport class BrandModule {}\n"],"names":["i1","i2","i3.SearchResultsComponent"],"mappings":";;;;;;;;;;;;;;AAOA;AACA;AACA;AACA;AAiCM,MAAO,cAAe,SAAQ,aAAa,CAAA;AAhCjD,IAAA,WAAA,GAAA;;AAiCmB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;QAGzC,IAAA,CAAA,QAAQ,GAAG,KAAK;QAEP,IAAA,CAAA,IAAI,GAAG,MAAK;YACnB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,KAAI;gBAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;AAC/B,gBAAA,IAAI,CAAC,IAAI;oBAAE;AACX,gBAAA,IAAI,CAAC,KAAK,GAAG,SAAS;AACtB,gBAAA,IAAI,CAAC,QAAQ,GAAG,KAAK;AACrB,gBAAA,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI;AAClC,qBAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AACtB,qBAAA,SAAS,CACR,KAAK,CAAC,CAAC,KAAK,KAAI;AACd,oBAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,oBAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,KAAK;AACtB,oBAAA,IAAI,KAAK;AAAE,wBAAA,K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yer/src/lib/pages/brand/brand.module.ts"],"sourcesContent":["import { Component, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { BaseDirective, using } from '@thescaffold/ngx-core';\nimport { takeUntil } from 'rxjs';\nimport { SeoService } from '../../services/seo.service';\nimport { BrandRow, findBrandBySlug } from '../../data/taxonomy';\n\n// CAT-07 — `/b/:slug` (TRD §5.3). `showFacets=false`: `SearchWorkflow`\n// only computes facets for a category-scoped search (P2.1/P2.2 scope\n// note — an unscoped cross-category facet set isn't a real R1 need), so\n// a brand page asking for facets would always render an empty rail.\n@Component({\n standalone: false,\n selector: 'x-brand',\n template: `\n @if (brand) {\n <x-tilmart-section-header [title]=\"brand.name\"></x-tilmart-section-header>\n @if (brand.description) {\n <p class=\"x-brand-desc\">{{ brand.description }}</p>\n }\n <x-search-results [brandId]=\"brand.id\" [showFacets]=\"false\"></x-search-results>\n } @else if (notFound) {\n <div class=\"x-brand-not-found\">Brand not found.</div>\n } @else {\n <x-element-loader></x-element-loader>\n }\n `,\n styles: [\n `\n .x-brand-desc {\n color: var(--color-text-muted);\n font-size: 13.5px;\n margin: -8px 0 16px;\n max-width: 720px;\n }\n .x-brand-not-found {\n padding: 48px 16px;\n text-align: center;\n color: var(--color-text-muted);\n }\n `,\n ],\n})\nexport class BrandComponent extends BaseDirective {\n private readonly route = inject(ActivatedRoute);\n private readonly seo = inject(SeoService);\n\n brand?: BrandRow;\n notFound = false;\n\n override init = () => {\n this.route.paramMap.pipe(takeUntil(this.$)).subscribe((params) => {\n const slug = params.get('slug');\n if (!slug) return;\n this.brand = undefined;\n this.notFound = false;\n findBrandBySlug(this.apiService, slug)\n .pipe(takeUntil(this.$))\n .subscribe(\n using((brand) => {\n this.brand = brand;\n this.notFound = !brand;\n if (brand) void this.seo.apply({ entityType: 'brand', entityId: brand.id });\n }),\n );\n });\n };\n}\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { ElementsModule } from '@thescaffold/ngx-ui';\nimport { TilmartElementsModule } from '@isaiahiroko/tilmart-ngx-ui';\nimport { SearchResultsModule } from '../_shared/search-results';\nimport { BrandComponent } from './brand.component';\n\n@NgModule({\n declarations: [BrandComponent],\n imports: [\n SharedModule,\n ElementsModule,\n TilmartElementsModule,\n SearchResultsModule,\n RouterModule.forChild([{ path: '', component: BrandComponent }]),\n ],\n})\nexport class BrandModule {}\n"],"names":["i1","i2","i3.SearchResultsComponent"],"mappings":";;;;;;;;;;;;;;AAOA;AACA;AACA;AACA;AAiCM,MAAO,cAAe,SAAQ,aAAa,CAAA;AAhCjD,IAAA,WAAA,GAAA;;AAiCmB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;QAGzC,IAAA,CAAA,QAAQ,GAAG,KAAK;QAEP,IAAA,CAAA,IAAI,GAAG,MAAK;YACnB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,KAAI;gBAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;AAC/B,gBAAA,IAAI,CAAC,IAAI;oBAAE;AACX,gBAAA,IAAI,CAAC,KAAK,GAAG,SAAS;AACtB,gBAAA,IAAI,CAAC,QAAQ,GAAG,KAAK;AACrB,gBAAA,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI;AAClC,qBAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AACtB,qBAAA,SAAS,CACR,KAAK,CAAC,CAAC,KAAK,KAAI;AACd,oBAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,oBAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,KAAK;AACtB,oBAAA,IAAI,KAAK;AAAE,wBAAA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
  import { ActivatedRoute, RouterModule } from '@angular/router';
5
- import { BaseDirective, using, SharedModule } from '@thescaffold/ngx-core';
5
+ import { BaseDirective, using, notify, SharedModule } from '@thescaffold/ngx-core';
6
6
  import * as i2 from '@thescaffold/ngx-ui';
7
7
  import { ElementsModule } from '@thescaffold/ngx-ui';
8
8
  import * as i3 from '@isaiahiroko/tilmart-ngx-ui';
9
9
  import { TilmartElementsModule } from '@isaiahiroko/tilmart-ngx-ui';
10
10
  import { Subject, takeUntil, debounceTime, switchMap, catchError, of, map } from 'rxjs';
11
11
  import { r as requestExpertReview } from './isaiahiroko-tilmart-ngx-apps-buyer-expert-review-DoJsoGgp.mjs';
12
+ import { w as withWidth, b as blobUrl } from './isaiahiroko-tilmart-ngx-apps-buyer-media-DP0SdGVm.mjs';
12
13
  import { l as loadToolSessionByShareToken, s as saveToolSession } from './isaiahiroko-tilmart-ngx-apps-buyer-tool-session-DcRvQngw.mjs';
14
+ import { C as CartAddService } from './isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-Dq1ngbpa.mjs';
15
+ import { CartStoreService } from './isaiahiroko-tilmart-ngx-apps-buyer.mjs';
13
16
  import * as i1 from '@angular/forms';
14
17
  import * as i2$1 from '@angular/common';
15
18
 
19
+ const ROLE_LABEL = {
20
+ inverter: 'Inverter',
21
+ battery: 'Battery bank',
22
+ panel: 'Solar panels',
23
+ };
16
24
  const DEFAULT_ASSUMPTIONS = {
17
25
  dodPercent: 50,
18
26
  autonomyDays: 1,
@@ -28,9 +36,11 @@ const DEFAULT_ASSUMPTIONS = {
28
36
  // Assumptions are shown and editable per TOOL-01's own requirement, with
29
37
  // `SizingWorkflow`'s own defaults pre-filled.
30
38
  //
31
- // "Results convert directly into a kit or a pre-filled quote request"
32
- // (TOOL-01) is NOT wired here — the kit builder (P3.4) and `Quote`
33
- // (P4.5) don't exist yet; this page only produces the numbers.
39
+ // "Results convert directly into a kit" (TOOL-01): `sizing/estimate`
40
+ // also returns the cheapest priced inverter / battery bank / panel
41
+ // string that meet the numbers (`recommendations`), and "Add to cart"
42
+ // drops them into the guest cart. A pre-filled `Quote` request (P4.5)
43
+ // is still unbuilt.
34
44
  //
35
45
  // Session persistence/sharing (P3.8) — `?s=<shareToken>` restores a
36
46
  // saved run on load; "Save & share" writes the current appliance list/
@@ -42,6 +52,8 @@ class CalculatorComponent extends BaseDirective {
42
52
  constructor() {
43
53
  super(...arguments);
44
54
  this.route = inject(ActivatedRoute);
55
+ this.cartAdd = inject(CartAddService);
56
+ this.cartStore = inject(CartStoreService);
45
57
  this.libSource = this.apiService.on('apps/commerce/appliance-library-item');
46
58
  this.irradianceSource = this.apiService.on('apps/commerce/irradiance-profile');
47
59
  this.recompute$ = new Subject();
@@ -60,6 +72,7 @@ class CalculatorComponent extends BaseDirective {
60
72
  this.expertReviewNote = '';
61
73
  this.expertReviewSending = false;
62
74
  this.expertReviewSent = false;
75
+ this.brokenImages = new Set();
63
76
  this.init = () => {
64
77
  this.libSource
65
78
  .getMany({ page: 1, perPage: 200 })
@@ -112,6 +125,57 @@ class CalculatorComponent extends BaseDirective {
112
125
  }));
113
126
  };
114
127
  }
128
+ get recommendations() {
129
+ return this.result?.recommendations ?? [];
130
+ }
131
+ get recommendationsTotal() {
132
+ return this.recommendations.reduce((sum, r) => sum + r.unitPrice * r.quantity, 0);
133
+ }
134
+ get recommendationsCurrency() {
135
+ return this.recommendations[0]?.currency ?? 'NGN';
136
+ }
137
+ roleLabel(role) {
138
+ return ROLE_LABEL[role];
139
+ }
140
+ imageFor(rec) {
141
+ return withWidth(blobUrl(rec.thumbnailBlobId), 160);
142
+ }
143
+ addRecommendationToCart(rec) {
144
+ this.cartAdd.add(this.toCartInput(rec));
145
+ }
146
+ addAllToCart() {
147
+ const recs = this.recommendations;
148
+ if (!recs.length)
149
+ return;
150
+ for (const rec of recs) {
151
+ const input = this.toCartInput(rec);
152
+ this.cartStore.addLine({
153
+ variantId: input.variantId,
154
+ productId: input.productId,
155
+ name: input.name,
156
+ slug: input.slug,
157
+ imageUrl: withWidth(input.imageUrl, 160),
158
+ quantity: input.quantity ?? 1,
159
+ unitPrice: input.unitPrice,
160
+ compareAtPrice: input.compareAtPrice,
161
+ currency: input.currency,
162
+ });
163
+ }
164
+ notify(`${recs.length} item${recs.length === 1 ? '' : 's'} added to your cart.`, undefined, 'success');
165
+ }
166
+ toCartInput(rec) {
167
+ return {
168
+ variantId: rec.variantId,
169
+ productId: rec.productId,
170
+ name: rec.name,
171
+ slug: rec.slug,
172
+ imageUrl: blobUrl(rec.thumbnailBlobId),
173
+ unitPrice: rec.unitPrice,
174
+ compareAtPrice: rec.compareAtAmount,
175
+ currency: rec.currency,
176
+ quantity: rec.quantity,
177
+ };
178
+ }
115
179
  get filteredLibrary() {
116
180
  const term = this.librarySearchTerm.trim().toLowerCase();
117
181
  if (!term)
@@ -233,11 +297,11 @@ class CalculatorComponent extends BaseDirective {
233
297
  };
234
298
  }
235
299
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: CalculatorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
236
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: CalculatorComponent, isStandalone: false, selector: "x-calculator", usesInheritance: true, ngImport: i0, template: "<div class=\"x-calc\">\n <x-tilmart-section-header title=\"Load & sizing calculator\"></x-tilmart-section-header>\n <p class=\"x-calc-intro\">\n Build your appliance list and get an inverter, battery and panel recommendation.\n </p>\n\n <div class=\"x-calc-state\">\n <label for=\"x-calc-state-select\">Your state</label>\n <select id=\"x-calc-state-select\" [(ngModel)]=\"selectedState\" (ngModelChange)=\"onFieldChange()\">\n <option [ngValue]=\"undefined\">Nigeria-wide average</option>\n @for (state of states; track state) {\n <option [ngValue]=\"state\">{{ state }}</option>\n }\n </select>\n </div>\n\n <div class=\"x-calc-add\">\n <input\n type=\"search\"\n class=\"x-calc-add-input\"\n placeholder=\"Search appliances \u2014 fridge, TV, fan, pump\u2026\"\n [(ngModel)]=\"librarySearchTerm\"\n />\n <button type=\"button\" class=\"x-calc-add-custom\" (click)=\"addCustomLine()\">\n + Add a custom appliance\n </button>\n </div>\n\n @if (librarySearchTerm && !loadingLibrary) {\n <div class=\"x-calc-picker\">\n @for (item of filteredLibrary; track item.id) {\n <button type=\"button\" class=\"x-calc-picker-item\" (click)=\"addFromLibrary(item)\">\n <span class=\"x-calc-picker-name\">{{ item.name }}</span>\n <span class=\"x-calc-picker-watts\">{{ item.defaultWatts }}W</span>\n </button>\n } @empty {\n <div class=\"x-calc-picker-empty\">No match in the appliance library.</div>\n }\n </div>\n }\n\n @if (lines.length) {\n <div class=\"x-calc-table-wrap\">\n <table class=\"x-calc-table\">\n <thead>\n <tr>\n <th>Appliance</th>\n <th>Watts</th>\n <th>Qty</th>\n <th>Hours/day</th>\n <th>Runs at night</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (line of lines; track line.id) {\n <tr>\n <td>\n <input\n type=\"text\"\n class=\"x-calc-cell-input\"\n [(ngModel)]=\"line.name\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <input\n type=\"number\"\n min=\"1\"\n class=\"x-calc-cell-input x-calc-cell-input-num\"\n [(ngModel)]=\"line.watts\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.quantity\"\n (inc)=\"onQuantityChange(line, line.quantity + 1)\"\n (dec)=\"onQuantityChange(line, line.quantity - 1)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.hoursPerDay\"\n [min]=\"0\"\n (inc)=\"onHoursChange(line, line.hoursPerDay + 0.5)\"\n (dec)=\"onHoursChange(line, line.hoursPerDay - 0.5)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td class=\"x-calc-cell-center\">\n <input\n type=\"checkbox\"\n [(ngModel)]=\"line.runsAtNight\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td class=\"x-calc-cell-center\">\n <button\n type=\"button\"\n class=\"x-calc-remove\"\n aria-label=\"Remove appliance\"\n (click)=\"removeLine(line.id)\"\n >\n &times;\n </button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n } @else {\n <div class=\"x-calc-empty\">\n Search the appliance library above or add a custom appliance to get started.\n </div>\n }\n\n @if (lines.length) {\n <details class=\"x-calc-assumptions\">\n <summary>Assumptions</summary>\n <div class=\"x-calc-assumptions-grid\">\n <label>\n Depth of discharge (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.dodPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Days of autonomy\n <input\n type=\"number\"\n min=\"0\"\n step=\"0.5\"\n [(ngModel)]=\"assumptions.autonomyDays\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter power factor\n <input\n type=\"number\"\n min=\"0.1\"\n max=\"1\"\n step=\"0.05\"\n [(ngModel)]=\"assumptions.inverterPowerFactor\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter headroom (%)\n <input\n type=\"number\"\n min=\"0\"\n [(ngModel)]=\"assumptions.inverterHeadroomPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Battery round-trip efficiency (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.batteryRoundTripEfficiencyPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n System losses (%)\n <input\n type=\"number\"\n min=\"0\"\n max=\"90\"\n [(ngModel)]=\"assumptions.systemLossPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n </div>\n </details>\n }\n\n @if (loadingResult) {\n <x-element-loader></x-element-loader>\n } @else if (result) {\n <div class=\"x-calc-results\">\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Peak load</div>\n <div class=\"x-calc-result-value\">{{ result.peakLoadW | number: '1.0-0' }} W</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Daily energy</div>\n <div class=\"x-calc-result-value\">{{ result.dailyEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Night energy</div>\n <div class=\"x-calc-result-value\">{{ result.nightEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended inverter</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedInverterVA | number: '1.0-0' }} VA</div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedInverterContinuousVA | number: '1.0-0' }} VA continuous \u00B7\n {{ result.recommendedInverterSurgeVA | number: '1.0-0' }} VA surge\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended battery bank</div>\n <div class=\"x-calc-result-value\">\n {{ result.recommendedBatteryCapacityAh | number: '1.0-0' }} Ah @ {{ result.recommendedSystemVoltage }}V\n </div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedBatteryUsableKwh | number: '1.1-2' }} kWh usable\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended solar array</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedArrayWp | number: '1.0-0' }} Wp</div>\n <div class=\"x-calc-result-sub\">\n {{ result.sunHoursUsed | number: '1.1-2' }} peak sun-hours/day\n @if (result.sunHoursSource === 'fallback') {\n (Nigeria-wide average \u2014 pick your state for a closer estimate)\n }\n </div>\n </div>\n </div>\n\n @if (result.warnings.length) {\n <ul class=\"x-calc-warnings\">\n @for (warning of result.warnings; track warning) {\n <li>{{ warning }}</li>\n }\n </ul>\n }\n\n <div class=\"x-calc-save\">\n <input\n type=\"text\"\n placeholder=\"Name this system (optional)\"\n [(ngModel)]=\"sessionName\"\n />\n <button type=\"button\" [disabled]=\"saving\" (click)=\"save()\">\n {{ sessionId ? 'Update saved link' : 'Save & share' }}\n </button>\n @if (shareUrl) {\n <a class=\"x-calc-save-link\" [href]=\"shareUrl\">{{ shareUrl }}</a>\n }\n </div>\n\n @if (!expertReviewOpen) {\n <button type=\"button\" class=\"x-calc-expert-btn\" (click)=\"openExpertReview()\">\n Have someone check this for me\n </button>\n } @else if (expertReviewSent) {\n <div class=\"x-calc-expert-sent\">Sent \u2014 our team will review this and reach out.</div>\n } @else {\n <div class=\"x-calc-expert-form\">\n <input\n type=\"tel\"\n placeholder=\"Phone or WhatsApp number\"\n [(ngModel)]=\"expertReviewPhone\"\n />\n <textarea placeholder=\"Anything else to add? (optional)\" [(ngModel)]=\"expertReviewNote\"></textarea>\n <button\n type=\"button\"\n [disabled]=\"expertReviewSending || !expertReviewPhone.trim()\"\n (click)=\"submitExpertReview()\"\n >\n Send to an expert\n </button>\n </div>\n }\n }\n</div>\n", styles: [".x-calc{display:flex;flex-direction:column;gap:16px;padding:16px;max-width:960px;margin:0 auto}.x-calc-intro{margin:-8px 0 0;color:var(--color-text-muted)}.x-calc-state{display:flex;flex-direction:column;gap:4px;max-width:320px}.x-calc-state label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-state select{padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add{display:flex;flex-wrap:wrap;gap:12px;align-items:center}.x-calc-add-input{flex:1;min-width:220px;padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add-custom{padding:10px 14px;border:1px dashed var(--color-border-strong);border-radius:6px;background:transparent;color:var(--color-text);cursor:pointer;white-space:nowrap}.x-calc-picker{display:flex;flex-direction:column;gap:2px;border:1px solid var(--color-border);border-radius:6px;max-height:240px;overflow-y:auto}.x-calc-picker-item{display:flex;justify-content:space-between;padding:10px 12px;border:0;background:var(--color-surface);color:var(--color-text);text-align:left;cursor:pointer}.x-calc-picker-item:hover{background:color-mix(in srgb,var(--color-accent) 8%,var(--color-surface))}.x-calc-picker-watts{font-family:var(--font-mono);color:var(--color-text-muted)}.x-calc-picker-empty{padding:12px;color:var(--color-text-muted)}.x-calc-empty{padding:32px 16px;text-align:center;color:var(--color-text-muted);border:1px dashed var(--color-border);border-radius:8px}.x-calc-table-wrap{overflow-x:auto}.x-calc-table{width:100%;min-width:640px;border-collapse:collapse}.x-calc-table th,.x-calc-table td{padding:8px 10px;border-bottom:1px solid var(--color-border);text-align:left}.x-calc-table th{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-cell-center{text-align:center}.x-calc-cell-input{width:100%;padding:6px 8px;border:1px solid var(--color-border);border-radius:4px;background:var(--color-surface);color:var(--color-text)}.x-calc-cell-input-num{width:80px}.x-calc-remove{width:28px;height:28px;border-radius:14px;border:0;background:color-mix(in srgb,var(--color-danger) 12%,var(--color-surface));color:var(--color-danger);font-size:16px;cursor:pointer}.x-calc-assumptions{border:1px solid var(--color-border);border-radius:8px;padding:12px}.x-calc-assumptions summary{cursor:pointer;font-weight:700}.x-calc-assumptions-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;margin-top:12px}.x-calc-assumptions-grid label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-assumptions-grid input{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-size:14px}.x-calc-results{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-calc-result-card{border:1px solid var(--color-border);border-radius:8px;padding:14px}.x-calc-result-label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted);margin-bottom:6px}.x-calc-result-value{font-family:var(--font-mono);font-size:22px;font-weight:800;color:var(--color-text)}.x-calc-result-sub{margin-top:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-warnings{margin:0;padding-left:18px;color:var(--color-warn);font-size:13px}.x-calc-save{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-save input{flex:1;min-width:180px;padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-save button{padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer;white-space:nowrap}.x-calc-save button:disabled{opacity:.5;cursor:not-allowed}.x-calc-save-link{flex-basis:100%;font-family:var(--font-mono);font-size:12px;color:var(--color-link);word-break:break-all}.x-calc-expert-btn{align-self:flex-start;padding:10px 14px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-brand);cursor:pointer}.x-calc-expert-form{display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-expert-form input,.x-calc-expert-form textarea{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-family:inherit}.x-calc-expert-form textarea{min-height:60px;resize:vertical}.x-calc-expert-form button{align-self:flex-start;padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer}.x-calc-expert-form button:disabled{opacity:.5;cursor:not-allowed}.x-calc-expert-sent{padding:14px;border:1px solid var(--color-success);border-radius:8px;color:var(--color-success)}\n"], dependencies: [{ kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i3.QuantityStepperComponent, selector: "x-tilmart-quantity-stepper", inputs: ["value", "min", "size"], outputs: ["inc", "dec"] }, { kind: "component", type: i3.SectionHeaderComponent, selector: "x-tilmart-section-header", inputs: ["title", "actionLabel", "actionUrl", "actionHref"], outputs: ["action"] }, { kind: "pipe", type: i2$1.DecimalPipe, name: "number" }] }); }
300
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.16", type: CalculatorComponent, isStandalone: false, selector: "x-calculator", usesInheritance: true, ngImport: i0, template: "<div class=\"x-calc\">\n <x-tilmart-section-header title=\"Load & sizing calculator\"></x-tilmart-section-header>\n <p class=\"x-calc-intro\">\n Build your appliance list and get an inverter, battery and panel recommendation.\n </p>\n\n <div class=\"x-calc-state\">\n <label for=\"x-calc-state-select\">Your state</label>\n <select id=\"x-calc-state-select\" [(ngModel)]=\"selectedState\" (ngModelChange)=\"onFieldChange()\">\n <option [ngValue]=\"undefined\">Nigeria-wide average</option>\n @for (state of states; track state) {\n <option [ngValue]=\"state\">{{ state }}</option>\n }\n </select>\n </div>\n\n <div class=\"x-calc-add\">\n <input\n type=\"search\"\n class=\"x-calc-add-input\"\n placeholder=\"Search appliances \u2014 fridge, TV, fan, pump\u2026\"\n [(ngModel)]=\"librarySearchTerm\"\n />\n <button type=\"button\" class=\"x-calc-add-custom\" (click)=\"addCustomLine()\">\n + Add a custom appliance\n </button>\n </div>\n\n @if (librarySearchTerm && !loadingLibrary) {\n <div class=\"x-calc-picker\">\n @for (item of filteredLibrary; track item.id) {\n <button type=\"button\" class=\"x-calc-picker-item\" (click)=\"addFromLibrary(item)\">\n <span class=\"x-calc-picker-name\">{{ item.name }}</span>\n <span class=\"x-calc-picker-watts\">{{ item.defaultWatts }}W</span>\n </button>\n } @empty {\n <div class=\"x-calc-picker-empty\">No match in the appliance library.</div>\n }\n </div>\n }\n\n @if (lines.length) {\n <div class=\"x-calc-table-wrap\">\n <table class=\"x-calc-table\">\n <thead>\n <tr>\n <th>Appliance</th>\n <th>Watts</th>\n <th>Qty</th>\n <th>Hours/day</th>\n <th>Runs at night</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (line of lines; track line.id) {\n <tr>\n <td>\n <input\n type=\"text\"\n class=\"x-calc-cell-input\"\n [(ngModel)]=\"line.name\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <input\n type=\"number\"\n min=\"1\"\n class=\"x-calc-cell-input x-calc-cell-input-num\"\n [(ngModel)]=\"line.watts\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.quantity\"\n (inc)=\"onQuantityChange(line, line.quantity + 1)\"\n (dec)=\"onQuantityChange(line, line.quantity - 1)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.hoursPerDay\"\n [min]=\"0\"\n (inc)=\"onHoursChange(line, line.hoursPerDay + 0.5)\"\n (dec)=\"onHoursChange(line, line.hoursPerDay - 0.5)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td class=\"x-calc-cell-center\">\n <input\n type=\"checkbox\"\n [(ngModel)]=\"line.runsAtNight\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td class=\"x-calc-cell-center\">\n <button\n type=\"button\"\n class=\"x-calc-remove\"\n aria-label=\"Remove appliance\"\n (click)=\"removeLine(line.id)\"\n >\n &times;\n </button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n } @else {\n <div class=\"x-calc-empty\">\n Search the appliance library above or add a custom appliance to get started.\n </div>\n }\n\n @if (lines.length) {\n <details class=\"x-calc-assumptions\">\n <summary>Assumptions</summary>\n <div class=\"x-calc-assumptions-grid\">\n <label>\n Depth of discharge (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.dodPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Days of autonomy\n <input\n type=\"number\"\n min=\"0\"\n step=\"0.5\"\n [(ngModel)]=\"assumptions.autonomyDays\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter power factor\n <input\n type=\"number\"\n min=\"0.1\"\n max=\"1\"\n step=\"0.05\"\n [(ngModel)]=\"assumptions.inverterPowerFactor\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter headroom (%)\n <input\n type=\"number\"\n min=\"0\"\n [(ngModel)]=\"assumptions.inverterHeadroomPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Battery round-trip efficiency (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.batteryRoundTripEfficiencyPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n System losses (%)\n <input\n type=\"number\"\n min=\"0\"\n max=\"90\"\n [(ngModel)]=\"assumptions.systemLossPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n </div>\n </details>\n }\n\n @if (loadingResult) {\n <x-element-loader></x-element-loader>\n } @else if (result) {\n <div class=\"x-calc-results\">\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Peak load</div>\n <div class=\"x-calc-result-value\">{{ result.peakLoadW | number: '1.0-0' }} W</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Daily energy</div>\n <div class=\"x-calc-result-value\">{{ result.dailyEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Night energy</div>\n <div class=\"x-calc-result-value\">{{ result.nightEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended inverter</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedInverterVA | number: '1.0-0' }} VA</div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedInverterContinuousVA | number: '1.0-0' }} VA continuous \u00B7\n {{ result.recommendedInverterSurgeVA | number: '1.0-0' }} VA surge\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended battery bank</div>\n <div class=\"x-calc-result-value\">\n {{ result.recommendedBatteryCapacityAh | number: '1.0-0' }} Ah @ {{ result.recommendedSystemVoltage }}V\n </div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedBatteryUsableKwh | number: '1.1-2' }} kWh usable\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended solar array</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedArrayWp | number: '1.0-0' }} Wp</div>\n <div class=\"x-calc-result-sub\">\n {{ result.sunHoursUsed | number: '1.1-2' }} peak sun-hours/day\n @if (result.sunHoursSource === 'fallback') {\n (Nigeria-wide average \u2014 pick your state for a closer estimate)\n }\n </div>\n </div>\n </div>\n\n @if (result.warnings.length) {\n <ul class=\"x-calc-warnings\">\n @for (warning of result.warnings; track warning) {\n <li>{{ warning }}</li>\n }\n </ul>\n }\n\n <section class=\"x-calc-reco\">\n <h3 class=\"x-calc-reco-title\">Products that fit this load</h3>\n @if (recommendations.length) {\n <ul class=\"x-calc-reco-list\">\n @for (rec of recommendations; track rec.role) {\n <li class=\"x-calc-reco-item\">\n @if (imageFor(rec); as img) {\n <img class=\"x-calc-reco-img\" [src]=\"img\" [alt]=\"rec.name\" loading=\"lazy\" (error)=\"brokenImages.add(rec.role)\" [hidden]=\"brokenImages.has(rec.role)\" />\n @if (brokenImages.has(rec.role)) {\n <div class=\"x-calc-reco-img x-calc-reco-img-empty\"></div>\n }\n } @else {\n <div class=\"x-calc-reco-img x-calc-reco-img-empty\"></div>\n }\n <div class=\"x-calc-reco-body\">\n <div class=\"x-calc-reco-role\">{{ roleLabel(rec.role) }}</div>\n <a class=\"x-calc-reco-name\" [routerLink]=\"['/p', rec.slug ?? rec.productId]\">{{ rec.name }}</a>\n <div class=\"x-calc-reco-sub\">{{ rec.summary }}</div>\n <div class=\"x-calc-reco-price\">\n {{ rec.currency }} {{ rec.unitPrice * rec.quantity | number: '1.0-0' }}\n @if (rec.compareAtAmount && rec.compareAtAmount > rec.unitPrice) {\n <span class=\"x-calc-reco-was\">{{ rec.currency }} {{ rec.compareAtAmount * rec.quantity | number: '1.0-0' }}</span>\n }\n </div>\n </div>\n <button type=\"button\" class=\"x-calc-reco-add\" (click)=\"addRecommendationToCart(rec)\">\n Add to cart\n </button>\n </li>\n }\n </ul>\n <div class=\"x-calc-reco-foot\">\n <div class=\"x-calc-reco-total\">\n Total: <strong>{{ recommendationsCurrency }} {{ recommendationsTotal | number: '1.0-0' }}</strong>\n </div>\n <button type=\"button\" class=\"x-calc-reco-add-all\" (click)=\"addAllToCart()\">\n Add all to cart\n </button>\n </div>\n } @else {\n <p class=\"x-calc-reco-empty\">\n We couldn't match a priced product to these numbers yet \u2014 browse the\n <a routerLink=\"/kits\">kits</a> or <a routerLink=\"/tools/kit-builder\">build your own</a>.\n </p>\n }\n </section>\n\n <div class=\"x-calc-save\">\n <input\n type=\"text\"\n placeholder=\"Name this system (optional)\"\n [(ngModel)]=\"sessionName\"\n />\n <button type=\"button\" [disabled]=\"saving\" (click)=\"save()\">\n {{ sessionId ? 'Update saved link' : 'Save & share' }}\n </button>\n @if (shareUrl) {\n <a class=\"x-calc-save-link\" [href]=\"shareUrl\">{{ shareUrl }}</a>\n }\n </div>\n\n @if (!expertReviewOpen) {\n <button type=\"button\" class=\"x-calc-expert-btn\" (click)=\"openExpertReview()\">\n Have someone check this for me\n </button>\n } @else if (expertReviewSent) {\n <div class=\"x-calc-expert-sent\">Sent \u2014 our team will review this and reach out.</div>\n } @else {\n <div class=\"x-calc-expert-form\">\n <input\n type=\"tel\"\n placeholder=\"Phone or WhatsApp number\"\n [(ngModel)]=\"expertReviewPhone\"\n />\n <textarea placeholder=\"Anything else to add? (optional)\" [(ngModel)]=\"expertReviewNote\"></textarea>\n <button\n type=\"button\"\n [disabled]=\"expertReviewSending || !expertReviewPhone.trim()\"\n (click)=\"submitExpertReview()\"\n >\n Send to an expert\n </button>\n </div>\n }\n }\n</div>\n", styles: [".x-calc{display:flex;flex-direction:column;gap:16px;padding:16px;max-width:960px;margin:0 auto}.x-calc-intro{margin:-8px 0 0;color:var(--color-text-muted)}.x-calc-state{display:flex;flex-direction:column;gap:4px;max-width:320px}.x-calc-state label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-state select{padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add{display:flex;flex-wrap:wrap;gap:12px;align-items:center}.x-calc-add-input{flex:1;min-width:220px;padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add-custom{padding:10px 14px;border:1px dashed var(--color-border-strong);border-radius:6px;background:transparent;color:var(--color-text);cursor:pointer;white-space:nowrap}.x-calc-picker{display:flex;flex-direction:column;gap:2px;border:1px solid var(--color-border);border-radius:6px;max-height:240px;overflow-y:auto}.x-calc-picker-item{display:flex;justify-content:space-between;padding:10px 12px;border:0;background:var(--color-surface);color:var(--color-text);text-align:left;cursor:pointer}.x-calc-picker-item:hover{background:color-mix(in srgb,var(--color-accent) 8%,var(--color-surface))}.x-calc-picker-watts{font-family:var(--font-mono);color:var(--color-text-muted)}.x-calc-picker-empty{padding:12px;color:var(--color-text-muted)}.x-calc-empty{padding:32px 16px;text-align:center;color:var(--color-text-muted);border:1px dashed var(--color-border);border-radius:8px}.x-calc-table-wrap{overflow-x:auto}.x-calc-table{width:100%;min-width:640px;border-collapse:collapse}.x-calc-table th,.x-calc-table td{padding:8px 10px;border-bottom:1px solid var(--color-border);text-align:left}.x-calc-table th{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-cell-center{text-align:center}.x-calc-cell-input{width:100%;padding:6px 8px;border:1px solid var(--color-border);border-radius:4px;background:var(--color-surface);color:var(--color-text)}.x-calc-cell-input-num{width:80px}.x-calc-remove{width:28px;height:28px;border-radius:14px;border:0;background:color-mix(in srgb,var(--color-danger) 12%,var(--color-surface));color:var(--color-danger);font-size:16px;cursor:pointer}.x-calc-assumptions{border:1px solid var(--color-border);border-radius:8px;padding:12px}.x-calc-assumptions summary{cursor:pointer;font-weight:700}.x-calc-assumptions-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;margin-top:12px}.x-calc-assumptions-grid label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-assumptions-grid input{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-size:14px}.x-calc-results{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-calc-result-card{border:1px solid var(--color-border);border-radius:8px;padding:14px}.x-calc-result-label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted);margin-bottom:6px}.x-calc-result-value{font-family:var(--font-mono);font-size:22px;font-weight:800;color:var(--color-text)}.x-calc-result-sub{margin-top:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-warnings{margin:0;padding-left:18px;color:var(--color-warn);font-size:13px}.x-calc-save{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-save input{flex:1;min-width:180px;padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-save button{padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer;white-space:nowrap}.x-calc-save button:disabled{opacity:.5;cursor:not-allowed}.x-calc-save-link{flex-basis:100%;font-family:var(--font-mono);font-size:12px;color:var(--color-link);word-break:break-all}.x-calc-expert-btn{align-self:flex-start;padding:10px 14px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-brand);cursor:pointer}.x-calc-expert-form{display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-expert-form input,.x-calc-expert-form textarea{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-family:inherit}.x-calc-expert-form textarea{min-height:60px;resize:vertical}.x-calc-expert-form button{align-self:flex-start;padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer}.x-calc-expert-form button:disabled{opacity:.5;cursor:not-allowed}.x-calc-expert-sent{padding:14px;border:1px solid var(--color-success);border-radius:8px;color:var(--color-success)}.x-calc-reco{display:flex;flex-direction:column;gap:10px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-reco-title{margin:0;font-size:16px;font-weight:800}.x-calc-reco-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}.x-calc-reco-item{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.x-calc-reco-img{width:56px;height:56px;object-fit:cover;border-radius:6px;flex-shrink:0}.x-calc-reco-img-empty{background:var(--color-surface-2)}.x-calc-reco-body{flex:1;min-width:180px;display:flex;flex-direction:column;gap:2px}.x-calc-reco-role{font-size:11px;font-weight:700;text-transform:uppercase;color:var(--color-text-muted)}.x-calc-reco-name{font-weight:700;color:var(--color-text);text-decoration:none}.x-calc-reco-sub{font-size:12.5px;color:var(--color-text-muted)}.x-calc-reco-price{font-family:var(--font-mono);font-weight:700;font-size:14px}.x-calc-reco-was{margin-left:6px;font-weight:400;font-size:12px;color:var(--color-text-muted);text-decoration:line-through}.x-calc-reco-add,.x-calc-reco-add-all{padding:8px 14px;border-radius:6px;font-weight:700;cursor:pointer;border:1px solid var(--color-border);background:var(--color-surface);color:var(--color-text)}.x-calc-reco-add-all{background:var(--color-accent);border-color:var(--color-accent);color:var(--color-accent-fg)}.x-calc-reco-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding-top:10px;border-top:1px solid var(--color-border)}.x-calc-reco-empty{margin:0;font-size:13.5px;color:var(--color-text-muted)}\n"], dependencies: [{ kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i2.LoaderComponent, selector: "x-element-loader", inputs: ["data"] }, { kind: "component", type: i3.QuantityStepperComponent, selector: "x-tilmart-quantity-stepper", inputs: ["value", "min", "size"], outputs: ["inc", "dec"] }, { kind: "component", type: i3.SectionHeaderComponent, selector: "x-tilmart-section-header", inputs: ["title", "actionLabel", "actionUrl", "actionQueryParams", "actionHref"], outputs: ["action"] }, { kind: "pipe", type: i2$1.DecimalPipe, name: "number" }] }); }
237
301
  }
238
302
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: CalculatorComponent, decorators: [{
239
303
  type: Component,
240
- args: [{ standalone: false, selector: 'x-calculator', template: "<div class=\"x-calc\">\n <x-tilmart-section-header title=\"Load & sizing calculator\"></x-tilmart-section-header>\n <p class=\"x-calc-intro\">\n Build your appliance list and get an inverter, battery and panel recommendation.\n </p>\n\n <div class=\"x-calc-state\">\n <label for=\"x-calc-state-select\">Your state</label>\n <select id=\"x-calc-state-select\" [(ngModel)]=\"selectedState\" (ngModelChange)=\"onFieldChange()\">\n <option [ngValue]=\"undefined\">Nigeria-wide average</option>\n @for (state of states; track state) {\n <option [ngValue]=\"state\">{{ state }}</option>\n }\n </select>\n </div>\n\n <div class=\"x-calc-add\">\n <input\n type=\"search\"\n class=\"x-calc-add-input\"\n placeholder=\"Search appliances \u2014 fridge, TV, fan, pump\u2026\"\n [(ngModel)]=\"librarySearchTerm\"\n />\n <button type=\"button\" class=\"x-calc-add-custom\" (click)=\"addCustomLine()\">\n + Add a custom appliance\n </button>\n </div>\n\n @if (librarySearchTerm && !loadingLibrary) {\n <div class=\"x-calc-picker\">\n @for (item of filteredLibrary; track item.id) {\n <button type=\"button\" class=\"x-calc-picker-item\" (click)=\"addFromLibrary(item)\">\n <span class=\"x-calc-picker-name\">{{ item.name }}</span>\n <span class=\"x-calc-picker-watts\">{{ item.defaultWatts }}W</span>\n </button>\n } @empty {\n <div class=\"x-calc-picker-empty\">No match in the appliance library.</div>\n }\n </div>\n }\n\n @if (lines.length) {\n <div class=\"x-calc-table-wrap\">\n <table class=\"x-calc-table\">\n <thead>\n <tr>\n <th>Appliance</th>\n <th>Watts</th>\n <th>Qty</th>\n <th>Hours/day</th>\n <th>Runs at night</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (line of lines; track line.id) {\n <tr>\n <td>\n <input\n type=\"text\"\n class=\"x-calc-cell-input\"\n [(ngModel)]=\"line.name\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <input\n type=\"number\"\n min=\"1\"\n class=\"x-calc-cell-input x-calc-cell-input-num\"\n [(ngModel)]=\"line.watts\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.quantity\"\n (inc)=\"onQuantityChange(line, line.quantity + 1)\"\n (dec)=\"onQuantityChange(line, line.quantity - 1)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.hoursPerDay\"\n [min]=\"0\"\n (inc)=\"onHoursChange(line, line.hoursPerDay + 0.5)\"\n (dec)=\"onHoursChange(line, line.hoursPerDay - 0.5)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td class=\"x-calc-cell-center\">\n <input\n type=\"checkbox\"\n [(ngModel)]=\"line.runsAtNight\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td class=\"x-calc-cell-center\">\n <button\n type=\"button\"\n class=\"x-calc-remove\"\n aria-label=\"Remove appliance\"\n (click)=\"removeLine(line.id)\"\n >\n &times;\n </button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n } @else {\n <div class=\"x-calc-empty\">\n Search the appliance library above or add a custom appliance to get started.\n </div>\n }\n\n @if (lines.length) {\n <details class=\"x-calc-assumptions\">\n <summary>Assumptions</summary>\n <div class=\"x-calc-assumptions-grid\">\n <label>\n Depth of discharge (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.dodPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Days of autonomy\n <input\n type=\"number\"\n min=\"0\"\n step=\"0.5\"\n [(ngModel)]=\"assumptions.autonomyDays\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter power factor\n <input\n type=\"number\"\n min=\"0.1\"\n max=\"1\"\n step=\"0.05\"\n [(ngModel)]=\"assumptions.inverterPowerFactor\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter headroom (%)\n <input\n type=\"number\"\n min=\"0\"\n [(ngModel)]=\"assumptions.inverterHeadroomPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Battery round-trip efficiency (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.batteryRoundTripEfficiencyPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n System losses (%)\n <input\n type=\"number\"\n min=\"0\"\n max=\"90\"\n [(ngModel)]=\"assumptions.systemLossPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n </div>\n </details>\n }\n\n @if (loadingResult) {\n <x-element-loader></x-element-loader>\n } @else if (result) {\n <div class=\"x-calc-results\">\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Peak load</div>\n <div class=\"x-calc-result-value\">{{ result.peakLoadW | number: '1.0-0' }} W</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Daily energy</div>\n <div class=\"x-calc-result-value\">{{ result.dailyEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Night energy</div>\n <div class=\"x-calc-result-value\">{{ result.nightEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended inverter</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedInverterVA | number: '1.0-0' }} VA</div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedInverterContinuousVA | number: '1.0-0' }} VA continuous \u00B7\n {{ result.recommendedInverterSurgeVA | number: '1.0-0' }} VA surge\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended battery bank</div>\n <div class=\"x-calc-result-value\">\n {{ result.recommendedBatteryCapacityAh | number: '1.0-0' }} Ah @ {{ result.recommendedSystemVoltage }}V\n </div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedBatteryUsableKwh | number: '1.1-2' }} kWh usable\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended solar array</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedArrayWp | number: '1.0-0' }} Wp</div>\n <div class=\"x-calc-result-sub\">\n {{ result.sunHoursUsed | number: '1.1-2' }} peak sun-hours/day\n @if (result.sunHoursSource === 'fallback') {\n (Nigeria-wide average \u2014 pick your state for a closer estimate)\n }\n </div>\n </div>\n </div>\n\n @if (result.warnings.length) {\n <ul class=\"x-calc-warnings\">\n @for (warning of result.warnings; track warning) {\n <li>{{ warning }}</li>\n }\n </ul>\n }\n\n <div class=\"x-calc-save\">\n <input\n type=\"text\"\n placeholder=\"Name this system (optional)\"\n [(ngModel)]=\"sessionName\"\n />\n <button type=\"button\" [disabled]=\"saving\" (click)=\"save()\">\n {{ sessionId ? 'Update saved link' : 'Save & share' }}\n </button>\n @if (shareUrl) {\n <a class=\"x-calc-save-link\" [href]=\"shareUrl\">{{ shareUrl }}</a>\n }\n </div>\n\n @if (!expertReviewOpen) {\n <button type=\"button\" class=\"x-calc-expert-btn\" (click)=\"openExpertReview()\">\n Have someone check this for me\n </button>\n } @else if (expertReviewSent) {\n <div class=\"x-calc-expert-sent\">Sent \u2014 our team will review this and reach out.</div>\n } @else {\n <div class=\"x-calc-expert-form\">\n <input\n type=\"tel\"\n placeholder=\"Phone or WhatsApp number\"\n [(ngModel)]=\"expertReviewPhone\"\n />\n <textarea placeholder=\"Anything else to add? (optional)\" [(ngModel)]=\"expertReviewNote\"></textarea>\n <button\n type=\"button\"\n [disabled]=\"expertReviewSending || !expertReviewPhone.trim()\"\n (click)=\"submitExpertReview()\"\n >\n Send to an expert\n </button>\n </div>\n }\n }\n</div>\n", styles: [".x-calc{display:flex;flex-direction:column;gap:16px;padding:16px;max-width:960px;margin:0 auto}.x-calc-intro{margin:-8px 0 0;color:var(--color-text-muted)}.x-calc-state{display:flex;flex-direction:column;gap:4px;max-width:320px}.x-calc-state label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-state select{padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add{display:flex;flex-wrap:wrap;gap:12px;align-items:center}.x-calc-add-input{flex:1;min-width:220px;padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add-custom{padding:10px 14px;border:1px dashed var(--color-border-strong);border-radius:6px;background:transparent;color:var(--color-text);cursor:pointer;white-space:nowrap}.x-calc-picker{display:flex;flex-direction:column;gap:2px;border:1px solid var(--color-border);border-radius:6px;max-height:240px;overflow-y:auto}.x-calc-picker-item{display:flex;justify-content:space-between;padding:10px 12px;border:0;background:var(--color-surface);color:var(--color-text);text-align:left;cursor:pointer}.x-calc-picker-item:hover{background:color-mix(in srgb,var(--color-accent) 8%,var(--color-surface))}.x-calc-picker-watts{font-family:var(--font-mono);color:var(--color-text-muted)}.x-calc-picker-empty{padding:12px;color:var(--color-text-muted)}.x-calc-empty{padding:32px 16px;text-align:center;color:var(--color-text-muted);border:1px dashed var(--color-border);border-radius:8px}.x-calc-table-wrap{overflow-x:auto}.x-calc-table{width:100%;min-width:640px;border-collapse:collapse}.x-calc-table th,.x-calc-table td{padding:8px 10px;border-bottom:1px solid var(--color-border);text-align:left}.x-calc-table th{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-cell-center{text-align:center}.x-calc-cell-input{width:100%;padding:6px 8px;border:1px solid var(--color-border);border-radius:4px;background:var(--color-surface);color:var(--color-text)}.x-calc-cell-input-num{width:80px}.x-calc-remove{width:28px;height:28px;border-radius:14px;border:0;background:color-mix(in srgb,var(--color-danger) 12%,var(--color-surface));color:var(--color-danger);font-size:16px;cursor:pointer}.x-calc-assumptions{border:1px solid var(--color-border);border-radius:8px;padding:12px}.x-calc-assumptions summary{cursor:pointer;font-weight:700}.x-calc-assumptions-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;margin-top:12px}.x-calc-assumptions-grid label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-assumptions-grid input{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-size:14px}.x-calc-results{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-calc-result-card{border:1px solid var(--color-border);border-radius:8px;padding:14px}.x-calc-result-label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted);margin-bottom:6px}.x-calc-result-value{font-family:var(--font-mono);font-size:22px;font-weight:800;color:var(--color-text)}.x-calc-result-sub{margin-top:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-warnings{margin:0;padding-left:18px;color:var(--color-warn);font-size:13px}.x-calc-save{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-save input{flex:1;min-width:180px;padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-save button{padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer;white-space:nowrap}.x-calc-save button:disabled{opacity:.5;cursor:not-allowed}.x-calc-save-link{flex-basis:100%;font-family:var(--font-mono);font-size:12px;color:var(--color-link);word-break:break-all}.x-calc-expert-btn{align-self:flex-start;padding:10px 14px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-brand);cursor:pointer}.x-calc-expert-form{display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-expert-form input,.x-calc-expert-form textarea{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-family:inherit}.x-calc-expert-form textarea{min-height:60px;resize:vertical}.x-calc-expert-form button{align-self:flex-start;padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer}.x-calc-expert-form button:disabled{opacity:.5;cursor:not-allowed}.x-calc-expert-sent{padding:14px;border:1px solid var(--color-success);border-radius:8px;color:var(--color-success)}\n"] }]
304
+ args: [{ standalone: false, selector: 'x-calculator', template: "<div class=\"x-calc\">\n <x-tilmart-section-header title=\"Load & sizing calculator\"></x-tilmart-section-header>\n <p class=\"x-calc-intro\">\n Build your appliance list and get an inverter, battery and panel recommendation.\n </p>\n\n <div class=\"x-calc-state\">\n <label for=\"x-calc-state-select\">Your state</label>\n <select id=\"x-calc-state-select\" [(ngModel)]=\"selectedState\" (ngModelChange)=\"onFieldChange()\">\n <option [ngValue]=\"undefined\">Nigeria-wide average</option>\n @for (state of states; track state) {\n <option [ngValue]=\"state\">{{ state }}</option>\n }\n </select>\n </div>\n\n <div class=\"x-calc-add\">\n <input\n type=\"search\"\n class=\"x-calc-add-input\"\n placeholder=\"Search appliances \u2014 fridge, TV, fan, pump\u2026\"\n [(ngModel)]=\"librarySearchTerm\"\n />\n <button type=\"button\" class=\"x-calc-add-custom\" (click)=\"addCustomLine()\">\n + Add a custom appliance\n </button>\n </div>\n\n @if (librarySearchTerm && !loadingLibrary) {\n <div class=\"x-calc-picker\">\n @for (item of filteredLibrary; track item.id) {\n <button type=\"button\" class=\"x-calc-picker-item\" (click)=\"addFromLibrary(item)\">\n <span class=\"x-calc-picker-name\">{{ item.name }}</span>\n <span class=\"x-calc-picker-watts\">{{ item.defaultWatts }}W</span>\n </button>\n } @empty {\n <div class=\"x-calc-picker-empty\">No match in the appliance library.</div>\n }\n </div>\n }\n\n @if (lines.length) {\n <div class=\"x-calc-table-wrap\">\n <table class=\"x-calc-table\">\n <thead>\n <tr>\n <th>Appliance</th>\n <th>Watts</th>\n <th>Qty</th>\n <th>Hours/day</th>\n <th>Runs at night</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (line of lines; track line.id) {\n <tr>\n <td>\n <input\n type=\"text\"\n class=\"x-calc-cell-input\"\n [(ngModel)]=\"line.name\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <input\n type=\"number\"\n min=\"1\"\n class=\"x-calc-cell-input x-calc-cell-input-num\"\n [(ngModel)]=\"line.watts\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.quantity\"\n (inc)=\"onQuantityChange(line, line.quantity + 1)\"\n (dec)=\"onQuantityChange(line, line.quantity - 1)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.hoursPerDay\"\n [min]=\"0\"\n (inc)=\"onHoursChange(line, line.hoursPerDay + 0.5)\"\n (dec)=\"onHoursChange(line, line.hoursPerDay - 0.5)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td class=\"x-calc-cell-center\">\n <input\n type=\"checkbox\"\n [(ngModel)]=\"line.runsAtNight\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td class=\"x-calc-cell-center\">\n <button\n type=\"button\"\n class=\"x-calc-remove\"\n aria-label=\"Remove appliance\"\n (click)=\"removeLine(line.id)\"\n >\n &times;\n </button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n } @else {\n <div class=\"x-calc-empty\">\n Search the appliance library above or add a custom appliance to get started.\n </div>\n }\n\n @if (lines.length) {\n <details class=\"x-calc-assumptions\">\n <summary>Assumptions</summary>\n <div class=\"x-calc-assumptions-grid\">\n <label>\n Depth of discharge (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.dodPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Days of autonomy\n <input\n type=\"number\"\n min=\"0\"\n step=\"0.5\"\n [(ngModel)]=\"assumptions.autonomyDays\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter power factor\n <input\n type=\"number\"\n min=\"0.1\"\n max=\"1\"\n step=\"0.05\"\n [(ngModel)]=\"assumptions.inverterPowerFactor\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter headroom (%)\n <input\n type=\"number\"\n min=\"0\"\n [(ngModel)]=\"assumptions.inverterHeadroomPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Battery round-trip efficiency (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.batteryRoundTripEfficiencyPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n System losses (%)\n <input\n type=\"number\"\n min=\"0\"\n max=\"90\"\n [(ngModel)]=\"assumptions.systemLossPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n </div>\n </details>\n }\n\n @if (loadingResult) {\n <x-element-loader></x-element-loader>\n } @else if (result) {\n <div class=\"x-calc-results\">\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Peak load</div>\n <div class=\"x-calc-result-value\">{{ result.peakLoadW | number: '1.0-0' }} W</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Daily energy</div>\n <div class=\"x-calc-result-value\">{{ result.dailyEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Night energy</div>\n <div class=\"x-calc-result-value\">{{ result.nightEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended inverter</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedInverterVA | number: '1.0-0' }} VA</div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedInverterContinuousVA | number: '1.0-0' }} VA continuous \u00B7\n {{ result.recommendedInverterSurgeVA | number: '1.0-0' }} VA surge\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended battery bank</div>\n <div class=\"x-calc-result-value\">\n {{ result.recommendedBatteryCapacityAh | number: '1.0-0' }} Ah @ {{ result.recommendedSystemVoltage }}V\n </div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedBatteryUsableKwh | number: '1.1-2' }} kWh usable\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended solar array</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedArrayWp | number: '1.0-0' }} Wp</div>\n <div class=\"x-calc-result-sub\">\n {{ result.sunHoursUsed | number: '1.1-2' }} peak sun-hours/day\n @if (result.sunHoursSource === 'fallback') {\n (Nigeria-wide average \u2014 pick your state for a closer estimate)\n }\n </div>\n </div>\n </div>\n\n @if (result.warnings.length) {\n <ul class=\"x-calc-warnings\">\n @for (warning of result.warnings; track warning) {\n <li>{{ warning }}</li>\n }\n </ul>\n }\n\n <section class=\"x-calc-reco\">\n <h3 class=\"x-calc-reco-title\">Products that fit this load</h3>\n @if (recommendations.length) {\n <ul class=\"x-calc-reco-list\">\n @for (rec of recommendations; track rec.role) {\n <li class=\"x-calc-reco-item\">\n @if (imageFor(rec); as img) {\n <img class=\"x-calc-reco-img\" [src]=\"img\" [alt]=\"rec.name\" loading=\"lazy\" (error)=\"brokenImages.add(rec.role)\" [hidden]=\"brokenImages.has(rec.role)\" />\n @if (brokenImages.has(rec.role)) {\n <div class=\"x-calc-reco-img x-calc-reco-img-empty\"></div>\n }\n } @else {\n <div class=\"x-calc-reco-img x-calc-reco-img-empty\"></div>\n }\n <div class=\"x-calc-reco-body\">\n <div class=\"x-calc-reco-role\">{{ roleLabel(rec.role) }}</div>\n <a class=\"x-calc-reco-name\" [routerLink]=\"['/p', rec.slug ?? rec.productId]\">{{ rec.name }}</a>\n <div class=\"x-calc-reco-sub\">{{ rec.summary }}</div>\n <div class=\"x-calc-reco-price\">\n {{ rec.currency }} {{ rec.unitPrice * rec.quantity | number: '1.0-0' }}\n @if (rec.compareAtAmount && rec.compareAtAmount > rec.unitPrice) {\n <span class=\"x-calc-reco-was\">{{ rec.currency }} {{ rec.compareAtAmount * rec.quantity | number: '1.0-0' }}</span>\n }\n </div>\n </div>\n <button type=\"button\" class=\"x-calc-reco-add\" (click)=\"addRecommendationToCart(rec)\">\n Add to cart\n </button>\n </li>\n }\n </ul>\n <div class=\"x-calc-reco-foot\">\n <div class=\"x-calc-reco-total\">\n Total: <strong>{{ recommendationsCurrency }} {{ recommendationsTotal | number: '1.0-0' }}</strong>\n </div>\n <button type=\"button\" class=\"x-calc-reco-add-all\" (click)=\"addAllToCart()\">\n Add all to cart\n </button>\n </div>\n } @else {\n <p class=\"x-calc-reco-empty\">\n We couldn't match a priced product to these numbers yet \u2014 browse the\n <a routerLink=\"/kits\">kits</a> or <a routerLink=\"/tools/kit-builder\">build your own</a>.\n </p>\n }\n </section>\n\n <div class=\"x-calc-save\">\n <input\n type=\"text\"\n placeholder=\"Name this system (optional)\"\n [(ngModel)]=\"sessionName\"\n />\n <button type=\"button\" [disabled]=\"saving\" (click)=\"save()\">\n {{ sessionId ? 'Update saved link' : 'Save & share' }}\n </button>\n @if (shareUrl) {\n <a class=\"x-calc-save-link\" [href]=\"shareUrl\">{{ shareUrl }}</a>\n }\n </div>\n\n @if (!expertReviewOpen) {\n <button type=\"button\" class=\"x-calc-expert-btn\" (click)=\"openExpertReview()\">\n Have someone check this for me\n </button>\n } @else if (expertReviewSent) {\n <div class=\"x-calc-expert-sent\">Sent \u2014 our team will review this and reach out.</div>\n } @else {\n <div class=\"x-calc-expert-form\">\n <input\n type=\"tel\"\n placeholder=\"Phone or WhatsApp number\"\n [(ngModel)]=\"expertReviewPhone\"\n />\n <textarea placeholder=\"Anything else to add? (optional)\" [(ngModel)]=\"expertReviewNote\"></textarea>\n <button\n type=\"button\"\n [disabled]=\"expertReviewSending || !expertReviewPhone.trim()\"\n (click)=\"submitExpertReview()\"\n >\n Send to an expert\n </button>\n </div>\n }\n }\n</div>\n", styles: [".x-calc{display:flex;flex-direction:column;gap:16px;padding:16px;max-width:960px;margin:0 auto}.x-calc-intro{margin:-8px 0 0;color:var(--color-text-muted)}.x-calc-state{display:flex;flex-direction:column;gap:4px;max-width:320px}.x-calc-state label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-state select{padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add{display:flex;flex-wrap:wrap;gap:12px;align-items:center}.x-calc-add-input{flex:1;min-width:220px;padding:10px 12px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-add-custom{padding:10px 14px;border:1px dashed var(--color-border-strong);border-radius:6px;background:transparent;color:var(--color-text);cursor:pointer;white-space:nowrap}.x-calc-picker{display:flex;flex-direction:column;gap:2px;border:1px solid var(--color-border);border-radius:6px;max-height:240px;overflow-y:auto}.x-calc-picker-item{display:flex;justify-content:space-between;padding:10px 12px;border:0;background:var(--color-surface);color:var(--color-text);text-align:left;cursor:pointer}.x-calc-picker-item:hover{background:color-mix(in srgb,var(--color-accent) 8%,var(--color-surface))}.x-calc-picker-watts{font-family:var(--font-mono);color:var(--color-text-muted)}.x-calc-picker-empty{padding:12px;color:var(--color-text-muted)}.x-calc-empty{padding:32px 16px;text-align:center;color:var(--color-text-muted);border:1px dashed var(--color-border);border-radius:8px}.x-calc-table-wrap{overflow-x:auto}.x-calc-table{width:100%;min-width:640px;border-collapse:collapse}.x-calc-table th,.x-calc-table td{padding:8px 10px;border-bottom:1px solid var(--color-border);text-align:left}.x-calc-table th{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted)}.x-calc-cell-center{text-align:center}.x-calc-cell-input{width:100%;padding:6px 8px;border:1px solid var(--color-border);border-radius:4px;background:var(--color-surface);color:var(--color-text)}.x-calc-cell-input-num{width:80px}.x-calc-remove{width:28px;height:28px;border-radius:14px;border:0;background:color-mix(in srgb,var(--color-danger) 12%,var(--color-surface));color:var(--color-danger);font-size:16px;cursor:pointer}.x-calc-assumptions{border:1px solid var(--color-border);border-radius:8px;padding:12px}.x-calc-assumptions summary{cursor:pointer;font-weight:700}.x-calc-assumptions-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;margin-top:12px}.x-calc-assumptions-grid label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-assumptions-grid input{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-size:14px}.x-calc-results{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.x-calc-result-card{border:1px solid var(--color-border);border-radius:8px;padding:14px}.x-calc-result-label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-muted);margin-bottom:6px}.x-calc-result-value{font-family:var(--font-mono);font-size:22px;font-weight:800;color:var(--color-text)}.x-calc-result-sub{margin-top:4px;font-size:12px;color:var(--color-text-muted)}.x-calc-warnings{margin:0;padding-left:18px;color:var(--color-warn);font-size:13px}.x-calc-save{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-save input{flex:1;min-width:180px;padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text)}.x-calc-save button{padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer;white-space:nowrap}.x-calc-save button:disabled{opacity:.5;cursor:not-allowed}.x-calc-save-link{flex-basis:100%;font-family:var(--font-mono);font-size:12px;color:var(--color-link);word-break:break-all}.x-calc-expert-btn{align-self:flex-start;padding:10px 14px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-brand);cursor:pointer}.x-calc-expert-form{display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-expert-form input,.x-calc-expert-form textarea{padding:8px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);color:var(--color-text);font-family:inherit}.x-calc-expert-form textarea{min-height:60px;resize:vertical}.x-calc-expert-form button{align-self:flex-start;padding:8px 14px;border-radius:6px;border:0;background:var(--color-brand);color:var(--color-brand-fg);font-weight:700;cursor:pointer}.x-calc-expert-form button:disabled{opacity:.5;cursor:not-allowed}.x-calc-expert-sent{padding:14px;border:1px solid var(--color-success);border-radius:8px;color:var(--color-success)}.x-calc-reco{display:flex;flex-direction:column;gap:10px;padding:14px;border:1px solid var(--color-border);border-radius:8px}.x-calc-reco-title{margin:0;font-size:16px;font-weight:800}.x-calc-reco-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}.x-calc-reco-item{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.x-calc-reco-img{width:56px;height:56px;object-fit:cover;border-radius:6px;flex-shrink:0}.x-calc-reco-img-empty{background:var(--color-surface-2)}.x-calc-reco-body{flex:1;min-width:180px;display:flex;flex-direction:column;gap:2px}.x-calc-reco-role{font-size:11px;font-weight:700;text-transform:uppercase;color:var(--color-text-muted)}.x-calc-reco-name{font-weight:700;color:var(--color-text);text-decoration:none}.x-calc-reco-sub{font-size:12.5px;color:var(--color-text-muted)}.x-calc-reco-price{font-family:var(--font-mono);font-weight:700;font-size:14px}.x-calc-reco-was{margin-left:6px;font-weight:400;font-size:12px;color:var(--color-text-muted);text-decoration:line-through}.x-calc-reco-add,.x-calc-reco-add-all{padding:8px 14px;border-radius:6px;font-weight:700;cursor:pointer;border:1px solid var(--color-border);background:var(--color-surface);color:var(--color-text)}.x-calc-reco-add-all{background:var(--color-accent);border-color:var(--color-accent);color:var(--color-accent-fg)}.x-calc-reco-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding-top:10px;border-top:1px solid var(--color-border)}.x-calc-reco-empty{margin:0;font-size:13.5px;color:var(--color-text-muted)}\n"] }]
241
305
  }] });
242
306
 
243
307
  class CalculatorModule {
@@ -264,4 +328,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
264
328
  }] });
265
329
 
266
330
  export { CalculatorModule };
267
- //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-buyer-calculator.module-BjV4sLrl.mjs.map
331
+ //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-buyer-calculator.module-DxAynSxK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isaiahiroko-tilmart-ngx-apps-buyer-calculator.module-DxAynSxK.mjs","sources":["../../../projects/buyer/src/lib/pages/tools/calculator/calculator.component.ts","../../../projects/buyer/src/lib/pages/tools/calculator/calculator.component.html","../../../projects/buyer/src/lib/pages/tools/calculator/calculator.module.ts"],"sourcesContent":["import { Component, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { BaseDirective, notify, using } from '@thescaffold/ngx-core';\nimport { Subject, catchError, debounceTime, map, of, switchMap, takeUntil } from 'rxjs';\nimport { requestExpertReview } from '../../../data/expert-review';\nimport { withWidth, blobUrl } from '../../../data/media';\nimport { loadToolSessionByShareToken, saveToolSession } from '../../../data/tool-session';\nimport { CartAddService } from '../../../services/cart-add.service';\nimport { CartStoreService } from '../../../services/cart-store.service';\n\ninterface ApplianceLibraryRow {\n id: string;\n name: string;\n category: string;\n defaultWatts: number;\n isInductive: boolean;\n surgeFactor: number;\n typicalHours?: number;\n}\n\ninterface CalculatorLine {\n id: string;\n name: string;\n watts: number;\n quantity: number;\n hoursPerDay: number;\n runsAtNight: boolean;\n isInductive: boolean;\n surgeFactor: number;\n}\n\ninterface CalculatorAssumptions {\n dodPercent: number;\n autonomyDays: number;\n inverterPowerFactor: number;\n inverterHeadroomPercent: number;\n batteryRoundTripEfficiencyPercent: number;\n systemLossPercent: number;\n}\n\ninterface RecommendationVm {\n role: 'inverter' | 'battery' | 'panel';\n productId: string;\n variantId: string;\n name: string;\n slug?: string;\n thumbnailBlobId?: string;\n quantity: number;\n unitPrice: number;\n compareAtAmount?: number;\n currency: string;\n summary: string;\n}\n\nconst ROLE_LABEL: Record<RecommendationVm['role'], string> = {\n inverter: 'Inverter',\n battery: 'Battery bank',\n panel: 'Solar panels',\n};\n\ninterface SizingResultVm {\n peakLoadW: number;\n dailyEnergyWh: number;\n nightEnergyWh: number;\n recommendedInverterContinuousVA: number;\n recommendedInverterSurgeVA: number;\n recommendedInverterVA: number;\n recommendedSystemVoltage: number;\n recommendedBatteryCapacityAh: number;\n recommendedBatteryUsableKwh: number;\n recommendedArrayWp: number;\n sunHoursUsed: number;\n sunHoursSource: 'state' | 'fallback';\n warnings: string[];\n recommendations?: RecommendationVm[];\n}\n\nconst DEFAULT_ASSUMPTIONS: CalculatorAssumptions = {\n dodPercent: 50,\n autonomyDays: 1,\n inverterPowerFactor: 0.8,\n inverterHeadroomPercent: 20,\n batteryRoundTripEfficiencyPercent: 90,\n systemLossPercent: 25,\n};\n\n// TOOL-01 — `/tools/calculator`. Appliance table (from the seeded\n// library, P3.1, or a free-text custom line) drives `SizingWorkflow`\n// (P3.2, `POST sizing/estimate`) on every change, debounced so a table\n// full of number inputs doesn't fire one request per keystroke.\n// Assumptions are shown and editable per TOOL-01's own requirement, with\n// `SizingWorkflow`'s own defaults pre-filled.\n//\n// \"Results convert directly into a kit\" (TOOL-01): `sizing/estimate`\n// also returns the cheapest priced inverter / battery bank / panel\n// string that meet the numbers (`recommendations`), and \"Add to cart\"\n// drops them into the guest cart. A pre-filled `Quote` request (P4.5)\n// is still unbuilt.\n//\n// Session persistence/sharing (P3.8) — `?s=<shareToken>` restores a\n// saved run on load; \"Save & share\" writes the current appliance list/\n// assumptions/state to a `ToolSession` row and hands back a shareable\n// URL. Guest-first via a `deviceToken` in localStorage; a signed-in\n// customer's sessions carrying forward on login needs a real `Customer`\n// entity (P4.5) and isn't attempted here.\n@Component({\n standalone: false,\n selector: 'x-calculator',\n templateUrl: './calculator.component.html',\n styleUrl: './calculator.component.scss',\n})\nexport class CalculatorComponent extends BaseDirective {\n private readonly route = inject(ActivatedRoute);\n private readonly cartAdd = inject(CartAddService);\n private readonly cartStore = inject(CartStoreService);\n private readonly libSource = this.apiService.on('apps/commerce/appliance-library-item');\n private readonly irradianceSource = this.apiService.on('apps/commerce/irradiance-profile');\n private readonly recompute$ = new Subject<void>();\n private nextId = 1;\n\n library: ApplianceLibraryRow[] = [];\n states: string[] = [];\n librarySearchTerm = '';\n loadingLibrary = true;\n\n lines: CalculatorLine[] = [];\n selectedState?: string;\n assumptions: CalculatorAssumptions = { ...DEFAULT_ASSUMPTIONS };\n\n result?: SizingResultVm;\n loadingResult = false;\n\n sessionId?: string;\n sessionName = '';\n shareUrl?: string;\n saving = false;\n\n expertReviewOpen = false;\n expertReviewPhone = '';\n expertReviewNote = '';\n expertReviewSending = false;\n expertReviewSent = false;\n\n readonly brokenImages = new Set<string>();\n\n get recommendations(): RecommendationVm[] {\n return this.result?.recommendations ?? [];\n }\n\n get recommendationsTotal(): number {\n return this.recommendations.reduce((sum, r) => sum + r.unitPrice * r.quantity, 0);\n }\n\n get recommendationsCurrency(): string {\n return this.recommendations[0]?.currency ?? 'NGN';\n }\n\n roleLabel(role: RecommendationVm['role']): string {\n return ROLE_LABEL[role];\n }\n\n imageFor(rec: RecommendationVm): string | undefined {\n return withWidth(blobUrl(rec.thumbnailBlobId), 160);\n }\n\n addRecommendationToCart(rec: RecommendationVm): void {\n this.cartAdd.add(this.toCartInput(rec));\n }\n\n addAllToCart(): void {\n const recs = this.recommendations;\n if (!recs.length) return;\n for (const rec of recs) {\n const input = this.toCartInput(rec);\n this.cartStore.addLine({\n variantId: input.variantId!,\n productId: input.productId,\n name: input.name,\n slug: input.slug,\n imageUrl: withWidth(input.imageUrl, 160),\n quantity: input.quantity ?? 1,\n unitPrice: input.unitPrice,\n compareAtPrice: input.compareAtPrice,\n currency: input.currency,\n });\n }\n notify(`${recs.length} item${recs.length === 1 ? '' : 's'} added to your cart.`, undefined, 'success');\n }\n\n private toCartInput(rec: RecommendationVm) {\n return {\n variantId: rec.variantId,\n productId: rec.productId,\n name: rec.name,\n slug: rec.slug,\n imageUrl: blobUrl(rec.thumbnailBlobId),\n unitPrice: rec.unitPrice,\n compareAtPrice: rec.compareAtAmount,\n currency: rec.currency,\n quantity: rec.quantity,\n };\n }\n\n get filteredLibrary(): ApplianceLibraryRow[] {\n const term = this.librarySearchTerm.trim().toLowerCase();\n if (!term) return this.library;\n return this.library.filter(\n (item) =>\n item.name.toLowerCase().includes(term) || item.category.toLowerCase().includes(term),\n );\n }\n\n override init = () => {\n this.libSource\n .getMany({ page: 1, perPage: 200 } as any)\n .pipe(takeUntil(this.$))\n .subscribe(\n using((response: any) => {\n this.library = (response?.data ?? []).map((item: any) => ({\n id: item.id,\n name: item.name,\n category: item.category,\n defaultWatts: Number(item.defaultWatts),\n isInductive: item.isInductive,\n surgeFactor: Number(item.surgeFactor),\n typicalHours: item.typicalHours != null ? Number(item.typicalHours) : undefined,\n }));\n this.loadingLibrary = false;\n }),\n );\n\n this.irradianceSource\n .getMany({ page: 1, perPage: 100 } as any)\n .pipe(takeUntil(this.$))\n .subscribe(\n using((response: any) => {\n this.states = (response?.data ?? []).map((p: any) => p.state).sort();\n }),\n );\n\n const shareToken = this.route.snapshot.queryParamMap.get('s');\n if (shareToken) {\n loadToolSessionByShareToken(this.apiService, shareToken)\n .pipe(takeUntil(this.$))\n .subscribe(\n using((session) => {\n if (!session) return;\n const input = session.input as {\n appliances?: Omit<CalculatorLine, 'id'>[];\n state?: string;\n assumptions?: CalculatorAssumptions;\n };\n this.sessionId = session.id;\n this.sessionName = session.name ?? '';\n this.shareUrl = this.buildShareUrl(session.shareToken);\n this.selectedState = input.state;\n this.assumptions = { ...DEFAULT_ASSUMPTIONS, ...input.assumptions };\n this.lines = (input.appliances ?? []).map((a) => ({\n ...a,\n id: String(this.nextId++),\n }));\n this.triggerRecompute();\n }),\n );\n }\n\n this.recompute$\n .pipe(\n debounceTime(300),\n switchMap(() =>\n this.apiService\n .post('apps/commerce/sizing/estimate', this.buildRequestBody())\n .pipe(catchError(() => of(undefined))),\n ),\n takeUntil(this.$),\n )\n .subscribe(\n using((response: any) => {\n this.loadingResult = false;\n this.result = response?.data;\n }),\n );\n };\n\n addFromLibrary(item: ApplianceLibraryRow): void {\n this.lines.push({\n id: String(this.nextId++),\n name: item.name,\n watts: item.defaultWatts,\n quantity: 1,\n hoursPerDay: item.typicalHours ?? 4,\n runsAtNight: false,\n isInductive: item.isInductive,\n surgeFactor: item.surgeFactor,\n });\n this.librarySearchTerm = '';\n this.triggerRecompute();\n }\n\n addCustomLine(): void {\n this.lines.push({\n id: String(this.nextId++),\n name: 'Custom appliance',\n watts: 100,\n quantity: 1,\n hoursPerDay: 4,\n runsAtNight: false,\n isInductive: false,\n surgeFactor: 1,\n });\n this.triggerRecompute();\n }\n\n removeLine(id: string): void {\n this.lines = this.lines.filter((l) => l.id !== id);\n this.triggerRecompute();\n }\n\n onQuantityChange(line: CalculatorLine, next: number): void {\n line.quantity = Math.max(1, next);\n this.triggerRecompute();\n }\n\n onHoursChange(line: CalculatorLine, next: number): void {\n line.hoursPerDay = Math.min(24, Math.max(0, Math.round(next * 2) / 2));\n this.triggerRecompute();\n }\n\n onFieldChange(): void {\n this.triggerRecompute();\n }\n\n save(): void {\n this.saving = true;\n this.persistSession().subscribe(\n using(() => {\n this.saving = false;\n }),\n );\n }\n\n openExpertReview(): void {\n this.expertReviewOpen = true;\n this.expertReviewSent = false;\n }\n\n submitExpertReview(): void {\n if (!this.expertReviewPhone.trim()) return;\n this.expertReviewSending = true;\n this.persistSession()\n .pipe(\n switchMap(() =>\n requestExpertReview(this.apiService, {\n contactPhone: this.expertReviewPhone,\n contextSummary: `Load & sizing calculator: ${this.shareUrl}`,\n note: this.expertReviewNote || undefined,\n }),\n ),\n takeUntil(this.$),\n )\n .subscribe(\n using(() => {\n this.expertReviewSending = false;\n this.expertReviewSent = true;\n }),\n );\n }\n\n // Shared by the plain \"Save & share\" button and \"have an expert check\n // this\" (TOOL-06 needs the full session context, which means a real\n // saved link, not just a text summary) — always saves/updates in\n // place rather than only saving when nothing's saved yet, so a review\n // request after further edits carries the latest numbers.\n private persistSession() {\n return saveToolSession(this.apiService, {\n id: this.sessionId,\n type: 'calculator',\n input: this.buildRequestBody(),\n output: this.result as unknown as Record<string, unknown>,\n name: this.sessionName || undefined,\n }).pipe(\n takeUntil(this.$),\n map((session) => {\n this.sessionId = session.id;\n this.shareUrl = this.buildShareUrl(session.shareToken);\n return session;\n }),\n );\n }\n\n private buildShareUrl(shareToken?: string): string | undefined {\n if (!shareToken) return undefined;\n return `${window.location.origin}/tools/calculator?s=${shareToken}`;\n }\n\n private triggerRecompute(): void {\n if (!this.lines.length) {\n this.result = undefined;\n this.loadingResult = false;\n return;\n }\n this.loadingResult = true;\n this.recompute$.next();\n }\n\n private buildRequestBody() {\n return {\n appliances: this.lines.map((l) => ({\n name: l.name,\n watts: l.watts,\n quantity: l.quantity,\n hoursPerDay: l.hoursPerDay,\n runsAtNight: l.runsAtNight,\n isInductive: l.isInductive,\n surgeFactor: l.surgeFactor,\n })),\n state: this.selectedState || undefined,\n assumptions: this.assumptions,\n };\n }\n}\n","<div class=\"x-calc\">\n <x-tilmart-section-header title=\"Load & sizing calculator\"></x-tilmart-section-header>\n <p class=\"x-calc-intro\">\n Build your appliance list and get an inverter, battery and panel recommendation.\n </p>\n\n <div class=\"x-calc-state\">\n <label for=\"x-calc-state-select\">Your state</label>\n <select id=\"x-calc-state-select\" [(ngModel)]=\"selectedState\" (ngModelChange)=\"onFieldChange()\">\n <option [ngValue]=\"undefined\">Nigeria-wide average</option>\n @for (state of states; track state) {\n <option [ngValue]=\"state\">{{ state }}</option>\n }\n </select>\n </div>\n\n <div class=\"x-calc-add\">\n <input\n type=\"search\"\n class=\"x-calc-add-input\"\n placeholder=\"Search appliances — fridge, TV, fan, pump…\"\n [(ngModel)]=\"librarySearchTerm\"\n />\n <button type=\"button\" class=\"x-calc-add-custom\" (click)=\"addCustomLine()\">\n + Add a custom appliance\n </button>\n </div>\n\n @if (librarySearchTerm && !loadingLibrary) {\n <div class=\"x-calc-picker\">\n @for (item of filteredLibrary; track item.id) {\n <button type=\"button\" class=\"x-calc-picker-item\" (click)=\"addFromLibrary(item)\">\n <span class=\"x-calc-picker-name\">{{ item.name }}</span>\n <span class=\"x-calc-picker-watts\">{{ item.defaultWatts }}W</span>\n </button>\n } @empty {\n <div class=\"x-calc-picker-empty\">No match in the appliance library.</div>\n }\n </div>\n }\n\n @if (lines.length) {\n <div class=\"x-calc-table-wrap\">\n <table class=\"x-calc-table\">\n <thead>\n <tr>\n <th>Appliance</th>\n <th>Watts</th>\n <th>Qty</th>\n <th>Hours/day</th>\n <th>Runs at night</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (line of lines; track line.id) {\n <tr>\n <td>\n <input\n type=\"text\"\n class=\"x-calc-cell-input\"\n [(ngModel)]=\"line.name\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <input\n type=\"number\"\n min=\"1\"\n class=\"x-calc-cell-input x-calc-cell-input-num\"\n [(ngModel)]=\"line.watts\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.quantity\"\n (inc)=\"onQuantityChange(line, line.quantity + 1)\"\n (dec)=\"onQuantityChange(line, line.quantity - 1)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td>\n <x-tilmart-quantity-stepper\n size=\"sm\"\n [value]=\"line.hoursPerDay\"\n [min]=\"0\"\n (inc)=\"onHoursChange(line, line.hoursPerDay + 0.5)\"\n (dec)=\"onHoursChange(line, line.hoursPerDay - 0.5)\"\n ></x-tilmart-quantity-stepper>\n </td>\n <td class=\"x-calc-cell-center\">\n <input\n type=\"checkbox\"\n [(ngModel)]=\"line.runsAtNight\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </td>\n <td class=\"x-calc-cell-center\">\n <button\n type=\"button\"\n class=\"x-calc-remove\"\n aria-label=\"Remove appliance\"\n (click)=\"removeLine(line.id)\"\n >\n &times;\n </button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n } @else {\n <div class=\"x-calc-empty\">\n Search the appliance library above or add a custom appliance to get started.\n </div>\n }\n\n @if (lines.length) {\n <details class=\"x-calc-assumptions\">\n <summary>Assumptions</summary>\n <div class=\"x-calc-assumptions-grid\">\n <label>\n Depth of discharge (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.dodPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Days of autonomy\n <input\n type=\"number\"\n min=\"0\"\n step=\"0.5\"\n [(ngModel)]=\"assumptions.autonomyDays\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter power factor\n <input\n type=\"number\"\n min=\"0.1\"\n max=\"1\"\n step=\"0.05\"\n [(ngModel)]=\"assumptions.inverterPowerFactor\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Inverter headroom (%)\n <input\n type=\"number\"\n min=\"0\"\n [(ngModel)]=\"assumptions.inverterHeadroomPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n Battery round-trip efficiency (%)\n <input\n type=\"number\"\n min=\"1\"\n max=\"100\"\n [(ngModel)]=\"assumptions.batteryRoundTripEfficiencyPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n <label>\n System losses (%)\n <input\n type=\"number\"\n min=\"0\"\n max=\"90\"\n [(ngModel)]=\"assumptions.systemLossPercent\"\n (ngModelChange)=\"onFieldChange()\"\n />\n </label>\n </div>\n </details>\n }\n\n @if (loadingResult) {\n <x-element-loader></x-element-loader>\n } @else if (result) {\n <div class=\"x-calc-results\">\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Peak load</div>\n <div class=\"x-calc-result-value\">{{ result.peakLoadW | number: '1.0-0' }} W</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Daily energy</div>\n <div class=\"x-calc-result-value\">{{ result.dailyEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Night energy</div>\n <div class=\"x-calc-result-value\">{{ result.nightEnergyWh / 1000 | number: '1.1-2' }} kWh</div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended inverter</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedInverterVA | number: '1.0-0' }} VA</div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedInverterContinuousVA | number: '1.0-0' }} VA continuous ·\n {{ result.recommendedInverterSurgeVA | number: '1.0-0' }} VA surge\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended battery bank</div>\n <div class=\"x-calc-result-value\">\n {{ result.recommendedBatteryCapacityAh | number: '1.0-0' }} Ah @ {{ result.recommendedSystemVoltage }}V\n </div>\n <div class=\"x-calc-result-sub\">\n {{ result.recommendedBatteryUsableKwh | number: '1.1-2' }} kWh usable\n </div>\n </div>\n <div class=\"x-calc-result-card\">\n <div class=\"x-calc-result-label\">Recommended solar array</div>\n <div class=\"x-calc-result-value\">{{ result.recommendedArrayWp | number: '1.0-0' }} Wp</div>\n <div class=\"x-calc-result-sub\">\n {{ result.sunHoursUsed | number: '1.1-2' }} peak sun-hours/day\n @if (result.sunHoursSource === 'fallback') {\n (Nigeria-wide average — pick your state for a closer estimate)\n }\n </div>\n </div>\n </div>\n\n @if (result.warnings.length) {\n <ul class=\"x-calc-warnings\">\n @for (warning of result.warnings; track warning) {\n <li>{{ warning }}</li>\n }\n </ul>\n }\n\n <section class=\"x-calc-reco\">\n <h3 class=\"x-calc-reco-title\">Products that fit this load</h3>\n @if (recommendations.length) {\n <ul class=\"x-calc-reco-list\">\n @for (rec of recommendations; track rec.role) {\n <li class=\"x-calc-reco-item\">\n @if (imageFor(rec); as img) {\n <img class=\"x-calc-reco-img\" [src]=\"img\" [alt]=\"rec.name\" loading=\"lazy\" (error)=\"brokenImages.add(rec.role)\" [hidden]=\"brokenImages.has(rec.role)\" />\n @if (brokenImages.has(rec.role)) {\n <div class=\"x-calc-reco-img x-calc-reco-img-empty\"></div>\n }\n } @else {\n <div class=\"x-calc-reco-img x-calc-reco-img-empty\"></div>\n }\n <div class=\"x-calc-reco-body\">\n <div class=\"x-calc-reco-role\">{{ roleLabel(rec.role) }}</div>\n <a class=\"x-calc-reco-name\" [routerLink]=\"['/p', rec.slug ?? rec.productId]\">{{ rec.name }}</a>\n <div class=\"x-calc-reco-sub\">{{ rec.summary }}</div>\n <div class=\"x-calc-reco-price\">\n {{ rec.currency }} {{ rec.unitPrice * rec.quantity | number: '1.0-0' }}\n @if (rec.compareAtAmount && rec.compareAtAmount > rec.unitPrice) {\n <span class=\"x-calc-reco-was\">{{ rec.currency }} {{ rec.compareAtAmount * rec.quantity | number: '1.0-0' }}</span>\n }\n </div>\n </div>\n <button type=\"button\" class=\"x-calc-reco-add\" (click)=\"addRecommendationToCart(rec)\">\n Add to cart\n </button>\n </li>\n }\n </ul>\n <div class=\"x-calc-reco-foot\">\n <div class=\"x-calc-reco-total\">\n Total: <strong>{{ recommendationsCurrency }} {{ recommendationsTotal | number: '1.0-0' }}</strong>\n </div>\n <button type=\"button\" class=\"x-calc-reco-add-all\" (click)=\"addAllToCart()\">\n Add all to cart\n </button>\n </div>\n } @else {\n <p class=\"x-calc-reco-empty\">\n We couldn't match a priced product to these numbers yet — browse the\n <a routerLink=\"/kits\">kits</a> or <a routerLink=\"/tools/kit-builder\">build your own</a>.\n </p>\n }\n </section>\n\n <div class=\"x-calc-save\">\n <input\n type=\"text\"\n placeholder=\"Name this system (optional)\"\n [(ngModel)]=\"sessionName\"\n />\n <button type=\"button\" [disabled]=\"saving\" (click)=\"save()\">\n {{ sessionId ? 'Update saved link' : 'Save & share' }}\n </button>\n @if (shareUrl) {\n <a class=\"x-calc-save-link\" [href]=\"shareUrl\">{{ shareUrl }}</a>\n }\n </div>\n\n @if (!expertReviewOpen) {\n <button type=\"button\" class=\"x-calc-expert-btn\" (click)=\"openExpertReview()\">\n Have someone check this for me\n </button>\n } @else if (expertReviewSent) {\n <div class=\"x-calc-expert-sent\">Sent — our team will review this and reach out.</div>\n } @else {\n <div class=\"x-calc-expert-form\">\n <input\n type=\"tel\"\n placeholder=\"Phone or WhatsApp number\"\n [(ngModel)]=\"expertReviewPhone\"\n />\n <textarea placeholder=\"Anything else to add? (optional)\" [(ngModel)]=\"expertReviewNote\"></textarea>\n <button\n type=\"button\"\n [disabled]=\"expertReviewSending || !expertReviewPhone.trim()\"\n (click)=\"submitExpertReview()\"\n >\n Send to an expert\n </button>\n </div>\n }\n }\n</div>\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '@thescaffold/ngx-core';\nimport { ElementsModule } from '@thescaffold/ngx-ui';\nimport { TilmartElementsModule } from '@isaiahiroko/tilmart-ngx-ui';\nimport { CalculatorComponent } from './calculator.component';\n\n@NgModule({\n declarations: [CalculatorComponent],\n imports: [\n SharedModule,\n ElementsModule,\n TilmartElementsModule,\n RouterModule.forChild([{ path: '', component: CalculatorComponent }]),\n ],\n})\nexport class CalculatorModule {}\n"],"names":["i2","i3","i4","i5","i1"],"mappings":";;;;;;;;;;;;;;;;;;AAsDA,MAAM,UAAU,GAA6C;AAC3D,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,OAAO,EAAE,cAAc;AACvB,IAAA,KAAK,EAAE,cAAc;CACtB;AAmBD,MAAM,mBAAmB,GAA0B;AACjD,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,mBAAmB,EAAE,GAAG;AACxB,IAAA,uBAAuB,EAAE,EAAE;AAC3B,IAAA,iCAAiC,EAAE,EAAE;AACrC,IAAA,iBAAiB,EAAE,EAAE;CACtB;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOM,MAAO,mBAAoB,SAAQ,aAAa,CAAA;AANtD,IAAA,WAAA,GAAA;;AAOmB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAC9B,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC;AAChC,QA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5D,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAT5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;AACnC,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,cAAc;wBACd,qBAAqB;AACrB,wBAAA,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACtE,qBAAA;AACF,iBAAA;;;;;"}
@@ -33,6 +33,7 @@ class CartAddService {
33
33
  imageUrl: withWidth(input.imageUrl, 160),
34
34
  quantity: Math.max(1, Math.round(input.quantity ?? 1)),
35
35
  unitPrice: input.unitPrice,
36
+ compareAtPrice: input.compareAtPrice,
36
37
  currency: input.currency,
37
38
  });
38
39
  notify(`${input.name} added to your cart.`, undefined, 'success');
@@ -47,6 +48,7 @@ class CartAddService {
47
48
  slug: card.slug,
48
49
  imageUrl: card.imageUrl,
49
50
  unitPrice: card.price,
51
+ compareAtPrice: card.compareAtPrice,
50
52
  currency: card.currency,
51
53
  });
52
54
  }
@@ -63,4 +65,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
63
65
  }] });
64
66
 
65
67
  export { CartAddService as C };
66
- //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-D2Xwziad.mjs.map
68
+ //# sourceMappingURL=isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-Dq1ngbpa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isaiahiroko-tilmart-ngx-apps-buyer-cart-add.service-Dq1ngbpa.mjs","sources":["../../../projects/buyer/src/lib/services/cart-add.service.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { notify } from '@thescaffold/ngx-core';\nimport { withWidth } from '../data/media';\nimport { ProductCardVm } from '../data/search-result-card';\nimport { CartStoreService } from './cart-store.service';\n\nexport interface CartAddInput {\n variantId?: string;\n productId: string;\n name: string;\n slug?: string;\n imageUrl?: string;\n unitPrice?: number;\n compareAtPrice?: number;\n currency?: string;\n quantity?: number;\n}\n\n// One entry point for every \"Add to cart\" button (search/category/brand\n// grids, PDP, compare). A guest cart is `CartStoreService` (localStorage);\n// the server cart is created lazily at checkout by `CartSyncService`, which\n// is also where stock is reserved — so adding here never blocks on network.\n@Injectable({ providedIn: 'root' })\nexport class CartAddService {\n private readonly store = inject(CartStoreService);\n private readonly router = inject(Router);\n\n /**\n * Adds one line. Returns false (and points the buyer at the product page)\n * when there is no purchasable variant to add yet.\n */\n add(input: CartAddInput): boolean {\n if (!input.variantId) {\n notify('Choose an option on the product page first.', undefined, 'info');\n if (input.slug) void this.router.navigate(['/p', input.slug]);\n return false;\n }\n this.store.addLine({\n variantId: input.variantId,\n productId: input.productId,\n name: input.name,\n slug: input.slug,\n imageUrl: withWidth(input.imageUrl, 160),\n quantity: Math.max(1, Math.round(input.quantity ?? 1)),\n unitPrice: input.unitPrice,\n compareAtPrice: input.compareAtPrice,\n currency: input.currency,\n });\n notify(`${input.name} added to your cart.`, undefined, 'success');\n return true;\n }\n\n /** Same as `add`, straight from a product-card view model. */\n addCard(card: ProductCardVm): boolean {\n return this.add({\n variantId: card.variantId,\n productId: card.productId,\n name: card.name,\n slug: card.slug,\n imageUrl: card.imageUrl,\n unitPrice: card.price,\n compareAtPrice: card.compareAtPrice,\n currency: card.currency,\n });\n }\n\n /** The card's \"Specs\" button — jump to the spec table on the PDP. */\n viewSpecs(card: ProductCardVm): void {\n void this.router.navigate(card.href, { fragment: 'specs' });\n }\n}\n"],"names":[],"mappings":";;;;;;;AAmBA;AACA;AACA;AACA;MAEa,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAChC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,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