@tma.js/sdk 3.0.8 → 3.1.0

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.
Files changed (42) hide show
  1. package/dist/dts/composables/Button.d.ts +3 -3
  2. package/dist/dts/errors.d.ts +10 -0
  3. package/dist/dts/features/BackButton/BackButton.d.ts +1 -1
  4. package/dist/dts/features/Biometry/Biometry.d.ts +2 -2
  5. package/dist/dts/features/Biometry/types.d.ts +5 -5
  6. package/dist/dts/features/ClosingBehavior/ClosingBehavior.d.ts +4 -4
  7. package/dist/dts/features/CloudStorage/CloudStorage.d.ts +4 -4
  8. package/dist/dts/features/DeviceStorage/DeviceStorage.d.ts +53 -0
  9. package/dist/dts/features/DeviceStorage/exports.d.ts +2 -0
  10. package/dist/dts/features/DeviceStorage/instance.d.ts +2 -0
  11. package/dist/dts/features/HapticFeedback/HapticFeedback.d.ts +3 -3
  12. package/dist/dts/features/Invoice/Invoice.d.ts +5 -5
  13. package/dist/dts/features/LocationManager/LocationManager.d.ts +3 -3
  14. package/dist/dts/features/LocationManager/types.d.ts +3 -3
  15. package/dist/dts/features/MainButton/MainButton.d.ts +2 -2
  16. package/dist/dts/features/MiniApp/MiniApp.d.ts +5 -5
  17. package/dist/dts/features/Popup/Popup.d.ts +4 -4
  18. package/dist/dts/features/QrScanner/QrScanner.d.ts +4 -4
  19. package/dist/dts/features/SecondaryButton/SecondaryButton.d.ts +2 -2
  20. package/dist/dts/features/SecureStorage/SecureStorage.d.ts +68 -0
  21. package/dist/dts/features/SecureStorage/exports.d.ts +2 -0
  22. package/dist/dts/features/SecureStorage/instance.d.ts +2 -0
  23. package/dist/dts/features/SettingsButton/SettingsButton.d.ts +1 -1
  24. package/dist/dts/features/ThemeParams/ThemeParams.d.ts +3 -3
  25. package/dist/dts/features/Viewport/Viewport.d.ts +6 -6
  26. package/dist/dts/features/emoji-status/setEmojiStatus.d.ts +1 -1
  27. package/dist/dts/features/privacy/requestContact.d.ts +1 -1
  28. package/dist/dts/features/uncategorized/getCurrentTime.d.ts +1 -1
  29. package/dist/dts/fn-options/withCreateRequestId.d.ts +7 -0
  30. package/dist/dts/fn-options/withRequest.d.ts +2 -2
  31. package/dist/dts/globals/request.d.ts +11 -1
  32. package/dist/dts/index.d.ts +4 -2
  33. package/dist/dts/with-checks/withChecksFp.d.ts +1 -1
  34. package/dist/index.cjs +1 -1
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.iife.js +3 -3
  37. package/dist/index.iife.js.map +1 -1
  38. package/dist/index.js +1657 -1482
  39. package/dist/index.js.map +1 -1
  40. package/package.json +4 -4
  41. /package/dist/dts/globals/{inline-mode.d.ts → isInlineMode.d.ts} +0 -0
  42. /package/dist/dts/globals/{post-event.d.ts → postEvent.d.ts} +0 -0
@@ -1,10 +1,10 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { PostEventError, MethodName, MethodParams } from '@tma.js/bridge';
3
- import { WithChecksFp, WithChecks } from '../with-checks/withChecksFp.js';
2
+ import { Computed } from '@tma.js/signals';
4
3
  import { SharedFeatureOptions } from '../fn-options/sharedFeatureOptions.js';
5
- import { WithStateRestore } from '../fn-options/withStateRestore.js';
6
4
  import { WithPostEvent } from '../fn-options/withPostEvent.js';
5
+ import { WithStateRestore } from '../fn-options/withStateRestore.js';
7
6
  import { WithVersion } from '../fn-options/withVersion.js';
7
+ import { WithChecksFp, WithChecks } from '../with-checks/withChecksFp.js';
8
8
  import * as E from 'fp-ts/Either';
9
9
  type ButtonEither = E.Either<PostEventError, void>;
