Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.saveAppFromWebmapDefaults = this.saveAppFromWebmapDefaults.bind(this);
this.saveAppFromScratchApp = this.saveAppFromScratchApp.bind(this);
this.createFeatureService = this.createFeatureService.bind(this);
this.createWebmap = this.createWebmap.bind(this);
this.createApp = this.createApp.bind(this);
this.saveApp = this.saveApp.bind(this);
this.registerApp = this.registerApp.bind(this);
this.redirectToEditor = this.redirectToEditor.bind(this);
// Subscribe to state changes
this.appState = AppStore.getState();
this.updateAppState();
this.unsubscribeAppStore = AppStore.subscribe(this.updateAppState);
if (lang.getObject('appState.config.webmap',false,this)) {
ArcgisItem.getDataById({
id: lang.getObject('appState.config.webmap',false,this),
item: 'webmap'
});
}
this.openFirstDialog('betaMessage');
}
const info = new OAuthInfo({
appId: clientId,
portalUrl: portalUrl,
popup: true,
popupCallbackUrl: redirectUri,
showSocialLogins: true
});
IdentityManager.registerOAuthInfos([info]);
IdentityManager.useSignInPage = false;
}
if (lang.getObject('appState.mode.fromScratch',false,this)) {
portal.signIn().then(this.verifyCredentials);
} else if (lang.getObject('appState.config.appid',false,this)) {
ArcgisItem.getDataById({
requiresLogin: lang.getObject('appState.mode.isBuilder',false,this)
});
}
}
}
ItemActions.updateFeatureServiceItemTitle(appItem.title);
ItemActions.updateFeatureServiceDefinition({name: appItem.title});
}
self.itemCreationPending = false;
});
};
ItemActions.updateFeatureServiceItem({
ownerFolder: appItem.ownerFolder
});
SettingsActions.updateIntroTitle(appItem.title);
SettingsActions.updateIntroSubtitle(appItem.snippet);
SettingsActions.updateHeaderTitle(appItem.title);
ArcgisItem.getDataById().then((appResponse) => {
if (appResponse.data && appResponse.data.values && appResponse.data.values.webmap) {
ArcgisItem.getDataById({
item: 'webmap',
id: appResponse.data.values.webmap
}).then(setLayerNameAndFinish);
} else {
ItemActions.updateWebmapItem({
ownerFolder: appItem.ownerFolder,
title: appItem.title
});
setLayerNameAndFinish();
}
});
}
updateAppState() {
this.appState = AppStore.getState();
const fromScratch = lang.getObject('appState.mode.fromScratch',false,this);
if (!this.loadStarted && lang.getObject('appState.user.publisher',false,this) && fromScratch) {
this.createNewStory();
} else if (!fromScratch && lang.getObject('appState.app.loading.data',false,this)) {
this.checkAppStateChange();
this.checkAppShareChange();
this.checkWebmapStateChange();
}
if (!this.webmapLoaded && lang.getObject('appState.app.loading.data',false,this) && lang.getObject('appState.items.app.data.values.settings.components.map.webmap',false,this)) {
this.webmapLoaded = true;
ArcgisItem.getDataById({
item: 'webmap',
id: lang.getObject('appState.items.app.data.values.settings.components.map.webmap',false,this)
});
}
}
}
});
const urlParams = $.param(urlQuery);
window.history.replaceState({},lang.getObject('appState.items.app.item.title',false,this),'?' + urlParams);
BuilderActions.changeDialog('');
ConfigActions.updateConfig({
appid
});
ModeActions.updateMode({
fromScratch: false
});
UserActions.signOutUser();
this.showCoverPageSettingsOnLoad = true;
ArcgisItem.getDataById({
id: appid
});
}
ArcgisItem.getDataById().then((appResponse) => {
if (appResponse.data && appResponse.data.values && appResponse.data.values.webmap) {
ArcgisItem.getDataById({
item: 'webmap',
id: appResponse.data.values.webmap
}).then(setLayerNameAndFinish);
} else {
ItemActions.updateWebmapItem({
ownerFolder: appItem.ownerFolder,
title: appItem.title
});
setLayerNameAndFinish();
}
});