@imposium-hub/components 2.6.0-1 → 2.6.0-2

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 (46) hide show
  1. package/dist/cjs/Util.d.ts +1 -1
  2. package/dist/cjs/Util.js +33 -20
  3. package/dist/cjs/Util.js.map +1 -1
  4. package/dist/cjs/components/app-wrapper/AppWrapper.d.ts +3 -1
  5. package/dist/cjs/components/app-wrapper/AppWrapper.js +8 -2
  6. package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
  7. package/dist/cjs/components/header/Header.d.ts +1 -0
  8. package/dist/cjs/components/header/Header.js +1 -3
  9. package/dist/cjs/components/header/Header.js.map +1 -1
  10. package/dist/cjs/index.d.ts +2 -2
  11. package/dist/cjs/index.js +2 -2
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/redux/actions/access.js +44 -37
  14. package/dist/cjs/redux/actions/access.js.map +1 -1
  15. package/dist/cjs/services/API.d.ts +4 -0
  16. package/dist/cjs/services/API.js.map +1 -1
  17. package/dist/cjs/utils/pendo.d.ts +2 -24
  18. package/dist/cjs/utils/pendo.js +4 -27
  19. package/dist/cjs/utils/pendo.js.map +1 -1
  20. package/dist/esm/Util.d.ts +1 -1
  21. package/dist/esm/Util.js +10 -19
  22. package/dist/esm/Util.js.map +1 -1
  23. package/dist/esm/components/app-wrapper/AppWrapper.d.ts +3 -1
  24. package/dist/esm/components/app-wrapper/AppWrapper.js +8 -2
  25. package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
  26. package/dist/esm/components/header/Header.d.ts +1 -0
  27. package/dist/esm/components/header/Header.js +1 -3
  28. package/dist/esm/components/header/Header.js.map +1 -1
  29. package/dist/esm/index.d.ts +2 -2
  30. package/dist/esm/index.js +2 -2
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/redux/actions/access.js +63 -56
  33. package/dist/esm/redux/actions/access.js.map +1 -1
  34. package/dist/esm/services/API.d.ts +4 -0
  35. package/dist/esm/services/API.js.map +1 -1
  36. package/dist/esm/utils/pendo.d.ts +2 -24
  37. package/dist/esm/utils/pendo.js +4 -27
  38. package/dist/esm/utils/pendo.js.map +1 -1
  39. package/package.json +8 -7
  40. package/src/Util.ts +10 -16
  41. package/src/components/app-wrapper/AppWrapper.tsx +13 -1
  42. package/src/components/header/Header.tsx +3 -3
  43. package/src/index.ts +3 -3
  44. package/src/redux/actions/access.ts +64 -72
  45. package/src/services/API.ts +4 -0
  46. package/src/utils/pendo.ts +5 -28
@@ -1,33 +1,31 @@
1
+ import { getOrgIdFromStory } from '../../Util';
2
+
1
3
  export const storyAdded = (storyId: string, storyName: string): any => {
2
4
  return (dispatch, getStore) => {
3
- const {
4
- access,
5
- routing: {
6
- locationBeforeTransitions: { query }
7
- }
8
- } = getStore();
9
- const orgId: string = query.organization_id;
10
-
11
- const accessData: any = {
12
- ...access,
13
- organizations: access.organizations.map((o: any) => {
14
- if (o.id === orgId) {
15
- return {
16
- ...o,
17
- stories: [
18
- ...o.stories,
19
- {
20
- id: storyId,
21
- name: storyName
22
- }
23
- ].sort((a, b) => a.name.localeCompare(b.name))
24
- };
25
- }
5
+ const { access } = getStore();
6
+ const orgId = getOrgIdFromStory(storyId, access);
7
+ if (orgId) {
8
+ const accessData: any = {
9
+ ...access,
10
+ organizations: access.organizations.map((o: any) => {
11
+ if (o.id === orgId) {
12
+ return {
13
+ ...o,
14
+ stories: [
15
+ ...o.stories,
16
+ {
17
+ id: storyId,
18
+ name: storyName
19
+ }
20
+ ].sort((a, b) => a.name.localeCompare(b.name))
21
+ };
22
+ }
26
23
 
27
- return o;
28
- })
29
- };
30
- dispatch({ type: actions.STORY_ADDED, accessData });
24
+ return o;
25
+ })
26
+ };
27
+ dispatch({ type: actions.STORY_ADDED, accessData });
28
+ }
31
29
  };
32
30
  };
33
31
 
@@ -54,61 +52,55 @@ export const orgNameMutated = (orgId: string, newOrgName: string): any => {
54
52
 
55
53
  export const storyNameMutated = (storyId: string, newStoryName: string): any => {
56
54
  return (dispatch, getStore) => {
57
- const {
58
- access,
59
- routing: {
60
- locationBeforeTransitions: { query }
61
- }
62
- } = getStore();
63
- const orgId: string = query.organization_id;
55
+ const { access } = getStore();
64
56
 
65
- const accessData: any = {
66
- ...access,
67
- organizations: access.organizations.map((o: any) => {
68
- if (o.id === orgId) {
69
- return {
70
- ...o,
71
- stories: o.stories.map((s: any) => {
72
- if (s.id === storyId) {
73
- return { ...s, name: newStoryName };
74
- }
57
+ const orgId = getOrgIdFromStory(storyId, access);
58
+ if (orgId) {
59
+ const accessData: any = {
60
+ ...access,
61
+ organizations: access.organizations.map((o: any) => {
62
+ if (o.id === orgId) {
63
+ return {
64
+ ...o,
65
+ stories: o.stories.map((s: any) => {
66
+ if (s.id === storyId) {
67
+ return { ...s, name: newStoryName };
68
+ }
75
69
 
76
- return s;
77
- })
78
- };
79
- }
70
+ return s;
71
+ })
72
+ };
73
+ }
80
74
 
81
- return o;
82
- })
83
- };
84
- dispatch({ type: actions.STORY_NAME_MUTATION, accessData });
75
+ return o;
76
+ })
77
+ };
78
+ dispatch({ type: actions.STORY_NAME_MUTATION, accessData });
79
+ }
85
80
  };
86
81
  };
87
82
 
88
83
  export const storyDeleted = (storyId: string): any => {
89
84
  return (dispatch, getStore) => {
90
- const {
91
- access,
92
- routing: {
93
- locationBeforeTransitions: { query }
94
- }
95
- } = getStore();
96
- const orgId: string = query.organization_id;
85
+ const { access } = getStore();
97
86
 
98
- const accessData: any = {
99
- ...access,
100
- organizations: access.organizations.map((o: any) => {
101
- if (o.id === orgId) {
102
- return {
103
- ...o,
104
- stories: o.stories.filter((s: any) => s.id !== storyId)
105
- };
106
- }
87
+ const orgId = getOrgIdFromStory(storyId, access);
88
+ if (orgId) {
89
+ const accessData: any = {
90
+ ...access,
91
+ organizations: access.organizations.map((o: any) => {
92
+ if (o.id === orgId) {
93
+ return {
94
+ ...o,
95
+ stories: o.stories.filter((s: any) => s.id !== storyId)
96
+ };
97
+ }
107
98
 
108
- return o;
109
- })
110
- };
111
- dispatch({ type: actions.STORY_DELETED, accessData });
99
+ return o;
100
+ })
101
+ };
102
+ dispatch({ type: actions.STORY_DELETED, accessData });
103
+ }
112
104
  };
113
105
  };
114
106
 
@@ -150,6 +150,10 @@ export interface IImposiumAPI {
150
150
  cacheActiveStory(serviceId: any, orgId: string, storyId: string);
151
151
  getCachedStoryForOrg(serviceId: string, orgId: string);
152
152
  getAccessData(includeTotalRenders?: boolean, orgId?: string);
153
+ deleteExperience(experienceId: string, eraseMedia?: boolean);
154
+ exportExperiences(experienceId: string, params: any);
155
+ addOrReplaceNote(experienceId: string, notes: string);
156
+ updateModerationStatus(experienceId: string, status: string, reason?: string);
153
157
  }
154
158
 
155
159
  interface ITTSOptions {
@@ -1,31 +1,8 @@
1
- /**
2
- * [initPendo description]
3
- * This initalizes the Pendo Help system in the application
4
- * The Pendo script should be added to the DOM in `index.html`
5
- * This function takes the user object and sets some initial information on Pendo for tracking
6
- * For full documentation of Pendo object please see Pendo Docs
7
- *
8
- * To prevent application breaking things, we wrap both groups in a try/catch
9
- * This allows our Application to work regardless of the status of Pendo
10
- * *************************************************************
11
- * We DO NOT WANT TO BREAK OUR APP if a 3rd party script fails
12
- * *************************************************************
13
- *
14
- * @param {object} userInfo User object from crm/v1/user
15
- * Each application's `user/` endpoint returns slightly different data
16
- * The `visitor` object will need to be adjusted based on the data returned
17
- * We should always have access to:
18
- * id
19
- * email
20
- * full_name
21
- *
22
- * @return {undefined} Nothing
23
- */
24
-
1
+ import { User } from '@auth0/auth0-react';
25
2
  declare const pendo;
26
3
 
27
- export const initPendo = (environment, userInfo) => {
28
- if (/dev/gi.test(environment)) {
4
+ export const initPendo = (appLabel, environment, userInfo: User) => {
5
+ if (environment !== 'production') {
29
6
  console.info(
30
7
  '%cPendo%c is %cdisabled%c for local testing',
31
8
  'color: #e247e5; font-weight:bold;',
@@ -39,7 +16,7 @@ export const initPendo = (environment, userInfo) => {
39
16
  try {
40
17
  const visitor = {
41
18
  id: userInfo.sub,
42
- email: userInfo['https://imposium.com/email']
19
+ email: userInfo.email
43
20
  };
44
21
 
45
22
  /* eslint-disable no-undef */
@@ -47,7 +24,7 @@ export const initPendo = (environment, userInfo) => {
47
24
  visitor: {
48
25
  ...visitor,
49
26
  environment,
50
- product: 'Imposium Project Editor',
27
+ product: appLabel,
51
28
  language: navigator.language
52
29
  }
53
30
  });