Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit e5c76ee

Browse files
committed
Configure progressive reg on content page
1 parent e595807 commit e5c76ee

File tree

2 files changed

+69
-21
lines changed

2 files changed

+69
-21
lines changed

services/example-website/config/identity-x.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,33 @@ module.exports = new IdentityXConfiguration({
3838
phoneNumber: 'Mobile Phone',
3939
organization: 'Company Name',
4040
},
41-
progressiveDelay: 0.25, // hours
41+
progressiveDelay: 0.1, // hours
4242
progressiveQuestions: [
43-
{
44-
id: 'postalCode',
45-
},
46-
{
47-
id: 'street',
48-
},
49-
{
50-
id: 'countryCode',
51-
},
5243
{
5344
id: 'givenName',
5445
},
55-
{
56-
id: 'familyName',
57-
},
46+
// {
47+
// id: 'familyName',
48+
// },
49+
// {
50+
// id: 'postalCode',
51+
// },
52+
// {
53+
// id: 'street',
54+
// },
55+
// {
56+
// id: 'countryCode',
57+
// },
58+
5859
{
5960
id: '618a8a62934f8400ad4beb8f',
6061
},
6162
{
6263
id: '626fe91c79d99b27544a4c9f',
6364
},
65+
{
66+
id: '628e9333f8dbf1d5cdda43d2',
67+
},
6468

6569
],
6670
hiddenFields: [],

services/example-website/server/templates/content.marko

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import { getAsArray, get } from "@parameter1/base-cms-object-path";
2+
import defaultValue from "@parameter1/base-cms-marko-core/utils/default-value";
3+
import getContentPreview from "@parameter1/base-cms-marko-web-theme-monorail/utils/get-content-preview";
4+
15
$ const { id, type, pageNode } = data;
2-
$ const { recaptcha } = out.global;
6+
$ const { recaptcha, identityX } = out.global;
37

48
<marko-web-content-page-layout id=id type=type>
59
<@page>
@@ -22,17 +26,57 @@ $ const { recaptcha } = out.global;
2226
<div class="row mt-3">
2327
<div class="col-md-8">
2428
<div class="content-page-body">
25-
<theme-page-contents|{ blockName }| attrs={ "data-gallery-id": id }>
2629
<marko-web-p1-events-track-content-scroll-depth
2730
content=content
2831
selector=".document-container .page .row .content-page-body"
2932
/>
30-
<content-body
31-
content=content
32-
block-name=blockName
33-
display-read-next=false
34-
display-comments=false
35-
/>
33+
<theme-page-contents|{ blockName }| attrs={ "data-gallery-id": id }>
34+
$ const requiresRegistration = get(content, "userRegistration.isCurrentlyRequired");
35+
$ const progressiveRegEnabled = identityX ? identityX.config.getProgresiveQuestions().length !== 0 : false;
36+
$ const checkReg = requiresRegistration || progressiveRegEnabled;
37+
<marko-web-identity-x-access|context| enabled=checkReg>
38+
<!-- If ProgressiveReg is enabled & required: Fire it first & ignore required user fields! -->
39+
<if(progressiveRegEnabled)>
40+
$ const body = getContentPreview({ body: content.body, selector: "p:nth-of-type(1)" });
41+
<marko-web-content-body block-name=blockName obj={ body } />
42+
<div class="content-page-preview-overlay" />
43+
<theme-content-page-gate
44+
profile-confirmation=false
45+
can-access=context.canAccess
46+
is-logged-in=context.isLoggedIn
47+
has-required-access-level=context.hasRequiredAccessLevel
48+
requires-access-level=context.requiresAccessLevel
49+
requires-user-input=false
50+
requiresPUI=context.requiresPUI
51+
messages=context.messages
52+
content-gate-type="default"
53+
/>
54+
</if>
55+
<else-if(!context.canAccess || (context.requiresUserInput && requiresRegistration))>
56+
$ const body = getContentPreview({ body: content.body, selector: "p:nth-of-type(1)" });
57+
<marko-web-content-body block-name=blockName obj={ body } />
58+
<div class="content-page-preview-overlay" />
59+
<theme-content-page-gate
60+
profile-confirmation=false
61+
can-access=context.canAccess
62+
is-logged-in=context.isLoggedIn
63+
has-required-access-level=context.hasRequiredAccessLevel
64+
requires-access-level=context.requiresAccessLevel
65+
requires-user-input=context.requiresUserInput
66+
requiresPUI=context.requiresPUI
67+
messages=context.messages
68+
content-gate-type="default"
69+
/>
70+
</else-if>
71+
<else>
72+
<content-body
73+
content=content
74+
block-name=blockName
75+
display-read-next=false
76+
display-comments=false
77+
/>
78+
</else>
79+
</marko-web-identity-x-access>
3680
</theme-page-contents>
3781
</div>
3882
</div>

0 commit comments

Comments
 (0)