# Upgrading from v8 to v9

The main feature in `prestations-ng` v9 is the update of the `@angular/*` peer dependencies
to `^8.0.0`.

Some deprecated features from `prestations-ng` have also been removed. See below for more information.

`@dsivd/presations-ng` now requires a version **`6.12.0`** of `prestations-be` at minimum.

## Updating Angular

`prestations-ng` now supports Angular 8. You can follow the Angular update guide
at this address:

[https://update.angular.io/#7.0:8.0](https://update.angular.io/#7.0:8.0)

```bash
yarn global add @angular/cli@8
ng update @angular/cli@8 @angular/core@8
ng update @dsivd/prestations-ng@^10.16.11
ng update ng-http-loader@6.0.1
ng update \
    @types/jasmine \
    @types/node \
    ts-node \
    tslint
yarn upgrade
```

Then fix any `TODO` the schematics might have added.

## Differential Loading

The `browserslist` must support IE11:

```text
> 0.5%
last 2 versions
Firefox ESR
not dead
IE 11
Safari >= 10
ios_saf >= 10
```

Remove `"es5BrowserSupport": true` from `angular.json`

```diff
    "assets": ["src/favicon.ico", "src/assets", "src/api"],
    "styles": ["src/styles.css"],
    "scripts": [],
-   "es5BrowserSupport": true
},
"configurations": {
    "production": {
        "fileReplacements": [
```

## Polyfill

Use the default Angular polyfills in `polyfills.ts`:

```typescript
/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone'; // Included with Angular CLI.
```

If you were including `import 'core-js/es7/array';` just for prestations-ng,
you can get rid of it.

## Issue with `proxy.conf.json`

If you're experiencing issues, when during development, a page cannot be reloaded, you
might want to consider removing the second element in the standard `proxy.conf.json`.

```diff
{
    "/pub/101102/api/*": {
        "target": "http://localhost:16400",
        "changeOrigin": true,
        "secure": false,
        "pathRewrite": {
            "^/api": ""
        }
    },
-    "/pub/101102/*": {
-        "target": "http://localhost:4200",
-        "changeOrigin": true,
-        "secure": false,
-        "logLevel": "debug",
-        "pathRewrite": {
-            "^/pub/101102": ""
-        }
-    }
}
```

For some reason the development webserver now starts at `http://localhost:4200/pub/101102`
rather than `http://localhost:4200`.

### `footerLinks` on the `foehn-page` component

By default the `foehn-page` adds two footer links. You should get rid of your custom `footerLinks`, or
hide the default links.

**Remove the custom footer links**

```diff
<foehn-page
-    [footerLinks]="footerLinks"
></foehn-page>
```

**Hide the default links**

```diff
<foehn-page
     [footerLinks]="footerLinks"
+    [showDefaultContactFooterLink]="false"
+    [showDefaultGuideFooterLink]="false"
></foehn-page>
```

## Deprecated Features Removed

The following components, attributes or methods have been removed.

### `AbstractPageComponent`

`initPageInfo` has been removed. Use `setPageTitle` and `breadcrumbEventService.setConfiguration` separately.

Moreover, the `foehn-form` component is now statically referenced from `AbstractPageComponent`. You must
not hide with an `*ngIf` the `foehn-form` in any component extending `AbstractPageComponent`.

Optional model when extending `AbstractPageComponent` has been removed. You now need to specify the page model.

### `PrestationsNgModule`

This module has been removed completely. Use `prestationsNgCoreModule` and individual modules instead.

### `FoehnPageComponent`

The attribute `headerTitle` have been removed as it wasn't used at all. You can safely remove it.

### `SdkPaymentPanelComponent`

The component has been completely removed as it wasn't used anywhere. If you need a similar functionality,
please implement it in your application.

### `SdkRecaptchaComponent`

The attribute `reference` has been removed as it wasn't used anymore.

The attribute `siteKey` has been removed. Please configure the public key in the properties
as described in the [Captcha Configuration documentation](https://dsi-vd.github.io/prestations-ng/captcha#configuration).

### `BreadcrumbEventService`

Removed `initPrestationBreadcrumb`. Use `setConfiguration` instead.