10
10
  type BoolFields<S> = {
@@ -8,6 +8,16 @@ export declare class ValidationError extends ValidationError_base {
8
8
  declare const CSSVarsBoundError_base: import('error-kid').ErrorClass<[]>;
9
9
  export declare class CSSVarsBoundError extends CSSVarsBoundError_base {
10
10
  }
11
+ declare const DeviceStorageMethodError_base: import('error-kid').ErrorClassWithData<[error: string], {
12
+ error: string;
13
+ }>;
14
+ export declare class DeviceStorageMethodError extends DeviceStorageMethodError_base {
15
+ }
16
+ declare const SecureStorageMethodError_base: import('error-kid').ErrorClassWithData<[error: string], {
17
+ error: string;
18
+ }>;
19
+ export declare class SecureStorageMethodError extends SecureStorageMethodError_base {
20
+ }
11
21
  declare const NotAvailableError_base: import('error-kid').ErrorClass<[message: string]>;
12
22
  export declare class NotAvailableError extends NotAvailableError_base {
13
23
  }
@@ -1,5 +1,5 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { PostEventError } from '@tma.js/bridge';
2
+ import { Computed } from '@tma.js/signals';
3
3
  import { ButtonOptions } from '../../composables/Button.js';
4
4
  import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
5
5
  import * as E from 'fp-ts/Either';
@@ -1,9 +1,9 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { RequestError, PostEventError, BiometryAuthRequestStatus, BiometryTokenUpdateStatus } from '@tma.js/bridge';
2
+ import { Computed } from '@tma.js/signals';
3
3
  import { BetterPromise } from 'better-promises';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
4
  import { BiometryAuthenticateOptions, BiometryOptions, BiometryRequestAccessOptions, BiometryState, BiometryUpdateTokenOptions } from './types.js';
6
5
  import { AsyncOptions } from '../../types.js';
6
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
7
7
  import * as E from 'fp-ts/Either';
8
8
  import * as TE from 'fp-ts/TaskEither';
9
9
  type BiometryTask<T> = TE.TaskEither<RequestError, T>;
@@ -1,11 +1,11 @@
1
1
  import { BiometryType, EventListener } from '@tma.js/bridge';
2
2
  import { Maybe } from '@tma.js/toolkit';
3
- import { AsyncOptions } from '../../types.js';
4
- import { WithVersion } from '../../fn-options/withVersion.js';
5
- import { WithStateRestore } from '../../fn-options/withStateRestore.js';
6
- import { WithRequest } from '../../fn-options/withRequest.js';
7
- import { WithPostEvent } from '../../fn-options/withPostEvent.js';
8
3
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
4
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
5
+ import { WithRequest } from '../../fn-options/withRequest.js';
6
+ import { WithStateRestore } from '../../fn-options/withStateRestore.js';
7
+ import { WithVersion } from '../../fn-options/withVersion.js';
8
+ import { AsyncOptions } from '../../types.js';
9
9
  export interface BiometryState {
10
10
  /**
11
11
  * If true, indicates that biometric authentication is available on the current device.
@@ -1,9 +1,9 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { PostEventError } from '@tma.js/bridge';
3
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
4
- import { WithStateRestore } from '../../fn-options/withStateRestore.js';
5
- import { WithPostEvent } from '../../fn-options/withPostEvent.js';
2
+ import { Computed } from '@tma.js/signals';
6
3
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
4
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
5
+ import { WithStateRestore } from '../../fn-options/withStateRestore.js';
6
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
7
7
  import * as E from 'fp-ts/Either';
8
8
  export interface ClosingBehaviorState {
9
9
  isConfirmationEnabled: boolean;
@@ -1,10 +1,10 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { InvokeCustomMethodFpOptions, RequestError } from '@tma.js/bridge';
2
+ import { Computed } from '@tma.js/signals';
3
3
  import { BetterPromise } from 'better-promises';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
- import { WithVersion } from '../../fn-options/withVersion.js';
6
- import { WithInvokeCustomMethod } from '../../fn-options/withInvokeCustomMethod.js';
7
4
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
5
+ import { WithInvokeCustomMethod } from '../../fn-options/withInvokeCustomMethod.js';
6
+ import { WithVersion } from '../../fn-options/withVersion.js';
7
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
8
8
  import * as TE from 'fp-ts/TaskEither';
9
9
  type CloudStorageTask<T> = TE.TaskEither<RequestError, T>;
10
10
  export interface CloudStorageOptions extends WithVersion, WithInvokeCustomMethod, SharedFeatureOptions {
@@ -0,0 +1,53 @@
1
+ import { RequestError } from '@tma.js/bridge';
2
+ import { DeviceStorageMethodError } from '../../errors.js';
3
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
4
+ import { WithCreateRequestId } from '../../fn-options/withCreateRequestId.js';
5
+ import { WithRequest } from '../../fn-options/withRequest.js';
6
+ import { WithVersion } from '../../fn-options/withVersion.js';
7
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
8
+ import * as TE from 'fp-ts/TaskEither';
9
+ export type DeviceStorageError = RequestError | DeviceStorageMethodError;
10
+ export interface DeviceStorageOptions extends SharedFeatureOptions, WithVersion, WithRequest, WithCreateRequestId {
11
+ }
12
+ /**
13
+ * @since Mini Apps v9.0
14
+ */
15
+ export declare class DeviceStorage {
16
+ constructor({ isTma, request, version, createRequestId }: DeviceStorageOptions);
17
+ /**
18
+ * Retrieves an item using its key.
19
+ * @since Mini Apps v9.0
20
+ */
21
+ readonly getItemFp: WithChecksFp<(key: string) => TE.TaskEither<DeviceStorageError, string | null>, true>;
22
+ /**
23
+ * @see getItemFp
24
+ */
25
+ readonly getItem: WithChecks<(key: string) => Promise<string | null>, true>;
26
+ /**
27
+ * Sets a new item in the storage.
28
+ * @since Mini Apps v9.0
29
+ */
30
+ readonly setItemFp: WithChecksFp<(key: string, value: string | null) => TE.TaskEither<DeviceStorageError, void>, true>;
31
+ /**
32
+ * @see setItemFp
33
+ */
34
+ readonly setItem: WithChecks<(key: string, value: string | null) => Promise<void>, true>;
35
+ /**
36
+ * Removes a key from the storage.
37
+ * @since Mini Apps v9.0
38
+ */
39
+ readonly deleteItemFp: WithChecksFp<(key: string) => TE.TaskEither<DeviceStorageError, void>, true>;
40
+ /**
41
+ * @see deleteItemFp
42
+ */
43
+ readonly deleteItem: WithChecks<(key: string) => Promise<void>, true>;
44
+ /**
45
+ * Removes all keys from the storage.
46
+ * @since Mini Apps v9.0
47
+ */
48
+ readonly clearFp: WithChecksFp<() => TE.TaskEither<DeviceStorageError, void>, true>;
49
+ /**
50
+ * @see clearFp
51
+ */
52
+ readonly clear: WithChecks<() => Promise<void>, true>;
53
+ }
@@ -0,0 +1,2 @@
1
+ export { DeviceStorage, type DeviceStorageOptions, type DeviceStorageError } from './DeviceStorage.js';
2
+ export { deviceStorage } from './instance.js';
@@ -0,0 +1,2 @@
1
+ import { DeviceStorage } from './DeviceStorage.js';
2
+ export declare const deviceStorage: DeviceStorage;
@@ -1,9 +1,9 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { ImpactHapticFeedbackStyle, NotificationHapticFeedbackType, PostEventError } from '@tma.js/bridge';
2
+ import { Computed } from '@tma.js/signals';
3
3
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
4
- import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
5
- import { WithVersion } from '../../fn-options/withVersion.js';
6
4
  import { WithPostEvent } from '../../fn-options/withPostEvent.js';
5
+ import { WithVersion } from '../../fn-options/withVersion.js';
6
+ import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
7
7
  import * as E from 'fp-ts/Either';
8
8
  type HapticFeedbackEither = E.Either<PostEventError, void>;
9
9
  export interface HapticFeedbackOptions extends WithVersion, WithPostEvent, SharedFeatureOptions {
@@ -1,12 +1,12 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { InvoiceStatus, RequestError } from '@tma.js/bridge';
2
+ import { Computed } from '@tma.js/signals';
3
3
  import { BetterPromise } from 'better-promises';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
- import { AsyncOptions } from '../../types.js';
6
4
  import { ConcurrentCallError, InvalidArgumentsError } from '../../errors.js';
7
- import { WithVersion } from '../../fn-options/withVersion.js';
8
- import { WithRequest } from '../../fn-options/withRequest.js';
9
5
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
6
+ import { WithRequest } from '../../fn-options/withRequest.js';
7
+ import { WithVersion } from '../../fn-options/withVersion.js';
8
+ import { AsyncOptions } from '../../types.js';
9
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
10
10
  import * as TE from 'fp-ts/TaskEither';
11
11
  type InvoiceTask<E, T> = TE.TaskEither<RequestError | ConcurrentCallError | E, T>;
12
12
  export interface InvoiceOptions extends WithVersion, WithRequest, SharedFeatureOptions {
@@ -1,9 +1,9 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { RequestError, PostEventError } from '@tma.js/bridge';
2
+ import { Computed } from '@tma.js/signals';
3
3
  import { BetterPromise } from 'better-promises';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
- import { AsyncOptions } from '../../types.js';
6
4
  import { LocationManagerOptions, LocationManagerRequestLocationResponse, LocationManagerState } from './types.js';
5
+ import { AsyncOptions } from '../../types.js';
6
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
7
7
  import * as E from 'fp-ts/Either';
8
8
  import * as TE from 'fp-ts/TaskEither';
9
9
  /**
@@ -1,9 +1,9 @@
1
1
  import { Maybe } from '@tma.js/toolkit';
2
- import { WithStateRestore } from '../../fn-options/withStateRestore.js';
3
- import { WithRequest } from '../../fn-options/withRequest.js';
4
2
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
5
- import { WithVersion } from '../../fn-options/withVersion.js';
6
3
  import { WithPostEvent } from '../../fn-options/withPostEvent.js';
4
+ import { WithRequest } from '../../fn-options/withRequest.js';
5
+ import { WithStateRestore } from '../../fn-options/withStateRestore.js';
6
+ import { WithVersion } from '../../fn-options/withVersion.js';
7
7
  export interface LocationManagerRequestLocationResponse {
8
8
  /**
9
9
  * Latitude in degrees.
@@ -1,9 +1,9 @@
1
+ import { PostEventError } from '@tma.js/bridge';
1
2
  import { Computed } from '@tma.js/signals';
2
3
  import { RGB } from '@tma.js/types';
3
- import { PostEventError } from '@tma.js/bridge';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
4
  import { ButtonOptions } from '../../composables/Button.js';
6
5
  import { MaybeAccessor } from '../../types.js';
6
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
7
7
  import * as E from 'fp-ts/Either';
8
8
  type MainButtonEither = E.Either<PostEventError, void>;
9
9
  export interface MainButtonState {
@@ -1,12 +1,12 @@
1
- import { KnownThemeParamsKey, RGB, ThemeParams } from '@tma.js/types';
2
- import { Computed } from '@tma.js/signals';
3
1
  import { PostEventError, EventPayload } from '@tma.js/bridge';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
2
+ import { Computed } from '@tma.js/signals';
3
+ import { KnownThemeParamsKey, RGB, ThemeParams } from '@tma.js/types';
5
4
  import { CSSVarsBoundError, UnknownThemeParamsKeyError } from '../../errors.js';
6
- import { WithPostEvent } from '../../fn-options/withPostEvent.js';
7
5
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
8
- import { WithVersion } from '../../fn-options/withVersion.js';
6
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
9
7
  import { WithStateRestore } from '../../fn-options/withStateRestore.js';
8
+ import { WithVersion } from '../../fn-options/withVersion.js';
9
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
10
10
  import * as E from 'fp-ts/Either';
11
11
  type AnyColor = RGB | KnownThemeParamsKey | string;
12
12
  export interface MiniAppState {
@@ -1,12 +1,12 @@
1
1
  import { RequestError } from '@tma.js/bridge';
2
2
  import { Computed } from '@tma.js/signals';
3
3
  import { BetterPromise } from 'better-promises';
4
- import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
5
- import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
6
- import { ShowOptions } from './types.js';
7
4
  import { ConcurrentCallError, InvalidArgumentsError } from '../../errors.js';
8
- import { WithVersion } from '../../fn-options/withVersion.js';
5
+ import { ShowOptions } from './types.js';
6
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
9
7
  import { WithRequest } from '../../fn-options/withRequest.js';
8
+ import { WithVersion } from '../../fn-options/withVersion.js';
9
+ import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
10
10
  import * as TE from 'fp-ts/TaskEither';
11
11
  export interface PopupOptions extends SharedFeatureOptions, WithVersion, WithRequest {
12
12
  }
@@ -1,12 +1,12 @@
1
+ import { PostEventError } from '@tma.js/bridge';
1
2
  import { Computed } from '@tma.js/signals';
2
3
  import { BetterTaskEitherError } from '@tma.js/toolkit';
3
4
  import { BetterPromise } from 'better-promises';
4
- import { PostEventError } from '@tma.js/bridge';
5
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
6
- import { AsyncOptions } from '../../types.js';
7
5
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
8
- import { WithVersion } from '../../fn-options/withVersion.js';
9
6
  import { WithPostEvent } from '../../fn-options/withPostEvent.js';
7
+ import { WithVersion } from '../../fn-options/withVersion.js';
8
+ import { AsyncOptions } from '../../types.js';
9
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
10
10
  import * as E from 'fp-ts/Either';
11
11
  import * as TE from 'fp-ts/TaskEither';
12
12
  export interface QrScannerOptions extends WithVersion, WithPostEvent, SharedFeatureOptions {
@@ -1,9 +1,9 @@
1
+ import { PostEventError, SecondaryButtonPosition } from '@tma.js/bridge';
1
2
  import { Computed } from '@tma.js/signals';
2
3
  import { RGB } from '@tma.js/types';
3
- import { PostEventError, SecondaryButtonPosition } from '@tma.js/bridge';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
4
  import { ButtonOptions } from '../../composables/Button.js';
6
5
  import { MaybeAccessor } from '../../types.js';
6
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
7
7
  import * as E from 'fp-ts/Either';
8
8
  type SecondaryButtonEither = E.Either<PostEventError, void>;
9
9
  export interface SecondaryButtonState {
@@ -0,0 +1,68 @@
1
+ import { RequestError } from '@tma.js/bridge';
2
+ import { SecureStorageMethodError } from '../../errors.js';
3
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
4
+ import { WithCreateRequestId } from '../../fn-options/withCreateRequestId.js';
5
+ import { WithRequest } from '../../fn-options/withRequest.js';
6
+ import { WithVersion } from '../../fn-options/withVersion.js';
7
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
8
+ import * as TE from 'fp-ts/TaskEither';
9
+ export type SecureStorageError = RequestError | SecureStorageMethodError;
10
+ export interface SecureStorageOptions extends SharedFeatureOptions, WithVersion, WithRequest, WithCreateRequestId {
11
+ }
12
+ /**
13
+ * @since Mini Apps v9.0
14
+ */
15
+ export declare class SecureStorage {
16
+ constructor({ isTma, request, version, createRequestId }: SecureStorageOptions);
17
+ /**
18
+ * Retrieves an item using its key.
19
+ * @since Mini Apps v9.0
20
+ */
21
+ readonly getItemFp: WithChecksFp<(key: string) => TE.TaskEither<SecureStorageError, {
22
+ value: string | null;
23
+ canRestore: boolean;
24
+ }>, true>;
25
+ /**
26
+ * @see getItemFp
27
+ */
28
+ readonly getItem: WithChecks<(key: string) => Promise<{
29
+ value: string | null;
30
+ canRestore: boolean;
31
+ }>, true>;
32
+ /**
33
+ * Restores an item from the storage.
34
+ * @since Mini Apps v9.0
35
+ */
36
+ readonly restoreItemFp: WithChecksFp<(key: string) => TE.TaskEither<SecureStorageError, string | null>, true>;
37
+ /**
38
+ * @see restoreItemFp
39
+ */
40
+ readonly restoreItem: WithChecks<(key: string) => Promise<string | null>, true>;
41
+ /**
42
+ * Sets a new item in the storage.
43
+ * @since Mini Apps v9.0
44
+ */
45
+ readonly setItemFp: WithChecksFp<(key: string, value: string | null) => TE.TaskEither<SecureStorageError, void>, true>;
46
+ /**
47
+ * @see setItemFp
48
+ */
49
+ readonly setItem: WithChecks<(key: string, value: string | null) => Promise<void>, true>;
50
+ /**
51
+ * Removes a key from the storage.
52
+ * @since Mini Apps v9.0
53
+ */
54
+ readonly deleteItemFp: WithChecksFp<(key: string) => TE.TaskEither<SecureStorageError, void>, true>;
55
+ /**
56
+ * @see deleteItemFp
57
+ */
58
+ readonly deleteItem: WithChecks<(key: string) => Promise<void>, true>;
59
+ /**
60
+ * Removes all keys from the storage.
61
+ * @since Mini Apps v9.0
62
+ */
63
+ readonly clearFp: WithChecksFp<() => TE.TaskEither<SecureStorageError, void>, true>;
64
+ /**
65
+ * @see clearFp
66
+ */
67
+ readonly clear: WithChecks<() => Promise<void>, true>;
68
+ }
@@ -0,0 +1,2 @@
1
+ export { SecureStorage, type SecureStorageOptions, type SecureStorageError } from './SecureStorage.js';
2
+ export { secureStorage } from './instance.js';
@@ -0,0 +1,2 @@
1
+ import { SecureStorage } from './SecureStorage.js';
2
+ export declare const secureStorage: SecureStorage;
@@ -1,5 +1,5 @@
1
- import { Computed } from '@tma.js/signals';
2
1
  import { PostEventError } from '@tma.js/bridge';
2
+ import { Computed } from '@tma.js/signals';
3
3
  import { ButtonOptions } from '../../composables/Button.js';
4
4
  import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
5
5
  import * as E from 'fp-ts/Either';
@@ -1,11 +1,11 @@
1
+ import { EventListener } from '@tma.js/bridge';
1
2
  import { Computed } from '@tma.js/signals';
2
3
  import { ThemeParams as ThemeParamsType, RGB } from '@tma.js/types';
3
- import { EventListener } from '@tma.js/bridge';
4
- import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
4
  import { CSSVarsBoundError } from '../../errors.js';
6
- import { WithStateRestore } from '../../fn-options/withStateRestore.js';
7
5
  import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
6
+ import { WithStateRestore } from '../../fn-options/withStateRestore.js';
8
7
  import { MaybeAccessor } from '../../types.js';
8
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
9
9
  import * as E from 'fp-ts/Either';
10
10
  export type ThemeParamsState = ThemeParamsType;
11
11
  export interface ThemeParamsOptions extends WithStateRestore<ThemeParamsState>, SharedFeatureOptions {
@@ -1,14 +1,14 @@
1
- import { BetterPromise } from 'better-promises';
2
1
  import { SafeAreaInsets, EventListener, RequestError, PostEventError } from '@tma.js/bridge';
3
2
  import { Computed } from '@tma.js/signals';
3
+ import { BetterPromise } from 'better-promises';
4
+ import { CSSVarsBoundError, FullscreenFailedError } from '../../errors.js';
5
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
6
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
7
+ import { WithRequest } from '../../fn-options/withRequest.js';
4
8
  import { WithStateRestore } from '../../fn-options/withStateRestore.js';
9
+ import { WithVersion } from '../../fn-options/withVersion.js';
5
10
  import { AsyncOptions } from '../../types.js';
6
11
  import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
7
- import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
8
- import { WithVersion } from '../../fn-options/withVersion.js';
9
- import { WithRequest } from '../../fn-options/withRequest.js';
10
- import { CSSVarsBoundError, FullscreenFailedError } from '../../errors.js';
11
- import { WithPostEvent } from '../../fn-options/withPostEvent.js';
12
12
  import * as E from 'fp-ts/Either';
13
13
  import * as TE from 'fp-ts/TaskEither';
14
14
  type FullscreenError = FullscreenFailedError | RequestError;
@@ -1,6 +1,6 @@
1
1
  import { RequestError } from '@tma.js/bridge';
2
- import { AsyncOptions } from '../../types.js';
3
2
  import { SetEmojiStatusError } from '../../errors.js';
3
+ import { AsyncOptions } from '../../types.js';
4
4
  import * as TE from 'fp-ts/TaskEither';
5
5
  export interface SetEmojiStatusOptions extends AsyncOptions {
6
6
  duration?: number;
@@ -1,6 +1,6 @@
1
1
  import { BetterTaskEitherError } from '@tma.js/toolkit';
2
- import { InvokeCustomMethodError } from '../../fn-options/withInvokeCustomMethod.js';
3
2
  import { AccessDeniedError, ValidationError } from '../../errors.js';
3
+ import { InvokeCustomMethodError } from '../../fn-options/withInvokeCustomMethod.js';
4
4
  import { AsyncOptions } from '../../types.js';
5
5
  import * as TE from 'fp-ts/TaskEither';
6
6
  /**
@@ -1,6 +1,6 @@
1
+ import { ValidationError } from '../../errors.js';
1
2
  import { InvokeCustomMethodError } from '../../fn-options/withInvokeCustomMethod.js';
2
3
  import { AsyncOptions } from '../../types.js';
3
- import { ValidationError } from '../../errors.js';
4
4
  import * as TE from 'fp-ts/TaskEither';
5
5
  export type GetCurrentTimeError = InvokeCustomMethodError | ValidationError;
6
6
  /**
@@ -0,0 +1,7 @@
1
+ export interface WithCreateRequestId {
2
+ /**
3
+ * A function generating a request identifier.
4
+ */
5
+ createRequestId: () => string;
6
+ }
7
+ export declare const withCreateRequestId: <O extends object>(obj: O) => O & WithCreateRequestId;
@@ -1,8 +1,8 @@
1
- import { RequestFpFn } from '@tma.js/bridge';
1
+ import { Request2FpFn } from '@tma.js/bridge';
2
2
  export interface WithRequest {
3
3
  /**
4
4
  * A request function to use to call Mini Apps methods.
5
5
  */
6
- request: RequestFpFn;
6
+ request: Request2FpFn;
7
7
  }
8
8
  export declare const withRequest: <O extends object>(obj: O) => O & WithRequest;
@@ -1,3 +1,13 @@
1
- import { RequestFpFn, RequestFn } from '@tma.js/bridge';
1
+ import { RequestFpFn, RequestFn, Request2FpFn, Request2Fn } from '@tma.js/bridge';
2
+ /**
3
+ * @deprecated To be removed in the next major update. Use `request2fp` instead, it provides
4
+ * a proper way of handling multiple events.
5
+ */
2
6
  export declare const requestFp: RequestFpFn;
7
+ export declare const request2Fp: Request2FpFn;
8
+ /**
9
+ * @deprecated To be removed in the next major update. Use `request` instead, it provides
10
+ * a proper way of handling multiple events.
11
+ */
3
12
  export declare const request: RequestFn;
13
+ export declare const request2: Request2Fn;
@@ -2,6 +2,7 @@ export * from './features/BackButton/exports.js';
2
2
  export * from './features/Biometry/exports.js';
3
3
  export * from './features/ClosingBehavior/exports.js';
4
4
  export * from './features/CloudStorage/exports.js';
5
+ export * from './features/DeviceStorage/exports.js';
5
6
  export * from './features/emoji-status/exports.js';
6
7
  export * from './features/HapticFeedback/exports.js';
7
8
  export * from './features/home-screen/exports.js';
@@ -15,6 +16,7 @@ export * from './features/Popup/exports.js';
15
16
  export * from './features/privacy/exports.js';
16
17
  export * from './features/QrScanner/exports.js';
17
18
  export * from './features/SecondaryButton/exports.js';
19
+ export * from './features/SecureStorage/exports.js';
18
20
  export * from './features/SettingsButton/exports.js';
19
21
  export * from './features/SwipeBehavior/exports.js';
20
22
  export * from './features/ThemeParams/exports.js';
@@ -22,7 +24,7 @@ export * from './features/uncategorized/exports.js';
22
24
  export * from './features/Viewport/exports.js';
23
25
  export { createRequestId } from './globals/createRequestId.js';
24
26
  export { invokeCustomMethod } from './globals/invokeCustomMethod.js';
25
- export { postEvent, postEventFp } from './globals/post-event.js';
27
+ export { postEvent, postEventFp } from './globals/postEvent.js';
26
28
  export { request, requestFp } from './globals/request.js';
27
29
  export { isColorDark, isColorDarkFp } from './helpers/isColorDark.js';
28
30
  export * from './errors.js';
@@ -30,4 +32,4 @@ export { init, initFp, type InitOptions } from './init.js';
30
32
  export type { AsyncOptions } from './types.js';
31
33
  export { isTMA, isTMAFp, type isTMAError, mockTelegramEnv, emitEvent, off, offAll, on, type EventListener, type SubscribeListener, type Events, type WriteAccessRequestedStatus, type EmojiStatusAccessRequestedStatus, type BiometryAuthRequestStatus, type BiometryTokenUpdateStatus, type BiometryType, type EmojiStatusFailedError, type EventName, type EventPayload, type EventWithoutPayload, type EventWithPayload, type PhoneRequestedStatus, type FullScreenErrorStatus, type HomeScreenStatus, type InvoiceStatus, type SafeAreaInsets, createPostEvent, type CreatePostEventMode, type OnUnsupportedFn, getReleaseVersion, type PostEventFn, type PostEventFpFn, type PostEventError, supports, type AnyHapticFeedbackParams, type AnyInvokeCustomMethodParams, type CreateMethodParams, type CustomMethodName, type ImpactHapticFeedbackParams, type ImpactHapticFeedbackStyle, type CustomMethodsParams, type CustomMethodParams, type MethodName, type MethodVersionedParams, type NotificationHapticFeedbackParams, type NotificationHapticFeedbackType, type Methods, type SelectionHapticFeedbackParams, type MethodNameWithOptionalParams, type MethodNameWithoutParams, type MethodNameWithRequiredParams, type MethodNameWithVersionedParams, type MethodParams, type PopupParams, type BackgroundColor, type BottomBarColor, type HeaderColorKey, type PopupButton, type OpenLinkBrowser, type SecondaryButtonPosition, type SwitchInlineQueryChatType, type InvokeCustomMethodFn, type InvokeCustomMethodOptions, type InvokeCustomMethodFpFn, type InvokeCustomMethodError, type InvokeCustomMethodFpOptions, type RequestCaptureEventFn, type RequestCaptureEventsFn, type RequestCaptureFn, type RequestCaptureFnEventsPayload, type RequestFn, type RequestOptions, type RequestResult, type RequestError, type RequestFpOptions, type RequestFpFn, applyPolyfills, decodeBase64Url, encodeBase64Url, decodeBase64UrlFp, type DecodeBase64UrlError, LaunchParamsRetrieveError, InvalidLaunchParamsError, InvokeCustomMethodFailedError, MethodParameterUnsupportedError, MethodUnsupportedError, UnknownEnvError, setDebug, debug, logger, setTargetOrigin, targetOrigin, retrieveLaunchParams, retrieveRawInitData, retrieveRawInitDataFp, retrieveRawLaunchParams, retrieveRawLaunchParamsFp, retrieveLaunchParamsFp, type RetrieveLaunchParamsError, type RetrieveLaunchParamsResult, type RetrieveRawInitDataError, type RetrieveRawLaunchParamsError, createStartParam, createStartParamFp, decodeStartParam, decodeStartParamFp, isSafeToCreateStartParam, createLogger, deepSnakeToCamelObjKeys, type DeepConvertSnakeKeysToCamelCase, type Logger, type LoggerFn, type LoggerForceFn, type LoggerOptions, type LogLevel, CancelledError, TimeoutError, } from '@tma.js/bridge';
32
34
  export { parseInitDataQuery, parseInitDataQueryFp, type ParseInitDataQueryError, parseLaunchParamsQuery, parseLaunchParamsQueryFp, type ParseLaunchParamsQueryError, isRGBShort, isRGBAShort, isRGB, isRGBA, isAnyRGB, toRGBFullFp, toRGBFp, toRGB, toRGBFull, serializeInitDataQuery, type InitDataLike, serializeLaunchParamsQuery, type LaunchParamsLike, } from '@tma.js/transformers';
33
- export type { RGB, User, Chat, InitData, ChatType, Platform, ThemeParams, LaunchParams, KnownThemeParamsKey, Version, } from '@tma.js/types';
35
+ export type { RGB, User, Chat, InitData as InitDataType, ChatType, Platform, ThemeParams as ThemeParamsType, LaunchParams, KnownThemeParamsKey, Version, } from '@tma.js/types';
@@ -4,8 +4,8 @@ import { If, IsNever, AnyFnAnyEither, RightOfReturn, LeftOfReturn, MaybeMonadRet
4
4
  import { Version } from '@tma.js/types';
5
5
  import { FunctionUnavailableError } from '../errors.js';
6
6
  import { MaybeAccessor } from '../types.js';
7
- import * as O from 'fp-ts/Option';
8
7
  import * as E from 'fp-ts/Either';
8
+ import * as O from 'fp-ts/Option';
9
9
  import * as TE from 'fp-ts/TaskEither';
10
10
  type IfReturnsTask<Fn extends AnyFnAnyEither, A, B> = ReturnType<Fn> extends TE.TaskEither<any, any> ? A : B;
11
11
  type OptionsBasedRequires<O extends WithChecksOptions<any>> = O extends {