UNPKG

@spartacus/order

Version:

Order feature library for Spartacus

448 lines (434 loc) 22.8 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@spartacus/core'), require('@angular/router'), require('@spartacus/storefront'), require('rxjs/operators')) : typeof define === 'function' && define.amd ? define('@spartacus/order/root', ['exports', '@angular/core', '@spartacus/core', '@angular/router', '@spartacus/storefront', 'rxjs/operators'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.spartacus = global.spartacus || {}, global.spartacus.order = global.spartacus.order || {}, global.spartacus.order.root = {}), global.ng.core, global.core, global.ng.router, global.storefront, global.rxjs.operators)); }(this, (function (exports, i0, core, i1, storefront, operators) { 'use strict'; function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n['default'] = e; return Object.freeze(n); } var i0__namespace = /*#__PURE__*/_interopNamespace(i0); var i1__namespace = /*#__PURE__*/_interopNamespace(i1); var ORDER_FEATURE = 'order'; var ORDER_CORE_FEATURE = 'orderCore'; function orderReturnRequestFacadeFactory() { return core.facadeFactory({ facade: OrderReturnRequestFacade, feature: ORDER_CORE_FEATURE, methods: [ 'createOrderReturnRequest', 'getOrderReturnRequest', 'getOrderReturnRequestList', 'loadOrderReturnRequestDetail', 'loadOrderReturnRequestList', 'clearOrderReturnRequestList', 'getReturnRequestLoading', 'getReturnRequestSuccess', 'clearOrderReturnRequestDetail', 'cancelOrderReturnRequest', 'getCancelReturnRequestLoading', 'getCancelReturnRequestSuccess', 'resetCancelReturnRequestProcessState', ], async: true, }); } var OrderReturnRequestFacade = /** @class */ (function () { function OrderReturnRequestFacade() { } return OrderReturnRequestFacade; }()); OrderReturnRequestFacade.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderReturnRequestFacade, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable }); OrderReturnRequestFacade.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderReturnRequestFacade, providedIn: 'root', useFactory: orderReturnRequestFacadeFactory }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderReturnRequestFacade, decorators: [{ type: i0.Injectable, args: [{ providedIn: 'root', useFactory: orderReturnRequestFacadeFactory, }] }] }); function orderFacadeFactory() { return core.facadeFactory({ facade: OrderFacade, feature: ORDER_CORE_FEATURE, methods: [ 'getOrderDetails', 'loadOrderDetails', 'clearOrderDetails', 'getOrderHistoryList', 'getOrderHistoryListLoaded', 'loadOrderList', 'clearOrderList', 'getConsignmentTracking', 'loadConsignmentTracking', 'clearConsignmentTracking', 'cancelOrder', 'getCancelOrderLoading', 'getCancelOrderSuccess', 'resetCancelOrderProcessState', ], async: true, }); } var OrderFacade = /** @class */ (function () { function OrderFacade() { } return OrderFacade; }()); OrderFacade.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderFacade, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable }); OrderFacade.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderFacade, providedIn: 'root', useFactory: orderFacadeFactory }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderFacade, decorators: [{ type: i0.Injectable, args: [{ providedIn: 'root', useFactory: orderFacadeFactory, }] }] }); function replenishmentOrderFacadeFactory() { return core.facadeFactory({ facade: ReplenishmentOrderFacade, feature: ORDER_CORE_FEATURE, methods: [ 'loadReplenishmentOrderDetails', 'getReplenishmentOrderDetails', 'getReplenishmentOrderDetailsLoading', 'getReplenishmentOrderDetailsSuccess', 'getReplenishmentOrderDetailsError', 'clearReplenishmentOrderDetails', 'cancelReplenishmentOrder', 'getCancelReplenishmentOrderLoading', 'getCancelReplenishmentOrderSuccess', 'getCancelReplenishmentOrderError', 'clearCancelReplenishmentOrderProcessState', 'getReplenishmentOrderHistoryList', 'getReplenishmentOrderHistoryListLoading', 'getReplenishmentOrderHistoryListError', 'getReplenishmentOrderHistoryListSuccess', 'loadReplenishmentOrderList', 'clearReplenishmentOrderList', ], async: true, }); } var ReplenishmentOrderFacade = /** @class */ (function () { function ReplenishmentOrderFacade() { } return ReplenishmentOrderFacade; }()); ReplenishmentOrderFacade.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ReplenishmentOrderFacade, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable }); ReplenishmentOrderFacade.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ReplenishmentOrderFacade, providedIn: 'root', useFactory: replenishmentOrderFacadeFactory }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ReplenishmentOrderFacade, decorators: [{ type: i0.Injectable, args: [{ providedIn: 'root', useFactory: replenishmentOrderFacadeFactory, }] }] }); var OrderDetailsOrderEntriesContext = /** @class */ (function () { function OrderDetailsOrderEntriesContext(userOrderService) { this.userOrderService = userOrderService; this.type = storefront.OrderEntriesSource.ORDER_DETAILS; } OrderDetailsOrderEntriesContext.prototype.getEntries = function () { return this.userOrderService .getOrderDetails() .pipe(operators.map(function (order) { var _a; return (_a = order === null || order === void 0 ? void 0 : order.entries) !== null && _a !== void 0 ? _a : []; })); }; return OrderDetailsOrderEntriesContext; }()); OrderDetailsOrderEntriesContext.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderDetailsOrderEntriesContext, deps: [{ token: OrderFacade }], target: i0__namespace.ɵɵFactoryTarget.Injectable }); OrderDetailsOrderEntriesContext.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderDetailsOrderEntriesContext, providedIn: 'root' }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderDetailsOrderEntriesContext, decorators: [{ type: i0.Injectable, args: [{ providedIn: 'root', }] }], ctorParameters: function () { return [{ type: OrderFacade }]; } }); var defaultOrderRoutingConfig = { routing: { routes: { orders: { paths: ['my-account/orders'], }, orderDetails: { paths: ['my-account/order/:orderCode'], paramsMapping: { orderCode: 'code' }, }, orderGuest: { paths: ['guest/order/:orderCode'], paramsMapping: { orderCode: 'code' }, }, orderReturn: { paths: ['my-account/order/return/:orderCode'], paramsMapping: { orderCode: 'code' }, }, orderReturnConfirmation: { paths: ['my-account/order/return/confirmation/:orderCode'], paramsMapping: { orderCode: 'code' }, }, orderCancel: { paths: ['my-account/order/cancel/:orderCode'], paramsMapping: { orderCode: 'code' }, }, orderCancelConfirmation: { paths: ['my-account/order/cancel/confirmation/:orderCode'], paramsMapping: { orderCode: 'code' }, }, returnRequestDetails: { paths: ['my-account/return-request/:returnCode'], paramsMapping: { returnCode: 'rma' }, }, replenishmentOrders: { paths: ['my-account/my-replenishments'], }, replenishmentDetails: { paths: ['my-account/my-replenishment/:replenishmentOrderCode'], paramsMapping: { replenishmentOrderCode: 'replenishmentOrderCode' }, }, }, }, }; var _a, _b; // TODO: Inline this factory when we start releasing Ivy compiled libraries function defaultOrderComponentsConfig() { var _a; var config = { featureModules: (_a = {}, _a[ORDER_FEATURE] = { cmsComponents: [ 'CancelOrderComponent', 'CancelOrderConfirmationComponent', 'ReturnOrderComponent', 'ReturnOrderConfirmationComponent', 'AccountOrderDetailsActionsComponent', 'AccountOrderDetailsItemsComponent', 'AccountOrderDetailsTotalsComponent', 'AccountOrderDetailsShippingComponent', 'AccountOrderHistoryComponent', 'ReplenishmentDetailItemsComponent', 'ReplenishmentDetailTotalsComponent', 'ReplenishmentDetailShippingComponent', 'ReplenishmentDetailActionsComponent', 'ReplenishmentDetailOrderHistoryComponent', 'AccountReplenishmentHistoryComponent', 'ReturnRequestOverviewComponent', 'ReturnRequestItemsComponent', 'ReturnRequestTotalsComponent', 'OrderReturnRequestListComponent', ], }, // by default core is bundled together with components _a[ORDER_CORE_FEATURE] = ORDER_FEATURE, _a), }; return config; } var OrderRootModule = /** @class */ (function () { function OrderRootModule() { } return OrderRootModule; }()); OrderRootModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderRootModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule }); OrderRootModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderRootModule, imports: [i1__namespace.RouterModule] }); OrderRootModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderRootModule, providers: [ core.provideDefaultConfigFactory(defaultOrderComponentsConfig), core.provideDefaultConfig(defaultOrderRoutingConfig), ], imports: [[ i1.RouterModule.forChild([ { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { pageLabel: 'order', cxRoute: 'orderGuest' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderDetails', cxContext: (_a = {}, _a[storefront.ORDER_ENTRIES_CONTEXT] = OrderDetailsOrderEntriesContext, _a), }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderCancel' }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderCancelConfirmation' }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderReturn' }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderReturnConfirmation' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orders' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'replenishmentDetails' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'replenishmentOrders' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'returnRequestDetails' }, }, ]), ]] }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: OrderRootModule, decorators: [{ type: i0.NgModule, args: [{ imports: [ i1.RouterModule.forChild([ { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { pageLabel: 'order', cxRoute: 'orderGuest' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderDetails', cxContext: (_b = {}, _b[storefront.ORDER_ENTRIES_CONTEXT] = OrderDetailsOrderEntriesContext, _b), }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderCancel' }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderCancelConfirmation' }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderReturn' }, }, { // @ts-ignore path: null, canActivate: [storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orderReturnConfirmation' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'orders' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'replenishmentDetails' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'replenishmentOrders' }, }, { // @ts-ignore path: null, canActivate: [core.AuthGuard, storefront.CmsPageGuard], component: storefront.PageLayoutComponent, data: { cxRoute: 'returnRequestDetails' }, }, ]), ], providers: [ core.provideDefaultConfigFactory(defaultOrderComponentsConfig), core.provideDefaultConfig(defaultOrderRoutingConfig), ], }] }] }); /** * Generated bundle index. Do not edit. */ exports.ORDER_CORE_FEATURE = ORDER_CORE_FEATURE; exports.ORDER_FEATURE = ORDER_FEATURE; exports.OrderDetailsOrderEntriesContext = OrderDetailsOrderEntriesContext; exports.OrderFacade = OrderFacade; exports.OrderReturnRequestFacade = OrderReturnRequestFacade; exports.OrderRootModule = OrderRootModule; exports.ReplenishmentOrderFacade = ReplenishmentOrderFacade; exports.defaultOrderComponentsConfig = defaultOrderComponentsConfig; exports.orderFacadeFactory = orderFacadeFactory; exports.orderReturnRequestFacadeFactory = orderReturnRequestFacadeFactory; exports.replenishmentOrderFacadeFactory = replenishmentOrderFacadeFactory; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=spartacus-order-root.umd.js.map