@evlop/commons 1.0.244 → 1.0.246
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/middlewares/platformEventsMiddleware.d.ts.map +1 -1
- package/dist/src/middlewares/platformEventsMiddleware.js +46 -2
- package/dist/src/middlewares/platformEventsMiddleware.js.map +1 -1
- package/dist/src/reducers/modals.d.ts +4 -0
- package/dist/src/reducers/modals.d.ts.map +1 -1
- package/dist/src/reducers/modals.js +2 -1
- package/dist/src/reducers/modals.js.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"platformEventsMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middlewares/platformEventsMiddleware.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"platformEventsMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middlewares/platformEventsMiddleware.tsx"],"names":[],"mappings":"AA8CA,eAAO,MAAM,wBAAwB;qBAA8B,GAAG,KAAK,IAAI;aAkB7D,GAAG,cAAc,GAAG,QACrC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
@@ -1,14 +1,58 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.platformEventsMiddleware = void 0;
|
4
|
+
const TYPE_REDUX_ACTION = 'REDUX_ACTION';
|
5
|
+
const TYPE_CAPTURE_SCREENSHOT = 'CAPTURE_SCREENSHOT';
|
6
|
+
async function captureScreenshot() {
|
7
|
+
// Dynamically load html2canvas if not already loaded
|
8
|
+
if (!window.html2canvas) {
|
9
|
+
const script = document.createElement('script');
|
10
|
+
script.src = 'https://html2canvas.hertzen.com/dist/html2canvas.min.js';
|
11
|
+
script.async = true;
|
12
|
+
await new Promise((resolve, reject) => {
|
13
|
+
script.onload = resolve;
|
14
|
+
script.onerror = reject;
|
15
|
+
document.head.appendChild(script);
|
16
|
+
});
|
17
|
+
}
|
18
|
+
try {
|
19
|
+
// Get viewport dimensions
|
20
|
+
const viewportWidth = window.innerWidth;
|
21
|
+
const viewportHeight = window.innerHeight;
|
22
|
+
// Capture the screenshot with viewport options
|
23
|
+
const canvas = await window.html2canvas(document.body, {
|
24
|
+
width: viewportWidth,
|
25
|
+
height: viewportHeight,
|
26
|
+
windowWidth: viewportWidth,
|
27
|
+
windowHeight: viewportHeight,
|
28
|
+
scrollX: window.scrollX,
|
29
|
+
scrollY: window.scrollY,
|
30
|
+
x: window.scrollX,
|
31
|
+
y: window.scrollY
|
32
|
+
});
|
33
|
+
const screenshot = canvas.toDataURL('image/png');
|
34
|
+
window.parent.postMessage({
|
35
|
+
type: 'SCREENSHOT_CAPTURED',
|
36
|
+
data: screenshot
|
37
|
+
}, '*');
|
38
|
+
}
|
39
|
+
catch (error) {
|
40
|
+
console.error('Failed to capture screenshot:', error);
|
41
|
+
}
|
42
|
+
}
|
4
43
|
// listen to window message events and pass to redux
|
5
44
|
const platformEventsMiddleware = (store) => {
|
6
45
|
if (typeof window.addEventListener === 'function') {
|
7
46
|
window.addEventListener('message', (message) => {
|
8
47
|
try {
|
9
48
|
const messageObject = typeof message.data === 'string' ? JSON.parse(message.data) : message.data;
|
10
|
-
|
11
|
-
|
49
|
+
switch (messageObject.type) {
|
50
|
+
case TYPE_REDUX_ACTION:
|
51
|
+
store.dispatch(messageObject.action);
|
52
|
+
break;
|
53
|
+
case TYPE_CAPTURE_SCREENSHOT:
|
54
|
+
captureScreenshot();
|
55
|
+
break;
|
12
56
|
}
|
13
57
|
}
|
14
58
|
catch (e) { }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"platformEventsMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/platformEventsMiddleware.tsx"],"names":[],"mappings":";;;AAAA,oDAAoD;AAC7C,MAAM,wBAAwB,GAAG,CAAC,KAAyC,EAAE,EAAE;IAClF,IAAG,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,EAAC;QAC7C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,OAAO,EAAC,EAAE;YAC1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+7,10 @@ export interface AppModal {
|
|
7
7
|
props: any;
|
8
8
|
closeable: boolean;
|
9
9
|
zIndex?: number;
|
10
|
+
/**
|
11
|
+
* @description: Only used for mobile apps.
|
12
|
+
*/
|
13
|
+
presentationStyle?: 'pageSheet' | 'formSheet' | 'fullScreen' | 'overFullScreen' | 'bottomSheet';
|
10
14
|
}
|
11
15
|
export declare const showModal: (options: Partial<AppModal>) => {
|
12
16
|
type: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modals.d.ts","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"modals.d.ts","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,aAAa,CAAC;CACnG;AAGD,eAAO,MAAM,SAAS,YAAa,QAAQ,QAAQ,CAAC;;;CAmBnD,CAAC;AAEF,eAAO,MAAM,WAAW,OAAQ,QAAQ,CAAC,IAAI,CAAC,WAAW,QAAQ,QAAQ,CAAC;;;;CAMzE,CAAA;AAED,eAAO,MAAM,UAAU;;;CAGrB,CAAC;;AAIH,wBAoBC"}
|
@@ -7,7 +7,7 @@ exports.UPDATE_MODAL = 'modal/update';
|
|
7
7
|
exports.CLOSE_MODAL = 'modal/close';
|
8
8
|
// export const showModal = (component, props = {})=>({
|
9
9
|
const showModal = (options) => {
|
10
|
-
const { id = lodash_1.random(Number.MAX_SAFE_INTEGER), component, props = {}, closeable = true, zIndex = 0 } = options;
|
10
|
+
const { id = lodash_1.random(Number.MAX_SAFE_INTEGER), component, props = {}, closeable = true, zIndex = 0, presentationStyle = 'bottomSheet' } = options;
|
11
11
|
if (!component) {
|
12
12
|
throw new Error('Modal component is required');
|
13
13
|
}
|
@@ -17,6 +17,7 @@ const showModal = (options) => {
|
|
17
17
|
props,
|
18
18
|
closeable,
|
19
19
|
zIndex,
|
20
|
+
presentationStyle,
|
20
21
|
};
|
21
22
|
return {
|
22
23
|
type: exports.SHOW_MODAL,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modals.js","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":";;;AAAA,mCAAgD;AAEnC,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,WAAW,GAAG,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"modals.js","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":";;;AAAA,mCAAgD;AAEnC,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,WAAW,GAAG,aAAa,CAAC;AAczC,uDAAuD;AAChD,MAAM,SAAS,GAAG,CAAC,OAA0B,EAAC,EAAE;IACnD,MAAM,EAAC,EAAE,GAAG,eAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC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