@pagopa/selfcare-common-frontend 1.2.2 → 1.4.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/CHANGELOG.md CHANGED
@@ -4,20 +4,79 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### 1.2.2
7
+ #### [v1.4.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.3.1...v1.4.0)
8
+
9
+ - Selc 144 track events [`#19`](https://github.com/pagopa/selfcare-common-frontend/pull/19)
10
+ - Selc 144 track events (#19) [`#144`](https://pagopa.atlassian.net/browse/144)
11
+
12
+ #### [v1.3.1](https://github.com/pagopa/selfcare-common-frontend/compare/v1.3.0...v1.3.1)
13
+
14
+ > 7 February 2022
15
+
16
+ - analyticsService will accept a callback [`#18`](https://github.com/pagopa/selfcare-common-frontend/pull/18)
17
+
18
+ #### [v1.3.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.2.3...v1.3.0)
19
+
20
+ > 4 February 2022
21
+
22
+ - SELC-145 e SELC-144 [`#17`](https://github.com/pagopa/selfcare-common-frontend/pull/17)
23
+ - SELC-144 analytcsService through mixPanel [`#16`](https://github.com/pagopa/selfcare-common-frontend/pull/16)
24
+ - SELC-145 e SELC-144 (#17) [`#145`](https://pagopa.atlassian.net/browse/145) [`#144`](https://pagopa.atlassian.net/browse/144) [`#145`](https://pagopa.atlassian.net/browse/145)
25
+ - SELC-144 analytcsService through mixPanel (#16) [`#144`](https://pagopa.atlassian.net/browse/144)
26
+
27
+ #### [v1.2.3](https://github.com/pagopa/selfcare-common-frontend/compare/v1.2.2...v1.2.3)
28
+
29
+ > 3 February 2022
30
+
31
+ - SELC-450 filterModal will discard selected when closed [`#15`](https://github.com/pagopa/selfcare-common-frontend/pull/15)
32
+ - fixed withLogin mock [`#14`](https://github.com/pagopa/selfcare-common-frontend/pull/14)
33
+ - SELC-450 filterModal will discard selected when closed (#15) [`#450`](https://pagopa.atlassian.net/browse/450) [`#450`](https://pagopa.atlassian.net/browse/450)
34
+
35
+ #### [v1.2.2](https://github.com/pagopa/selfcare-common-frontend/compare/v1.2.1...v1.2.2)
36
+
37
+ > 2 February 2022
8
38
 
9
39
  - Selc 447 session modal defaults [`#13`](https://github.com/pagopa/selfcare-common-frontend/pull/13)
40
+ - Selc 447 session modal defaults (#13) [`#447`](https://pagopa.atlassian.net/browse/447)
41
+
42
+ #### [v1.2.1](https://github.com/pagopa/selfcare-common-frontend/compare/v1.2.0...v1.2.1)
43
+
44
+ > 2 February 2022
45
+
10
46
  - SELC-417 fixed useUnloadEventInterceptor useEffect [`#12`](https://github.com/pagopa/selfcare-common-frontend/pull/12)
47
+ - SELC-417 fixed useUnloadEventInterceptor useEffect (#12) [`#417`](https://pagopa.atlassian.net/browse/417) [`#417`](https://pagopa.atlassian.net/browse/417)
48
+
49
+ #### [v1.2.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.1.1...v1.2.0)
50
+
51
+ > 1 February 2022
52
+
11
53
  - added api-utils and utility to use together with @pagopa/openapi-codegen-ts [`#11`](https://github.com/pagopa/selfcare-common-frontend/pull/11)
12
54
  - Selc-408 fix concurrent notify [`#10`](https://github.com/pagopa/selfcare-common-frontend/pull/10)
13
55
  - bug fix [`#8`](https://github.com/pagopa/selfcare-common-frontend/pull/8)
14
56
  - Selc 408 Implementare gestione notifiche utente [`#7`](https://github.com/pagopa/selfcare-common-frontend/pull/7)
57
+ - Selc-408 fix concurrent notify (#10) [`#408`](https://pagopa.atlassian.net/browse/408)
58
+ - Selc 417 (#9) - UnloadEventInterceptor feature [`#417`](https://pagopa.atlassian.net/browse/417)
59
+
60
+ #### [v1.1.1](https://github.com/pagopa/selfcare-common-frontend/compare/v1.1.0...v1.1.1)
61
+
62
+ > 27 January 2022
63
+
15
64
  - fix EndingPage width [`#6`](https://github.com/pagopa/selfcare-common-frontend/pull/6)
65
+
66
+ #### [v1.1.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.0.0...v1.1.0)
67
+
68
+ > 27 January 2022
69
+
16
70
  - SELC 369 [`#5`](https://github.com/pagopa/selfcare-common-frontend/pull/5)
17
71
  - SELC-393 Gestione visualizzazione errore tramite Toast [`#4`](https://github.com/pagopa/selfcare-common-frontend/pull/4)
18
72
  - Bump node-fetch from 3.0.0 to 3.1.1 [`#3`](https://github.com/pagopa/selfcare-common-frontend/pull/3)
19
73
  - Bump nanoid from 3.1.30 to 3.2.0 [`#2`](https://github.com/pagopa/selfcare-common-frontend/pull/2)
20
- - Bump follow-redirects from 1.14.4 to 1.14.7 [`#1`](https://github.com/pagopa/selfcare-common-frontend/pull/1)
21
- - common logic extracted [`06d5b9c`](https://github.com/pagopa/selfcare-common-frontend/commit/06d5b9cc4d9a653e8ed08294efa011cd40cf80b7)
22
- - Selc 417 (#9) - UnloadEventInterceptor feature [`59e769d`](https://github.com/pagopa/selfcare-common-frontend/commit/59e769d382f422a7ab6c687a0e8655854df25193)
23
- - example code [`37e354d`](https://github.com/pagopa/selfcare-common-frontend/commit/37e354d15a0d7e74a6e568127267ce17cd6b78fa)
74
+ - SELC 369 (#5) [`#369`](https://pagopa.atlassian.net/browse/369)
75
+ - SELC-393 Gestione visualizzazione errore tramite Toast (#4) [`#393`](https://pagopa.atlassian.net/browse/393)
76
+ - fixed useLoading unitTest [`371e31b`](https://github.com/pagopa/selfcare-common-frontend/commit/371e31b89cf2d4f3d8d23a8977c619509844d904)
77
+
78
+ ### [v1.0.0](https://github.com/pagopa/selfcare-common-frontend/compare/v0.1.4...v1.0.0)
79
+
80
+ > 21 January 2022
81
+
82
+ - common library completed [`2bd0acc`](https://github.com/pagopa/selfcare-common-frontend/commit/2bd0acc6c09f042249861ad33446dd00a38ca41d)
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
+ # SelfCare's common components & features
2
+ This library contains utility, components and features built for the selfcare project.
3
+
4
+ # Configuration
5
+ In order to use these components it's necessary to set the following keys of the CONFIG object imported from /config/env as first things inside the application:
6
+
7
+ | Key | Type | Description | DefaultValue |
8
+ | URL_FE.LOGIN | string | The url of the login page | /auth/login |
9
+ | URL_FE.LOGOUT | string | The url of the logout page | /auth/logout |
10
+ | URL_FE.ASSISTANCE | string | The url of the assistance page | /assistenza |
11
+ | MOCKS.MOCK_USER | boolean | If the application should configure a logged mocked User usable in DEV environment | false |
12
+ | ANALYTICS.* | | See [analitics feature](#analytics) | |
13
+ | CONSENT.* | | See [consent management feature](#consent-management) | |
14
+
1
15
  # Common components used to build pagopa/selfcare react projects
2
16
  ## Header
3
17
  SelfCare Header component
@@ -160,7 +174,7 @@ An utility script to use when generating the stub through @pagopa/openapi-codege
160
174
  This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
161
175
  This decorator has to be applied to components whose acces require an active session.
162
176
  Accessing to the components decorated with it without a session will brought to the login page.
163
- It's possible to modify the login path changing the value in CONFIG.login inside the index.tsx file
177
+ It's possible to modify the login path changing the value in [CONFIG.URL_FE.LOGIN](#Configuration) inside the index.tsx file
164
178
 
165
179
  # Common features used in pagopa/selfcare react projects
166
180
  ## LoadingOverlay
@@ -194,7 +208,7 @@ The error to be submitted has type AppError which has the following fields:
194
208
  | toNotify | boolean | Y | If true, it will notify the error |
195
209
  | component | string | N | Can render a SessionModal or Toast component |
196
210
 
197
- ASIS the notify consists just on the console.error invocation
211
+ The error will be notified as a GENERIC_ERROR through the [analytcs feature](#analytics)
198
212
 
199
213
  ## UserNotifyHandle
200
214
  This feature is based on react-redux library and require to register the reducer build in appStateSlice into the application's redux store.
@@ -233,3 +247,40 @@ In order to show a custom pop-up when the user trigger an exit action you have t
233
247
 
234
248
  When the exitAction is the Logout you can use the custom hook useUnloadEventLogout which is the customization of the useUnloadEventOnExit using the logout as an exit action.
235
249
 
250
+ ## Analytics
251
+ This feature allow to track the application events through an analytics tool.
252
+ The actual version of the library make use of [mixpanel tool](https://mixpanel.com/) to handle the tracking.
253
+
254
+ In order to start the analytics you have to call the initAnalytics method imported from the service/analyticsService module, otherwise this feature will be ignored
255
+
256
+ This feature can be configured with the following keys of the [CONFIG](#Configuration) object (each key has the ANALYTCS. prefix):
257
+
258
+ | Key | Type | Description | DefaultValue |
259
+ |-----|------|-------------|--------------|
260
+ | ENABLED | boolean | If disabled, it will do nothing (except for event having name GENERIC_ERROR, if disabled, these events will be printed through console.error) | false |
261
+ | MOCK | boolean | If true, it will print the event through the console.log function | false |
262
+ | DEBUG | boolean | If the mixpanel's debug feature should be enabled | false |
263
+ | TOKEN | string | The token to use when sending event data | |
264
+ | API_HOST | string | The url where to send mixpanel events | `https://api-eu.mixpanel.com` |
265
+ | PERSISTENCE | string | Where to store session data, possible values are cookie or localStorage | localStorage |
266
+ | LOG_IP | boolean | If the ip should be sent | false |
267
+ | LOG_IP | boolean | If the ip should be sent | false |
268
+ | PROPERTY_BLACKLIST | Array<string> | If the ip should be sent | ["$current_url", "$initial_referrer", "$referrer"] |
269
+ | ADDITIONAL_PROPERTIES | {[key: string]: string} | An object containing a fixed set of properties to send every time, overridden if the actual event will report the same properties | {} |
270
+ | ADDITIONAL_PROPERTIES_IMPORTANT | {[key: string]: string} | As ADDITIONAL_PROPERTIES, but these properties will take the precedence overriding events conflicting properties | {} |
271
+
272
+ In order track an event (once the initAnalytics method has been invoked) you have to call the trackEvent(event_name: string, properties?: any, callback?: () => void)=> void method where:
273
+ * event_name: the name of the event
274
+ * properties: the additional payload sent with the event
275
+ * callback: an action taken when the track has completed (If the action taken immediately after the track is an exit action from the application, it's better to use this callback to perform the exit, in order to give to mixPanel the time to send the event)
276
+
277
+ ## Consent management
278
+ This feature allows the automatic enabling of the [analytics feature](#analytics) only when the user accept to send that data.
279
+
280
+ The tool used is [OneTrust](#https://www.onetrust.it/), and in order to be able to use it, you have:
281
+ 1. to put the [script](#https://about.gitlab.com/handbook/marketing/inbound-marketing/digital-experience/onetrust-cookie-consent/#implementation) tag obtained when registering to the service inside the head section of your index.html file.
282
+ 2. import the consentManagementConfigure.ts script inside your index.ts file (after the configuration of the common library)
283
+
284
+ | Key | Type | Description | DefaultValue |
285
+ |-----|------|-------------|--------------|
286
+ | COOKIE_GROUP_ANALYTICS | string | The cookie group configured for the analytics tool. MixPanel's cookies are configured as default by OneTrust with C0004 group, or as Targeting Cookies | C0004 |
package/build.info CHANGED
@@ -1,2 +1,2 @@
1
- 20220202.2 - selfcare-common-frontend.deploy(18875)
2
- tags/v1.2.2^0 504858b61e5a76d093014dae8c7ba484879d5a78
1
+ 20220208.1 - selfcare-common-frontend.deploy(19745)
2
+ tags/v1.4.0^0 3c655fdaf41c28e1bda9bf7a4e7f28659be1c83e
@@ -12,6 +12,7 @@ const ClearOutlined_1 = (0, tslib_1.__importDefault)(require("@mui/icons-materia
12
12
  function FilterModal({ open, handleClose, title, filterModalConfig, height = '16em', minHeight = '16em', }) {
13
13
  const theme = (0, styles_1.useTheme)();
14
14
  const fullScreen = (0, useMediaQuery_1.default)(theme.breakpoints.down('xs'));
15
+ React.useEffect(() => setValueRadio(''), [open]);
15
16
  const [valueRadio, setValueRadio] = React.useState('');
16
17
  const handleChange = (_, value) => {
17
18
  setValueRadio(value);
@@ -1 +1 @@
1
- {"version":3,"file":"FilterModal.js","sourceRoot":"","sources":["../../src/lib/components/FilterModal.tsx"],"names":[],"mappings":";;;;AAAA,0DAA+B;AAC/B,4CASuB;AACvB,+EAA0C;AAC1C,6FAAwD;AACxD,iDAAgD;AAChD,mGAAkE;AA2BlE,8EAA8E;AAC9E,SAAwB,WAAW,CAAC,EAClC,IAAI,EACJ,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,MAAM,GAAG,MAAM,EACf,SAAS,GAAG,MAAM,GACZ;IACN,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/D,MAAM,CAAC,UAAU,EAAE,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AU,EAAE,KAAK,EAAE,gBACjE,cAAc,KAAK,EAAE,YACX,aACR,YACF,EAEP,uBAAC,eAAI,kBAAC,SAAS,QAAC,IAAI,sBAClB,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,gBACtB,uBAAC,qBAAU,gCACE,QAAQ,EACnB,IAAI,EAAC,gCAAgC,EACrC,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,YAAY,gBAErB,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,uBAAC,2BAAgB,IACf,KAAK,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,QAAQ,CAAC,KAAK,CAAC,EACzC,OAAO,EAAE,uBAAC,gBAAK,aAAG,EAClB,KAAK,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,QAAQ,CAAC,KAAK,CAAC,IACpC,KAAK,CACV,CACH,CAAC,YACS,YACR,YACF,EAEP,uBAAC,eAAI,kBAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,gBACtB,uBAAC,iBAAM,kBACL,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAC3C,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,YAAY,oCAGd,YACJ,aACH,YACD,YACA,CACV,CAAC;AACJ,CAAC;AAjFD,8BAiFC"}
@@ -27,7 +27,7 @@ function UnloadEventHandler() {
27
27
  unloadEventconfiguration.exitAction();
28
28
  }
29
29
  };
30
- return ((0, jsx_runtime_1.jsx)(SessionModal_1.default, { open: unloadEventconfiguration.enabled && unloadEventconfiguration.open, title: (_a = unloadEventconfiguration.title) !== null && _a !== void 0 ? _a : 'Vuoi davvero uscire?', message: (_b = unloadEventconfiguration.description) !== null && _b !== void 0 ? _b : 'Se esci, la richiesta di assistenza andrà persa.', onConfirm: onConfirm, onConfirmLabel: 'Esci', handleClose: onClose }, void 0));
30
+ return ((0, jsx_runtime_1.jsx)(SessionModal_1.default, { open: unloadEventconfiguration.enabled && unloadEventconfiguration.open, title: (_a = unloadEventconfiguration.title) !== null && _a !== void 0 ? _a : 'Vuoi davvero uscire?', message: (_b = unloadEventconfiguration.description) !== null && _b !== void 0 ? _b : 'Se esci, le modifiche apportate andranno perse.', onConfirm: onConfirm, onConfirmLabel: 'Esci', handleClose: onClose }, void 0));
31
31
  }
32
32
  exports.default = UnloadEventHandler;
33
33
  //# sourceMappingURL=UnloadEventHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnloadEventHandler.js","sourceRoot":"","sources":["../../src/lib/components/UnloadEventHandler.tsx"],"names":[],"mappings":";;;;AAAA,6CAAuD;AACvD,kFAA+E;AAC/E,iEAAmF;AACnF,+EAA0C;AAE1C;;;;;;EAME;AACF,SAAwB,kBAAkB;;IACxC,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,wBAAwB,GAAG,IAAA,yBAAW,EAAC,iCAAiB,CAAC,8BAA8B,CAAC,CAAC;IAC/F,MAAM,EAAC,qBAAqB,EAAC,GAAG,IAAA,qDAAyB,GAAE,CAAC;IAE5D,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,CAAC,+BAAe,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC;IACF,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,qBAAqB,EAAE,CAAC;QACxB,IAAI,wBAAwB,CAAC,UAAU,EAAE;YACvC,wBAAwB,CAAC,UAAU,EAAE,CAAC;SACvC;IACH,CAAC,CAAC;IACF,OAAO,CACL,uBAAC,sBAAY,IACX,IAAI,EAAE,wBAAwB,CAAC,OAAO,IAAI,wBAAwB,CAAC,IAAI,EACvE,KAAK,EAAE,MAAA,wBAAwB,CAAC,KAAK,mCAAI,sBAAsB,EAC/D,OAAO,EACL,MAAA,wBAAwB,CAAC,WAAW,mCAAI,kDAAkD,EAE5F,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,OAAO,WACpB,CACH,CAAC;AACJ,CAAC;AA1BD,qCA0BC"}
1
+ {"version":3,"file":"UnloadEventHandler.js","sourceRoot":"","sources":["../../src/lib/components/UnloadEventHandler.tsx"],"names":[],"mappings":";;;;AAAA,6CAAuD;AACvD,kFAA+E;AAC/E,iEAAmF;AACnF,+EAA0C;AAE1C;;;;;;EAME;AACF,SAAwB,kBAAkB;;IACxC,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,MAAM,wBAAwB,GAAG,IAAA,yBAAW,EAAC,iCAAiB,CAAC,8BAA8B,CAAC,CAAC;IAC/F,MAAM,EAAE,qBAAqB,EAAE,GAAG,IAAA,qDAAyB,GAAE,CAAC;IAE9D,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,CAAC,+BAAe,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC;IACF,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,qBAAqB,EAAE,CAAC;QACxB,IAAI,wBAAwB,CAAC,UAAU,EAAE;YACvC,wBAAwB,CAAC,UAAU,EAAE,CAAC;SACvC;IACH,CAAC,CAAC;IACF,OAAO,CACL,uBAAC,sBAAY,IACX,IAAI,EAAE,wBAAwB,CAAC,OAAO,IAAI,wBAAwB,CAAC,IAAI,EACvE,KAAK,EAAE,MAAA,wBAAwB,CAAC,KAAK,mCAAI,sBAAsB,EAC/D,OAAO,EACL,MAAA,wBAAwB,CAAC,WAAW,mCAAI,iDAAiD,EAE3F,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,OAAO,WACpB,CACH,CAAC;AACJ,CAAC;AA1BD,qCA0BC"}
package/config/env.d.ts CHANGED
@@ -7,4 +7,19 @@ export declare const CONFIG: {
7
7
  MOCKS: {
8
8
  MOCK_USER: boolean;
9
9
  };
10
+ ANALYTCS: {
11
+ ENABLE: boolean;
12
+ MOCK: boolean;
13
+ DEBUG: boolean;
14
+ TOKEN: string;
15
+ API_HOST: string;
16
+ PERSISTENCE: string;
17
+ LOG_IP: boolean;
18
+ PROPERTY_BLACKLIST: string[];
19
+ ADDITIONAL_PROPERTIES: {};
20
+ ADDITIONAL_PROPERTIES_IMPORTANT: {};
21
+ };
22
+ CONSENT: {
23
+ COOKIE_GROUP_ANALYTICS: string;
24
+ };
10
25
  };
package/config/env.js CHANGED
@@ -12,5 +12,20 @@ exports.CONFIG = {
12
12
  MOCKS: {
13
13
  MOCK_USER: env.get('REACT_APP_MOCK_USER').default('false').asBool(),
14
14
  },
15
+ ANALYTCS: {
16
+ ENABLE: env.get('REACT_APP_ANALYTICS_ENABLE').default('false').asBool(),
17
+ MOCK: env.get('REACT_APP_ANALYTICS_MOCK').default('false').asBool(),
18
+ DEBUG: env.get('REACT_APP_ANALYTICS_DEBUG').default('false').asBool(),
19
+ TOKEN: env.get('REACT_APP_MIXPANEL_TOKEN').default('').asString(),
20
+ API_HOST: 'https://api-eu.mixpanel.com',
21
+ PERSISTENCE: 'localStorage',
22
+ LOG_IP: false,
23
+ PROPERTY_BLACKLIST: ['$current_url', '$initial_referrer', '$referrer'],
24
+ ADDITIONAL_PROPERTIES: {},
25
+ ADDITIONAL_PROPERTIES_IMPORTANT: {},
26
+ },
27
+ CONSENT: {
28
+ COOKIE_GROUP_ANALYTICS: 'C0004',
29
+ },
15
30
  };
16
31
  //# sourceMappingURL=env.js.map
package/config/env.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/config/env.ts"],"names":[],"mappings":";;;;AAAA,0DAA+B;AAElB,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE;QACN,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,cAAc;QACtB,UAAU,EAAE,aAA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use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const env_1 = require("./config/env");
4
+ const analyticsService_1 = require("./services/analyticsService");
5
+ // target cookies (Mixpanel)
6
+ const targCookiesGroup = env_1.CONFIG.CONSENT.COOKIE_GROUP_ANALYTICS;
7
+ // OneTrust callback at first time
8
+ // eslint-disable-next-line functional/immutable-data
9
+ window.OptanonWrapper = function () {
10
+ OneTrust.OnConsentChanged(function () {
11
+ const activeGroups = OnetrustActiveGroups;
12
+ if (activeGroups.indexOf(targCookiesGroup) > -1) {
13
+ (0, analyticsService_1.initAnalytics)();
14
+ }
15
+ });
16
+ };
17
+ // check mixpanel cookie consent in cookie
18
+ const OTCookieValue = document.cookie.split('; ').find((row) => row.startsWith('OptanonConsent=')) || '';
19
+ const checkValue = `${targCookiesGroup}%3A1`;
20
+ if (OTCookieValue.indexOf(checkValue) > -1) {
21
+ (0, analyticsService_1.initAnalytics)();
22
+ }
23
+ //# sourceMappingURL=consentManagementConfigure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consentManagementConfigure.js","sourceRoot":"","sources":["../src/lib/consentManagementConfigure.ts"],"names":[],"mappings":";;AAAA,sCAAsC;AACtC,kEAA4D;AAM5D,4BAA4B;AAC5B,MAAM,gBAAgB,GAAG,YAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC;AAE/D,kCAAkC;AAClC,qDAAqD;AACrD,MAAM,CAAC,cAAc,GAAG;IACtB,QAAQ,CAAC,gBAAgB,CAAC;QACxB,MAAM,YAAY,GAAG,oBAAoB,CAAC;QAC1C,IAAI,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE;YAC/C,IAAA,gCAAa,GAAE,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AACF,0CAA0C;AAC1C,MAAM,aAAa,GACjB,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC;AACrF,MAAM,UAAU,GAAG,GAAG,gBAAgB,MAAM,CAAC;AAC7C,IAAI,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;IAC1C,IAAA,gCAAa,GAAE,CAAC;CACjB"}
@@ -18,9 +18,10 @@ const verifyMockExecution = (state) => {
18
18
  exports.verifyMockExecution = verifyMockExecution;
19
19
  exports.default = (WrappedComponent) => () => {
20
20
  const dispatch = (0, react_redux_1.useDispatch)();
21
+ const loggedUser = (0, react_redux_1.useSelector)(userSlice_1.userSelectors.selectLoggedUser);
21
22
  (0, react_1.useEffect)(() => {
22
23
  dispatch(userSlice_1.userActions.setLoggedUser(exports.mockedUser));
23
24
  }, []);
24
- return (0, jsx_runtime_1.jsx)(WrappedComponent, {}, void 0);
25
+ return loggedUser ? (0, jsx_runtime_1.jsx)(WrappedComponent, {}, void 0) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
25
26
  };
26
27
  //# sourceMappingURL=withLogin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withLogin.js","sourceRoot":"","sources":["../../../src/lib/decorators/__mocks__/withLogin.tsx"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAClC,6CAA0C;AAE1C,4DAA2D;AAE9C,QAAA,UAAU,GAAS;IAC9B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAAC,KAAU,EAAE,EAAE;IAChD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,kBAAU,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF,kBAAe,C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CHANGED
@@ -1,21 +1,13 @@
1
1
  export { default as Header } from './components/Header/Header';
2
- export * from './components/Header/Header';
3
2
  export { default as Footer } from './components/Footer/Footer';
4
- export * from './components/Footer/Footer';
5
3
  export { default as CustomAvatar } from './components/CustomAvatar';
6
- export * from './components/CustomAvatar';
7
4
  export { default as CustomPagination } from './components/CustomPagination';
8
- export * from './components/CustomPagination';
9
5
  export { default as FilterModal } from './components/FilterModal';
10
- export * from './components/FilterModal';
11
6
  export { default as SessionModal } from './components/SessionModal';
12
- export * from './components/SessionModal';
13
7
  export { default as TitleBox } from './components/TitleBox';
14
- export * from './components/TitleBox';
15
8
  export { default as Toast } from './components/Toast';
16
- export * from './components/Toast';
9
+ export { default as EndingPage } from './components/EndingPage';
17
10
  export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary';
18
- export * from './components/ErrorBoundary/ErrorBoundary';
19
11
  export { default as LoadingOverlay } from './components/Loading/LoadingOverlay';
20
- export * from './components/Loading/LoadingOverlay';
21
- export { default as EndingPage } from './components/EndingPage';
12
+ export { default as UserNotifyHandle } from './components/UserNotifyHandle';
13
+ export { default as UnloadEventHandler } from './components/UnloadEventHandler';
package/index.js CHANGED
@@ -1,37 +1,33 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EndingPage = exports.LoadingOverlay = exports.ErrorBoundary = exports.Toast = exports.TitleBox = exports.SessionModal = exports.FilterModal = exports.CustomPagination = exports.CustomAvatar = exports.Footer = exports.Header = void 0;
4
- const tslib_1 = require("tslib");
6
+ exports.UnloadEventHandler = exports.UserNotifyHandle = exports.LoadingOverlay = exports.ErrorBoundary = exports.EndingPage = exports.Toast = exports.TitleBox = exports.SessionModal = exports.FilterModal = exports.CustomPagination = exports.CustomAvatar = exports.Footer = exports.Header = void 0;
5
7
  var Header_1 = require("./components/Header/Header");
6
- Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Header_1).default; } });
7
- (0, tslib_1.__exportStar)(require("./components/Header/Header"), exports);
8
+ Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return __importDefault(Header_1).default; } });
8
9
  var Footer_1 = require("./components/Footer/Footer");
9
- Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Footer_1).default; } });
10
- (0, tslib_1.__exportStar)(require("./components/Footer/Footer"), exports);
10
+ Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return __importDefault(Footer_1).default; } });
11
11
  var CustomAvatar_1 = require("./components/CustomAvatar");
12
- Object.defineProperty(exports, "CustomAvatar", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(CustomAvatar_1).default; } });
13
- (0, tslib_1.__exportStar)(require("./components/CustomAvatar"), exports);
12
+ Object.defineProperty(exports, "CustomAvatar", { enumerable: true, get: function () { return __importDefault(CustomAvatar_1).default; } });
14
13
  var CustomPagination_1 = require("./components/CustomPagination");
15
- Object.defineProperty(exports, "CustomPagination", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(CustomPagination_1).default; } });
16
- (0, tslib_1.__exportStar)(require("./components/CustomPagination"), exports);
14
+ Object.defineProperty(exports, "CustomPagination", { enumerable: true, get: function () { return __importDefault(CustomPagination_1).default; } });
17
15
  var FilterModal_1 = require("./components/FilterModal");
18
- Object.defineProperty(exports, "FilterModal", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(FilterModal_1).default; } });
19
- (0, tslib_1.__exportStar)(require("./components/FilterModal"), exports);
16
+ Object.defineProperty(exports, "FilterModal", { enumerable: true, get: function () { return __importDefault(FilterModal_1).default; } });
20
17
  var SessionModal_1 = require("./components/SessionModal");
21
- Object.defineProperty(exports, "SessionModal", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(SessionModal_1).default; } });
22
- (0, tslib_1.__exportStar)(require("./components/SessionModal"), exports);
18
+ Object.defineProperty(exports, "SessionModal", { enumerable: true, get: function () { return __importDefault(SessionModal_1).default; } });
23
19
  var TitleBox_1 = require("./components/TitleBox");
24
- Object.defineProperty(exports, "TitleBox", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(TitleBox_1).default; } });
25
- (0, tslib_1.__exportStar)(require("./components/TitleBox"), exports);
20
+ Object.defineProperty(exports, "TitleBox", { enumerable: true, get: function () { return __importDefault(TitleBox_1).default; } });
26
21
  var Toast_1 = require("./components/Toast");
27
- Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Toast_1).default; } });
28
- (0, tslib_1.__exportStar)(require("./components/Toast"), exports);
22
+ Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return __importDefault(Toast_1).default; } });
23
+ var EndingPage_1 = require("./components/EndingPage");
24
+ Object.defineProperty(exports, "EndingPage", { enumerable: true, get: function () { return __importDefault(EndingPage_1).default; } });
29
25
  var ErrorBoundary_1 = require("./components/ErrorBoundary/ErrorBoundary");
30
- Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ErrorBoundary_1).default; } });
31
- (0, tslib_1.__exportStar)(require("./components/ErrorBoundary/ErrorBoundary"), exports);
26
+ Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return __importDefault(ErrorBoundary_1).default; } });
32
27
  var LoadingOverlay_1 = require("./components/Loading/LoadingOverlay");
33
- Object.defineProperty(exports, "LoadingOverlay", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(LoadingOverlay_1).default; } });
34
- (0, tslib_1.__exportStar)(require("./components/Loading/LoadingOverlay"), exports);
35
- var EndingPage_1 = require("./components/EndingPage");
36
- Object.defineProperty(exports, "EndingPage", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(EndingPage_1).default; } });
28
+ Object.defineProperty(exports, "LoadingOverlay", { enumerable: true, get: function () { return __importDefault(LoadingOverlay_1).default; } });
29
+ var UserNotifyHandle_1 = require("./components/UserNotifyHandle");
30
+ Object.defineProperty(exports, "UserNotifyHandle", { enumerable: true, get: function () { return __importDefault(UserNotifyHandle_1).default; } });
31
+ var UnloadEventHandler_1 = require("./components/UnloadEventHandler");
32
+ Object.defineProperty(exports, "UnloadEventHandler", { enumerable: true, get: function () { return __importDefault(UnloadEventHandler_1).default; } });
37
33
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,qDAA+D;AAAtD,8HAAA,OAAO,OAAU;AAC1B,0EAA2C;AAE3C,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kEAA4E;AAAnE,kJAAA,OAAO,OAAoB;AACpC,6EAA8C;AAE9C,wDAAkE;AAAzD,wIAAA,OAAO,OAAe;AAC/B,wEAAyC;AAEzC,0DAAoE;AAA3D,0IAAA,OAAO,OAAgB;AAChC,yEAA0C;AAE1C,kDAA4D;AAAnD,kIAAA,OAAO,OAAY;AAC5B,qEAAsC;AAEtC,4CAAsD;AAA7C,4HAAA,OAAO,OAAS;AACzB,kEAAmC;AAEnC,0EAAoF;AAA3E,4IAAA,OAAO,OAAiB;AACjC,wFAAyD;AAEzD,sEAAgF;AAAvE,8IAAA,OAAO,OAAkB;AAClC,mFAAoD;AAEpD,sDAAgE;AAAvD,sIAAA,OAAO,OAAc"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA+D;AAAtD,iHAAA,OAAO,OAAU;AAC1B,qDAA+D;AAAtD,iHAAA,OAAO,OAAU;AAC1B,0DAAoE;AAA3D,6HAAA,OAAO,OAAgB;AAChC,kEAA4E;AAAnE,qIAAA,OAAO,OAAoB;AACpC,wDAAkE;AAAzD,2HAAA,OAAO,OAAe;AAC/B,0DAAoE;AAA3D,6HAAA,OAAO,OAAgB;AAChC,kDAA4D;AAAnD,qHAAA,OAAO,OAAY;AAC5B,4CAAsD;AAA7C,+GAAA,OAAO,OAAS;AACzB,sDAAgE;AAAvD,yHAAA,OAAO,OAAc;AAE9B,0EAAoF;AAA3E,+HAAA,OAAO,OAAiB;AACjC,sEAAgF;AAAvE,iIAAA,OAAO,OAAkB;AAClC,kEAA4E;AAAnE,qIAAA,OAAO,OAAoB;AACpC,sEAAgF;AAAvE,yIAAA,OAAO,OAAsB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagopa/selfcare-common-frontend",
3
3
  "description": "Shared React components for the pagopa selfcare project",
4
- "version": "1.2.2",
4
+ "version": "1.4.0",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/pagopa/selfcare-common-frontend",
7
7
  "author": "https://www.pagopa.gov.it",
@@ -23,6 +23,7 @@
23
23
  "@testing-library/user-event": "^12.8.3",
24
24
  "@types/jest": "^26.0.24",
25
25
  "@types/lodash": "^4.14.172",
26
+ "@types/mixpanel-browser": "^2.38.0",
26
27
  "@types/node": "^12.20.19",
27
28
  "@types/react": "^17.0.18",
28
29
  "@types/react-dom": "^17.0.9",
@@ -35,6 +36,7 @@
35
36
  "fp-ts": "^2.11.5",
36
37
  "io-ts": "^2.2.16",
37
38
  "lodash": "^4.17.21",
39
+ "mixpanel-browser": "^2.43.0",
38
40
  "node-fetch": "^3.0.0",
39
41
  "react": "^17.0.2",
40
42
  "react-app-polyfill": "^3.0.0",
@@ -64,7 +66,7 @@
64
66
  "lint-autofix": "yarn setTsConfigStart && eslint . -c .eslintrc.js --ext .ts,.tsx --fix",
65
67
  "lint": "yarn setTsConfigStart && eslint . -c .eslintrc.js --ext .ts,.tsx ",
66
68
  "prettify": "prettier --write \"./**/*.{ts,tsx}\"",
67
- "version": "auto-changelog -p --config .auto-changelog.json --tag-pattern \\d+\\.\\d+.\\d+$ --unreleased --ignore-commit-pattern \"Bump version to\" --starting-version v1.0.0 && git add CHANGELOG.md"
69
+ "version": "auto-changelog -p --config .auto-changelog.json && git add CHANGELOG.md"
68
70
  },
69
71
  "eslintConfig": {
70
72
  "extends": [
@@ -0,0 +1,12 @@
1
+ import { AppError } from '../redux/slices/appStateSlice';
2
+ /** To call in order to start the analytics service, otherwise no event will be sent */
3
+ export declare const initAnalytics: () => void;
4
+ /** To notify an error through the analytics tool */
5
+ export declare const trackAppError: (error: AppError) => void;
6
+ /**
7
+ * To notify an event through the analytics tool:
8
+ * @property event_name: the name of the event
9
+ * @property properties: the additional payload sent with the event
10
+ * @property callback: an action taken when the track has completed (If the action taken immediately after the track is an exit action from the application, it's better to use this callback to perform the exit, in order to give to mixPanel the time to send the event)
11
+ */
12
+ export declare const trackEvent: (event_name: string, properties?: any, callback?: (() => void) | undefined) => void;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.trackEvent = exports.trackAppError = exports.initAnalytics = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const mixpanel_browser_1 = (0, tslib_1.__importDefault)(require("mixpanel-browser"));
6
+ const env_1 = require("../config/env");
7
+ // eslint-disable-next-line functional/no-let
8
+ let init = false;
9
+ /** To call in order to start the analytics service, otherwise no event will be sent */
10
+ const initAnalytics = () => {
11
+ if (env_1.CONFIG.ANALYTCS.ENABLE) {
12
+ init = true;
13
+ if (env_1.CONFIG.ANALYTCS.MOCK) {
14
+ // eslint-disable-next-line no-console
15
+ console.log('Mixpanel events mock on console log.');
16
+ }
17
+ else {
18
+ mixpanel_browser_1.default.init(env_1.CONFIG.ANALYTCS.TOKEN, {
19
+ api_host: env_1.CONFIG.ANALYTCS.API_HOST,
20
+ persistence: env_1.CONFIG.ANALYTCS.PERSISTENCE,
21
+ ip: env_1.CONFIG.ANALYTCS.LOG_IP,
22
+ property_blacklist: env_1.CONFIG.ANALYTCS.PROPERTY_BLACKLIST,
23
+ debug: env_1.CONFIG.ANALYTCS.DEBUG,
24
+ });
25
+ }
26
+ }
27
+ };
28
+ exports.initAnalytics = initAnalytics;
29
+ /** To notify an error through the analytics tool */
30
+ const trackAppError = (error) => {
31
+ if (env_1.CONFIG.ANALYTCS.ENABLE && init) {
32
+ (0, exports.trackEvent)('GENERIC_ERROR', error);
33
+ }
34
+ else {
35
+ console.error(error);
36
+ }
37
+ };
38
+ exports.trackAppError = trackAppError;
39
+ /**
40
+ * To notify an event through the analytics tool:
41
+ * @property event_name: the name of the event
42
+ * @property properties: the additional payload sent with the event
43
+ * @property callback: an action taken when the track has completed (If the action taken immediately after the track is an exit action from the application, it's better to use this callback to perform the exit, in order to give to mixPanel the time to send the event)
44
+ */
45
+ const trackEvent = (event_name, properties, callback) => {
46
+ if (env_1.CONFIG.ANALYTCS.ENABLE && init) {
47
+ if (env_1.CONFIG.ANALYTCS.MOCK) {
48
+ // eslint-disable-next-line no-console
49
+ console.log(event_name, properties);
50
+ if (callback) {
51
+ callback();
52
+ }
53
+ }
54
+ else {
55
+ trackEventThroughAnalyticTool(event_name, properties, callback);
56
+ }
57
+ }
58
+ else {
59
+ if (callback) {
60
+ callback();
61
+ }
62
+ }
63
+ };
64
+ exports.trackEvent = trackEvent;
65
+ const trackEventThroughAnalyticTool = (event_name, properties, callback) => {
66
+ // eslint-disable-next-line functional/no-let
67
+ let called = false;
68
+ const wrappedCallback = callback
69
+ ? () => {
70
+ try {
71
+ called = true;
72
+ callback();
73
+ }
74
+ catch (reason) {
75
+ console.error(`Something gone wrong while calling trackEvent ${event_name} callback`, reason);
76
+ }
77
+ }
78
+ : undefined;
79
+ try {
80
+ mixpanel_browser_1.default.track(event_name, {
81
+ ...env_1.CONFIG.ANALYTCS.ADDITIONAL_PROPERTIES,
82
+ ...properties,
83
+ ...env_1.CONFIG.ANALYTCS.ADDITIONAL_PROPERTIES_IMPORTANT,
84
+ }, wrappedCallback ? { send_immediately: true } : undefined, wrappedCallback);
85
+ }
86
+ catch (reason) {
87
+ console.error('Something gone wrong while sending data to mixpanel:', reason);
88
+ // eslint-disable-next-line no-console
89
+ console.log(event_name, properties);
90
+ if (wrappedCallback && !called) {
91
+ wrappedCallback();
92
+ }
93
+ }
94
+ };
95
+ //# sourceMappingURL=analyticsService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyticsService.js","sourceRoot":"","sources":["../../src/lib/services/analyticsService.ts"],"names":[],"mappings":";;;;AAAA,qFAAwC;AACxC,uCAAuC;AAGvC,6CAA6C;AAC7C,IAAI,IAAI,GAAG,KAAK,CAAC;AAEjB,uFAAuF;AAChF,MAAM,aAAa,GAAG,GAAS,EAAE;IACtC,IAAI,YAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;QAC1B,IAAI,GAAG,IAAI,CAAC;QACZ,IAAI,YAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;YACxB,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;SACrD;aAAM;YACL,0BAAQ,CAAC,IAAI,CAAC,YAAM,CAAC,QAAQ,CAAC,KAAK,EAAE;gBACnC,QAAQ,EAAE,YAAM,CAAC,QAAQ,CAAC,QAAQ;gBAClC,WAAW,EAAE,YAAM,CAAC,QAAQ,CAAC,WAAwC;gBACrE,EAAE,EAAE,YAAM,CAAC,QAAQ,CAAC,MAAM;gBAC1B,kBAAkB,EAAE,YAAM,CAAC,QAAQ,CAAC,kBAAkB;gBACtD,KAAK,EAAE,YAAM,CAAC,QAAQ,CAAC,KAAK;aAC7B,CAAC,CAAC;SACJ;KACF;AACH,CAAC,CAAC;AAhBW,QAAA,aAAa,iBAgBxB;AAEF,oDAAoD;AAC7C,MAAM,aAAa,GAAG,CAAC,KAAe,EAAQ,EAAE;IACrD,IAAI,YAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI,EAAE;QAClC,IAAA,kBAAU,EAAC,eAAe,EAAE,KAAK,CAAC,CAAC;KACpC;SAAM;QACL,OAAO,CAAC,KAA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AAE,CAAC,CAAC,CAAC,SAAS,EACxD,eAAe,CAChB,CAAC;KACH;IAAC,OAAO,MAAM,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,sDAAsD,EAAE,MAAM,CAAC,CAAC;QAC9E,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAEpC,IAAI,eAAe,IAAI,CAAC,MAAM,EAAE;YAC9B,eAAe,EAAE,CAAC;SACnB;KACF;AACH,CAAC,CAAC"}
@@ -6,9 +6,11 @@ const isEmpty_1 = (0, tslib_1.__importDefault)(require("lodash/isEmpty"));
6
6
  const env_1 = require("../config/env");
7
7
  const storage_utils_1 = require("../utils/storage-utils");
8
8
  const constants_1 = require("../utils/constants");
9
+ const analyticsService_1 = require("./analyticsService");
9
10
  const buildAssistanceURI = (assistanceEmail) => {
10
11
  const sessionStorageUser = (0, storage_utils_1.storageRead)(constants_1.STORAGE_KEY_USER, 'object');
11
12
  if ((0, isEmpty_1.default)(sessionStorageUser)) {
13
+ (0, analyticsService_1.trackEvent)('CUSTOMER_CARE_MAILTO');
12
14
  return `mailto:${assistanceEmail}`;
13
15
  }
14
16
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"assistanceService.js","sourceRoot":"","sources":["../../src/lib/services/assistanceService.ts"],"names":[],"mappings":";;;;AACA,0EAAqC;AACrC,uCAAuC;AACvC,0DAAqD;AACrD,kDAAsD;AAE/C,MAAM,kBAAkB,GAAG,CAAC,eAAwB,EAAE,EAAE;IAE3D,MAAM,kBAAkB,GAAG,IAAA,2BAAW,EAAC,4BAAgB,EAAE,QAAQ,CAAC,CAAC;IAEnE,IAAI,IAAA,iBAAO,EAAC,kBAAkB,CAAC,EAAE;QAC7B,OAAO,UAAU,eAAe,EAAE,CAAC;KACtC;SAAO;QACJ,OAAO,YAAM,CAAC,MAAM,CAAC,UAAU,CAAC;KACnC;AACL,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
1
+ {"version":3,"file":"assistanceService.js","sourceRoot":"","sources":["../../src/lib/services/assistanceService.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,uCAAuC;AACvC,0DAAqD;AACrD,kDAAsD;AACtD,yDAAgD;AAEzC,MAAM,kBAAkB,GAAG,CAAC,eAAwB,EAAE,EAAE;IAC7D,MAAM,kBAAkB,GAAG,IAAA,2BAAW,EAAC,4BAAgB,EAAE,QAAQ,CAAC,CAAC;IAEnE,IAAI,IAAA,iBAAO,EAAC,kBAAkB,CAAC,EAAE;QAC/B,IAAA,6BAAU,EAAC,sBAAsB,CAAC,CAAC;QACnC,OAAO,UAAU,eAAe,EAAE,CAAC;KACpC;SAAM;QACL,OAAO,YAAM,CAAC,MAAM,CAAC,UAAU,CAAC;KACjC;AACH,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleErrors = void 0;
4
+ const analyticsService_1 = require("./analyticsService");
4
5
  const handleErrors = (errors) => {
5
6
  errors
6
7
  .filter((e) => e.toNotify)
7
8
  .forEach((e) => {
8
- console.error('An error occurred: ', e);
9
+ (0, analyticsService_1.trackAppError)(e);
9
10
  });
10
11
  };
11
12
  exports.handleErrors = handleErrors;
@@ -1 +1 @@
1
- {"version":3,"file":"errorService.js","sourceRoot":"","sources":["../../src/lib/services/errorService.ts"],"names":[],"mappings":";;;AAEO,MAAM,YAAY,GAAG,CAAC,MAAuB,EAAE,EAAE;IACtD,MAAM;SACH,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;SACzB,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}
1
+ {"version":3,"file":"errorService.js","sourceRoot":"","sources":["../../src/lib/services/errorService.ts"],"names":[],"mappings":";;;AACA,yDAAmD;AAE5C,MAAM,YAAY,GAAG,CAAC,MAAuB,EAAE,EAAE;IACtD,MAAM;SACH,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;SACzB,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACb,IAAA,gCAAa,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}