@meetelise/chat 1.30.1 → 1.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,7 @@ export declare type CalculateQuoteResponse = {
23
23
  declare type UnitFeeBundle = {
24
24
  unitId: number;
25
25
  unitNumber: string;
26
+ unitLayout: number;
26
27
  rent: number;
27
28
  fees: FeeEstimate[];
28
29
  feeTotal: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.30.1",
3
+ "version": "1.30.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -3071,7 +3071,7 @@ xmlns="http://www.w3.org/2000/svg"
3071
3071
  justify-content: center;
3072
3072
  }
3073
3073
  }
3074
- `;class io{constructor(e={}){var t,i,n,o,r,a,s,l,u,c,d,h,p,f;this.id=null!==(t=e.id)&&void 0!==t?t:0,this.buildingId=null!==(i=e.buildingId)&&void 0!==i?i:0,this.blueprint=null!==(n=e.blueprint)&&void 0!==n?n:{},this.unitIds=null!==(o=e.unitIds)&&void 0!==o?o:null,this.layoutIds=null!==(r=e.layoutIds)&&void 0!==r?r:null,this.startDate=null!==(a=e.startDate)&&void 0!==a?a:null,this.endDate=null!==(s=e.endDate)&&void 0!==s?s:null,this.source=null!==(l=e.source)&&void 0!==l?l:null,this.timeCreated=null!==(u=e.timeCreated)&&void 0!==u?u:new Date,this.externalKey=null!==(c=e.externalKey)&&void 0!==c?c:null,this.syncActive=null!==(d=e.syncActive)&&void 0!==d&&d,this.hiddenReason=null!==(h=e.hiddenReason)&&void 0!==h?h:null,this.refundable=null!==(p=e.refundable)&&void 0!==p?p:null,this.required=null!==(f=e.required)&&void 0!==f&&f}get isAddOn(){return null!==this.blueprint.addOnInfo}displayName(e="Fee"){const t=this.blueprint.category;return t?yi(t):e}get description(){return this.blueprint.transactionDescription||""}get displayAmount(){const e=this.blueprint.transactionAmount;return wi(null!=e?e:0)}}var no,oo,ro;!function(e){e.OneTime="OneTime",e.Daily="Daily",e.Weekly="Weekly",e.BiWeekly="BiWeekly",e.Monthly="Monthly",e.Yearly="Yearly",e.Unknown="Unknown"}(no||(no={})),function(e){e.Debit="Debit",e.Credit="Credit"}(oo||(oo={})),function(e){e.Fixed="Fixed",e.UsageBased="UsageBased",e.Varies="Varies"}(ro||(ro={}));const ao=e=>new io(e),so=async e=>{try{const i=await t().get(`${hi}/platformApi/webchat/${e}/fees`);if(i.data){const e=pi(i.data);return{fees:e.fees.map(ao),rentableItems:e.rentableItems}}}catch(t){vn({logType:bn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_FEES]",logData:{error:t}})}return{fees:[],rentableItems:[]}},lo=-1;class uo{constructor(e){this.name=e.name,this.description=e.description,this.amount=e.amount,this.frequency=e.frequency,this.addOnType=e.addOnType,this.applicable=e.applicable,this.required=e.required,this.adjustments=e.adjustments,this.comment=e.comment}get displayAmount(){return wi(this.amount)}get displayName(){return yi(this.name)}get isAddOn(){return!!this.addOnType}}const co=e=>new uo(e);var ho=i(3279),po=i.n(ho);const fo=(e="black")=>R`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none">
3074
+ `;class io{constructor(e={}){var t,i,n,o,r,a,s,l,u,c,d,h,p,f;this.id=null!==(t=e.id)&&void 0!==t?t:0,this.buildingId=null!==(i=e.buildingId)&&void 0!==i?i:0,this.blueprint=null!==(n=e.blueprint)&&void 0!==n?n:{},this.unitIds=null!==(o=e.unitIds)&&void 0!==o?o:null,this.layoutIds=null!==(r=e.layoutIds)&&void 0!==r?r:null,this.startDate=null!==(a=e.startDate)&&void 0!==a?a:null,this.endDate=null!==(s=e.endDate)&&void 0!==s?s:null,this.source=null!==(l=e.source)&&void 0!==l?l:null,this.timeCreated=null!==(u=e.timeCreated)&&void 0!==u?u:new Date,this.externalKey=null!==(c=e.externalKey)&&void 0!==c?c:null,this.syncActive=null!==(d=e.syncActive)&&void 0!==d&&d,this.hiddenReason=null!==(h=e.hiddenReason)&&void 0!==h?h:null,this.refundable=null!==(p=e.refundable)&&void 0!==p?p:null,this.required=null!==(f=e.required)&&void 0!==f&&f}get isAddOn(){return null!==this.blueprint.addOnInfo}displayName(e="Fee"){var t;return this.isAddOn&&(null===(t=this.blueprint.addOnInfo)||void 0===t?void 0:t.addOnType)?yi(this.blueprint.addOnInfo.addOnType):this.blueprint.category?yi(this.blueprint.category):e}get description(){return this.blueprint.transactionDescription||""}get displayAmount(){const e=this.blueprint.transactionAmount;return wi(null!=e?e:0)}}var no,oo,ro;!function(e){e.OneTime="OneTime",e.Daily="Daily",e.Weekly="Weekly",e.BiWeekly="BiWeekly",e.Monthly="Monthly",e.Yearly="Yearly",e.Unknown="Unknown"}(no||(no={})),function(e){e.Debit="Debit",e.Credit="Credit"}(oo||(oo={})),function(e){e.Fixed="Fixed",e.UsageBased="UsageBased",e.Varies="Varies"}(ro||(ro={}));const ao=e=>new io(e),so=async e=>{try{const i=await t().get(`${hi}/platformApi/webchat/${e}/fees`);if(i.data){const e=pi(i.data);return{fees:e.fees.map(ao),rentableItems:e.rentableItems}}}catch(t){vn({logType:bn.error,buildingSlug:e,logTitle:"[ERROR_GETTING_FEES]",logData:{error:t}})}return{fees:[],rentableItems:[]}},lo=-1;class uo{constructor(e){this.name=e.name,this.description=e.description,this.amount=e.amount,this.frequency=e.frequency,this.addOnType=e.addOnType,this.applicable=e.applicable,this.required=e.required,this.adjustments=e.adjustments,this.comment=e.comment}get displayAmount(){return wi(this.amount)}get displayName(){return yi(this.name)}get isAddOn(){return!!this.addOnType}}const co=e=>new uo(e);var ho=i(3279),po=i.n(ho);const fo=(e="black")=>R`<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none">
3075
3075
  <line x1="1.70782" y1="13.2254" x2="13.2376" y2="1.69554" stroke="${e}" stroke-width="2.13401"/>
