@expressms/smartapp-sdk 1.3.2 → 1.4.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.
Files changed (38) hide show
  1. package/README.md +82 -52
  2. package/build/main/index.d.ts +1 -1
  3. package/build/main/index.js +2 -2
  4. package/build/main/lib/client/index.d.ts +1 -1
  5. package/build/main/lib/client/index.js +2 -2
  6. package/build/main/lib/contacts/index.d.ts +1 -2
  7. package/build/main/lib/contacts/index.js +1 -1
  8. package/build/main/lib/index.d.ts +1 -4
  9. package/build/main/lib/index.js +1 -4
  10. package/build/main/lib/logging/index.d.ts +2 -2
  11. package/build/main/lib/logging/index.js +3 -3
  12. package/build/main/lib/notification/index.d.ts +0 -3
  13. package/build/main/lib/notification/index.js +1 -4
  14. package/build/main/types/bridge.d.ts +1 -1
  15. package/build/main/types/client.d.ts +3 -3
  16. package/build/main/types/contacts.d.ts +2 -2
  17. package/build/main/types/index.d.ts +4 -4
  18. package/build/module/index.d.ts +1 -1
  19. package/build/module/index.js +2 -2
  20. package/build/module/lib/client/index.d.ts +1 -1
  21. package/build/module/lib/client/index.js +2 -2
  22. package/build/module/lib/contacts/index.d.ts +1 -2
  23. package/build/module/lib/contacts/index.js +1 -1
  24. package/build/module/lib/index.d.ts +1 -4
  25. package/build/module/lib/index.js +3 -6
  26. package/build/module/lib/logging/index.d.ts +2 -2
  27. package/build/module/lib/logging/index.js +4 -4
  28. package/build/module/lib/notification/index.d.ts +0 -3
  29. package/build/module/lib/notification/index.js +3 -6
  30. package/build/module/lib/routing/index.js +1 -1
  31. package/build/module/types/bridge.d.ts +1 -1
  32. package/build/module/types/client.d.ts +3 -3
  33. package/build/module/types/contacts.d.ts +2 -2
  34. package/build/module/types/index.d.ts +4 -4
  35. package/build/module/types/index.js +4 -4
  36. package/build/umd/index.js +815 -18
  37. package/package.json +13 -21
  38. package/workers/workbox.js +0 -80
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressms/smartapp-sdk",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Smartapp SDK",
5
5
  "main": "build/main/index.js",
6
6
  "typings": "build/main/index.d.ts",
@@ -10,7 +10,6 @@
10
10
  "build:umd": "rollup -c",
11
11
  "build:main": "tsc -p tsconfig.json",
12
12
  "build:module": "tsc -p tsconfig.module.json",
13
- "postinstall": "npm update @expressms/smartapp-bridge",
14
13
  "test:lint": "eslint src --ext .ts",
15
14
  "test:prettier": "prettier \"src/**/*.ts\" --list-different"
16
15
  },
@@ -26,26 +25,20 @@
26
25
  "devDependencies": {
27
26
  "@rollup/plugin-commonjs": "^17.1.0",
28
27
  "@rollup/plugin-json": "^4.1.0",
29
- "@rollup/plugin-node-resolve": "^13.1.3",
30
- "@typescript-eslint/eslint-plugin": "^4.0.1",
31
- "@typescript-eslint/parser": "^4.0.1",
32
- "eslint": "^7.8.0",
33
- "eslint-config-prettier": "^8.5.0",
28
+ "@rollup/plugin-node-resolve": "^13.3.0",
29
+ "@typescript-eslint/eslint-plugin": "^4.33.0",
30
+ "@typescript-eslint/parser": "^4.33.0",
31
+ "eslint": "^7.32.0",
32
+ "eslint-config-prettier": "^8.10.0",
34
33
  "eslint-plugin-eslint-comments": "^3.2.0",
35
- "eslint-plugin-import": "^2.22.0",
36
- "prettier": "^2.1.1",
37
- "rollup": "^2.39.1",
38
- "tslib": "^2.1.0",
39
- "typescript": "^4.0.2"
34
+ "eslint-plugin-import": "^2.29.0",
35
+ "prettier": "^2.8.8",
36
+ "rollup": "^2.79.1",
37
+ "tslib": "^2.6.2",
38
+ "typescript": "^4.9.5"
40
39
  },
