@pushwoosh/session-store 1.0.0

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.
@@ -0,0 +1,207 @@
1
+ export declare type AccountData = {
2
+ name: string;
3
+ isEnterprise: boolean;
4
+ expireDate: string;
5
+ frozen: boolean;
6
+ productType: string;
7
+ admin: boolean;
8
+ restriction: string;
9
+ maxUsers: number;
10
+ tagsCount: number;
11
+ maxTags: number;
12
+ filtersCount: number;
13
+ maxFilters: number;
14
+ applicationsCount: number;
15
+ maxApplications: number;
16
+ appGroupsCount: number;
17
+ maxAppGroups: number;
18
+ totalSubscribers: number;
19
+ MAU: number;
20
+ calendarMAU: number;
21
+ lastMAU: number;
22
+ MAD: number;
23
+ calendarMAD: number;
24
+ lastMAD: number;
25
+ pushAvailableSubscribers: number;
26
+ pushNotAvailableSubscribers: number;
27
+ maxDevices: number;
28
+ maxPreparedFilters: number;
29
+ geoZonesCount: number;
30
+ maxGeoZones: number;
31
+ maxGeozoneRange: number;
32
+ minGeozoneRange: number;
33
+ campaignsCount: number;
34
+ maxCampaigns: number;
35
+ presetsCount: number;
36
+ maxPresets: number;
37
+ testDevicesCount: number;
38
+ maxTestDevices: number;
39
+ beaconsCount: number;
40
+ maxBeacons: number;
41
+ autoPushesCount: number;
42
+ maxAutoPushes: number;
43
+ autoEmailsCount: number;
44
+ maxAutoEmails: number;
45
+ rssFeedsCount: number;
46
+ maxRssFeeds: number;
47
+ twitterFeedsCount: number;
48
+ maxTwitterFeeds: number;
49
+ allowCustomRssPollingInterval: boolean;
50
+ inAppsCount: number;
51
+ maxInApps: number;
52
+ eventsCount: number;
53
+ maxEvents: number;
54
+ deeplinksCount: number;
55
+ maxDeeplinks: number;
56
+ richMediaCount: number;
57
+ maxRichMedia: number;
58
+ emailTemplatesCount: number;
59
+ maxEmailTemplates: number;
60
+ accountMailsCount: number;
61
+ maxEmailMails: number;
62
+ accountDomainsCount: number;
63
+ maxAccountDomains: number;
64
+ triggeredMessagesCount: number;
65
+ currentOrder: null;
66
+ isUnderSu: boolean;
67
+ ACESeeApplications: boolean;
68
+ ACEModifyApplications: boolean;
69
+ ACESeeAppGroups: boolean;
70
+ ACEModifyAppGroups: boolean;
71
+ ACESeeMessages: boolean;
72
+ ACEModifyMessages: boolean;
73
+ ACESendMessages: boolean;
74
+ ACESeeFilters: boolean;
75
+ ACEModifyFilters: boolean;
76
+ ACESeeTags: boolean;
77
+ ACEModifyTags: boolean;
78
+ ACESeeRichMedia: boolean;
79
+ ACEModifyRichMedia: boolean;
80
+ ACESeeEmailTemplates: boolean;
81
+ ACEModifyEmailTemplates: boolean;
82
+ ACESuperRight: boolean;
83
+ ACEManageUsers: boolean;
84
+ ACEManageSubscription: boolean;
85
+ ACESeeAPIAccess: boolean;
86
+ ACEDomainAndEmailVerification: boolean;
87
+ hasActiveOrder: boolean;
88
+ maxPushOnEventDelayInDays: number;
89
+ maxTriggeredMessagePresets: number;
90
+ maxInboxTtlDays: number;
91
+ messageHistoryStorePeriod: number;
92
+ allowBackup: boolean;
93
+ allowDeeplinks: boolean;
94
+ allowAPI: boolean;
95
+ allowStatsAccess: boolean;
96
+ allowScheduling: boolean;
97
+ allowCustomData: boolean;
98
+ allowAutoConfig: boolean;
99
+ allowAppGroups: boolean;
100
+ allowTwoFactorAuth: boolean;
101
+ allowCSVMessage: boolean;
102
+ allowPushOnEvent: boolean;
103
+ allowCampaigns: boolean;
104
+ allowPresets: boolean;
105
+ allowGeozones: boolean;
106
+ allowAutoPushes: boolean;
107
+ allowAutoEmails: boolean;
108
+ allowBeacons: boolean;
109
+ allowTwitterFeeds: boolean;
110
+ allowRSSFeeds: boolean;
111
+ allowSubUsers: boolean;
112
+ allowTestDevices: boolean;
113
+ allowEvents: boolean;
114
+ allowInApps: boolean;
115
+ allowFilters: boolean;
116
+ allowAbTests: boolean;
117
+ allowTags: boolean;
118
+ allowHtmlPages: boolean;
119
+ allowRichMedia: boolean;
120
+ allowUseEmailPlatform: boolean;
121
+ allowIOSCategories: boolean;
122
+ allowFilterCompiling: boolean;
123
+ allowGoalTracking: boolean;
124
+ allowUseIEPlatform: boolean;
125
+ allowUseUserSpecificTags: boolean;
126
+ allowDynamicContent: boolean;
127
+ allowPlatforms: Array<number>;
128
+ allowDebugMode: boolean;
129
+ isConfiguredForBlackberry: boolean;
130
+ isConfiguredForBaiduAndroid: boolean;
131
+ registrationDate: string;
132
+ allowTagNotSetFilter: boolean;
133
+ allowTrackingUninstall: boolean;
134
+ allowFrequencyCapping: boolean;
135
+ allowInbox: boolean;
136
+ allowChannels: boolean;
137
+ allowUseRemotePage: boolean;
138
+ allowSendToGeoZone: boolean;
139
+ allowSendExternalStats: boolean;
140
+ allowGDPR: boolean;
141
+ sendRateMin: number;
142
+ sendRateMax: number;
143
+ isDeviceLimitReached: boolean;
144
+ dailyEmailStat: number;
145
+ monthlyEmailStat: number;
146
+ lastEmailStat: number;
147
+ freeEmailQuota: number;
148
+ freeEmailLimit: number;
149
+ freeEmailLimitUpdateDate: string;
150
+ paidEmailQuota?: number;
151
+ paidEmailExpireDate?: string;
152
+ readonly billingAddress: {
153
+ account_company_name: string;
154
+ company_name?: string;
155
+ country?: string;
156
+ country_code?: string;
157
+ state?: string;
158
+ state_code?: string;
159
+ city?: string;
160
+ street?: string;
161
+ zip?: string;
162
+ phone?: string;
163
+ vat_number?: string;
164
+ company_number?: string;
165
+ first_name: string;
166
+ last_name: string;
167
+ paymentEmail?: string;
168
+ secondary_person_first_name?: string;
169
+ secondary_person_last_name?: string;
170
+ secondary_person_email?: string;
171
+ industry?: string;
172
+ department?: string;
173
+ additionalEmails?: string;
174
+ };
175
+ ssoAccessToken: {
176
+ access_token: string;
177
+ account_id: number;
178
+ username: string;
179
+ };
180
+ allowContentTemplates: boolean;
181
+ enableCDPLink: boolean;
182
+ allowLegacyCP: boolean;
183
+ allowNewSendPushForm: boolean;
184
+ allowPushByUser: boolean;
185
+ allowMultiLanguage: boolean;
186
+ isTwoFactorAuthEnabled: boolean;
187
+ isAllowTopBanner: boolean;
188
+ userAlerts: Array<unknown>;
189
+ canUsePacks: boolean;
190
+ hasPersonalizationPack: boolean;
191
+ hasMarketingPack: boolean;
192
+ isAccountLocked: boolean;
193
+ };
194
+ export declare type UserData = {
195
+ readonly username: string;
196
+ readonly email: string;
197
+ readonly isActive: boolean;
198
+ readonly timezone: string;
199
+ readonly timezoneOffset: string;
200
+ readonly accountsCount: number;
201
+ readonly allowNewsletters: boolean;
202
+ readonly allowDailyStatsGlobal: boolean;
203
+ readonly allowNotificationSubscribers: boolean;
204
+ readonly allowNotificationIosLicense: boolean;
205
+ readonly allowNotificationUserInactivity: boolean;
206
+ readonly allowNotificationDisablePlatform: boolean;
207
+ };
@@ -0,0 +1,43 @@
1
+ import { Subscription } from 'rxjs';
2
+ import { HttpClient } from '@pushwoosh/http-client';
3
+ import { Session } from './session-store.types';
4
+ /**
5
+ * Хранилище сеанса.
6
+ */
7
+ export declare class SessionStore {
8
+ /**
9
+ * Клиент для работы с http запросами.
10
+ */
11
+ private readonly httpClient;
12
+ /**
13
+ * "Наблюдаемый объект" сеанса.
14
+ */
15
+ private readonly subject;
16
+ /**
17
+ * Создать экземпляр класса SessionStore.
18
+ *
19
+ * @param { HttpClient } httpClient - клиент для работы с http запросами.
20
+ */
21
+ constructor(httpClient: HttpClient);
22
+ /**
23
+ * Обновить "Наблюдаемый объект" текущего сеанса.
24
+ */
25
+ private updateSubject;
26
+ /**
27
+ * Загрузить данные об аккаунте и пользователе.
28
+ *
29
+ * @return { [*, *, *] } - данные об аккаунте и пользователе.
30
+ */
31
+ private load;
32
+ /**
33
+ * Обновить сеанс.
34
+ */
35
+ update: () => Promise<void>;
36
+ /**
37
+ * Подписаться на изменение сеанса.
38
+ *
39
+ * @param { Function } callback - колбэк, который будет вызван при изменении сеанса.
40
+ * @return { Subscription } - подписка на изменение сеанса.
41
+ */
42
+ subscribe: (callback: (session: Session) => any) => Subscription;
43
+ }
@@ -0,0 +1,12 @@
1
+ import { Account } from './entities/account';
2
+ import { Permissions } from './entities/permissions';
3
+ import { Platforms } from './entities/platforms';
4
+ import { Restrictions } from './entities/restrictions';
5
+ import { User } from './entities/user';
6
+ export declare type Session = {
7
+ readonly account: Account;
8
+ readonly permissions: Permissions;
9
+ readonly platforms: Platforms;
10
+ readonly restrictions: Restrictions;
11
+ readonly user: User;
12
+ };
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@pushwoosh/session-store",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "start": "npm run development",
12
+ "build": "npm run production",
13
+ "development": "cross-env NODE_ENV=development webpack-dev-server --config webpack.development.config.js",
14
+ "production": "cross-env NODE_ENV=production webpack --config webpack.production.config.js",
15
+ "check": "npm run check:lint && npm run check:types && npm run check:tests",
16
+ "check:lint": "echo \"Run check:lint\" && eslint .",
17
+ "check:tests": "echo \"Run check:tests\" && jest --passWithNoTests",
18
+ "check:types": "echo \"Run check:types\" && tsc --project tsconfig.json --noEmit"
19
+ },
20
+ "pre-commit": "check",
21
+ "dependencies": {
22
+ "@babel/runtime-corejs3": "^7.16.5",
23
+ "core-js": "^3.20.0"
24
+ },
25
+ "devDependencies": {
26
+ "@babel/core": "^7.16.5",
27
+ "@babel/plugin-transform-runtime": "^7.16.5",
28
+ "@babel/preset-env": "^7.16.5",
29
+ "@pushwoosh/http-client": "^1.0.0",
30
+ "@types/jest": "^26.0.24",
31
+ "@types/webpack-env": "^1.16.3",
32
+ "@typescript-eslint/eslint-plugin": "^4.33.0",
33
+ "@typescript-eslint/parser": "^4.33.0",
34
+ "axios": "^0.24.0",
35
+ "babel-loader": "^8.2.3",
36
+ "clean-webpack-plugin": "^3.0.0",
37
+ "cross-env": "^7.0.3",
38
+ "dotenv": "^10.0.0",
39
+ "eslint": "^7.32.0",
40
+ "eslint-config-airbnb": "^18.2.1",
41
+ "eslint-config-airbnb-typescript": "^14.0.2",
42
+ "eslint-import-resolver-alias": "^1.1.2",
43
+ "eslint-plugin-import": "^2.25.3",
44
+ "eslint-plugin-jsx-a11y": "^6.5.1",
45
+ "eslint-plugin-react": "^7.27.1",
46
+ "eslint-plugin-react-hooks": "^4.3.0",
47
+ "history": "^4.10.1",
48
+ "jest": "^26.6.3",
49
+ "pre-commit": "^1.2.2",
50
+ "rxjs": "^7.5.2",
51
+ "terser-webpack-plugin": "^4.2.3",
52
+ "ts-jest": "^26.5.6",
53
+ "ts-loader": "^8.3.0",
54
+ "tslib": "^2.3.1",
55
+ "typescript": "^4.5.4",
56
+ "webpack": "^4.46.0",
57
+ "webpack-cli": "^3.3.12",
58
+ "webpack-config-single-spa": "^1.18.3",
59
+ "webpack-dev-server": "^3.11.3",
60
+ "webpack-merge": "^5.8.0"
61
+ },
62
+ "peerDependencies": {
63
+ "@pushwoosh/http-client": "^1.0.0",
64
+ "rxjs": "^7.5.2",
65
+ "tslib": "^2.3.1"
66
+ },
67
+ "engines": {
68
+ "node": ">= 14"
69
+ }
70
+ }