@veloceapps/sdk 7.0.2-33 → 7.0.2-35

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.
@@ -1107,6 +1107,11 @@ class FlowHeaderComponent {
1107
1107
  date.setHours(0, 0, 0, 0);
1108
1108
  const now = date.getTime();
1109
1109
  const termParentIds = lineItems.map(li => li.rampInstanceId).filter(Boolean);
1110
+ const lineItemsRampInstanceIdMap = lineItems.reduce((acc, li) => {
1111
+ var _a;
1112
+ acc[(_a = li.rampInstanceId) !== null && _a !== void 0 ? _a : ''] = li;
1113
+ return acc;
1114
+ }, {});
1110
1115
  return lineItems.reduce((result, li) => {
1111
1116
  // find main term line item
1112
1117
  if (li.rampInstanceId) {
@@ -1115,23 +1120,20 @@ class FlowHeaderComponent {
1115
1120
  // find current term line item
1116
1121
  let target = li;
1117
1122
  while (target && target.endDate && new Date(target.endDate).getTime() <= now) {
1118
- target = lineItems.find(sub => sub.rampInstanceId === li.id);
1123
+ target = lineItemsRampInstanceIdMap[li.id];
1119
1124
  }
1120
1125
  if (target && target.productId) {
1121
- return [
1122
- ...result,
1123
- {
1124
- id: target.id,
1125
- productId: target.productId,
1126
- name: target.name,
1127
- configurable: target.properties['#configurable'] === 'true',
1128
- deleted: target.actionCode === 'DELETE',
1129
- hasTerm: termParentIds.includes(target.id),
1130
- qty: target.qty,
1131
- mrr: this.formatMetric(target.properties.VDM_Total_MRR),
1132
- nrr: this.formatMetric(target.properties.VDM_Total_NRR),
1133
- },
1134
- ];
1126
+ result.push({
1127
+ id: target.id,
1128
+ productId: target.productId,
1129
+ name: target.name,
1130
+ configurable: target.properties['#configurable'] === 'true',
1131
+ deleted: target.actionCode === 'DELETE',
1132
+ hasTerm: termParentIds.includes(target.id),
1133
+ qty: target.qty,
1134
+ mrr: this.formatMetric(target.properties.VDM_Total_MRR),
1135
+ nrr: this.formatMetric(target.properties.VDM_Total_NRR),
1136
+ });
1135
1137
  }
1136
1138
  return result;
1137
1139
  }, []);