@everymatrix/user-actions 0.0.1 → 1.0.69

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 (48) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-ac3a63b0.js +851 -0
  3. package/dist/cjs/loader.cjs.js +6 -12
  4. package/dist/cjs/user-actions.cjs.entry.js +60 -46
  5. package/dist/cjs/user-actions.cjs.js +16 -10
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/user-actions/index.js +1 -0
  8. package/dist/collection/components/user-actions/user-actions.js +100 -86
  9. package/dist/collection/utils/utils.js +20 -12
  10. package/dist/esm/app-globals-0f993ce5.js +3 -0
  11. package/dist/esm/index-ab1e2c3f.js +826 -0
  12. package/dist/esm/loader.js +6 -12
  13. package/dist/esm/user-actions.entry.js +60 -46
  14. package/dist/esm/user-actions.js +13 -10
  15. package/dist/stencil.config.dev.js +17 -0
  16. package/dist/stencil.config.js +14 -19
  17. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-actions/.stencil/packages/stencil/user-actions/stencil.config.d.ts +2 -0
  18. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-actions/.stencil/packages/stencil/user-actions/stencil.config.dev.d.ts +2 -0
  19. package/dist/types/components/user-actions/index.d.ts +1 -0
  20. package/dist/types/components/user-actions/user-actions.d.ts +9 -9
  21. package/dist/types/stencil-public-runtime.d.ts +142 -33
  22. package/dist/types/utils/utils.d.ts +20 -12
  23. package/dist/user-actions/p-307d13e2.js +2 -0
  24. package/dist/user-actions/p-e1255160.js +1 -0
  25. package/dist/user-actions/p-f2e74cc7.entry.js +1 -0
  26. package/dist/user-actions/user-actions.esm.js +1 -1
  27. package/loader/cdn.js +1 -3
  28. package/loader/index.cjs.js +1 -3
  29. package/loader/index.d.ts +13 -1
  30. package/loader/index.es2017.js +1 -3
  31. package/loader/index.js +1 -3
  32. package/loader/package.json +1 -0
  33. package/package.json +8 -1
  34. package/dist/cjs/index-46c0a1de.js +0 -791
  35. package/dist/components/index.d.ts +0 -26
  36. package/dist/components/index.js +0 -1
  37. package/dist/components/user-actions.d.ts +0 -11
  38. package/dist/components/user-actions.js +0 -79
  39. package/dist/esm/index-6c13c021.js +0 -767
  40. package/dist/esm/polyfills/core-js.js +0 -11
  41. package/dist/esm/polyfills/css-shim.js +0 -1
  42. package/dist/esm/polyfills/dom.js +0 -79
  43. package/dist/esm/polyfills/es5-html-element.js +0 -1
  44. package/dist/esm/polyfills/index.js +0 -34
  45. package/dist/esm/polyfills/system.js +0 -6
  46. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/user-actions/.stencil/packages/user-actions/stencil.config.d.ts +0 -2
  47. package/dist/user-actions/p-02573b9e.entry.js +0 -1
  48. package/dist/user-actions/p-d8d5dc61.js +0 -1
@@ -1,17 +1,11 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-6c13c021.js';
1
+ import { b as bootstrapLazy } from './index-ab1e2c3f.js';
2
+ export { s as setNonce } from './index-ab1e2c3f.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
2
4
 
