@meetelise/chat 1.39.0 → 1.39.1

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.
@@ -3,6 +3,9 @@ import { FeeQuote } from "../../model/fee-quote";
3
3
  export declare class FeeItemComponent extends LitElement {
4
4
  static styles: import("lit").CSSResult;
5
5
  feeQuote: FeeQuote | null;
6
+ get name(): string;
7
+ get isRequired(): boolean;
8
+ get description(): string;
6
9
  render(): TemplateResult;
7
10
  }
8
11
  declare global {
@@ -29,6 +29,7 @@ export declare class BuildingFeeView {
29
29
  pricingType: "fixed" | "per-item" | "usage-based" | "percent-rent" | "custom";
30
30
  frequency: BuildingFeeFrequency;
31
31
  nlpPricing?: string;
32
+ isAddon: boolean;
32
33
  amount?: number;
33
34
  percentRent?: number;
34
35
  unitLabel?: string;
@@ -1,8 +1,11 @@
1
1
  import { SourceFee } from "./source-fee";
2
2
  import { AmountRange } from "./amount-range";
3
3
  import { ItemCombination } from "./item-combination";
4
+ import { RentableItem } from "./rentable-item";
4
5
  export interface FeeQuote {
5
- sourceFee: SourceFee;
6
+ sourceFee?: SourceFee;
7
+ sourceRentableItem?: RentableItem | null;
8
+ isAddon: boolean | null;
6
9
  amountRange: AmountRange;
7
10
  itemCombination: ItemCombination;
8
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.39.0",
3
+ "version": "1.39.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -3286,7 +3286,7 @@ xmlns="http://www.w3.org/2000/svg"
3286
3286
  margin: 2px 0;
3287
3287
  }
3288
3288
  }
3289
- `;class Qo{constructor(e={}){var t,i,n,o,r;this.id=null!==(t=e.id)&&void 0!==t?t:"",this.description=null!==(i=e.description)&&void 0!==i?i:"",this.rent=null!==(n=e.rent)&&void 0!==n?n:0,this.rentFrequency=null!==(o=e.rentFrequency)&&void 0!==o?o:"monthly",this.available=null!==(r=e.available)&&void 0!==r&&r,this.reservedUntil=e.reservedUntil?new Date(e.reservedUntil):void 0}}class Go{constructor(e={}){var t,i,n,o,r;this.description=null!==(t=e.description)&&void 0!==t?t:"",this.type=null!==(i=e.type)&&void 0!==i?i:"",this.minAvailableItem=e.minAvailableItem?new Qo(e.minAvailableItem):void 0,this.maxAvailableItem=e.maxAvailableItem?new Qo(e.maxAvailableItem):void 0,this.allItems=(null!==(n=e.allItems)&&void 0!==n?n:[]).map((e=>new Qo(e))),this.rent=null!==(o=e.rent)&&void 0!==o?o:0,this.priceDescription=null!==(r=e.priceDescription)&&void 0!==r?r:""}get displayName(){return this.description}get itemDescription(){return 0===this.allItems.length?"":this.allItems[0].description}}class qo{constructor(e=[]){this.quantities=e}toKey(){return this.quantities.sort(((e,t)=>e.itemType.localeCompare(t.itemType))).map((e=>`${e.itemType}:${e.quantity}`)).join(",")}}class Wo{constructor(e={}){var t;this.rules=new Map,(null!==(t=e.pricingRules)&&void 0!==t?t:[]).forEach((e=>this.addRule(e)))}addRule(e){const t=e.combination.toKey();this.rules.set(t,e)}getPrice(e){const t=e.toKey(),i=this.rules.get(t);return null==i?void 0:i.price}toRuleArray(){return Array.from(this.rules.values())}toJSON(){return{pricingRules:this.toRuleArray()}}static fromJSON(e){var t;return new Wo({pricingRules:null===(t=e.pricingRules)||void 0===t?void 0:t.map((e=>({...e,combination:new qo(e.combination.quantities)})))})}}var Vo;!function(e){e.OneTime="One Time",e.Monthly="Monthly",e.Quarterly="Quarterly",e.Annually="Annually",e.PerOccurrence="Per Occurrence"}(Vo||(Vo={}));class Yo{constructor(e={}){var t,i,n,o,r,a,s,l,u;this.category="Other",this.syncActive=!0,this.refundable=!1,this.publicFacing=!0,this.id=e.id,this.buildingId=null!==(t=e.buildingId)&&void 0!==t?t:0,this.feeName=null!==(i=e.feeName)&&void 0!==i?i:"",this.description=e.description,this.category=null!==(n=e.category)&&void 0!==n?n:"Other",this.unitIds=e.unitIds,this.layoutIds=e.layoutIds,this.startDate=e.startDate,this.endDate=e.endDate,this.source=e.source,this.externalKey=e.externalKey,this.syncActive=null===(o=e.syncActive)||void 0===o||o,this.hiddenReason=e.hiddenReason,this.refundable=null!==(r=e.refundable)&&void 0!==r&&r,this.bundleKey=e.bundleKey,this.publicFacing=null===(a=e.publicFacing)||void 0===a||a,this.chargeCode=e.chargeCode,this.prorated=e.prorated,this.pricingCategory=null!==(s=e.pricingCategory)&&void 0!==s?s:"mandatory",this.pricingType=null!==(l=e.pricingType)&&void 0!==l?l:"fixed",this.frequency=null!==(u=e.frequency)&&void 0!==u?u:Vo.OneTime,this.nlpPricing=e.nlpPricing,void 0!==e.amount&&(this.amount=e.amount),void 0!==e.percentRent&&(this.percentRent=e.percentRent),void 0!==e.unitLabel&&(this.unitLabel=e.unitLabel),void 0!==e.minAmount&&(this.minAmount=e.minAmount),void 0!==e.maxAmount&&(this.maxAmount=e.maxAmount);const c=e.customMatrixData;var d;c instanceof Wo?this.customMatrixData=c:(d=c)&&"object"==typeof d&&"pricingRules"in d&&Array.isArray(d.pricingRules)&&(this.customMatrixData=Wo.fromJSON(c))}get isOptional(){return"situational"===this.pricingCategory}get hasMatrix(){return!("custom"!==this.pricingType||!this.customMatrixData)}}const Ko=class{constructor(){this.params=new URLSearchParams}addSingle(e,t){return t?(this.params.append(e,t),this):this}addArray(e,t){return t?(t.forEach((t=>{t&&this.params.append(`${e}[]`,t)})),this):this}build(){return this.params.toString()?`?${this.params.toString()}`:""}},Xo=e=>new Yo(e),Zo=e=>new Go(e),Jo=async(e,i)=>{try{const n=(new Ko).addArray("layout_ids",null==i?void 0:i.map((e=>e.toString()))),o=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/fees?${n.build()}`);if(o.data){const e=fi(o.data);return{fees:e.fees.map(Xo),rentableItems:e.rentableItems.map(Zo),buildingIncentives:e.buildingIncentives}}}catch(t){xn({logType:Cn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_FEES]",logData:{error:t}})}return{fees:[],rentableItems:[],buildingIncentives:[]}},er=(e="black")=>B`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none">
3289
+ `;class Qo{constructor(e={}){var t,i,n,o,r;this.id=null!==(t=e.id)&&void 0!==t?t:"",this.description=null!==(i=e.description)&&void 0!==i?i:"",this.rent=null!==(n=e.rent)&&void 0!==n?n:0,this.rentFrequency=null!==(o=e.rentFrequency)&&void 0!==o?o:"monthly",this.available=null!==(r=e.available)&&void 0!==r&&r,this.reservedUntil=e.reservedUntil?new Date(e.reservedUntil):void 0}}class Go{constructor(e={}){var t,i,n,o,r;this.description=null!==(t=e.description)&&void 0!==t?t:"",this.type=null!==(i=e.type)&&void 0!==i?i:"",this.minAvailableItem=e.minAvailableItem?new Qo(e.minAvailableItem):void 0,this.maxAvailableItem=e.maxAvailableItem?new Qo(e.maxAvailableItem):void 0,this.allItems=(null!==(n=e.allItems)&&void 0!==n?n:[]).map((e=>new Qo(e))),this.rent=null!==(o=e.rent)&&void 0!==o?o:0,this.priceDescription=null!==(r=e.priceDescription)&&void 0!==r?r:""}get displayName(){return this.description}get itemDescription(){return 0===this.allItems.length?"":this.allItems[0].description}}class qo{constructor(e=[]){this.quantities=e}toKey(){return this.quantities.sort(((e,t)=>e.itemType.localeCompare(t.itemType))).map((e=>`${e.itemType}:${e.quantity}`)).join(",")}}class Wo{constructor(e={}){var t;this.rules=new Map,(null!==(t=e.pricingRules)&&void 0!==t?t:[]).forEach((e=>this.addRule(e)))}addRule(e){const t=e.combination.toKey();this.rules.set(t,e)}getPrice(e){const t=e.toKey(),i=this.rules.get(t);return null==i?void 0:i.price}toRuleArray(){return Array.from(this.rules.values())}toJSON(){return{pricingRules:this.toRuleArray()}}static fromJSON(e){var t;return new Wo({pricingRules:null===(t=e.pricingRules)||void 0===t?void 0:t.map((e=>({...e,combination:new qo(e.combination.quantities)})))})}}var Vo;!function(e){e.OneTime="One Time",e.Monthly="Monthly",e.Quarterly="Quarterly",e.Annually="Annually",e.PerOccurrence="Per Occurrence"}(Vo||(Vo={}));class Yo{constructor(e={}){var t,i,n,o,r,a,s,l,u,c;this.category="Other",this.syncActive=!0,this.refundable=!1,this.publicFacing=!0,this.id=e.id,this.buildingId=null!==(t=e.buildingId)&&void 0!==t?t:0,this.feeName=null!==(i=e.feeName)&&void 0!==i?i:"",this.description=e.description,this.category=null!==(n=e.category)&&void 0!==n?n:"Other",this.unitIds=e.unitIds,this.layoutIds=e.layoutIds,this.startDate=e.startDate,this.endDate=e.endDate,this.source=e.source,this.externalKey=e.externalKey,this.syncActive=null===(o=e.syncActive)||void 0===o||o,this.hiddenReason=e.hiddenReason,this.refundable=null!==(r=e.refundable)&&void 0!==r&&r,this.bundleKey=e.bundleKey,this.publicFacing=null===(a=e.publicFacing)||void 0===a||a,this.chargeCode=e.chargeCode,this.prorated=e.prorated,this.pricingCategory=null!==(s=e.pricingCategory)&&void 0!==s?s:"mandatory",this.pricingType=null!==(l=e.pricingType)&&void 0!==l?l:"fixed",this.frequency=null!==(u=e.frequency)&&void 0!==u?u:Vo.OneTime,this.nlpPricing=e.nlpPricing,this.isAddon=null!==(c=e.isAddon)&&void 0!==c&&c,void 0!==e.amount&&(this.amount=e.amount),void 0!==e.percentRent&&(this.percentRent=e.percentRent),void 0!==e.unitLabel&&(this.unitLabel=e.unitLabel),void 0!==e.minAmount&&(this.minAmount=e.minAmount),void 0!==e.maxAmount&&(this.maxAmount=e.maxAmount);const d=e.customMatrixData;var h;d instanceof Wo?this.customMatrixData=d:(h=d)&&"object"==typeof h&&"pricingRules"in h&&Array.isArray(h.pricingRules)&&(this.customMatrixData=Wo.fromJSON(d))}get isOptional(){return"situational"===this.pricingCategory}get hasMatrix(){return!("custom"!==this.pricingType||!this.customMatrixData)}}const Ko=class{constructor(){this.params=new URLSearchParams}addSingle(e,t){return t?(this.params.append(e,t),this):this}addArray(e,t){return t?(t.forEach((t=>{t&&this.params.append(`${e}[]`,t)})),this):this}build(){return this.params.toString()?`?${this.params.toString()}`:""}},Xo=e=>new Yo(e),Zo=e=>new Go(e),Jo=async(e,i)=>{try{const n=(new Ko).addArray("layout_ids",null==i?void 0:i.map((e=>e.toString()))),o=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/fees?${n.build()}`);if(o.data){const e=fi(o.data);return{fees:e.fees.map(Xo),rentableItems:e.rentableItems.map(Zo),buildingIncentives:e.buildingIncentives}}}catch(t){xn({logType:Cn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_FEES]",logData:{error:t}})}return{fees:[],rentableItems:[],buildingIncentives:[]}},er=(e="black")=>B`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none">
3290
3290
  <line x1="1.70782" y1="13.2254" x2="13.2376" y2="1.69554" stroke="${e}" stroke-width="2.13401"/>
3291
3291
  <path d="M2.00929 1.99996L13.3328 13.3421" stroke="${e}" stroke-width="2.13401"/>
3292
3292
  </svg>`,tr=({color:e="#347FF7",size:t=24}={})=>B`
@@ -3706,14 +3706,12 @@ xmlns="http://www.w3.org/2000/svg"
3706
3706
  font-size: 1rem;
3707
3707
  align-self: center;
3708
3708
  }
3709
- `;var fr=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let gr=class extends oe{constructor(){super(...arguments),this.feeQuote=null}render(){var e;return this.feeQuote?R`
3709
+ `;var fr=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let gr=class extends oe{constructor(){super(...arguments),this.feeQuote=null}get name(){var e,t,i,n;return(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)?this.feeQuote.sourceRentableItem.description:null!==(n=null===(i=null===(t=this.feeQuote)||void 0===t?void 0:t.sourceFee)||void 0===i?void 0:i.name)&&void 0!==n?n:""}get isRequired(){var e;return!!(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceFee)&&"MANDATORY"===this.feeQuote.sourceFee.pricingMetadata.pricingCategory}get description(){var e,t,i,n;return(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)?"":null!==(n=null===(i=null===(t=this.feeQuote)||void 0===t?void 0:t.sourceFee)||void 0===i?void 0:i.description)&&void 0!==n?n:""}render(){var e;return this.feeQuote?R`
3710
3710
  <div class="fee-item">
3711
3711
  <div class="fee-info">
3712
- ${"MANDATORY"===this.feeQuote.sourceFee.pricingMetadata.pricingCategory?R`<div class="required-label">Required</div>`:""}
3713
- <div class="fee-name">${this.feeQuote.sourceFee.name}</div>
3714
- <div class="fee-description">
3715
- ${this.feeQuote.sourceFee.description}
3716
- </div>
3712
+ ${this.isRequired?R`<div class="required-label">Required</div>`:""}
3713
+ <div class="fee-name">${this.name}</div>
3714
+ <div class="fee-description">${this.description}</div>
3717
3715
  </div>
3718
3716
  <div class="fee-amount">
3719
3717
  ${wi(null!==(e=this.feeQuote.amountRange.fixedValue)&&void 0!==e?e:0)}
@@ -3779,7 +3777,7 @@ xmlns="http://www.w3.org/2000/svg"
3779
3777
  margin: 12px;
3780
3778
  justify-content: space-between;
3781
3779
  }
