@dynamic-labs/client 2.0.0-alpha.28 → 2.0.0-alpha.30

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/CHANGELOG.md CHANGED
@@ -1,4 +1,36 @@
1
1
 
2
+ ## [2.0.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.29...v2.0.0-alpha.30) (2024-04-11)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * add headless sms sign-in (#5274)
8
+
9
+ ### Features
10
+
11
+ * add headless sms sign-in ([#5274](https://github.com/dynamic-labs/DynamicAuth/issues/5274)) ([fffc293](https://github.com/dynamic-labs/DynamicAuth/commit/fffc293f85447a784e8c728d1586f3555ab1fbfa))
12
+
13
+ ## [2.0.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.28...v2.0.0-alpha.29) (2024-04-10)
14
+
15
+
16
+ ### ⚠ BREAKING CHANGES
17
+
18
+ * replace sdk-api with sdk-api-core (#5280)
19
+
20
+ ### Features
21
+
22
+ * add dynamic client context ([#5250](https://github.com/dynamic-labs/DynamicAuth/issues/5250)) ([778ebe6](https://github.com/dynamic-labs/DynamicAuth/commit/778ebe6313e0bf3c9876feb6eff5bf152c15c55e))
23
+ * **webview-controller:** fetch manifest and render Dynamic SDK ([#5287](https://github.com/dynamic-labs/DynamicAuth/issues/5287)) ([00e84ac](https://github.com/dynamic-labs/DynamicAuth/commit/00e84acc4bdda92bad91108788f8d7882d0790d6))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * don't render modal header component if there's no content ([#5269](https://github.com/dynamic-labs/DynamicAuth/issues/5269)) ([f4d7266](https://github.com/dynamic-labs/DynamicAuth/commit/f4d72668a5243108649774c6581733655f385cab))
29
+ * don't show get extension button when there are no download links ([#5276](https://github.com/dynamic-labs/DynamicAuth/issues/5276)) ([e8cf660](https://github.com/dynamic-labs/DynamicAuth/commit/e8cf66076a9914881a8edda69feb2fb192ac63a3))
30
+
31
+
32
+ * replace sdk-api with sdk-api-core ([#5280](https://github.com/dynamic-labs/DynamicAuth/issues/5280)) ([da4b695](https://github.com/dynamic-labs/DynamicAuth/commit/da4b6955a81d6bfb5c994cd62e21e9ae11a4f454))
33
+
2
34
  ## [2.0.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.27...v2.0.0-alpha.28) (2024-04-10)
3
35
 
4
36
 
package/package.cjs CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "2.0.0-alpha.28";
5
+ var version = "2.0.0-alpha.30";
6
6
 
7
7
  exports.version = version;
package/package.js CHANGED
@@ -1,3 +1,3 @@
1
- var version = "2.0.0-alpha.28";
1
+ var version = "2.0.0-alpha.30";
2
2
 
3
3
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/client",
3
- "version": "2.0.0-alpha.28",
3
+ "version": "2.0.0-alpha.30",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,6 +26,8 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "peerDependencies": {
29
- "@dynamic-labs/message-transport": "2.0.0-alpha.28"
29
+ "@dynamic-labs/message-transport": "2.0.0-alpha.30",
30
+ "@dynamic-labs/types": "2.0.0-alpha.30",
31
+ "eventemitter3": "5.0.1"
30
32
  }
31
33
  }
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var sdkModule = require('../modules/sdkModule/sdkModule.cjs');
6
+ var walletsModule = require('../modules/walletsModule/walletsModule.cjs');
6
7
  var Extendable = require('../utils/Extendable/Extendable.cjs');
7
8
  var core = require('./core/core.cjs');
8
9
 
@@ -19,6 +20,8 @@ const createClient = (props) => {
19
20
  return baseExtendable.extend(() => ({
20
21
  /** Module that gives insight over the state of the SDK */
21
22
  sdk: sdkModule.createSdkModule(core$1, props),
23
+ /** Module that provides access to user's wallets */
24
+ wallets: walletsModule.createWalletsModule(core$1),
22
25
  }));
23
26
  };
24
27
 
@@ -16,7 +16,7 @@ export type ClientProps = {
16
16
  */
17
17
  export declare const createClient: (props: ClientProps) => {
18
18
  /** Module that gives insight over the state of the SDK */
19
- sdk: {
20
- readonly loaded: boolean;
21
- };
19
+ sdk: import("dist/packages/message-transport/src").StoreStateGetters<import("dist/packages/message-transport/src").SdkModuleState>;
20
+ /** Module that provides access to user's wallets */
21
+ wallets: import("dist/packages/message-transport/src").StoreStateGetters<import("dist/packages/message-transport/src").WalletsModuleState> & Pick<import("eventemitter3").EventEmitter<import("dist/packages/message-transport/src").StoreStateEvents<import("dist/packages/message-transport/src").WalletsModuleState>, any>, "on" | "off" | "once">;
22
22
  } & Extendable;
@@ -1,4 +1,5 @@
1
1
  import { createSdkModule } from '../modules/sdkModule/sdkModule.js';
2
+ import { createWalletsModule } from '../modules/walletsModule/walletsModule.js';
2
3
  import { Extendable } from '../utils/Extendable/Extendable.js';
3
4
  import { createCore } from './core/core.js';
4
5
 
@@ -15,6 +16,8 @@ const createClient = (props) => {
15
16
  return baseExtendable.extend(() => ({
16
17
  /** Module that gives insight over the state of the SDK */
17
18
  sdk: createSdkModule(core, props),
19
+ /** Module that provides access to user's wallets */
20
+ wallets: createWalletsModule(core),
18
21
  }));
19
22
  };
20
23
 
@@ -8,18 +8,15 @@ var manifest = require('./manifest/manifest.cjs');
8
8
 
9
9
  const createSdkModule = (core, props) => {
10
10
  const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
11
- const state = {
12
- loaded: false,
13
- };
14
11
  requestChannel.handle('manifest', () => _tslib.__awaiter(void 0, void 0, void 0, function* () { return manifest.createManifest(props); }));
15
- // This will soon have to change. After we implement th store abstraction
16
- // in the message transport package, we should use it here.
17
- requestChannel.handle('loaded', () => (state.loaded = true));
18
- return {
19
- get loaded() {
20
- return state.loaded;
12
+ const store = messageTransport.createStore({
13
+ initialState: {
14
+ loaded: false,
21
15
  },
22
- };
16
+ key: 'sdk',
17
+ messageTransport: core.messageTransport,
18
+ });
19
+ return store.getters;
23
20
  };
24
21
 
25
22
  exports.createSdkModule = createSdkModule;
@@ -1,5 +1,4 @@
1
+ import { SdkModuleState } from '@dynamic-labs/message-transport';
1
2
  import type { ClientProps } from '../../client';
2
3
  import { Core } from '../../client/core';
3
- export declare const createSdkModule: (core: Core, props: ClientProps) => {
4
- readonly loaded: boolean;
5
- };
4
+ export declare const createSdkModule: (core: Core, props: ClientProps) => import("@dynamic-labs/message-transport").StoreStateGetters<SdkModuleState>;
@@ -1,21 +1,18 @@
1
1
  import { __awaiter } from '../../../_virtual/_tslib.js';
2
- import { createRequestChannel } from '@dynamic-labs/message-transport';
2
+ import { createRequestChannel, createStore } from '@dynamic-labs/message-transport';
3
3
  import { createManifest } from './manifest/manifest.js';
4
4
 
5
5
  const createSdkModule = (core, props) => {
6
6
  const requestChannel = createRequestChannel(core.messageTransport);
7
- const state = {
8
- loaded: false,
9
- };
10
7
  requestChannel.handle('manifest', () => __awaiter(void 0, void 0, void 0, function* () { return createManifest(props); }));
11
- // This will soon have to change. After we implement th store abstraction
12
- // in the message transport package, we should use it here.
13
- requestChannel.handle('loaded', () => (state.loaded = true));
14
- return {
15
- get loaded() {
16
- return state.loaded;
8
+ const store = createStore({
9
+ initialState: {
10
+ loaded: false,
17
11
  },
18
- };
12
+ key: 'sdk',
13
+ messageTransport: core.messageTransport,
14
+ });
15
+ return store.getters;
19
16
  };
20
17
 
21
18
  export { createSdkModule };
@@ -0,0 +1 @@
1
+ export * from './walletsModule';
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var messageTransport = require('@dynamic-labs/message-transport');
6
+ var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
7
+
8
+ const createWalletsModule = (core) => {
9
+ const store = messageTransport.createStore({
10
+ initialState: { primaryWallet: undefined, userWallets: [] },
11
+ key: 'wallets',
12
+ messageTransport: core.messageTransport,
13
+ });
14
+ return Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter));
15
+ };
16
+
17
+ exports.createWalletsModule = createWalletsModule;
@@ -0,0 +1,4 @@
1
+ import { WalletsModuleState } from '@dynamic-labs/message-transport';
2
+ import { Core } from '../../client/core';
3
+ export type WalletsModule = ReturnType<typeof createWalletsModule>;
4
+ export declare const createWalletsModule: (core: Core) => import("@dynamic-labs/message-transport").StoreStateGetters<WalletsModuleState> & Pick<import("eventemitter3").EventEmitter<import("@dynamic-labs/message-transport").StoreStateEvents<WalletsModuleState>, any>, "on" | "off" | "once">;
@@ -0,0 +1,13 @@
1
+ import { createStore } from '@dynamic-labs/message-transport';
2
+ import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
3
+
4
+ const createWalletsModule = (core) => {
5
+ const store = createStore({
6
+ initialState: { primaryWallet: undefined, userWallets: [] },
7
+ key: 'wallets',
8
+ messageTransport: core.messageTransport,
9
+ });
10
+ return Object.assign(store.getters, pickListenerActions(store.eventEmitter));
11
+ };
12
+
13
+ export { createWalletsModule };
@@ -0,0 +1 @@
1
+ export * from './pickListenerActions';
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * This only serves to limit the methods of an event emitter to
7
+ * only the ones necessary for event listening
8
+ */
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ const pickListenerActions = (emitter) => ({
11
+ off: emitter.off.bind(emitter),
12
+ on: emitter.on.bind(emitter),
13
+ once: emitter.once.bind(emitter),
14
+ });
15
+
16
+ exports.pickListenerActions = pickListenerActions;
@@ -0,0 +1,6 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ /**
3
+ * This only serves to limit the methods of an event emitter to
4
+ * only the ones necessary for event listening
5
+ */
6
+ export declare const pickListenerActions: <T extends EventEmitter<any, any>>(emitter: T) => Pick<T, "on" | "off" | "once">;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This only serves to limit the methods of an event emitter to
3
+ * only the ones necessary for event listening
4
+ */
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const pickListenerActions = (emitter) => ({
7
+ off: emitter.off.bind(emitter),
8
+ on: emitter.on.bind(emitter),
9
+ once: emitter.once.bind(emitter),
10
+ });
11
+
12
+ export { pickListenerActions };