3
- /*
4
- Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
5
- */
6
- const patchEsm = () => {
7
- return promiseResolve();
8
- };
9
-
10
- const defineCustomElements = (win, options) => {
11
- if (typeof window === 'undefined') return Promise.resolve();
12
- return patchEsm().then(() => {
5
+ const defineCustomElements = async (win, options) => {
6
+ if (typeof window === 'undefined') return undefined;
7
+ await globalScripts();
13
8
  return bootstrapLazy([["user-actions",[[1,"user-actions",{"endpoint":[1],"userid":[1],"actionStack":[32]},[[8,"message","handleEvent"]]]]]], options);
14
- });
15
9
  };
16
10
 
17
11
  export { defineCustomElements };
@@ -1,57 +1,71 @@
1
- import { r as registerInstance } from './index-6c13c021.js';
1
+ import { r as registerInstance } from './index-ab1e2c3f.js';
2
2
 
3
3
  const actionsMapping = {
4
- "verification-popup": {
5
- "emit": "openKycVerificationModal",
6
- "listen": "closeKycVerificationModal"
7
- },
8
- "get-temporary-account-consents": {
9
- "emit": "openTemporaryConsentsModal",
10
- "listen": "closeTemporaryConsentsModal"
11
- },
12
- "limits-popup": {
13
- "emit": "openLugasPopup",
14
- "listen": "closeLugasPopup"
15
- },
4
+ "verification-popup": {
5
+ "emit": "openKycVerificationModal",
6
+ "listen": "closeKycVerificationModal"
7
+ },
8
+ "get-temporary-account-consents": {
9
+ "emit": "openTemporaryConsentsModal",
10
+ "listen": "closeTemporaryConsentsModal"
11
+ },
12
+ "limits-popup": {
13
+ "emit": "openLugasPopup",
14
+ "listen": "closeLugasPopup"
15
+ },
16
+ "video-verification-popup": {
17
+ "emit": "openKycVerificationModal",
18
+ "listen": "closeKycVerificationModal"
19
+ },
20
+ "unverified-phone-number": {
21
+ "emit": "openSmsVerificationModal",
22
+ "listen": "closeSmsVerificationModal"
23
+ }
16
24
  };
17
25
 
18
26
  const userActionsCss = ":host{display:block}";
27
+ const UserActionsStyle0 = userActionsCss;
19
28
 
20
29
  const UserActions = class {
21
- constructor(hostRef) {
22
- registerInstance(this, hostRef);
23
- this.actionStack = [];
24
- this.emitCurrentActionEvent = () => {
25
- window.postMessage({ type: actionsMapping[this.actionStack[0].action].emit });
26
- };
27
- this.shiftActionStack = () => {
28
- this.actionStack = this.actionStack.slice(1);
29
- };
30
- }
31
- handleEvent(e) {
32
- if (actionsMapping[this.actionStack[0].action].listen === e.data) {
33
- this.shiftActionStack();
34
- if (this.actionStack.length > 0)
35
- this.emitCurrentActionEvent();
30
+ constructor(hostRef) {
31
+ registerInstance(this, hostRef);
32
+ this.emitCurrentActionEvent = () => {
33
+ window.postMessage({ type: actionsMapping[this.actionStack[0].action].emit });
34
+ };
35
+ this.shiftActionStack = () => {
36
+ this.actionStack = this.actionStack.slice(1);
37
+ };
38
+ this.endpoint = undefined;
39
+ this.userid = undefined;
40
+ this.actionStack = [];
41
+ }
42
+ handleEvent(e) {
43
+ var _a, _b;
44
+ if (((_b = actionsMapping[(_a = this.actionStack[0]) === null || _a === void 0 ? void 0 : _a.action]) === null || _b === void 0 ? void 0 : _b.listen) === e.data.type) {
45
+ this.shiftActionStack();
46
+ if (this.actionStack.length > 0)
47
+ this.emitCurrentActionEvent();
48
+ }
49
+ }
50
+ fetchUserActions() {
51
+ const url = new URL(`${this.endpoint}/v1/player/${this.userid}/legislation/actions`);
52
+ return fetch(url.href)
53
+ .then((response) => response.json())
54
+ .then(data => {
55
+ // filtering necessary to prevent widget from throwing "cannot read properties of 'undefined'"
56
+ // when the actions received are not part of actionsMapping
57
+ this.actionStack = data.actions.filter(action => actionsMapping[action.action]);
58
+ if (this.actionStack.length > 0)
59
+ this.emitCurrentActionEvent();
60
+ });
61
+ }
62
+ componentWillLoad() {
63
+ return this.fetchUserActions();
64
+ }
65
+ render() {
66
+ return;
36
67
  }
37
- }
38
- fetchUserActions() {
39
- const url = new URL(`${this.endpoint}/v1/player/${this.userid}/legislation/actions`);
40
- return fetch(url.href)
41
- .then((response) => response.json())
42
- .then(data => {
43
- this.actionStack = data.actions;
44
- if (this.actionStack.length > 0)
45
- this.emitCurrentActionEvent();
46
- });
47
- }
48
- componentWillLoad() {
49
- return this.fetchUserActions();
50
- }
51
- render() {
52
- return;
53
- }
54
68
  };
55
- UserActions.style = userActionsCss;
69
+ UserActions.style = UserActionsStyle0;
56
70
 
57
71
  export { UserActions as user_actions };
@@ -1,17 +1,20 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-6c13c021.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-ab1e2c3f.js';
2
+ export { s as setNonce } from './index-ab1e2c3f.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
2
4
 
3
5
  /*
4
- Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v4.20.0 | MIT Licensed | https://stenciljs.com
5
7
  */
6
- const patchBrowser = () => {
7
- const importMeta = import.meta.url;
8
- const opts = {};
9
- if (importMeta !== '') {
10
- opts.resourcesUrl = new URL('.', importMeta).href;
11
- }
12
- return promiseResolve(opts);
8
+ var patchBrowser = () => {
9
+ const importMeta = import.meta.url;
10
+ const opts = {};
11
+ if (importMeta !== "") {
12
+ opts.resourcesUrl = new URL(".", importMeta).href;
13
+ }
14
+ return promiseResolve(opts);
13
15
  };
14
16
 
15
- patchBrowser().then(options => {
17
+ patchBrowser().then(async (options) => {
18
+ await globalScripts();
16
19
  return bootstrapLazy([["user-actions",[[1,"user-actions",{"endpoint":[1],"userid":[1],"actionStack":[32]},[[8,"message","handleEvent"]]]]]], options);
17
20
  });
@@ -0,0 +1,17 @@
1
+ import { sass } from "@stencil/sass";
2
+ export const config = {
3
+ namespace: 'user-actions',
4
+ taskQueue: 'async',
5
+ sourceMap: true,
6
+ minifyJs: false,
7
+ extras: {
8
+ experimentalImportInjection: true
9
+ },
10
+ plugins: [sass()],
11
+ outputTargets: [
12
+ {
13
+ type: 'www',
14
+ serviceWorker: null // disable service workers
15
+ }
16
+ ]
17
+ };
@@ -1,22 +1,17 @@
1
- import { sass } from '@stencil/sass';
1
+ import { sass } from "@stencil/sass";
2
2
  export const config = {
3
- namespace: 'user-actions',
4
- taskQueue: 'async',
5
- plugins: [sass()],
6
- outputTargets: [
7
- {
8
- type: 'dist',
9
- esmLoaderPath: '../loader',
3
+ namespace: 'user-actions',
4
+ taskQueue: 'async',
5
+ sourceMap: false,
6
+ minifyJs: true,
7
+ extras: {
8
+ experimentalImportInjection: true
10
9
  },
11
- {
12
- type: 'dist-custom-elements',
13
- },
14
- {
15
- type: 'docs-readme',
16
- },
17
- {
18
- type: 'www',
19
- serviceWorker: null, // disable service workers
20
- },
21
- ],
10
+ plugins: [sass()],
11
+ outputTargets: [
12
+ {
13
+ type: 'dist',
14
+ esmLoaderPath: '../loader'
15
+ }
16
+ ]
22
17
  };
@@ -0,0 +1,2 @@
1
+ import { Config } from '../../../../../../../../../../../../stencil-public-runtime';
2
+ export declare const config: Config;
@@ -0,0 +1,2 @@
1
+ import { Config } from '../../../../../../../../../../../../stencil-public-runtime';
2
+ export declare const config: Config;
@@ -0,0 +1 @@
1
+ export { UserActions } from './user-actions';
@@ -1,11 +1,11 @@
1
1
  export declare class UserActions {
2
- endpoint: string;
3
- userid: string;
4
- private actionStack;
5
- handleEvent(e: any): void;
6
- fetchUserActions(): Promise<void>;
7
- private emitCurrentActionEvent;
8
- shiftActionStack: () => void;
9
- componentWillLoad(): Promise<void>;
10
- render(): void;
2
+ endpoint: string;
3
+ userid: string;
4
+ private actionStack;
5
+ handleEvent(e: any): void;
6
+ fetchUserActions(): Promise<void>;
7
+ private emitCurrentActionEvent;
8
+ shiftActionStack: () => void;
9
+ componentWillLoad(): Promise<void>;
10
+ render(): void;
11
11
  }