Browse Source

styling update

master
ganga satish kumar 3 years ago
parent
commit
da7559acb8
  1. 1
      node_modules/__ngcc_entry_points__.json
  2. 258
      node_modules/ngx-cookie-service/README.md
  3. 208
      node_modules/ngx-cookie-service/esm2020/lib/cookie.service.mjs
  4. 5
      node_modules/ngx-cookie-service/esm2020/ngx-cookie-service.mjs
  5. 5
      node_modules/ngx-cookie-service/esm2020/public-api.mjs
  6. 219
      node_modules/ngx-cookie-service/fesm2015/ngx-cookie-service.mjs
  7. 1
      node_modules/ngx-cookie-service/fesm2015/ngx-cookie-service.mjs.map
  8. 217
      node_modules/ngx-cookie-service/fesm2020/ngx-cookie-service.mjs
  9. 1
      node_modules/ngx-cookie-service/fesm2020/ngx-cookie-service.mjs.map
  10. 127
      node_modules/ngx-cookie-service/lib/cookie.service.d.ts
  11. 5
      node_modules/ngx-cookie-service/ngx-cookie-service.d.ts
  12. 144
      node_modules/ngx-cookie-service/package.json
  13. 1
      node_modules/ngx-cookie-service/public-api.d.ts
  14. 8
      package-lock.json
  15. 1
      package.json
  16. 4
      src/app/annual-health-checkup/annual-health-checkup.component.ts
  17. 6
      src/app/annual-health-checkup/generate-letter/generate-letter.component.ts
  18. 29
      src/app/annual-health-checkup/generate-letter/generate-letter.service.ts
  19. 4
      src/app/app.module.ts

1
node_modules/__ngcc_entry_points__.json
File diff suppressed because it is too large
View File

258
node_modules/ngx-cookie-service/README.md

