@griddo/ax 10.1.4 → 10.1.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "10.1.4",
4
+ "version": "10.1.5",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -230,5 +230,5 @@
230
230
  "publishConfig": {
231
231
  "access": "public"
232
232
  },
233
- "gitHead": "e7e5967817e6eff49c9b62b352988758c81a2334"
233
+ "gitHead": "0cd7e08b1541b6157760681d82ded3bdda7d2762"
234
234
  }
@@ -2,11 +2,11 @@
2
2
 
3
3
  exports[`Avatar component rendering should render the component only with name 1`] = `
4
4
  <div
5
- className="sc-gUrTyy hCAPBe"
5
+ className="sc-ejdXBC fORGYU"
6
6
  data-testid="avatar-wrapper"
7
7
  >
8
8
  <div
9
- className="sc-kZGvTt fqifXh"
9
+ className="sc-ldFCYb iNdtRr"
10
10
  data-testid="avatar"
11
11
  />
12
12
  </div>
@@ -14,11 +14,11 @@ exports[`Avatar component rendering should render the component only with name 1
14
14
 
15
15
  exports[`Avatar component rendering should render the component with a wrong image url 1`] = `
16
16
  <div
17
- className="sc-gUrTyy hCAPBe"
17
+ className="sc-ejdXBC fORGYU"
18
18
  data-testid="avatar-wrapper"
19
19
  >
20
20
  <div
21
- className="sc-kZGvTt ewoFoI"
21
+ className="sc-ldFCYb cpyHnO"
22
22
  data-testid="avatar"
23
23
  />
24
24
  </div>
@@ -26,11 +26,11 @@ exports[`Avatar component rendering should render the component with a wrong ima
26
26
 
27
27
  exports[`Avatar component rendering should render the component with an empty string as name 1`] = `
28
28
  <div
29
- className="sc-gUrTyy hCAPBe"
29
+ className="sc-ejdXBC fORGYU"
30
30
  data-testid="avatar-wrapper"
31
31
  >
32
32
  <div
33
- className="sc-kZGvTt gaoFtK"
33
+ className="sc-ldFCYb iXxXyw"
34
34
  data-testid="avatar"
35
35
  />
36
36
  </div>
@@ -38,11 +38,11 @@ exports[`Avatar component rendering should render the component with an empty st
38
38
 
39
39
  exports[`Avatar component rendering should render the component with image null 1`] = `
40
40
  <div
41
- className="sc-gUrTyy hCAPBe"
41
+ className="sc-ejdXBC fORGYU"
42
42
  data-testid="avatar-wrapper"
43
43
  >
44
44
  <div
45
- className="sc-kZGvTt iGBqvM"
45
+ className="sc-ldFCYb Tmium"
46
46
  data-testid="avatar"
47
47
  />
48
48
  </div>
@@ -50,11 +50,11 @@ exports[`Avatar component rendering should render the component with image null
50
50
 
