buzzcasting-storage 1.0.3 → 1.0.6

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  This is a wrapper class to use multiple storage options with BuzzCasting.
4
4
 
5
+ BuzzCasting Social Media Wall & Dataviz [More info](https://www.touchflows.com/services-buzzcasting-social-media-wall/).
6
+
5
7
  Currently supported are: Local Storage, Session Storage, IDB Keyval, Dexie, Window object
6
8
 
7
9
  ## Features
@@ -17,37 +19,61 @@ Currently supported are: Local Storage, Session Storage, IDB Keyval, Dexie, Wind
17
19
  ## Get started
18
20
 
19
21
  Example call:
22
+
20
23
  ```js
21
- import BuzzcastingStorageManager, { IQuery, IStorageManager } from 'buzzcasting-storage'
24
+ import BuzzcastingStorageManager, {
25
+ IQuery,
26
+ IStorageManager,
27
+ IMessages,
28
+ } from "buzzcasting-storage";
22
29
 
23
30
  const options: IStorageManager = {
24
- app: 'my-subdomain',
25
- version: 'v4',
26
- token: 'meta',
27
- bearer: 'bearer_token',
28
- storage: 'dexie',
29
- moderation: 'none',
31
+ app: "my-subdomain",
32
+ version: "v4",
33
+ token: "meta",
34
+ bearer: "bearer_token",
35
+ storage: "dexie",
36
+ moderation: "none",
30
37
  beforeTime: null,
31
38
  delay: 0,
32
39
  period: 0,
33
40
  };
34
41
 
35
- let storageManager = new BuzzcastingStorageManager(options)
42
+ let storageManager = new BuzzcastingStorageManager(options);
36
43
 
37
44
  const query: IQuery = {
38
- type: 'messages',
39
- dashboard: 'dashboard_id',
40
- widget: 'widget_id'
41
- }
45
+ type: "messages",
46
+ dashboard: "dashboard_id",
47
+ widget: "widget_id",
48
+ };
42
49
 
43
- const data = storageManager.getMessages(query)
50
+ const data: IMessages = storageManager.getMessages(query);
44
51
  ```
45
52
 
46
53
  This will initiate a call to the buzzcasting backoffice to retrieve results
47
54
 
48
- ### GitHub Template
55
+ The Storage Manager will carry out the API call for the subscriber, and send out a BroadcastChannel on `app` to inform the subcriber that it can retrieve new data. The broadcast channel facilitates its incorporation in for example a Web Worker.
49
56
 
50
- This is a template repo. Click the green [Use this template](https://github.com/hywax/vite-vanilla-library-template/generate) button to get started.
57
+ ```js
58
+
59
+ const broadcastChannel = new BroadcastChannel('my-subdomain')
60
+
61
+ broadcastChannel.onmessage = (messageEvent: MessageEvent) => {
62
+ this.actions(messageEvent)
63
+ }
64
+
65
+ actions = (messageEvent: MessageEvent) => {
66
+ switch (messageEvent.data.event) {
67
+ case 'widget-update':
68
+ // handle update
69
+ this.widgetUpdated.emit(messageEvent.data.data)
70
+ break
71
+ default:
72
+ //console.log('[storage]', messageEvent.data)
73
+ }
74
+ }
75
+
76
+ ```
51
77
 
52
78
  ### Git Clone
53
79
 
@@ -55,7 +81,7 @@ This is a template repo. Click the green [Use this template](https://github.com/
55
81
  git clone https://github.com/TouchFlows/buzzcasting-storage.git
56
82
  cd buzzcasting-storage
57
83
  pnpm install
58
- ```
84
+ ````
59
85
 
60
86
  ## Usage
61
87
 
@@ -15,27 +15,57 @@ declare class BuzzcastingStorageManager {
15
15
  }
16
16
  export default BuzzcastingStorageManager;
17
17
 
18
- declare interface IQuery {
18
+ export declare const CLOUD = "cloud";
19
+
20
+ export declare interface Dynamics {
21
+ uniquecomments: number;
22
+ engagement: number;
23
+ likesandvotes: number;
24
+ viewcount: number;
25
+ inboundlinks: number;
26
+ forumthread: number;
27
+ shares: number;
28
+ favourite: number;
29
+ semrush_visits?: number;
30
+ potential_reach?: number;
31
+ }
32
+
33
+ export declare interface Geo {
34
+ latitude: number;
35
+ longitude: number;
36
+ zip: string;
37
+ street: string;
38
+ city: string;
39
+ country: string;
40
+ }
41
+
42
+ export declare interface IMessages {
43
+ success?: boolean;
44
+ message?: string;
45
+ data?: Message[];
46
+ }
47
+
48
+ export declare interface IQuery {
19
49
  [x: string]: any;
20
50
  topics?: string;
21
51
  dashboard?: string;
22
52
  widget?: string;
23
53
  compare?: string;
24
54
  period?: number;
25
- type?: 'cloud' | 'messages' | 'indicators' | 'proxy';
55
+ type?: "cloud" | "messages" | "indicators" | "proxy";
26
56
  order?: string;
27
57
  media?: number;
28
58
  dynamics?: number;
29
59
  geo?: number;
30
60
  delay?: string;
31
61
  approved?: string;
32
- moderation?: 'realtime' | 'delayed' | 'approved';
62
+ moderation?: "realtime" | "delayed" | "approved";
33
63
  hrm?: string;
34
64
  before?: number;
35
65
  since?: number;
36
66
  }
37
67
 
38
- declare interface IStorageManager {
68
+ export declare interface IStorageManager {
39
69
  app: string;
40
70
  version: string;
41
71
  storage: string;
@@ -51,4 +81,75 @@ declare interface IStorageManager {
51
81
  retention?: number;
52
82
  }
53
83
 
84
+ export declare interface Medium {
85
+ type: string;
86
+ url: string;
87
+ width: number;
88
+ height: number;
89
+ }
90
+
91
+ export declare interface Message {
92
+ id: string;
93
+ published: string;
94
+ harvested: string;
95
+ utc: number;
96
+ channel: string;
97
+ type: string;
98
+ sender: Sender;
99
+ reply: string;
100
+ replyto: string;
101
+ page: string;
102
+ conversation: string;
103
+ title: string;
104
+ content: string;
105
+ sentiment: number;
106
+ link: string;
107
+ language: string;
108
+ region: string;
109
+ topics: Topic[];
110
+ dynamics?: Dynamics;
111
+ geo?: Geo;
112
+ media?: Medium[];
113
+ }
114
+
115
+ export declare const MESSAGES = "messages";
116
+
117
+ export declare interface Sender {
118
+ id: string;
119
+ title: string;
120
+ name: string;
121
+ avatar: string;
122
+ bio: string;
123
+ location: string;
124
+ verified: number;
125
+ following: number;
126
+ followers: number;
127
+ listed: number;
128
+ favourites: number;
129
+ messages: number;
130
+ influence: number;
131
+ }
132
+
133
+ export declare const SERIES = "series";
134
+
135
+ export declare const STORAGE_DEXIE = "dexie";
136
+
137
+ export declare const STORAGE_KEYVAL = "keyval";
138
+
139
+ export declare const STORAGE_LOCAL = "local";
140
+
141
+ export declare const STORAGE_SESSION = "session";
142
+
143
+ export declare const STORAGE_WINDOW = "window";
144
+
145
+ export declare interface Topic {
146
+ topic: string;
147
+ engagement: number;
148
+ impressions: number;
149
+ reach: number;
150
+ sentiment: number;
151
+ }
152
+
153
+ export declare const TOPICS = "topics";
154
+
54
155
  export { }