41
40
  "dependencies": {
42
- "@expressms/smartapp-bridge": "^1.2.1",
43
- "workbox-cacheable-response": "^6.5.4",
44
- "workbox-expiration": "^6.5.4",
45
- "workbox-precaching": "^6.5.4",
46
- "workbox-routing": "^6.5.4",
47
- "workbox-strategies": "^6.5.4",
48
- "workbox-webpack-plugin": "^5.1.4"
41
+ "@expressms/smartapp-bridge": "1.2.3"
49
42
  },
50
43
  "files": [
51
44
  "build/main",
@@ -54,7 +47,6 @@
54
47
  ".npmrc",
55
48
  "README.md",
56
49
  "!**/*.spec.*",
57
- "!**/*.json",
58
- "workers/workbox.js"
50
+ "!**/*.json"
59
51
  ]
60
52
  }
@@ -1,80 +0,0 @@
1
- import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin'
2
- import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin'
3
- import { precacheAndRoute } from 'workbox-precaching'
4
- import { registerRoute } from 'workbox-routing/registerRoute'
5
- import { CacheFirst } from 'workbox-strategies/CacheFirst'
6
-
7
- // need for uniq cache of each smart app
8
- const LOCATION_HREF = self.location.href
9
- const CACHE_NAME = `cache_smart_app_${LOCATION_HREF}`
10
- const INDEX_URL = './index.html'
11
-
12
- const isIndexPage = (url) => url.match(/\/index\.html/)
13
-
14
- precacheAndRoute(self.__WB_MANIFEST)
15
-
16
- registerRoute(
17
- ({ url }) => !isIndexPage(url.pathname),
18
- new CacheFirst({
19
- cacheName: `workbox_smart_app_${LOCATION_HREF}`,
20
- plugins: [
21
- new ExpirationPlugin({
22
- maxAgeSeconds: 60 * 60 * 24 * 3, // 3 days
23
- }),
24
- new CacheableResponsePlugin({
25
- statuses: [0, 200],
26
- }),
27
- ],
28
- }),
29
- )
30
-
31
- self.addEventListener('activate', (event) => {
32
- // make claim for first load page fetch listening
33
- event.waitUntil(self.clients.claim())
34
- })
35
-
36
-
37
- self.addEventListener('fetch', event => {
38
- if (!isIndexPage(event.request.url)) return
39
- // handle url request
40
- event.respondWith(
41
- // Open the cache
42
- caches.open(CACHE_NAME)
43
- .then(cache => {
44
- // Go to the network first
45
- return fetch(event.request)
46
- .then(fetchedResponse => {
47
- // cache index response
48
- cache.put(INDEX_URL, fetchedResponse.clone())
49
- return fetchedResponse
50
- })
51
- .catch(() => {
52
- // If the network is unavailable, get
53
- return cache.match(INDEX_URL)
54
- })
55
- }),
56
- )
57
- })
58
-
59
- self.addEventListener('install', event => {
60
- event.waitUntil(
61
- // open cache
62
- caches.open(CACHE_NAME)
63
- .then(cache => {
64
- return cache.match(URL)
65
- .then(cachedResponse => {
66
- // already cache skip
67
- if (cachedResponse) {
68
- return true
69
- }
70
- const request = new Request(INDEX_URL)
71
- // fetch index url and cache it
72
- return fetch(request)
73
- .then(fetchedResponse => {
74
- cache.put(INDEX_URL, fetchedResponse.clone())
75
- return fetchedResponse
76
- })
77
- })
78
- }),
79
- )
80
- })