@wix/entity-advanced-permissions 1.804.0 → 1.806.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 (40) hide show
  1. package/dist/cjs/components/EmptyState/EmptyState.js +9 -7
  2. package/dist/cjs/components/EmptyState/EmptyState.js.map +1 -1
  3. package/dist/cjs/components/EmptyState/EmptyState.spec.js +49 -46
  4. package/dist/cjs/components/EmptyState/EmptyState.spec.js.map +1 -1
  5. package/dist/cjs/components/EntityAdvancedPermissions.js +68 -95
  6. package/dist/cjs/components/EntityAdvancedPermissions.js.map +1 -1
  7. package/dist/cjs/components/EntityAdvancedPermissionsState.js +4 -5
  8. package/dist/cjs/components/EntityAdvancedPermissionsState.js.map +1 -1
  9. package/dist/cjs/components/NotifyBox/NotifyBox.js +16 -14
  10. package/dist/cjs/components/NotifyBox/NotifyBox.js.map +1 -1
  11. package/dist/cjs/components/PermissionsDropdown/PermissionsDropdown.js +13 -18
  12. package/dist/cjs/components/PermissionsDropdown/PermissionsDropdown.js.map +1 -1
  13. package/dist/cjs/components/PermissionsDropdown/PermissionsDropdown.spec.js +135 -128
  14. package/dist/cjs/components/PermissionsDropdown/PermissionsDropdown.spec.js.map +1 -1
  15. package/dist/cjs/components/PermissionsList/Avatar.js +6 -4
  16. package/dist/cjs/components/PermissionsList/Avatar.js.map +1 -1
  17. package/dist/cjs/components/PermissionsList/AvatarRole.js +11 -8
  18. package/dist/cjs/components/PermissionsList/AvatarRole.js.map +1 -1
  19. package/dist/cjs/components/PermissionsList/PermissionsList.js +25 -27
  20. package/dist/cjs/components/PermissionsList/PermissionsList.js.map +1 -1
  21. package/dist/cjs/components/PermissionsList/PermissionsList.spec.js +133 -126
  22. package/dist/cjs/components/PermissionsList/PermissionsList.spec.js.map +1 -1
  23. package/dist/cjs/components/PermissionsList/ViewRow.js +11 -8
  24. package/dist/cjs/components/PermissionsList/ViewRow.js.map +1 -1
  25. package/dist/cjs/components/SearchEntity/DashboardMultiSelect.js +12 -14
  26. package/dist/cjs/components/SearchEntity/DashboardMultiSelect.js.map +1 -1
  27. package/dist/cjs/components/SearchEntity/SearchEntity.js +24 -21
  28. package/dist/cjs/components/SearchEntity/SearchEntity.js.map +1 -1
  29. package/dist/cjs/components/SearchEntity/SearchEntity.spec.js +17 -16
  30. package/dist/cjs/components/SearchEntity/SearchEntity.spec.js.map +1 -1
  31. package/dist/cjs/components/SearchEntity/SearchReplacmentsComponents.js +11 -6
  32. package/dist/cjs/components/SearchEntity/SearchReplacmentsComponents.js.map +1 -1
  33. package/dist/statics/entity-advanced-permissions.umd.js +230 -254
  34. package/dist/statics/entity-advanced-permissions.umd.js.map +1 -1
  35. package/dist/statics/entity-advanced-permissions.umd.min.js +5 -5
  36. package/dist/statics/entity-advanced-permissions.umd.min.js.map +1 -1
  37. package/dist/statics/manifest.json +2 -2
  38. package/dist/statics/manifest.min.json +2 -2
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +14 -14
@@ -12,13 +12,15 @@ var _jsxFileName = "/home/builduser/work/4775e43efb305866/packages/entity-advanc
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
14
  function EmptyState(props) {
15
- const _useContext = (0, _react.useContext)(_wixUiTpa.TPAComponentsContext),
16
- mobile = _useContext.mobile;
17
- const mainTitle = props.mainTitle,
18
- description = props.description,
19
- className = props.className,
20
- _props$isDashboard = props.isDashboard,
21
- isDashboard = _props$isDashboard === void 0 ? false : _props$isDashboard;
15
+ const {
16
+ mobile
17
+ } = (0, _react.useContext)(_wixUiTpa.TPAComponentsContext);
18
+ const {
19
+ mainTitle,
20
+ description,
21
+ className,
22
+ isDashboard = false
23
+ } = props;
22
24
  if (isDashboard) {
23
25
  const wsrEmptyStateTitle = /*#__PURE__*/_react.default.createElement(_wixStyleReact.Text, {
24
26
  size: 'medium',
@@ -1 +1 @@
1
- {"version":3,"names":["EmptyState","props","useContext","TPAComponentsContext","mobile","mainTitle","description","className","isDashboard","wsrEmptyStateTitle","wsrEmptyStateDescription","st","classes","emptyStateWsr","emptyState","TextTypography","smallTitle","he","decode","runningText"],"sources":["../../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport he from 'he';\nimport { Text, TextTypography } from 'wix-ui-tpa';\nimport { classes, st } from './EmptyState.st.css';\nimport { TPAComponentsContext } from 'wix-ui-tpa';\nimport { EmptyState as WSREmptyState, Box, Text as WSRText } from 'wix-style-react';\n\nexport interface EmptyStateProps {\n mainTitle: string;\n description: string;\n className?: string;\n isDashboard?: boolean;\n}\n\nfunction EmptyState(props: EmptyStateProps) {\n const { mobile } = useContext(TPAComponentsContext);\n const { mainTitle, description, className, isDashboard = false } = props;\n\n if (isDashboard) {\n const wsrEmptyStateTitle = <WSRText size={'medium'} weight={'bold'}> {mainTitle} </WSRText>;\n const wsrEmptyStateDescription = <WSRText size={'medium'}> {description} </WSRText>;\n return (\n <Box className={st(classes.emptyStateWsr)} >\n <WSREmptyState\n theme={'page-no-border'}\n title={wsrEmptyStateTitle}\n align={'center'}\n subtitle={wsrEmptyStateDescription}\n />\n </Box>\n );\n }\n\n return (\n <div className={st(classes.emptyState, { mobile }, className)}>\n <Text\n typography={TextTypography.smallTitle}\n className={st(classes.mainTitle)}\n >\n {he.decode(mainTitle)}\n </Text>\n <Text\n typography={TextTypography.runningText}\n className={st(classes.description)}\n >\n {he.decode(description)}\n </Text>\n </div>\n );\n}\n\nexport default EmptyState;\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AAEA;AAAoF;AAAA;AAAA;AASpF,SAASA,UAAU,CAACC,KAAsB,EAAE;EAC1C,oBAAmB,IAAAC,iBAAU,EAACC,8BAAoB,CAAC;IAA3CC,MAAM,eAANA,MAAM;EACd,MAAQC,SAAS,GAAkDJ,KAAK,CAAhEI,SAAS;IAAEC,WAAW,GAAqCL,KAAK,CAArDK,WAAW;IAAEC,SAAS,GAA0BN,KAAK,CAAxCM,SAAS;IAAA,qBAA0BN,KAAK,CAA7BO,WAAW;IAAXA,WAAW,mCAAG,KAAK;EAE9D,IAAIA,WAAW,EAAE;IACf,MAAMC,kBAAkB,gBAAG,6BAAC,mBAAO;MAAC,IAAI,EAAE,QAAS;MAAC,MAAM,EAAE,MAAO;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,QAAGJ,SAAS,MAAY;IAC3F,MAAMK,wBAAwB,gBAAG,6BAAC,mBAAO;MAAC,IAAI,EAAE,QAAS;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,QAAGJ,WAAW,MAAY;IACnF,oBACE,6BAAC,kBAAG;MAAC,SAAS,EAAE,IAAAK,gBAAE,EAACC,qBAAO,CAACC,aAAa,CAAE;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,gBACxC,6BAAC,yBAAa;MACZ,KAAK,EAAE,gBAAiB;MACxB,KAAK,EAAEJ,kBAAmB;MAC1B,KAAK,EAAE,QAAS;MAChB,QAAQ,EAAEC,wBAAyB;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,EACnC,CACE;EAEV;EAEA,oBACE;IAAK,SAAS,EAAE,IAAAC,gBAAE,EAACC,qBAAO,CAACE,UAAU,EAAE;MAAEV;IAAO,CAAC,EAAEG,SAAS,CAAE;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,gBAC5D,6BAAC,cAAI;IACH,UAAU,EAAEQ,wBAAc,CAACC,UAAW;IACtC,SAAS,EAAE,IAAAL,gBAAE,EAACC,qBAAO,CAACP,SAAS,CAAE;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,GAEhCY,WAAE,CAACC,MAAM,CAACb,SAAS,CAAC,CAChB,eACP,6BAAC,cAAI;IACH,UAAU,EAAEU,wBAAc,CAACI,WAAY;IACvC,SAAS,EAAE,IAAAR,gBAAE,EAACC,qBAAO,CAACN,WAAW,CAAE;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,GAElCW,WAAE,CAACC,MAAM,CAACZ,WAAW,CAAC,CAClB,CACH;AAEV;AAAC,eAEcN,UAAU;AAAA"}
1
+ {"version":3,"names":["EmptyState","props","mobile","useContext","TPAComponentsContext","mainTitle","description","className","isDashboard","wsrEmptyStateTitle","wsrEmptyStateDescription","st","classes","emptyStateWsr","emptyState","TextTypography","smallTitle","he","decode","runningText"],"sources":["../../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport he from 'he';\nimport { Text, TextTypography } from 'wix-ui-tpa';\nimport { classes, st } from './EmptyState.st.css';\nimport { TPAComponentsContext } from 'wix-ui-tpa';\nimport { EmptyState as WSREmptyState, Box, Text as WSRText } from 'wix-style-react';\n\nexport interface EmptyStateProps {\n mainTitle: string;\n description: string;\n className?: string;\n isDashboard?: boolean;\n}\n\nfunction EmptyState(props: EmptyStateProps) {\n const { mobile } = useContext(TPAComponentsContext);\n const { mainTitle, description, className, isDashboard = false } = props;\n\n if (isDashboard) {\n const wsrEmptyStateTitle = <WSRText size={'medium'} weight={'bold'}> {mainTitle} </WSRText>;\n const wsrEmptyStateDescription = <WSRText size={'medium'}> {description} </WSRText>;\n return (\n <Box className={st(classes.emptyStateWsr)} >\n <WSREmptyState\n theme={'page-no-border'}\n title={wsrEmptyStateTitle}\n align={'center'}\n subtitle={wsrEmptyStateDescription}\n />\n </Box>\n );\n }\n\n return (\n <div className={st(classes.emptyState, { mobile }, className)}>\n <Text\n typography={TextTypography.smallTitle}\n className={st(classes.mainTitle)}\n >\n {he.decode(mainTitle)}\n </Text>\n <Text\n typography={TextTypography.runningText}\n className={st(classes.description)}\n >\n {he.decode(description)}\n </Text>\n </div>\n );\n}\n\nexport default EmptyState;\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AAEA;AAAoF;AAAA;AAAA;AASpF,SAASA,UAAU,CAACC,KAAsB,EAAE;EAC1C,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,iBAAU,EAACC,8BAAoB,CAAC;EACnD,MAAM;IAAEC,SAAS;IAAEC,WAAW;IAAEC,SAAS;IAAEC,WAAW,GAAG;EAAM,CAAC,GAAGP,KAAK;EAExE,IAAIO,WAAW,EAAE;IACf,MAAMC,kBAAkB,gBAAG,6BAAC,mBAAO;MAAC,IAAI,EAAE,QAAS;MAAC,MAAM,EAAE,MAAO;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,QAAGJ,SAAS,MAAY;IAC3F,MAAMK,wBAAwB,gBAAG,6BAAC,mBAAO;MAAC,IAAI,EAAE,QAAS;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,QAAGJ,WAAW,MAAY;IACnF,oBACE,6BAAC,kBAAG;MAAC,SAAS,EAAE,IAAAK,gBAAE,EAACC,qBAAO,CAACC,aAAa,CAAE;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,gBACxC,6BAAC,yBAAa;MACZ,KAAK,EAAE,gBAAiB;MACxB,KAAK,EAAEJ,kBAAmB;MAC1B,KAAK,EAAE,QAAS;MAChB,QAAQ,EAAEC,wBAAyB;MAAA;MAAA;QAAA;QAAA;QAAA;MAAA;IAAA,EACnC,CACE;EAEV;EAEA,oBACE;IAAK,SAAS,EAAE,IAAAC,gBAAE,EAACC,qBAAO,CAACE,UAAU,EAAE;MAAEZ;IAAO,CAAC,EAAEK,SAAS,CAAE;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,gBAC5D,6BAAC,cAAI;IACH,UAAU,EAAEQ,wBAAc,CAACC,UAAW;IACtC,SAAS,EAAE,IAAAL,gBAAE,EAACC,qBAAO,CAACP,SAAS,CAAE;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,GAEhCY,WAAE,CAACC,MAAM,CAACb,SAAS,CAAC,CAChB,eACP,6BAAC,cAAI;IACH,UAAU,EAAEU,wBAAc,CAACI,WAAY;IACvC,SAAS,EAAE,IAAAR,gBAAE,EAACC,qBAAO,CAACN,WAAW,CAAE;IAAA;IAAA;MAAA;MAAA;MAAA;IAAA;EAAA,GAElCW,WAAE,CAACC,MAAM,CAACZ,WAAW,CAAC,CAClB,CACH;AAEV;AAAC,eAEcN,UAAU;AAAA"}
@@ -9,19 +9,20 @@ var _jsxFileName = "/home/builduser/work/4775e43efb305866/packages/entity-advanc
9
9
  describe('Test Empty State component', () => {
10
10
  it('renders properly', () => {
11
11
  var _container$firstChild;
12
- const _render = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
13
- mainTitle: 'Main title text',
14
- description: 'description test',
15
- className: 'CustomClass',
16
- __self: void 0,
17
- __source: {
18
- fileName: _jsxFileName,
19
- lineNumber: 9,
20
- columnNumber: 7
21
- }
22
- })),
23
- getByText = _render.getByText,
24
- container = _render.container;
12
+ const {
13
+ getByText,
14
+ container
15
+ } = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
16
+ mainTitle: 'Main title text',
17
+ description: 'description test',
18
+ className: 'CustomClass',
19
+ __self: void 0,
20
+ __source: {
21
+ fileName: _jsxFileName,
22
+ lineNumber: 9,
23
+ columnNumber: 7
24
+ }
25
+ }));
25
26
  expect(getByText('Main title text')).toBeTruthy();
26
27
  expect(getByText('description test')).toBeTruthy();
27
28
 
@@ -29,44 +30,46 @@ describe('Test Empty State component', () => {
29
30
  expect(container == null ? void 0 : (_container$firstChild = container.firstChild) == null ? void 0 : _container$firstChild.className).toContain('CustomClass');
30
31
  });
31
32
  it('decodes properly', () => {
32
- const _render2 = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
33
- mainTitle: 'Main title &ne;',
34
- description: 'description &ne;',
35
- __self: void 0,
36
- __source: {
37
- fileName: _jsxFileName,
38
- lineNumber: 25,
39
- columnNumber: 7
40
- }
41
- })),
42
- getByText = _render2.getByText;
33
+ const {
34
+ getByText
35
+ } = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
36
+ mainTitle: 'Main title &ne;',
37
+ description: 'description &ne;',
38
+ __self: void 0,
39
+ __source: {
40
+ fileName: _jsxFileName,
41
+ lineNumber: 25,
42
+ columnNumber: 7
43
+ }
44
+ }));
43
45
  expect(getByText('Main title ≠')).toBeTruthy();
