@@ -15,13 +15,16 @@ import {
15
15
APP_INSTANCE_RESOURCE_TYPES ,
16
16
POST_ACTION ,
17
17
ACTION_TYPES ,
18
+ POST_FILE ,
19
+ FILE_TYPES ,
18
20
} from '../../types' ;
19
21
import {
20
22
getAppInstanceResources ,
21
23
patchAppInstanceResource ,
22
24
postAppInstanceResource ,
23
25
getAppInstance ,
24
26
postAction ,
27
+ postFile ,
25
28
} from '../../actions' ;
26
29
import {
27
30
DEFAULT_LANGUAGE ,
@@ -51,6 +54,7 @@ class PhaseApp extends Component {
51
54
folder : PropTypes . string . isRequired ,
52
55
dispatchGetAppInstance : PropTypes . func . isRequired ,
53
56
dispatchPostAction : PropTypes . func . isRequired ,
57
+ dispatchPostFile : PropTypes . func . isRequired ,
54
58
id : PropTypes . string . isRequired ,
55
59
phaseId : PropTypes . string . isRequired ,
56
60
spaceId : PropTypes . string . isRequired ,
@@ -115,6 +119,7 @@ class PhaseApp extends Component {
115
119
try {
116
120
const {
117
121
dispatchGetAppInstance,
122
+ dispatchPostFile,
118
123
appInstance,
119
124
dispatchPostAction,
120
125
user,
@@ -125,7 +130,13 @@ class PhaseApp extends Component {
125
130
const { id : componentAppInstanceId } = appInstance || { } ;
126
131
const { type, payload } = JSON . parse ( event . data ) ;
127
132
let { id : messageAppInstanceId } = payload ;
128
- if ( [ ...APP_INSTANCE_RESOURCE_TYPES , ...ACTION_TYPES ] . includes ( type ) ) {
133
+ if (
134
+ [
135
+ ...APP_INSTANCE_RESOURCE_TYPES ,
136
+ ...ACTION_TYPES ,
137
+ ...FILE_TYPES ,
138
+ ] . includes ( type )
139
+ ) {
129
140
( { appInstanceId : messageAppInstanceId } = payload ) ;
130
141
}
131
142
@@ -153,6 +164,12 @@ class PhaseApp extends Component {
153
164
}
154
165
break ;
155
166
}
167
+ case POST_FILE : {
168
+ if ( isSpaceSaved ) {
169
+ return dispatchPostFile ( payload , this . postMessage ) ;
170
+ }
171
+ break ;
172
+ }
156
173
default :
157
174
return false ;
158
175
}
@@ -324,6 +341,7 @@ const mapStateToProps = ({ authentication, Space }) => ({
324
341
const mapDispatchToProps = {
325
342
dispatchGetAppInstance : getAppInstance ,
326
343
dispatchPostAction : postAction ,
344
+ dispatchPostFile : postFile ,
327
345
} ;
328
346
329
347
const ConnectedComponent = connect (
0 commit comments