ng-easycommerce 0.0.673 → 0.0.674
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.
- package/README.md +5 -0
- package/bundles/ng-easycommerce.umd.js +124 -71
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.js +44 -18
- package/esm2015/lib/services/checkout/shipment.service.js +3 -3
- package/esm5/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.js +70 -31
- package/esm5/lib/services/checkout/shipment.service.js +56 -42
- package/fesm2015/ng-easycommerce.js +45 -19
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +124 -71
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-component/checkout-ec/shipment-ec/shipment-ec.component.d.ts +2 -0
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# version 0.0.674
|
|
2
|
+
- Checkout single (envíos): `shipping-option` vuelve a enviar los datos que antes se persistían vía `shipping-contract` para contratos de sucursal OCA.
|
|
3
|
+
- Checkout single (envíos): se completa el payload con `name`, `price`, `selected`, datos de sucursal (`street`, `number`, `province`, `city`, `code`, `description`, `address`, `computed`) y claves de método (`shipping_method_contract`, `shipping_method_branch_code`).
|
|
4
|
+
- Checkout single (envíos): para `branch_delivery`, se enriquece el contrato con datos del flujo legacy cuando el endpoint `shipping-options` no trae toda la información.
|
|
5
|
+
- `ShipmentService.normalizeShippingOptions`: normaliza contratos de sucursal incorporando `address` + `branch_property` para mantener consistencia entre checkout single y legacy.
|
|
1
6
|
# version 0.0.673
|
|
2
7
|
- Checkout (direcciones): el buscador queda solo para vista **single** (`dataform-ec-single`) y se quita de **legacy**.
|
|
3
8
|
- Checkout legacy (direcciones): se elimina el scroll fijo de la grilla de direcciones para mantener el comportamiento anterior.
|
|
@@ -5970,7 +5970,7 @@
|
|
|
5970
5970
|
ShipmentService.prototype.normalizeShippingOptions = function (response) {
|
|
5971
5971
|
var _a, _b, _c, _d, _e;
|
|
5972
5972
|
return __awaiter$6(this, void 0, void 0, function () {
|
|
5973
|
-
var list, stores, list_1, list_1_1, entry, methodCode, options, options_1, options_1_1, option,
|
|
5973
|
+
var list, stores, list_1, list_1_1, entry, methodCode, options, _loop_1, this_1, options_1, options_1_1, option, e_1_1, e_2_1;
|
|
5974
5974
|
var e_2, _f, e_1, _g;
|
|
5975
5975
|
return __generator$6(this, function (_h) {
|
|
5976
5976
|
switch (_h.label) {
|
|
@@ -5979,79 +5979,93 @@
|
|
|
5979
5979
|
stores = null;
|
|
5980
5980
|
_h.label = 1;
|
|
5981
5981
|
case 1:
|
|
5982
|
-
_h.trys.push([1, 13, 14
|
|
5982
|
+
_h.trys.push([1, 12, 13, 14]);
|
|
5983
5983
|
list_1 = __values(list), list_1_1 = list_1.next();
|
|
5984
5984
|
_h.label = 2;
|
|
5985
5985
|
case 2:
|
|
5986
|
-
if (!!list_1_1.done) return [3 /*break*/,
|
|
5986
|
+
if (!!list_1_1.done) return [3 /*break*/, 11];
|
|
5987
5987
|
entry = list_1_1.value;
|
|
5988
5988
|
methodCode = ((_b = (_a = entry) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.code) || '';
|
|
5989
5989
|
options = ((_c = entry) === null || _c === void 0 ? void 0 : _c.options) || [];
|
|
5990
|
+
_loop_1 = function (option) {
|
|
5991
|
+
var contracts;
|
|
5992
|
+
return __generator$6(this, function (_a) {
|
|
5993
|
+
switch (_a.label) {
|
|
5994
|
+
case 0:
|
|
5995
|
+
contracts = ((_d = option) === null || _d === void 0 ? void 0 : _d.contracts) || [];
|
|
5996
|
+
if (((_e = option) === null || _e === void 0 ? void 0 : _e.name) === 'branch_delivery') {
|
|
5997
|
+
option.contracts = contracts.map(function (contract) {
|
|
5998
|
+
var _a, _b, _c, _d;
|
|
5999
|
+
var branch = ((_a = contract) === null || _a === void 0 ? void 0 : _a.branch_property) || {};
|
|
6000
|
+
var address = branch.address || {};
|
|
6001
|
+
var street = address.street || '';
|
|
6002
|
+
var number = address.number || '';
|
|
6003
|
+
var computed = [street, number ? "N\u00B0 " + number : ''].filter(Boolean).join(' ');
|
|
6004
|
+
return __assign$d(__assign$d(__assign$d(__assign$d({}, contract), address), branch), { contract: ((_b = contract) === null || _b === void 0 ? void 0 : _b.contract) || option.name, name: (_c = contract) === null || _c === void 0 ? void 0 : _c.name, price: (_d = contract) === null || _d === void 0 ? void 0 : _d.price, computed: computed || contract.computed });
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
if (!methodCode.includes('pickup_store')) return [3 /*break*/, 3];
|
|
6008
|
+
if (!!stores) return [3 /*break*/, 2];
|
|
6009
|
+
return [4 /*yield*/, this_1.storesService.stores.pipe(operators.take(1)).toPromise()];
|
|
6010
|
+
case 1:
|
|
6011
|
+
stores = _a.sent();
|
|
6012
|
+
_a.label = 2;
|
|
6013
|
+
case 2:
|
|
6014
|
+
if (stores && stores.length) {
|
|
6015
|
+
option.contracts = contracts.map(function (contract) {
|
|
6016
|
+
var currentStore = stores.find(function (store) { return store.code == contract.name; });
|
|
6017
|
+
if (!currentStore)
|
|
6018
|
+
return __assign$d(__assign$d({}, contract), { detail: 'Sin información' });
|
|
6019
|
+
return __assign$d(__assign$d({}, contract), { detail: currentStore.name + ' - ' + currentStore.address });
|
|
6020
|
+
});
|
|
6021
|
+
}
|
|
6022
|
+
_a.label = 3;
|
|
6023
|
+
case 3: return [2 /*return*/];
|
|
6024
|
+
}
|
|
6025
|
+
});
|
|
6026
|
+
};
|
|
6027
|
+
this_1 = this;
|
|
5990
6028
|
_h.label = 3;
|
|
5991
6029
|
case 3:
|
|
5992
|
-
_h.trys.push([3, 9, 10
|
|
6030
|
+
_h.trys.push([3, 8, 9, 10]);
|
|
5993
6031
|
options_1 = (e_1 = void 0, __values(options)), options_1_1 = options_1.next();
|
|
5994
6032
|
_h.label = 4;
|
|
5995
6033
|
case 4:
|
|
5996
|
-
if (!!options_1_1.done) return [3 /*break*/,
|
|
6034
|
+
if (!!options_1_1.done) return [3 /*break*/, 7];
|
|
5997
6035
|
option = options_1_1.value;
|
|
5998
|
-
|
|
5999
|
-
if (((_e = option) === null || _e === void 0 ? void 0 : _e.name) === 'branch_delivery') {
|
|
6000
|
-
option.contracts = contracts.map(function (contract) {
|
|
6001
|
-
var _a;
|
|
6002
|
-
var branch = ((_a = contract) === null || _a === void 0 ? void 0 : _a.branch_property) || {};
|
|
6003
|
-
var address = branch.address || {};
|
|
6004
|
-
var street = address.street || '';
|
|
6005
|
-
var number = address.number || '';
|
|
6006
|
-
var computed = [street, number ? "N\u00B0 " + number : ''].filter(Boolean).join(' ');
|
|
6007
|
-
return __assign$d(__assign$d({}, contract), { computed: computed || contract.computed });
|
|
6008
|
-
});
|
|
6009
|
-
}
|
|
6010
|
-
if (!methodCode.includes('pickup_store')) return [3 /*break*/, 7];
|
|
6011
|
-
if (!!stores) return [3 /*break*/, 6];
|
|
6012
|
-
return [4 /*yield*/, this.storesService.stores.pipe(operators.take(1)).toPromise()];
|
|
6036
|
+
return [5 /*yield**/, _loop_1(option)];
|
|
6013
6037
|
case 5:
|
|
6014
|
-
|
|
6038
|
+
_h.sent();
|
|
6015
6039
|
_h.label = 6;
|
|
6016
6040
|
case 6:
|
|
6017
|
-
if (stores && stores.length) {
|
|
6018
|
-
option.contracts = contracts.map(function (contract) {
|
|
6019
|
-
var currentStore = stores.find(function (store) { return store.code == contract.name; });
|
|
6020
|
-
if (!currentStore)
|
|
6021
|
-
return __assign$d(__assign$d({}, contract), { detail: 'Sin información' });
|
|
6022
|
-
return __assign$d(__assign$d({}, contract), { detail: currentStore.name + ' - ' + currentStore.address });
|
|
6023
|
-
});
|
|
6024
|
-
}
|
|
6025
|
-
_h.label = 7;
|
|
6026
|
-
case 7:
|
|
6027
6041
|
options_1_1 = options_1.next();
|
|
6028
6042
|
return [3 /*break*/, 4];
|
|
6029
|
-
case
|
|
6030
|
-
case
|
|
6043
|
+
case 7: return [3 /*break*/, 10];
|
|
6044
|
+
case 8:
|
|
6031
6045
|
e_1_1 = _h.sent();
|
|
6032
6046
|
e_1 = { error: e_1_1 };
|
|
6033
|
-
return [3 /*break*/,
|
|
6034
|
-
case
|
|
6047
|
+
return [3 /*break*/, 10];
|
|
6048
|
+
case 9:
|
|
6035
6049
|
try {
|
|
6036
6050
|
if (options_1_1 && !options_1_1.done && (_g = options_1.return)) _g.call(options_1);
|
|
6037
6051
|
}
|
|
6038
6052
|
finally { if (e_1) throw e_1.error; }
|
|
6039
6053
|
return [7 /*endfinally*/];
|
|
6040
|
-
case
|
|
6054
|
+
case 10:
|
|
6041
6055
|
list_1_1 = list_1.next();
|
|
6042
6056
|
return [3 /*break*/, 2];
|
|
6043
|
-
case
|
|
6044
|
-
case
|
|
6057
|
+
case 11: return [3 /*break*/, 14];
|
|
6058
|
+
case 12:
|
|
6045
6059
|
e_2_1 = _h.sent();
|
|
6046
6060
|
e_2 = { error: e_2_1 };
|
|
6047
|
-
return [3 /*break*/,
|
|
6048
|
-
case
|
|
6061
|
+
return [3 /*break*/, 14];
|
|
6062
|
+
case 13:
|
|
6049
6063
|
try {
|
|
6050
6064
|
if (list_1_1 && !list_1_1.done && (_f = list_1.return)) _f.call(list_1);
|
|
6051
6065
|
}
|
|
6052
6066
|
finally { if (e_2) throw e_2.error; }
|
|
6053
6067
|
return [7 /*endfinally*/];
|
|
6054
|
-
case
|
|
6068
|
+
case 14: return [2 /*return*/, list];
|
|
6055
6069
|
}
|
|
6056
6070
|
});
|
|
6057
6071
|
});
|
|
@@ -11160,10 +11174,10 @@
|
|
|
11160
11174
|
});
|
|
11161
11175
|
}); };
|
|
11162
11176
|
_this.selectSingleOption = function (option) { return __awaiter$c(_this, void 0, void 0, function () {
|
|
11163
|
-
var shippingMethodContract, shippingMethodBranchCode, requestPayload, stepData, methodLabel, contractLabel, groupLabel, label, detail, error_1;
|
|
11164
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
11165
|
-
return __generator$c(this, function (
|
|
11166
|
-
switch (
|
|
11177
|
+
var contractData, initialContractName, legacyContractData, contractType, contractName, shippingMethodContract, shippingMethodBranchCode, sanitizedContractData, requestPayload, stepData, methodLabel, contractLabel, groupLabel, label, detail, error_1;
|
|
11178
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
11179
|
+
return __generator$c(this, function (_k) {
|
|
11180
|
+
switch (_k.label) {
|
|
11167
11181
|
case 0:
|
|
11168
11182
|
if (!option)
|
|
11169
11183
|
return [2 /*return*/];
|
|
@@ -11172,35 +11186,43 @@
|
|
|
11172
11186
|
this.selectedOptionId = option.id;
|
|
11173
11187
|
this.loading_internal = true;
|
|
11174
11188
|
this.shipmentErrorKey = null;
|
|
11175
|
-
|
|
11189
|
+
_k.label = 1;
|
|
11176
11190
|
case 1:
|
|
11177
|
-
|
|
11178
|
-
|
|
11191
|
+
_k.trys.push([1, 5, 6, 7]);
|
|
11192
|
+
contractData = __assign$m({}, (option.contract || {}));
|
|
11193
|
+
initialContractName = contractData.name || ((_a = option.contract) === null || _a === void 0 ? void 0 : _a.name);
|
|
11194
|
+
if (!this.shouldEnrichFromLegacy(option)) return [3 /*break*/, 3];
|
|
11195
|
+
return [4 /*yield*/, this.getLegacyContractData((_b = option.method) === null || _b === void 0 ? void 0 : _b.code, option.costName, initialContractName)];
|
|
11196
|
+
case 2:
|
|
11197
|
+
legacyContractData = _k.sent();
|
|
11198
|
+
if (legacyContractData) {
|
|
11199
|
+
contractData = __assign$m(__assign$m({}, contractData), legacyContractData);
|
|
11200
|
+
}
|
|
11201
|
+
_k.label = 3;
|
|
11202
|
+
case 3:
|
|
11203
|
+
contractType = contractData.contract || option.costName;
|
|
11204
|
+
contractName = contractData.name || ((_c = option.contract) === null || _c === void 0 ? void 0 : _c.name);
|
|
11205
|
+
shippingMethodContract = option.costName + "_" + contractName;
|
|
11179
11206
|
shippingMethodBranchCode = option.costName === 'branch_delivery'
|
|
11180
|
-
? (
|
|
11181
|
-
:
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
price: (_g = option.contract) === null || _g === void 0 ? void 0 : _g.price,
|
|
11188
|
-
shipping_method_contract: shippingMethodContract,
|
|
11189
|
-
shipping_method_branch_code: shippingMethodBranchCode
|
|
11190
|
-
};
|
|
11191
|
-
stepData = __assign$m(__assign$m({}, requestPayload), { method_name: (_h = option.method) === null || _h === void 0 ? void 0 : _h.name, contract_name: (_j = option.contract) === null || _j === void 0 ? void 0 : _j.name });
|
|
11207
|
+
? (contractData.sucursal_id || contractData.number || ((_d = contractData.branch_property) === null || _d === void 0 ? void 0 : _d.number) || contractName)
|
|
11208
|
+
: contractName;
|
|
11209
|
+
sanitizedContractData = __assign$m({}, contractData);
|
|
11210
|
+
delete sanitizedContractData.branch_property;
|
|
11211
|
+
delete sanitizedContractData.option;
|
|
11212
|
+
requestPayload = __assign$m(__assign$m({}, sanitizedContractData), { shippingId: option.method.code, method: option.method.code, option: option.costName, contract: contractType, name: contractName, price: contractData.price, selected: true, shipping_method_contract: shippingMethodContract, shipping_method_branch_code: shippingMethodBranchCode });
|
|
11213
|
+
stepData = __assign$m(__assign$m({}, requestPayload), { method_name: (_e = option.method) === null || _e === void 0 ? void 0 : _e.name, contract_name: contractName });
|
|
11192
11214
|
return [4 /*yield*/, this.shipmentService.setShippingOption(requestPayload, stepData)];
|
|
11193
|
-
case
|
|
11194
|
-
|
|
11195
|
-
methodLabel = ((
|
|
11215
|
+
case 4:
|
|
11216
|
+
_k.sent();
|
|
11217
|
+
methodLabel = ((_f = option.method) === null || _f === void 0 ? void 0 : _f.name) ? this.translateService.instant(option.method.name)
|
|
11196
11218
|
: '';
|
|
11197
|
-
contractLabel = ((
|
|
11219
|
+
contractLabel = ((_g = option.contract) === null || _g === void 0 ? void 0 : _g.name) ? this.translateService.instant(option.contract.name)
|
|
11198
11220
|
: '';
|
|
11199
11221
|
groupLabel = option.costName
|
|
11200
11222
|
? this.translateService.instant(this.resolveGroupLabel(option.costName))
|
|
11201
11223
|
: '';
|
|
11202
11224
|
label = [groupLabel, methodLabel, contractLabel].filter(Boolean).join(' · ');
|
|
11203
|
-
detail = ((
|
|
11225
|
+
detail = ((_h = option.contract) === null || _h === void 0 ? void 0 : _h.computed) || ((_j = option.contract) === null || _j === void 0 ? void 0 : _j.detail) || '';
|
|
11204
11226
|
this.summaryChange.emit({
|
|
11205
11227
|
label: label || undefined,
|
|
11206
11228
|
detail: detail || undefined
|
|
@@ -11208,15 +11230,41 @@
|
|
|
11208
11230
|
if (this.compactShipmentView) {
|
|
11209
11231
|
this.advanceStep.emit();
|
|
11210
11232
|
}
|
|
11211
|
-
return [3 /*break*/,
|
|
11212
|
-
case
|
|
11213
|
-
error_1 =
|
|
11233
|
+
return [3 /*break*/, 7];
|
|
11234
|
+
case 5:
|
|
11235
|
+
error_1 = _k.sent();
|
|
11214
11236
|
this.shipmentErrorKey = 'operation-error';
|
|
11215
|
-
return [3 /*break*/,
|
|
11216
|
-
case
|
|
11237
|
+
return [3 /*break*/, 7];
|
|
11238
|
+
case 6:
|
|
11217
11239
|
this.loading_internal = false;
|
|
11218
11240
|
return [7 /*endfinally*/];
|
|
11219
|
-
case
|
|
11241
|
+
case 7: return [2 /*return*/];
|
|
11242
|
+
}
|
|
11243
|
+
});
|
|
11244
|
+
}); };
|
|
11245
|
+
_this.getLegacyContractData = function (methodCode, costName, contractName) { return __awaiter$c(_this, void 0, void 0, function () {
|
|
11246
|
+
var costs, selectedCost, selectedContract, error_2;
|
|
11247
|
+
var _a, _b;
|
|
11248
|
+
return __generator$c(this, function (_c) {
|
|
11249
|
+
switch (_c.label) {
|
|
11250
|
+
case 0:
|
|
11251
|
+
if (!methodCode || !costName || !contractName)
|
|
11252
|
+
return [2 /*return*/, null];
|
|
11253
|
+
_c.label = 1;
|
|
11254
|
+
case 1:
|
|
11255
|
+
_c.trys.push([1, 3, , 4]);
|
|
11256
|
+
return [4 /*yield*/, this.shipmentService.getCostsForMethod(methodCode)];
|
|
11257
|
+
case 2:
|
|
11258
|
+
costs = _c.sent();
|
|
11259
|
+
selectedCost = (costs || []).find(function (cost) { var _a; return String(((_a = cost) === null || _a === void 0 ? void 0 : _a.name) || '') === String(costName); });
|
|
11260
|
+
if (!((_b = (_a = selectedCost) === null || _a === void 0 ? void 0 : _a.contracts) === null || _b === void 0 ? void 0 : _b.length))
|
|
11261
|
+
return [2 /*return*/, null];
|
|
11262
|
+
selectedContract = selectedCost.contracts.find(function (contract) { var _a; return String(((_a = contract) === null || _a === void 0 ? void 0 : _a.name) || '') === String(contractName); });
|
|
11263
|
+
return [2 /*return*/, selectedContract || null];
|
|
11264
|
+
case 3:
|
|
11265
|
+
error_2 = _c.sent();
|
|
11266
|
+
return [2 /*return*/, null];
|
|
11267
|
+
case 4: return [2 /*return*/];
|
|
11220
11268
|
}
|
|
11221
11269
|
});
|
|
11222
11270
|
}); };
|
|
@@ -11270,6 +11318,11 @@
|
|
|
11270
11318
|
this.shipmentService.getShipmentMethods();
|
|
11271
11319
|
}
|
|
11272
11320
|
};
|
|
11321
|
+
ShipmentEcComponent.prototype.shouldEnrichFromLegacy = function (option) {
|
|
11322
|
+
if (!option || option.costName !== 'branch_delivery')
|
|
11323
|
+
return false;
|
|
11324
|
+
return true;
|
|
11325
|
+
};
|
|
11273
11326
|
ShipmentEcComponent.prototype.setActive = function (e) {
|
|
11274
11327
|
var e_2, _a;
|
|
11275
11328
|
var parent = e.target.parentElement.children;
|