@research-ag/ic-web-push 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -43,12 +43,14 @@ You can also customize the path/scope via `init()` if you prefer a different loc
43
43
 
44
44
  ```ts
45
45
  import icWebPush from 'ic-web-push';
46
- import { HttpAgent } from '@dfinity/agent';
46
+ import { HttpAgent } from '@icp-sdk/core/agent';
47
47
 
48
48
  const agent = new HttpAgent({ host: 'https://ic0.app' });
49
49
  // If developing locally against a replica, you may need:
50
50
  // await agent.fetchRootKey();
51
51
 
52
+ // Ensure the user is authenticated and the identity is set to the agent reference before proceeding
53
+
52
54
  icWebPush.init({
53
55
  agent,
54
56
  // Notification canister ID (defaults to mainnet id):
@@ -218,7 +220,7 @@ export default function App() {
218
220
 
219
221
  ## Sending notifications
220
222
 
221
- From your canister or backend, call `sendNotifications` with a vector of `(principal, NotificationBody)` pairs on the notification canister. The `principal` should be your application canister principal that was used when registering subscriptions.
223
+ From your canister or backend, call `sendNotifications` with a vector of `(principal, NotificationBody)` pairs on the notification canister. The `principal` should be your user's principal.
222
224
 
223
225
  `NotificationBody` schema:
224
226
  ```candid
@@ -1,6 +1,6 @@
1
- import type { ActorConfig, ActorSubclass, Agent, HttpAgentOptions, } from "@dfinity/agent";
2
- import type { Principal } from "@dfinity/principal";
3
- import type { IDL } from "@dfinity/candid";
1
+ import type { ActorConfig, ActorSubclass, Agent, HttpAgentOptions, } from "@icp-sdk/core/agent";
2
+ import type { Principal } from "@icp-sdk/core/principal";
3
+ import type { IDL } from "@icp-sdk/core/candid";
4
4
 
5
5
  import { _SERVICE } from './notification_canister.did';
6
6
 
@@ -1,4 +1,4 @@
1
- import {Actor, HttpAgent} from "@dfinity/agent";
1
+ import {Actor, HttpAgent} from "@icp-sdk/core/agent";
2
2
 
3
3
  // Imports and re-exports candid interface
4
4
  import {idlFactory} from "./notification_canister.did.js";
@@ -1,6 +1,6 @@
1
- import type { Principal } from '@dfinity/principal';
2
- import type { ActorMethod } from '@dfinity/agent';
3
- import type { IDL } from '@dfinity/candid';
1
+ import type { Principal } from '@icp-sdk/core/principal';
2
+ import type { ActorMethod } from '@icp-sdk/core/agent';
3
+ import type { IDL } from '@icp-sdk/core/candid';
4
4
 
5
5
  export interface RelayerInfo {
6
6
  'relayer': Principal,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { HttpAgent } from '@dfinity/agent';
2
- import { Principal } from '@dfinity/principal';
1
+ import { HttpAgent } from '@icp-sdk/core/agent';
2
+ import { Principal } from '@icp-sdk/core/principal';
3
3
  export type IcWebPushConfig = {
4
4
  agent: HttpAgent;
5
5
  /** Notification canister ID (Principal text). Defaults to known mainnet ID. */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Actor } from '@dfinity/agent';
2
- import { Principal } from '@dfinity/principal';
1
+ import { Actor } from '@icp-sdk/core/agent';
2
+ import { Principal } from '@icp-sdk/core/principal';
3
3
  import { idlFactory as notificationIdlFactory } from './declarations/notification_canister/notification_canister.did.js';
4
4
  const DEFAULTS = {
5
5
  notificationCanisterId: 'zjwxf-jyaaa-aaaao-a43ca-cai',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@research-ag/ic-web-push",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Browser SDK for Internet Computer web push notifications with a companion service worker.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,15 +35,12 @@
35
35
  ],
36
36
  "author": "",
37
37
  "license": "MIT",
38
- "dependencies": {
39
- },
40
38
  "devDependencies": {
41
- "rimraf": "^5.0.5",
39
+ "rimraf": "^6.1.3",
42
40
  "typescript": "^5.4.0"
43
41
  },
44
42
  "peerDependencies": {
45
- "@dfinity/agent": "^3.4.3",
46
- "@dfinity/principal": "^3.4.3"
43
+ "@icp-sdk/core": "^5.0.0"
47
44
  },
48
45
  "sideEffects": false
49
46
  }