sspart-common-lib 0.0.3 → 0.0.4

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.
@@ -0,0 +1,23 @@
1
+ export declare const NOTIFICATION_SERVICES: {
2
+ PAGE_SPINNER: string;
3
+ DISPLAY_ALERT: string;
4
+ DISPLAY_SNACKBAR: string;
5
+ };
6
+ export declare const ALERT_TYPES: {
7
+ SUCCESS: string;
8
+ ERROR: string;
9
+ WARNING: string;
10
+ INFO: string;
11
+ };
12
+ export declare const STATUSES: {
13
+ SUCCESS: string;
14
+ FAILURE: string;
15
+ };
16
+ export declare const TABLE_DIRECTION: {
17
+ UP: string;
18
+ DOWN: string;
19
+ };
20
+ export declare const STOCK_ORDER_TYPES: {
21
+ LIMIT: string;
22
+ MARKET: string;
23
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STOCK_ORDER_TYPES = exports.TABLE_DIRECTION = exports.STATUSES = exports.ALERT_TYPES = exports.NOTIFICATION_SERVICES = void 0;
4
+ exports.NOTIFICATION_SERVICES = {
5
+ PAGE_SPINNER: 'pagespinner',
6
+ DISPLAY_ALERT: 'displayalert',
7
+ DISPLAY_SNACKBAR: 'displaysnackbar'
8
+ };
9
+ exports.ALERT_TYPES = {
10
+ SUCCESS: 'success',
11
+ ERROR: 'error',
12
+ WARNING: 'warning',
13
+ INFO: 'info'
14
+ };
15
+ exports.STATUSES = {
16
+ SUCCESS: 'Success',
17
+ FAILURE: 'Failure',
18
+ };
19
+ exports.TABLE_DIRECTION = {
20
+ UP: 'up',
21
+ DOWN: 'down'
22
+ };
23
+ exports.STOCK_ORDER_TYPES = {
24
+ LIMIT: 'LIMIT',
25
+ MARKET: 'MARKET'
26
+ };
@@ -0,0 +1,3 @@
1
+ export declare const setCookie: (key: string, value: string) => void;
2
+ export declare const setCookieExpiry: (key: string, value: string, expiryTime: number) => void;
3
+ export declare const getCookie: (cname: string) => string;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCookie = exports.setCookieExpiry = exports.setCookie = void 0;
4
+ const setCookie = (key, value) => {
5
+ const encodedKey = encodeURIComponent(key);
6
+ const encodedValue = encodeURIComponent(value);
7
+ (0, exports.setCookieExpiry)(encodedKey, '', -1);
8
+ document.cookie = `${encodedKey}=${encodedValue};path=/`;
9
+ };
10
+ exports.setCookie = setCookie;
11
+ const setCookieExpiry = (key, value, expiryTime) => {
12
+ const encodedKey = encodeURIComponent(key);
13
+ const encodedValue = encodeURIComponent(value);
14
+ const date = new Date(new Date().getTime() + expiryTime * 60 * 1000);
15
+ const expires = expiryTime > 0 ? `expires=${date.toUTCString()};` : '';
16
+ document.cookie = `${encodedKey}=${encodedValue};${expires}path=/`;
17
+ };
18
+ exports.setCookieExpiry = setCookieExpiry;
19
+ const getCookie = (cname) => {
20
+ const cookies = document.cookie.split(';').map(cookie => cookie.trim());
21
+ const targetCookie = cookies.find(cookie => cookie.startsWith(`${cname}=`));
22
+ return targetCookie ? targetCookie.split('=')[1] : '';
23
+ };
24
+ exports.getCookie = getCookie;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ export { logFailure, logFailureWithoutReturn, sendFailureResponse, sendSuccessCo
2
2
  export { sleep, isValidUsername, validateStringIsValidEmail, validateStringIsValidNumber, genRandomString, genRandomNumber, format, createUUID } from './common/common';
3
3
  export { getCookies } from './common/cookies';
4
4
  export { generateHashedPassword, validateHashedPassword } from './common/password.service';
5
+ export { getCookie, setCookie, setCookieExpiry } from './common/cookies.browser';
6
+ export { NOTIFICATION_SERVICES, ALERT_TYPES, STATUSES, TABLE_DIRECTION, STOCK_ORDER_TYPES } from './common/constants';
5
7
  export { getConfig, setLibraryConfig } from './common/config';
6
8
  export { default as alertService } from './common/alert-data.service';
7
9
  export { default as contentDs } from './common/content-data.service';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.planAuth = exports.auth = exports.ns = exports.contentDs = exports.alertService = exports.setLibraryConfig = exports.getConfig = exports.validateHashedPassword = exports.generateHashedPassword = exports.getCookies = exports.createUUID = exports.format = exports.genRandomNumber = exports.genRandomString = exports.validateStringIsValidNumber = exports.validateStringIsValidEmail = exports.isValidUsername = exports.sleep = exports.sendSuccessCodeResponse = exports.sendSuccessResponse = exports.sendSuccessCode = exports.sendFailureResponse = exports.logFailureWithoutReturn = exports.logFailure = void 0;
3
+ exports.planAuth = exports.auth = exports.ns = exports.contentDs = exports.alertService = exports.setLibraryConfig = exports.getConfig = exports.STOCK_ORDER_TYPES = exports.TABLE_DIRECTION = exports.STATUSES = exports.ALERT_TYPES = exports.NOTIFICATION_SERVICES = exports.setCookieExpiry = exports.setCookie = exports.getCookie = exports.validateHashedPassword = exports.generateHashedPassword = exports.getCookies = exports.createUUID = exports.format = exports.genRandomNumber = exports.genRandomString = exports.validateStringIsValidNumber = exports.validateStringIsValidEmail = exports.isValidUsername = exports.sleep = exports.sendSuccessCodeResponse = exports.sendSuccessResponse = exports.sendSuccessCode = exports.sendFailureResponse = exports.logFailureWithoutReturn = exports.logFailure = void 0;
4
4
  var response_service_1 = require("./common/response.service");
5
5
  Object.defineProperty(exports, "logFailure", { enumerable: true, get: function () { return response_service_1.logFailure; } });
6
6
  Object.defineProperty(exports, "logFailureWithoutReturn", { enumerable: true, get: function () { return response_service_1.logFailureWithoutReturn; } });
@@ -22,6 +22,16 @@ Object.defineProperty(exports, "getCookies", { enumerable: true, get: function (
22
22
  var password_service_1 = require("./common/password.service");
23
23
  Object.defineProperty(exports, "generateHashedPassword", { enumerable: true, get: function () { return password_service_1.generateHashedPassword; } });
24
24
  Object.defineProperty(exports, "validateHashedPassword", { enumerable: true, get: function () { return password_service_1.validateHashedPassword; } });
25
+ var cookies_browser_1 = require("./common/cookies.browser");
26
+ Object.defineProperty(exports, "getCookie", { enumerable: true, get: function () { return cookies_browser_1.getCookie; } });
27
+ Object.defineProperty(exports, "setCookie", { enumerable: true, get: function () { return cookies_browser_1.setCookie; } });
28
+ Object.defineProperty(exports, "setCookieExpiry", { enumerable: true, get: function () { return cookies_browser_1.setCookieExpiry; } });
29
+ var constants_1 = require("./common/constants");
30
+ Object.defineProperty(exports, "NOTIFICATION_SERVICES", { enumerable: true, get: function () { return constants_1.NOTIFICATION_SERVICES; } });
31
+ Object.defineProperty(exports, "ALERT_TYPES", { enumerable: true, get: function () { return constants_1.ALERT_TYPES; } });
32
+ Object.defineProperty(exports, "STATUSES", { enumerable: true, get: function () { return constants_1.STATUSES; } });
33
+ Object.defineProperty(exports, "TABLE_DIRECTION", { enumerable: true, get: function () { return constants_1.TABLE_DIRECTION; } });
34
+ Object.defineProperty(exports, "STOCK_ORDER_TYPES", { enumerable: true, get: function () { return constants_1.STOCK_ORDER_TYPES; } });
25
35
  var config_1 = require("./common/config");
26
36
  Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return config_1.getConfig; } });
27
37
  Object.defineProperty(exports, "setLibraryConfig", { enumerable: true, get: function () { return config_1.setLibraryConfig; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sspart-common-lib",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",