@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 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-js/v0)
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 { user } from 'depends on npm or eik (see above)';
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 'depends on npm or eik (see above)';
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 build:rollup`
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;
@@ -0,0 +1,7 @@
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
+ export default log;