UNPKG

@spartacus/cart

Version:

`@spartacus/cart` is a package that you can include in your application, which allows you to use various cart features.

138 lines (127 loc) 6.9 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@spartacus/core'), require('@spartacus/storefront')) : typeof define === 'function' && define.amd ? define('@spartacus/cart/import-export/core', ['exports', '@angular/core', '@spartacus/core', '@spartacus/storefront'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.spartacus = global.spartacus || {}, global.spartacus.cart = global.spartacus.cart || {}, global.spartacus.cart['import-export'] = global.spartacus.cart['import-export'] || {}, global.spartacus.cart['import-export'].core = {}), global.ng.core, global.core, global.storefront)); }(this, (function (exports, i0, core, storefront) { '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 ImportExportConfig = /** @class */ (function () { function ImportExportConfig() { } return ImportExportConfig; }()); ImportExportConfig.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ImportExportConfig, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable }); ImportExportConfig.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ImportExportConfig, providedIn: 'root', useExisting: core.Config }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ImportExportConfig, decorators: [{ type: i0.Injectable, args: [{ providedIn: 'root', useExisting: core.Config, }] }] }); /** * Indicates from which source the new saved cart name * should be taken. */ exports.CartNameSource = void 0; (function (CartNameSource) { CartNameSource["FILE_NAME"] = "fileName"; CartNameSource["DATE_TIME"] = "dateTime"; })(exports.CartNameSource || (exports.CartNameSource = {})); var _a; var defaultImportExportConfig = { cartImportExport: { file: { separator: ',', }, import: { fileValidity: { maxSize: 1, maxEntries: (_a = {}, _a[storefront.OrderEntriesSource.NEW_SAVED_CART] = 100, _a[storefront.OrderEntriesSource.SAVED_CART] = 100, _a[storefront.OrderEntriesSource.ACTIVE_CART] = 10, _a[storefront.OrderEntriesSource.QUICK_ORDER] = 10, _a), allowedTypes: [ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel', 'text/csv', '.csv', ], }, cartNameGeneration: { source: exports.CartNameSource.FILE_NAME, }, }, export: { additionalColumns: [ { name: { key: 'name', }, value: 'product.name', }, { name: { key: 'price', }, value: 'totalPrice.formattedValue', }, ], messageEnabled: true, downloadDelay: 1000, maxEntries: 1000, fileOptions: { fileName: 'cart', extension: 'csv', type: 'text/csv', }, }, }, }; var ImportExportCoreModule = /** @class */ (function () { function ImportExportCoreModule() { } ImportExportCoreModule.forRoot = function () { return { ngModule: ImportExportCoreModule, providers: [core.provideDefaultConfig(defaultImportExportConfig)], }; }; return ImportExportCoreModule; }()); ImportExportCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ImportExportCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule }); ImportExportCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ImportExportCoreModule }); ImportExportCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ImportExportCoreModule }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ImportExportCoreModule, decorators: [{ type: i0.NgModule, args: [{}] }] }); /** * Generated bundle index. Do not edit. */ exports.ImportExportConfig = ImportExportConfig; exports.ImportExportCoreModule = ImportExportCoreModule; exports.defaultImportExportConfig = defaultImportExportConfig; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=spartacus-cart-import-export-core.umd.js.map