3076
3076
  <path d="M2.00929 1.99996L13.3328 13.3421" stroke="${e}" stroke-width="2.13401"/>
3077
3077
  </svg>`,go=l`
@@ -3701,7 +3701,6 @@ xmlns="http://www.w3.org/2000/svg"
3701
3701
  flex: 0 0 300px;
3702
3702
  display: flex;
3703
3703
  margin-left: 20px;
3704
- background-color: white;
3705
3704
  flex-direction: column;
3706
3705
  max-width: 50%;
3707
3706
  gap: 20px;
@@ -3807,7 +3806,7 @@ xmlns="http://www.w3.org/2000/svg"
3807
3806
  min-height: 100px;
3808
3807
  }
3809
3808
  }
3810
- `;var Lo=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 Ro=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.isLoading=!1,this.selectedUnitId=null,this.quote=null,this.layoutOptions=[],this.selectedLayoutIds=[lo],this.groupedFees={[no.OneTime]:[],[no.Daily]:[],[no.Weekly]:[],[no.BiWeekly]:[],[no.Monthly]:[],[no.Yearly]:[],[no.Unknown]:[]},this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.onAddonSelect=null}get standardFees(){const e={};return Object.entries(this.groupedFees).forEach((([t,i])=>{e[t]=i.filter((e=>!e.isAddOn))})),e}get addOns(){return Object.values(this.groupedFees).flat().filter((e=>e.isAddOn))}renderRecurrenceFeeSection(e,t){return(null==t?void 0:t.length)?L` <fee-card .fees=${t} title=${e}></fee-card> `:null}renderFeeSections(){var e,t,i;const n=[],o=[{freq:no.Yearly,title:"Yearly Charges"},{freq:no.Monthly,title:"Monthly Charges"},{freq:no.BiWeekly,title:"Bi-Weekly Charges"},{freq:no.Weekly,title:"Weekly Charges"},{freq:no.Daily,title:"Daily Charges"},{freq:no.Unknown,title:"Other Charges"},{freq:no.OneTime,title:"Prior to Move-In"}],r=null!==(i=null===(t=null===(e=this.quote)||void 0===e?void 0:e.units.find((e=>e.unitId===this.selectedUnitId)))||void 0===t?void 0:t.fees)&&void 0!==i?i:[];for(const{freq:e,title:t}of o){if(!r.length)continue;const i=r.filter((t=>t.frequency===e)),o=this.renderRecurrenceFeeSection(t,i);o&&n.push(o)}return n}renderFeesContent(){return this.selectedUnitId?L`
3809
+ `;var Lo=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 Ro=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.isLoading=!1,this.selectedUnitId=null,this.quote=null,this.layoutOptions=[],this.selectedLayoutIds=[lo],this.groupedFees={[no.OneTime]:[],[no.Daily]:[],[no.Weekly]:[],[no.BiWeekly]:[],[no.Monthly]:[],[no.Yearly]:[],[no.Unknown]:[]},this.onSelectLayout=null,this.onUnitSelect=null,this.onMoveInDateChange=null,this.onLeaseTermChange=null,this.onAddonSelect=null}get standardFees(){const e={};return Object.entries(this.groupedFees).forEach((([t,i])=>{e[t]=i.filter((e=>!e.isAddOn))})),e}get addOns(){return Object.values(this.groupedFees).flat().filter((e=>{var t,i;if(!e.isAddOn)return!1;if(!this.quote)return!0;const n=null===(i=null===(t=this.quote)||void 0===t?void 0:t.units.find((e=>e.unitId===this.selectedUnitId)))||void 0===i?void 0:i.unitLayout;return!e.layoutIds||null==n||e.layoutIds.includes(n)}))}renderRecurrenceFeeSection(e,t){return(null==t?void 0:t.length)?L` <fee-card .fees=${t} title=${e}></fee-card> `:null}renderFeeSections(){var e,t,i;const n=[],o=[{freq:no.Yearly,title:"Yearly Charges"},{freq:no.Monthly,title:"Monthly Charges"},{freq:no.BiWeekly,title:"Bi-Weekly Charges"},{freq:no.Weekly,title:"Weekly Charges"},{freq:no.Daily,title:"Daily Charges"},{freq:no.Unknown,title:"Other Charges"},{freq:no.OneTime,title:"Prior to Move-In"}],r=(null!==(i=null===(t=null===(e=this.quote)||void 0===e?void 0:e.units.find((e=>e.unitId===this.selectedUnitId)))||void 0===t?void 0:t.fees)&&void 0!==i?i:[]).filter((e=>e.applicable));for(const{freq:e,title:t}of o){if(!r.length)continue;const i=r.filter((t=>t.frequency===e)),o=this.renderRecurrenceFeeSection(t,i);o&&n.push(o)}return n}renderFeesContent(){return this.selectedUnitId?L`
3811
3810
  <div class="fees-container">
