Skip to content

Commit eff81fd

Browse files
committed
format
1 parent 451782e commit eff81fd

File tree

1 file changed

+63
-63
lines changed

1 file changed

+63
-63
lines changed

integrations/googleanalytics/src/components.tsx

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,79 @@ type GARuntimeEnvironment = RuntimeEnvironment<{}, GASiteInstallationConfigurati
55
type GARuntimeContext = RuntimeContext<GARuntimeEnvironment>;
66

77
type GASiteInstallationConfiguration = {
8-
tracking_id?: string;
8+
tracking_id?: string;
99
};
1010

1111
type GAState = GASiteInstallationConfiguration;
1212

1313
type GAProps = {
14-
siteInstallation: {
15-
configuration?: GASiteInstallationConfiguration;
16-
};
14+
siteInstallation: {
15+
configuration?: GASiteInstallationConfiguration;
16+
};
1717
};
1818

1919
export type GAAction = { action: 'save.config' };
2020

2121
export const configBlock = createComponent<GAProps, GAState, GAAction, GARuntimeContext>({
22-
componentId: 'config',
23-
initialState: (props) => {
24-
const siteInstallation = props.siteInstallation;
25-
return {
26-
tracking_id: siteInstallation.configuration?.tracking_id ?? '',
27-
};
28-
},
29-
action: async (element, action, context) => {
30-
switch (action.action) {
31-
case 'save.config':
32-
const { api, environment } = context;
33-
const siteInstallation = environment.siteInstallation;
34-
if (!siteInstallation) {
35-
throw Error('No site installation found');
36-
}
22+
componentId: 'config',
23+
initialState: (props) => {
24+
const siteInstallation = props.siteInstallation;
25+
return {
26+
tracking_id: siteInstallation.configuration?.tracking_id ?? '',
27+
};
28+
},
29+
action: async (element, action, context) => {
30+
switch (action.action) {
31+
case 'save.config':
32+
const { api, environment } = context;
33+
const siteInstallation = environment.siteInstallation;
34+
if (!siteInstallation) {
35+
throw Error('No site installation found');
36+
}
3737

38-
const configurationBody = {
39-
...siteInstallation.configuration,
40-
tracking_id: element.state.tracking_id,
41-
};
42-
await api.integrations.updateIntegrationSiteInstallation(
43-
siteInstallation.integration,
44-
siteInstallation.installation,
45-
siteInstallation.site,
46-
{
47-
configuration: {
48-
...configurationBody,
49-
},
50-
},
51-
);
52-
return element;
53-
}
54-
},
55-
render: async () => {
56-
return (
57-
<configuration>
58-
<input
59-
label="Client ID"
60-
hint={<text>The unique identifier of your GA app client.</text>}
61-
element={<textinput state="tracking_id" placeholder="Tracking ID" />}
62-
/>
38+
const configurationBody = {
39+
...siteInstallation.configuration,
40+
tracking_id: element.state.tracking_id,
41+
};
42+
await api.integrations.updateIntegrationSiteInstallation(
43+
siteInstallation.integration,
44+
siteInstallation.installation,
45+
siteInstallation.site,
46+
{
47+
configuration: {
48+
...configurationBody,
49+
},
50+
},
51+
);
52+
return element;
53+
}
54+
},
55+
render: async () => {
56+
return (
57+
<configuration>
58+
<input
59+
label="Client ID"
60+
hint={<text>The unique identifier of your GA app client.</text>}
61+
element={<textinput state="tracking_id" placeholder="Tracking ID" />}
62+
/>
6363

64-
<divider />
65-
<input
66-
label=""
67-
hint=""
68-
element={
69-
<button
70-
style="primary"
71-
disabled={false}
72-
label="Save"
73-
tooltip="Save configuration"
74-
onPress={{
75-
action: 'save.config',
76-
}}
77-
/>
78-
}
79-
/>
80-
</configuration>
81-
);
82-
},
64+
<divider />
65+
<input
66+
label=""
67+
hint=""
68+
element={
69+
<button
70+
style="primary"
71+
disabled={false}
72+
label="Save"
73+
tooltip="Save configuration"
74+
onPress={{
75+
action: 'save.config',
76+
}}
77+
/>
78+
}
79+
/>
80+
</configuration>
81+
);
82+
},
8383
});

0 commit comments

Comments
 (0)