1 | import * as i0 from "@angular/core";
|
2 | export type SameSite = 'Lax' | 'None' | 'Strict';
|
3 | export interface CookieOptions {
|
4 | expires?: number | Date;
|
5 | path?: string;
|
6 | domain?: string;
|
7 | secure?: boolean;
|
8 | sameSite?: SameSite;
|
9 | partitioned?: boolean;
|
10 | }
|
11 | export declare class CookieService {
|
12 | private document;
|
13 | private platformId;
|
14 | private readonly documentIsAccessible;
|
15 | constructor(document: Document, platformId: any);
|
16 | /**
|
17 | * Get cookie Regular Expression
|
18 | *
|
19 | * @param name Cookie name
|
20 | * @returns property RegExp
|
21 | *
|
22 | * @author: Stepan Suvorov
|
23 | * @since: 1.0.0
|
24 | */
|
25 | private static getCookieRegExp;
|
26 | /**
|
27 | * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
28 | *
|
29 | * @param encodedURIComponent A value representing an encoded URI component.
|
30 | *
|
31 | * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).
|
32 | *
|
33 | * @author: Stepan Suvorov
|
34 | * @since: 1.0.0
|
35 | */
|
36 | private static safeDecodeURIComponent;
|
37 | /**
|
38 | * Return `true` if {return `false`
Document} is accessible, otherwise |
39 | *
|
40 | * name Cookie name
|
41 | * boolean - whether cookie with specified name exists
|
42 | *
|
43 | * : Stepan Suvorov
|
44 | * 1.0.0
: |
45 | */
|
46 | check(name: string): boolean;
|
47 | /**
|
48 | * Get cookies by name
|
49 | *
|
50 | * @param name Cookie name
|
51 | * @returns property value
|
52 | *
|
53 | * @author: Stepan Suvorov
|
54 | * @since: 1.0.0
|
55 | */
|
56 | get(name: string): string;
|
57 | /**
|
58 | * Get all cookies in JSON format
|
59 | *
|
60 | * @returns all the cookies in json
|
61 | *
|
62 | * @author: Stepan Suvorov
|
63 | * @since: 1.0.0
|
64 | */
|
65 | getAll(): {
|
66 | [key: string]: string;
|
67 | };
|
68 | /**
|
69 | * Set cookie based on provided information
|
70 | *
|
71 | * @param name Cookie name
|
72 | * @param value Cookie value
|
73 | * @param expires Number of days until the cookies expires or an actual `Date`
|
74 | * @param path Cookie path
|
75 | * @param domain Cookie domain
|
76 | * @param secure Secure flag
|
77 | * @param partitioned Partitioned flag
|
78 | * @param sameSite OWASP same site token `Lax`, `None`, or `Strict`. Defaults to `Lax`
|
79 | *
|
80 | * @author: Stepan Suvorov
|
81 | * @since: 1.0.0
|
82 | */
|
83 | set(name: string, value: string, expires?: CookieOptions['expires'], path?: CookieOptions['path'], domain?: CookieOptions['domain'], secure?: CookieOptions['secure'], sameSite?: SameSite, partitioned?: CookieOptions['partitioned']): void;
|
84 | /**
|
85 | * Set cookie based on provided information
|
86 | *
|
87 | * Cookie's parameters:
|
88 | * <pre>
|
89 | * expires Number of days until the cookies expires or an actual `Date`
|
90 | * path Cookie path
|
91 | * domain Cookie domain
|
92 | * secure flag
|
93 | * sameSite OWASP same site token `Lax`, `None`, or `Strict`. Defaults to `Lax`
|
94 | * </pre>
|
95 | *
|
96 | * @param name Cookie name
|
97 | * @param value Cookie value
|
98 | * @param options Body with cookie's params
|
99 | *
|
100 | * @author: Stepan Suvorov
|
101 | * @since: 1.0.0
|
102 | */
|
103 | set(name: string, value: string, options?: CookieOptions): void;
|
104 | /**
|
105 | * Delete cookie by name
|
106 | *
|
107 | * @param name Cookie name
|
108 | * @param path Cookie path
|
109 | * @param domain Cookie domain
|
110 | * @param secure Cookie secure flag
|
111 | * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
112 | *
|
113 | * @author: Stepan Suvorov
|
114 | * @since: 1.0.0
|
115 | */
|
116 | delete(name: string, path?: CookieOptions['path'], domain?: CookieOptions['domain'], secure?: CookieOptions['secure'], sameSite?: SameSite): void;
|
117 | /**
|
118 | * Delete all cookies
|
119 | *
|
120 | * @param path Cookie path
|
121 | * @param domain Cookie domain
|
122 | * @param secure Is the Cookie secure
|
123 | * @param sameSite Is the cookie same site
|
124 | *
|
125 | * @author: Stepan Suvorov
|
126 | * @since: 1.0.0
|
127 | */
|
128 | deleteAll(path?: CookieOptions['path'], domain?: CookieOptions['domain'], secure?: CookieOptions['secure'], sameSite?: SameSite): void;
|
129 | static ɵfac: i0.ɵɵFactoryDeclaration<CookieService, never>;
|
130 | static ɵprov: i0.ɵɵInjectableDeclaration<CookieService>;
|
131 | }
|
132 | //# sourceMappingURL=cookie.service.d.ts.map |
\ | No newline at end of file |