@dynamic-labs/message-transport 2.0.2 → 2.1.0-alpha.1

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 (30) hide show
  1. package/CHANGELOG.md +14 -12
  2. package/_virtual/_tslib.cjs +1 -0
  3. package/_virtual/_tslib.js +1 -0
  4. package/package.json +4 -4
  5. package/src/index.cjs +1 -0
  6. package/src/index.d.ts +1 -1
  7. package/src/index.js +1 -0
  8. package/src/messageTransport/decorators/applyDefaultMessageOrigin/applyDefaultMessageOrigin.cjs +1 -0
  9. package/src/messageTransport/decorators/applyDefaultMessageOrigin/applyDefaultMessageOrigin.js +1 -0
  10. package/src/messageTransport/decorators/makeWaitForInitEvent/makeWaitForInitEvent.cjs +1 -0
  11. package/src/messageTransport/decorators/makeWaitForInitEvent/makeWaitForInitEvent.js +1 -0
  12. package/src/messageTransport/decorators/makeWaitForUnblock/makeWaitForUnblock.cjs +1 -0
  13. package/src/messageTransport/decorators/makeWaitForUnblock/makeWaitForUnblock.js +1 -0
  14. package/src/messageTransport/messageTransport.cjs +1 -0
  15. package/src/messageTransport/messageTransport.js +1 -0
  16. package/src/messageTypes/AuthModuleMessages.d.ts +2 -3
  17. package/src/messageTypes/OtpExtensionMessages.d.ts +1 -1
  18. package/src/messageTypes/SdkModuleMessages.cjs +1 -0
  19. package/src/messageTypes/SdkModuleMessages.js +1 -0
  20. package/src/requestChannel/requestChannel.cjs +1 -0
  21. package/src/requestChannel/requestChannel.js +1 -0
  22. package/src/store/createEventEmitterForMessages/createEventEmitterForMessages.cjs +1 -0
  23. package/src/store/createEventEmitterForMessages/createEventEmitterForMessages.js +1 -0
  24. package/src/store/store.cjs +3 -1
  25. package/src/store/store.js +3 -1
  26. package/src/store/storeSetter/storeSetter.cjs +1 -0
  27. package/src/store/storeSetter/storeSetter.js +1 -0
  28. package/src/store/types.d.ts +13 -0
  29. package/src/utils/parseMessageTransportData/parseMessageTransportData.cjs +1 -0
  30. package/src/utils/parseMessageTransportData/parseMessageTransportData.js +1 -0
package/CHANGELOG.md CHANGED
@@ -1,24 +1,26 @@
1
1
 
