@defra/fcp-sfd-frontend-engine 0.16.0 → 0.17.0

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/dist/index.cjs CHANGED
@@ -353,19 +353,35 @@ var sortErrorsBySectionOrder = (errors, orderedSectionsToFix, SECTION_FIELD_ORDE
353
353
  };
354
354
 
355
355
  // src/presenters/address-presenter.js
356
- var addressChangeLink = (postcodeLookup) => {
357
- if (postcodeLookup) {
358
- return "/account-address-change";
359
- } else {
356
+ var addressChangeLink = (postcodeLookup, context) => {
357
+ if (context === "business") {
358
+ if (postcodeLookup) {
359
+ return "/business-address-change";
360
+ }
361
+ return "/business-address-enter";
362
+ }
363
+ if (context === "personal") {
364
+ if (postcodeLookup) {
365
+ return "/account-address-change";
366
+ }
360
367
  return "/account-address-enter";
361
368
  }
369
+ return null;
362
370
  };
363
- var addressBackLink = (postcodeLookup) => {
364
- if (postcodeLookup) {
365
- return { href: "/account-address-select" };
366
- } else {
371
+ var addressBackLink = (postcodeLookup, context) => {
372
+ if (context === "business") {
373
+ if (postcodeLookup) {
374
+ return { href: "/business-address-select" };
375
+ }
376
+ return { href: "/business-address-enter" };
377
+ }
378
+ if (context === "personal") {
379
+ if (postcodeLookup) {
380
+ return { href: "/account-address-select" };
381
+ }
367
382
  return { href: "/account-address-enter" };
368
383
  }
384
+ return null;
369
385
  };
370
386
  var buildAddressLine = (parts) => {
371
387
  return parts.filter(Boolean).join(", ") || null;
package/dist/index.js CHANGED
@@ -313,19 +313,35 @@ var sortErrorsBySectionOrder = (errors, orderedSectionsToFix, SECTION_FIELD_ORDE
313
313
  };
314
314
 
315
315
  // src/presenters/address-presenter.js
316
- var addressChangeLink = (postcodeLookup) => {
317
- if (postcodeLookup) {
318
- return "/account-address-change";
319
- } else {
316
+ var addressChangeLink = (postcodeLookup, context) => {
317
+ if (context === "business") {
318
+ if (postcodeLookup) {
319
+ return "/business-address-change";
320
+ }
321
+ return "/business-address-enter";
322
+ }
323
+ if (context === "personal") {
324
+ if (postcodeLookup) {
325
+ return "/account-address-change";
326
+ }
320
327
  return "/account-address-enter";
321
328
  }
329
+ return null;
322
330
  };
323
- var addressBackLink = (postcodeLookup) => {
324
- if (postcodeLookup) {
325
- return { href: "/account-address-select" };
326
- } else {
331
+ var addressBackLink = (postcodeLookup, context) => {
332
+ if (context === "business") {
333
+ if (postcodeLookup) {
334
+ return { href: "/business-address-select" };
335
+ }
336
+ return { href: "/business-address-enter" };
337
+ }
338
+ if (context === "personal") {
339
+ if (postcodeLookup) {
340
+ return { href: "/account-address-select" };
341
+ }
327
342
  return { href: "/account-address-enter" };
328
343
  }
344
+ return null;
329
345
  };
330
346
  var buildAddressLine = (parts) => {
331
347
  return parts.filter(Boolean).join(", ") || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/fcp-sfd-frontend-engine",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Shared frontend engine used by both the internal and external frontend applications.",
5
5
  "main": "./dist/index.cjs",
6
6
  "exports": {
@@ -6,14 +6,23 @@
6
6
  * Otherwise, they navigate to the manual address entry page.
7
7
  *
8
8
  * @param {boolean} postcodeLookup - Whether the user used a postcode lookup to find their address
9
+ * @param {string} context - The context for the address change ('business' or 'personal')
9
10
  * @returns {string} The URL path for the address change page
10
11
  */
11
- export const addressChangeLink = (postcodeLookup) => {
12
- if (postcodeLookup) {
13
- return '/account-address-change'
14
- } else {
12
+ export const addressChangeLink = (postcodeLookup, context) => {
13
+ if (context === 'business') {
14
+ if (postcodeLookup) {
15
+ return '/business-address-change'
16
+ }
17
+ return '/business-address-enter'
18
+ }
19
+ if (context === 'personal') {
20
+ if (postcodeLookup) {
21
+ return '/account-address-change'
22
+ }
15
23
  return '/account-address-enter'
16
24
  }
25
+ return null
17
26
  }
18
27
 
19
28
  /**
@@ -23,14 +32,23 @@ export const addressChangeLink = (postcodeLookup) => {
23
32
  * If they manually entered the address, the back link returns to the manual entry page.
24
33
  *
25
34
  * @param {boolean} postcodeLookup - Whether the user used a postcode lookup to find their address
35
+ * @param {string} context - The context for the address change ('business' or 'personal')
26
36
  * @returns {Object} An object with an `href` property containing the back link URL
27
37
  */
28
- export const addressBackLink = (postcodeLookup) => {
29
- if (postcodeLookup) {
30
- return { href: '/account-address-select' }
31
- } else {
38
+ export const addressBackLink = (postcodeLookup, context) => {
39
+ if (context === 'business') {
40
+ if (postcodeLookup) {
41
+ return { href: '/business-address-select' }
42
+ }
43
+ return { href: '/business-address-enter' }
44
+ }
45
+ if (context === 'personal') {
46
+ if (postcodeLookup) {
47
+ return { href: '/account-address-select' }
48
+ }
32
49
  return { href: '/account-address-enter' }
33
50
  }
51
+ return null
34
52
  }
35
53
 
36
54
  /**