Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dscvr-one/canvas-client-sdk

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dscvr-one/canvas-client-sdk - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

src/index.ts

1

dist/index.d.ts

@@ -21,2 +21,3 @@ import * as CanvasInterface from '@dscvr-one/canvas-interface';

createPost(htmlContent: string): Promise<CanvasInterface.User.CreatePostResponse>;
createShareLink(urlData: string): Promise<CanvasInterface.User.CreateShareLinkResponse>;
copyToClipboard(content: string): Promise<CanvasInterface.User.CopyToClipboardResponse>;

@@ -23,0 +24,0 @@ onContentReaction(callback: (reaction: CanvasInterface.User.ContentReactionResponse) => void): void;

@@ -117,2 +117,14 @@ // src/index.ts

}
createShareLink(urlData) {
console.log("CREATE SHARE LINK IN SDK!");
return this.sendMessageAndWaitResponse(
{
type: "user:create-share-link-request",
payload: {
urlData
}
},
CanvasInterface.User.createShareLinkResponseMessageSchema
);
}
copyToClipboard(content) {

@@ -119,0 +131,0 @@ return this.sendMessageAndWaitResponse(

32

package.json
{
"name": "@dscvr-one/canvas-client-sdk",
"version": "1.1.1",
"version": "2.0.0",
"description": "SDK for iframes apps to connect to dscvr host using postMessage rpc",
"type": "module",
"main": "./dist/index.js",
"main": "src/index.ts",
"publishConfig": {
"main": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"homepage": "https://github.com/dscvr-one/dscvr-canvas/tree/main/libs/canvas-client-sdk#readme",

@@ -11,2 +15,9 @@ "files": [

],
"scripts": {
"build": "tsup",
"doc": "typedoc",
"release": "shipjs prepare",
"release:dry": "shipjs prepare --dry-run",
"release:auto": "shipjs prepare --yes"
},
"keywords": [

@@ -22,3 +33,3 @@ "dscvr",

"dependencies": {
"@dscvr-one/canvas-interface": "~1.1.0",
"@dscvr-one/canvas-interface": "~1.2.0",
"eventemitter3": "^5.0.1"

@@ -43,14 +54,3 @@ },

"typescript": "^5.3.3"
},
"scripts": {
"build": "tsup",
"doc": "typedoc",
"lint:js": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint \"{,!(node_modules|dist|static)/**/}*.{js,ts}\" --ignore-path .gitignore",
"lint:prettier": "prettier --check \"{,!(node_modules|dist|static)/**/}*.{js,ts}\" --ignore-path .gitignore",
"release": "shipjs prepare",
"release:dry": "shipjs prepare --dry-run",
"release:auto": "shipjs prepare --yes"
},
"types": "./dist/index.d.ts"
}
}
}

@@ -32,3 +32,7 @@ # @dscvr-one/canvas-client-sdk

```typescript
import { CanvasInterface, CanvasClient } from '@dscvr-one/canvas-client-sdk';
import {
createCanvasClient,
type CanvasInterface,
type CanvasClient,
} from '@dscvr-one/canvas-client-sdk';
```

@@ -39,3 +43,3 @@

```typescript
const canvasClient = new CanvasClient();
const canvasClient = createCanvasClient();
```

@@ -56,4 +60,39 @@

4. Destruction
If the client is being instantiated in a react hook or in a vue component/composable (anything with a lifecycle),
we recommend to destroy the client on hot refreshes to avoid `CanvasInterface.ClientAlreadyInitializedError` while on localhost.
e.g `Vue`
```typescript
onMounted(() => {
canvasClient = createCanvasClient();
if (!canvasClient) return;
response = await canvasClient.ready();
});
onUnmounted(() => {
canvasClient?.destroy();
});
```
e.g `React`
```typescript
useEffect(() => {
canvasClient = createCanvasClient();
if (canvasClient) {
response = await canvasClient.ready();
}
// Destroy the client on effect cleanup
return () => {
canvasClient?.destroy();
};
});
```
## Contributing
Contributions are welcome! If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc