@clxmedia/xperience-rights-client 1.0.9 → 1.0.11

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/client.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  import { CLiQUserLocator, XperienceAbility, XperienceRightsData, XperienceScopes } from '@clxmedia/types/core/auth';
2
+ export type OdooRole = {
3
+ id: number;
4
+ slug: string;
5
+ name: string;
6
+ };
7
+ export declare const ODOO_ROLES: {
8
+ [x: string]: OdooRole;
9
+ };
2
10
  export declare const CLIQ_GROUPS: {
3
11
  [x: string]: string;
4
12
  };
@@ -10,7 +18,7 @@ export declare const FRIENDLY_SCOPE_NAMES: {
10
18
  };
11
19
  export declare class XperienceRightsClient {
12
20
  static findAbility(data: XperienceRightsData, scope: XperienceScopes, qualifier?: number): XperienceAbility;
13
- static cliqLocatorDescription(locator: CLiQUserLocator | null): string | null;
21
+ static cliqLocatorDescription(locator: CLiQUserLocator | null, long?: boolean): string | null;
14
22
  static isGroupMember(data: XperienceRightsData, group: string, qualifier?: number): boolean;
15
23
  static abilityValue(ability: XperienceAbility): number;
16
24
  static compareAbilities(a: XperienceAbility, b: XperienceAbility, comparison?: 'enough' | 'better'): boolean;
package/dist/client.js CHANGED
@@ -1,6 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XperienceRightsClient = exports.FRIENDLY_SCOPE_NAMES = exports.CLIQ_ROLES = exports.CLIQ_GROUPS = void 0;
3
+ exports.XperienceRightsClient = exports.FRIENDLY_SCOPE_NAMES = exports.CLIQ_ROLES = exports.CLIQ_GROUPS = exports.ODOO_ROLES = void 0;
4
+ exports.ODOO_ROLES = {
5
+ '2-Proofing Contact': { id: 2, name: 'Proofing Contact', slug: '2-Proofing Contact' },
6
+ '3-Reporting Contact': { id: 3, name: 'Reporting Contact', slug: '3-Reporting Contact' },
7
+ '4-Billing Contact': { id: 4, name: 'Billing Contact', slug: '4-Billing Contact' },
8
+ '5-Marketing Contact': { id: 5, name: 'Marketing Contact', slug: '5-Marketing Contact' },
9
+ '8-Video Producer': { id: 8, name: 'Video Producer', slug: '8-Video Producer' },
10
+ '9-Regional Contact': { id: 9, name: 'Regional Contact', slug: '9-Regional Contact' },
11
+ '16-Accounts Payable': { id: 16, name: 'Accounts Payable', slug: '16-Accounts Payable' },
12
+ '17-Main': { id: 17, name: 'Main', slug: '17-Main' },
13
+ '18-Website Contact': { id: 18, name: 'Website Contact', slug: '18-Website Contact' },
14
+ '19-GTM Contact': { id: 19, name: 'GTM Contact', slug: '19-GTM Contact' },
15
+ '20-GA Contact': { id: 20, name: 'GA Contact', slug: '20-GA Contact' },
16
+ '21-GBP Contact': { id: 21, name: 'GBP Contact', slug: '21-GBP Contact' },
17
+ '22-FB Contact': { id: 22, name: 'FB Contact', slug: '22-FB Contact' },
18
+ '23-CRM Contact': { id: 23, name: 'CRM Contact', slug: '23-CRM Contact' },
19
+ '24-TCC/Chat Contact': { id: 24, name: 'TCC/Chat Contact', slug: '24-TCC/Chat Contact' },
20
+ '25-Leasing/Community Manager': { id: 25, name: 'Leasing/Community Manager', slug: '25-Leasing/Community Manager' },
21
+ '27-Pausing Notifications Contact': {
22
+ id: 27,
23
+ name: 'Pausing Notifications Contact',
24
+ slug: '27-Pausing Notifications Contact',
25
+ },
26
+ '28-BOV Contact': { id: 28, name: 'BOV Contact', slug: '28-BOV Contact' },
27
+ '29-Contract Signee': { id: 29, name: 'Contract Signee', slug: '29-Contract Signee' },
28
+ '30-Onboarding Contact': { id: 30, name: 'Onboarding Contact', slug: '30-Onboarding Contact' },
29
+ };
4
30
  exports.CLIQ_GROUPS = {
5
31
  ad_reviewer: 'Property Ad Reviewers',
6
32
  company_billing: 'Property Billing Admins',
@@ -35,6 +61,7 @@ exports.FRIENDLY_SCOPE_NAMES = {
35
61
  adrequests: 'Ad Requests',
36
62
  dashboard: 'Dashboard',
37
63
  videoreview: 'Video Review',
64
+ video: 'Video',
38
65
  tcc: 'The Conversion Cloud',
39
66
  };
40
67
  class XperienceRightsClient {
@@ -65,7 +92,7 @@ class XperienceRightsClient {
65
92
  return best;
66
93
  }, 'none');
67
94
  }
68
- static cliqLocatorDescription(locator) {
95
+ static cliqLocatorDescription(locator, long = false) {
69
96
  if (!locator || !locator.type) {
70
97
  return null;
71
98
  }
@@ -73,14 +100,17 @@ class XperienceRightsClient {
73
100
  return locator.value;
74
101
  }
75
102
  if (locator.type === 'group') {
76
- return `any user in the group: ${exports.CLIQ_GROUPS[locator.value] || locator.value}`;
103
+ return `${long ? 'any user in the group: ' : ''}${exports.CLIQ_GROUPS[locator.value] || locator.value}`;
77
104
  }
78
105
  if (locator.type === 'role') {
79
106
  return `${exports.CLIQ_ROLES[locator.value] || locator.value}`;
80
107
  }
81
108
  if (locator.type === 'right') {
82
109
  const [scope, ability] = locator.value.split('@');
83
- return `any ${locator.constraint ? `${locator.constraint} ` : ''}user with the ${exports.FRIENDLY_SCOPE_NAMES[scope]} ${ability} rights`;
110
+ return long ? `any ${locator.constraint ? `${locator.constraint} ` : ''}user with the ${exports.FRIENDLY_SCOPE_NAMES[scope]} ${ability} rights` : `${exports.FRIENDLY_SCOPE_NAMES[scope]} ${ability}${locator.constraint ? ` (${locator.constraint})` : ''}`;
111
+ }
112
+ if (locator.type === 'odoo_role') {
113
+ return `${long ? 'any user with the Odoo role: ' : ''}${exports.ODOO_ROLES[locator.value] ? exports.ODOO_ROLES[locator.value].name : locator.value}`;
84
114
  }
85
115
  }
86
116
  ;
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { XperienceRightsClient, CLIQ_GROUPS, CLIQ_ROLES, FRIENDLY_SCOPE_NAMES } from './client';
1
+ export { XperienceRightsClient, CLIQ_GROUPS, CLIQ_ROLES, FRIENDLY_SCOPE_NAMES, ODOO_ROLES, OdooRole, } from './client';
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FRIENDLY_SCOPE_NAMES = exports.CLIQ_ROLES = exports.CLIQ_GROUPS = exports.XperienceRightsClient = void 0;
3
+ exports.ODOO_ROLES = exports.FRIENDLY_SCOPE_NAMES = exports.CLIQ_ROLES = exports.CLIQ_GROUPS = exports.XperienceRightsClient = void 0;
4
4
  var client_1 = require("./client");
5
5
  Object.defineProperty(exports, "XperienceRightsClient", { enumerable: true, get: function () { return client_1.XperienceRightsClient; } });
6
6
  Object.defineProperty(exports, "CLIQ_GROUPS", { enumerable: true, get: function () { return client_1.CLIQ_GROUPS; } });
7
7
  Object.defineProperty(exports, "CLIQ_ROLES", { enumerable: true, get: function () { return client_1.CLIQ_ROLES; } });
8
8
  Object.defineProperty(exports, "FRIENDLY_SCOPE_NAMES", { enumerable: true, get: function () { return client_1.FRIENDLY_SCOPE_NAMES; } });
9
+ Object.defineProperty(exports, "ODOO_ROLES", { enumerable: true, get: function () { return client_1.ODOO_ROLES; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clxmedia/xperience-rights-client",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "CLXperience Rights Client",
5
5
  "author": "Brandon Thompson <brandont@clxmedia.com>",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "bugs": "https://github.com/adsupnow/xperience-library/xperience-rights-client",
34
34
  "dependencies": {
35
- "@clxmedia/types": "1.0.153"
35
+ "@clxmedia/types": "1.0.155"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "29.5.11",