Plum tree systems utils
Instalation
Add module
yarn add @plumtreesystems/utils
tsconfig.json
file if necessary
Add types definition to "typeRoots": [
"./node_modules/@plumtreesystems/utils/dist/esm/@types"
],
jest.config.js
file
For Jest to understand modules add to transformIgnorePatterns: ['/node_modules/(?!@plumtreesystems)'],
Utils
Browser detector
Initiated BrowserDetector
class.
import BrowserDetector from '@plumtreesystems/utils';
Currency prefix
CurrencyPrefix
uninitiated class.
import CurrencyPrefix from '@plumtreesystems/utils';
new CurrencyPrefix(countryOptions);
Params:
countryOptions: Object<{key: value}>
Date manager
DateManager
uninitiated class.
import DateManager from '@plumtreesystems/utils';
new DateManager(dateFormat, timeFormat);
Params:
dateFormat: string = 'YYYY-MM-DD'
timeFormat: string = 'HH:mm'
File downloader
Function for file downloading
import fileDownload from '@plumtreesystems/utils';
File helper
FilesHelper
initiated class.
import { FilesHelper, AssetCategoryType, AssetStatsType, AssetType } from '@plumtreesystems/utils';
Hydra
Uninitiated Hydra
pagination object and types.
import { Hydra, HydraObjectType, HydraPaginationType, HydraViewObjectType, PageFilterType } from '@plumtreesystems/utils';
new Hydra(hydraObject);
Params:
hydraObject: HydraObjectType
Image tools
ImageTools
initiated class.
import ImageTools from '@plumtreesystems/utils';
Impersonator
Impersonator
initiated class. Handle impersonation token actions with local storage.
import Impersonator from '@plumtreesystems/utils';
Local storage manager
LocalStorageManager
uninitiated class.
import LocalStorageManager from '@plumtreesystems/utils';
new LocalStorageManager(storeVersion, excludedModules);
Params:
storeVersion: string
excludedModules: string[]
Mocked date manager
MockedDateManager
uninitiated class.
import MockedDateManager from '@plumtreesystems/utils';
new MockedDateManager(currentDate);
Params:
currentDate: string = '2020-08-08 08:00'
Object processor
ObjectProcessor
initiated class.
import ObjectProcessor from '@plumtreesystems/utils';
Pagination helper
PaginationHelper
initiated class.
import PaginationHelper from '@plumtreesystems/utils';
Request cache
RequestCache
initiated class and types.
import { RequestCache, RequestCacheFormatType, SetCachedRequestParametersType } from '@plumtreesystems/utils';
Response error processor
ResponseErrorsProcessor
uninitiated class, errorsFormatter
function and error types.
import { ResponseErrorsProcessor, errorsFormatter, ErrorType, ErrorsObjectType } from '@plumtreesystems/utils';
new ResponseErrorsProcessor(registerError)
Params:
registerError: (e: any) => any
Scroll to top
scrollToTop
function.
import scrollToTop from '@plumtreesystems/utils';
Types overwrite
OverwriteType
type to overwrite existing types.
import OverwriteType from '@plumtreesystems/utils';
Url tools
UrlTools
initiated class.
import UrlTools from '@plumtreesystems/utils/src/url-tools';
Vuex module decorators
CustomAction
function witch overrides default action parameters.
import { CustomAction } from '@plumtreesystems/utils';