Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Updating package versioning and improvements to lightning compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-manywho committed Apr 30, 2017
1 parent 2cc6d54 commit d64aeb9
Show file tree
Hide file tree
Showing 23 changed files with 161 additions and 124 deletions.
Binary file modified manywho_flow.zip
Binary file not shown.
54 changes: 44 additions & 10 deletions manywho_flow/js/manywho/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,68 @@ var manywho = {
}
});

// Pass input values into the page if they have been provided
var inputValues = null;

if ($('#manywho-lightning-settings').data('object-id') != null &&
$('#manywho-lightning-settings').data('object-id').trim().length > 0) {
inputValues = [];
inputValues.push({
'developerName': 'SalesforceNotificationRecordId',
'contentType': 'ContentString',
'contentValue': $('#manywho-lightning-settings').data('object-id'),
});
}

if ($('#manywho-lightning-settings').data('object-name') != null &&
$('#manywho-lightning-settings').data('object-name').trim().length > 0) {
if (inputValues == null) {
inputValues = [];
}
inputValues.push({
'developerName': 'SalesforceNotificationObjectName',
'contentType': 'ContentString',
'contentValue': $('#manywho-lightning-settings').data('object-name'),
});
}

var salesforceSessionId = null;
var salesforceSessionUrl = null;

// Only send the session information if configured to do so
if (manywho.utils.isEqual('true', $('#manywho-lightning-settings').data('provide-session-info'), true)) {
salesforceSessionId = $('#manywho-lightning-settings').data('session-token');
salesforceSessionUrl = $('#manywho-lightning-settings').data('session-url');
}

var options = {
authentication: {
sessionId: $('#manywho-lightning-settings').data('session-token'),
sessionUrl: $('#manywho-lightning-settings').data('session-url')
sessionId: salesforceSessionId,
sessionUrl: salesforceSessionUrl
},
navigationElementId: queryParameters['navigation-element-id'],
navigationElementId: $('#manywho-lightning-settings').data('navigation-element-id'),
mode: $('#manywho-lightning-settings').data('mode'),
reportingMode: $('#manywho-lightning-settings').data('reporting-mode'),
replaceUrl: false,
collaboration: {
isEnabled: true
isEnabled: manywho.utils.isEqual('true', $('#manywho-lightning-settings').data('collaboration-is-enabled'), true)
},
inputs: null,
inputs: inputValues,
annotations: null,
navigation: {
isFixed: false,
isWizard: false
isFixed: manywho.utils.isEqual('true', $('#manywho-lightning-settings').data('navigation-is-fixed'), true),
isWizard: manywho.utils.isEqual('true', $('#manywho-lightning-settings').data('navigation-is-wizard'), true)
},
callbacks: [],
collapsible: false
collapsible: manywho.utils.isEqual('true', $('#manywho-lightning-settings').data('collapsible'), true)
};

