@clxmedia/xperience-rights-client 1.0.11 → 1.1.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/dist/client.js +67 -26
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -2,30 +2,62 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.XperienceRightsClient = exports.FRIENDLY_SCOPE_NAMES = exports.CLIQ_ROLES = exports.CLIQ_GROUPS = exports.ODOO_ROLES = void 0;
4
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': {
5
+ proofing_contact: {
6
+ id: 2,
7
+ name: 'Proofing Contact',
8
+ slug: 'proofing_contact',
9
+ },
10
+ reporting_contact: {
11
+ id: 3,
12
+ name: 'Reporting Contact',
13
+ slug: 'reporting_contact',
14
+ },
15
+ billing_contact: { id: 4, name: 'Billing Contact', slug: 'billing_contact' },
16
+ marketing_contact: {
17
+ id: 5,
18
+ name: 'Marketing Contact',
19
+ slug: 'marketing_contact',
20
+ },
21
+ video_producer: { id: 8, name: 'Video Producer', slug: 'video_producer' },
22
+ regional_contact: {
23
+ id: 9,
24
+ name: 'Regional Contact',
25
+ slug: 'regional_contact',
26
+ },
27
+ accounts_payable: {
28
+ id: 16,
29
+ name: 'Accounts Payable',
30
+ slug: 'accounts_payable',
31
+ },
32
+ main: { id: 17, name: 'Main', slug: 'main' },
33
+ website_contact: { id: 18, name: 'Website Contact', slug: 'website_contact' },
34
+ gtm_contact: { id: 19, name: 'GTM Contact', slug: 'gtm_contact' },
35
+ ga_contact: { id: 20, name: 'GA Contact', slug: 'ga_contact' },
36
+ gbp_contact: { id: 21, name: 'GBP Contact', slug: 'gbp_contact' },
37
+ fb_contact: { id: 22, name: 'FB Contact', slug: 'fb_contact' },
38
+ crm_contact: { id: 23, name: 'CRM Contact', slug: 'crm_contact' },
39
+ tcc_chat_contact: {
40
+ id: 24,
41
+ name: 'TCC/Chat Contact',
42
+ slug: 'tcc_chat_contact',
43
+ },
44
+ leasing_community_manager: {
45
+ id: 25,
46
+ name: 'Leasing/Community Manager',
47
+ slug: 'leasing_community_manager',
48
+ },
49
+ pausing_notifications_contact: {
22
50
  id: 27,
23
51
  name: 'Pausing Notifications Contact',
24
- slug: '27-Pausing Notifications Contact',
52
+ slug: 'pausing_notifications_contact',
53
+ },
54
+ bov_contact: { id: 28, name: 'BOV Contact', slug: 'bov_contact' },
55
+ contract_signee: { id: 29, name: 'Contract Signee', slug: 'contract_signee' },
56
+ onboarding_contact: {
57
+ id: 30,
58
+ name: 'Onboarding Contact',
59
+ slug: 'onboarding_contact',
25
60
  },
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
61
  };
30
62
  exports.CLIQ_GROUPS = {
31
63
  ad_reviewer: 'Property Ad Reviewers',
@@ -107,13 +139,16 @@ class XperienceRightsClient {
107
139
  }
108
140
  if (locator.type === 'right') {
109
141
  const [scope, ability] = locator.value.split('@');
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})` : ''}`;
142
+ return long
143
+ ? `any ${locator.constraint ? `${locator.constraint} ` : ''}user with the ${exports.FRIENDLY_SCOPE_NAMES[scope]} ${ability} rights`
144
+ : `${exports.FRIENDLY_SCOPE_NAMES[scope]} ${ability}${locator.constraint ? ` (${locator.constraint})` : ''}`;
111
145
  }
112
146
  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}`;
147
+ return `${long ? 'any user with the Odoo role: ' : ''}${exports.ODOO_ROLES[locator.value]
148
+ ? exports.ODOO_ROLES[locator.value].name
149
+ : locator.value}`;
114
150
  }
115
151
  }
116
- ;
117
152
  static isGroupMember(data, group, qualifier) {
118
153
  if (!data || !data.groups || !data.groups[group]) {
119
154
  return false;
@@ -121,7 +156,11 @@ class XperienceRightsClient {
121
156
  if (!qualifier) {
122
157
  qualifier = 0;
123
158
  }
124
- return data.groups[group].qualifiers.includes(0) || data.groups[group].qualifiers.includes(qualifier) || (data.groups[group].common && (data.commonQualifiers.includes(qualifier) || data.commonQualifiers.includes(0)));
159
+ return (data.groups[group].qualifiers.includes(0) ||
160
+ data.groups[group].qualifiers.includes(qualifier) ||
161
+ (data.groups[group].common &&
162
+ (data.commonQualifiers.includes(qualifier) ||
163
+ data.commonQualifiers.includes(0))));
125
164
  }
126
165
  static abilityValue(ability) {
127
166
  switch (ability) {
@@ -147,7 +186,9 @@ class XperienceRightsClient {
147
186
  }
148
187
  static bestAbility(...abilities) {
149
188
  return abilities.reduce((best, current) => {
150
- return XperienceRightsClient.compareAbilities(current, best, 'better') ? current : best;
189
+ return XperienceRightsClient.compareAbilities(current, best, 'better')
190
+ ? current
191
+ : best;
151
192
  }, 'none');
152
193
  }
153
194
  static xperienceScopeName(scope) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clxmedia/xperience-rights-client",
3
- "version": "1.0.11",
3
+ "version": "1.1.0",
4
4
  "description": "CLXperience Rights Client",
5
5
  "author": "Brandon Thompson <brandont@clxmedia.com>",
6
6
  "license": "MIT",