useActionCallback.js
2 years ago
useActionDetail.js
2 years ago
useActions.js
2 years ago
useActionsEdit.js
2 years ago
useCurrentAction.js
2 years ago
useRequestFields.js
2 years ago
useSanitizeFieldsMap.js
2 years ago
useUpdateCurrentAction.js
2 years ago
useUpdateCurrentActionMeta.js
2 years ago
withCurrentAction.js
2 years ago
withDispatchActionLoading.js
2 years ago
withRequestFields.js
2 years ago
withSelectActionLoading.js
2 years ago
withRequestFields.js
17 lines
| 1 | import { getRequestFields, getComputedFields } from './useRequestFields'; |
| 2 | |
| 3 | function withRequestFields( select ) { |
| 4 | const meta = select( 'core/editor' ). |
| 5 | getEditedPostAttribute( 'meta' ) || {}; |
| 6 | const actions = JSON.parse( meta._jf_actions || '[]' ); |
| 7 | const currentAction = select( 'jet-forms/actions' ).getCurrentAction(); |
| 8 | const computed = select( 'jet-forms/actions' ).getComputedFields(); |
| 9 | |
| 10 | actions.splice( currentAction.index ); |
| 11 | |
| 12 | const fields = getRequestFields( actions ); |
| 13 | |
| 14 | return { requestFields: getComputedFields( fields, actions, computed ) }; |
| 15 | } |
| 16 | |
| 17 | export default withRequestFields; |