44
46
  expect(getByText('description ≠')).toBeTruthy();
45
47
  });
46
48
  it('Mobile class added', () => {
47
49
  var _container$firstChild2;
48
- const _render3 = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_wixUiTpa.TPAComponentsProvider, {
49
- value: {
50
- mobile: true
51
- },
52
- __self: void 0,
53
- __source: {
54
- fileName: _jsxFileName,
55
- lineNumber: 37,
56
- columnNumber: 7
57
- }
58
- }, /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
59
- mainTitle: 'Main title',
60
- description: 'description',
61
- __self: void 0,
62
- __source: {
63
- fileName: _jsxFileName,
64
- lineNumber: 38,
65
- columnNumber: 9
66
- }
67
- }))),
68
- container = _render3.container,
69
- debug = _render3.debug;
50
+ const {
51
+ container,
52
+ debug
53
+ } = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_wixUiTpa.TPAComponentsProvider, {
54
+ value: {
55
+ mobile: true
56
+ },
57
+ __self: void 0,
58
+ __source: {
59
+ fileName: _jsxFileName,
60
+ lineNumber: 37,
61
+ columnNumber: 7
62
+ }
63
+ }, /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
64
+ mainTitle: 'Main title',
65
+ description: 'description',
66
+ __self: void 0,
67
+ __source: {
68
+ fileName: _jsxFileName,
69
+ lineNumber: 38,
70
+ columnNumber: 9
71
+ }
72
+ })));
70
73
 