2
- ### [2.0.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.1...v2.0.2) (2024-04-19)
3
-
4
-
5
- ### Bug Fixes
6
-
7
- * buffer polyfill for utils package ([#5404](https://github.com/dynamic-labs/DynamicAuth/issues/5404)) ([#5405](https://github.com/dynamic-labs/DynamicAuth/issues/5405)) ([679c197](https://github.com/dynamic-labs/DynamicAuth/commit/679c197a52969a0db614ed280d7b9a0bf172bf72))
8
-
9
- ### [2.0.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0...v2.0.1) (2024-04-18)
2
+ ## [2.1.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.0...v2.1.0-alpha.1) (2024-04-18)
10
3
 
11
4
 
12
5
  ### Features
13
6
 
14
- * add redirectUri to farcaster connect ([#5373](https://github.com/dynamic-labs/DynamicAuth/issues/5373)) ([#5383](https://github.com/dynamic-labs/DynamicAuth/issues/5383)) ([d031d7e](https://github.com/dynamic-labs/DynamicAuth/commit/d031d7ee5705de5ec83ef328f03633d5f3524786))
7
+ * add frame metadata to demo index page ([#5327](https://github.com/dynamic-labs/DynamicAuth/issues/5327)) ([34a071a](https://github.com/dynamic-labs/DynamicAuth/commit/34a071af8faa8a867ad747ec2a607056a883568d))
8
+ * add MfaChooseDeviceView and MfaSecureDeviceView ([#5343](https://github.com/dynamic-labs/DynamicAuth/issues/5343)) ([4c39b1c](https://github.com/dynamic-labs/DynamicAuth/commit/4c39b1c34b5091190b095770e95a733c8f458ca2)), closes [#5356](https://github.com/dynamic-labs/DynamicAuth/issues/5356)
9
+ * add redirectUri to farcaster connect ([#5373](https://github.com/dynamic-labs/DynamicAuth/issues/5373)) ([ed13fc2](https://github.com/dynamic-labs/DynamicAuth/commit/ed13fc2948e06df0017ac122db54aca44f264a6d))
10
+ * add useMfa hook ([#5337](https://github.com/dynamic-labs/DynamicAuth/issues/5337)) ([a7682ba](https://github.com/dynamic-labs/DynamicAuth/commit/a7682ba10fd0f0809af802e0172154726f1bd857))
11
+ * headless create session and is session active ([#5346](https://github.com/dynamic-labs/DynamicAuth/issues/5346)) ([a787bbc](https://github.com/dynamic-labs/DynamicAuth/commit/a787bbcbb44104d2d0bd263579bd87a78453681d))
12
+ * secure enclave wallet generate one-time code headless ([#5329](https://github.com/dynamic-labs/DynamicAuth/issues/5329)) ([cab80a2](https://github.com/dynamic-labs/DynamicAuth/commit/cab80a2bfa77e48263d47cdcb813c54ef5b831d5))
15
13
 
16
14
 
17
15
  ### Bug Fixes
18
16
 
19
- * copy and ui fixes ([#5367](https://github.com/dynamic-labs/DynamicAuth/issues/5367)) ([e39ea97](https://github.com/dynamic-labs/DynamicAuth/commit/e39ea97d98de6b7087c24f2326a5fdc07ab9c8c3))
20
- * bitcoin connector improvements
21
- * solana package improvements ([#5360](https://github.com/dynamic-labs/DynamicAuth/issues/5360)) ([#5385](https://github.com/dynamic-labs/DynamicAuth/issues/5385)) ([9010bce](https://github.com/dynamic-labs/DynamicAuth/commit/9010bcebb4b0f2d293d517347187d38accbac0d3))
17
+ * always stringify the message before signing a message using walletUiUtils ([#5325](https://github.com/dynamic-labs/DynamicAuth/issues/5325)) ([7abf094](https://github.com/dynamic-labs/DynamicAuth/commit/7abf09456e30ad0657892e9ba58d7391f0f430e6))
18
+ * bitcoin network connector sendBitcoin methods updates ([#5369](https://github.com/dynamic-labs/DynamicAuth/issues/5369)) ([e9bf444](https://github.com/dynamic-labs/DynamicAuth/commit/e9bf444122ee86030d85b84ede96bdfb9772425e))
19
+ * buffer missing when using buffer util function ([#5360](https://github.com/dynamic-labs/DynamicAuth/issues/5360)) ([e998e46](https://github.com/dynamic-labs/DynamicAuth/commit/e998e464bd2671a82aa271b407a7d8fc49a16bd0))
20
+ * embedded solana send transaction shouldn't sign a signed transaction ([#5357](https://github.com/dynamic-labs/DynamicAuth/issues/5357)) ([c2ae2fa](https://github.com/dynamic-labs/DynamicAuth/commit/c2ae2faa509b62fc5ceb345fbc0f0b47217bf4b0))
21
+ * use network.name if vanity name is missing ([#5338](https://github.com/dynamic-labs/DynamicAuth/issues/5338)) ([34ec2ae](https://github.com/dynamic-labs/DynamicAuth/commit/34ec2ae5c4dad5376a3b9c5a07221f68a2f7756c))
22
+
23
+ ## [2.1.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.32...v2.1.0-alpha.0) (2024-04-15)
22
24
 
23
25
  ## [2.0.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.31...v2.0.0-alpha.32) (2024-04-15)
24
26
 
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  /******************************************************************************
2
3
  Copyright (c) Microsoft Corporation.
3
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/message-transport",
3
- "version": "2.0.2",
3
+ "version": "2.1.0-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "./package.json": "./package.json"
27
27
  },
28
- "peerDependencies": {
29
- "@dynamic-labs/sdk-react-core": "2.0.2",
30
- "@dynamic-labs/types": "2.0.2",
28
+ "dependencies": {
29
+ "@vue/reactivity": "3.4.21",
30
+ "@dynamic-labs/types": "2.1.0-alpha.1",
31
31
  "eventemitter3": "5.0.1"
32
32
  }
33
33
  }
package/src/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
package/src/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { applyDefaultMessageOrigin, createMessageTransport, makeWaitForInitEvent
2
2
  export { createRequestChannel, type RequestChannel } from './requestChannel';
3
3
  export { parseMessageTransportData } from './utils/parseMessageTransportData';
4
4
  export { createEventEmitterForMessages, createStore, createStoreSetter, type MessagesForEventEmitter, } from './store';
5
- export type { Store, StoreKeys, StoreSetter, StoreStateEvents, StoreStateGetters, } from './store/types';
5
+ export type { Store, StoreKeys, StoreSetter, StoreStateEvents, StoreStateGetters, StoreEventListeners, } from './store/types';
6
6
  export { sdkHasLoadedEventName, type AuthModuleMessages, type AuthModuleState, type ClientManifest, type OtpExtensionMessages, type SdkModuleMessages, type SdkModuleState, type WalletsModuleState, } from './messageTypes';
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  export { createMessageTransport } from './messageTransport/messageTransport.js';
2
3
  export { applyDefaultMessageOrigin } from './messageTransport/decorators/applyDefaultMessageOrigin/applyDefaultMessageOrigin.js';
3
4
  export { makeWaitForInitEvent } from './messageTransport/decorators/makeWaitForInitEvent/makeWaitForInitEvent.js';
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  /** Allows setting a default origin, making the origin property optional */
2
3
  const applyDefaultMessageOrigin = ({ defaultOrigin, messageTransport, }) => (Object.assign(Object.assign({}, messageTransport), { defaultOrigin, emit: (message) => {
3
4
  var _a;
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  import { makeWaitForUnblock } from '../makeWaitForUnblock/makeWaitForUnblock.js';
2
3
 
3
4
  /**
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  /**
2
3
  * Decorator that adds the following features to a MessageTransport:
3
4
  * 1. Any emit calls will not emit the message yet. These messages will be stored.
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  /** Creates a simple message transport for general use */
2
3
  const createMessageTransport = () => {
3
4
  const listeners = new Set();
@@ -1,9 +1,8 @@
1
- import type { UserProfile } from '@dynamic-labs/sdk-react-core';
1
+ import type { UserProfile } from '@dynamic-labs/types';
2
2
  export type AuthModuleState = {
3
- authToken: string | null;
3
+ token: string | null;
4
4
  authenticatedUser: UserProfile | null;
5
5
  };
6
6
  export type AuthModuleMessages = {
7
7
  logout: () => Promise<void>;
8
- login: () => Promise<void>;
9
8
  };
@@ -1,4 +1,4 @@
1
- import { OtpDestination, PhoneData } from '@dynamic-labs/sdk-react-core';
1
+ import { OtpDestination, PhoneData } from '@dynamic-labs/types';
2
2
  type OtpData = {
3
3
  destination: Extract<OtpDestination, 'email'>;
4
4
  target: string;
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  /** Easy access to the event name that indicates the SDK has loaded */
2
3
  const sdkHasLoadedEventName = 'sdk__loadedChanged';
3
4
 
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  import { __awaiter } from '../../_virtual/_tslib.js';
2
3
 
3
4
  /** Given a request event name, returns the event name for its resolve */
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  import EventEmitter from 'eventemitter3';
2
3
  import { createRequestChannel } from '../../requestChannel/requestChannel.js';
3
4
 
@@ -1,8 +1,10 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
4
5
 
5
6
  var EventEmitter = require('eventemitter3');
7
+ var reactivity = require('@vue/reactivity');
6
8
  var requestChannel = require('../requestChannel/requestChannel.cjs');
7
9
 
8
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -23,7 +25,7 @@ const createStore = ({ initialState, key, messageTransport, }) => {
23
25
  * for clients to have access to.
24
26
  */
25
27
  const eventEmitter = new EventEmitter__default["default"]();
26
- const state = Object.assign({}, initialState);
28
+ const state = reactivity.reactive(Object.assign({}, initialState));
27
29
  const getters = {};
28
30
  for (const variable in state) {
29
31
  // Add the state getter
@@ -1,4 +1,6 @@
1
+ 'use client'
1
2
  import EventEmitter from 'eventemitter3';
3
+ import { reactive } from '@vue/reactivity';
2
4
  import { createRequestChannel } from '../requestChannel/requestChannel.js';
3
5
 
4
6
  const createStore = ({ initialState, key, messageTransport, }) => {
@@ -15,7 +17,7 @@ const createStore = ({ initialState, key, messageTransport, }) => {
15
17
  * for clients to have access to.
16
18
  */
17
19
  const eventEmitter = new EventEmitter();
18
- const state = Object.assign({}, initialState);
20
+ const state = reactive(Object.assign({}, initialState));
19
21
  const getters = {};
20
22
  for (const variable in state) {
21
23
  // Add the state getter
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  import { createRequestChannel } from '../../requestChannel/requestChannel.js';
2
3
 
3
4
  const createStoreSetter = ({ key, messageTransport, }) => {
@@ -38,3 +38,16 @@ export type StoreStateChangeEvent<T extends Record<string, unknown>, K extends E
38
38
  export type StoreStateEvents<T extends Record<string, unknown>> = {
39
39
  [K in Extract<keyof T, string> as StoreStateChangeEvent<T, K>]: (value: T[K]) => void;
40
40
  };
41
+ /**
42
+ * Generates the event listener methods for a StoreState.
43
+ * The methods still return the original type of the eventemitter3 class.
44
+ * Use StoreEventListeners instead, which hides these return types.
45
+ */
46
+ type RawStoreEventListeners<T extends Record<string, unknown>> = Pick<EventEmitter<StoreStateEvents<T>>, 'on' | 'off' | 'once'>;
47
+ /**
48
+ * The event listener methods for a StoreState
49
+ */
50
+ export type StoreEventListeners<T extends Record<string, unknown>> = {
51
+ [M in keyof RawStoreEventListeners<T>]: (...args: Parameters<RawStoreEventListeners<T>[M]>) => void;
52
+ };
53
+ export {};
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client'
1
2
  const parseMessageTransportData = (
2
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  parsedData) => {