← All changes
|
scripts/elementor/FormWidget/ElementorFormSelect.tsx
+7
-29
11.1.21
→
11.3.75
View file →
| @@ -1,15 +1,10 @@ | ||
| 1 | -import React, { useState, useEffect, Fragment } from 'react'; | |
| 2 | -import { portalId, refreshToken } from '../../constants/leadinConfig'; | |
| 1 | +import { portalId } from '../../constants/leadinConfig'; | |
| 2 | +import { __ } from '@wordpress/i18n'; | |
| 3 | 3 | import ElementorBanner from '../Common/ElementorBanner'; |
| 4 | 4 | import UISpinner from '../../shared/UIComponents/UISpinner'; |
| 5 | -import { __ } from '@wordpress/i18n'; | |
| 6 | -import { | |
| 7 | - BackgroudAppContext, | |
| 8 | - useBackgroundAppContext, | |
| 9 | -} from '../../iframe/useBackgroundApp'; | |
| 10 | 5 | import useForms from './hooks/useForms'; |
| 11 | -import { getOrCreateBackgroundApp } from '../../utils/backgroundAppUtils'; | |
| 6 | +import EmbedderContainer from '../../shared/Common/EmbedderContainer'; | |
| 12 | 7 | |
| 13 | 8 | interface IElementorFormSelectProps { |
| 14 | 9 | formId: string; |
| 15 | 10 | setAttributes: Function; |
| @@ -40,8 +35,9 @@ | ||
| 40 | 35 | setAttributes({ |
| 41 | 36 | portalId, |
| 42 | 37 | formId: selectedForm.value, |
| 43 | 38 | formName: selectedForm.label, |
| 39 | + embedVersion: selectedForm.embedVersion, | |
| 44 | 40 | }); |
| 45 | 41 | } |
| 46 | 42 | }} |
| 47 | 43 | > |
| @@ -56,31 +52,13 @@ | ||
| 56 | 52 | </select> |
| 57 | 53 | ); |
| 58 | 54 | } |
| 59 | 55 | |
| 60 | -function ElementorFormSelectWrapper(props: IElementorFormSelectProps) { | |
| 61 | - const isBackgroundAppReady = useBackgroundAppContext(); | |
| 62 | - | |
| 63 | - return ( | |
| 64 | - <Fragment> | |
| 65 | - {!isBackgroundAppReady ? ( | |
| 66 | - <div> | |
| 67 | - <UISpinner /> | |
| 68 | - </div> | |
| 69 | - ) : ( | |
| 70 | - <ElementorFormSelect {...props} /> | |
| 71 | - )} | |
| 72 | - </Fragment> | |
| 73 | - ); | |
| 74 | -} | |
| 75 | - | |
| 76 | 56 | export default function ElementorFormSelectContainer( |
| 77 | 57 | props: IElementorFormSelectProps |
| 78 | 58 | ) { |
| 79 | 59 | return ( |
| 80 | - <BackgroudAppContext.Provider | |
| 81 | - value={refreshToken && getOrCreateBackgroundApp(refreshToken)} | |
| 82 | - > | |
| 83 | - <ElementorFormSelectWrapper {...props} /> | |
| 84 | - </BackgroudAppContext.Provider> | |
| 60 | + <EmbedderContainer> | |
| 61 | + <ElementorFormSelect {...props} /> | |
| 62 | + </EmbedderContainer> | |
| 85 | 63 | ); |
| 86 | 64 | } |