@salesforcedevs/dw-components 1.3.148-canary.9 → 1.3.150
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/LICENSE +12 -0
- package/lwc.config.json +0 -2
- package/package.json +4 -3
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.css +0 -53
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.html +0 -75
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.ts +0 -395
- package/src/modules/dw/j2sCardSequence/mockProps.ts +0 -46
- package/src/modules/dw/j2sForm/j2sForm.css +0 -52
- package/src/modules/dw/j2sForm/j2sForm.html +0 -160
- package/src/modules/dw/j2sForm/j2sForm.ts +0 -263
- package/src/modules/dw/j2sForm/mockProps.ts +0 -3095
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.150",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"lodash.clonedeep": "^4.5.0",
|
|
15
15
|
"lodash.orderby": "^4.6.0",
|
|
16
16
|
"lodash.uniqby": "^4.7.0",
|
|
17
|
-
"query-string": "^7.1.
|
|
17
|
+
"query-string": "^7.1.3"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/classnames": "^2.2.10",
|
|
@@ -23,5 +23,6 @@
|
|
|
23
23
|
"@types/lodash.uniqby": "^4.7.7",
|
|
24
24
|
"@types/setimmediate": "^1.0.2",
|
|
25
25
|
"setimmediate": "^1.0.5"
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "ca1041e6f13585f85b24a5ca48804f20e040d405"
|
|
27
28
|
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
@import "dxHelpers/reset";
|
|
2
|
-
@import "dxHelpers/text";
|
|
3
|
-
@import "dxHelpers/card";
|
|
4
|
-
|
|
5
|
-
:host {
|
|
6
|
-
--dx-c-button-custom-color: var(--dx-g-blue-vibrant-50);
|
|
7
|
-
--dx-c-button-custom-background: white;
|
|
8
|
-
--dx-c-button-custom-border: var(--dx-g-blue-vibrant-50);
|
|
9
|
-
--dx-c-button-custom-color-hover: var(--dx-g-blue-vibrant-50);
|
|
10
|
-
--dx-c-button-custom-background-hover: var(--dx-g-cloud-blue-vibrant-90);
|
|
11
|
-
--dx-c-button-custom-border-hover: var(--dx-g-cloud-blue-vibrant-50);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
dx-step-sequence {
|
|
15
|
-
scroll-margin-top: var(--dx-g-global-header-height);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
dx-step-sequence-step:last-child dx-card-step::part(footer-container) {
|
|
19
|
-
background-color: var(--dx-g-indigo-vibrant-95);
|
|
20
|
-
border-radius: 8px;
|
|
21
|
-
margin: 0 30px 30px 30px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
[slot="secondary-action-section"] {
|
|
25
|
-
color: var(--dx-g-red-vibrant-50);
|
|
26
|
-
position: relative;
|
|
27
|
-
font-size: var(--dx-g-text-xs, 12px);
|
|
28
|
-
font-family: var(--dx-g-font-sans);
|
|
29
|
-
line-height: 18px;
|
|
30
|
-
text-align: left;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.body-container li {
|
|
34
|
-
line-height: var(--dx-g-text-2xl);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.body-container p:not(:last-child) {
|
|
38
|
-
padding-bottom: 20px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.body-markup {
|
|
42
|
-
display: block;
|
|
43
|
-
padding-bottom: var(--dx-g-spacing-md);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.referral-email-field {
|
|
47
|
-
--dx-c-input-width: 100%;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.spinner-container {
|
|
51
|
-
min-height: 200px;
|
|
52
|
-
position: relative;
|
|
53
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<dx-step-sequence
|
|
3
|
-
animate-transitions={animateTransitions}
|
|
4
|
-
communicate-step-changes="true"
|
|
5
|
-
initial-step-index={initialStepIndex}
|
|
6
|
-
onstepsequencechange={handleStepSequenceChange}
|
|
7
|
-
session-storage-id={sessionStorageId}
|
|
8
|
-
use-history={useHistory}
|
|
9
|
-
>
|
|
10
|
-
<template for:each={stepsData} for:item="stepDatum" for:index="index">
|
|
11
|
-
<dx-step-sequence-step key={stepDatum.id}>
|
|
12
|
-
<dx-card-step
|
|
13
|
-
header-icon-symbol={stepDatum.headerData.iconSymbol}
|
|
14
|
-
header-icon-sprite={stepDatum.headerData.iconSprite}
|
|
15
|
-
header-icon-color={stepDatum.headerData.iconColor}
|
|
16
|
-
header-background-color={stepDatum.headerData.backgroundColor}
|
|
17
|
-
header-text-color={stepDatum.headerData.textColor}
|
|
18
|
-
show-step-number={stepDatum.showStepNumber}
|
|
19
|
-
step-count={stepsData.length}
|
|
20
|
-
step-index={index}
|
|
21
|
-
step-title={stepDatum.stepTitle}
|
|
22
|
-
>
|
|
23
|
-
<div slot="card-body" class="body-container">
|
|
24
|
-
<template if:true={isLoading}>
|
|
25
|
-
<div class="spinner-container">
|
|
26
|
-
<dx-spinner
|
|
27
|
-
size="large"
|
|
28
|
-
variant="brand"
|
|
29
|
-
></dx-spinner>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
32
|
-
<template if:false={isLoading}>
|
|
33
|
-
<span lwc:dom="manual" class="body-markup"></span>
|
|
34
|
-
<template if:true={stepDatum.formData}>
|
|
35
|
-
<dw-j2s-form
|
|
36
|
-
id={stepDatum.formData.formId}
|
|
37
|
-
countries={countries}
|
|
38
|
-
form-metadata={stepDatum.formMetadata}
|
|
39
|
-
incoming-user-info={formIncomingUserInfo}
|
|
40
|
-
onformvaliditychange={handleFormValidityChange}
|
|
41
|
-
recaptcha-token={recaptchaToken}
|
|
42
|
-
>
|
|
43
|
-
<div slot="form-captcha-slot">
|
|
44
|
-
<slot name="captcha-slot"></slot>
|
|
45
|
-
</div>
|
|
46
|
-
</dw-j2s-form>
|
|
47
|
-
</template>
|
|
48
|
-
</template>
|
|
49
|
-
</div>
|
|
50
|
-
<div slot="secondary-action-section">
|
|
51
|
-
<span
|
|
52
|
-
lwc:dom="manual"
|
|
53
|
-
class="secondary-action-markup"
|
|
54
|
-
></span>
|
|
55
|
-
</div>
|
|
56
|
-
<div slot="primary-action-section">
|
|
57
|
-
<dx-button
|
|
58
|
-
class="primary-action"
|
|
59
|
-
disabled={isJ2sFormInvalid}
|
|
60
|
-
href={stepDatum.primaryAction.link}
|
|
61
|
-
icon-sprite={stepDatum.primaryAction.iconSprite}
|
|
62
|
-
icon-symbol={stepDatum.primaryAction.iconSymbol}
|
|
63
|
-
loading={isLoading}
|
|
64
|
-
onclick={primaryActionHandler}
|
|
65
|
-
size="large"
|
|
66
|
-
variant={primaryActionVariant}
|
|
67
|
-
>
|
|
68
|
-
{stepDatum.primaryAction.text}
|
|
69
|
-
</dx-button>
|
|
70
|
-
</div>
|
|
71
|
-
</dx-card-step>
|
|
72
|
-
</dx-step-sequence-step>
|
|
73
|
-
</template>
|
|
74
|
-
</dx-step-sequence>
|
|
75
|
-
</template>
|
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import { api, LightningElement } from "lwc";
|
|
2
|
-
import StepSequence from "dx/stepSequence";
|
|
3
|
-
import { getListWithUuids } from "dxUtils/list";
|
|
4
|
-
import { track } from "dxUtils/analytics";
|
|
5
|
-
import { toJson } from "dxUtils/normalizers";
|
|
6
|
-
|
|
7
|
-
export type StepDatum = {
|
|
8
|
-
bodyHtml?: string;
|
|
9
|
-
formData?: {
|
|
10
|
-
countriesWithReferralInput?: string[];
|
|
11
|
-
countriesWithRequiredJobRole?: string[];
|
|
12
|
-
formId?: string;
|
|
13
|
-
j2sTerms?: string;
|
|
14
|
-
notAvailableAlertInfo?: {
|
|
15
|
-
title: string;
|
|
16
|
-
body: string;
|
|
17
|
-
};
|
|
18
|
-
participatingCountryCodes?: string[];
|
|
19
|
-
};
|
|
20
|
-
headerData?: {
|
|
21
|
-
backgroundColor?: string;
|
|
22
|
-
iconColor?: string;
|
|
23
|
-
iconSprite?: string;
|
|
24
|
-
iconSymbol?: string;
|
|
25
|
-
textColor?: string;
|
|
26
|
-
};
|
|
27
|
-
primaryAction: {
|
|
28
|
-
iconSprite?: string;
|
|
29
|
-
iconSymbol?: string;
|
|
30
|
-
link?: string;
|
|
31
|
-
text: string;
|
|
32
|
-
variant?: string;
|
|
33
|
-
};
|
|
34
|
-
secondaryActionHtml?: string;
|
|
35
|
-
showStepNumber?: boolean;
|
|
36
|
-
stepTitle: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function isNoAnimationCookieSet() {
|
|
40
|
-
return document.cookie
|
|
41
|
-
.split(";")
|
|
42
|
-
.some((ck) => ck.trim() === "no_j2s_animation=true");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default class J2sCardSequence extends LightningElement {
|
|
46
|
-
_didRenderStaticInnerHtml = false;
|
|
47
|
-
_isDrmLoading = false;
|
|
48
|
-
_isFormSubmitting = false;
|
|
49
|
-
_isJ2sFormInvalid = false;
|
|
50
|
-
_isTbidLoading = false;
|
|
51
|
-
_stepsData: StepDatum[] = [];
|
|
52
|
-
@api animateTransitions = false;
|
|
53
|
-
@api drmDomain: string = "https://drm.my.salesforce-sites.com";
|
|
54
|
-
@api formHandler: string =
|
|
55
|
-
"https://formhandlermule-1s9xrb.5sc6y6-4.usa-e2.cloudhub.io/form_handler";
|
|
56
|
-
@api tbidApiBaseUrl: string | undefined;
|
|
57
|
-
@api useHistory: boolean = false;
|
|
58
|
-
|
|
59
|
-
@api
|
|
60
|
-
get stepsData() {
|
|
61
|
-
return this._stepsData;
|
|
62
|
-
}
|
|
63
|
-
set stepsData(value) {
|
|
64
|
-
// normalize incoming value with uuid keys and non-required props (for cleaner HTML template), etc.
|
|
65
|
-
this._stepsData = getListWithUuids<StepDatum>(toJson(value)).map(
|
|
66
|
-
(stepDatum) => {
|
|
67
|
-
const normalizedStepDatum = {
|
|
68
|
-
...stepDatum,
|
|
69
|
-
headerData: stepDatum.headerData || {},
|
|
70
|
-
primaryAction: {
|
|
71
|
-
...stepDatum.primaryAction,
|
|
72
|
-
variant: stepDatum.primaryAction.variant || "primary",
|
|
73
|
-
iconSprite:
|
|
74
|
-
stepDatum.primaryAction.iconSprite || "general",
|
|
75
|
-
iconSymbol:
|
|
76
|
-
stepDatum.primaryAction.iconSymbol || "arrow-right"
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
if (normalizedStepDatum.formData) {
|
|
81
|
-
(normalizedStepDatum as any).formMetadata = JSON.stringify(
|
|
82
|
-
normalizedStepDatum.formData
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return normalizedStepDatum;
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private countries = "[]";
|
|
92
|
-
private currentSequenceStep = 0;
|
|
93
|
-
private recaptchaToken = "";
|
|
94
|
-
private sessionStorageId = "j2s-card-sequence";
|
|
95
|
-
private tbidUserInfo: any; // TODO typings?
|
|
96
|
-
|
|
97
|
-
private get isLoading() {
|
|
98
|
-
return (
|
|
99
|
-
this._isDrmLoading || this._isTbidLoading || this._isFormSubmitting
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
private get isLoggedIn() {
|
|
104
|
-
return Boolean(this.tbidUserInfo);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private get isJ2sFormInvalid() {
|
|
108
|
-
return this.currentSequenceStep === 1 ? this._isJ2sFormInvalid : false;
|
|
109
|
-
}
|
|
110
|
-
private set isJ2sFormInvalid(isFormInvalid: boolean) {
|
|
111
|
-
this._isJ2sFormInvalid = isFormInvalid;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private get primaryActionVariant() {
|
|
115
|
-
if (this.currentSequenceStep === 1 && this.isJ2sFormInvalid) {
|
|
116
|
-
return "custom"; // override for disabled button styling
|
|
117
|
-
}
|
|
118
|
-
return this.stepsData[this.currentSequenceStep || 0].primaryAction
|
|
119
|
-
.variant;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
private get formIncomingUserInfo() {
|
|
123
|
-
if (!this.tbidUserInfo) {
|
|
124
|
-
return "{}";
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return JSON.stringify({
|
|
128
|
-
firstName: this.tbidUserInfo.given_name,
|
|
129
|
-
lastName: this.tbidUserInfo.family_name,
|
|
130
|
-
email: this.tbidUserInfo.email,
|
|
131
|
-
jobRole: this.tbidUserInfo.custom_attributes?.Role,
|
|
132
|
-
companyName: this.tbidUserInfo.custom_attributes?.CompanyName,
|
|
133
|
-
country: this.tbidUserInfo.custom_attributes?.Country
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
private get initialStepIndex() {
|
|
138
|
-
let initialStepIndex = 0;
|
|
139
|
-
|
|
140
|
-
const storedSessionData = sessionStorage.getItem(this.sessionStorageId);
|
|
141
|
-
if (storedSessionData) {
|
|
142
|
-
try {
|
|
143
|
-
const { currentStepIndex } = JSON.parse(storedSessionData);
|
|
144
|
-
initialStepIndex = currentStepIndex;
|
|
145
|
-
} catch (ex) {
|
|
146
|
-
// noop
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return initialStepIndex;
|
|
151
|
-
}
|
|
152
|
-
private set initialStepIndex(value: number) {
|
|
153
|
-
sessionStorage.setItem(
|
|
154
|
-
this.sessionStorageId,
|
|
155
|
-
JSON.stringify({
|
|
156
|
-
currentStepIndex: value
|
|
157
|
-
})
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
@api
|
|
162
|
-
recaptchaCallback(responseToken: string) {
|
|
163
|
-
this.recaptchaToken = responseToken;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
@api
|
|
167
|
-
recaptchaExpiredCallback() {
|
|
168
|
-
this.recaptchaToken = "";
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
connectedCallback() {
|
|
172
|
-
this.getCountryList();
|
|
173
|
-
this.getTbidUserInfo();
|
|
174
|
-
// This has to be defined here since it depends on a variable that depends on sessionStorage.
|
|
175
|
-
this.currentSequenceStep = this.initialStepIndex;
|
|
176
|
-
this.resetCustomButtonColors();
|
|
177
|
-
if (isNoAnimationCookieSet()) {
|
|
178
|
-
/* eslint-disable-next-line @lwc/lwc/no-api-reassignments */
|
|
179
|
-
this.animateTransitions = false;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
renderedCallback() {
|
|
184
|
-
if (this.isLoading) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (!this._didRenderStaticInnerHtml) {
|
|
189
|
-
this.updateStaticInnerHtml();
|
|
190
|
-
this._didRenderStaticInnerHtml = true;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
handleFormValidityChange({ detail }: CustomEvent) {
|
|
195
|
-
this.isJ2sFormInvalid = !detail.isValid;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
handleStepSequenceChange({ detail }: CustomEvent) {
|
|
199
|
-
this.currentSequenceStep = detail.stepIndex;
|
|
200
|
-
this.resetCustomButtonColors();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
handleGetStarted(evt: Event) {
|
|
204
|
-
// If the user is not yet logged in, we need to prevent moving immediately to the next
|
|
205
|
-
// step, but set storage up so that they are on the second step when they return to the
|
|
206
|
-
// site in a logged-in state; then, we need to get them to log in.
|
|
207
|
-
if (!this.isLoggedIn) {
|
|
208
|
-
evt.preventDefault();
|
|
209
|
-
this.initialStepIndex = 1;
|
|
210
|
-
this._isTbidLoading = true;
|
|
211
|
-
// @ts-ignore: call out to the tbid-controller on DSC
|
|
212
|
-
window.__startTbidLogin();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
async handleFormSubmit(evt: Event) {
|
|
217
|
-
if (!this.formHandler || this.isJ2sFormInvalid || !this.isLoggedIn) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
evt.preventDefault(); // don't proceed automatically to next step
|
|
222
|
-
this._isFormSubmitting = true;
|
|
223
|
-
|
|
224
|
-
try {
|
|
225
|
-
const formData = (this.template.querySelector("dw-j2s-form") as any)
|
|
226
|
-
?.formDataForDrm;
|
|
227
|
-
// For some countries, explicit approvals will be present; for others, it is implicitly assumed
|
|
228
|
-
if (typeof formData.Opt_In__c !== "boolean") {
|
|
229
|
-
formData.Opt_In__c = true;
|
|
230
|
-
}
|
|
231
|
-
if (typeof formData.Privacy_Statement__c !== "boolean") {
|
|
232
|
-
formData.Privacy_Statement__c = true;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
console.log("submitting", JSON.stringify(formData, null, 2));
|
|
236
|
-
const res = await fetch(this.formHandler, {
|
|
237
|
-
method: "POST",
|
|
238
|
-
headers: {
|
|
239
|
-
"Captcha-Response": this.recaptchaToken,
|
|
240
|
-
"Content-Type": "application/json"
|
|
241
|
-
},
|
|
242
|
-
body: JSON.stringify({
|
|
243
|
-
...formData,
|
|
244
|
-
"Content-Type": "application/json",
|
|
245
|
-
handlerName: "J2S Registration Page",
|
|
246
|
-
TBID__c: this.tbidUserInfo.user_id
|
|
247
|
-
})
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
if (res.ok) {
|
|
251
|
-
const resData = await res.json();
|
|
252
|
-
if (resData.status === "success") {
|
|
253
|
-
this.jumpToStepIndex(2);
|
|
254
|
-
} else {
|
|
255
|
-
throw new Error(
|
|
256
|
-
`Form submission failed. (status: ${resData.status}, message: ${resData.errorMessage})`
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
} catch (ex) {
|
|
261
|
-
console.error(ex); // TODO
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
this._isFormSubmitting = false;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
primaryActionHandler(evt: Event) {
|
|
268
|
-
const target = evt.target as HTMLButtonElement;
|
|
269
|
-
|
|
270
|
-
if (!target || target.disabled) {
|
|
271
|
-
evt.preventDefault();
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
track(target, "custEv_ctaButtonClick", {
|
|
276
|
-
click_text: target.textContent,
|
|
277
|
-
element_title: this.stepsData[this.currentSequenceStep].stepTitle,
|
|
278
|
-
click_url:
|
|
279
|
-
this.stepsData[this.currentSequenceStep].primaryAction.link ||
|
|
280
|
-
"",
|
|
281
|
-
element_type: "button",
|
|
282
|
-
content_category: "cta"
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
if (!this.currentSequenceStep) {
|
|
286
|
-
this.handleGetStarted(evt);
|
|
287
|
-
} else if (this.currentSequenceStep === 1) {
|
|
288
|
-
this.handleFormSubmit(evt);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private resetCustomButtonColors() {
|
|
293
|
-
let bgColor;
|
|
294
|
-
let textColor;
|
|
295
|
-
|
|
296
|
-
if (this.currentSequenceStep === 1) {
|
|
297
|
-
bgColor = "var(--dx-g-gray-80)";
|
|
298
|
-
textColor = "white";
|
|
299
|
-
} else {
|
|
300
|
-
bgColor = "white";
|
|
301
|
-
textColor = "var(--dx-g-blue-vibrant-50)";
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
this.template.host.style.setProperty(
|
|
305
|
-
"--dx-c-button-custom-color",
|
|
306
|
-
textColor
|
|
307
|
-
);
|
|
308
|
-
this.template.host.style.setProperty(
|
|
309
|
-
"--dx-c-button-custom-background",
|
|
310
|
-
bgColor
|
|
311
|
-
);
|
|
312
|
-
this.template.host.style.setProperty(
|
|
313
|
-
"--dx-c-button-custom-border",
|
|
314
|
-
bgColor
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
private jumpToStepIndex(stepIndex: number) {
|
|
319
|
-
this.initialStepIndex = stepIndex; // update sessionStorage value
|
|
320
|
-
((this.template.querySelector(
|
|
321
|
-
"dx-step-sequence"
|
|
322
|
-
) as unknown) as StepSequence)?.jumpToStep(stepIndex);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// HTML is received via config from DSC and should be static after initial render.
|
|
326
|
-
private updateStaticInnerHtml() {
|
|
327
|
-
const bodyMarkupContainers = this.template.querySelectorAll(
|
|
328
|
-
"span.body-markup"
|
|
329
|
-
);
|
|
330
|
-
const secondaryActionMarkupContainers = this.template.querySelectorAll(
|
|
331
|
-
"span.secondary-action-markup"
|
|
332
|
-
);
|
|
333
|
-
|
|
334
|
-
this.stepsData.forEach((step, stepIndex) => {
|
|
335
|
-
const { bodyHtml, secondaryActionHtml } = step;
|
|
336
|
-
const bodyMarkupContainer = bodyMarkupContainers[stepIndex];
|
|
337
|
-
const secondaryActionMarkupContainer =
|
|
338
|
-
secondaryActionMarkupContainers[stepIndex];
|
|
339
|
-
|
|
340
|
-
if (bodyMarkupContainer) {
|
|
341
|
-
bodyMarkupContainer.innerHTML = bodyHtml || "";
|
|
342
|
-
}
|
|
343
|
-
if (secondaryActionMarkupContainer) {
|
|
344
|
-
secondaryActionMarkupContainer.innerHTML =
|
|
345
|
-
secondaryActionHtml || "";
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
private async getCountryList() {
|
|
351
|
-
this._isDrmLoading = true;
|
|
352
|
-
|
|
353
|
-
const errorMsg = "Error while getting county list";
|
|
354
|
-
try {
|
|
355
|
-
const res = await fetch(
|
|
356
|
-
`${this.drmDomain}/utilities/services/apexrest/countries`
|
|
357
|
-
);
|
|
358
|
-
if (!res.ok) {
|
|
359
|
-
throw new Error(errorMsg);
|
|
360
|
-
}
|
|
361
|
-
const data = await res.json();
|
|
362
|
-
this.countries = JSON.stringify(data);
|
|
363
|
-
} catch (error) {
|
|
364
|
-
console.error(error);
|
|
365
|
-
if (this.initialStepIndex > 0) {
|
|
366
|
-
// Page loaded on a step higher than the first, but we can't get data for the form;
|
|
367
|
-
// send user back to the start for now.
|
|
368
|
-
this.jumpToStepIndex(0);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
this._isDrmLoading = false;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
private async getTbidUserInfo() {
|
|
376
|
-
this._isTbidLoading = true;
|
|
377
|
-
|
|
378
|
-
try {
|
|
379
|
-
const res = await fetch(`${this.tbidApiBaseUrl}/userinfo`);
|
|
380
|
-
if (res.ok) {
|
|
381
|
-
this.tbidUserInfo = await res.json();
|
|
382
|
-
}
|
|
383
|
-
} catch (ex) {
|
|
384
|
-
// noop; nothing to do here
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (!this.tbidUserInfo && this.initialStepIndex > 0) {
|
|
388
|
-
// login failed and the user was previously beyond the start step; need to send them
|
|
389
|
-
// back to the start:
|
|
390
|
-
this.jumpToStepIndex(0);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
this._isTbidLoading = false;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const stepsData = [
|
|
2
|
-
{
|
|
3
|
-
showStepNumber: "true",
|
|
4
|
-
stepTitle: "Get started now.",
|
|
5
|
-
bodyHtml:
|
|
6
|
-
'<p class="dx-text-display-7">Register for Journey to Salesforce and you\'ll be on your way to becoming a Salesforce Developer.</p><ul class="dx-text-display-8"><li>Step 1: Log in or sign up for a free Trailblazer.me account</li><li>Step 2: Confirm your program registration</li><li>Step 3: Begin your journey!</li></ul>',
|
|
7
|
-
primaryActionText: "Get Started"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
showStepNumber: "true",
|
|
11
|
-
stepTitle: "Complete your registration.",
|
|
12
|
-
formData: {
|
|
13
|
-
countriesWithReferralInput: ["IN"],
|
|
14
|
-
countriewWithRequiredJobRole: ["CA"],
|
|
15
|
-
notAvailableAlertInfo: {
|
|
16
|
-
title: "Not Available",
|
|
17
|
-
body: 'The Journey to Salesforce program is not currently available in your country. See the <a href="https://www.google.com/">program FAQs</a> for a list of participating countries.'
|
|
18
|
-
},
|
|
19
|
-
participatingCountryCodes: ["US", "CA", "IN"]
|
|
20
|
-
},
|
|
21
|
-
bodyHtml:
|
|
22
|
-
'<p class="dx-text-display-7">You\'re almost done! Please review your information and agree to the Journey to Salesforce program terms and conditions.</p>',
|
|
23
|
-
secondaryActionHtml:
|
|
24
|
-
'<span class="required-notice">* Required to participate in Journey to Salesforce</span>',
|
|
25
|
-
primaryActionText: "Complete Registration"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
showStepNumber: "true",
|
|
29
|
-
stepTitle: "Your Registration is Confirmed",
|
|
30
|
-
headerData: {
|
|
31
|
-
iconSymbol: "check-circle",
|
|
32
|
-
iconSprite: "general",
|
|
33
|
-
iconColor: "green-vibrant-65",
|
|
34
|
-
backgroundColor: "green-vibrant-95",
|
|
35
|
-
textColor: "indigo-vibrant-20"
|
|
36
|
-
},
|
|
37
|
-
bodyHtml:
|
|
38
|
-
'<div class="dx-text-display-8"><p>Welcome to Journey to Salesforce! Congratulations on taking this step in your journey towards becoming a Salesforce Developer. Through this program you\'ll gain the knowledge, experience, and skills to help you excel in the Salesforce ecosystem.</p><p>To get started, click the button below to join the Journey to Salesforce community, and make sure to check your email for links to bookmark!</p>',
|
|
39
|
-
secondaryActionHtml:
|
|
40
|
-
'<span class="dx-text-display-7">Ready to jump in?</span>',
|
|
41
|
-
primaryActionText: "Join Slack",
|
|
42
|
-
primaryActionVariant: "custom",
|
|
43
|
-
primaryActionIconSprite: "utility",
|
|
44
|
-
primaryActionIconSymbol: "new_window"
|
|
45
|
-
}
|
|
46
|
-
];
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
.hidden {
|
|
2
|
-
display: none;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.form-row {
|
|
6
|
-
display: flex;
|
|
7
|
-
justify-content: space-between;
|
|
8
|
-
padding-bottom: var(--dx-g-spacing-md);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.form-row > * {
|
|
12
|
-
--dx-c-input-width: 100%;
|
|
13
|
-
|
|
14
|
-
font-family: var(--dx-g-font-sans);
|
|
15
|
-
width: calc(50% - 20px);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.form-row > :only-child {
|
|
19
|
-
max-width: 100%;
|
|
20
|
-
width: 100%;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.form-row .terms {
|
|
24
|
-
--dx-c-checkbox-text-line-height: 20px;
|
|
25
|
-
--dx-c-checkbox-font-size: 14px;
|
|
26
|
-
|
|
27
|
-
font-family: var(--dx-g-font-sans);
|
|
28
|
-
font-size: var(--dx-c-checkbox-font-size);
|
|
29
|
-
font-weight: var(--dx-g-font-normal);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.form-row .legal-terms-learn-more:not(.hidden) {
|
|
33
|
-
display: block;
|
|
34
|
-
padding-top: var(--dx-g-spacing-md);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.form-row .legal-terms.no-checkbox {
|
|
38
|
-
font-family: var(--dx-g-font-sans);
|
|
39
|
-
font-size: var(--dx-g-text-xs);
|
|
40
|
-
font-weight: var(--dx-g-font-normal);
|
|
41
|
-
margin-left: 28px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.form-terms-container {
|
|
45
|
-
padding-top: var(--dx-g-spacing-sm);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.form-captcha-slot {
|
|
49
|
-
align-items: center;
|
|
50
|
-
display: flex;
|
|
51
|
-
justify-content: center;
|
|
52
|
-
}
|