@tramvai/module-cookie 1.70.0 → 1.70.2

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.
package/lib/browser.js CHANGED
@@ -53,12 +53,13 @@ class CookiesFallback {
53
53
  }
54
54
  }
55
55
  class CookieManager {
56
- constructor() {
56
+ constructor({ cookieOptions = {} } = {}) {
57
57
  const isSecure = window.location.protocol === 'https:';
58
58
  this.cookies = checkCookieEnabled()
59
59
  ? new Cookies({
60
60
  sameSite: isSecure ? 'none' : 'lax',
61
61
  secure: isSecure,
62
+ ...cookieOptions,
62
63
  })
63
64
  : new CookiesFallback();
64
65
  }
@@ -98,6 +99,15 @@ CookieModule = __decorate([
98
99
  provide: COOKIE_MANAGER_TOKEN,
99
100
  useClass: CookieManager,
100
101
  scope: Scope.SINGLETON,
102
+ deps: {
103
+ // cookieOptions позволяет переопределить SameSite=Lax на None для фикса проблем с iframe
104
+ // TODO после успешного тестирования в приложении paymentsext, убрать прокидывание cookieOptions
105
+ // и установить SameSite=None по умолчанию
106
+ cookieOptions: {
107
+ token: 'temporary cookieOptions',
108
+ optional: true,
109
+ },
110
+ },
101
111
  },
102
112
  ],
103
113
  })
@@ -2,7 +2,9 @@ import type { CookieOptions } from '@tinkoff/browser-cookies';
2
2
  import type { CookieManager as Interface, CookieSetOptions } from './tokens';
3
3
  export declare class CookieManager implements Interface {
4
4
  private cookies;
5
- constructor();
5
+ constructor({ cookieOptions }?: {
6
+ cookieOptions?: CookieOptions;
7
+ });
6
8
  get(name: string): string;
7
9
  set({ name, value, noSubdomains, ...options }: CookieSetOptions): void;
8
10
  all(): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-cookie",
3
- "version": "1.70.0",
3
+ "version": "1.70.2",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@tinkoff/utils": "^2.1.2",
27
- "@tramvai/core": "1.70.0",
28
- "@tramvai/state": "1.70.0",
29
- "@tramvai/tokens-common": "1.70.0",
27
+ "@tramvai/core": "1.70.2",
28
+ "@tramvai/state": "1.70.2",
29
+ "@tramvai/tokens-common": "1.70.2",
30
30
  "@tinkoff/dippy": "0.7.38",
31
31
  "tslib": "^2.0.3"
32
32
  },