turf-common 1.4.1-beta.8 → 1.4.1-beta.9

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.
@@ -183,20 +183,26 @@ var PricingPlanEntityModelV2 = /** @class */ (function () {
183
183
  };
184
184
  var billingCycle = (_b = this.subscriptionCycle) === null || _b === void 0 ? void 0 : _b.split(",");
185
185
  billingCycle === null || billingCycle === void 0 ? void 0 : billingCycle.forEach(function (billing, index) {
186
- var billingArray = billing.split("_");
186
+ var billingArray = billing.split('_');
187
187
  responseObj.billing_cycle[index] = {
188
188
  from: Number(billingArray[0].slice(0, 3)),
189
189
  to: Number(billingArray[0].slice(3, 6)),
190
190
  // discount: billingArray[1],
191
- name: billingArray.slice(2).join("_"),
192
- key: billingArray.slice(2).join("-").toLowerCase().replace(/ /g, "-"),
191
+ name: billingArray.slice(2).join('_'),
192
+ key: billingArray.slice(2).join('-').toLowerCase().replace(/ /g, '-'),
193
193
  };
194
194
  });
195
- this.billingCostCode.split(",").forEach(function (code, index) {
196
- var costCode = code.split("#");
195
+ var billingCycleSet = new Set();
196
+ this.billingCostCode.split(',').forEach(function (code, index) {
197
+ var costCode = code.split('#');
198
+ billingCycleSet.add(costCode[0]);
199
+ });
200
+ billingCycleSet.forEach(function (pitchRange, index) {
201
+ var from = Number(pitchRange.split('_')[0]);
202
+ var to = Number(pitchRange.split('_')[1]);
197
203
  responseObj.pitch_slab[index] = {
198
- from: Number(costCode[0]),
199
- to: Number(costCode[0]),
204
+ from: from,
205
+ to: to,
200
206
  // discount: costCode[1],
201
207
  };
202
208
  });
@@ -206,6 +212,46 @@ var PricingPlanEntityModelV2 = /** @class */ (function () {
206
212
  responseObj.base_price = this.basePrice;
207
213
  return responseObj;
208
214
  };
215
+ // toObject(): GetPricingPlanByDateResponseV2 {
216
+ // const responseObj: GetPricingPlanByDateResponseV2 = {
217
+ // id: this.id,
218
+ // effective_from_date: 0,
219
+ // effective_to_date: 0,
220
+ // base_price: 0,
221
+ // unit: "per_hour_per_pitch",
222
+ // pitch_slab: {},
223
+ // billing_cycle: {},
224
+ // billing_cost_code: this.billingCostCode??''
225
+ // };
226
+ // const billingCycle = this.subscriptionCycle?.split(",");
227
+ // billingCycle?.forEach((billing, index) => {
228
+ // const billingArray = billing.split("_");
229
+ // responseObj.billing_cycle[index] = {
230
+ // from: Number(billingArray[0].slice(0, 3)),
231
+ // to: Number(billingArray[0].slice(3, 6)),
232
+ // // discount: billingArray[1],
233
+ // name: billingArray.slice(2).join("_"),
234
+ // key: billingArray.slice(2).join("-").toLowerCase().replace(/ /g, "-"),
235
+ // };
236
+ // });
237
+ // this.billingCostCode!.split(",").forEach((code, index) => {
238
+ // const costCode = code.split("#");
239
+ // responseObj.pitch_slab[index] = {
240
+ // from: Number(costCode[0]),
241
+ // to: Number(costCode[0]),
242
+ // // discount: costCode[1],
243
+ // };
244
+ // });
245
+ // responseObj.effective_from_date = Number(
246
+ // BookingCode.getDateCode(this.effectiveFrom)
247
+ // );
248
+ // responseObj.effective_to_date = Number(
249
+ // BookingCode.getDateCode(this.effectiveTo)
250
+ // );
251
+ // responseObj.unit = this.unit;
252
+ // responseObj.base_price = this.basePrice;
253
+ // return responseObj;
254
+ // }
209
255
  PricingPlanEntityModelV2.prototype.toPitchSlabs = function () {
210
256
  return this.billingCostCode
211
257
  .split(",")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.4.1-beta.8",
3
+ "version": "1.4.1-beta.9",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",