@salesforce/retail-react-app 8.3.0-preview.1 → 8.4.0-nightly-20260116000329

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.
@@ -288,4 +288,181 @@ describe('configureRoutes', function () {
288
288
  expect(paths).toEqual(expectedRes)
289
289
  })
290
290
  })
291
+
292
+ describe('fuzzyPathMatching', function () {
293
+ // Expected patterns based on sites mock:
294
+ // Sites: uk (alias) / site-1 (id), us (alias) / site-2 (id)
295
+ // Locales: en-GB, fr (alias), fr-FR, it-IT (site-1), en-US, en-CA (site-2)
296
+ const sitePattern = 'uk|site-1|us|site-2'
297
+ const localePattern = 'en-GB|fr|fr-FR|it-IT|en-US|en-CA'
298
+
299
+ const fuzzyCases = [
300
+ {
301
+ urlConfig: {
302
+ site: 'path',
303
+ locale: 'path',
304
+ showDefaults: true
305
+ },
306
+ expectedRes: [
307
+ `/:site(${sitePattern})/:locale(${localePattern})/`,
308
+ '/',
309
+ `/:site(${sitePattern})/:locale(${localePattern})/category/:categoryId`,
310
+ '/category/:categoryId'
311
+ ]
312
+ },
313
+ {
314
+ urlConfig: {
315
+ site: 'path',
316
+ locale: 'path',
317
+ showDefaults: false
318
+ },
319
+ expectedRes: [
320
+ `/:site(${sitePattern})/:locale(${localePattern})/`,
321
+ '/',
322
+ `/:site(${sitePattern})/:locale(${localePattern})/category/:categoryId`,
323
+ '/category/:categoryId'
324
+ ]
325
+ },
326
+ {
327
+ urlConfig: {
328
+ site: 'query_param',
329
+ locale: 'path',
330
+ showDefaults: true
331
+ },
332
+ expectedRes: [
333
+ `/:locale(${localePattern})/`,
334
+ '/',
335
+ `/:locale(${localePattern})/category/:categoryId`,
336
+ '/category/:categoryId'
337
+ ]
338
+ },
339
+ {
340
+ urlConfig: {
341
+ site: 'query_param',
342
+ locale: 'path',
343
+ showDefaults: false
344
+ },
345
+ expectedRes: [
346
+ `/:locale(${localePattern})/`,
347
+ '/',
348
+ `/:locale(${localePattern})/category/:categoryId`,
349
+ '/category/:categoryId'
350
+ ]
351
+ },
352
+ {
353
+ urlConfig: {
354
+ site: 'path',
355
+ locale: 'query_param',
356
+ showDefaults: true
357
+ },
358
+ expectedRes: [
359
+ `/:site(${sitePattern})/`,
360
+ '/',
361
+ `/:site(${sitePattern})/category/:categoryId`,
362
+ '/category/:categoryId'
363
+ ]
364
+ },
365
+ {
366
+ urlConfig: {
367
+ site: 'path',
368
+ locale: 'query_param',
369
+ showDefaults: false
370
+ },
371
+ expectedRes: [
372
+ `/:site(${sitePattern})/`,
373
+ '/',
374
+ `/:site(${sitePattern})/category/:categoryId`,
375
+ '/category/:categoryId'
376
+ ]
377
+ },
378
+ {
379
+ urlConfig: {
380
+ site: 'query_param',
381
+ locale: 'query_param',
382
+ showDefaults: true
383
+ },
384
+ expectedRes: ['/', '/category/:categoryId']
385
+ },
386
+ {
387
+ urlConfig: {
388
+ site: 'query_param',
389
+ locale: 'query_param',
390
+ showDefaults: false
391
+ },
392
+ expectedRes: ['/', '/category/:categoryId']
393
+ },
394
+ {
395
+ urlConfig: {
396
+ site: 'path',
397
+ locale: 'path',
398
+ showDefaults: true
399
+ },
400
+ expectedRes: [
401
+ `/:site(${sitePattern})/:locale(${localePattern})/`,
402
+ '/',
403
+ '/category/:categoryId'
404
+ ],
405
+ ignoredRoutes: ['/category/:categoryId']
406
+ }
407
+ ]
408
+
409
+ fuzzyCases.forEach(({urlConfig, expectedRes, ignoredRoutes = []}) => {
410
+ test(`Should return parameterized routes with fuzzyPathMatching based on ${JSON.stringify(
411
+ urlConfig
412
+ )} config${
413
+ ignoredRoutes.length ? ` and ignore routes ${ignoredRoutes.join(',')}` : ''
414
+ }`, () => {
415
+ const config = {
416
+ app: {
417
+ url: urlConfig
418
+ }
419
+ }
420
+ const configuredRoutes = configureRoutes(routes, config, {
421
+ ignoredRoutes,
422
+ fuzzyPathMatching: true
423
+ })
424
+ const paths = configuredRoutes.map((route) => route.path)
425
+ expect(paths).toEqual(expectedRes)
426
+ })
427
+ })
428
+
429
+ test('Should generate significantly fewer routes with fuzzyPathMatching enabled', () => {
430
+ const config = {
431
+ app: {
432
+ url: {
433
+ site: 'path',
434
+ locale: 'path',
435
+ showDefaults: true
436
+ }
437
+ }
438
+ }
439
+
440
+ const explicitRoutes = configureRoutes(routes, config, {fuzzyPathMatching: false})
441
+ const fuzzyRoutes = configureRoutes(routes, config, {fuzzyPathMatching: true})
442
+
443
+ // Fuzzy matching should produce significantly fewer routes
444
+ expect(fuzzyRoutes.length).toBeLessThan(explicitRoutes.length)
445
+ // With 2 input routes, fuzzy should produce 4 (2 parameterized + 2 fallback)
446
+ expect(fuzzyRoutes).toHaveLength(4)
447
+ })
448
+
449
+ test('Should preserve route properties when using fuzzyPathMatching', () => {
450
+ const config = {
451
+ app: {
452
+ url: {
453
+ site: 'path',
454
+ locale: 'path',
455
+ showDefaults: true
456
+ }
457
+ }
458
+ }
459
+ const configuredRoutes = configureRoutes(routes, config, {fuzzyPathMatching: true})
460
+
461
+ // All routes should have the component and exact properties preserved
462
+ configuredRoutes.forEach((route) => {
463
+ expect(route.component).toBeDefined()
464
+ expect(route.exact).toBe(true)
465
+ })
466
+ })
467
+ })
291
468
  })