3782
- `;var br=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let vr=class extends oe{constructor(){super(...arguments),this.title="Fees",this.fees=[],this.buildingFeesToQuantity={},this.handleQuantityChange=(e,t)=>{this.buildingFeesToQuantity[e]=t,this.requestUpdate()}}get totalAmount(){const e=this.fees.reduce(((e,t)=>{var i;return e+(null!==(i=t.amountRange.fixedValue)&&void 0!==i?i:0)}),0);return wi(e)}get standardFees(){return this.fees}get addons(){return[]}render(){return R`
3780
+ `;var br=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let vr=class extends oe{constructor(){super(...arguments),this.title="Fees",this.fees=[],this.buildingFeesToQuantity={},this.handleQuantityChange=(e,t)=>{this.buildingFeesToQuantity[e]=t,this.requestUpdate()}}get totalAmount(){const e=this.fees.reduce(((e,t)=>{var i;return e+(null!==(i=t.amountRange.fixedValue)&&void 0!==i?i:0)}),0);return wi(e)}get standardFees(){return this.fees.filter((e=>!e.isAddon))}get addons(){return this.fees.filter((e=>e.isAddon))}render(){return R`
3783
3781
  <div class="fee-card-section-container">
3784
3782
  <div class="fee-card-section-header">
3785
3783
  <h1 class="section-title">${this.title}</h1>