@ -0,0 +1,258 @@
# NGX Cookie Service
<p align="center">
![build](https://github.com/stevermeister/ngx-cookie-service/workflows/CI/badge.svg?branch=master)
<a href="https://www.npmjs.com/ngx-cookie-service">
<img src="https://img.shields.io/npm/v/ngx-cookie-service.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen" alt="Ngx Cookie Service on npm" />
</a>
<a href="https://gitter.im/ngx-cookie-service/community">
<img src="https://badges.gitter.im/ngx-cookie-service/community.svg" alt="Chat in Gitter" />
</a>
[![ngx-cookie-service channel on discord](https://img.shields.io/discord/873021904708059177.svg?style=flat-square)](https://discord.gg/N3xc4Jfb)
</p>
Angular service to read, set and delete browser cookies. Originally based on the [ng2-cookies](https://www.npmjs.com/package/ng2-cookies) library. The experienced team behind [Studytube](https://www.studytube.nl/) will take care of our cookie service from now on.
> Note: `ViewEngine` support has been removed on 13.x.x. See [compatability matrix](https://github.com/stevermeister/ngx-cookie-service#supported-versions) for details
## Installation
```bash
npm install ngx-cookie-service --save
# or
yarn add ngx-cookie-service
```
## Usage
Add the cookie service to your `app.module.ts` as a provider:
```typescript
import { CookieService } from 'ngx-cookie-service';
@NgModule({
...
providers:
[CookieService],
...
})
export class AppModule {
}
```
Then, import and inject it into a constructor:
```typescript
constructor(private
cookieService: CookieService
)
{
this.cookieService.set('Test', 'Hello World');
this.cookieValue = this.cookieService.get('Test');
}
```
That's it!
## Server Side Rendering (Coming Soon)
`ngx-cookie-service` supports Server Side Rendering (SSR) through Angular Universal. By default, browser cookies are not
available in SSR because `document` object is not available. To overcome this, navigate to `server.ts` file in your SSR
project, and replace the following code
```typescript
server.get('*', (req, res) => {
res.render(indexHtml, { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] });
});
```
with this
```typescript
server.get('*', (req, res) => {
res.render(indexHtml, {
req,
providers: [
{ provide: APP_BASE_HREF, useValue: req.baseUrl },
{ provide: 'REQUEST', useValue: req },
{ provide: 'RESPONSE', useValue: res },
],
});
});
```
This will make sure the cookies are available in `REQUEST` object, and the `ngx-cookie-service` can use `REQUEST.cookies` to access the
cookies in SSR. Then proceed to use `ngx-cookie-service` as usual. See
the [sample repo](https://github.com/pavankjadda/angular-ssr-docker) for more details.
## Demo
https://stackblitz.com/edit/angular-ivy-1lrgdt?file=src%2Fapp%2Fapp.component.ts
## Supported Versions
`ViewEngine` support has been removed on 13.x.x. For Angular versions 13.x.x or later use the latest version of the
library. For versions <=12.x.x, use 12.0.3 version
| Angular Version | Supported Version |
| ---------------------- | ----------------- |
| 13.x.x or later (Ivy) | 13.x.x or later |
| <=12.x.x (View Engine) | 12.0.3 |
# API
## check( name: string ): boolean;
```typescript
const cookieExists: boolean = cookieService.check('test');
```
Checks if a cookie with the given`name` can be accessed or found.
## get( name: string ): string;
```typescript
const value: string = cookieService.get('test');
```
Gets the value of the cookie with the specified `name`.
## getAll(): {};
```typescript
const allCookies: {} = cookieService.getAll();
```
Returns a map of key-value pairs for cookies that can be accessed.
## set( name: string, value: string, expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'Strict' | 'None' ): void;
## set( name: string, value: string, options?: { expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'None' | 'Strict'}): void;
```typescript
cookieService.set('test', 'Hello World');
cookieService.set('test', 'Hello World', { expires: 2, sameSite: 'Lax' });
```
Sets a cookie with the specified `name` and `value`. It is good practice to specify a path. If you are unsure about the
path value, use `'/'`. If no path or domain is explicitly defined, the current location is assumed. `sameSite` defaults
to `Lax`.
**Important:** For security reasons, it is not possible to define cookies for other domains. Browsers do not allow this.
Read [this](https://stackoverflow.com/a/1063760) and [this](https://stackoverflow.com/a/17777005/1007003) StackOverflow
answer for a more in-depth explanation.
**Important:** Browsers do not accept cookies flagged sameSite = 'None' if secure flag isn't set as well. CookieService
will override the secure flag to true if sameSite='None'.
## delete( name: string, path?: string, domain?: string, secure?: boolean, sameSite: 'Lax' | 'None' | 'Strict' = 'Lax'): void;
```typescript
cookieService.delete('test');
```
Deletes a cookie with the specified `name`. It is best practice to always define a path. If you are unsure about the
path value, use `'/'`.
**Important:** For security reasons, it is not possible to delete cookies for other domains. Browsers do not allow this.
Read [this](https://stackoverflow.com/a/1063760) and [this](https://stackoverflow.com/a/17777005/1007003) StackOverflow
answer for a more in-depth explanation.
## deleteAll( path?: string, domain?: string, secure?: boolean, sameSite: 'Lax' | 'None' | 'Strict' = 'Lax' ): void;
```typescript
cookieService.deleteAll();
```
Deletes all cookies that can currently be accessed. It is best practice to always define a path. If you are unsure about
the path value, use `'/'`.
# FAQ
## General tips
Checking out the following resources usually solves most of the problems people seem to have with this cookie service:
- [article about cookies in general @MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) (recommended read!)
- [common localhost problems @StackOverflow](https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain)
- [problems with secure cookies @StackOverflow](https://stackoverflow.com/questions/8064318/how-to-read-a-secure-cookie-using-javascript)
- [how do browser cookie domains work? @StackOverflow](https://stackoverflow.com/questions/1062963/how-do-browser-cookie-domains-work)
- [get cookies from different paths](https://github.com/7leads/ngx-cookie-service/issues/7#issuecomment-351321518)
The following general steps are usually very helpful when debugging problems with this cookie service or cookies in
general:
- check out if there are any [open](https://github.com/stevermeister/ngx-cookie-service/issues)
or [closed](https://github.com/stevermeister/ngx-cookie-service/issues?q=is%3Aissue+is%3Aclosed) issues that answer
your question
- check out the actual value(s) of `document.cookie`
- does it work if you use `document.cookie` manually (i.e. in a console of your choice)?
- set explicit paths for your cookies
- [explain to your local rubber duck why your code should work and why it (probably) does not](https://en.wikipedia.org/wiki/Rubber_duck_debugging)
# I am always getting a "token missing" or "no provider" error.
Package managers are a well known source of frustration. If you have "token missing" or "no provider" errors, a simple
re-installation of your node modules might suffice:
```
rm -rf node_modules
yarn # or `npm install`
```
## I have a problem with framework X or library Y. What can I do?
Please be aware that we cannot help you with problems that are out of scope. For example, we cannot debug a Symfony or
Springboot application for you. In that case, you are better off asking the nice folks over
at [StackOverflow](https://stackoverflow.com/) for help.
## Do you support Angular Universal?
There is an [issue](https://github.com/7leads/ngx-cookie-service/issues/1) for that. Check
out [this comment](https://github.com/7leads/ngx-cookie-service/issues/1#issuecomment-361150174) for more information
about future support.
# Opening issues
Please make sure to check out our FAQ before you open a new issue. Also, try to give us as much information as you can
when you open an issue. Maybe you can even supply a test environment or test cases, if necessary?
# Contributing
We are happy to accept pull requests or test cases for things that do not work. Feel free to submit one of those.
However, we will only accept pull requests that pass all tests and include some new ones (as long as it makes sense to
add them, of course).
- [Open a new pull request](https://github.com/stevermeister/ngx-cookie-service/compare)
# Author
This cookie service is brought to you by [7leads GmbH](http://www.7leads.org/). We built it for one of our apps, because
the other cookie packages we found were either not designed "the Angular way" or caused trouble during AOT compilation.
# Contributors
Thanks to all contributors:
- [paroe](https://github.com/paroe)
- [CunningFatalist](https://github.com/CunningFatalist)
- [kthy](https://github.com/kthy)
- [JaredClemence](https://github.com/JaredClemence)
- [flakolefluk](https://github.com/flakolefluk)
- [mattbanks](https://github.com/mattbanks)
- [DBaker85](https://github.com/DBaker85)
- [mattlewis92](https://github.com/mattlewis92)
- [IceBreakerG](https://github.com/IceBreakerG)
- [rojedalopez](https://github.com/rojedalopez)
- [Nikel163](https://github.com/Nikel163)
- [pavankjadda](https://github.com/pavankjadda)
# License
[MIT](https://github.com/stevermeister/ngx-cookie-service/blob/master/LICENSE)

208
node_modules/ngx-cookie-service/esm2020/lib/cookie.service.mjs
File diff suppressed because it is too large
View File

5
node_modules/ngx-cookie-service/esm2020/ngx-cookie-service.mjs

@ -0,0 +1,5 @@
/**
* Generated bundle index. Do not edit.
*/
export * from './public-api';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWNvb2tpZS1zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vcHJvamVjdHMvbmd4LWNvb2tpZS1zZXJ2aWNlL3NyYy9uZ3gtY29va2llLXNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==

5
node_modules/ngx-cookie-service/esm2020/public-api.mjs

@ -0,0 +1,5 @@
/*
* Public API Surface of ngx-cookie-service
*/
export * from './lib/cookie.service';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1jb29raWUtc2VydmljZS9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsc0JBQXNCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIG5neC1jb29raWUtc2VydmljZVxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL2Nvb2tpZS5zZXJ2aWNlJztcbiJdfQ==

219
node_modules/ngx-cookie-service/fesm2015/ngx-cookie-service.mjs

@ -0,0 +1,219 @@
import * as i0 from '@angular/core';
import { PLATFORM_ID, Injectable, Inject } from '@angular/core';
import { isPlatformBrowser, DOCUMENT } from '@angular/common';
// This service is based on the `ng2-cookies` package which sadly is not a service and does
class CookieService {
constructor(document,
// Get the `PLATFORM_ID` so we can check if we're in a browser.
platformId) {
this.document = document;
this.platformId = platformId;
this.documentIsAccessible = isPlatformBrowser(this.platformId);
}
/**
* Get cookie Regular Expression
*
* @param name Cookie name
* @returns property RegExp
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
static getCookieRegExp(name) {
const escapedName = name.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi, '\\$1');
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
}
/**
* Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
*
* @param encodedURIComponent A value representing an encoded URI component.
*
* @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
static safeDecodeURIComponent(encodedURIComponent) {
try {
return decodeURIComponent(encodedURIComponent);
}
catch (_a) {
// probably it is not uri encoded. return as is
return encodedURIComponent;
}
}
/**
* Return `true` if {@link Document} is accessible, otherwise return `false`
*
* @param name Cookie name
* @returns boolean - whether cookie with specified name exists
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
check(name) {
if (!this.documentIsAccessible) {
return false;
}
name = encodeURIComponent(name);
const regExp = CookieService.getCookieRegExp(name);
return regExp.test(this.document.cookie);
}
/**
* Get cookies by name
*
* @param name Cookie name
* @returns property value
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
get(name) {
if (this.documentIsAccessible && this.check(name)) {
name = encodeURIComponent(name);
const regExp = CookieService.getCookieRegExp(name);
const result = regExp.exec(this.document.cookie);
return result[1] ? CookieService.safeDecodeURIComponent(result[1]) : '';
}
else {
return '';
}
}
/**
* Get all cookies in JSON format
*
* @returns all the cookies in json
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
getAll() {
if (!this.documentIsAccessible) {
return {};
}
const cookies = {};
const document = this.document;
if (document.cookie && document.cookie !== '') {
document.cookie.split(';').forEach((currentCookie) => {
const [cookieName, cookieValue] = currentCookie.split('=');
cookies[CookieService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = CookieService.safeDecodeURIComponent(cookieValue);
});
}
return cookies;
}
set(name, value, expiresOrOptions, path, domain, secure, sameSite) {
if (!this.documentIsAccessible) {
return;
}
if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {
const optionsBody = {
expires: expiresOrOptions,
path,
domain,
secure,
sameSite: sameSite ? sameSite : 'Lax',
};
this.set(name, value, optionsBody);
return;
}
let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
const options = expiresOrOptions ? expiresOrOptions : {};
if (options.expires) {
if (typeof options.expires === 'number') {
const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);
cookieString += 'expires=' + dateExpires.toUTCString() + ';';
}
else {
cookieString += 'expires=' + options.expires.toUTCString() + ';';
}
}
if (options.path) {
cookieString += 'path=' + options.path + ';';
}
if (options.domain) {
cookieString += 'domain=' + options.domain + ';';
}
if (options.secure === false && options.sameSite === 'None') {
options.secure = true;
console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +
`More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`);
}
if (options.secure) {
cookieString += 'secure;';
}
if (!options.sameSite) {
options.sameSite = 'Lax';
}
cookieString += 'sameSite=' + options.sameSite + ';';
this.document.cookie = cookieString;
}
/**
* Delete cookie by name
*
* @param name Cookie name
* @param path Cookie path
* @param domain Cookie domain
* @param secure Cookie secure flag
* @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
delete(name, path, domain, secure, sameSite = 'Lax') {
if (!this.documentIsAccessible) {
return;
}
const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');
this.set(name, '', { expires: expiresDate, path, domain, secure, sameSite });
}
/**
* Delete all cookies
*
* @param path Cookie path
* @param domain Cookie domain
* @param secure Is the Cookie secure
* @param sameSite Is the cookie same site
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
deleteAll(path, domain, secure, sameSite = 'Lax') {
if (!this.documentIsAccessible) {
return;
}
const cookies = this.getAll();
for (const cookieName in cookies) {
if (cookies.hasOwnProperty(cookieName)) {
this.delete(cookieName, path, domain, secure, sameSite);
}
}
}
}
CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CookieService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CookieService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], ctorParameters: function () {
return [{ type: Document, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [PLATFORM_ID]
}] }];
} });
/*
* Public API Surface of ngx-cookie-service
*/
/**
* Generated bundle index. Do not edit.
*/
export { CookieService };
//# sourceMappingURL=ngx-cookie-service.mjs.map

1
node_modules/ngx-cookie-service/fesm2015/ngx-cookie-service.mjs.map
File diff suppressed because it is too large
View File

217
node_modules/ngx-cookie-service/fesm2020/ngx-cookie-service.mjs

@ -0,0 +1,217 @@
import * as i0 from '@angular/core';
import { PLATFORM_ID, Injectable, Inject } from '@angular/core';
import { isPlatformBrowser, DOCUMENT } from '@angular/common';
// This service is based on the `ng2-cookies` package which sadly is not a service and does
class CookieService {
constructor(document,
// Get the `PLATFORM_ID` so we can check if we're in a browser.
platformId) {
this.document = document;
this.platformId = platformId;
this.documentIsAccessible = isPlatformBrowser(this.platformId);
}
/**
* Get cookie Regular Expression
*
* @param name Cookie name
* @returns property RegExp
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
static getCookieRegExp(name) {
const escapedName = name.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi, '\\$1');
return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
}
/**
* Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
*
* @param encodedURIComponent A value representing an encoded URI component.
*
* @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
static safeDecodeURIComponent(encodedURIComponent) {
try {
return decodeURIComponent(encodedURIComponent);
}
catch {
// probably it is not uri encoded. return as is
return encodedURIComponent;
}
}
/**
* Return `true` if {@link Document} is accessible, otherwise return `false`
*
* @param name Cookie name
* @returns boolean - whether cookie with specified name exists
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
check(name) {
if (!this.documentIsAccessible) {
return false;
}
name = encodeURIComponent(name);
const regExp = CookieService.getCookieRegExp(name);
return regExp.test(this.document.cookie);
}
/**
* Get cookies by name
*
* @param name Cookie name
* @returns property value
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
get(name) {
if (this.documentIsAccessible && this.check(name)) {
name = encodeURIComponent(name);
const regExp = CookieService.getCookieRegExp(name);
const result = regExp.exec(this.document.cookie);
return result[1] ? CookieService.safeDecodeURIComponent(result[1]) : '';
}
else {
return '';
}
}
/**
* Get all cookies in JSON format
*
* @returns all the cookies in json
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
getAll() {
if (!this.documentIsAccessible) {
return {};
}
const cookies = {};
const document = this.document;
if (document.cookie && document.cookie !== '') {
document.cookie.split(';').forEach((currentCookie) => {
const [cookieName, cookieValue] = currentCookie.split('=');
cookies[CookieService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = CookieService.safeDecodeURIComponent(cookieValue);
});
}
return cookies;
}
set(name, value, expiresOrOptions, path, domain, secure, sameSite) {
if (!this.documentIsAccessible) {
return;
}
if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {
const optionsBody = {
expires: expiresOrOptions,
path,
domain,
secure,
sameSite: sameSite ? sameSite : 'Lax',
};
this.set(name, value, optionsBody);
return;
}
let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
const options = expiresOrOptions ? expiresOrOptions : {};
if (options.expires) {
if (typeof options.expires === 'number') {
const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);
cookieString += 'expires=' + dateExpires.toUTCString() + ';';
}
else {
cookieString += 'expires=' + options.expires.toUTCString() + ';';
}
}
if (options.path) {
cookieString += 'path=' + options.path + ';';
}
if (options.domain) {
cookieString += 'domain=' + options.domain + ';';
}
if (options.secure === false && options.sameSite === 'None') {
options.secure = true;
console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` +
`More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`);
}
if (options.secure) {
cookieString += 'secure;';
}
if (!options.sameSite) {
options.sameSite = 'Lax';
}
cookieString += 'sameSite=' + options.sameSite + ';';
this.document.cookie = cookieString;
}
/**
* Delete cookie by name
*
* @param name Cookie name
* @param path Cookie path
* @param domain Cookie domain
* @param secure Cookie secure flag
* @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
delete(name, path, domain, secure, sameSite = 'Lax') {
if (!this.documentIsAccessible) {
return;
}
const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');
this.set(name, '', { expires: expiresDate, path, domain, secure, sameSite });
}
/**
* Delete all cookies
*
* @param path Cookie path
* @param domain Cookie domain
* @param secure Is the Cookie secure
* @param sameSite Is the cookie same site
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
deleteAll(path, domain, secure, sameSite = 'Lax') {
if (!this.documentIsAccessible) {
return;
}
const cookies = this.getAll();
for (const cookieName in cookies) {
if (cookies.hasOwnProperty(cookieName)) {
this.delete(cookieName, path, domain, secure, sameSite);
}
}
}
}
CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CookieService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: CookieService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}], ctorParameters: function () { return [{ type: Document, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }, { type: undefined, decorators: [{
type: Inject,
args: [PLATFORM_ID]
}] }]; } });
/*
* Public API Surface of ngx-cookie-service
*/
/**
* Generated bundle index. Do not edit.
*/
export { CookieService };
//# sourceMappingURL=ngx-cookie-service.mjs.map

1
node_modules/ngx-cookie-service/fesm2020/ngx-cookie-service.mjs.map
File diff suppressed because it is too large
View File

127
node_modules/ngx-cookie-service/lib/cookie.service.d.ts

@ -0,0 +1,127 @@
import * as i0 from "@angular/core";
export declare class CookieService {
private document;
private platformId;
private readonly documentIsAccessible;
constructor(document: Document, platformId: any);
/**
* Get cookie Regular Expression
*
* @param name Cookie name
* @returns property RegExp
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
private static getCookieRegExp;
/**
* Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
*
* @param encodedURIComponent A value representing an encoded URI component.
*
* @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
private static safeDecodeURIComponent;
/**
* Return `true` if {@link Document} is accessible, otherwise return `false`
*
* @param name Cookie name
* @returns boolean - whether cookie with specified name exists
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
check(name: string): boolean;
/**
* Get cookies by name
*
* @param name Cookie name
* @returns property value
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
get(name: string): string;
/**
* Get all cookies in JSON format
*
* @returns all the cookies in json
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
getAll(): {
[key: string]: string;
};
/**
* Set cookie based on provided information
*
* @param name Cookie name
* @param value Cookie value
* @param expires Number of days until the cookies expires or an actual `Date`
* @param path Cookie path
* @param domain Cookie domain
* @param secure Secure flag
* @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
set(name: string, value: string, expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'None' | 'Strict'): void;
/**
* Set cookie based on provided information
*
* Cookie's parameters:
* <pre>
* expires Number of days until the cookies expires or an actual `Date`
* path Cookie path
* domain Cookie domain
* secure Secure flag
* sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax`
* </pre>
*
* @param name Cookie name
* @param value Cookie value
* @param options Body with cookie's params
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
set(name: string, value: string, options?: {
expires?: number | Date;
path?: string;
domain?: string;
secure?: boolean;
sameSite?: 'Lax' | 'None' | 'Strict';
}): void;
/**
* Delete cookie by name
*
* @param name Cookie name
* @param path Cookie path
* @param domain Cookie domain
* @param secure Cookie secure flag
* @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
delete(name: string, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'None' | 'Strict'): void;
/**
* Delete all cookies
*
* @param path Cookie path
* @param domain Cookie domain
* @param secure Is the Cookie secure
* @param sameSite Is the cookie same site
*
* @author: Stepan Suvorov
* @since: 1.0.0
*/
deleteAll(path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'None' | 'Strict'): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CookieService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CookieService>;
}

5
node_modules/ngx-cookie-service/ngx-cookie-service.d.ts

@ -0,0 +1,5 @@
/**
* Generated bundle index. Do not edit.
*/
/// <amd-module name="ngx-cookie-service" />
export * from './public-api';

144
node_modules/ngx-cookie-service/package.json

@ -0,0 +1,144 @@
{
"_from": "ngx-cookie-service",
"_id": "ngx-cookie-service@13.1.2",
"_inBundle": false,
"_integrity": "sha512-CInzm1xjI51QA1gCJEnqfDFLnN7w/SzqM5+kGdpI+UiCeHKgYEXpKG1s7lFz4jbLDrL/jHKtrf92t7RGsm66Cg==",
"_location": "/ngx-cookie-service",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "ngx-cookie-service",
"name": "ngx-cookie-service",
"escapedName": "ngx-cookie-service",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/ngx-cookie-service/-/ngx-cookie-service-13.1.2.tgz",
"_shasum": "31dbd523e16765649661e36cb436d8f19bd9ea4b",
"_spec": "ngx-cookie-service",
"_where": "/Users/satish.ganga/Desktop/EKAM/ekamv3/skgangaEkam",
"author": {
"name": "Stepan Suvorov",
"email": "stevermeister@gmail.com"
},
"bugs": {
"url": "https://github.com/stevermeister/ngx-cookie-service/issues",
"email": "stepan@studytube.nl"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Pavan Kumar Jadda"
},
{
"name": "Christopher Parotat",
"email": "c.parotat@7leads.org"
},
{
"name": "Stefan Bauer",
"email": "bauer.stefan@live.de"
},
{
"name": "Kristian Thy",
"email": "thy@42.dk"
},
{
"name": "Jared Clemence"
},
{
"name": "flakolefluk"
},
{
"name": "mattbanks"
},
{
"name": "DBaker85"
},
{
"name": "Matt Lewis",
"email": "npm@mattlewis.me"
},
{
"name": "IceBreakerG"
}
],
"dependencies": {
"tslib": "^2.0.0"
},
"deprecated": false,
"description": "Angular cookie service",
"es2020": "fesm2020/ngx-cookie-service.mjs",
"esm2020": "esm2020/ngx-cookie-service.mjs",
"exports": {
"./package.json": {
"default": "./package.json"
},
".": {
"types": "./ngx-cookie-service.d.ts",
"esm2020": "./esm2020/ngx-cookie-service.mjs",
"es2020": "./fesm2020/ngx-cookie-service.mjs",
"es2015": "./fesm2015/ngx-cookie-service.mjs",
"node": "./fesm2015/ngx-cookie-service.mjs",
"default": "./fesm2020/ngx-cookie-service.mjs"
}
},
"fesm2015": "fesm2015/ngx-cookie-service.mjs",
"fesm2020": "fesm2020/ngx-cookie-service.mjs",
"homepage": "https://github.com/stevermeister/ngx-cookie-service#readme",
"keywords": [
"angular",
"angular2",
"angular4",
"angular5",
"angular-2",
"angular-4",
"angular-5",
"angular-6",
"angular-7",
"angular-8",
"angular-9",
"angular-10",
"angular-11",
"angular-12",
"angular-13",
"ivy",
"ivy-compatible",
"ivy-compilation",
"ngx",
"ng2",
"ng",
"service",
"angular-service",
"cookie-service",
"cookie",
"cookies"
],
"license": "MIT",
"module": "fesm2015/ngx-cookie-service.mjs",
"name": "ngx-cookie-service",
"peerDependencies": {
"@angular/common": "^13.0.0",
"@angular/core": "^13.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/stevermeister/ngx-cookie-service.git"
},
"resolve": {
"fallback": {
"path": false,
"http": false,
"stream": false,
"util": false
}
},
"sideEffects": false,
"typings": "ngx-cookie-service.d.ts",
"version": "13.1.2"
}

1
node_modules/ngx-cookie-service/public-api.d.ts

@ -0,0 +1 @@
export * from './lib/cookie.service';

8
package-lock.json

@ -7531,6 +7531,14 @@
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
}, },
"ngx-cookie-service": {
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/ngx-cookie-service/-/ngx-cookie-service-13.1.2.tgz",
"integrity": "sha512-CInzm1xjI51QA1gCJEnqfDFLnN7w/SzqM5+kGdpI+UiCeHKgYEXpKG1s7lFz4jbLDrL/jHKtrf92t7RGsm66Cg==",
"requires": {
"tslib": "^2.0.0"
}
},
"nice-napi": { "nice-napi": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz", "resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz",

1
package.json

@ -23,6 +23,7 @@
"bootstrap": "^5.1.3", "bootstrap": "^5.1.3",
"html-to-pdfmake": "^2.3.9", "html-to-pdfmake": "^2.3.9",
"jspdf": "^2.5.1", "jspdf": "^2.5.1",
"ngx-cookie-service": "^13.1.2",
"pdfmake": "^0.2.4", "pdfmake": "^0.2.4",
"primeicons": "^5.0.0", "primeicons": "^5.0.0",
"primeng": "^13.1.0", "primeng": "^13.1.0",

4
src/app/annual-health-checkup/annual-health-checkup.component.ts

@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import {MatSnackBar, MatSnackBarHorizontalPosition, import {MatSnackBar, MatSnackBarHorizontalPosition,
MatSnackBarVerticalPosition,} from '@angular/material/snack-bar'; MatSnackBarVerticalPosition,} from '@angular/material/snack-bar';
import { GenerateLetterService } from './generate-letter/generate-letter.service';
@Component({ @Component({
selector: 'app-annual-health-checkup', selector: 'app-annual-health-checkup',
@ -12,11 +13,12 @@ export class AnnualHealthCheckupComponent implements OnInit {
horizontalPosition: MatSnackBarHorizontalPosition = 'center'; horizontalPosition: MatSnackBarHorizontalPosition = 'center';
verticalPosition: MatSnackBarVerticalPosition = 'bottom'; verticalPosition: MatSnackBarVerticalPosition = 'bottom';
constructor(private router:Router, private _snackBar: MatSnackBar) {
constructor(private router:Router, private _snackBar: MatSnackBar, private generateLetterService:GenerateLetterService) {
} }
ngOnInit(): void { ngOnInit(): void {
this.generateLetterService.getUserDetailsFromCookies();
this._snackBar.open('Employees who have attained the age of 40 years by 1st April 2022 will be covered under the Annual Health Check-up.', '',{ this._snackBar.open('Employees who have attained the age of 40 years by 1st April 2022 will be covered under the Annual Health Check-up.', '',{
horizontalPosition: this.horizontalPosition, horizontalPosition: this.horizontalPosition,
verticalPosition: this.verticalPosition, verticalPosition: this.verticalPosition,

6
src/app/annual-health-checkup/generate-letter/generate-letter.component.ts

@ -1,6 +1,7 @@
import { Component, ElementRef, OnInit, ViewChild } from "@angular/core"; import { Component, ElementRef, OnInit, ViewChild } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { jsPDF } from "jspdf"; import { jsPDF } from "jspdf";
import { CookieService } from "ngx-cookie-service";
import * as pdfMake from "pdfmake/build/pdfmake"; import * as pdfMake from "pdfmake/build/pdfmake";
import { GenerateLetterService } from "./generate-letter.service"; import { GenerateLetterService } from "./generate-letter.service";
@ -43,10 +44,12 @@ export class GenerateLetterComponent implements OnInit {
date:null, date:null,
gender:null gender:null
}; };
userDetailsObject:any = {};
constructor( constructor(
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private generateLetterService: GenerateLetterService
private generateLetterService: GenerateLetterService,
private cookieService: CookieService
) { ) {
this.createNewForm(); this.createNewForm();
} }
@ -79,6 +82,7 @@ export class GenerateLetterComponent implements OnInit {
} }
} }
); );
this.userDetailsObject = this.generateLetterService.getUserObject();
this.initiateControls(); this.initiateControls();
} }

29
src/app/annual-health-checkup/generate-letter/generate-letter.service.ts

@ -3,13 +3,40 @@ import { Injectable } from '@angular/core';
import { handleError } from '../../shared/utilities/utils'; import { handleError } from '../../shared/utilities/utils';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
import { USER_DETAILS_API } from 'src/constants/apiConstants'; import { USER_DETAILS_API } from 'src/constants/apiConstants';
import { CookieService } from 'ngx-cookie-service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class GenerateLetterService { export class GenerateLetterService {
constructor(private http: HttpClient) {
userInfo={
empId : '',
gender :'',
location : '',
department :'',
grade : '',
displayName : '',
userMobile : '',
mailId : ''
};
constructor(private http: HttpClient, private cookieService: CookieService) {
}
getUserDetailsFromCookies(){
this.userInfo.empId = this.cookieService.get('empId');
this.userInfo.gender = this.cookieService.get('Gender');
this.userInfo.location = this.cookieService.get('empLocationText');
this.userInfo.department = this.cookieService.get('department');
this.userInfo.grade = this.cookieService.get('_ga');
this.userInfo.displayName = this.cookieService.get('displayName');
this.userInfo.userMobile = this.cookieService.get('userMobile');
this.userInfo.mailId = this.cookieService.get('mailId');
}
getUserObject(){
return this.userInfo;
} }
getUserDetails(body: any) { getUserDetails(body: any) {

4
src/app/app.module.ts

@ -78,6 +78,8 @@ import { GenerateLetterService } from './annual-health-checkup/generate-letter/g
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { TokenInterceptor } from './shared/helpers/token.interceptor'; import { TokenInterceptor } from './shared/helpers/token.interceptor';
import { ScheduleAppointmentService } from './annual-health-checkup/schedule-appointment/schedule-appointment.service'; import { ScheduleAppointmentService } from './annual-health-checkup/schedule-appointment/schedule-appointment.service';
import { CookieService } from 'ngx-cookie-service';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
@ -157,7 +159,7 @@ import { ScheduleAppointmentService } from './annual-health-checkup/schedule-app
ScrollingModule, ScrollingModule,
HttpClientModule HttpClientModule
], ],
providers: [FooterService, RouterService, SelectedScreenService, TranslationContentService, GenerateLetterService, ScheduleAppointmentService,{
providers: [FooterService, RouterService, SelectedScreenService, TranslationContentService, GenerateLetterService, ScheduleAppointmentService, CookieService, {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor, useClass: TokenInterceptor,
multi: true, multi: true,

Loading…
Cancel
Save