@doreamonjs/plugin-iframe 1.10.63

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/CHANGELOG.md ADDED
@@ -0,0 +1,134 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [1.10.63](https://github.com/doreamonjs/doreamon/compare/v1.10.62...v1.10.63) (2024-01-25)
7
+
8
+ **Note:** Version bump only for package @doreamonjs/plugin-iframe
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.10.57](https://github.com/doreamonjs/doreamon/compare/v1.10.56...v1.10.57) (2024-01-15)
15
+
16
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
17
+
18
+ ## [1.10.46](https://github.com/doreamonjs/doreamon/compare/v1.10.45...v1.10.46) (2023-12-07)
19
+
20
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
21
+
22
+ ## [1.10.45](https://github.com/doreamonjs/doreamon/compare/v1.10.44...v1.10.45) (2023-12-07)
23
+
24
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
25
+
26
+ ## [1.10.44](https://github.com/doreamonjs/doreamon/compare/v1.10.43...v1.10.44) (2023-12-07)
27
+
28
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
29
+
30
+ ## [1.10.43](https://github.com/doreamonjs/doreamon/compare/v1.10.42...v1.10.43) (2023-12-06)
31
+
32
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
33
+
34
+ ## [1.10.42](https://github.com/doreamonjs/doreamon/compare/v1.10.41...v1.10.42) (2023-12-06)
35
+
36
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
37
+
38
+ ## [1.10.41](https://github.com/doreamonjs/doreamon/compare/v1.10.40...v1.10.41) (2023-12-06)
39
+
40
+ ### Bug Fixes
41
+
42
+ - plugin terminal step into next action when close ([0992c2f](https://github.com/doreamonjs/doreamon/commit/0992c2fcdc6b0aa2de6c958e482df5039b50cc9d))
43
+
44
+ ## [1.9.30](https://github.com/doreamonjs/doreamon/compare/v1.9.29...v1.9.30) (2023-09-08)
45
+
46
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
47
+
48
+ ## [1.2.13](https://github.com/doreamonjs/doreamon/compare/v1.2.12...v1.2.13) (2022-11-14)
49
+
50
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
51
+
52
+ ## [1.2.5](https://github.com/doreamonjs/doreamon/compare/v1.2.4...v1.2.5) (2022-10-17)
53
+
54
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
55
+
56
+ ## [1.1.36](https://github.com/doreamonjs/doreamon/compare/v1.1.35...v1.1.36) (2022-10-10)
57
+
58
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
59
+
60
+ ## [1.1.35](https://github.com/doreamonjs/doreamon/compare/v1.1.34...v1.1.35) (2022-10-10)
61
+
62
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
63
+
64
+ ## [1.1.34](https://github.com/doreamonjs/doreamon/compare/v1.1.33...v1.1.34) (2022-10-10)
65
+
66
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
67
+
68
+ ## [1.1.33](https://github.com/doreamonjs/doreamon/compare/v1.1.32...v1.1.33) (2022-10-10)
69
+
70
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
71
+
72
+ ## [1.1.32](https://github.com/doreamonjs/doreamon/compare/v1.1.31...v1.1.32) (2022-10-10)
73
+
74
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
75
+
76
+ ## [1.1.31](https://github.com/doreamonjs/doreamon/compare/v1.1.30...v1.1.31) (2022-10-10)
77
+
78
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
79
+
80
+ ## [1.1.28](https://github.com/doreamonjs/doreamon/compare/v1.1.27...v1.1.28) (2022-09-29)
81
+
82
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
83
+
84
+ ## [1.1.22](https://github.com/doreamonjs/doreamon/compare/v1.1.21...v1.1.22) (2022-09-16)
85
+
86
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
87
+
88
+ ## [1.1.8](https://github.com/doreamonjs/doreamon/compare/v1.1.7...v1.1.8) (2022-09-09)
89
+
90
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
91
+
92
+ ## [1.0.1](https://github.com/doreamonjs/doreamon/compare/v0.6.13...v1.0.1) (2022-09-04)
93
+
94
+ ### Bug Fixes
95
+
96
+ - update dependencies versions ([77fb520](https://github.com/doreamonjs/doreamon/commit/77fb520f652d2bb1a6ffe25399d14bd204b3f87e))
97
+
98
+ ## [0.6.10](https://github.com/doreamonjs/doreamon/compare/v0.6.9...v0.6.10) (2022-09-04)
99
+
100
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
101
+
102
+ ## [0.6.4](https://github.com/doreamonjs/doreamon/compare/v0.6.3...v0.6.4) (2022-09-03)
103
+
104
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
105
+
106
+ # [0.6.0](https://github.com/doreamonjs/doreamon/compare/v0.5.0...v0.6.0) (2022-09-03)
107
+
108
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
109
+
110
+ # [0.5.0](https://github.com/doreamonjs/doreamon/compare/v0.4.5...v0.5.0) (2022-09-02)
111
+
112
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
113
+
114
+ ## [0.4.2](https://github.com/doreamonjs/doreamon/compare/v0.4.1...v0.4.2) (2022-08-31)
115
+
116
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
117
+
118
+ ## [0.4.1](https://github.com/doreamonjs/doreamon/compare/v0.4.0...v0.4.1) (2022-08-31)
119
+
120
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
121
+
122
+ # [0.4.0](https://github.com/doreamonjs/doreamon/compare/v0.3.17...v0.4.0) (2022-08-31)
123
+
124
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
125
+
126
+ ## [0.3.16](https://github.com/doreamonjs/doreamon/compare/v0.3.15...v0.3.16) (2022-08-31)
127
+
128
+ **Note:** Version bump only for package @doreamonjs/plugin-terminal
129
+
130
+ ## [0.3.15](https://github.com/doreamonjs/doreamon/compare/v0.3.14...v0.3.15) (2022-08-31)
131
+
132
+ ### Bug Fixes
133
+
134
+ - merge confict and clean changelog ([b5b0428](https://github.com/doreamonjs/doreamon/commit/b5b042803ef660e6c8faf214bd24fc27934deb91))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Eason
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@doreamonjs/plugin-terminal`
2
+
3
+ > TODO: description
@@ -0,0 +1,2 @@
1
+ export declare const NAMESPACE = "iframes";
2
+ export declare function namespace(): string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.namespace = exports.NAMESPACE = void 0;
4
+ exports.NAMESPACE = 'iframes';
5
+ function namespace() {
6
+ return exports.NAMESPACE;
7
+ }
8
+ exports.namespace = namespace;
package/lib/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './constants';
3
+ export * from './model';
4
+ export * from './service';
5
+ export * from './instance';
package/lib/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./types"), exports);
14
+ __exportStar(require("./constants"), exports);
15
+ __exportStar(require("./model"), exports);
16
+ __exportStar(require("./service"), exports);
17
+ __exportStar(require("./instance"), exports);
@@ -0,0 +1,4 @@
1
+ import { Model } from './model';
2
+ import { Service } from './service';
3
+ export declare const model: Model;
4
+ export declare const service: Service;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.service = exports.model = void 0;
4
+ const model_1 = require("./model");
5
+ const service_1 = require("./service");
6
+ exports.model = new model_1.Model();
7
+ exports.service = new service_1.Service();
package/lib/model.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Model as DvaModel } from 'dva';
2
+ export interface ModelOptions {
3
+ }
4
+ export declare class Model {
5
+ readonly options?: ModelOptions;
6
+ constructor(options?: ModelOptions);
7
+ get namespace(): string;
8
+ build(): DvaModel;
9
+ toDva(): DvaModel;
10
+ }
package/lib/model.js ADDED
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Model = void 0;
4
+ const doreamon_1 = require("@zodash/doreamon");
5
+ const constants_1 = require("./constants");
6
+ class Model {
7
+ constructor(options) {
8
+ this.options = options;
9
+ }
10
+ get namespace() {
11
+ return constants_1.NAMESPACE;
12
+ }
13
+ build() {
14
+ return {
15
+ namespace: constants_1.NAMESPACE,
16
+ state: {
17
+ visible: false,
18
+ attributes: {
19
+ title: '终端',
20
+ },
21
+ datasets: {
22
+ values: {}, // data is here
23
+ },
24
+ // callback function
25
+ callback: null,
26
+ },
27
+ reducers: {
28
+ save: (state, { payload }) => ({ ...state, ...payload }),
29
+ 'value/change'(state, { payload }) {
30
+ return { ...state, datasets: { ...state.datasets, ...payload } };
31
+ },
32
+ },
33
+ effects: {
34
+ // ui
35
+ *open({ payload }, { select, put, call }) {
36
+ const visible = yield select((state) => state[constants_1.NAMESPACE].visible);
37
+ if (visible) {
38
+ return yield put({
39
+ type: 'queue/in',
40
+ payload,
41
+ });
42
+ }
43
+ const { attributes, datasets = {}, callback, } = payload || {};
44
+ const { target } = attributes || {};
45
+ if (callback) {
46
+ callback(null, 'open');
47
+ }
48
+ else if (!target) {
49
+ throw new Error(`require attributes.target`);
50
+ }
51
+ else if (!(datasets === null || datasets === void 0 ? void 0 : datasets.values)) {
52
+ throw new Error(`require datasets.values`);
53
+ }
54
+ yield put({
55
+ type: 'save',
56
+ payload: {
57
+ visible: true,
58
+ attributes,
59
+ datasets,
60
+ //
61
+ callback,
62
+ },
63
+ });
64
+ },
65
+ *cancel(action, { select, put, take }) {
66
+ const { callback } = yield select((state) => state.confirms);
67
+ yield put({ type: 'close' });
68
+ yield take('close/@@end');
69
+ callback === null || callback === void 0 ? void 0 : callback(null, 'cancel');
70
+ },
71
+ // data
72
+ *submit({ payload: { values: updates } }, { select, put, call, take }) {
73
+ var _a;
74
+ const { attributes, datasets: originals, callback, } = yield select((state) => state[constants_1.NAMESPACE]);
75
+ const { target } = attributes || {};
76
+ if (callback) {
77
+ //
78
+ }
79
+ else if (!target) {
80
+ throw new Error(`require attributes.target`);
81
+ }
82
+ const { namespace, effect, props } = target || {};
83
+ const nextEffect = `${namespace}/${effect}`;
84
+ const datasets = doreamon_1.default.immer.produce(originals, (draft) => {
85
+ draft.values = {
86
+ ...originals.values,
87
+ ...updates,
88
+ };
89
+ });
90
+ yield put({ type: 'save', payload: { datasets } });
91
+ // @TODO business
92
+ yield call(doreamon_1.default.delay, 300);
93
+ if (callback) {
94
+ yield put({ type: 'close' });
95
+ callback(null, 'ok', (_a = datasets) === null || _a === void 0 ? void 0 : _a.values);
96
+ yield put({ type: 'queue/out' });
97
+ return;
98
+ }
99
+ yield put({ ...props, type: nextEffect, payload: datasets });
100
+ yield take(`${nextEffect}/@@end`);
101
+ yield put({ type: 'close' });
102
+ yield put({ type: 'queue/out' });
103
+ },
104
+ //
105
+ *close(action, { put, select, take }) {
106
+ const { attributes, datasets, callback } = yield select((state) => state[constants_1.NAMESPACE]);
107
+ const { target } = attributes || {};
108
+ const { namespace, effect, props } = target || {};
109
+ const nextEffect = `${namespace}/${effect}`;
110
+ yield put({ type: 'save', payload: { visible: false } });
111
+ yield put({ ...props, type: nextEffect, payload: datasets });
112
+ yield take(`${nextEffect}/@@end`);
113
+ yield put({ type: 'queue/out' });
114
+ },
115
+ //
116
+ *'queue/in'({ payload }, { select, put }) {
117
+ const state = yield select((state) => state[constants_1.NAMESPACE]);
118
+ yield put({
119
+ type: 'save',
120
+ payload: {
121
+ ...state,
122
+ queue: !state.queue ? [payload] : [...state.queue, payload],
123
+ },
124
+ });
125
+ },
126
+ *'queue/out'(action, { select, put, call }) {
127
+ yield call(doreamon_1.default.delay, 500);
128
+ const { queue } = yield select((state) => state[constants_1.NAMESPACE]);
129
+ if ((queue === null || queue === void 0 ? void 0 : queue.length) > 0) {
130
+ yield put({
131
+ type: 'save',
132
+ payload: {
133
+ queue: queue.slice(1),
134
+ },
135
+ });
136
+ yield put({
137
+ type: 'open',
138
+ payload: queue[0],
139
+ });
140
+ }
141
+ },
142
+ },
143
+ };
144
+ }
145
+ toDva() {
146
+ return this.build();
147
+ }
148
+ }
149
+ exports.Model = Model;
@@ -0,0 +1,15 @@
1
+ export interface OpenConfig {
2
+ type?: 'drawer' | 'modal';
3
+ values?: any;
4
+ onError?: (err: any) => void;
5
+ onOpen?: () => void;
6
+ onOk?: (values: any) => void;
7
+ onCancel?: () => void;
8
+ }
9
+ export declare class Service {
10
+ private logger;
11
+ get namespace(): string;
12
+ private dispatch;
13
+ open(log: string, cfg: OpenConfig): void;
14
+ close(): void;
15
+ }
package/lib/service.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Service = void 0;
4
+ const shared = require("@doreamonjs/plugin-shared");
5
+ const constants_1 = require("./constants");
6
+ class Service {
7
+ constructor() {
8
+ this.logger = shared.logger;
9
+ }
10
+ get namespace() {
11
+ return constants_1.NAMESPACE;
12
+ }
13
+ dispatch(type, payload) {
14
+ shared.store.dispatch({
15
+ type: `${constants_1.NAMESPACE}/${type}`,
16
+ payload,
17
+ });
18
+ }
19
+ open(log, cfg) {
20
+ const { values, ...attributes } = cfg;
21
+ this.dispatch('open', {
22
+ attributes,
23
+ datasets: {
24
+ values: {
25
+ log,
26
+ },
27
+ },
28
+ //
29
+ callback: (err, status, values) => {
30
+ var _a, _b, _c, _d;
31
+ if (err) {
32
+ return (_a = cfg.onError) === null || _a === void 0 ? void 0 : _a.call(cfg, err);
33
+ }
34
+ switch (status) {
35
+ case 'open':
36
+ return (_b = cfg.onOpen) === null || _b === void 0 ? void 0 : _b.call(cfg);
37
+ case 'ok':
38
+ return (_c = cfg.onOk) === null || _c === void 0 ? void 0 : _c.call(cfg, values);
39
+ case 'cancel':
40
+ return (_d = cfg.onCancel) === null || _d === void 0 ? void 0 : _d.call(cfg);
41
+ default:
42
+ throw new Error(`unknown status: ${status}`);
43
+ }
44
+ },
45
+ });
46
+ }
47
+ close() {
48
+ this.dispatch('close');
49
+ }
50
+ }
51
+ exports.Service = Service;
package/lib/types.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export interface State {
2
+ visible: boolean;
3
+ attributes: Attributes;
4
+ datasets: Datasets;
5
+ queue: State[];
6
+ callback?: (err: Error | null, type: 'open' | 'close' | 'cancel' | 'ok', vallues?: any) => void;
7
+ }
8
+ export interface Attributes {
9
+ type?: Type;
10
+ title?: string;
11
+ target: AttributeTarget;
12
+ }
13
+ export interface Datasets {
14
+ values: object;
15
+ }
16
+ export interface AttributeTarget {
17
+ namespace: string;
18
+ effect: string;
19
+ props: any;
20
+ }
21
+ export declare type Type = 'modal' | 'drawer';
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@doreamonjs/plugin-iframe",
3
+ "version": "1.10.63",
4
+ "description": "iframe plugin for doreamonjs",
5
+ "keywords": [
6
+ "doreamonjs",
7
+ "plugin"
8
+ ],
9
+ "author": "whatwewant <tobewhatwewant@gmail.com>",
10
+ "homepage": "https://github.com/doreamonjs/doreamon#readme",
11
+ "license": "MIT",
12
+ "main": "lib/index.js",
13
+ "typings": "lib/index.d.ts",
14
+ "directories": {
15
+ "lib": "lib"
16
+ },
17
+ "files": [
18
+ "lib"
19
+ ],
20
+ "jest": {
21
+ "roots": [
22
+ "__tests__"
23
+ ],
24
+ "transform": {
25
+ "^.+\\.tsx?$": "ts-jest"
26
+ },
27
+ "testRegex": ".*\\.(spec|test)\\.(ts|tsx)$",
28
+ "moduleDirectories": [
29
+ "node_modules",
30
+ "src"
31
+ ],
32
+ "moduleFileExtensions": [
33
+ "ts",
34
+ "tsx",
35
+ "js",
36
+ "jsx"
37
+ ],
38
+ "coverageDirectory": "./coverage/",
39
+ "collectCoverage": true,
40
+ "collectCoverageFrom": [
41
+ "src/**/*.{ts,tsx}"
42
+ ],
43
+ "coverageThreshold": {
44
+ "global": {
45
+ "branches": 60,
46
+ "functions": 60,
47
+ "lines": 60,
48
+ "statements": -10
49
+ }
50
+ }
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/doreamonjs/doreamon.git"
58
+ },
59
+ "scripts": {
60
+ "build": "tsc",
61
+ "test": "jest -w 1",
62
+ "coverage": "codecov"
63
+ },
64
+ "bugs": {
65
+ "url": "https://github.com/doreamonjs/doreamon/issues"
66
+ },
67
+ "dependencies": {
68
+ "@doreamonjs/plugin-shared": "^1.1.28",
69
+ "@doreamonjs/request": "^1.10.57",
70
+ "@sentry/browser": "^7.11.1",
71
+ "@sentry/tracing": "^7.11.1",
72
+ "@zcorky/delay": "^1.0.1",
73
+ "@zcorky/query-string": "^1.0.2",
74
+ "@zodash/doreamon": "^1.1.5",
75
+ "dva": "^2.4.1",
76
+ "immer": "^9.0.15",
77
+ "mixpanel-browser": "^2.45.0",
78
+ "thinkingdata-browser": "^1.6.0"
79
+ },
80
+ "gitHead": "da85b504069aeea323435dcd8bdaa63c8821f161"
81
+ }