@newskit-render/my-account 7.25.1 → 7.26.0-alpha.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.
Files changed (2) hide show
  1. package/README.md +109 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -36,7 +36,9 @@ ACCOUNT_PROVIDER_INTERNAL_AUTH0_DOMAIN, ACCOUNT_PROVIDER_INTERNAL_CLIENT_ID, and
36
36
  If you are interested in my-account - CPS integration and you want some in-depth info about it, you can have a look at our space in [confluence](https://nidigitalsolutions.jira.com/wiki/spaces/NPP/pages/3004694700/PP+My+Account+-+MAIN)
37
37
 
38
38
  ### **Step-up MFA**
39
+
39
40
  To enable step-up MFA both `@newskit-render/api` and `@newskit-render/my-account` should have following environment variables:
41
+
40
42
  ```
41
43
  ENABLE_STEPUP_MFA="true"
42
44
  STEPUP_MFA_GO_TO_URI=""
@@ -45,6 +47,112 @@ STEPUP_MFA_GO_TO_URI=""
45
47
  ENABLE_STEPUP_MFA: disables MFA if set to anything other then 'true' or excluded
46
48
  STEPUP_MFA_GO_TO_URI: used to decide where to redirect user on succesfull MFA calls.
47
49
 
50
+ ### **Tracking user interactions - Tealium config**
51
+
52
+ We rely on Tealium in combination with Newskit to track user interaction. In the my-account package we track user interactions ( such as clicking ) in two ways, depending on what component we want to track:
53
+
54
+ When using Newskit components that are by nature interactive ( buttons, switches, links, etc. ) we pass an `eventContext` object, with the following shape:
55
+
56
+ ```
57
+ eventContext: {
58
+ key[string]: string
59
+ }
60
+ ```
61
+
62
+ which contains the Tealium key-value pairs needed for analytics (e.g. `event_navigation_name: "sidebar option selection"`)
63
+ And an
64
+
65
+ ```
66
+ eventOriginator: string
67
+ ```
68
+
69
+ used to pass information on which interactive element was used to trigger the event ( e.g. `eventOriginator: "primary button"`).
70
+ Wrapper components, exported form shared-components, such as the ButtonGroup, use the `eventOriginator` and `eventContext` internally.
71
+
72
+ For example, when using the ButtonGroup component, exported from shared-components, we can pass the Teallium configuration for the buttons as such:
73
+
74
+ ```
75
+ props: {
76
+ buttonGroupProps: {
77
+ primaryButton: {
78
+ text: 'Save',
79
+ eventContext: {
80
+ event_navigation_action: 'navigation',
81
+ event_navigation_name: 'button:save',
82
+ event_navigation_browsing_method: EventTrigger.Click,
83
+ },
84
+ ariaLabel: 'Save and go back to ...',
85
+ },
86
+ secondaryButton: {
87
+ eventContext: {
88
+ event_navigation_action: 'navigation',
89
+ event_navigation_name: 'button:cancel',
90
+ event_navigation_browsing_method: EventTrigger.Click,
91
+ },
92
+ ariaLabel: 'Cancel and go back to ...',
93
+ href: '[baseURL]/my-url',
94
+ },
95
+ },
96
+ ...moreContext,
97
+ },
98
+
99
+ ```
100
+
101
+ The ButtonGroup will add the event originator automatically.
102
+
103
+ For the components that are _NOT_ naturally interactive ( like the StructuredListItem ), but we have added interactivity to them, the Tealium tracking can be added with the function `createClickEvent`, which is exported from [shared-components](https://github.com/newscorp-ghfb/ncu-newskit-render/blob/0863db264f900d618688d908bad3b07f0ce65a03/packages/shared-components/src/utils/tracking.tsx) package.
104
+
105
+ It takes the following params:
106
+
107
+ ```
108
+ createClickEvent(
109
+ originator: string,
110
+ text: string,
111
+ label?: string,
112
+ articleParentName?: string,
113
+ pageName?: string,
114
+ event_navigation_action = 'navigation'
115
+ )
116
+ ```
117
+
118
+ And returns a Tealium configuration object for a click event.
119
+
120
+ When using this function, we rely on the `PUBLISHER` environment variable to keep the tracking title agnostic. In the future, we will move the Teallium configuration for these cases to the contexts.
121
+
122
+ **Page loading events**
123
+
124
+ In many cases we want to track visitor’s landing on a page. To do this, we use the [usePageViewTracking](https://github.com/newscorp-ghfb/ncu-newskit-render/blob/0863db264f900d618688d908bad3b07f0ce65a03/packages/shared-components/src/utils/tracking.tsx) hook, exported from `shared-components`. The hook accepts an object as an argument:
125
+
126
+ ```
127
+ interface TealiumEventContext {
128
+ originator: string
129
+ context: Record<string, string>
130
+ }
131
+ ```
132
+
133
+ And is triggered only if such an object is passed to it via the page’s context.
134
+
135
+ The context’s key for page view tracking is `tealiumContext`. For example:
136
+
137
+ ```
138
+ const personalDetailsContext = {
139
+ …otherContextValues,
140
+ tealiumContext: {
141
+ originator: 'page view',
142
+ context: {
143
+ page_site_name: ‘you ‘site name,
144
+ page_section: 'my account',
145
+ page_type: ‘personal ‘details,
146
+ page_restrictions: 'restricted',
147
+ page_name: 'personal details',
148
+ ‘some_other_key’: ‘some other value’
149
+ },
150
+ },
151
+ }
152
+ ```
153
+
154
+ For contributors: the rules for keeping the package title agnostic are the same.
155
+
48
156
  ### **Theming**
49
157
 
50
158
  The my-account package appearance can be controlled by a custom theme. The package uses NewsKit's theming system to enable customisation. See [Newskit theming](https://www.newskit.co.uk/theming/overview)
@@ -743,6 +851,7 @@ infoBanner {
743
851
  disableClose?: boolean
744
852
  }
745
853
  ```
854
+
746
855
  When the close button is clicked, a new object with the key as the banner name and the value as "dismissed" will be added to the local storage. The banner will remain invisible as long as this local storage value is present.
747
856
 
748
857
  ## Address Form - Loqate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/my-account",
3
- "version": "7.25.1",
3
+ "version": "7.26.0-alpha.0",
4
4
  "description": "Newskit Render",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",