3812
3811
  ${this.isLoading?L`
3813
3812
  <div class="loading-container">
@@ -18,7 +18,6 @@ export default css`
18
18
  flex: 0 0 300px;
19
19
  display: flex;
20
20
  margin-left: 20px;
21
- background-color: white;
22
21
  flex-direction: column;
23
22
  max-width: 50%;
24
23
  gap: 20px;
@@ -81,7 +81,19 @@ export class FeeCalculatorLayout extends LitElement {
81
81
  get addOns(): BuildingFee[] {
82
82
  return Object.values(this.groupedFees)
83
83
  .flat()
84
- .filter((fee) => fee.isAddOn);
84
+ .filter((fee) => {
85
+ if (!fee.isAddOn) return false;
86
+ if (!this.quote) return true;
87
+
88
+ const unitLayout = this.quote?.units.find(
89
+ (unit) => unit.unitId === this.selectedUnitId
90
+ )?.unitLayout;
91
+
92
+ // Let the addon through if it's not layout specific
93
+ if (!fee.layoutIds || unitLayout == null) return true;
94
+
95
+ return fee.layoutIds.includes(unitLayout);
96
+ });
85
97
  }
86
98
 
87
99
  renderRecurrenceFeeSection(
@@ -110,10 +122,12 @@ export class FeeCalculatorLayout extends LitElement {
110
122
  this.quote?.units.find((unit) => unit.unitId === this.selectedUnitId)
111
123
  ?.fees ?? [];
112
124
 
125
+ const applicableFees = unitFees.filter((fee) => fee.applicable);
126
+
113
127
  for (const { freq, title } of frequencyOrder) {
114
- if (!unitFees.length) continue;
128
+ if (!applicableFees.length) continue;
115
129
 
116
- const fees = unitFees.filter((fee) => fee.frequency === freq);
130
+ const fees = applicableFees.filter((fee) => fee.frequency === freq);
117
131
  const section = this.renderRecurrenceFeeSection(title, fees);
118
132
  if (section) sections.push(section);
119
133
  }
@@ -39,9 +39,13 @@ export class BuildingFee {
39
39
  }
40
40
 
41
41
  displayName(fallback = "Fee"): string {
42
- const category = this.blueprint.category;
43
- if (!category) return fallback;
44
- return sentenceTitleCase(category);
42
+ if (this.isAddOn && this.blueprint.addOnInfo?.addOnType) {
43
+ return sentenceTitleCase(this.blueprint.addOnInfo.addOnType);
44
+ }
45
+
46
+ return this.blueprint.category
47
+ ? sentenceTitleCase(this.blueprint.category)
48
+ : fallback;
45
49
  }
46
50
 
47
51
  get description(): string {
@@ -38,6 +38,7 @@ export type CalculateQuoteResponse = {
38
38
  type UnitFeeBundle = {
39
39
  unitId: number;
40
40
  unitNumber: string;
41
+ unitLayout: number;
41
42
  rent: number;
42
43
  fees: FeeEstimate[];
43
44
  feeTotal: number;