Skip to content

Commit 1ae59cb

Browse files
committed
Add siteid and locale to demo path
1 parent 57593e9 commit 1ae59cb

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@ module.exports = {
1010
app: {
1111
// Customize how your 'site' and 'locale' are displayed in the url.
1212
url: {
13+
{{#if answers.project.demo.enableDemoSettings}}
14+
// Determine where the siteRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
15+
// site: 'path',
16+
// Determine where the localeRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
17+
locale: 'path',
18+
{{else}}
1319
// Determine where the siteRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
1420
// site: 'none',
1521
// Determine where the localeRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
16-
locale: 'none'
22+
locale: 'none',
23+
{{/if}}
1724
// This boolean value dictates whether or not default site or locale values are shown in the url. Defaults to: false
1825
// showDefaults: true
1926
},
2027
login: {
2128
passwordless: {
2229
// Enables or disables passwordless login for the site. Defaults to: false
23-
{{#if answers.project.demo.enablePasswordlessAndSocialLogin}}
30+
{{#if answers.project.demo.enableDemoSettings}}
2431
enabled: true,
2532
{{else}}
2633
enabled: false,
@@ -35,7 +42,7 @@ module.exports = {
3542
},
3643
social: {
3744
// Enables or disables social login for the site. Defaults to: false
38-
{{#if answers.project.demo.enablePasswordlessAndSocialLogin}}
45+
{{#if answers.project.demo.enableDemoSettings}}
3946
enabled: true,
4047
{{else}}
4148
enabled: false,

packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ module.exports = {
1010
app: {
1111
// Customize settings for your url
1212
url: {
13+
{{#if answers.project.demo.enableDemoSettings}}
14+
// Determine where the siteRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
15+
// site: 'path',
16+
// Determine where the localeRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
17+
locale: 'path',
18+
{{else}}
1319
// Determine where the siteRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
1420
// site: 'none',
1521
// Determine where the localeRef is located. Valid values include 'path|query_param|none'. Defaults to: 'none'
1622
locale: 'none',
23+
{{/if}}
1724
// This boolean value dictates whether default site or locale values are shown in the url. Defaults to: false
1825
// showDefaults: true,
1926
// This boolean value dictates whether the plus sign (+) is interpreted as space for query param string. Defaults to: false
@@ -22,7 +29,7 @@ module.exports = {
2229
login: {
2330
passwordless: {
2431
// Enables or disables passwordless login for the site. Defaults to: false
25-
{{#if answers.project.demo.enablePasswordlessAndSocialLogin}}
32+
{{#if answers.project.demo.enableDemoSettings}}
2633
enabled: true,
2734
{{else}}
2835
enabled: false,
@@ -37,7 +44,7 @@ module.exports = {
3744
},
3845
social: {
3946
// Enables or disables social login for the site. Defaults to: false
40-
{{#if answers.project.demo.enablePasswordlessAndSocialLogin}}
47+
{{#if answers.project.demo.enableDemoSettings}}
4148
enabled: true,
4249
{{else}}
4350
enabled: false,

packages/pwa-kit-create-app/scripts/create-mobify-app.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ sh.set('-e')
5959
// will ensure those escaped double quotes are still escaped after processing the template.
6060
Handlebars.registerHelper('script', (object) => object.replaceAll('"', '\\"'))
6161

62-
Handlebars.registerHelper('ifEquals', function(arg1, arg2, options) {
63-
return (arg1 == arg2) ? options.fn(this) : options.inverse(this);
64-
})
65-
6662
// Validations
6763
const validPreset = (preset) => {
6864
return ALL_PRESET_NAMES.includes(preset)
@@ -270,7 +266,7 @@ const PRESETS = [
270266
['project.commerce.isSlasPrivate']: false,
271267
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
272268
['project.einstein.siteId']: 'aaij-MobileFirst',
273-
['project.demo.enablePasswordlessAndSocialLogin']: false
269+
['project.demo.enableDemoSettings']: false
274270
},
275271
assets: ['translations'],
276272
private: false
@@ -284,7 +280,8 @@ const PRESETS = [
284280
285281
This has social and passwordless login enabled but requires a client secret to run.
286282
`,
287-
shortDescription: 'The Retail app with demo Commerce Cloud instance and a private SLAS client',
283+
shortDescription:
284+
'The Retail app with demo Commerce Cloud instance and a private SLAS client',
288285
templateSource: {
289286
type: TEMPLATE_SOURCE_NPM,
290287
id: '@salesforce/retail-react-app'
@@ -302,7 +299,7 @@ const PRESETS = [
302299
['project.commerce.isSlasPrivate']: true,
303300
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
304301
['project.einstein.siteId']: 'aaij-MobileFirst',
305-
['project.demo.enablePasswordlessAndSocialLogin']: true // True only for PWA Kit demo environments!
302+
['project.demo.enableDemoSettings']: true // True only for presets deployed to demo environments like pwa-kit.mobify-storefront.com
306303
},
307304
assets: ['translations'],
308305
private: true
@@ -328,7 +325,7 @@ const PRESETS = [
328325
['project.commerce.isSlasPrivate']: false,
329326
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
330327
['project.einstein.siteId']: 'aaij-MobileFirst',
331-
['project.demo.enablePasswordlessAndSocialLogin']: false
328+
['project.demo.enableDemoSettings']: false
332329
},
333330
assets: ['translations'],
334331
private: true
@@ -354,7 +351,7 @@ const PRESETS = [
354351
['project.commerce.isSlasPrivate']: true,
355352
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
356353
['project.einstein.siteId']: 'aaij-MobileFirst',
357-
['project.demo.enablePasswordlessAndSocialLogin']: false
354+
['project.demo.enableDemoSettings']: false
358355
},
359356
assets: ['translations'],
360357
private: true
@@ -380,7 +377,7 @@ const PRESETS = [
380377
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
381378
['project.einstein.siteId']: 'aaij-MobileFirst',
382379
['project.commerce.isSlasPrivate']: true,
383-
['project.demo.enablePasswordlessAndSocialLogin']: false
380+
['project.demo.enableDemoSettings']: false
384381
},
385382
assets: ['translations'],
386383
private: true
@@ -406,7 +403,7 @@ const PRESETS = [
406403
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
407404
['project.einstein.siteId']: 'aaij-MobileFirst',
408405
['project.commerce.isSlasPrivate']: true,
409-
['project.demo.enablePasswordlessAndSocialLogin']: false
406+
['project.demo.enableDemoSettings']: false
410407
},
411408
assets: ['translations'],
412409
private: true
@@ -432,7 +429,7 @@ const PRESETS = [
432429
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
433430
['project.einstein.siteId']: 'aaij-MobileFirst',
434431
['project.commerce.isSlasPrivate']: false,
435-
['project.demo.enablePasswordlessAndSocialLogin']: false
432+
['project.demo.enableDemoSettings']: false
436433
},
437434
assets: ['translations'],
438435
private: true

0 commit comments

Comments
 (0)