plugin updates

This commit is contained in:
Tony Volpe
2024-09-25 09:45:47 -04:00
parent cc870f301f
commit f6021c7c22
245 changed files with 4835 additions and 4671 deletions

View File

@@ -25,7 +25,7 @@ import {
wpVersion,
contentEmbed,
requiresContentEmbedScope,
refreshTokenError,
decryptError,
LeadinConfig,
} from '../constants/leadinConfig';
import { App, AppIframe } from './constants';
@@ -55,9 +55,17 @@ type PartialLeadinConfig = Pick<
| 'wpVersion'
| 'contentEmbed'
| 'requiresContentEmbedScope'
| 'refreshTokenError'
| 'decryptError'
>;
type AppIntegrationConfig = Pick<LeadinConfig, 'adminUrl'>;
const getIntegrationConfig = (): AppIntegrationConfig => {
return {
adminUrl: leadinQueryParams.adminUrl,
};
};
/**
* A modified version of the original leadinConfig that is passed to some integrated apps.
*
@@ -120,7 +128,7 @@ const getLeadinConfig = (): AppLeadinConfig => {
wpVersion,
contentEmbed,
requiresContentEmbedScope,
refreshTokenError,
decryptError,
...utm_query_params,
};
};
@@ -135,15 +143,15 @@ const getAppOptions = (app: App, createRoute = false) => {
let options;
switch (app) {
case App.Plugin:
options = new PluginAppOptions().setLeadinConfig(getLeadinConfig());
options = new PluginAppOptions();
break;
case App.PluginSettings:
options = new PluginAppOptions()
.setLeadinConfig(getLeadinConfig())
.setPluginSettingsInit();
options = new PluginAppOptions().setPluginSettingsInit();
break;
case App.Forms:
options = new FormsAppOptions();
options = new FormsAppOptions().setIntegratedAppConfig(
getIntegrationConfig()
);
if (createRoute) {
options = options.setCreateFormAppInit();
}
@@ -180,7 +188,8 @@ export default function useAppEmbedder(
const options = getAppOptions(app, createRoute)
.setLocale(locale)
.setDeviceId(deviceId)
.setRefreshToken(refreshToken);
.setRefreshToken(refreshToken)
.setLeadinConfig(getLeadinConfig());
const embedder = new IntegratedAppEmbedder(
AppIframe[app],