@suprsend/web-sdk 1.2.1 → 1.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suprsend/web-sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "This is sdk used to integrate suprsend functionality in javascript applications",
5
5
  "main": "dist/cjs_bundle.js",
6
6
  "scripts": {
package/src/index.d.ts CHANGED
@@ -58,7 +58,7 @@ interface PreferenceErrorData {
58
58
  error_obj?: Error | null;
59
59
  }
60
60
 
61
- interface GetPreferencesResponse extends PreferenceData, PreferenceErrorData {}
61
+ interface PreferencesResponse extends PreferenceData, PreferenceErrorData {}
62
62
 
63
63
  interface GetCategoriesResponse extends PreferenceErrorData {
64
64
  meta: { count: number; limit: number; offset: number };
@@ -72,9 +72,7 @@ interface GetOverAllChannelPreferencesResponse extends PreferenceErrorData {
72
72
  interface Preferences {
73
73
  data: PreferenceData;
74
74
 
75
- get_preferences(args?: {
76
- brand_id?: string;
77
- }): Promise<GetPreferencesResponse>;
75
+ get_preferences(args?: { brand_id?: string }): Promise<PreferencesResponse>;
78
76
 
79
77
  get_categories(args?: {
80
78
  brand_id?: string;
@@ -95,7 +93,7 @@ interface Preferences {
95
93
  args?: {
96
94
  brand_id?: string;
97
95
  }
98
- ): PreferenceData | PreferenceErrorData;
96
+ ): PreferencesResponse;
99
97
 
100
98
  update_channel_preference_in_category(
101
99
  channel: string,
@@ -104,12 +102,12 @@ interface Preferences {
104
102
  args?: {
105
103
  brand_id?: string;
106
104
  }
107
- ): PreferenceData | PreferenceErrorData;
105
+ ): PreferencesResponse;
108
106
 
109
107
  update_overall_channel_preference(
110
108
  channel: string,
111
109
  preference: ChannelLevelPreferenceOptions
112
- ): PreferenceData | PreferenceErrorData;
110
+ ): PreferencesResponse;
113
111
  }
114
112
 
115
113
  interface User {
@@ -148,6 +146,7 @@ interface User {
148
146
 
149
147
  export interface WebPush {
150
148
  register_push(): void;
149
+ notification_permission(): NotificationPermission;
151
150
  }
152
151
 
153
152
  export interface SuprSend {
package/src/web_push.js CHANGED
@@ -106,6 +106,10 @@ class WebPush {
106
106
  return !!subscription;
107
107
  };
108
108
 
109
+ notification_permission() {
110
+ return Notification.permission;
111
+ }
112
+
109
113
  // unsubscribe_push = () => {
110
114
  // navigator.serviceWorker.ready
111
115
  // .then((registration) => {