@@ -35,11 +35,15 @@ module.exports = {
35
35
  login: {
36
36
  passwordless: {
37
37
  enabled: false,
38
- callbackURI: 'https://webhook.site/27761b71-50c1-4097-a600-21a3b89a546c'
38
+ callbackURI: 'https://webhook.site/27761b71-50c1-4097-a600-21a3b89a546c',
39
+ landingPath: '/passwordless-login-landing'
39
40
  },
40
41
  social: {
41
42
  enabled: false,
42
43
  idps: ['google', 'apple']
44
+ },
45
+ resetPassword: {
46
+ landingPath: '/reset-password-landing'
43
47
  }
44
48
  },
45
49
  siteAliases: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/retail-react-app",
3
- "version": "8.3.0-preview.1",
3
+ "version": "8.4.0-nightly-20260116000329",
4
4
  "license": "See license in LICENSE",
5
5
  "author": "cc-pwa-kit@salesforce.com",
6
6
  "ccExtensibility": {
@@ -46,10 +46,10 @@
46
46
  "@loadable/component": "^5.15.3",
47
47
  "@peculiar/webcrypto": "^1.4.2",
48
48
  "@salesforce/cc-datacloud-typescript": "1.1.2",
49
- "@salesforce/commerce-sdk-react": "4.3.0-preview.1",
50
- "@salesforce/pwa-kit-dev": "3.15.0-preview.1",
51
- "@salesforce/pwa-kit-react-sdk": "3.15.0-preview.1",
52
- "@salesforce/pwa-kit-runtime": "3.15.0-preview.1",
49
+ "@salesforce/commerce-sdk-react": "4.4.0-nightly-20260116000329",
50
+ "@salesforce/pwa-kit-dev": "3.16.0-nightly-20260116000329",
51
+ "@salesforce/pwa-kit-react-sdk": "3.16.0-nightly-20260116000329",
52
+ "@salesforce/pwa-kit-runtime": "3.16.0-nightly-20260116000329",
53
53
  "@tanstack/react-query": "^4.28.0",
54
54
  "@tanstack/react-query-devtools": "^4.29.1",
55
55
  "@testing-library/dom": "^9.0.1",
@@ -108,5 +108,5 @@
108
108
  "maxSize": "363 kB"
109
109
  }
110
110
  ],
111
- "gitHead": "1f4623e3e297937208c62de776518b442ad08ceb"
111
+ "gitHead": "486db465c8d07569d755a510ac8bb53360e78281"
112
112
  }