forked from umbraco/Umbraco-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V8: Email Marketing Opt In (umbraco#7366)
* Enable BackOfficeTours to have a bool to hide them in the help drawer * New hidden tour to display the email marketing option on login to backoffice * Update to tourService to use the new bool property of hidden to show/hide the tour in the help drawer * AngularJS Resource to call the Azure Function EmailService proxy code - currently set to DEV * New method on userService.addUserToEmailMarketing that in turn calls the new emailMarketingResource * New AngularJS view & controller in the tour step to deal with user clicking yes/accept to the email opt-in * Modifies the init script to auto launch the hidden email marketing tour at login If it has been accepted or dismissed before we then try to launch the original intro tour * Only show the email marketing tour when the intro tour has been dismissed or completed and will appear for one time only the next time you login * When using X to close email tour, it does not disable and never show it again but just closes it, similar to intro tour * Adds new localStorageService key for 'emailMarketingTourShown' to prevent the tour being shown again in the same logged in session, if you refresh the backoffice in your browser * Update URL to email function * Adding new COMA copy for email marketing tour - needs fine tuning pixel pushing from Niels L * Prettified layout of e-mail marketing promotion tour * fixing whitespace * text=auto * adding xml to gitattributes * Ensures the email tour is not shown if you dismiss the intro tour and manually refresh the page Co-authored-by: Niels Lyngsø <[email protected]>
- Loading branch information
Showing
15 changed files
with
236 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Umbraco.Web.UI.Client/src/common/resources/emailmarketing.resource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @ngdoc service | ||
* @name umbraco.resources.emailMarketingResource | ||
* @description Used to add a backoffice user to Umbraco's email marketing system, if user opts in | ||
* | ||
* | ||
**/ | ||
function emailMarketingResource($http, umbRequestHelper) { | ||
|
||
// LOCAL | ||
// http://localhost:7071/api/EmailProxy | ||
|
||
// LIVE | ||
// https://emailcollector.umbraco.io/api/EmailProxy | ||
|
||
const emailApiUrl = 'https://emailcollector.umbraco.io/api/EmailProxy'; | ||
|
||
//the factory object returned | ||
return { | ||
|
||
postAddUserToEmailMarketing: (user) => { | ||
return umbRequestHelper.resourcePromise( | ||
$http.post(emailApiUrl, | ||
{ | ||
name: user.name, | ||
email: user.email, | ||
usergroup: user.userGroups // [ "admin", "sensitiveData" ] | ||
}), | ||
'Failed to add user to email marketing list'); | ||
} | ||
}; | ||
} | ||
|
||
angular.module('umbraco.resources').factory('emailMarketingResource', emailMarketingResource); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Umbraco.Web.UI.Client/src/less/components/umbemailmarketing.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.umb-email-marketing { | ||
|
||
h2 { | ||
font-weight: 800; | ||
max-width: 26ex; | ||
margin-top: 20px; | ||
} | ||
|
||
.layout { | ||
display: flex; | ||
align-items: center; | ||
align-content: stretch; | ||
|
||
.primary { | ||
flex-basis: 50%; | ||
padding-right: 40px; | ||
padding-top: 20px; | ||
padding-bottom: 20px; | ||
.notice { | ||
color: @gray-5; | ||
font-style: italic; | ||
a { | ||
color: @gray-5; | ||
&:hover { | ||
color: @ui-action-type-hover; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.secondary { | ||
flex-basis: 50%; | ||
svg { | ||
height: 200px; | ||
width: 100%; | ||
margin-top: -60px; | ||
} | ||
} | ||
} | ||
|
||
.cta { | ||
text-align: right; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...mbraco.Web.UI.Client/src/views/common/tours/umbEmailMarketing/emails/emails.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(function () { | ||
"use strict"; | ||
|
||
function EmailsController($scope, userService) { | ||
|
||
var vm = this; | ||
|
||
vm.optIn = function() { | ||
// Get the current user in backoffice | ||
userService.getCurrentUser().then(function(user){ | ||
// Send this user along to opt in | ||
// It's a fire & forget - not sure we need to check the response | ||
userService.addUserToEmailMarketing(user); | ||
}); | ||
|
||
// Mark Tour as complete | ||
// This is also can help us indicate that the user accepted | ||
// Where disabled is set if user closes modal or chooses NO | ||
$scope.model.completeTour(); | ||
} | ||
} | ||
|
||
angular.module("umbraco").controller("Umbraco.Tours.UmbEmailMarketing.EmailsController", EmailsController); | ||
})(); |
26 changes: 26 additions & 0 deletions
26
src/Umbraco.Web.UI.Client/src/views/common/tours/umbEmailMarketing/emails/emails.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<div ng-controller="Umbraco.Tours.UmbEmailMarketing.EmailsController as vm" class="umb-email-marketing"> | ||
|
||
<umb-tour-step on-close="model.endTour()"> | ||
|
||
<h2>{{ model.currentStep.title }}</h2> | ||
|
||
<div class="layout"> | ||
<!-- HTML Content stored in tour JSON config file --> | ||
<div class="primary"> | ||
<div ng-bind-html="model.currentStep.content"></div> | ||
</div> | ||
|
||
<!-- Secondary Column with paperplane --> | ||
<div class="secondary"> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 220 1080 640"><defs><style>.cls-1{fill:#fba0a2;}.cls-2{fill:#3544b1;}</style></defs><title>paperplane</title><g id="Layer_54" data-name="Layer 54"><polygon class="cls-1" points="1012.92 370.19 894.84 709.81 832.53 529.1 691.24 457.68 1012.92 370.19"/><polygon class="cls-2" points="1012.92 370.19 832.53 529.1 894.84 709.81 1012.92 370.19"/><path class="cls-2" d="M784.24,590.07s-34.16,66.82-88,70.95l-11.65-32s46.67-12.34,79.51-42.3Z"/><path class="cls-2" d="M633.49,670s-66.81,25.65-94.62,7l-3.5-26s35.92,19.8,79.74-9.67Z"/><path class="cls-2" d="M475.1,673.19S405.19,650.45,383,623.94l4.21-15.08,95.94,33.81Z"/><path class="cls-2" d="M311.51,601.88s-36.8-46.78-77.3-41.65l3.14-21.17s36.46-21.71,82.28,31.89Z"/><path class="cls-2" d="M183.21,562.23S119,565.32,89.29,588.69L67.08,569.22s61.6-41.75,103.69-36.05Z"/></g></svg> | ||
</div> | ||
</div> | ||
|
||
<div class="cta"> | ||
<umb-button size="m" button-style="link" type="button" label="No thanks" action="model.disableTour()"></umb-button> | ||
<umb-button size="m" button-style="action" type="button" action="vm.optIn()" label="Keep me updated!"></umb-button> | ||
</div> | ||
|
||
</umb-tour-step> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/Umbraco.Web.UI/config/BackOfficeTours/getting-started.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters