@amedia/user 0.13.12 → 0.13.15
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 +17 -9
- package/build.js +25 -0
- package/dist/clients/mercury.d.ts +0 -7
- package/dist/clients/mercuryLog.d.ts +7 -0
- package/dist/index.d.ts +696 -17
- package/dist/index.esm.js +15 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +7 -0
- package/dist/lib/UserDataRequest.spec.d.ts +1 -0
- package/eik.json +5 -4
- package/package.json +30 -39
- package/src/actions/userData.ts +7 -9
- package/src/clients/jupiter.spec.ts +1 -3
- package/src/clients/mercury.spec.ts +2 -23
- package/src/clients/mercury.ts +17 -59
- package/src/clients/mercuryLog.spec.ts +30 -0
- package/src/clients/mercuryLog.ts +56 -0
- package/src/clients/pluto.spec.ts +2 -5
- package/src/lib/UserDataRequest.spec.ts +71 -0
- package/src/utils/log.ts +1 -1
- package/tsconfig.eslint.json +2 -4
- package/tsconfig.json +2 -1
- package/amedia-user-js.iml +0 -9
- package/dist/cache/engines/indexeddb.d.ts +0 -7
- package/dist/index.js.LICENSE.txt +0 -14
- package/dist/lib/PaywallUnlocker.d.ts +0 -16
- package/dist/lib/PaywallUnlocker.spec.d.ts +0 -4
- package/dist/lib/User.d.ts +0 -21
- package/dist/utils/logValidationError.d.ts +0 -1
- package/rollup.config.js +0 -14
- package/test.html +0 -12
- package/webpack.config.js +0 -28
- /package/dist/{janitor/index.spec.d.ts → clients/mercuryLog.spec.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -4,15 +4,23 @@ Its goal is to simplify the complexity of logging in and
|
|
|
4
4
|
getting access to user related data.
|
|
5
5
|
|
|
6
6
|
# Usage
|
|
7
|
-
Add this project to yours either via npm (@amedia/user) or eik (https://assets.acdn.no/pkg/user
|
|
7
|
+
Add this project to yours either via npm (@amedia/user) or eik (https://assets.acdn.no/pkg/user/v0)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
UserDataRequest,
|
|
13
|
+
PaywallUnlockRequest,
|
|
14
|
+
goToLoginPage,
|
|
15
|
+
logout,
|
|
16
|
+
...etc,
|
|
17
|
+
} from 'depends on npm or eik (see above)';
|
|
12
18
|
```
|
|
13
19
|
|
|
14
20
|
## Subscribing to updates
|
|
15
21
|
```ts
|
|
22
|
+
import { UserDataRequest } from '...';
|
|
23
|
+
|
|
16
24
|
new UserDataRequest()
|
|
17
25
|
.withAttributes(['name', 'email'])
|
|
18
26
|
.withStorage(['my_namespace']) // You might know this as Europa
|
|
@@ -30,6 +38,8 @@ we get data in from the various services.
|
|
|
30
38
|
|
|
31
39
|
## Fetching all the data once (no rerenders)
|
|
32
40
|
```ts
|
|
41
|
+
import { UserDataRequest } from '...';
|
|
42
|
+
|
|
33
43
|
new UserDataRequest()
|
|
34
44
|
.withAttributes(['name', 'email'])
|
|
35
45
|
.withStorage(['my_namespace']) // You might know this as Europa
|
|
@@ -46,7 +56,7 @@ This is neat if you don't need to render fast as it reduces complexity in some s
|
|
|
46
56
|
|
|
47
57
|
## Updating storage
|
|
48
58
|
```ts
|
|
49
|
-
import { updateStorage } from '
|
|
59
|
+
import { updateStorage } from '...';
|
|
50
60
|
|
|
51
61
|
updateStorage({
|
|
52
62
|
my_namespace: {
|
|
@@ -58,6 +68,8 @@ The subscribe above will notify you when data has changed.
|
|
|
58
68
|
|
|
59
69
|
## Unlocking the paywall
|
|
60
70
|
```ts
|
|
71
|
+
import { PaywallUnlockRequest } from '...';
|
|
72
|
+
|
|
61
73
|
new PaywallUnlockRequest()
|
|
62
74
|
.redirectOnAccess('https://my.neat/place') // Optional
|
|
63
75
|
.reloadOnAccess() // Optional
|
|
@@ -155,9 +167,5 @@ Before publishing to Eik, you need to be logged in by running `eik/eik-login` in
|
|
|
155
167
|
To publish a new version do the following:
|
|
156
168
|
|
|
157
169
|
- Update version number in `eik.json` to the same version as in `package.json`
|
|
158
|
-
- Run `npm run
|
|
159
|
-
- Run `npx eik package
|
|
160
|
-
- Run `npx eik package-alias user-js <version from eik.json> <Alias version>`
|
|
161
|
-
|
|
162
|
-
`build:rollup` will package the internal modules into one big Javascript module that is ES compatible. `npx eik package`
|
|
163
|
-
will upload this module to Eik and `npx eik package-alias` will update the alias to point to the new version.
|
|
170
|
+
- Run `npm run eik:package` (no publishing will be done unless packages passes lint, typings, tests and builds successfully)
|
|
171
|
+
- Run `npx eik package-alias user <version from eik.json> <Alias version>`
|
package/build.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { build } = require('esbuild');
|
|
2
|
+
const { Generator } = require('npm-dts');
|
|
3
|
+
|
|
4
|
+
const shared = {
|
|
5
|
+
entryPoints: ['src/index.ts'],
|
|
6
|
+
bundle: true,
|
|
7
|
+
minify: true,
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
build({
|
|
12
|
+
...shared,
|
|
13
|
+
outfile: 'dist/index.js',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
build({
|
|
17
|
+
...shared,
|
|
18
|
+
outfile: 'dist/index.esm.js',
|
|
19
|
+
format: 'esm',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
new Generator({
|
|
23
|
+
entry: 'src/index.ts',
|
|
24
|
+
output: 'dist/index.d.ts',
|
|
25
|
+
}).generate();
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
declare const log: {
|
|
2
|
-
error: (message: string, context: Object) => void;
|
|
3
|
-
warn: (message: string, context: Object) => void;
|
|
4
|
-
info: (message: string, context: Object) => void;
|
|
5
|
-
debug: (message: string, context: Object) => void;
|
|
6
|
-
};
|
|
7
1
|
export declare class UserDeactivatedError extends Error {
|
|
8
2
|
}
|
|
9
3
|
export declare const activateSubscription: (accessFeatures: string[]) => Promise<string[]>;
|
|
10
|
-
export default log;
|