import Base from './base'; import type CookiesService from 'ember-cookies/services/cookies'; import type CookieStore from './cookie'; import type LocalStorageStore from './local-storage'; /** Session store that persists data in the browser's `localStorage` (see {@linkplain LocalStorageStore}) if that is available or in a cookie (see {@linkplain CookieStore}) if it is not. __This is the default store that Ember Simple Auth will use when the application doesn't define a custom store.__ __This session store does not work with FastBoot. In order to use Ember Simple Auth with FastBoot, configure the {@linkplain CookieStore} as the application's session store.__ @class AdaptiveStore @extends BaseStore @public */ export default class AdaptiveStore extends Base { /** The `localStorage` key the store persists data in if `localStorage` is available. @memberof AdaptiveStore @property localStorageKey @type String @default 'ember_simple_auth-session' @public */ localStorageKey: string; /** The domain to use for the cookie if `localStorage` is not available, e.g., "example.com", ".example.com" (which includes all subdomains) or "subdomain.example.com". If not explicitly set, the cookie domain defaults to the domain the session was authenticated on. @memberof AdaptiveStore @property cookieDomain @type String @default null @public */ _cookieDomain: null; cookieDomain: null | string; /** Allows servers to assert that a cookie ought not to be sent along with cross-site requests, which provides some protection against cross-site request forgery attacks (CSRF). Available options: - "Strict" - "Lax" @memberof AdaptiveStore @property sameSite @type String @default null @public */ _sameSite: null; sameSite: null | 'Strict' | 'Lax' | 'None'; /** Allows servers to assert that a cookie should opt in to partitioned storage, i.e. use a separate cookie per top level site if the cookie is used in a third party context Available options: - null - true @memberof AdaptiveStore @property partitioned @type Boolean @default null @public */ _partitioned: null; partitioned: null | boolean; /** The name of the cookie to use if `localStorage` is not available. @memberof AdaptiveStore @property cookieName @type String @default ember_simple_auth-session @public */ _cookieName: string; cookieName: string; /** The path to use for the cookie, e.g., "/", "/something". @memberof AdaptiveStore @property cookiePath @type String @default '/' @public */ _cookiePath: string; cookiePath: string; /** The expiration time for the cookie in seconds if `localStorage` is not available. A value of `null` will make the cookie a session cookie that expires and gets deleted when the browser is closed. @memberof AdaptiveStore @property cookieExpirationTime @default null @type Integer @public */ _cookieExpirationTime: null; cookieExpirationTime: number | null; _cookies: CookiesService; _fastboot: any; _store: CookieStore | LocalStorageStore; __isLocalStorageAvailable: boolean | null; get _isLocalStorageAvailable(): boolean; init(emberOwner: any, __isLocalStorageAvailable?: boolean | null): void; _setupStoreEvents(store: CookieStore | LocalStorageStore): CookieStore | LocalStorageStore; /** Persists the `data` in the `localStorage` if it is available or in a cookie if it is not. @memberof AdaptiveStore @method persist @param {Object} data The data to persist @return {Promise} A promise that resolves when the data has successfully been persisted and rejects otherwise. @public */ persist(data: Record): Promise; /** Returns all data currently stored in the `localStorage` if that is available - or if it is not, in the cookie - as a plain object. @memberof AdaptiveStore @method restore @return {Promise} A promise that resolves with the data currently persisted in the store when the data has been restored successfully and rejects otherwise. @public */ restore(): Promise; /** Clears the store by deleting the {@linkplain LocalStorageStore.key} from `localStorage` if that is available or by deleting the cookie if it is not. @memberof AdaptiveStore @method clear @return {Promise} A promise that resolves when the store has been cleared successfully and rejects otherwise. @public */ clear(): Promise; setRedirectTarget(url: string): void; getRedirectTarget(): string | null; clearRedirectTarget(): void; }