@@ -3795,7 +3793,7 @@ xmlns="http://www.w3.org/2000/svg"
3795
3793
  <div class="fee-card-list">
3796
3794
  <div class="section-title-addons">Add-Ons</div>
3797
3795
  ${this.addons.map((e=>R`<div class="fee-item-container">
3798
- <fee-item .feeItem=${e}></fee-item>
3796
+ <fee-item .feeQuote=${e}></fee-item>
3799
3797
  </div>`))}
3800
3798
  </div>
3801
3799
  `:""}
@@ -4465,7 +4463,7 @@ xmlns="http://www.w3.org/2000/svg"
4465
4463
  <div class="skeleton-loader">
4466
4464
  ${Array.from({length:this.cards},((e,t)=>{const i=Array.isArray(this.rowsPerCard)?this.rowsPerCard[t]||2:this.rowsPerCard;return R`<skeleton-card .rows=${i}></skeleton-card>`}))}
4467
4465
  </div>
4468
- `}};zr.styles=jr,$r([le({type:Number})],zr.prototype,"cards",void 0),$r([le({type:Array})],zr.prototype,"rowsPerCard",void 0),zr=$r([ae("skeleton-loader")],zr);var Qr=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Gr=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.showSkeletonLoader=!1,this.selectedUnit=null,this.quote=null,this.layoutOptions=[],this.selectedLayoutIds=[-1],this.groupedFees={[Vo.OneTime]:[],[Vo.Monthly]:[],[Vo.Quarterly]:[],[Vo.Annually]:[],[Vo.PerOccurrence]:[]},this.rentableItems=[],this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.onAddonSelect=null,this.onRentableItemSelect=null}get addOns(){return[...Object.values(this.groupedFees).flat().filter((e=>e.isOptional)),...this.rentableItems].sort(((e,t)=>{var i,n,o,r;const a=e instanceof Go,s=t instanceof Go;if(!a&&!s)return 0;const l=!a||null!==(n=null===(i=e.allItems)||void 0===i?void 0:i.some((e=>e.available)))&&void 0!==n&&n;return l===(!s||null!==(r=null===(o=t.allItems)||void 0===o?void 0:o.some((e=>e.available)))&&void 0!==r&&r)?0:l?-1:1}))}get rentAsFeeQuote(){var e,t;return(null===(e=this.quote)||void 0===e?void 0:e.rentCost)?{sourceFee:{name:"Rent",description:`Unit ${null===(t=this.selectedUnit)||void 0===t?void 0:t.unitNumber}`,frequency:Sr.MONTHLY,pricingMetadata:{pricingCategory:"MANDATORY"}},amountRange:{fixedValue:this.quote.rentCost,minValue:null,maxValue:null},itemCombination:{quantities:[],toKey:()=>"rent"}}:null}renderRecurringFeeSection(e,t){return(null==t?void 0:t.length)?R` <fee-card .fees=${t} title=${e}></fee-card> `:null}renderFeeSections(){var e,t;const i=[],n=[{freq:Sr.ANNUALLY,title:"Yearly Charges"},{freq:Sr.MONTHLY,title:"Monthly Charges"},{freq:Sr.BI_WEEKLY,title:"Bi-Weekly Charges"},{freq:Sr.WEEKLY,title:"Weekly Charges"},{freq:Sr.DAILY,title:"Daily Charges"},{freq:Sr.ONE_TIME,title:"Prior to Move-In"},{freq:Sr.NEVER,title:"No Charges"}],o=null===(e=this.quote)||void 0===e?void 0:e.feeQuotes;for(const{freq:e,title:r}of n){if(!(null==o?void 0:o.length)&&e!==Sr.MONTHLY)continue;let n=null!==(t=null==o?void 0:o.filter((t=>{var i;return(null===(i=t.sourceFee)||void 0===i?void 0:i.frequency)===e})))&&void 0!==t?t:[];if(e===Sr.MONTHLY){const e=this.rentAsFeeQuote;e&&(n=[e,...n])}const a=this.renderRecurringFeeSection(r,n);a&&i.push(a)}return i}renderFeesContent(){return this.selectedUnit?R`
4466
+ `}};zr.styles=jr,$r([le({type:Number})],zr.prototype,"cards",void 0),$r([le({type:Array})],zr.prototype,"rowsPerCard",void 0),zr=$r([ae("skeleton-loader")],zr);var Qr=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Gr=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.showSkeletonLoader=!1,this.selectedUnit=null,this.quote=null,this.layoutOptions=[],this.selectedLayoutIds=[-1],this.groupedFees={[Vo.OneTime]:[],[Vo.Monthly]:[],[Vo.Quarterly]:[],[Vo.Annually]:[],[Vo.PerOccurrence]:[]},this.rentableItems=[],this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.onAddonSelect=null,this.onRentableItemSelect=null}get addOns(){return[...Object.values(this.groupedFees).flat().filter((e=>e.isAddon)),...this.rentableItems].sort(((e,t)=>{var i,n,o,r;const a=e instanceof Go,s=t instanceof Go;if(!a&&!s)return 0;const l=!a||null!==(n=null===(i=e.allItems)||void 0===i?void 0:i.some((e=>e.available)))&&void 0!==n&&n;return l===(!s||null!==(r=null===(o=t.allItems)||void 0===o?void 0:o.some((e=>e.available)))&&void 0!==r&&r)?0:l?-1:1}))}get rentAsFeeQuote(){var e,t;return(null===(e=this.quote)||void 0===e?void 0:e.rentCost)?{sourceFee:{name:"Rent",description:`Unit ${null===(t=this.selectedUnit)||void 0===t?void 0:t.unitNumber}`,frequency:Sr.MONTHLY,pricingMetadata:{pricingCategory:"MANDATORY"}},amountRange:{fixedValue:this.quote.rentCost,minValue:null,maxValue:null},itemCombination:{quantities:[],toKey:()=>"rent"},isAddon:!1}:null}renderRecurringFeeSection(e,t){return(null==t?void 0:t.length)?R` <fee-card .fees=${t} title=${e}></fee-card> `:null}renderFeeSections(){var e,t;const i=[],n=[{freq:Sr.ANNUALLY,title:"Yearly Charges"},{freq:Sr.MONTHLY,title:"Monthly Charges"},{freq:Sr.BI_WEEKLY,title:"Bi-Weekly Charges"},{freq:Sr.WEEKLY,title:"Weekly Charges"},{freq:Sr.DAILY,title:"Daily Charges"},{freq:Sr.ONE_TIME,title:"Prior to Move-In"},{freq:Sr.NEVER,title:"No Charges"}],o=null===(e=this.quote)||void 0===e?void 0:e.feeQuotes;for(const{freq:e,title:r}of n){if(!(null==o?void 0:o.length)&&e!==Sr.MONTHLY)continue;let n=null!==(t=null==o?void 0:o.filter((t=>{var i;return(null===(i=t.sourceFee)||void 0===i?void 0:i.frequency)===e||!!t.sourceRentableItem&&("monthly"===t.sourceRentableItem.rentFrequency&&e===Sr.MONTHLY||"annually"===t.sourceRentableItem.rentFrequency&&e===Sr.ANNUALLY)})))&&void 0!==t?t:[];if(e===Sr.MONTHLY){const e=this.rentAsFeeQuote;e&&(n=[e,...n])}const a=this.renderRecurringFeeSection(r,n);a&&i.push(a)}return i}renderFeesContent(){return this.selectedUnit?R`
4469
4467
  <div class="fees-container">
4470
4468
  ${this.showSkeletonLoader?R`
4471
4469
  <div class="loading-container">
@@ -80,7 +80,7 @@ export class FeeCalculatorLayout extends LitElement {
80
80
  get addOns(): (BuildingFeeView | RentableItemSummary)[] {
81
81
  const addons = Object.values(this.groupedFees)
82
82
  .flat()
83
- .filter((fee) => fee.isOptional);
83
+ .filter((fee) => fee.isAddon);
84
84
 
85
85
  return [...addons, ...this.rentableItems].sort((a, b) => {
86
86
  const aIsRentable = a instanceof RentableItemSummary;
@@ -118,6 +118,7 @@ export class FeeCalculatorLayout extends LitElement {
118
118
  maxValue: null,
119
119
  } as AmountRange,
120
120
  itemCombination: { quantities: [], toKey: () => "rent" },
121
+ isAddon: false,
121
122
  } as FeeQuote;
122
123
  }
123
124
 
@@ -148,7 +149,20 @@ export class FeeCalculatorLayout extends LitElement {
148
149
  if (!feeQuotes?.length && freq !== FeeFrequency.MONTHLY) continue;
149
150
 
150
151
  let feesByFreq =
151
- feeQuotes?.filter((fq) => fq.sourceFee?.frequency === freq) ?? [];
152
+ feeQuotes?.filter((fq) => {
153
+ if (fq.sourceFee?.frequency === freq) return true;
154
+
155
+ if (fq.sourceRentableItem) {
156
+ return (
157
+ (fq.sourceRentableItem.rentFrequency === "monthly" &&
158
+ freq === FeeFrequency.MONTHLY) ||
159
+ (fq.sourceRentableItem.rentFrequency === "annually" &&
160
+ freq === FeeFrequency.ANNUALLY)
161
+ );
162
+ }
163
+
164
+ return false;
165
+ }) ?? [];
152
166
 
153
167
  // Add rent as a monthly "fee"
154
168
  if (freq === FeeFrequency.MONTHLY) {
@@ -28,11 +28,11 @@ export class FeeCard extends LitElement {
28
28
  }
29
29
 
30
30
  get standardFees(): FeeQuote[] {
31
- return this.fees;
31
+ return this.fees.filter((fee) => !fee.isAddon);
32
32
  }
33
33
 
34
34
  get addons(): FeeQuote[] {
35
- return [];
35
+ return this.fees.filter((fee) => fee.isAddon);
36
36
  }
37
37
 
38
38
  handleQuantityChange = (feeId: number, quantity: number): void => {
@@ -61,7 +61,7 @@ export class FeeCard extends LitElement {
61
61
  <div class="section-title-addons">Add-Ons</div>
62
62
  ${this.addons.map(
63
63
  (item) => html`<div class="fee-item-container">
64
- <fee-item .feeItem=${item}></fee-item>
64
+ <fee-item .feeQuote=${item}></fee-item>
65
65
  </div>`
66
66
  )}
67
67
  </div>
@@ -1,9 +1,9 @@
1
1
  import { LitElement, html, TemplateResult } from "lit";
2
2
  import { customElement, property } from "lit/decorators.js";
3
3
  import { FeeQuote } from "../../model/fee-quote";
4
+ import { formatCurrency } from "../../../../utils";
4
5
 
5
6
  import feeItemStyles from "./fee-item-styles";
6
- import { formatCurrency } from "../../../../utils";
7
7
 
8
8
  @customElement("fee-item")
9
9
  export class FeeItemComponent extends LitElement {
@@ -12,20 +12,36 @@ export class FeeItemComponent extends LitElement {
12
12
  @property({ type: Object })
13
13
  feeQuote: FeeQuote | null = null;
14
14
 
15
+ get name(): string {
16
+ if (this.feeQuote?.sourceRentableItem) {
17
+ return this.feeQuote.sourceRentableItem.description;
18
+ }
19
+ return this.feeQuote?.sourceFee?.name ?? "";
20
+ }
21
+
22
+ get isRequired(): boolean {
23
+ if (!this.feeQuote?.sourceFee) return false;
24
+ return (
25
+ this.feeQuote.sourceFee.pricingMetadata.pricingCategory === "MANDATORY"
26
+ );
27
+ }
28
+
29
+ get description(): string {
30
+ if (this.feeQuote?.sourceRentableItem) return "";
31
+ return this.feeQuote?.sourceFee?.description ?? "";
32
+ }
33
+
15
34
  render(): TemplateResult {
16
35
  if (!this.feeQuote) return html``;
17
36
 
18
37
  return html`
19
38
  <div class="fee-item">
20
39
  <div class="fee-info">
21
- ${this.feeQuote.sourceFee.pricingMetadata.pricingCategory ===
22
- "MANDATORY"
40
+ ${this.isRequired
23
41
  ? html`<div class="required-label">Required</div>`
24
42
  : ""}
25
- <div class="fee-name">${this.feeQuote.sourceFee.name}</div>
26
- <div class="fee-description">
27
- ${this.feeQuote.sourceFee.description}
28
- </div>
43
+ <div class="fee-name">${this.name}</div>
44
+ <div class="fee-description">${this.description}</div>
29
45
  </div>
30
46
  <div class="fee-amount">
31
47
  ${formatCurrency(this.feeQuote.amountRange.fixedValue ?? 0)}
@@ -44,6 +44,7 @@ export class BuildingFeeView {
44
44
  pricingType: "fixed" | "per-item" | "usage-based" | "percent-rent" | "custom";
45
45
  frequency: BuildingFeeFrequency;
46
46
  nlpPricing?: string;
47
+ isAddon: boolean;
47
48
 
48
49
  // Optional fields that depend on fee type
49
50
  amount?: number;
@@ -76,6 +77,7 @@ export class BuildingFeeView {
76
77
  this.pricingType = data.pricingType ?? "fixed";
77
78
  this.frequency = data.frequency ?? BuildingFeeFrequency.OneTime;
78
79
  this.nlpPricing = data.nlpPricing;
80
+ this.isAddon = data.isAddon ?? false;
79
81
 
80
82
  // Optional fields
81
83
  if (data.amount !== undefined) this.amount = data.amount;
@@ -1,9 +1,12 @@
1
1
  import { SourceFee } from "./source-fee";
2
2
  import { AmountRange } from "./amount-range";
3
3
  import { ItemCombination } from "./item-combination";
4
+ import { RentableItem } from "./rentable-item";
4
5
 
5
6
  export interface FeeQuote {
6
- sourceFee: SourceFee;
7
+ sourceFee?: SourceFee;
8
+ sourceRentableItem?: RentableItem | null;
9
+ isAddon: boolean | null;
7
10
  amountRange: AmountRange;
8
11
  itemCombination: ItemCombination;
9
12
  }