pushwave-client 0.3.9 → 0.3.10

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.
@@ -1,2 +1,5 @@
1
1
  import { IdentifyOptions, IdentifyResponse } from "./identify.dto";
2
+ /**
3
+ * Link a userId to the current installation. Requires a successful registerPushWave/init call.
4
+ */
2
5
  export declare function identify({ userId }: IdentifyOptions): Promise<IdentifyResponse>;
@@ -8,6 +8,9 @@ const fetch_1 = require("../utils/fetch");
8
8
  const pwLogger_1 = require("../utils/pwLogger");
9
9
  const installationId_1 = require("../utils/installationId");
10
10
  const getApiKey_1 = require("../utils/getApiKey");
11
+ /**
12
+ * Link a userId to the current installation. Requires a successful registerPushWave/init call.
13
+ */
11
14
  async function identify({ userId }) {
12
15
  const response = { success: false };
13
16
  if (!register_1.IS_INITIALIZED) {
package/dist/index.d.ts CHANGED
@@ -3,10 +3,32 @@ import { IdentifyOptions, IdentifyResponse } from "./identify";
3
3
  import { LogoutResponse } from "./logout";
4
4
  import { GetUserAttributesResponse, SetUserAttributes, SetUserAttributesResponse } from "./userAttributes";
5
5
  export interface PushWaveClientType {
6
+ /**
7
+ * Initialize PushWave for this installation. Must be called once at app startup.
8
+ * - Requests push permissions + Expo push token.
9
+ * - Collects device/app metadata and attestation.
10
+ * - Caches the API key (SecureStore when available) and marks the client initialized.
11
+ */
6
12
  init(options: RegisterPushWaveClient): Promise<RegisterPushWaveResponse>;
13
+ /**
14
+ * Attach a userId to the current installation for targeting/analytics.
15
+ * Requires `init` to have run successfully in this session.
16
+ */
7
17
  identify(options: IdentifyOptions): Promise<IdentifyResponse>;
18
+ /**
19
+ * Unlink the current installation from the backend (e.g., on logout).
20
+ * Requires `init` to have run successfully in this session.
21
+ */
8
22
  logout(): Promise<LogoutResponse>;
23
+ /**
24
+ * Set custom attributes for the current user/installation.
25
+ * Requires `init` to have run successfully in this session.
26
+ */
9
27
  setUserAttributes(options: SetUserAttributes): Promise<SetUserAttributesResponse>;
28
+ /**
29
+ * Fetch stored attributes for the current user/installation.
30
+ * Requires `init` to have run successfully in this session.
31
+ */
10
32
  getUserAttributes(): Promise<GetUserAttributesResponse>;
11
33
  }
12
34
  declare const PushWaveClient: PushWaveClientType;
@@ -1,2 +1,5 @@
1
1
  import { LogoutResponse } from "./logout.dto";
2
+ /**
3
+ * Unregister the current installation (e.g., on user logout). Requires a successful init.
4
+ */
2
5
  export declare function logout(): Promise<LogoutResponse>;
@@ -8,6 +8,9 @@ const installationId_1 = require("../utils/installationId");
8
8
  const pwLogger_1 = require("../utils/pwLogger");
9
9
  const fetch_1 = require("../utils/fetch");
10
10
  const getApiKey_1 = require("../utils/getApiKey");
11
+ /**
12
+ * Unregister the current installation (e.g., on user logout). Requires a successful init.
13
+ */
11
14
  async function logout() {
12
15
  const response = { success: false };
13
16
  if (!register_1.IS_INITIALIZED) {
@@ -2,4 +2,9 @@ import { RegisterPushWaveClient, RegisterPushWaveResponse } from "./registerPush
2
2
  export declare var IS_INITIALIZED: boolean;
3
3
  export declare const API_STORAGE_KEY = "pushwave-api-storage-key";
4
4
  export declare var CACHE_API_KEY: string | false;
5
+ /**
6
+ * Initialize PushWave for this installation: retrieves the Expo push token, collects
7
+ * attestation + device metadata, persists the API key when SecureStore is available,
8
+ * and caches initialization state for subsequent calls.
9
+ */
5
10
  export declare function registerPushWave({ apiKey }: RegisterPushWaveClient): Promise<RegisterPushWaveResponse>;
@@ -14,6 +14,11 @@ const loadSecureStore_1 = require("../utils/loadSecureStore");
14
14
  exports.IS_INITIALIZED = false;
15
15
  exports.API_STORAGE_KEY = "pushwave-api-storage-key";
16
16
  exports.CACHE_API_KEY = false;
17
+ /**
18
+ * Initialize PushWave for this installation: retrieves the Expo push token, collects
19
+ * attestation + device metadata, persists the API key when SecureStore is available,
20
+ * and caches initialization state for subsequent calls.
21
+ */
17
22
  async function registerPushWave({ apiKey }) {
18
23
  const OS = react_native_1.Platform.OS;
19
24
  if ((0, apiKeyCheck_1.isSecretKey)(apiKey)) {
@@ -1,3 +1,9 @@
1
1
  import { GetUserAttributesResponse, SetUserAttributes, SetUserAttributesResponse } from "./userAttributes.dto";
2
+ /**
3
+ * Set custom attributes for the current user/installation. Requires a successful init.
4
+ */
2
5
  export declare function setUserAttributes(attributes: SetUserAttributes): Promise<SetUserAttributesResponse>;
6
+ /**
7
+ * Retrieve attributes for the current user/installation. Requires a successful init.
8
+ */
3
9
  export declare function getUserAttributes(): Promise<GetUserAttributesResponse>;
@@ -9,6 +9,9 @@ const getApiKey_1 = require("../utils/getApiKey");
9
9
  const installationId_1 = require("../utils/installationId");
10
10
  const pwLogger_1 = require("../utils/pwLogger");
11
11
  const fetch_1 = require("../utils/fetch");
12
+ /**
13
+ * Set custom attributes for the current user/installation. Requires a successful init.
14
+ */
12
15
  async function setUserAttributes(attributes) {
13
16
  const response = { success: false };
14
17
  if (!register_1.IS_INITIALIZED) {
@@ -50,6 +53,9 @@ async function setUserAttributes(attributes) {
50
53
  };
51
54
  }
52
55
  }
56
+ /**
57
+ * Retrieve attributes for the current user/installation. Requires a successful init.
58
+ */
53
59
  async function getUserAttributes() {
54
60
  if (!register_1.IS_INITIALIZED) {
55
61
  const msg = `PushWaveClient.init({ apiKey }) must be called before PushWaveClient.getUserAttributes`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushwave-client",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "PushWave Client, Expo Push Notifications SaaS SDK",
5
5
  "homepage": "https://github.com/luruk-hai/pushwave-client#readme",
6
6
  "bugs": {