@lingk/sync 0.1.53 → 0.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/main.js CHANGED
@@ -1317,9 +1317,6 @@ module.exports =
1317
1317
  }
1318
1318
 
1319
1319
  _createClass(SelectWrapper, [{
1320
- key: 'componentDidMount',
1321
- value: function componentDidMount() {}
1322
- }, {
1323
1320
  key: 'expand',
1324
1321
  value: function expand(v, parents) {
1325
1322
  this.setState({ expanded: _nestExpand2.default.expand(v, parents, this.state.expanded) });
@@ -1701,16 +1698,15 @@ module.exports =
1701
1698
  var SET_WIZARD_TRIGGER = exports.SET_WIZARD_TRIGGER = 'SET_WIZARD_TRIGGER';
1702
1699
  var SET_WIZARD_LOADED = exports.SET_WIZARD_LOADED = 'SET_WIZARD_LOADED';
1703
1700
  var SET_WIZARD_DATA_LOADED = exports.SET_WIZARD_DATA_LOADED = 'SET_WIZARD_DATA_LOADED';
1704
- var START_ENV_CHECK = exports.START_ENV_CHECK = 'START_ENV_CHECK';
1705
- var FINISH_ENV_CHECK = exports.FINISH_ENV_CHECK = 'FINISH_ENV_CHECK';
1706
- var START_PREVIEW = exports.START_PREVIEW = 'START_PREVIEW';
1707
- var FINISH_PREVIEW = exports.FINISH_PREVIEW = 'FINISH_PREVIEW';
1708
- var START_GET_SCENARIO = exports.START_GET_SCENARIO = 'START_GET_SCENARIO';
1709
- var FINISH_GET_SCENARIO = exports.FINISH_GET_SCENARIO = 'FINISH_GET_SCENARIO';
1710
- var CLEAR_WIZARD = exports.CLEAR_WIZARD = 'CLEAR_WIZARD';
1711
- var SET_OAUTH_URL = exports.SET_OAUTH_URL = 'SET_OAUTH_URL';
1712
- var GETTING_OAUTH_URL = exports.GETTING_OAUTH_URL = 'GETTING_OAUTH_URL';
1701
+ var START_WIZARD_ENV_CHECK = exports.START_WIZARD_ENV_CHECK = 'START_WIZARD_ENV_CHECK';
1702
+ var FINISH_WIZARD_ENV_CHECK = exports.FINISH_WIZARD_ENV_CHECK = 'FINISH_WIZARD_ENV_CHECK';
1703
+ var START_WIZARD_GET_SCENARIO = exports.START_WIZARD_GET_SCENARIO = 'START_WIZARD_GET_SCENARIO';
1704
+ var FINISH_WIZARD_GET_SCENARIO = exports.FINISH_WIZARD_GET_SCENARIO = 'FINISH_WIZARD_GET_SCENARIO';
1705
+ var SET_WIZARD_OAUTH_URL = exports.SET_WIZARD_OAUTH_URL = 'SET_WIZARD_OAUTH_URL';
1706
+ var GETTING_WIZARD_OAUTH_URL = exports.GETTING_WIZARD_OAUTH_URL = 'GETTING_WIZARD_OAUTH_URL';
1713
1707
  var SET_WIZARD_SAVED_CREDENTIALS = exports.SET_WIZARD_SAVED_CREDENTIALS = 'SET_WIZARD_SAVED_CREDENTIALS';
1708
+
1709
+ var CLEAR_WIZARD = exports.CLEAR_WIZARD = 'CLEAR_WIZARD';
1714
1710
 
1715
1711
  /***/ },
1716
1712
  /* 41 */
@@ -2036,7 +2032,8 @@ module.exports =
2036
2032
  }
2037
2033
  }, {
2038
2034
  key: 'addDefaultResourceGroup',
2039
- value: function addDefaultResourceGroup(v, selectIdx, id, section) {
2035
+ value: function addDefaultResourceGroup(v, selectIdx, newGroup) {
2036
+ var section = newGroup.section;
2040
2037
  var _props = this.props,
2041
2038
  addGroup = _props.addGroup,
2042
2039
  resourceGroups = _props.resourceGroups,
@@ -2060,7 +2057,7 @@ module.exports =
2060
2057
  if (!(resourceGroups && resourceGroups.length === 0)) {
2061
2058
  this.go(false, finalIndex);
2062
2059
  }
2063
- addGroup(v, finalIndex, id, section);
2060
+ addGroup(v, finalIndex, newGroup);
2064
2061
  }
2065
2062
  }, {
2066
2063
  key: 'pickEntity',
@@ -2072,7 +2069,7 @@ module.exports =
2072
2069
  }
2073
2070
  }, {
2074
2071
  key: 'addDefaultEntity',
2075
- value: function addDefaultEntity(groupIndex, v, rscIndex, section, rtid, parentRef) {
2072
+ value: function addDefaultEntity(v, rscIndex, entity, groupIndex) {
2076
2073
  var _this3 = this;
2077
2074
 
2078
2075
  var resourceGroups = this.props.resourceGroups;
@@ -2086,7 +2083,7 @@ module.exports =
2086
2083
  }, 40);
2087
2084
  }
2088
2085
 
2089
- this.props.addDefaultEntity(groupIndex, v, rscIndex, section, rtid, parentRef);
2086
+ this.props.addDefaultEntity(v, rscIndex, entity, groupIndex);
2090
2087
  }
2091
2088
  }, {
2092
2089
  key: 'unPick',
@@ -2384,7 +2381,7 @@ module.exports =
2384
2381
  value: true
2385
2382
  });
2386
2383
 
2387
- function saveData(resourceGroups, providers, sourceMetadata, destinationMetadata, sourceEndpoint) {
2384
+ function saveData(resourceGroups, targetProvider, sourceMetadata, destinationMetadata, sourceEndpoint) {
2388
2385
  var bundles = resourceGroups || [];
2389
2386
  var mappings = [];
2390
2387
  var endpoints = {};
@@ -2395,7 +2392,7 @@ module.exports =
2395
2392
  }) : group;
2396
2393
  group.name = destinationResource.type;
2397
2394
  group.resourceLabel = destinationResource.name;
2398
- group.provider = providers['destination'].toLowerCase();
2395
+ group.provider = targetProvider.toLowerCase();
2399
2396
  if (destinationResource.recordTypeId) {
2400
2397
  group.recordTypeId = destinationResource.recordTypeId;
2401
2398
  }
@@ -2432,7 +2429,7 @@ module.exports =
2432
2429
  var sourceKeyResourceProvider = group.resources.find(function (r) {
2433
2430
  return r.name === group.sourceKeysObjects[i];
2434
2431
  }).provider;
2435
- var dataSourceMetadata = sourceKeyResourceProvider === providers['destination'] ? destinationMetadata : sourceMetadata;
2432
+ var dataSourceMetadata = sourceKeyResourceProvider === targetProvider ? destinationMetadata : sourceMetadata;
2436
2433
  var sourceResource = dataSourceMetadata.find(function (metaRsc) {
2437
2434
  return metaRsc.name === group.sourceKeysObjects[i];
2438
2435
  });
@@ -2480,7 +2477,7 @@ module.exports =
2480
2477
  var transConcatSourceResourceProvider = group.resources.find(function (r) {
2481
2478
  return r.name === s[0];
2482
2479
  }).provider;
2483
- var transConcatSourceMetadata = transConcatSourceResourceProvider === providers['destination'] ? destinationMetadata : sourceMetadata;
2480
+ var transConcatSourceMetadata = transConcatSourceResourceProvider === targetProvider ? destinationMetadata : sourceMetadata;
2484
2481
  var transConcatSourceResource = transConcatSourceMetadata.find(function (rsc) {
2485
2482
  return rsc.name === s[0];
2486
2483
  });