71
74
  // @ts-ignore
72
75
  expect(container == null ? void 0 : (_container$firstChild2 = container.firstChild) == null ? void 0 : _container$firstChild2.className).toContain('--mobile');
@@ -1 +1 @@
1
- {"version":3,"names":["describe","it","render","getByText","container","expect","toBeTruthy","firstChild","className","toContain","mobile","debug"],"sources":["../../../../src/components/EmptyState/EmptyState.spec.tsx"],"sourcesContent":["import React from 'react';\nimport { render, fireEvent } from '@testing-library/react';\nimport EmptyState from './EmptyState.tsx';\nimport { TPAComponentsProvider } from 'wix-ui-tpa';\n\ndescribe('Test Empty State component', () => {\n it('renders properly', () => {\n const { getByText, container } = render(\n <EmptyState\n mainTitle={'Main title text'}\n description={'description test'}\n className={'CustomClass'}\n />,\n );\n\n expect(getByText('Main title text')).toBeTruthy();\n expect(getByText('description test')).toBeTruthy();\n\n // @ts-ignore\n expect(container?.firstChild?.className).toContain('CustomClass');\n });\n\n it('decodes properly', () => {\n const { getByText } = render(\n <EmptyState\n mainTitle={'Main title &ne;'}\n description={'description &ne;'}\n />,\n );\n\n expect(getByText('Main title ≠')).toBeTruthy();\n expect(getByText('description ≠')).toBeTruthy();\n });\n\n it('Mobile class added', () => {\n const { container, debug } = render(\n <TPAComponentsProvider value={{ mobile: true }}>\n <EmptyState mainTitle={'Main title'} description={'description'} />\n </TPAComponentsProvider>,\n );\n\n // @ts-ignore\n expect(container?.firstChild?.className).toContain('--mobile');\n });\n});\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AAAmD;AAEnDA,QAAQ,CAAC,4BA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UAAA;QAAA;MAAA,EAAG,CAC7C,CACzB;MAJON,SAAS,YAATA,SAAS;MAAEO,KAAK,YAALA,KAAK;;IAMxB;IACAN,MAAM,CAACD,SAAS,8CAATA,SAAS,CAAEG,UAAU,qBAArB,uBAAuBC,SAAS,CAAC,CAACC,SAAS,CAAC,UAAU,CAAC;EAChE,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["describe","it","getByText","container","render","expect","toBeTruthy","firstChild","className","toContain","debug","mobile"],"sources":["../../../../src/components/EmptyState/EmptyState.spec.tsx"],"sourcesContent":["import React from 'react';\nimport { render, fireEvent } from '@testing-library/react';\nimport EmptyState from './EmptyState.tsx';\nimport { TPAComponentsProvider } from 'wix-ui-tpa';\n\ndescribe('Test Empty State component', () => {\n it('renders properly', () => {\n const { getByText, container } = render(\n <EmptyState\n mainTitle={'Main title text'}\n description={'description test'}\n className={'CustomClass'}\n />,\n );\n\n expect(getByText('Main title text')).toBeTruthy();\n expect(getByText('description test')).toBeTruthy();\n\n // @ts-ignore\n expect(container?.firstChild?.className).toContain('CustomClass');\n });\n\n it('decodes properly', () => {\n const { getByText } = render(\n <EmptyState\n mainTitle={'Main title &ne;'}\n description={'description &ne;'}\n />,\n );\n\n expect(getByText('Main title ≠')).toBeTruthy();\n expect(getByText('description ≠')).toBeTruthy();\n });\n\n it('Mobile class added', () => {\n const { container, debug } = render(\n <TPAComponentsProvider value={{ mobile: true }}>\n <EmptyState mainTitle={'Main title'} description={'description'} />\n </TPAComponentsProvider>,\n );\n\n // @ts-ignore\n expect(container?.firstChild?.className).toContain('--mobile');\n });\n});\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AAAmD;AAEnDA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;EAC3CC,EAAE,CAAC,kBAAkB,EAAE,MAAM;IAAA;IAC3B,MAAM;MAAEC,SAAS;MAAEC;IAAU,CAAC,GAAG,IAAAC,cAAM,gBACrC,6BAAC,mBAAU;MACT,SAAS,EAAE,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C;EAChE,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -30,92 +30,60 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
30
30
  const STEP_1 = 1;
31
31
  const STEP_2 = 2;
32
32
  function EntityAdvancedPermissions(props) {
33
- const _props$removePermissi = props.removePermissionCode,
34
- removePermissionCode = _props$removePermissi === void 0 ? 'NONE' : _props$removePermissi,
35
- entityTitle = props.entityTitle,
36
- entityId = props.entityId,
37
- className = props.className,
38
- _props$validateChange = props.validateChanges,
39
- validateChanges = _props$validateChange === void 0 ? () => '' : _props$validateChange,
40
- _props$labels = props.labels,
41
- _props$labels$title = _props$labels.title,
42
- title = _props$labels$title === void 0 ? 'Manage Permissions' : _props$labels$title,
43
- _props$labels$secondT = _props$labels.secondTitle,
44
- secondTitle = _props$labels$secondT === void 0 ? 'Add Permissions' : _props$labels$secondT,
45
- cancel = _props$labels.cancel,
46
- save = _props$labels.save,
47
- _props$labels$add = _props$labels.add,
48
- add = _props$labels$add === void 0 ? 'Add' : _props$labels$add,
49
- _props$labels$loading = _props$labels.loadingMessage,
50
- loadingMessage = _props$labels$loading === void 0 ? 'Loading' : _props$labels$loading,
51
- _props$labels$searchP = _props$labels.searchPlaceHolder,
52
- searchPlaceHolder = _props$labels$searchP === void 0 ? 'Add roles & members...' : _props$labels$searchP,
53
- _props$labels$allOpti = _props$labels.allOptionsSelected,
54
- allOptionsSelected = _props$labels$allOpti === void 0 ? 'You’ve selected all your members.' : _props$labels$allOpti,
55
- _props$labels$noOptio = _props$labels.noOptionsMessage,
56
- noOptionsMessage = _props$labels$noOptio === void 0 ? 'We couldn’t find any matches. Try another search.' : _props$labels$noOptio,
57
- backButtonLabel = _props$labels.backButtonLabel,
58
- _props$labels$checkBo = _props$labels.checkBoxNotifyLabel,
59
- checkBoxNotifyLabel = _props$labels$checkBo === void 0 ? 'Notify people' : _props$labels$checkBo,
60
- _props$labels$notifyM = _props$labels.notifyMessagePlaceholder,
61
- notifyMessagePlaceholder = _props$labels$notifyM === void 0 ? 'Add A Message (Optional)' : _props$labels$notifyM,
62
- _props$labels$notifyM2 = _props$labels.notifyMessageLabel,
63
- notifyMessageLabel = _props$labels$notifyM2 === void 0 ? 'Add A Message' : _props$labels$notifyM2,
64
- _props$labels$notifyL = _props$labels.notifyLabelHint,
65
- notifyLabelHint = _props$labels$notifyL === void 0 ? 'Notifications will be sent by email and show in the members area.' : _props$labels$notifyL,
66
- _props$labels$closeAr = _props$labels.closeAriaLabel,
67
- closeAriaLabel = _props$labels$closeAr === void 0 ? 'Close' : _props$labels$closeAr,
68
- _props$labels$backAri = _props$labels.backAriaLabel,
69
- backAriaLabel = _props$labels$backAri === void 0 ? 'Back' : _props$labels$backAri,
70
- _props$labels$emptySt = _props$labels.emptyStateTitle,
71
- emptyStateTitle = _props$labels$emptySt === void 0 ? 'Only Admins Can Access This Folder' : _props$labels$emptySt,
72
- _props$labels$emptySt2 = _props$labels.emptyStateDescription,
73
- emptyStateDescription = _props$labels$emptySt2 === void 0 ? 'Add permissions to share this folder with site members, subscription plans and more.' : _props$labels$emptySt2,
74
- _props$labels$buttonA = _props$labels.buttonAddNotify,
75
- buttonAddNotify = _props$labels$buttonA === void 0 ? 'Add & Notify' : _props$labels$buttonA,
76
- _props$labels$step1Sa = _props$labels.step1SaveError,
77
- step1SaveError = _props$labels$step1Sa === void 0 ? 'This action didn’t work out, try again later or close the window to continue without saving.' : _props$labels$step1Sa,
78
- _props$labels$step2Sa = _props$labels.step2SaveError,
79
- step2SaveError = _props$labels$step2Sa === void 0 ? 'There was a problem saving changes. Please try again later.' : _props$labels$step2Sa,
80
- _props$labels$rolesLi = _props$labels.rolesListError,
81
- rolesListError = _props$labels$rolesLi === void 0 ? 'There was a problem loading permissions. Wait a moment and try again.' : _props$labels$rolesLi,
82
- _props$labels$numberO = _props$labels.numberOfResultsMessage,
83
- numberOfResultsMessage = _props$labels$numberO === void 0 ? '{0} results' : _props$labels$numberO,
84
- _props$labels$pressDe = _props$labels.pressDeleteToRemoveMessage,
85
- pressDeleteToRemoveMessage = _props$labels$pressDe === void 0 ? '{0}: press delete to remove' : _props$labels$pressDe,
86
- _props$labels$selectP = _props$labels.selectPermissionLabel,
87
- selectPermissionLabel = _props$labels$selectP === void 0 ? 'Select permission' : _props$labels$selectP,
88
- _props$labels$saveSuc = _props$labels.saveSuccessMessage,
89
- saveSuccessMessage = _props$labels$saveSuc === void 0 ? 'Permissions successfully added' : _props$labels$saveSuc,
90
- _props$labels$permiss = _props$labels.permissionRemovedMessage,
91
- permissionRemovedMessage = _props$labels$permiss === void 0 ? 'Permission successfully removed' : _props$labels$permiss,
92
- _props$labels$doneLab = _props$labels.doneLabel,
93
- doneLabel = _props$labels$doneLab === void 0 ? 'Done' : _props$labels$doneLab,
94
- _props$isModal = props.isModal,
95
- isModal = _props$isModal === void 0 ? true : _props$isModal,
96
- queryFunction = props.queryFunction,
97
- onClose = props.onClose,
98
- _props$availablePermi = props.availablePermissions,
99
- availablePermissions = _props$availablePermi === void 0 ? _EntityAdvancedPermissionsTypes.DefaultPermissions : _props$availablePermi,
100
- onSave = props.onSave,
101
- items = props.items,
102
- _props$direction = props.direction,
103
- direction = _props$direction === void 0 ? _EntityAdvancedPermissionsTypes.Direction.LTR : _props$direction,
104
- loading = props.loading,
105
- _props$mobile = props.mobile,
106
- mobile = _props$mobile === void 0 ? false : _props$mobile,
107
- preloadRoles = props.preloadRoles,
108
- _props$theme = props.theme,
109
- theme = _props$theme === void 0 ? _EntityAdvancedPermissionsTypes.Theme.SITE : _props$theme,
110
- _props$isSitePublishe = props.isSitePublished,
111
- isSitePublished = _props$isSitePublishe === void 0 ? 'true' : _props$isSitePublishe;
33
+ const {
34
+ removePermissionCode = 'NONE',
35
+ entityTitle,
36
+ entityId,
37
+ className,
38
+ validateChanges = () => '',
39
+ labels: {
40
+ title = 'Manage Permissions',
41
+ secondTitle = 'Add Permissions',
42
+ cancel,
43
+ save,
44
+ add = 'Add',
45
+ loadingMessage = 'Loading',
46
+ searchPlaceHolder = 'Add roles & members...',
47
+ allOptionsSelected = 'You’ve selected all your members.',
48
+ noOptionsMessage = 'We couldn’t find any matches. Try another search.',
49
+ backButtonLabel,
50
+ checkBoxNotifyLabel = 'Notify people',
51
+ notifyMessagePlaceholder = 'Add A Message (Optional)',
52
+ notifyMessageLabel = 'Add A Message',
53
+ notifyLabelHint = 'Notifications will be sent by email and show in the members area.',
54
+ closeAriaLabel = 'Close',
55
+ backAriaLabel = 'Back',
56
+ emptyStateTitle = 'Only Admins Can Access This Folder',
57
+ emptyStateDescription = 'Add permissions to share this folder with site members, subscription plans and more.',
58
+ buttonAddNotify = 'Add & Notify',
59
+ step1SaveError = 'This action didn’t work out, try again later or close the window to continue without saving.',
60
+ step2SaveError = 'There was a problem saving changes. Please try again later.',
61
+ rolesListError = 'There was a problem loading permissions. Wait a moment and try again.',
62
+ numberOfResultsMessage = '{0} results',
63
+ pressDeleteToRemoveMessage = '{0}: press delete to remove',
64
+ selectPermissionLabel = 'Select permission',
65
+ saveSuccessMessage = 'Permissions successfully added',
66
+ permissionRemovedMessage = 'Permission successfully removed',
67
+ doneLabel = 'Done'
68
+ },
69
+ isModal = true,
70
+ queryFunction,
71
+ onClose,
72
+ availablePermissions = _EntityAdvancedPermissionsTypes.DefaultPermissions,
73
+ onSave,
74
+ items,
75
+ direction = _EntityAdvancedPermissionsTypes.Direction.LTR,
76
+ loading,
77
+ mobile = false,
78
+ preloadRoles,
79
+ theme = _EntityAdvancedPermissionsTypes.Theme.SITE,
80
+ isSitePublished = 'true'
81
+ } = props;
112
82
  const isDashboard = theme === _EntityAdvancedPermissionsTypes.Theme.DASHBOARD;
113
83
  const Provider = isDashboard ? _wixStyleReact.WixStyleReactProvider : _wixUiTpa.TPAComponentsProvider;
114
84
  const searchEntityRef = /*#__PURE__*/(0, _react.createRef)();
115
85
  const step2Permissions = (availablePermissions || []).filter(permission => !(permission.divider || permission.id === removePermissionCode));
116
- const _useState = (0, _react.useState)(STEP_1),
117
- step = _useState[0],
118
- setStep = _useState[1];
86
+ const [step, setStep] = (0, _react.useState)(STEP_1);
119
87
  const defaultPermissionId = availablePermissions.length ? availablePermissions[0].id : '';
120
88
  const setFocus = () => {
121
89
  if (searchEntityRef.current) {
@@ -132,9 +100,7 @@ function EntityAdvancedPermissions(props) {
132
100
  saveState: _wixUiTpa.StatesButtonStates.IDLE,
133
101
  pendingSave: false
134
102
  };
135
- const _useReducer = (0, _react.useReducer)(_EntityAdvancedPermissionsState.advancedPermissionReducer, defaultState),
136
- advancedPermissionState = _useReducer[0],
137
- setAdvancedPermissionState = _useReducer[1];
103
+ const [advancedPermissionState, setAdvancedPermissionState] = (0, _react.useReducer)(_EntityAdvancedPermissionsState.advancedPermissionReducer, defaultState);
138
104
  const closeCallback = () => onClose ? onClose({
139
105
  closeReason: _EntityAdvancedPermissionsTypes.CloseReason.Cancel,
140
106
  availabilityStatus: advancedPermissionState.availabilityStatus
@@ -183,11 +149,13 @@ function EntityAdvancedPermissions(props) {
183
149
  type: _EntityAdvancedPermissionsState.SET_ERROR_MESSAGE,
184
150
  errorMessage: ''
185
151
  });
186
- const roleToPermission = advancedPermissionState.roleToPermission,
187
- notify = advancedPermissionState.notify,
188
- notifyMessage = advancedPermissionState.notifyMessage,
189
- selectedRoles = advancedPermissionState.selectedRoles,
190
- chosenPermission = advancedPermissionState.chosenPermission;
152
+ const {
153
+ roleToPermission,
154
+ notify,
155
+ notifyMessage,
156
+ selectedRoles,
157
+ chosenPermission
158
+ } = advancedPermissionState;
191
159
  const step2RolesToPermissions = new Map();
192
160
  (selectedRoles || []).forEach(({
193
161
  value
@@ -208,9 +176,10 @@ function EntityAdvancedPermissions(props) {
208
176
  };
209
177
  if (onSave) {
210
178
  try {
211
- const _await$onSave = await onSave(saveData),
212
- responseStatus = _await$onSave.responseStatus,
213
- availabilityStatus = _await$onSave.availabilityStatus;
179
+ const {
180
+ responseStatus,
181
+ availabilityStatus
182
+ } = await onSave(saveData);
214
183
  if (responseStatus === _EntityAdvancedPermissionsTypes.ResponseStatus.Success) {
215
184
  setAdvancedPermissionState({
216
185
  type: _EntityAdvancedPermissionsState.RESET,
@@ -253,7 +222,9 @@ function EntityAdvancedPermissions(props) {
253
222
  }
254
223
  };
255
224
  const savesStep1Silently = () => {
256
- const roleToPermission = advancedPermissionState.roleToPermission;
225
+ const {
226
+ roleToPermission
227
+ } = advancedPermissionState;
257
228
  if (roleToPermission !== undefined && roleToPermission.size > 0) {
258
229
  const saveData = {
259
230
  entityId,
@@ -357,7 +328,9 @@ function EntityAdvancedPermissions(props) {
357
328
  };
358
329
  const updatedItems = items.map(item => {
359
330
  var _advancedPermissionSt;
360
- const id = item.id;
331
+ const {
332
+ id
333
+ } = item;
361
334
  const roleToPermission = (_advancedPermissionSt = advancedPermissionState.roleToPermission) == null ? void 0 : _advancedPermissionSt.get(id);
362
335
  if (roleToPermission !== undefined) {
363
336
  return {