manywho.engine.initialize(
$('#manywho-lightning-settings').data('tenant-id'),
$('#manywho-lightning-settings').data('flow-id'),
queryParameters['flow-version-id'],
$('#manywho-lightning-settings').data('flow-version-id'),
'main',
queryParameters['join'],
$('#manywho-lightning-settings').data('join'),
queryParameters['authorization'],
options,
queryParameters['initialization']
Expand Down
62 changes: 55 additions & 7 deletions src/aura/ManyWhoFlow/ManyWhoFlow.cmp
Original file line number Diff line number Diff line change
@@ -1,12 +1,60 @@
<aura:component access="global" implements="forceCommunity:availableForAllPageTypes" >
<aura:attribute name="stateId" type="String" />
<aura:component controller="ManyWhoCurrentUserController"
implements="forceCommunity:availableForAllPageTypes,force:hasRecordId"
access="global">
<aura:attribute name="flowId" type="String" />
<aura:attribute name="tenantId" type="String" />
<aura:attribute name="flowVersionId" type="String" />
<aura:attribute name="navigationElementId" type="String" />
<aura:attribute name="userInfo" type="ManyWhoUserInfo" />
<aura:attribute name="mode" type="String" default="" />
<aura:attribute name="reportingMode" type="String" default="" />
<aura:attribute name="collaborationIsEnabled" type="Boolean" />
<aura:attribute name="navigationIsFixed" type="Boolean" />
<aura:attribute name="navigationIsWizard" type="Boolean" />
<aura:attribute name="collapsible" type="Boolean" />
<aura:attribute name="stateId" type="String" />
<aura:attribute name="objectId" type="String" />
<aura:attribute name="objectName" type="String" />
<ltng:require scripts="/resource/manywho_flow/js/vendor/jquery-2.1.4.min.js,
/resource/manywho_flow/js/vendor/bootstrap-3.3.6.min.js,
/resource/manywho_flow/js/vendor/react-0.14.6.min.js,
/resource/manywho_flow/js/vendor/react-dom-0.14.6.min.js,
/resource/manywho_flow/js/vendor/socket.io-1.4.5.js,
/resource/manywho_flow/js/vendor/chosen.jquery-1.4.2.min.js,
/resource/manywho_flow/js/vendor/moment-with-locales-2.10.6.min.js,
/resource/manywho_flow/js/vendor/loglevel-1.4.0.min.js,
/resource/manywho_flow/js/manywho/init.js,
/resource/manywho_flow/js/manywho/compiled-6fbefb4c67.js"
styles="/resource/manywho_flow/css/manywho/mw-bootstrap-2d0a35d387.css,
/resource/manywho_flow/css/manywho/compiled-a5f8d32268.css,
/resource/manywho_flow/css/themes/mw-sf1.css"
afterScriptsLoaded="{!c.afterScriptsLoaded}"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

<div id="manywho">
<div id="loader" style="width: 100%; height: 100%; background: black; opacity: 1;">
<div style="position: absolute; width: 100%; top: 35%; left: 0; text-align: center; color: black; transform: translateY(-50%)">
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 2em">

</p>
</div>
</div>
</div>

<lightning:container aura:id="ManyWhoFlowApp"
src="https://manywhoos-dev-ed--c.na30.visual.force.com/resource/1487215709000/manywho_flow/index.html"
onmessage="{!c.handleMessage}"
onerror="{!c.handleError}" />
<div id="manywho-lightning-settings"
data-tenant-id="{!v.userInfo.tenantId}"
data-flow-id="{!v.flowId}"
data-flow-version-id="{!v.flowVersionId}"
data-navigation-element-id="{!v.navigationElementId}"
data-session-token="{!v.userInfo.sessionId}"
data-session-url="{!v.userInfo.sessionUrl}"
data-mode="{!v.mode}"
data-reporting-mode="{!v.reportingMode}"
data-collaboration-is-enabled="{!v.collaborationIsEnabled}"
data-navigation-is-fixed="{!v.navigationIsFixed}"
data-navigation-is-wizard="{!v.navigationIsWizard}"
data-collapsible="{!v.collapsible}"
data-join="{!v.stateId}"
data-object-id="{!v.objectId}"
data-object-name="{!v.objectName}">
</div>
</aura:component>
10 changes: 3 additions & 7 deletions src/aura/ManyWhoFlow/ManyWhoFlow.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

.THIS .mw-bs .wait-spinner
{
content: url('/resource/manywho_flow/images/manywholightningwaitgif.gif');
content: url('/sfsites/c/resource/manywho_flow/images/manywholightningwaitgif.gif');
display: block;
position: relative;
left: 50%;
Expand All @@ -40,12 +40,12 @@
}

.THIS .mw-bs .status > .wait-spinner {
content:url('/resource/manywho_flow/images/manywhogreentick.png') !important;
content:url('/sfsites/c/resource/manywho_flow/images/manywhogreentick.png') !important;
}

.THIS .mw-bs .wait-spinner-small
{
content: url('/resource/manywho_flow/images/manywholightningwaitgif.gif');
content: url('/sfsites/c/resource/manywho_flow/images/manywholightningwaitgif.gif');
width: 20px;
height: 20px;
margin:-10px 0 0 -10px
Expand All @@ -58,10 +58,6 @@
text-align: center;
}

.THIS .mw-bs {
margin-top: 10px !important;
}

.THIS .mw-bs .navbar {
margin-bottom: 0px !important;
}
Expand Down
9 changes: 7 additions & 2 deletions src/aura/ManyWhoFlow/ManyWhoFlow.design
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<design:component >
<design:attribute name="tenantId" label="Tenant Id" description="The unique identifier of the ManyWho Tenant" />
<design:component label="ManyWho Flow">
<design:attribute name="flowId" label="Flow Id" description="The unique identifier of the Flow" />
<design:attribute name="navigationElementId" label="Navigation Element Id" description="(Optional) Use if you have more than one Navigation and wish to explicitly define the Navigation to use for this instance of the component" />
<design:attribute name="mode" label="Debug Mode" datasource=",DEBUG,DEBUG_STEPTHROUGH" default="" description="(Optional) Use if you want to debug the Flow" />
<design:attribute name="reportingMode" label="Reporting Mode" datasource=",PATH,VALUES,PATH_AND_VALUES" default="" description="(Optional) Use if you want to enable reporting and have configured Apex REST to receive the data" />
<design:attribute name="navigationIsWizard" label="Show Navigation as Chevrons" description="The Navigation can be shown as a menu (default) or as chevrons" />
<design:attribute name="collaborationIsEnabled" label="Enable Realtime Collaboration" description="ManyWho pages can support realtime co-edit and co-navigation, however LockerService will disable this feature" />
<design:attribute name="collapsible" label="Enable Collapsible Containers" description="Determines if a user can collapse labelled Containers in your Page Layouts" />
</design:component>
56 changes: 16 additions & 40 deletions src/aura/ManyWhoFlow/ManyWhoFlowController.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
({
sendMessage : function(component, event, helper) {
//var userAction = component.get("c.getUserInfo");
doInit: function(cmp) {
//cmp.set("v.mode", "DEBUG");
cmp.set("v.provideSessionInfo", false);

//userAction.setCallback(this, function(response){
// var state = response.getState();

// if (state === "SUCCESS") {
// var userInfo = response.getReturnValue();
var resourceUrl = $A.get('$Resource.manywho_flow');

//userInfo.sessionUrl
//userInfo.sessionId
var startInfo = {
tenantId: null,
flowId: null,
sessionId: null,
sessionUrl: null,
resourceUrl: resourceUrl
};

component.find("ManyWhoFlowApp").message(startInfo);
// }
//});

var userAction = cmp.get("c.getUserInfo");
userAction.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
cmp.set("v.userInfo", response.getReturnValue());
}
});

$A.enqueueAction(userAction);
},
},