@@ -2525,7 +2522,7 @@ module.exports =
2525
2522
  group.resources = group.resources.map(function (rsc) {
2526
2523
 
2527
2524
  //get resource source (check both metadatas)
2528
- var dataSourceMetadata = rsc.provider === providers['destination'] ? destinationMetadata : sourceMetadata;
2525
+ var dataSourceMetadata = rsc.provider === targetProvider ? destinationMetadata : sourceMetadata;
2529
2526
  var sourceResource = dataSourceMetadata.find(function (metaRsc) {
2530
2527
  return metaRsc.name === rsc.name;
2531
2528
  });
@@ -2537,7 +2534,7 @@ module.exports =
2537
2534
  }
2538
2535
 
2539
2536
  //get first resource in bundle (for primaryKeyName)
2540
- var primaryDataSourceMetadata = group.resources[0].provider === providers['destination'] ? destinationMetadata : sourceMetadata;
2537
+ var primaryDataSourceMetadata = group.resources[0].provider === targetProvider ? destinationMetadata : sourceMetadata;
2541
2538
  var primarySourceResource = primaryDataSourceMetadata.find(function (metaRsc) {
2542
2539
  return metaRsc.name === group.resources[0].name;
2543
2540
  });
@@ -4932,17 +4929,14 @@ module.exports =
4932
4929
  Object.defineProperty(exports, "__esModule", {
4933
4930
  value: true
4934
4931
  });
4935
- exports.getMetadataFromEnvStep = getMetadataFromEnvStep;
4936
- exports.callCheckConnection = callCheckConnection;
4937
- exports.callCheckConnectionForProvider = callCheckConnectionForProvider;
4932
+ exports.callGetMetadata = callGetMetadata;
4933
+ exports.tryCheckConnection = tryCheckConnection;
4938
4934
  exports.callGetProviderMetadata = callGetProviderMetadata;
4939
4935
  exports.getOauthUrl = getOauthUrl;
4940
4936
  exports.createLingkExternalIds = createLingkExternalIds;
4941
- exports.callTest = callTest;
4942
4937
  exports.callAddCustomField = callAddCustomField;
4943
4938
  exports.gotEmptyScenario = gotEmptyScenario;
4944
4939
  exports.callGetScenario = callGetScenario;
4945
- exports.callPreviewIntegration = callPreviewIntegration;
4946
4940
  exports.callGetScenarioList = callGetScenarioList;
4947
4941
  exports.callCreateScenario = callCreateScenario;
4948
4942
  exports.callUpdateScenarioList = callUpdateScenarioList;
@@ -4958,12 +4952,13 @@ module.exports =
4958
4952
  exports.callDeployTrigger = callDeployTrigger;
4959
4953
  exports.callInit = callInit;
4960
4954
  exports.callGetPiConfig = callGetPiConfig;
4955
+ exports.tryGetMetadataIntro = tryGetMetadataIntro;
4956
+ exports.callGetCredentialsAndMetadatas = callGetCredentialsAndMetadatas;
4957
+ exports.tryGetCredentials = tryGetCredentials;
4961
4958
  exports.tryGetMetadata = tryGetMetadata;
4962
4959
  exports.callGetBundles = callGetBundles;
4963
4960
  exports.callGetMapping = callGetMapping;
4964
4961
  exports.postCredentials = postCredentials;
4965
- exports.callGetCredentials = callGetCredentials;
4966
- exports.tryGetCredentials = tryGetCredentials;
4967
4962
  exports.callGetTrigger = callGetTrigger;
4968
4963
  exports.setWizardLoaded = setWizardLoaded;
4969
4964
  exports.setWizardDataLoaded = setWizardDataLoaded;
@@ -4983,91 +4978,56 @@ module.exports =
4983
4978
 
4984
4979
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
4985
4980
 
4986
- // runs when "checkconnection" is click in environment step
4987
- function getMetadataFromEnvStep(tenantId, appId, mode, providerType, urlSuffix, apiUrl, endpoint, creds) {
4981
+ // bug: when reloading a wizard that has no creds saved, the metadata will be called
4982
+ // automatically, because it assumes it doesnt need creds.
4983
+ // need to check "credentials" config object AND creds in tryCheckConnection
4984
+ function callGetMetadata(tenantId, appId, mode, providerType, urlSuffix, apiUrl, endpoint, credsConfig) {
4988
4985
  return function (dispatch) {
4989
- if (urlSuffix) {
4990
- dispatch(callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType));
4991
- }
4992
- if (endpoint && endpoint.length > 8 && creds) {
4993
- //dont check if its just https://
4994
- // creds is the actual value of credentials from environmentStep
4995
- // for Salesforce (using Oauth) it will be undefined
4996
- dispatch(callCheckConnection(tenantId, appId, endpoint, mode, providerType, creds));
4997
- }
4998
- };
4999
- }
5000
-
5001
- function callCheckConnection(tenantId, appId, url, mode, providerType, creds) {
5002
- return function (dispatch, getState, api) {
5003
4986
  dispatch({
5004
- type: types.START_ENV_CHECK,
4987
+ type: types.START_WIZARD_ENV_CHECK,
5005
4988
  mode: mode
5006
4989
  });
5007
- return dispatch(callCheckConnectionForProvider(tenantId, appId, url, mode, providerType, creds)).then(function (res) {
4990
+ return dispatch(tryCheckConnection(tenantId, appId, providerType, credsConfig)).then(function (r) {
4991
+ return dispatch(callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType, endpoint));
4992
+ }).then(function (res) {
5008
4993
  dispatch({
5009
- type: types.FINISH_ENV_CHECK,
4994
+ type: types.FINISH_WIZARD_ENV_CHECK,
5010
4995
  data: { res: res, mode: mode, code: '200 OK', providerType: providerType }
5011
4996
  });
5012
4997
  }).catch(function (err) {
5013
4998
  dispatch({
5014
- type: types.FINISH_ENV_CHECK,
4999
+ type: types.FINISH_WIZARD_ENV_CHECK,
5015
5000
  data: { res: null, mode: mode, code: '404 Error', providerType: providerType }
5016
5001
  });
5017
5002
  });
5018
5003
  };
5019
5004
  }
5020
5005
 
5021
- function callCheckConnectionForProvider(tenantId, appId, url, mode, providerType, creds) {
5006
+ function tryCheckConnection(tenantId, appId, providerType, credsConfig) {
5022
5007
  return function (dispatch, getState, api) {
5008
+ var needsCredentials = credsConfig && credsConfig.length > 0 && credsConfig[0] !== 'Oauth';
5009
+
5023
5010
  var _getState = getState(),
5024
5011
  config = _getState.config;
5025
5012
 
5026
- if (providerType === 'Canvas' && creds && creds.Token) {
5027
- // if creds exist, check connection
5028
- return api.post(tenantId + '/' + appId + '/testconnection/canvas', {
5029
- endpoint: config.TRANS_API_URL,
5030
- data: {
5031
- credentialType: providerType,
5032
- credentialsJson: {
5033
- rootUrl: url,
5034
- accessToken: creds.Token
5035
- }
5036
- }
5037
- });
5038
- } else {
5039
- // else just check for adapter connection
5040
- return api.get(tenantId + '/' + appId + '/testconnection?url=' + url, {
5013
+ if (needsCredentials) {
5014
+ return api.post(tenantId + '/' + appId + '/testconnection/' + providerType.toLowerCase(), {
5041
5015
  endpoint: config.TRANS_API_URL
5042
5016
  });
5043
- }
5017
+ } else return Promise.resolve(null);
5044
5018
  };
5045
5019
  }
5046
5020
 
5047
- function callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType) {
5021
+ function callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType, endpoint) {
5048
5022
  return function (dispatch, getState, api) {
5049
- dispatch({
5050
- type: types.START_ENV_CHECK,
5051
- mode: mode
5052
- });
5053
-
5054
5023
  var _getState2 = getState(),
5055
5024
  config = _getState2.config;
5056
5025
 
5026
+ if (urlSuffix === 'testconnection') {
5027
+ urlSuffix = 'testconnection?url=' + endpoint;
5028
+ }
5057
5029
  return api.get(tenantId + '/' + appId + '/' + urlSuffix, {
5058
5030
  endpoint: config[apiUrl]
5059
- }).then(function (res) {
5060
- dispatch({
5061
- type: types.FINISH_ENV_CHECK,
5062
- data: { res: res, mode: mode, code: '200 OK', providerType: providerType }
5063
- });
5064
- return true;
5065
- }).catch(function (err) {
5066
- console.log(err);
5067
- dispatch({
5068
- type: types.FINISH_ENV_CHECK,
5069
- data: { res: null, mode: mode, code: '404 Error' }
5070
- });
5071
5031
  });
5072
5032
  };
5073
5033
  }
@@ -5075,7 +5035,7 @@ module.exports =
5075
5035
  function getOauthUrl(tenantId, appId, typeGuid, orgType, mode) {
5076
5036
  return function (dispatch, getState, api) {
5077
5037
  dispatch({
5078
- type: types.GETTING_OAUTH_URL,
5038
+ type: types.GETTING_WIZARD_OAUTH_URL,
5079
5039
  bool: true,
5080
5040
  mode: mode
5081
5041
  });
@@ -5087,7 +5047,7 @@ module.exports =
5087
5047
  endpoint: config.SF_AGENT_API_URL
5088
5048
  }).then(function (data) {
5089
5049
  dispatch({
5090
- type: types.SET_OAUTH_URL,
5050
+ type: types.SET_WIZARD_OAUTH_URL,
5091
5051
  data: data.url
5092
5052
  });
5093
5053
  }).catch(function (err) {
@@ -5142,19 +5102,6 @@ module.exports =
5142
5102
  };
5143
5103
  }
5144
5104
 
5145
- function asyncFunction(v, callback) {
5146
- setTimeout(function () {
5147
- return callback(v * 2);
5148
- }, 1000);
5149
- }
5150
- function callTest(v, completedCallback) {
5151
- return new Promise(function (resolve) {
5152
- return asyncFunction(v, function (r) {
5153
- return resolve(r * 2);
5154
- });
5155
- });
5156
- }
5157
-
5158
5105
  function callAddCustomField(tenantId, appId, objectType, fieldName, completedCallback) {
5159
5106
  return function (dispatch, getState, api) {
5160
5107
  var _getState5 = getState(),
@@ -5176,7 +5123,7 @@ module.exports =
5176
5123
  function gotEmptyScenario() {
5177
5124
  return function (dispatch) {
5178
5125
  dispatch({
5179
- type: types.FINISH_GET_SCENARIO
5126
+ type: types.FINISH_WIZARD_GET_SCENARIO
5180
5127
  });
5181
5128
  dispatch({
5182
5129
  type: types.SET_WIZARD_SAVED_BUNDLES,
@@ -5192,13 +5139,13 @@ module.exports =
5192
5139
  function callGetScenario(magicNumber, bundleGuid, mappingGuid, completedCallback) {
5193
5140
  return function (dispatch, getState, api) {
5194
5141
  dispatch({
5195
- type: types.START_GET_SCENARIO
5142
+ type: types.START_WIZARD_GET_SCENARIO
5196
5143
  });
5197
5144
  var tenantId = magicNumber;
5198
5145
  var accountId = magicNumber;
5199
5146
  return Promise.all([dispatch(callGetBundles(tenantId, accountId, bundleGuid)), dispatch(callGetMapping(tenantId, accountId, mappingGuid))]).then(function (res) {
5200
5147
  dispatch({
5201
- type: types.FINISH_GET_SCENARIO
5148
+ type: types.FINISH_WIZARD_GET_SCENARIO
5202
5149
  });
5203
5150
  completedCallback();
5204
5151
  }).catch(function (err) {
@@ -5208,31 +5155,11 @@ module.exports =
5208
5155
  };
5209
5156
  }
5210
5157
 
5211
- function callPreviewIntegration(tenantId, appId, url) {
5158
+ function callGetScenarioList(tenantId, appId, typeGuid) {
5212
5159
  return function (dispatch, getState, api) {
5213
- dispatch({
5214
- type: types.START_PREVIEW
5215
- });
5216
-
5217
5160
  var _getState6 = getState(),
5218
5161
  config = _getState6.config;
5219
5162
 
5220
- return api.get(tenantId + '/' + appId + '/previewintegration?url=' + url, {
5221
- endpoint: config.TRANS_API_URL
5222
- }).then(function (res) {
5223
- dispatch({
5224
- type: types.FINISH_PREVIEW,
5225
- data: res
5226
- });
5227
- });
5228
- };
5229
- }
5230
-
5231
- function callGetScenarioList(tenantId, appId, typeGuid) {
5232
- return function (dispatch, getState, api) {
5233
- var _getState7 = getState(),
5234
- config = _getState7.config;
5235
-
5236
5163
  return api.get(tenantId + '/' + appId + '/scenarios/' + typeGuid, {
5237
5164
  endpoint: config.TRANS_API_URL
5238
5165
  });
@@ -5241,8 +5168,8 @@ module.exports =
5241
5168
 
5242
5169
  function callCreateScenario(tenantId, appId, data) {
5243
5170
  return function (dispatch, getState, api) {
5244
- var _getState8 = getState(),
5245
- config = _getState8.config;
5171
+ var _getState7 = getState(),
5172
+ config = _getState7.config;
5246
5173
 
5247
5174
  return api.post(tenantId + '/' + appId + '/scenario', {
5248
5175
  endpoint: config.TRANS_API_URL,
@@ -5253,8 +5180,8 @@ module.exports =
5253
5180
 
5254
5181
  function callUpdateScenarioList(tenantId, appId, typeGuid, scenarioIds) {
5255
5182
  return function (dispatch, getState, api) {
5256
- var _getState9 = getState(),
5257
- config = _getState9.config;
5183
+ var _getState8 = getState(),
5184
+ config = _getState8.config;
5258
5185
 
5259
5186
  return api.post(tenantId + '/' + appId + '/scenarios/' + typeGuid, {
5260
5187
  endpoint: config.TRANS_API_URL,
@@ -5267,8 +5194,8 @@ module.exports =
5267
5194
 
5268
5195
  function callPostBundles(tenantId, appId, bundles) {
5269
5196
  return function (dispatch, getState, api) {
5270
- var _getState10 = getState(),
5271
- config = _getState10.config;
5197
+ var _getState9 = getState(),
5198
+ config = _getState9.config;
5272
5199
 
5273
5200
  var data = { bundles: bundles };
5274
5201
  return api.post(tenantId + '/' + appId + '/bundle', {
@@ -5282,8 +5209,8 @@ module.exports =
5282
5209
 
5283
5210
  function callPostMapping(tenantId, appId, mappings) {
5284
5211
  return function (dispatch, getState, api) {
5285
- var _getState11 = getState(),
5286
- config = _getState11.config;
5212
+ var _getState10 = getState(),
5213
+ config = _getState10.config;
5287
5214
 
5288
5215
  var data = { mappings: mappings };
5289
5216
  return api.post(tenantId + '/' + appId + '/schemamappings', {
@@ -5297,8 +5224,8 @@ module.exports =
5297
5224
 
5298
5225
  function callPostProductizedIntegration(tenantId, appId, schemaMappingGuid, bundlePackGuid, configuration, title, typeGuid) {
5299
5226
  return function (dispatch, getState, api) {
5300
- var _getState12 = getState(),
5301
- config = _getState12.config;
5227
+ var _getState11 = getState(),
5228
+ config = _getState11.config;
5302
5229
 
5303
5230
  var data = {
5304
5231
  schemaMappingGuid: schemaMappingGuid,
@@ -5318,8 +5245,8 @@ module.exports =
5318
5245
 
5319
5246
  function callUpdateProductizedIntegration(tenantId, appId, schemaMappingGuid, bundlePackGuid, configuration, title, typeGuid, piGuid) {
5320
5247
  return function (dispatch, getState, api) {
5321
- var _getState13 = getState(),
5322
- config = _getState13.config;
5248
+ var _getState12 = getState(),
5249
+ config = _getState12.config;
5323
5250
 
5324
5251
  var data = {
5325
5252
  schemaMappingGuid: schemaMappingGuid,
@@ -5339,8 +5266,8 @@ module.exports =
5339
5266
 
5340
5267
  function callGenerateRecipe(tenantId, appId, typeId, typeGuid, title, piGuid, mappingGuid, sourceMetadata, destinationMetadata, isManagedPackage) {
5341
5268
  return function (dispatch, getState, api) {
5342
- var _getState14 = getState(),
5343
- config = _getState14.config;
5269
+ var _getState13 = getState(),
5270
+ config = _getState13.config;
5344
5271
 
5345
5272
  return api.post(tenantId + '/' + appId + '/productizedintegrations/' + piGuid + '/generate', {
5346
5273
  endpoint: config.TRANS_API_URL,
@@ -5396,8 +5323,8 @@ module.exports =
5396
5323
 
5397
5324
  function callExecuteTransformer(transId) {
5398
5325
  return function (dispatch, getState, api) {
5399
- var _getState15 = getState(),
5400
- config = _getState15.config;
5326
+ var _getState14 = getState(),
5327
+ config = _getState14.config;
5401
5328
 
5402
5329
  var query = '';
5403
5330
  var d = new Date();
@@ -5421,8 +5348,8 @@ module.exports =
5421
5348
 
5422
5349
  function callLookupLogData(externalExecutionId, index, onFinish, generatedRecipe, pi) {
5423
5350
  return function (dispatch, getState, api) {
5424
- var _getState16 = getState(),
5425
- config = _getState16.config;
5351
+ var _getState15 = getState(),
5352
+ config = _getState15.config;
5426
5353
 
5427
5354
  return api.get('logs/transformers/externalExecutionId/' + externalExecutionId, {
5428
5355
  endpoint: config.TRANS_API_URL
@@ -5465,8 +5392,8 @@ module.exports =
5465
5392
  };
5466
5393
  }
5467
5394
  return function (dispatch, getState, api) {
5468
- var _getState17 = getState(),
5469
- config = _getState17.config;
5395
+ var _getState16 = getState(),
5396
+ config = _getState16.config;
5470
5397
 
5471
5398
  return api.post('createtrigger', {
5472
5399
  endpoint: config.TRANS_API_URL,
@@ -5479,8 +5406,8 @@ module.exports =
5479
5406
 
5480
5407
  function callDeployTrigger(generatedRecipe, pi, onFinish) {
5481
5408
  return function (dispatch, getState, api) {
5482
- var _getState18 = getState(),
5483
- config = _getState18.config;
5409
+ var _getState17 = getState(),
5410
+ config = _getState17.config;
5484
5411
 
5485
5412
  return api.put('transformer/deploy/' + generatedRecipe.Id, {
5486
5413
  endpoint: config.TRANS_API_URL,
@@ -5512,20 +5439,15 @@ module.exports =
5512
5439
  };
5513
5440
  }
5514
5441
 
5515
- function callGetPiConfig(tenantId, accountId, piGuid, providers, metadataEndpoints) {
5516
- // a wizard config already exists
5517
- var source = metadataEndpoints.source,
5518
- sourceApi = metadataEndpoints.sourceApi,
5519
- destination = metadataEndpoints.destination,
5520
- destinationApi = metadataEndpoints.destinationApi;
5521
- var skipSourceEnv = providers.skipSourceEnv,
5522
- skipDestinationEnv = providers.skipDestinationEnv;
5442
+ function callGetPiConfig(tenantId, accountId, piGuid, wizardConfig) {
5443
+ var source = wizardConfig.source,
5444
+ destination = wizardConfig.destination;
5523
5445
 
5524
5446
 
5525
5447
  if (piGuid && piGuid !== '_') {
5526
5448
  return function (dispatch, getState, api) {
5527
- var _getState19 = getState(),
5528
- config = _getState19.config;
5449
+ var _getState18 = getState(),
5450
+ config = _getState18.config;
5529
5451
 
5530
5452
  return api.get(tenantId + '/' + accountId + '/productizedintegration/' + piGuid, {
5531
5453
  endpoint: config.TRANS_API_URL
@@ -5544,34 +5466,72 @@ module.exports =
5544
5466
  type: types.SET_WIZARD_SAVED_CONFIGURATION,
5545
5467
  data: config
5546
5468
  });
5547
- return Promise.all([dispatch(tryGetMetadata(tenantId, accountId, 'source', providers.source, source, sourceApi, savedSourceEndpoint, skipSourceEnv)), dispatch(tryGetMetadata(tenantId, accountId, 'destination', providers.destination, destination, destinationApi, savedDestinationEndpoint, skipDestinationEnv)), dispatch(callGetMapping(tenantId, accountId, pi.schemaMappingGuid)), dispatch(callGetBundles(tenantId, accountId, pi.bundlePackGuid)), dispatch(callGetCredentials(tenantId, accountId, providers)), dispatch(callGetTrigger(pi.transformerBaseId))]);
5469
+ return Promise.all([dispatch(callGetMapping(tenantId, accountId, pi.schemaMappingGuid)), dispatch(callGetBundles(tenantId, accountId, pi.bundlePackGuid)), dispatch(callGetCredentialsAndMetadatas(tenantId, accountId, wizardConfig, savedSourceEndpoint, savedDestinationEndpoint)), dispatch(callGetTrigger(pi.transformerBaseId))]);
5548
5470
  });
5549
5471
  };
5550
5472
  } else return function (dispatch) {
5551
5473
  // FIRST TIME!
5552
- return Promise.all([dispatch(tryGetMetadata(tenantId, accountId, 'source', providers.source, source, sourceApi, null, skipSourceEnv)), dispatch(tryGetMetadata(tenantId, accountId, 'destination', providers.destination, destination, destinationApi, null, skipDestinationEnv))]);
5474
+ return Promise.all([dispatch(tryGetMetadataIntro(tenantId, accountId, 'source', source)), dispatch(tryGetMetadataIntro(tenantId, accountId, 'destination', destination))]);
5553
5475
  };
5554
5476
  }
5555
5477
 
5556
- // this function runs when wizard first loads
5557
- function tryGetMetadata(tenantId, appId, mode, providerType, urlSuffix, apiUrl, savedEndpoint, skipEnvStep) {
5558
- // if its first time AND there is no env step, automatically pull metadata (SF app)
5559
- if (!savedEndpoint && !skipEnvStep) return function () {
5560
- return Promise.resolve(null);
5561
- };
5562
- if (urlSuffix) {
5563
- return function (dispatch) {
5564
- return dispatch(callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType));
5565
- };
5566
- } else if (savedEndpoint && savedEndpoint !== 'https://' && savedEndpoint !== 'http://' && savedEndpoint !== '_blank') {
5478
+ // this function runs when a NEW wizard first loads ONLY in Salesforce App (no env step)
5479
+ function tryGetMetadataIntro(tenantId, appId, mode, config) {
5480
+ var type = config.type,
5481
+ metadataEndpoint = config.metadataEndpoint,
5482
+ metadataApi = config.metadataApi,
5483
+ skipEnvStep = config.skipEnvStep;
5484
+ // automatically pull metadata (SF app)
5485
+
5486
+ if (skipEnvStep) {
5567
5487
  return function (dispatch) {
5568
- return dispatch(callCheckConnection(tenantId, appId, savedEndpoint, mode, providerType));
5488
+ return dispatch(callGetProviderMetadata(tenantId, appId, metadataEndpoint, metadataApi, mode, type));
5569
5489
  };
5570
5490
  } else return function () {
5571
5491
  return Promise.resolve(null);
5572
5492
  };
5573
5493
  }
5574
5494
 
5495
+ function callGetCredentialsAndMetadatas(tenantId, appId, config, savedSourceEndpoint, savedDestinationEndpoint) {
5496
+ var source = config.source,
5497
+ destination = config.destination;
5498
+
5499
+ return function (dispatch, getState, api) {
5500
+ return Promise.all([dispatch(tryGetCredentials(tenantId, appId, source.type, source.credentials)), dispatch(tryGetCredentials(tenantId, appId, destination.type, destination.credentials))]).then(function (res) {
5501
+ dispatch({
5502
+ type: types.SET_WIZARD_SAVED_CREDENTIALS,
5503
+ data: {
5504
+ source: res[0] && res[0].credentialsJson,
5505
+ destination: res[1] && res[1].credentialsJson
5506
+ }
5507
+ });
5508
+ return Promise.all([dispatch(tryGetMetadata(tenantId, appId, 'source', source, savedSourceEndpoint, source.credentials)), dispatch(tryGetMetadata(tenantId, appId, 'destination', destination, savedDestinationEndpoint, destination.credentials))]);
5509
+ });
5510
+ };
5511
+ }
5512
+
5513
+ function tryGetCredentials(tenantId, appId, credentialType, credsConfig) {
5514
+ return function (dispatch, getState, api) {
5515
+ var _getState19 = getState(),
5516
+ config = _getState19.config;
5517
+
5518
+ if (credsConfig && credsConfig.length > 0 && credsConfig[0] !== 'Oauth') {
5519
+ return api.get(tenantId + '/' + appId + '/credentials/' + credentialType, {
5520
+ endpoint: config.TRANS_API_URL
5521
+ });
5522
+ } else return Promise.resolve(null);
5523
+ };
5524
+ }
5525
+
5526
+ function tryGetMetadata(tenantId, appId, mode, config, savedEndpoint, credsConfig) {
5527
+ return function (dispatch, getState, api) {
5528
+ // if skipEnvStep (as in SF App), auto pull SF metadata
5529
+ if (savedEndpoint && savedEndpoint.length > 8 || config.skipEnvStep) {
5530
+ return dispatch(callGetMetadata(tenantId, appId, mode, config.type, config.metadataEndpoint, config.metadataApi, savedEndpoint, credsConfig));
5531
+ } else return Promise.resolve(null);
5532
+ };
5533
+ }
5534
+
5575
5535
  function callGetBundles(tenantId, accountId, bundlePackGuid) {
5576
5536
  if (bundlePackGuid) {
5577
5537
  return function (dispatch, getState, api) {
@@ -5587,9 +5547,7 @@ module.exports =
5587
5547
  });
5588
5548
  });
5589
5549
  };
5590
- } else return function () {
5591
- return Promise.resolve(null);
5592
- };
5550
+ } else return Promise.resolve(null);
5593
5551
  }
5594
5552
 
5595
5553
  function callGetMapping(tenantId, accountId, mappingGuid) {
@@ -5607,75 +5565,51 @@ module.exports =
5607
5565
  });
5608
5566
  });
5609
5567
  };
5610
- } else return function () {
5611
- return Promise.resolve(null);
5612
- };
5568
+ } else return Promise.resolve(null);
5613
5569
  }
5614
5570
 
5615
5571
  function postCredentials(tenantId, appId, providerType, url, credentials, mode) {
5616
5572
  return function (dispatch, getState, api) {
5617
5573
  dispatch({
5618
- type: types.START_ENV_CHECK,
5574
+ type: types.START_WIZARD_ENV_CHECK,
5619
5575
  mode: mode
5620
5576
  });
5621
5577
 
5622
5578
  var _getState22 = getState(),
5623
5579
  config = _getState22.config;
5624
5580
 
5625
- var credentialsJson = {
5626
- rootUrl: url,
5627
- key: credentials.ClientKey || credentials.ClientID,
5628
- secret: credentials.ClientSecret
5629
- };
5630
- if (providerType === 'Canvas') {
5631
- credentialsJson = {
5632
- rootUrl: url,
5633
- accessToken: credentials.Token
5634
- };
5635
- }
5636
5581
  return api.post(tenantId + '/' + appId + '/credentials', {
5637
5582
  endpoint: config.TRANS_API_URL,
5638
- data: {
5639
- credentialType: providerType,
5640
- credentialsJson: credentialsJson
5641
- }
5642
- });
5643
- };
5644
- }
5645
-
5646
- function callGetCredentials(tenantId, appId, providers) {
5647
- return function (dispatch, getState, api) {
5648
- return Promise.all([dispatch(tryGetCredentials(tenantId, appId, providers.source, providers.sourceCredentials)), dispatch(tryGetCredentials(tenantId, appId, providers.destination, providers.destinationCredentials))]).then(function (res) {
5649
- dispatch({
5650
- type: types.SET_WIZARD_SAVED_CREDENTIALS,
5651
- data: {
5652
- source: res[0] && res[0].credentialsJson,
5653
- destination: res[1] && res[1].credentialsJson
5654
- }
5655
- });
5583
+ data: makeCredsForProvider(credentials, providerType, url)
5656
5584
  });
5657
5585
  };
5658
5586
  }
5659
5587
 
5660
- function tryGetCredentials(tenantId, appId, credentialType, creds) {
5661
- return function (dispatch, getState, api) {
5662
- var _getState23 = getState(),
5663
- config = _getState23.config;
5664
-
5665
- if (creds && creds.length > 0 && creds[0] !== 'Oauth') {
5666
- return api.get(tenantId + '/' + appId + '/credentials/' + credentialType, {
5667
- endpoint: config.TRANS_API_URL
5668
- });
5669
- } else {
5670
- return Promise.resolve(null);
5588
+ function makeCredsForProvider(creds, providerType, url) {
5589
+ var data = {
5590
+ credentialType: providerType,
5591
+ credentialsJson: {
5592
+ rootUrl: url
5671
5593
  }
5672
5594
  };
5595
+ switch (providerType) {
5596
+ case 'Canvas':
5597
+ data.credentialsJson.accessToken = creds.Token;
5598
+ break;
5599
+ case 'Blackboard':
5600
+ data.credentialsJson.key = creds.ClientKey;
5601
+ data.credentialsJson.secret = creds.ClientSecret;
5602
+ break;
5603
+ default:
5604
+ break;
5605
+ }
5606
+ return data;
5673
5607
  }
5674
5608
 
5675
5609
  function callGetTrigger(transBaseId) {
5676
5610
  return function (dispatch, getState, api) {
5677
- var _getState24 = getState(),
5678
- config = _getState24.config;
5611
+ var _getState23 = getState(),
5612
+ config = _getState23.config;
5679
5613
 
5680
5614
  if (transBaseId) {
5681
5615
  return api.get('gettrigger/' + transBaseId, {
@@ -5686,9 +5620,7 @@ module.exports =
5686
5620
  data: data
5687
5621
  });
5688
5622
  });
5689
- } else return function () {
5690
- return Promise.resolve(null);
5691
- };
5623
+ } else return Promise.resolve(null);
5692
5624
  };
5693
5625
  }
5694
5626
 
@@ -5990,7 +5922,7 @@ module.exports =
5990
5922
  _react2.default.createElement(
5991
5923
  'div',
5992
5924
  { style: { display: 'inline-block', width: 'calc(50% - 120px)' } },
5993
- 'Destination Objects'
5925
+ 'Target Objects'
5994
5926
  )
5995
5927
  ),
5996
5928
  _react2.default.createElement(
@@ -6246,41 +6178,41 @@ module.exports =
6246
6178
  props.update();
6247
6179
  };
6248
6180
 
6249
- var selectSourceKeyForLingk = function selectSourceKeyForLingk(key, section, parents) {
6181
+ var selectSourceKeyForLingk = function selectSourceKeyForLingk(key, i, field) {
6250
6182
  var rgs = [].concat(_toConsumableArray(resourceGroups));
6251
6183
  var group = rgs[bundleIndex];
6252
6184
  group.lingkSourceKey = key;
6253
- group.lingkSourceKeyObject = section;
6254
- group.lingkSourceKeyParents = parents;
6185
+ group.lingkSourceKeyObject = field.section;
6186
+ group.lingkSourceKeyParents = field.parents;
6255
6187
  change('resourceGroups', rgs);
6256
6188
  props.update();
6257
6189
  };
6258
6190
 
6259
- var selectCustomSourceKey = function selectCustomSourceKey(key, section, i, parents) {
6191
+ var selectCustomSourceKey = function selectCustomSourceKey(key, i, field) {
6260
6192
  var rgs = [].concat(_toConsumableArray(resourceGroups));
6261
6193
  var group = rgs[bundleIndex];
6262
6194
  if (i === 0) {
6263
6195
  group.sourceKeys = [key];
6264
- group.sourceKeysObjects = [section];
6265
- group.sourceKeysParents = [parents];
6196
+ group.sourceKeysObjects = [field.section];
6197
+ group.sourceKeysParents = [field.parents];
6266
6198
  } else {
6267
6199
  group.sourceKeys[i] = key;
6268
- group.sourceKeysObjects[i] = section;
6269
- group.sourceKeysParents[i] = parents;
6200
+ group.sourceKeysObjects[i] = field.section;
6201
+ group.sourceKeysParents[i] = field.parents;
6270
6202
  }
6271
6203
  change('resourceGroups', rgs);
6272
6204
  props.update();
6273
6205
  };
6274
6206
 
6275
- var selectCustomDestinationKey = function selectCustomDestinationKey(key, i, parents) {
6207
+ var selectCustomDestinationKey = function selectCustomDestinationKey(key, i, field) {
6276
6208
  var rgs = [].concat(_toConsumableArray(resourceGroups));
6277
6209
  var group = rgs[bundleIndex];
6278
6210
  if (i === 0) {
6279
6211
  group.destinationKeys = [key];
6280
- group.destinationKeysParents = [parents];
6212
+ group.destinationKeysParents = [field.parents];
6281
6213
  } else {
6282
6214
  group.destinationKeys[i] = key;
6283
- group.destinationKeysParents[i] = parents;
6215
+ group.destinationKeysParents[i] = field.parents;
6284
6216
  }
6285
6217
  change('resourceGroups', rgs);
6286
6218
  props.update();
@@ -6402,9 +6334,10 @@ module.exports =
6402
6334
  'div',
6403
6335
  { className: 'external-keys-column' },
6404
6336
  _react2.default.createElement(_selectWrapper2.default, { label: sourceLabel || 'Choose Key',
6405
- onSelect: function onSelect(v, iii, rtid, section, parents) {
6406
- return selectCustomSourceKey(v, section, i, parents);
6407
- }, inputs: inputs,
6337
+ onSelect: function onSelect(v, iii, field) {
6338
+ return selectCustomSourceKey(v, i, field);
6339
+ },
6340
+ inputs: inputs,
6408
6341
  type: 'brand', fieldPropLabel: 'label',
6409
6342
  values: vals, sectionLabels: sectionLabels,
6410
6343
  selectedValues: group.sourceKeys && [{
@@ -6424,9 +6357,10 @@ module.exports =
6424
6357
  'div',
6425
6358
  { className: 'external-keys-column' },
6426
6359
  _react2.default.createElement(_selectWrapper2.default, { label: group.destinationKeys && group.destinationKeys[i] || 'Choose Key',
6427
- onSelect: function onSelect(v, iii, rtid, section, parents) {
6428
- return selectCustomDestinationKey(v, i, parents);
6429
- }, type: 'brand', inputs: inputs,
6360
+ onSelect: function onSelect(v, iii, field) {
6361
+ return selectCustomDestinationKey(v, i, field);
6362
+ },
6363
+ type: 'brand', inputs: inputs,
6430
6364
  values: destinationVals,
6431
6365
  sectionLabels: [bundle.name], fieldPropLabel: 'label',
6432
6366
  selectedValues: group.destinationKeys && [{
@@ -6522,9 +6456,10 @@ module.exports =
6522
6456
  { className: 'external-keys-column' },
6523
6457
  _react2.default.createElement(_selectWrapper2.default, { label: sourceLabel || 'Choose Key',
6524
6458
  menuItemStyle: { height: 20, padding: '1px 8px' },
6525
- onSelect: function onSelect(v, i, rtid, section, parents) {
6526
- return selectSourceKeyForLingk(v, section, parents);
6527
- }, type: 'brand', inputs: inputs,
6459
+ onSelect: function onSelect(v, i, field) {
6460
+ return selectSourceKeyForLingk(v, i, field);
6461
+ },
6462
+ type: 'brand', inputs: inputs,
6528
6463
  values: vals, sectionLabels: sectionLabels,
6529
6464
  fieldPropLabel: 'label',
6530
6465
  selectedValues: [{
@@ -7642,8 +7577,8 @@ module.exports =
7642
7577
  )
7643
7578
  ),
7644
7579
  _react2.default.createElement(_selectWrapper2.default, { label: primaryKeyLabel || 'Primary Join Key',
7645
- onSelect: function onSelect(v, a, b, c, parents) {
7646
- return selectPrimaryKey(v, parents, resourceGroupIndex, i);
7580
+ onSelect: function onSelect(v, idx, field) {
7581
+ selectPrimaryKey(v, field, resourceGroupIndex, i);
7647
7582
  },
7648
7583
  onClick: showOverflow,
7649
7584
  type: 'neutral', inputs: inputs,
@@ -7678,8 +7613,8 @@ module.exports =
7678
7613
  )
7679
7614
  ),
7680
7615
  _react2.default.createElement(_selectWrapper2.default, { label: joinKeyLabel || 'Join Key',
7681
- onSelect: function onSelect(v, a, b, c, parents) {
7682
- return selectJoinKey(v, parents, resourceGroupIndex, i);
7616
+ onSelect: function onSelect(v, idx, field) {
7617
+ selectJoinKey(v, field, resourceGroupIndex, i);
7683
7618
  },
7684
7619
  onClick: showOverflow,
7685
7620
  type: 'neutral', inputs: inputs,
@@ -7731,9 +7666,10 @@ module.exports =
7731
7666
  'div',
7732
7667
  { style: { display: 'inline-block', marginLeft: 11 } },
7733
7668
  _react2.default.createElement(_selectWrapper2.default, { label: 'Add Data Source', style: { height: 40 }, onClick: showOverflow,
7734
- onSelect: function onSelect(v, i, rtid, section, parents, parentRef) {
7735
- addDefaultEntity(resourceGroupIndex, v, i, section, rtid, parentRef);
7736
- }, type: 'neutral', inputs: inputs
7669
+ onSelect: function onSelect(v, i, entity) {
7670
+ return addDefaultEntity(v, i, entity, resourceGroupIndex);
7671
+ },
7672
+ type: 'neutral', inputs: inputs
7737
7673
  //selectedValues={resourceGroups && resourceGroups[resourceGroupIndex] &&
7738
7674
  //resourceGroups[resourceGroupIndex].resources}
7739
7675
  , values: !isReverse ? [sourceSchema, destinationSchema] : [destinationSchema, sourceSchema],
@@ -7894,7 +7830,9 @@ module.exports =
7894
7830
  }
7895
7831
  }, {
7896
7832
  key: 'changeConcatField',
7897
- value: function changeConcatField(field, resource, parents, mappingIndex) {
7833
+ value: function changeConcatField(v, field, mappingIndex) {
7834
+ var section = field.section,
7835
+ parents = field.parents;
7898
7836
  var _props2 = this.props,
7899
7837
  change = _props2.change,
7900
7838
  resourceGroups = _props2.resourceGroups,
@@ -7902,11 +7840,11 @@ module.exports =
7902
7840
 
7903
7841
  var groups = [].concat(_toConsumableArray(resourceGroups));
7904
7842
  var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
7905
- var s = resource + '->';
7843
+ var s = section + '->';
7906
7844
  parents && parents.forEach(function (p) {
7907
7845
  s += p + '.';
7908
7846
  });
7909
- s += field;
7847
+ s += v;
7910
7848
  trans.args = trans.args || [];
7911
7849
  trans.args[1] = s;
7912
7850
  change('resourceGroups', groups);
@@ -8249,8 +8187,8 @@ module.exports =
8249
8187
  if (label) sourceLabel += label;
8250
8188
 
8251
8189
  return _react2.default.createElement(_selectWrapper2.default, { key: ta, label: sourceLabel || 'Choose Field',
8252
- onSelect: function onSelect(v, iii, rtid, section, parents) {
8253
- return _this3.changeConcatField(v, section, parents, mappingIndex);
8190
+ onSelect: function onSelect(v, iii, field) {
8191
+ return _this3.changeConcatField(v, field, mappingIndex);
8254
8192
  },
8255
8193
  inputs: inputs,
8256
8194
  type: 'brand', fieldPropLabel: 'label',
@@ -8905,10 +8843,10 @@ module.exports =
8905
8843
 
8906
8844
  if (credentials) {
8907
8845
  actions.postCredentials(tenantId, accountId, step.providerType, endpoint, credentials, step.mode).then(function () {
8908
- actions.getMetadataFromEnvStep(tenantId, accountId, step.mode, step.providerType, step.metadataEndpoint, step.metadataApi, endpoint || '_blank', credentials);
8846
+ actions.callGetMetadata(tenantId, accountId, step.mode, step.providerType, step.metadataEndpoint, step.metadataApi, endpoint || '_blank', step.credentials);
8909
8847
  });
8910
8848
  } else {
8911
- actions.getMetadataFromEnvStep(tenantId, accountId, step.mode, step.providerType, step.metadataEndpoint, step.metadataApi, endpoint || '_blank', credentials);
8849
+ actions.callGetMetadata(tenantId, accountId, step.mode, step.providerType, step.metadataEndpoint, step.metadataApi, endpoint || '_blank', step.credentials);
8912
8850
  }
8913
8851
  }
8914
8852
  }, {
@@ -8947,6 +8885,8 @@ module.exports =
8947
8885
  return m.method === 'POST' || m.method === 'PUT';
8948
8886
  });
8949
8887
 
8888
+ var hasEndpoint = formValues[step.mode + 'Endpoint'] && formValues[step.mode + 'Endpoint'].length > 8;
8889
+
8950
8890
  return _react2.default.createElement(
8951
8891
  'form',
8952
8892
  { onKeyPress: function onKeyPress(e) {
@@ -9074,7 +9014,8 @@ module.exports =
9074
9014
  onClick: function onClick() {
9075
9015
  return _this2.check();
9076
9016
  },
9077
- style: { marginLeft: 8, marginBottom: 2, height: 30, lineHeight: '10px' } },
9017
+ style: { marginLeft: 8, marginBottom: 2, height: 30, lineHeight: '10px' },
9018
+ disabled: !hasEndpoint },
9078
9019
  'Test Connection'
9079
9020
  ) : null,
9080
9021
  _react2.default.createElement(
@@ -9126,7 +9067,7 @@ module.exports =
9126
9067
  disabled: step.credentials.some(function (c) {
9127
9068
  var formCreds = formValues[step.mode + 'Credentials'];
9128
9069
  return !(formCreds && Object.keys(formCreds).includes(c.split(' ').join('')));
9129
- }) },
9070
+ }) || !hasEndpoint },
9130
9071
  'Test Connection'
9131
9072
  )
9132
9073
  )
@@ -10476,7 +10417,7 @@ module.exports =
10476
10417
  }
10477
10418
  }, {
10478
10419
  key: 'addGroup',
10479
- value: function addGroup(v, index, recordTypeId, section) {
10420
+ value: function addGroup(v, index, newGroup) {
10480
10421
  var _props4 = this.props,
10481
10422
  change = _props4.change,
10482
10423
  formValues = _props4.formValues;
@@ -10487,15 +10428,15 @@ module.exports =
10487
10428
  resourceGroups.splice(index, 0, {
10488
10429
  name: v,
10489
10430
  resources: null,
10490
- recordTypeId: recordTypeId,
10491
- provider: section
10431
+ recordTypeId: newGroup.recordTypeId,
10432
+ provider: newGroup.section
10492
10433
  });
10493
10434
 
10494
10435
  change('resourceGroups', resourceGroups);
10495
10436
  }
10496
10437
  }, {
10497
10438
  key: 'addDefaultEntity',
10498
- value: function addDefaultEntity(groupIndex, v, rscIndex, section, rtid, parentRef) {
10439
+ value: function addDefaultEntity(v, rscIndex, entity, groupIndex) {
10499
10440
  var _props5 = this.props,
10500
10441
  change = _props5.change,
10501
10442
  formValues = _props5.formValues;
@@ -10512,7 +10453,7 @@ module.exports =
10512
10453
  group.resources = [];
10513
10454
  this.openConnectionModal(group, groupIndex);
10514
10455
  }
10515
- // ADD PARENTS AS WELL
10456
+ // ADD PARENTS AS WELL ?
10516
10457
  /*if(parentRef && parentRef.length>0){
10517
10458
  parentRef.forEach((pr,i)=>{
10518
10459
  if(!(group.resources.find(r=>r.name===pr))){
@@ -10527,9 +10468,9 @@ module.exports =
10527
10468
  }*/
10528
10469
  group.resources.push(Object.assign({
10529
10470
  name: v,
10530
- provider: section,
10471
+ provider: entity.section,
10531
10472
  joinType: 'LEFT JOIN'
10532
- }, parentRef && { parentRef: parentRef }, rtid && { recordTypeId: rtid }));
10473
+ }, entity.parentRef && { parentRef: entity.parentRef }, entity.recordTypeId && { recordTypeId: entity.rtid }));
10533
10474
  change('resourceGroups', resourceGroups);
10534
10475
  this.forceUpdate();
10535
10476
  }
@@ -10623,7 +10564,8 @@ module.exports =
10623
10564
  }
10624
10565
  }, {
10625
10566
  key: 'selectPrimaryKey',
10626
- value: function selectPrimaryKey(v, parents, rgi, i) {
10567
+ value: function selectPrimaryKey(v, field, rgi, i) {
10568
+ console.log(field.parents);
10627
10569
  var _props10 = this.props,
10628
10570
  change = _props10.change,
10629
10571
  formValues = _props10.formValues;
@@ -10631,13 +10573,13 @@ module.exports =
10631
10573
  var resourceGroups = [].concat(_toConsumableArray(formValues['resourceGroups']));
10632
10574
  var rsc = resourceGroups[rgi].resources[i];
10633
10575
  rsc.primaryKeyName = v;
10634
- rsc.primaryKeyParents = parents;
10576
+ rsc.primaryKeyParents = field.parents;
10635
10577
  change('resourceGroups', resourceGroups);
10636
10578
  this.forceUpdate();
10637
10579
  }
10638
10580
  }, {
10639
10581
  key: 'selectJoinKey',
10640
- value: function selectJoinKey(v, parents, rgi, i) {
10582
+ value: function selectJoinKey(v, field, rgi, i) {
10641
10583
  var _props11 = this.props,
10642
10584
  change = _props11.change,
10643
10585
  formValues = _props11.formValues;
@@ -10645,7 +10587,7 @@ module.exports =
10645
10587
  var resourceGroups = [].concat(_toConsumableArray(formValues['resourceGroups']));
10646
10588
  var rsc = resourceGroups[rgi].resources[i];
10647
10589
  rsc.joinKeyName = v;
10648
- rsc.joinKeyParents = parents;
10590
+ rsc.joinKeyParents = field.parents;
10649
10591
  change('resourceGroups', resourceGroups);
10650
10592
  this.forceUpdate();
10651
10593
  }
@@ -10739,7 +10681,8 @@ module.exports =
10739
10681
  { className: 'connect-modal' },
10740
10682
  resourceGroups && resourceGroups.length > 0 && this.state.showModal && _react2.default.createElement(_connectModal2.default, { inputs: inputs, hideModal: this.hideModal,
10741
10683
  bundle: this.state.selectedBundle, opened: this.state.showModal, change: change,
10742
- resourceGroups: resourceGroups, step: step, bundleIndex: this.state.selectedBundleIndex,
10684
+ resourceGroups: resourceGroups, step: step,
10685
+ bundleIndex: this.state.selectedBundleIndex,
10743
10686
  sourceSchema: sourceSchema, destinationSchema: destinationSchema,
10744
10687
  update: function update() {
10745
10688
  return _this2.forceUpdate();
@@ -11029,10 +10972,9 @@ module.exports =
11029
10972
  destinationMetadata = _props3.destinationMetadata,
11030
10973
  sourceEndpoint = _props3.sourceEndpoint;
11031
10974
 
11032
- var providers = { source: step.sourceProvider, destination: step.destinationProvider };
11033
10975
  var clone = (0, _objectAssignDeep2.default)({}, { bundles: resourceGroups });
11034
10976
 
11035
- var _saveData = (0, _saveData3.default)(clone.bundles, providers, sourceMetadata, destinationMetadata, sourceEndpoint),
10977
+ var _saveData = (0, _saveData3.default)(clone.bundles, step.destinationProvider, sourceMetadata, destinationMetadata, sourceEndpoint),
11036
10978
  bundles = _saveData.bundles,
11037
10979
  mappings = _saveData.mappings;
11038
10980
 
@@ -11461,10 +11403,9 @@ module.exports =
11461
11403
  actions = _props.actions,
11462
11404
  tenantId = _props.tenantId,
11463
11405
  accountId = _props.accountId,
11464
- metadataEndpoints = _props.metadataEndpoints,
11465
- providers = _props.providers;
11406
+ wizardConfig = _props.wizardConfig;
11466
11407
 
11467
- actions.callInit(tenantId, accountId, piGuid, providers, metadataEndpoints);
11408
+ actions.callInit(tenantId, accountId, piGuid, wizardConfig);
11468
11409
  }
11469
11410
  }]);
11470
11411
 
@@ -11510,7 +11451,7 @@ module.exports =
11510
11451
  //resources: Type is the real value, Name is the displayed value
11511
11452
  //properties: Name is the real value, Label is the displayed value
11512
11453
 
11513
- var _saveData = (0, _saveData3.default)(formValues['resourceGroups'], this.props.providers, this.props.wizard.sourceMetadata, this.props.wizard.destinationMetadata, formValues.sourceEndpoint),
11454
+ var _saveData = (0, _saveData3.default)(formValues['resourceGroups'], this.props.wizardConfig.destination.type, this.props.wizard.sourceMetadata, this.props.wizard.destinationMetadata, formValues.sourceEndpoint),
11514
11455
  bundles = _saveData.bundles,
11515
11456
  mappings = _saveData.mappings,
11516
11457
  endpoints = _saveData.endpoints;
@@ -11769,7 +11710,7 @@ module.exports =
11769
11710
  mode: 'source'
11770
11711
  }, {
11771
11712
  type: 'environment',
11772
- title: 'Destination Environment',
11713
+ title: 'Target Environment',
11773
11714
  mode: 'destination'
11774
11715
  }, {
11775
11716
  type: 'filter',
@@ -11849,33 +11790,14 @@ module.exports =
11849
11790
  stepList.push(step);
11850
11791
  }
11851
11792
  }
11852
- var providers = {
11853
- source: wizard.source.type,
11854
- destination: wizard.destination.type,
11855
- sourceCredentials: wizard.source.credentials,
11856
- destinationCredentials: wizard.destination.credentials,
11857
- skipSourceEnv: wizard.source.skipEnvStep,
11858
- skipDestinationEnv: wizard.destination.skipEnvStep
11859
- };
11860
- var metadataEndpoints = {
11861
- source: wizard.source.metadataEndpoint || null,
11862
- sourceApi: wizard.source.metadataApi || null,
11863
- destination: wizard.destination.metadataEndpoint || null,
11864
- destinationApi: wizard.destination.metadataApi || null
11865
- };
11866
11793
  this.setState({
11867
- steps: stepList,
11868
- providers: providers,
11869
- metadataEndpoints: metadataEndpoints
11794
+ steps: stepList
11870
11795
  });
11871
11796
  }
11872
11797
  }, {
11873
11798
  key: 'render',
11874
11799
  value: function render() {
11875
- var _state = this.state,
11876
- steps = _state.steps,
11877
- providers = _state.providers,
11878
- metadataEndpoints = _state.metadataEndpoints;
11800
+ var steps = this.state.steps;
11879
11801
 
11880
11802
  if (!steps) return _react2.default.createElement('div', null);
11881
11803
  return _react2.default.createElement(
@@ -11886,9 +11808,7 @@ module.exports =
11886
11808
  height: '100%'
11887
11809
  } },
11888
11810
  _react2.default.createElement(_wizardForm2.default, Object.assign({
11889
- steps: steps,
11890
- providers: providers,
11891
- metadataEndpoints: metadataEndpoints
11811
+ steps: steps
11892
11812
  }, this.props))
11893
11813
  );
11894
11814
  }