turf-common 1.4.1-beta.7 → 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(
|
|
191
|
+
name: billingArray.slice(2).join('_'),
|
|
192
|
+
key: billingArray.slice(2).join('-').toLowerCase().replace(/ /g, '-'),
|
|
193
193
|
};
|
|
194
194
|
});
|
|
195
|
-
|
|
196
|
-
|
|
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:
|
|
199
|
-
to:
|
|
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(",")
|
|
@@ -167,8 +167,19 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
|
|
|
167
167
|
// return codes ? codes[0] : "";
|
|
168
168
|
};
|
|
169
169
|
SubscribedPricingPlanModelV2.prototype.getDiscount = function () {
|
|
170
|
-
var
|
|
171
|
-
|
|
170
|
+
var _this = this;
|
|
171
|
+
var codes = this.billing_cost_code.split(",");
|
|
172
|
+
// Filter by pitch count
|
|
173
|
+
codes = codes.filter(function (code) {
|
|
174
|
+
var _a = code.split("_"), from = _a[0], to = _a[1];
|
|
175
|
+
return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
|
|
176
|
+
});
|
|
177
|
+
codes.sort();
|
|
178
|
+
// Filter by billing cycle
|
|
179
|
+
codes = codes.filter(function (code) {
|
|
180
|
+
return _this.selectedBillingCycle.to === Number(code.split("#")[1]);
|
|
181
|
+
});
|
|
182
|
+
return codes ? codes[0].split("#")[3] : "";
|
|
172
183
|
};
|
|
173
184
|
SubscribedPricingPlanModelV2.prototype.getBasePriceByPitchSlab = function () {
|
|
174
185
|
var _this = this;
|