handleMessage: function(component, message, helper) {
/*var payload = message.payload;
var name = payload.name;
if (name === "General") {
var value = payload.value;
component.set("v.messageReceived", value);
} else if (name === "Foo") {
// A different response
}*/
},

handleError: function(component, error, helper) {
var e = error;
}
})
afterScriptsLoaded : function(cmp, event, helper) {
manywho.initialize();
}
})
2 changes: 1 addition & 1 deletion src/classes/ManyWhoAPI.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>36.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoAPI_Tests.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>37.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
11 changes: 9 additions & 2 deletions src/classes/ManyWhoCurrentUserController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ public with sharing class ManyWhoCurrentUserController {

@AuraEnabled
public static ManyWhoUserInfo getUserInfo() {
// Get the tenant id from custom settings
String manywhoTenantId = null;
ManyWho__c customSetting = ManyWho__c.getInstance('Default');
if (customSetting != null) {
manywhoTenantId = customSetting.Tenant_Id__c;
}

ManyWhoUserInfo manywhoUserInfo = new ManyWhoUserInfo(
userinfo.getSessionId(),
'/services/Soap/u/26.0/' + userInfo.getOrganizationId(),
System.URL.getSalesforceBaseURL().toExternalForm() + '/services/Soap/u/26.0/' + userInfo.getOrganizationId(),
manywhoTenantId,
userinfo.getUserId()
);

Expand All @@ -29,5 +37,4 @@ public with sharing class ManyWhoCurrentUserController {

return stateId;
}

}
2 changes: 1 addition & 1 deletion src/classes/ManyWhoCurrentUserController.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>36.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoFlowController.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>36.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoFlowController_Tests.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>37.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoHttp.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>36.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoHttpMock.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>37.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoHttp_Tests.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>37.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoObjectUtils.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>36.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoObjectUtils_Tests.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>37.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/ManyWhoReportingService.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>36.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
6 changes: 5 additions & 1 deletion src/classes/ManyWhoUserInfo.cls
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
public class ManyWhoUserInfo {
public ManyWhoUserInfo(String sessionId, String sessionUrl, String userId) {
public ManyWhoUserInfo(String sessionId, String sessionUrl, String tenantId, String userId) {
this.sessionId = sessionId;
this.sessionUrl = sessionUrl;
this.tenantId = tenantId;
this.userId = userId;
}

Expand All @@ -10,6 +11,9 @@ public class ManyWhoUserInfo {

@AuraEnabled
public String sessionUrl { get; set; }

@AuraEnabled
public String tenantId { get; set; }

@AuraEnabled
public String userId { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/classes/ManyWhoUserInfo.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>36.0</apiVersion>
<apiVersion>39.0</apiVersion>
<status>Active</status>
</ApexClass>
Loading

0 comments on commit d64aeb9

Please sign in to comment.