51
51
  exports[`Avatar component rendering should render the component without name or image 1`] = `
52
52
  <div
53
- className="sc-gUrTyy hCAPBe"
53
+ className="sc-ejdXBC fORGYU"
54
54
  data-testid="avatar-wrapper"
55
55
  >
56
56
  <div
57
- className="sc-kZGvTt gaoFtK"
57
+ className="sc-ldFCYb iXxXyw"
58
58
  data-testid="avatar"
59
59
  />
60
60
  </div>
@@ -127,6 +127,21 @@ const initialStore = {
127
127
  ],
128
128
  relatedPages: [],
129
129
  },
130
+ {
131
+ id: 6,
132
+ name: "Page custom",
133
+ description: "This is the integration page custom",
134
+ site: 86,
135
+ contentHead: "<script>console.log('Hello')</script>",
136
+ contentBody: "",
137
+ contentBodyPosition: "start",
138
+ contentPresence: {
139
+ presenceType: "page-custom",
140
+ relatedPages: null,
141
+ },
142
+ active: true,
143
+ relatedPages: [],
144
+ },
130
145
  ],
131
146
  totalItems: 3,
132
147
  integrationCopy: null,
@@ -157,7 +172,7 @@ describe("IntegrationsField component rendering", () => {
157
172
  );
158
173
  });
159
174
 
160
- expect(screen.getByText("Third-Party Integration")).toBeTruthy();
175
+ expect(screen.getByText("Add-ons")).toBeTruthy();
161
176
  });
162
177
 
163
178
  test("should render the component IntegrationsField with integrations", async () => {
@@ -183,7 +198,7 @@ describe("IntegrationsField component rendering", () => {
183
198
  );
184
199
  });
185
200
 
186
- expect(screen.getAllByTestId("integration-item").length).toBe(3);
201
+ expect(screen.getAllByTestId("integration-item").length).toBe(4);
187
202
  });
188
203
 
189
204
  test("should render the component IntegrationsField with custom code integration", async () => {
@@ -218,7 +233,7 @@ describe("IntegrationsField component rendering", () => {
218
233
  );
219
234
  });
220
235
 
221
- expect(screen.getAllByTestId("integration-item").length).toBe(4);
236
+ expect(screen.getAllByTestId("integration-item").length).toBe(5);
222
237
  });
223
238
  });
224
239
 
@@ -247,17 +262,17 @@ describe("Events", () => {
247
262
  );
248
263
  });
249
264
 
250
- expect(screen.getAllByTestId("integration-item").length).toBe(3);
265
+ expect(screen.getAllByTestId("integration-item").length).toBe(4);
251
266
 
252
267
  const floatingMenuButtons = screen.getAllByTestId("floating-menu-button");
253
268
  fireEvent.click(floatingMenuButtons[1]);
254
- const actionMenu = screen.getByTestId("action-menu-item");
255
- fireEvent.click(actionMenu);
269
+ const actionMenu = screen.getAllByTestId("action-menu-item");
270
+ fireEvent.click(actionMenu[1]);
256
271
 
257
272
  const buttonsDefault = screen.getAllByTestId("button-default");
258
- fireEvent.click(buttonsDefault[3]);
273
+ fireEvent.click(buttonsDefault[4]);
259
274
 
260
- const integrationsWithDeletion = initialStore.integrations.integrations.slice(0, 2);
275
+ const integrationsWithDeletion = initialStore.integrations.integrations.slice(0,3);
261
276
 
262
277
  expect(onChange).toHaveBeenLastCalledWith(integrationsWithDeletion);
263
278
  });
@@ -35,7 +35,7 @@ const VariablesPanel = (props: IProps): JSX.Element => {
35
35
  };
36
36
 
37
37
  const noteText =
38
- "This integration has some variables assigned. You can define its values to customize some properties.";
38
+ "This add-on has some variables assigned. You can define its values to customize some properties.";
39
39
 
40
40
  const Variable = ({ variable }: { variable: IIntegrationVariable }) => {
41
41
  const handleChange = (value: string) => setVariableValueRef.current(variable.id, value);
@@ -12,7 +12,7 @@ const DeleteModal = (props: IModal & { integrationName: string | undefined }): J
12
12
  <Modal
13
13
  isOpen={isOpen}
14
14
  hide={toggleModal}
15
- title={`Remove ${integrationName} integration`}
15
+ title={`Remove ${integrationName} add-on`}
16
16
  secondaryAction={secondaryModalAction}
17
17
  mainAction={mainModalAction}
18
18
  size="S"
@@ -60,7 +60,7 @@ const IntegrationItem = (props: IProps): JSX.Element => {
60
60
  const integrationName = isCustom ? "Custom Code" : integration.name;
61
61
 
62
62
  const mainDeleteModalAction = {
63
- title: "Remove integration",
63
+ title: "Remove add-on",
64
64
  onClick: removeItem,
65
65
  };
66
66
  const secondaryDeleteModalAction = { title: "Cancel", onClick: toggleModalDelete };
@@ -25,7 +25,7 @@ const SideModal = (props: ISideModalProps): JSX.Element | null => {
25
25
  ? createPortal(
26
26
  <S.Wrapper ref={node}>
27
27
  <S.Header>
28
- <S.Title>Integrations</S.Title>
28
+ <S.Title>Add-ons</S.Title>
29
29
  <S.ButtonWrapper>
30
30
  <IconAction icon="close" onClick={toggleModal} />
31
31
  </S.ButtonWrapper>
@@ -65,7 +65,8 @@ const IntegrationsField = (props: IIntegrationsFieldProps): JSX.Element => {
65
65
 
66
66
  const timeSinceIntegrationCopy = !!integrationCopy && differenceInSeconds(new Date(), new Date(integrationCopy.date));
67
67
  const eightHoursInSeconds = 8 * 60 * 60;
68
- const showPasteIntegrationButton = !disabled && !!integrationCopy && timeSinceIntegrationCopy < eightHoursInSeconds;
68
+ const showPasteIntegrationButton =
69
+ !disabled && !!integrationCopy && timeSinceIntegrationCopy < eightHoursInSeconds;
69
70
 
70
71
  const pasteIntegration = () => {
71
72
  integrationCopy && handleAdd(integrationCopy.integration);
@@ -73,14 +74,14 @@ const IntegrationsField = (props: IIntegrationsFieldProps): JSX.Element => {
73
74
 
74
75
  return (
75
76
  <S.Wrapper>
76
- <S.Title>Third-Party Integration</S.Title>
77
+ <S.Title>Add-ons</S.Title>
77
78
  <S.ItemRow>
78
79
  <S.Subtitle>{state?.length || 0} items</S.Subtitle>
79
80
  <S.ActionsWrapper>
80
81
  {showPasteIntegrationButton && <PasteIntegrationButton pasteIntegration={pasteIntegration} />}
81
82
  {!disabled && (
82
83
  <>
83
- <Tooltip content="Add integration" hideOnClick>
84
+ <Tooltip content="Add Add-on" hideOnClick>
84
85
  <IconAction icon="add" onClick={toggleModal} />
85
86
  </Tooltip>
86
87
  <SideModal
@@ -8,7 +8,7 @@ import AutoItem from "./AutoItem";
8
8
  import * as S from "./style";
9
9
 
10
10
  const AutoPanel = (props: IProps): JSX.Element => {
11
- const { onChange, site, structuredData, validators } = props;
11
+ const { onChange, site, structuredData, validators, categories } = props;
12
12
 
13
13
  const { state, setState } = useReference();
14
14
 
@@ -199,7 +199,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
199
199
  filter={sourceFilters}
200
200
  addFilter={handleAddFilter}
201
201
  site={site}
202
- structuredDataSite={structuredData.site}
202
+ structuredDataSite={[...structuredData.site, ...categories.site]}
203
203
  />
204
204
  );
205
205
  })}
@@ -241,6 +241,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
241
241
 
242
242
  interface IProps {
243
243
  structuredData: { global: IStructuredData[]; site: IStructuredData[] };
244
+ categories: { global: IStructuredData[]; site: IStructuredData[] };
244
245
  onChange: (value: any) => void;
245
246
  site: ISite;
246
247
  validators?: Record<string, unknown>;
@@ -28,6 +28,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
28
28
  site,
29
29
  selectionType,
30
30
  structuredDataValues,
31
+ categories,
31
32
  validators,
32
33
  maxItems,
33
34
  resetValidation,
@@ -170,7 +171,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
170
171
 
171
172
  const getPanel = () =>
172
173
  isAuto ? (
173
- <AutoPanel structuredData={structuredDataValues} onChange={handleOnChange} site={site} validators={validators} />
174
+ <AutoPanel structuredData={structuredDataValues} categories={categories} onChange={handleOnChange} site={site} validators={validators} />
174
175
  ) : (
175
176
  <ManualPanel
176
177
  onChange={handleOnChange}
@@ -229,6 +230,7 @@ export interface IReferenceFieldProps {
229
230
  site: ISite;
230
231
  selectionType?: string[];
231
232
  structuredDataValues: { global: IStructuredData[]; site: IStructuredData[] };
233
+ categories: { global: IStructuredData[]; site: IStructuredData[] };
232
234
  validators?: Record<string, unknown>;
233
235
  maxItems?: number;
234
236
  resetValidation?: () => void;
@@ -239,6 +241,7 @@ export interface IReferenceFieldProps {
239
241
 
240
242
  const mapStateToProps = (state: IRootState) => ({
241
243
  structuredDataValues: state.structuredData.structuredData,
244
+ categories: state.structuredData.categories,
242
245
  });
243
246
 
244
247
  export default connect(mapStateToProps, null)(ReferenceFieldWithProvider);
@@ -81,7 +81,7 @@ const CategoriesList = (props: IProps): JSX.Element => {
81
81
  useEffect(() => {
82
82
  currentStructuredData && getContents(currentStructuredData.id);
83
83
  // eslint-disable-next-line react-hooks/exhaustive-deps
84
- }, [lang, currentStructuredData]);
84
+ }, [lang, currentStructuredData, page]);
85
85
 
86
86
  const handleClick = (dataID: string) => {
87
87
  setSelectedCategory(dataID, scope);
@@ -80,7 +80,7 @@ const IntegrationForm = (props: IProps) => {
80
80
  action: handleSave,
81
81
  };
82
82
 
83
- const pageTitle = form.name.trim().length > 0 ? form.name : "New Integration";
83
+ const pageTitle = form.name.trim().length > 0 ? form.name : "New Add-on";
84
84
 
85
85
  const bodyOptions = [
86
86
  {
@@ -10,7 +10,7 @@ const CopyModal = (props: ICopyModalProps): JSX.Element => {
10
10
  const [site, setSite] = useState();
11
11
 
12
12
  const mainCopyModalAction = {
13
- title: "Copy integration",
13
+ title: "Copy add-on",
14
14
  onClick: () => site && action(site),
15
15
  disabled: !site,
16
16
  };
@@ -21,14 +21,14 @@ const CopyModal = (props: ICopyModalProps): JSX.Element => {
21
21
  <Modal
22
22
  isOpen={isOpen}
23
23
  hide={hide}
24
- title="Copy integration in another site"
24
+ title="Copy add-on in another site"
25
25
  secondaryAction={secondaryCopyModalAction}
26
26
  mainAction={mainCopyModalAction}
27
27
  size="S"
28
28
  overflow="visible"
29
29
  >
30
30
  <S.ModalContent>
31
- <S.Title>Select a site to copy this integration.</S.Title>
31
+ <S.Title>Select a site to copy this add-on.</S.Title>
32
32
  <FieldsBehavior name="language" fieldType="AsyncSelect" value={site} entity="sites" onChange={setSite} />
33
33
  </S.ModalContent>
34
34
  </Modal>
@@ -79,14 +79,14 @@ const IntegrationItem = (props: IIntegrationItemProps): JSX.Element => {
79
79
  ];
80
80
 
81
81
  const mainDeleteModalAction = {
82
- title: "Delete integration",
82
+ title: "Delete add-on",
83
83
  onClick: removeItem,
84
84
  };
85
85
 
86
86
  const secondaryDeleteModalAction = { title: "Cancel", onClick: toggleModalDelete };
87
87
 
88
88
  const mainChangeStateModalAction = {
89
- title: `${integration.active ? "Disable" : "Enable"} integration`,
89
+ title: `${integration.active ? "Disable" : "Enable"} add-on`,
90
90
  onClick: handleChangeState,
91
91
  };
92
92
 
@@ -94,7 +94,7 @@ const IntegrationItem = (props: IIntegrationItemProps): JSX.Element => {
94
94
 
95
95
  const copyToastProps = {
96
96
  setIsVisible: setIsVisibleCopy,
97
- message: "1 Integration copied to another Site",
97
+ message: "1 Add-on copied to another Site",
98
98
  };
99
99
 
100
100
  const copyIntegration = async (site: number) => {
@@ -108,7 +108,7 @@ const IntegrationItem = (props: IIntegrationItemProps): JSX.Element => {
108
108
  const handleClick = () => {
109
109
  const { setCurrentIntegration, setHistoryPush } = props;
110
110
  setCurrentIntegration(integration);
111
- setHistoryPush("integrations/edit");
111
+ setHistoryPush("addons/edit");
112
112
  };
113
113
 
114
114
  return (
@@ -136,27 +136,27 @@ const IntegrationItem = (props: IIntegrationItemProps): JSX.Element => {
136
136
  <Modal
137
137
  isOpen={isOpenDelete}
138
138
  hide={toggleModalDelete}
139
- title="Delete integration"
139
+ title="Delete add-on"
140
140
  secondaryAction={secondaryDeleteModalAction}
141
141
  mainAction={mainDeleteModalAction}
142
142
  size="S"
143
143
  >
144
144
  <S.ModalContent>
145
- Are you sure you want to delete <strong>{integration.name} integration</strong>? This action{" "}
145
+ Are you sure you want to delete <strong>{integration.name} add-on</strong>? This action{" "}
146
146
  <strong>cannot be undone</strong>.
147
147
  </S.ModalContent>
148
148
  </Modal>
149
149
  <Modal
150
150
  isOpen={isOpenChangeState}
151
151
  hide={toggleModalChangeState}
152
- title={`${integration.active ? "Disable" : "Enable"} Third-Party Integration`}
152
+ title={`${integration.active ? "Disable" : "Enable"} Add-on`}
153
153
  secondaryAction={secondaryChangeStateModalAction}
154
154
  mainAction={mainChangeStateModalAction}
155
155
  size="S"
156
156
  >
157
157
  <S.ModalContent>
158
158
  Are you sure you want to {integration.active ? "disable" : "enable"}{" "}
159
- <strong>{integration.name} integration</strong>? This integration will {integration.active ? "stop" : "start"}{" "}
159
+ <strong>{integration.name} add-on</strong>? This add-on will {integration.active ? "stop" : "start"}{" "}
160
160
  working in the pages previously added.
161
161
  </S.ModalContent>
162
162
  </Modal>
@@ -13,7 +13,7 @@ const DeleteModal = (props: IModal & { integrations: IIntegration[]; selectedIds
13
13
  <Modal
14
14
  isOpen={isOpen}
15
15
  hide={toggleModal}
16
- title="Delete Integrations"
16
+ title="Delete Add-ons"
17
17
  secondaryAction={secondaryModalAction}
18
18
  mainAction={mainModalAction}
19
19
  size="S"
@@ -33,13 +33,13 @@ const DeactivateModal = (props: IModal & { integrations: IIntegration[]; selecte
33
33
  <Modal
34
34
  isOpen={isOpen}
35
35
  hide={toggleModal}
36
- title="Deactivate Integrations"
36
+ title="Deactivate Add-ons"
37
37
  secondaryAction={secondaryModalAction}
38
38
  mainAction={mainModalAction}
39
39
  size="S"
40
40
  >
41
41
  <S.ModalContent>
42
- Are you sure you want to disable {getIntegrationsNames(integrations, selectedIds)}? These integrations will stop
42
+ Are you sure you want to disable {getIntegrationsNames(integrations, selectedIds)}? These add-ons will stop
43
43
  working in the pages previously added.
44
44
  </S.ModalContent>
45
45
  </Modal>
@@ -53,9 +53,9 @@ const Integrations = (props: IIntegrationsProps): JSX.Element => {
53
53
  } = useToast();
54
54
 
55
55
  const noElementsProps: IEmptyStateProps = {
56
- message: "To start using third-party integrations in your site, create as many Custom Code as you need.",
56
+ message: "To start using add-ons in your site, create as many Custom Code as you need.",
57
57
  button: "Create custom code",
58
- action: () => setHistoryPush(`/sites/settings/integrations/new`),
58
+ action: () => setHistoryPush(`/sites/settings/addons/new`),
59
59
  };
60
60
  const fetchState = { isLoading, isFiltered };
61
61
  const { isEmpty, emptyStateProps } = useEmptyState(integrations, fetchState, { noElementsProps });
@@ -164,37 +164,37 @@ const Integrations = (props: IIntegrationsProps): JSX.Element => {
164
164
  };
165
165
 
166
166
  const mainDeleteModalAction = {
167
- title: "Delete integrations",
167
+ title: "Delete add-ons",
168
168
  onClick: bulkDelete,
169
169
  };
170
170
  const secondaryDeleteModalAction = { title: "Cancel", onClick: toggleModalDelete };
171
171
 
172
172
  const mainDeactivateModalAction = {
173
- title: "Deactivate integrations",
173
+ title: "Deactivate add-ons",
174
174
  onClick: bulkDeactivate,
175
175
  };
176
176
  const secondaryDeactivateModalAction = { title: "Cancel", onClick: toggleModalDeactivate };
177
177
 
178
178
  const deletedToastProps = {
179
179
  setIsVisible: setIsVisibleDelete,
180
- message: stateToastDelete?.total > 1 ? `${stateToastDelete?.total} integrations deleted` : "Integration deleted",
180
+ message: stateToastDelete?.total > 1 ? `${stateToastDelete?.total} add-ons deleted` : "Add-on deleted",
181
181
  };
182
182
 
183
183
  const changedToastProps = {
184
184
  setIsVisible: setIsVisibleChange,
185
- message: `${stateToastChange?.total} integration${stateToastChange?.total > 1 ? "s" : ""} ${
185
+ message: `${stateToastChange?.total} add-on${stateToastChange?.total > 1 ? "s" : ""} ${
186
186
  stateToastChange?.active ? "enabled" : "disabled"
187
187
  }`,
188
188
  };
189
189
 
190
190
  const rightButtonProps = {
191
191
  label: "New Custom Code",
192
- action: () => setHistoryPush(`/sites/settings/integrations/new`),
192
+ action: () => setHistoryPush(`/sites/settings/addons/new`),
193
193
  };
194
194
 
195
195
  return (
196
196
  <>
197
- <MainWrapper backLink={false} title="Third-Party Integration" rightButton={rightButtonProps}>
197
+ <MainWrapper backLink={false} title="Add-ons" rightButton={rightButtonProps}>
198
198
  <S.Wrapper data-testid="integrations-main-wrapper">
199
199
  <S.ContentWrapper>
200
200
  <ErrorToast />
@@ -24,13 +24,13 @@ const getIntegrationsNames = (integrations: IIntegration[], ids: number[]) => {
24
24
  return (
25
25
  <>
26
26
  <strong>{namesString.substring(0, lastCommaIndex - 1)}</strong> and
27
- <strong>{namesString.substring(lastCommaIndex + 1)}</strong> integrations
27
+ <strong>{namesString.substring(lastCommaIndex + 1)}</strong> add-ons
28
28
  </>
29
29
  );
30
30
  } else {
31
31
  return (
32
32
  <>
33
- <strong>{namesString}</strong> integration
33
+ <strong>{namesString}</strong> add-on
34
34
  </>
35
35
  );
36
36
  }
@@ -104,24 +104,24 @@ export default [
104
104
  name: "SEO & Analytics",
105
105
  },
106
106
  {
107
- path: `${BASE_PATH}/settings/integrations`,
107
+ path: `${BASE_PATH}/settings/addons`,
108
108
  component: Integrations,
109
- name: "Third-Party Integration",
109
+ name: "Add-ons",
110
110
  },
111
111
  ],
112
112
  },
113
113
  ],
114
114
  },
115
115
  {
116
- path: `${BASE_PATH}/settings/integrations/new`,
116
+ path: `${BASE_PATH}/settings/addons/new`,
117
117
  component: IntegrationForm,
118
- name: "New Integration",
118
+ name: "New Add-on",
119
119
  showInNav: false,
120
120
  },
121
121
  {
122
- path: `${BASE_PATH}/settings/integrations/edit`,
122
+ path: `${BASE_PATH}/settings/addons/edit`,
123
123
  component: IntegrationForm,
124
- name: "Edit Integration",
124
+ name: "Edit Add-on",
125
125
  showInNav: false,
126
126
  },
127
127
  { path: `${BASE_PATH}/settings/languages`, component: Settings, name: "Languages", showInNav: false },