@manta-eu/react 0.1.7 → 0.1.8
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/README.md +2 -0
- package/dist/components/chart/AreaChart.d.ts.map +1 -1
- package/dist/components/chart/AreaChart.js +4 -6
- package/dist/components/chart/BarChart.d.ts.map +1 -1
- package/dist/components/chart/BarChart.js +5 -6
- package/dist/components/chart/ComposedChart.d.ts.map +1 -1
- package/dist/components/chart/ComposedChart.js +15 -7
- package/dist/components/chart/LineChart.d.ts.map +1 -1
- package/dist/components/chart/LineChart.js +4 -6
- package/dist/components/chart/annotations.d.ts +4 -0
- package/dist/components/chart/annotations.d.ts.map +1 -1
- package/dist/components/chart/annotations.js +10 -2
- package/dist/components/chart/chart-schemas.d.ts +1960 -54
- package/dist/components/chart/chart-schemas.d.ts.map +1 -1
- package/dist/components/chart/chart-schemas.js +137 -15
- package/dist/components/chart/series.d.ts +28 -0
- package/dist/components/chart/series.d.ts.map +1 -0
- package/dist/components/chart/series.js +61 -0
- package/dist/components/chart/stacks.d.ts +9 -0
- package/dist/components/chart/stacks.d.ts.map +1 -0
- package/dist/components/chart/stacks.js +11 -0
- package/dist/components/chat-view/ChatHeaders.d.ts.map +1 -1
- package/dist/components/chat-view/ChatHeaders.js +2 -2
- package/dist/components/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/layouts/Sidebar.js +14 -3
- package/dist/components/planning/ActioningView.d.ts.map +1 -1
- package/dist/components/planning/ActioningView.js +7 -49
- package/dist/components/planning/ExecutionSectionItem.d.ts +6 -4
- package/dist/components/planning/ExecutionSectionItem.d.ts.map +1 -1
- package/dist/components/planning/ExecutionSectionItem.js +2 -2
- package/dist/components/planning/ExecutionSections.d.ts +6 -4
- package/dist/components/planning/ExecutionSections.d.ts.map +1 -1
- package/dist/components/planning/ExecutionSections.js +2 -2
- package/dist/components/planning/ManualActionCard.d.ts +14 -8
- package/dist/components/planning/ManualActionCard.d.ts.map +1 -1
- package/dist/components/planning/ManualActionCard.js +44 -24
- package/dist/components/planning/ManualActionList.d.ts +22 -0
- package/dist/components/planning/ManualActionList.d.ts.map +1 -0
- package/dist/components/planning/ManualActionList.js +35 -0
- package/dist/components/planning/manual-action-targets.d.ts +4 -0
- package/dist/components/planning/manual-action-targets.d.ts.map +1 -0
- package/dist/components/planning/manual-action-targets.js +19 -0
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/index.d.ts.map +1 -1
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/sidebar/nav-user.d.ts +1 -1
- package/dist/components/sidebar/nav-user.d.ts.map +1 -1
- package/dist/components/sidebar/nav-user.js +3 -3
- package/dist/components/sidebar/user-avatar.d.ts +7 -0
- package/dist/components/sidebar/user-avatar.d.ts.map +1 -0
- package/dist/components/sidebar/user-avatar.js +9 -0
- package/dist/globals.css +6 -13
- package/dist/hooks/use-connection-problems.d.ts.map +1 -1
- package/dist/hooks/use-manual-actions.d.ts +13 -3
- package/dist/hooks/use-manual-actions.d.ts.map +1 -1
- package/dist/hooks/use-manual-actions.js +16 -10
- package/dist/hooks/useAuth.d.ts +1 -0
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +7 -1
- package/dist/hooks/useConversations.d.ts +1 -0
- package/dist/hooks/useConversations.d.ts.map +1 -1
- package/dist/hooks/useResolveManualAction.d.ts +14 -0
- package/dist/hooks/useResolveManualAction.d.ts.map +1 -0
- package/dist/hooks/useResolveManualAction.js +47 -0
- package/dist/hooks/useValidateActionPlan.d.ts.map +1 -1
- package/dist/ldo-ui.d.ts +2 -1
- package/dist/ldo-ui.d.ts.map +1 -1
- package/dist/ldo-ui.js +2 -1
- package/dist/lib/build-config.d.ts +2 -0
- package/dist/lib/build-config.d.ts.map +1 -1
- package/dist/lib/build-config.js +2 -0
- package/dist/lib/chat-types.d.ts +1 -0
- package/dist/lib/chat-types.d.ts.map +1 -1
- package/dist/lib/datastore-route-table.d.ts +2 -0
- package/dist/lib/datastore-route-table.d.ts.map +1 -1
- package/dist/lib/datastore-route-table.js +3 -1
- package/dist/lib/datastore-routes.d.ts +7 -1
- package/dist/lib/datastore-routes.d.ts.map +1 -1
- package/dist/lib/datastore-routes.js +7 -2
- package/dist/lib/decode-chart-entities.d.ts.map +1 -1
- package/dist/lib/decode-chart-entities.js +5 -1
- package/dist/lib/manual-actions.d.ts +1 -0
- package/dist/lib/manual-actions.d.ts.map +1 -1
- package/dist/lib/manual-actions.js +4 -1
- package/dist/lib/structured-data/types.d.ts +7 -2
- package/dist/lib/structured-data/types.d.ts.map +1 -1
- package/dist/providers/ChatManagerProvider.d.ts.map +1 -1
- package/dist/providers/ChatManagerProvider.js +18 -16
- package/dist/providers/NavExtrasProvider.d.ts +23 -0
- package/dist/providers/NavExtrasProvider.d.ts.map +1 -0
- package/dist/providers/NavExtrasProvider.js +10 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +1 -0
- package/dist/routes/explain/ExplainEmpty.d.ts.map +1 -1
- package/dist/routes/explain/ExplainEmpty.js +2 -1
- package/dist/routes/integrations/catalog-shape.d.ts +2 -1
- package/dist/routes/integrations/catalog-shape.d.ts.map +1 -1
- package/dist/routes/integrations/components/AddIntegrationModal.d.ts.map +1 -1
- package/dist/routes/integrations/components/AddIntegrationModal.js +1 -1
- package/dist/routes/integrations/components/MantaSyncPluginDownload.d.ts +13 -0
- package/dist/routes/integrations/components/MantaSyncPluginDownload.d.ts.map +1 -0
- package/dist/routes/integrations/components/MantaSyncPluginDownload.js +23 -0
- package/dist/routes/integrations/components/connect-forms/ConnectFormHeader.d.ts +1 -1
- package/dist/routes/integrations/components/connect-forms/ConnectFormHeader.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/ConnectWizardShell.d.ts +1 -1
- package/dist/routes/integrations/components/connect-forms/ConnectWizardShell.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/ConnectionStringInput.d.ts +11 -0
- package/dist/routes/integrations/components/connect-forms/ConnectionStringInput.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/ConnectionStringInput.js +49 -0
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.d.ts +7 -0
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.js +87 -0
- package/dist/routes/integrations/components/connect-forms/DataConnectionConnectForm.d.ts +20 -0
- package/dist/routes/integrations/components/connect-forms/DataConnectionConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/DataConnectionConnectForm.js +144 -0
- package/dist/routes/integrations/components/connect-forms/DataConnectionFieldInputs.d.ts +8 -0
- package/dist/routes/integrations/components/connect-forms/DataConnectionFieldInputs.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/DataConnectionFieldInputs.js +44 -0
- package/dist/routes/integrations/components/connect-forms/FigmaConnectForm.d.ts +3 -0
- package/dist/routes/integrations/components/connect-forms/FigmaConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/FigmaConnectForm.js +20 -0
- package/dist/routes/integrations/components/connect-forms/GmailConnectForm.d.ts +3 -0
- package/dist/routes/integrations/components/connect-forms/GmailConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/GmailConnectForm.js +11 -0
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.d.ts +3 -0
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.js +37 -0
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.d.ts +3 -0
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.js +37 -0
- package/dist/routes/integrations/components/connect-forms/ImportStartedNotice.d.ts +21 -0
- package/dist/routes/integrations/components/connect-forms/ImportStartedNotice.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/ImportStartedNotice.js +25 -0
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.d.ts +45 -0
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.js +187 -0
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.d.ts +6 -0
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.js +68 -0
- package/dist/routes/integrations/components/connect-forms/LinkedinConnectForm.d.ts +10 -0
- package/dist/routes/integrations/components/connect-forms/LinkedinConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/LinkedinConnectForm.js +124 -0
- package/dist/routes/integrations/components/connect-forms/MetaAdsConnectForm.d.ts +14 -0
- package/dist/routes/integrations/components/connect-forms/MetaAdsConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/MetaAdsConnectForm.js +183 -0
- package/dist/routes/integrations/components/connect-forms/OAuthConnectLink.d.ts +10 -0
- package/dist/routes/integrations/components/connect-forms/OAuthConnectLink.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/OAuthConnectLink.js +17 -0
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.d.ts +45 -0
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.js +136 -0
- package/dist/routes/integrations/components/connect-forms/OAuthSingleAccountConnectForm.d.ts +23 -0
- package/dist/routes/integrations/components/connect-forms/OAuthSingleAccountConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/OAuthSingleAccountConnectForm.js +63 -0
- package/dist/routes/integrations/components/connect-forms/ShopifyConnectForm.d.ts +3 -0
- package/dist/routes/integrations/components/connect-forms/ShopifyConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/ShopifyConnectForm.js +14 -0
- package/dist/routes/integrations/components/connect-forms/SlackConnectForm.d.ts +3 -0
- package/dist/routes/integrations/components/connect-forms/SlackConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/SlackConnectForm.js +10 -0
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.d.ts +5 -0
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.js +35 -0
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.d.ts +5 -0
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.js +47 -0
- package/dist/routes/integrations/components/connect-forms/connection-string-fields.d.ts +13 -0
- package/dist/routes/integrations/components/connect-forms/connection-string-fields.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/connection-string-fields.js +110 -0
- package/dist/routes/integrations/components/connect-forms/dash-folder-tree.d.ts +6 -0
- package/dist/routes/integrations/components/connect-forms/dash-folder-tree.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/dash-folder-tree.js +14 -0
- package/dist/routes/integrations/components/connect-forms/data-connection-fields.d.ts +35 -0
- package/dist/routes/integrations/components/connect-forms/data-connection-fields.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/data-connection-fields.js +88 -0
- package/dist/routes/integrations/components/connect-forms/google-ads-account-tree.d.ts +11 -0
- package/dist/routes/integrations/components/connect-forms/google-ads-account-tree.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/google-ads-account-tree.js +36 -0
- package/dist/routes/integrations/components/connect-forms/google-analytics-property-tree.d.ts +6 -0
- package/dist/routes/integrations/components/connect-forms/google-analytics-property-tree.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/google-analytics-property-tree.js +34 -0
- package/dist/routes/integrations/components/connect-forms/oauth-setup-phase.d.ts +12 -0
- package/dist/routes/integrations/components/connect-forms/oauth-setup-phase.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/oauth-setup-phase.js +33 -0
- package/dist/routes/integrations/components/connect-forms/setup-account-unavailable-reason.d.ts +3 -0
- package/dist/routes/integrations/components/connect-forms/setup-account-unavailable-reason.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/setup-account-unavailable-reason.js +8 -0
- package/dist/routes/integrations/components/connect-forms/types.d.ts +5 -1
- package/dist/routes/integrations/components/connect-forms/types.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/useConnectWizard.d.ts +19 -0
- package/dist/routes/integrations/components/connect-forms/useConnectWizard.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/useConnectWizard.js +28 -0
- package/dist/routes/integrations/components/connect-forms/useConnectedExternalIds.d.ts +4 -0
- package/dist/routes/integrations/components/connect-forms/useConnectedExternalIds.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/useConnectedExternalIds.js +17 -0
- package/dist/routes/integrations/components/connect-forms/useWindowFocusPoll.d.ts +7 -0
- package/dist/routes/integrations/components/connect-forms/useWindowFocusPoll.d.ts.map +1 -0
- package/dist/routes/integrations/components/connect-forms/useWindowFocusPoll.js +18 -0
- package/dist/routes/integrations/connect-forms.d.ts +16 -0
- package/dist/routes/integrations/connect-forms.d.ts.map +1 -0
- package/dist/routes/integrations/connect-forms.js +14 -0
- package/dist/routes/integrations/filter-connected-providers.d.ts +3 -0
- package/dist/routes/integrations/filter-connected-providers.d.ts.map +1 -0
- package/dist/routes/integrations/filter-connected-providers.js +15 -0
- package/dist/routes/integrations/overview.d.ts +3 -0
- package/dist/routes/integrations/overview.d.ts.map +1 -0
- package/dist/routes/integrations/overview.js +2 -0
- package/dist/routes/integrations/use-connected-account-entities.d.ts +10 -0
- package/dist/routes/integrations/use-connected-account-entities.d.ts.map +1 -0
- package/dist/routes/integrations/use-connected-account-entities.js +29 -0
- package/dist/routes/memories/components/EmptyStates.d.ts.map +1 -1
- package/dist/routes/memories/components/EmptyStates.js +2 -1
- package/dist/routes/plans/components/actionPlansTableConfig.d.ts +12 -12
- package/package.json +47 -8
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type InferalCredentialFormConfig } from "./InferalCredentialConnectForm.js";
|
|
2
|
+
import type { ConnectFormProps } from "./types.js";
|
|
3
|
+
export declare const woocommerceConfig: InferalCredentialFormConfig<"sourceUrl" | "consumerKey" | "consumerSecret">;
|
|
4
|
+
export declare function WoocommerceConnectForm(props: ConnectFormProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=WoocommerceConnectForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WoocommerceConnectForm.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/WoocommerceConnectForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAChH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,iBAAiB,EAAE,2BAA2B,CAAC,WAAW,GAAG,aAAa,GAAG,gBAAgB,CAwCzG,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,2CAE7D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ensureProtocol } from "@manta-eu/lib/url";
|
|
3
|
+
import { InferalCredentialConnectForm } from "./InferalCredentialConnectForm.js";
|
|
4
|
+
export const woocommerceConfig = {
|
|
5
|
+
providerName: "WooCommerce",
|
|
6
|
+
fieldIdPrefix: "woocommerce",
|
|
7
|
+
identifier: {
|
|
8
|
+
key: "sourceUrl",
|
|
9
|
+
label: "Site URL",
|
|
10
|
+
placeholder: "https://shop.example.com",
|
|
11
|
+
requiredMessage: "Site URL is required",
|
|
12
|
+
stepTitle: "Point Manta at your WooCommerce store",
|
|
13
|
+
stepDescription: "We use your site URL to identify which store this integration belongs to.",
|
|
14
|
+
},
|
|
15
|
+
secrets: {
|
|
16
|
+
title: "Generate a REST API key pair",
|
|
17
|
+
description: "Manta needs Read / Write access to sync orders, customers, and products from your WooCommerce store.",
|
|
18
|
+
fields: [
|
|
19
|
+
{
|
|
20
|
+
key: "consumerKey",
|
|
21
|
+
label: "Consumer key",
|
|
22
|
+
placeholder: "ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
23
|
+
requiredMessage: "Consumer key is required",
|
|
24
|
+
secret: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "consumerSecret",
|
|
28
|
+
label: "Consumer secret",
|
|
29
|
+
placeholder: "cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
30
|
+
requiredMessage: "Consumer secret is required",
|
|
31
|
+
secret: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
streamNamePlaceholder: "woocommerce-shopexamplecom",
|
|
36
|
+
locationStepDescription: "Pick the region closest to your store for the lowest latency.",
|
|
37
|
+
buildProviderInput: (credentials) => ({
|
|
38
|
+
woocommerce: {
|
|
39
|
+
sourceUrl: ensureProtocol(credentials.sourceUrl),
|
|
40
|
+
consumerKey: credentials.consumerKey,
|
|
41
|
+
consumerSecret: credentials.consumerSecret,
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
export function WoocommerceConnectForm(props) {
|
|
46
|
+
return _jsx(InferalCredentialConnectForm, { ...props, config: woocommerceConfig });
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DataConnectorType } from "../../types.js";
|
|
2
|
+
import type { ConnectorField } from "./data-connection-fields.js";
|
|
3
|
+
export type ConnectionStringResult = {
|
|
4
|
+
ok: true;
|
|
5
|
+
values: Record<string, string>;
|
|
6
|
+
notice?: string;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function acceptsConnectionString(connectorType: string): connectorType is DataConnectorType;
|
|
12
|
+
export declare function connectionStringValues(connectorType: string, input: string, fields: readonly ConnectorField[]): ConnectionStringResult;
|
|
13
|
+
//# sourceMappingURL=connection-string-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-string-fields.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/connection-string-fields.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAC9B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAYjC,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,IAAI,iBAAiB,CAEjG;AAED,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,cAAc,EAAE,GAChC,sBAAsB,CAiBxB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { parseConnectionString, unescapeBracedValue } from "@manta-eu/lib/connection-string";
|
|
2
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
+
export function acceptsConnectionString(connectorType) {
|
|
4
|
+
return Object.hasOwn(formats, connectorType);
|
|
5
|
+
}
|
|
6
|
+
export function connectionStringValues(connectorType, input, fields) {
|
|
7
|
+
if (!acceptsConnectionString(connectorType)) {
|
|
8
|
+
return { ok: false, error: "This connector does not accept a connection string." };
|
|
9
|
+
}
|
|
10
|
+
const format = formats[connectorType];
|
|
11
|
+
const parsed = parseConnectionString(input, { semicolonProperties: format.semicolonProperties });
|
|
12
|
+
if (!parsed)
|
|
13
|
+
return { ok: false, error: unreadableError(connectorType, input, format.schemes) };
|
|
14
|
+
if (!format.schemes.includes(parsed.scheme))
|
|
15
|
+
return { ok: false, error: schemeHint(format.schemes) };
|
|
16
|
+
const mapped = format.toValues(parsed);
|
|
17
|
+
if ("error" in mapped)
|
|
18
|
+
return { ok: false, error: mapped.error };
|
|
19
|
+
const values = formValues(mapped.values, fields);
|
|
20
|
+
if (!isPresent(values))
|
|
21
|
+
return { ok: false, error: "The connection string holds no value for this form." };
|
|
22
|
+
return mapped.notice ? { ok: true, values, notice: mapped.notice } : { ok: true, values };
|
|
23
|
+
}
|
|
24
|
+
const formats = {
|
|
25
|
+
postgres: urlFormat("postgres", "postgresql"),
|
|
26
|
+
redshift: urlFormat("redshift", "postgres", "postgresql"),
|
|
27
|
+
mysql: urlFormat("mysql", "mariadb"),
|
|
28
|
+
mariadb: urlFormat("mariadb", "mysql"),
|
|
29
|
+
clickhouse: urlFormat("clickhouse"),
|
|
30
|
+
snowflake: { schemes: ["snowflake"], toValues: snowflakeValues },
|
|
31
|
+
sqlserver: { schemes: ["sqlserver", "mssql"], semicolonProperties: true, toValues: sqlServerValues },
|
|
32
|
+
bigquery: { schemes: ["bigquery"], semicolonProperties: true, toValues: bigQueryValues },
|
|
33
|
+
};
|
|
34
|
+
function urlFormat(...schemes) {
|
|
35
|
+
return { schemes, toValues: (parsed) => ({ values: urlValues(parsed) }) };
|
|
36
|
+
}
|
|
37
|
+
function urlValues(parsed) {
|
|
38
|
+
const { host, port, username, password, path, params } = parsed;
|
|
39
|
+
return { ...lowerCaseNames(params), host, port, username, password, database: path[0] };
|
|
40
|
+
}
|
|
41
|
+
function lowerCaseNames(params) {
|
|
42
|
+
return Object.fromEntries(Object.entries(params).map(([name, value]) => [name.toLowerCase(), value]));
|
|
43
|
+
}
|
|
44
|
+
function snowflakeValues(parsed) {
|
|
45
|
+
return { values: { ...urlValues(parsed), schema: parsed.path[1] } };
|
|
46
|
+
}
|
|
47
|
+
const namedInstanceError = "Use host:port or ;instanceName= instead of host\\instance.";
|
|
48
|
+
function sqlServerValues(parsed) {
|
|
49
|
+
const read = sqlServerPropertyReader(parsed.params);
|
|
50
|
+
const host = parsed.host ?? read("serverName");
|
|
51
|
+
if (host?.includes("\\"))
|
|
52
|
+
return { error: namedInstanceError };
|
|
53
|
+
const port = parsed.port ?? read("portNumber", "port");
|
|
54
|
+
return {
|
|
55
|
+
values: {
|
|
56
|
+
host,
|
|
57
|
+
port,
|
|
58
|
+
instance: isPresent(port) ? undefined : read("instanceName"),
|
|
59
|
+
username: parsed.username ?? read("user", "userName"),
|
|
60
|
+
password: parsed.password ?? read("password"),
|
|
61
|
+
database: parsed.path[0] ?? read("databaseName", "database"),
|
|
62
|
+
encrypt: booleanValue(read("encrypt")),
|
|
63
|
+
trust_server_certificate: booleanValue(read("trustServerCertificate")),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function sqlServerPropertyReader(params) {
|
|
68
|
+
const read = propertyReader(params);
|
|
69
|
+
return (...names) => {
|
|
70
|
+
const value = read(...names);
|
|
71
|
+
return value === undefined ? undefined : unescapeBracedValue(value);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// JDBC property names are case-insensitive, so the lookup lowers the case of each name.
|
|
75
|
+
function propertyReader(params) {
|
|
76
|
+
const valueByName = new Map(Object.entries(lowerCaseNames(params)));
|
|
77
|
+
return (...names) => names.map((name) => valueByName.get(name.toLowerCase())).find(isPresent);
|
|
78
|
+
}
|
|
79
|
+
function booleanValue(value) {
|
|
80
|
+
const lowered = value?.toLowerCase();
|
|
81
|
+
return lowered === "true" || lowered === "false" ? lowered : undefined;
|
|
82
|
+
}
|
|
83
|
+
const keyFileNotice = "Paste the service account key into the key field. The browser cannot read a key file.";
|
|
84
|
+
function bigQueryValues(parsed) {
|
|
85
|
+
const read = propertyReader(parsed.params);
|
|
86
|
+
const key = read("OAuthPvtKey");
|
|
87
|
+
const inlineKey = key?.trimStart().startsWith("{") ? key : undefined;
|
|
88
|
+
const pointsToKeyFile = isPresent(read("OAuthPvtKeyPath")) || (isPresent(key) && inlineKey === undefined);
|
|
89
|
+
return {
|
|
90
|
+
values: {
|
|
91
|
+
project: read("ProjectId"),
|
|
92
|
+
dataset: read("DefaultDataset"),
|
|
93
|
+
location: read("Location"),
|
|
94
|
+
key_body: inlineKey,
|
|
95
|
+
},
|
|
96
|
+
notice: pointsToKeyFile ? keyFileNotice : undefined,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function unreadableError(connectorType, input, schemes) {
|
|
100
|
+
return connectorType === "sqlserver" && input.includes("\\") ? namedInstanceError : schemeHint(schemes);
|
|
101
|
+
}
|
|
102
|
+
function schemeHint(schemes) {
|
|
103
|
+
return `Paste a ${schemes.map((scheme) => `${scheme}://`).join(" or ")} connection string.`;
|
|
104
|
+
}
|
|
105
|
+
function formValues(values, fields) {
|
|
106
|
+
return Object.fromEntries(fields.flatMap((field) => {
|
|
107
|
+
const value = values[field.key];
|
|
108
|
+
return isPresent(value) ? [[field.key, value]] : [];
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TreeNode, type TreeSelectItem } from "#components/tree-multi-select/index";
|
|
2
|
+
export type DashFolder = TreeNode & {
|
|
3
|
+
position?: number | null;
|
|
4
|
+
};
|
|
5
|
+
export declare function dashFolderTreeItems(folders: DashFolder[]): TreeSelectItem[];
|
|
6
|
+
//# sourceMappingURL=dash-folder-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dash-folder-tree.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/dash-folder-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAEtH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAQjE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,cAAc,EAAE,CAO3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buildTreeRows, compareNodes } from "#components/tree-multi-select/index";
|
|
2
|
+
// Siblings in Dash's own order; a folder without a position goes last.
|
|
3
|
+
function compareFolders(a, b) {
|
|
4
|
+
const unpositioned = Number.MAX_SAFE_INTEGER;
|
|
5
|
+
return (a.position ?? unpositioned) - (b.position ?? unpositioned) || compareNodes(a, b);
|
|
6
|
+
}
|
|
7
|
+
export function dashFolderTreeItems(folders) {
|
|
8
|
+
return buildTreeRows(folders, compareFolders).map(({ node, depth }) => ({
|
|
9
|
+
id: node.id,
|
|
10
|
+
label: node.name ?? node.id,
|
|
11
|
+
selectable: true,
|
|
12
|
+
depth,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type GQLDataConnectorTypesQuery } from "@manta-eu/client";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export type ConnectorField = GQLDataConnectorTypesQuery["dataConnectorTypes"][number]["fields"][number];
|
|
4
|
+
export declare const nameKey = "connectionName";
|
|
5
|
+
export type DataConnectionValues = {
|
|
6
|
+
[nameKey]: string;
|
|
7
|
+
[setting: string]: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const nameSchema: z.ZodString;
|
|
10
|
+
export declare function choices(field: ConnectorField): string[] | undefined;
|
|
11
|
+
export declare function settingsSchema(fields: readonly ConnectorField[]): z.ZodObject<{
|
|
12
|
+
[x: string]: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare function formSchema(fields: readonly ConnectorField[]): z.ZodType<DataConnectionValues, DataConnectionValues>;
|
|
15
|
+
export declare function pickSettings(values: DataConnectionValues, fields: readonly ConnectorField[]): {
|
|
16
|
+
key: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
export declare function blankValues(fields: readonly ConnectorField[]): DataConnectionValues;
|
|
20
|
+
export type DataConnectionSetting = {
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
export type StoredDataConnection = {
|
|
25
|
+
name: string;
|
|
26
|
+
settings: readonly DataConnectionSetting[];
|
|
27
|
+
candidateSettings?: readonly DataConnectionSetting[] | null;
|
|
28
|
+
error?: string | null;
|
|
29
|
+
};
|
|
30
|
+
export declare function editableFields(fields: readonly ConnectorField[]): ConnectorField[];
|
|
31
|
+
export declare function storedValues(stored: StoredDataConnection, fields: readonly ConnectorField[]): DataConnectionValues;
|
|
32
|
+
export declare function changedSettings(values: DataConnectionValues, fields: readonly ConnectorField[], stored: StoredDataConnection): DataConnectionSetting[];
|
|
33
|
+
export declare function isCloudSqlField(field: ConnectorField): boolean;
|
|
34
|
+
export declare function hasCustomValue(values: Partial<DataConnectionValues>, fields: readonly ConnectorField[]): boolean;
|
|
35
|
+
//# sourceMappingURL=data-connection-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-connection-fields.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/data-connection-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,cAAc,GAAG,0BAA0B,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAExG,eAAO,MAAM,OAAO,mBAAmB,CAAC;AAGxC,MAAM,MAAM,oBAAoB,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEpF,eAAO,MAAM,UAAU,aAAiF,CAAC;AAQzG,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,EAAE,GAAG,SAAS,CAInE;AAaD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE;;kBAE/D;AAGD,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAKnH;AAGD,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,SAAS,cAAc,EAAE;;;IAK3F;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,oBAAoB,CAEnF;AAED,MAAM,MAAM,qBAAqB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C,iBAAiB,CAAC,EAAE,SAAS,qBAAqB,EAAE,GAAG,IAAI,CAAC;IAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAQF,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,cAAc,EAAE,CAElF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,oBAAoB,CAOlH;AAgBD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,SAAS,cAAc,EAAE,EACjC,MAAM,EAAE,oBAAoB,GAC3B,qBAAqB,EAAE,CAWzB;AAID,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAE9D;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAKhH"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { GQLDataConnectorFieldType } from "@manta-eu/client";
|
|
2
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export const nameKey = "connectionName";
|
|
5
|
+
export const nameSchema = z.string().trim().min(1, "Name is required").max(64, "64 characters or fewer");
|
|
6
|
+
const valuePatterns = {
|
|
7
|
+
[GQLDataConnectorFieldType.Integer]: { pattern: /^-?\d+$/, message: "Enter a whole number" },
|
|
8
|
+
[GQLDataConnectorFieldType.Decimal]: { pattern: /^-?\d+(\.\d+)?$/, message: "Enter a number" },
|
|
9
|
+
[GQLDataConnectorFieldType.Boolean]: { pattern: /^(true|false)$/, message: "Choose true or false" },
|
|
10
|
+
};
|
|
11
|
+
export function choices(field) {
|
|
12
|
+
if (isPresent(field.enum))
|
|
13
|
+
return field.enum;
|
|
14
|
+
if (field.dataType === GQLDataConnectorFieldType.Boolean)
|
|
15
|
+
return ["true", "false"];
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
function fieldSchema(field) {
|
|
19
|
+
const base = z.string().trim();
|
|
20
|
+
const value = field.required ? base.min(1, `${field.title} is required`) : base;
|
|
21
|
+
const allowed = choices(field);
|
|
22
|
+
const format = valuePatterns[field.dataType];
|
|
23
|
+
return value
|
|
24
|
+
.refine((text) => !isPresent(text) || !allowed || allowed.includes(text), "Choose one of the listed values")
|
|
25
|
+
.refine((text) => !isPresent(text) || !format || format.pattern.test(text), format?.message);
|
|
26
|
+
}
|
|
27
|
+
export function settingsSchema(fields) {
|
|
28
|
+
return z.object(Object.fromEntries(fields.map((field) => [field.key, fieldSchema(field)])));
|
|
29
|
+
}
|
|
30
|
+
// The fields come at runtime, so the built schema has no static output type to infer.
|
|
31
|
+
export function formSchema(fields) {
|
|
32
|
+
return settingsSchema(fields).extend({ [nameKey]: nameSchema });
|
|
33
|
+
}
|
|
34
|
+
// A blank optional field is left out, so manta-clj applies the default of the connector.
|
|
35
|
+
export function pickSettings(values, fields) {
|
|
36
|
+
return fields.flatMap((field) => {
|
|
37
|
+
const value = values[field.key]?.trim() ?? "";
|
|
38
|
+
return isPresent(value) ? [{ key: field.key, value }] : [];
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function blankValues(fields) {
|
|
42
|
+
return { ...Object.fromEntries(fields.map((field) => [field.key, ""])), [nameKey]: "" };
|
|
43
|
+
}
|
|
44
|
+
// A change that waits for its test, or that failed it, is what the caller last typed.
|
|
45
|
+
function latestValueByKey(stored) {
|
|
46
|
+
const latest = stored.candidateSettings ?? stored.settings;
|
|
47
|
+
return new Map(latest.map(({ key, value }) => [key, value]));
|
|
48
|
+
}
|
|
49
|
+
export function editableFields(fields) {
|
|
50
|
+
return fields.map((field) => (field.secret ? { ...field, required: false } : field));
|
|
51
|
+
}
|
|
52
|
+
export function storedValues(stored, fields) {
|
|
53
|
+
const storedByKey = latestValueByKey(stored);
|
|
54
|
+
return {
|
|
55
|
+
...Object.fromEntries(fields.map((field) => [field.key, field.secret ? "" : (storedByKey.get(field.key) ?? "")])),
|
|
56
|
+
[nameKey]: stored.name,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// manta-clj gives a setting with an empty value its connector default again.
|
|
60
|
+
function clearedSettings(settings, fields, storedByKey) {
|
|
61
|
+
const sentKeys = new Set(settings.map(({ key }) => key));
|
|
62
|
+
return fields
|
|
63
|
+
.filter((field) => !field.secret && storedByKey.has(field.key) && !sentKeys.has(field.key))
|
|
64
|
+
.map((field) => ({ key: field.key, value: "" }));
|
|
65
|
+
}
|
|
66
|
+
// An empty list only renames the connection, so manta-clj starts no new test.
|
|
67
|
+
// After a failed test, the same settings go again, because only a passed test clears the error.
|
|
68
|
+
export function changedSettings(values, fields, stored) {
|
|
69
|
+
const storedByKey = latestValueByKey(stored);
|
|
70
|
+
const settings = pickSettings(values, fields);
|
|
71
|
+
const cleared = clearedSettings(settings, fields, storedByKey);
|
|
72
|
+
if (isPresent(stored.error))
|
|
73
|
+
return [...settings, ...cleared];
|
|
74
|
+
const secretKeys = new Set(fields.filter((field) => field.secret).map((field) => field.key));
|
|
75
|
+
const changed = isPresent(cleared) || settings.some(({ key, value }) => secretKeys.has(key) || storedByKey.get(key) !== value);
|
|
76
|
+
return changed ? [...settings, ...cleared] : [];
|
|
77
|
+
}
|
|
78
|
+
const cloudSqlPrefix = "gcp_";
|
|
79
|
+
export function isCloudSqlField(field) {
|
|
80
|
+
return field.key.startsWith(cloudSqlPrefix);
|
|
81
|
+
}
|
|
82
|
+
// A value equal to the connector default counts as unset, because a stored boolean holds its default.
|
|
83
|
+
export function hasCustomValue(values, fields) {
|
|
84
|
+
return fields.some((field) => {
|
|
85
|
+
const value = values[field.key]?.trim() ?? "";
|
|
86
|
+
return isPresent(value) && value !== (field.default ?? "");
|
|
87
|
+
});
|
|
88
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GQLGoogleAdAccount } from "@manta-eu/client";
|
|
2
|
+
import { type TreeSelectItem } from "#components/tree-multi-select/index";
|
|
3
|
+
export type GoogleAdsAccountRow = {
|
|
4
|
+
account: GQLGoogleAdAccount;
|
|
5
|
+
depth: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function isManagerAccount(account: GQLGoogleAdAccount): boolean;
|
|
8
|
+
export declare function isConnectable(account: GQLGoogleAdAccount): boolean;
|
|
9
|
+
export declare function buildAccountRows(accounts: GQLGoogleAdAccount[]): GoogleAdsAccountRow[];
|
|
10
|
+
export declare function googleAdsTreeItems(accounts: GQLGoogleAdAccount[], alreadyConnectedExternalIds: ReadonlySet<string>, reconnectableExternalIds?: ReadonlySet<string>): TreeSelectItem[];
|
|
11
|
+
//# sourceMappingURL=google-ads-account-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-ads-account-tree.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/google-ads-account-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAEzF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAErE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAElE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,mBAAmB,EAAE,CAEtF;AAcD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,EAChD,wBAAwB,GAAE,WAAW,CAAC,MAAM,CAAa,GACxD,cAAc,EAAE,CAclB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { buildTreeRows } from "#components/tree-multi-select/index";
|
|
2
|
+
export function isManagerAccount(account) {
|
|
3
|
+
return account.manager === true;
|
|
4
|
+
}
|
|
5
|
+
export function isConnectable(account) {
|
|
6
|
+
return account.connectable === true;
|
|
7
|
+
}
|
|
8
|
+
export function buildAccountRows(accounts) {
|
|
9
|
+
return buildTreeRows(accounts).map(({ node, depth }) => ({ account: node, depth }));
|
|
10
|
+
}
|
|
11
|
+
function accountHint(account, alreadyConnected, reconnectable) {
|
|
12
|
+
if (isManagerAccount(account))
|
|
13
|
+
return "Manager";
|
|
14
|
+
if (!isConnectable(account))
|
|
15
|
+
return "Unavailable";
|
|
16
|
+
if (reconnectable)
|
|
17
|
+
return "Reconnect";
|
|
18
|
+
if (alreadyConnected)
|
|
19
|
+
return "Already connected";
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
export function googleAdsTreeItems(accounts, alreadyConnectedExternalIds, reconnectableExternalIds = new Set()) {
|
|
23
|
+
return buildAccountRows(accounts).map(({ account, depth }) => {
|
|
24
|
+
const reconnectable = reconnectableExternalIds.has(account.id);
|
|
25
|
+
const alreadyConnected = !reconnectable && alreadyConnectedExternalIds.has(account.id);
|
|
26
|
+
return {
|
|
27
|
+
id: account.id,
|
|
28
|
+
label: account.name ?? account.id,
|
|
29
|
+
caption: account.name != null ? account.id : undefined,
|
|
30
|
+
hint: accountHint(account, alreadyConnected, reconnectable),
|
|
31
|
+
selectable: isConnectable(account),
|
|
32
|
+
disabled: alreadyConnected,
|
|
33
|
+
depth,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GQLGoogleAnalyticsProperty } from "@manta-eu/client";
|
|
2
|
+
import { type TreeSelectItem } from "#components/tree-multi-select/index";
|
|
3
|
+
export declare function isAccount(row: GQLGoogleAnalyticsProperty): boolean;
|
|
4
|
+
export declare function isConnectable(row: GQLGoogleAnalyticsProperty): boolean;
|
|
5
|
+
export declare function googleAnalyticsTreeItems(rows: GQLGoogleAnalyticsProperty[], alreadyConnectedExternalIds: ReadonlySet<string>, reconnectableExternalIds?: ReadonlySet<string>): TreeSelectItem[];
|
|
6
|
+
//# sourceMappingURL=google-analytics-property-tree.d.ts.map
|
package/dist/routes/integrations/components/connect-forms/google-analytics-property-tree.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-analytics-property-tree.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/google-analytics-property-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAEzF,wBAAgB,SAAS,CAAC,GAAG,EAAE,0BAA0B,GAAG,OAAO,CAElE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,0BAA0B,GAAG,OAAO,CAEtE;AAcD,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,0BAA0B,EAAE,EAClC,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,EAChD,wBAAwB,GAAE,WAAW,CAAC,MAAM,CAAa,GACxD,cAAc,EAAE,CAelB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
2
|
+
import { buildTreeRows } from "#components/tree-multi-select/index";
|
|
3
|
+
export function isAccount(row) {
|
|
4
|
+
return row.account === true;
|
|
5
|
+
}
|
|
6
|
+
export function isConnectable(row) {
|
|
7
|
+
return row.connectable === true;
|
|
8
|
+
}
|
|
9
|
+
function rowHint(row, alreadyConnected, reconnectable) {
|
|
10
|
+
if (isAccount(row))
|
|
11
|
+
return "Account";
|
|
12
|
+
if (!isConnectable(row))
|
|
13
|
+
return "Unavailable";
|
|
14
|
+
if (reconnectable)
|
|
15
|
+
return "Reconnect";
|
|
16
|
+
if (alreadyConnected)
|
|
17
|
+
return "Already connected";
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
export function googleAnalyticsTreeItems(rows, alreadyConnectedExternalIds, reconnectableExternalIds = new Set()) {
|
|
21
|
+
return buildTreeRows(rows).map(({ node, depth }) => {
|
|
22
|
+
const reconnectable = isPresent(node.externalId) && reconnectableExternalIds.has(node.externalId);
|
|
23
|
+
const alreadyConnected = !reconnectable && isPresent(node.externalId) && alreadyConnectedExternalIds.has(node.externalId);
|
|
24
|
+
return {
|
|
25
|
+
id: node.id,
|
|
26
|
+
label: node.name ?? node.id,
|
|
27
|
+
caption: node.name != null ? node.id : undefined,
|
|
28
|
+
hint: rowHint(node, alreadyConnected, reconnectable),
|
|
29
|
+
selectable: isConnectable(node),
|
|
30
|
+
disabled: alreadyConnected,
|
|
31
|
+
depth,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GQLGoogleSetupStateEnum } from "@manta-eu/client";
|
|
2
|
+
export type Phase = "idle" | "awaitingOAuth" | "loadingAccounts" | "pickingAccount" | "submitting" | "done" | "failed";
|
|
3
|
+
export type DerivePhaseInput = {
|
|
4
|
+
states: GQLGoogleSetupStateEnum[] | undefined;
|
|
5
|
+
hasStartedOAuth: boolean;
|
|
6
|
+
hasSeenActiveState: boolean;
|
|
7
|
+
resumesUnfinishedSetup?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const terminalStates: readonly GQLGoogleSetupStateEnum[];
|
|
10
|
+
export declare const activePhases: readonly Phase[];
|
|
11
|
+
export declare function derivePhase({ states, hasStartedOAuth, hasSeenActiveState, resumesUnfinishedSetup, }: DerivePhaseInput): Phase;
|
|
12
|
+
//# sourceMappingURL=oauth-setup-phase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-setup-phase.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/oauth-setup-phase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAG3D,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,eAAe,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,uBAAuB,EAAE,GAAG,SAAS,CAAC;IAC9C,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,OAAO,CAAC;IAE5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAYF,eAAO,MAAM,cAAc,EAAE,SAAS,uBAAuB,EAI5D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAAS,KAAK,EAAyE,CAAC;AAEnH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,sBAA6B,GAC9B,EAAE,gBAAgB,GAAG,KAAK,CAa1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { GQLGoogleSetupStateEnum } from "@manta-eu/client";
|
|
2
|
+
import { match } from "ts-pattern";
|
|
3
|
+
const statePriority = [
|
|
4
|
+
GQLGoogleSetupStateEnum.Finished,
|
|
5
|
+
GQLGoogleSetupStateEnum.FatallyFailed,
|
|
6
|
+
GQLGoogleSetupStateEnum.TimedOut,
|
|
7
|
+
GQLGoogleSetupStateEnum.ConnectingAccounts,
|
|
8
|
+
GQLGoogleSetupStateEnum.SelectingAccounts,
|
|
9
|
+
GQLGoogleSetupStateEnum.FetchingAccounts,
|
|
10
|
+
GQLGoogleSetupStateEnum.Initializing,
|
|
11
|
+
];
|
|
12
|
+
export const terminalStates = [
|
|
13
|
+
GQLGoogleSetupStateEnum.Finished,
|
|
14
|
+
GQLGoogleSetupStateEnum.FatallyFailed,
|
|
15
|
+
GQLGoogleSetupStateEnum.TimedOut,
|
|
16
|
+
];
|
|
17
|
+
export const activePhases = ["awaitingOAuth", "loadingAccounts", "pickingAccount", "submitting"];
|
|
18
|
+
export function derivePhase({ states, hasStartedOAuth, hasSeenActiveState, resumesUnfinishedSetup = true, }) {
|
|
19
|
+
const defaultPhase = hasStartedOAuth ? "awaitingOAuth" : "idle";
|
|
20
|
+
if (!hasStartedOAuth && !resumesUnfinishedSetup)
|
|
21
|
+
return defaultPhase;
|
|
22
|
+
const dominant = statePriority.find((state) => states?.includes(state));
|
|
23
|
+
if (dominant && terminalStates.includes(dominant) && !hasSeenActiveState)
|
|
24
|
+
return defaultPhase;
|
|
25
|
+
return match(dominant)
|
|
26
|
+
.returnType()
|
|
27
|
+
.with(GQLGoogleSetupStateEnum.Finished, () => "done")
|
|
28
|
+
.with(GQLGoogleSetupStateEnum.FatallyFailed, GQLGoogleSetupStateEnum.TimedOut, () => "failed")
|
|
29
|
+
.with(GQLGoogleSetupStateEnum.ConnectingAccounts, () => "submitting")
|
|
30
|
+
.with(GQLGoogleSetupStateEnum.SelectingAccounts, () => "pickingAccount")
|
|
31
|
+
.with(GQLGoogleSetupStateEnum.FetchingAccounts, GQLGoogleSetupStateEnum.Initializing, () => "loadingAccounts")
|
|
32
|
+
.otherwise(() => defaultPhase);
|
|
33
|
+
}
|
package/dist/routes/integrations/components/connect-forms/setup-account-unavailable-reason.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-account-unavailable-reason.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/setup-account-unavailable-reason.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAOpE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gCAAgC,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE1G"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GQLSetupAccountUnavailableReason } from "@manta-eu/client";
|
|
2
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
+
const unavailableReasonLabels = {
|
|
4
|
+
[GQLSetupAccountUnavailableReason.InsufficientPermissions]: "Insufficient permissions",
|
|
5
|
+
};
|
|
6
|
+
export function unavailableReasonLabel(reason) {
|
|
7
|
+
return isPresent(reason) ? unavailableReasonLabels[reason] : "Unavailable";
|
|
8
|
+
}
|
|
@@ -2,8 +2,8 @@ import type { GQLInferalLocation } from "@manta-eu/client";
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { FieldValues, UseFormReturn } from "react-hook-form";
|
|
4
4
|
import type { z } from "zod";
|
|
5
|
+
import type { ProviderPresentation } from "../../types.js";
|
|
5
6
|
import type { FieldInstruction } from "./FieldInstructions.js";
|
|
6
|
-
import type { ProviderPresentation } from "#routes/integrations/types";
|
|
7
7
|
export type ProviderSetupInstructions = Readonly<{
|
|
8
8
|
identifier?: FieldInstruction;
|
|
9
9
|
apiKey?: FieldInstruction;
|
|
@@ -14,6 +14,9 @@ export type InferalConnectFormConfig = {
|
|
|
14
14
|
deriveStreamName: (identifier: string) => string;
|
|
15
15
|
locationLabels: Readonly<Record<GQLInferalLocation, string>>;
|
|
16
16
|
};
|
|
17
|
+
export type ImportNotice = {
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
17
20
|
export type ConnectFormProps = {
|
|
18
21
|
provider: ProviderPresentation<string>;
|
|
19
22
|
inferalConfig?: InferalConnectFormConfig;
|
|
@@ -22,6 +25,7 @@ export type ConnectFormProps = {
|
|
|
22
25
|
onChanged: () => void;
|
|
23
26
|
onDismiss: () => void;
|
|
24
27
|
resumedFromOAuth?: boolean;
|
|
28
|
+
importNotice?: ImportNotice;
|
|
25
29
|
};
|
|
26
30
|
export type StepConfig<Values extends FieldValues> = {
|
|
27
31
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG;IACrC,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,WAAW,IAAI;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;CACpD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FieldValues, UseFormReturn } from "react-hook-form";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { StepConfig } from "./types.js";
|
|
4
|
+
type UseConnectWizardArgs<Values extends FieldValues> = {
|
|
5
|
+
steps: StepConfig<Values>[];
|
|
6
|
+
form: UseFormReturn<Values>;
|
|
7
|
+
fullSchema: z.ZodTypeAny;
|
|
8
|
+
onSubmit: (values: Values) => void | Promise<void>;
|
|
9
|
+
onBack: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useConnectWizard<Values extends FieldValues>(args: UseConnectWizardArgs<Values>): {
|
|
12
|
+
stepIndex: number;
|
|
13
|
+
currentStep: StepConfig<Values>;
|
|
14
|
+
canAdvance: boolean;
|
|
15
|
+
handleContinue: () => void;
|
|
16
|
+
handleBack: () => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=useConnectWizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnectWizard.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/useConnectWizard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,KAAK,oBAAoB,CAAC,MAAM,SAAS,WAAW,IAAI;IACtD,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,MAAM,SAAS,WAAW,EAAE,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC;;;;;;EAiC9F"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
export function useConnectWizard(args) {
|
|
3
|
+
const { steps, form, fullSchema, onSubmit, onBack } = args;
|
|
4
|
+
const [stepIndex, setStepIndex] = useState(0);
|
|
5
|
+
const currentStep = steps[stepIndex];
|
|
6
|
+
if (!currentStep)
|
|
7
|
+
throw new Error(`Invalid step index: ${stepIndex}`);
|
|
8
|
+
const isLastStep = stepIndex === steps.length - 1;
|
|
9
|
+
const schemaToValidate = isLastStep ? fullSchema : currentStep.schema;
|
|
10
|
+
const canAdvance = schemaToValidate.safeParse(form.watch()).success;
|
|
11
|
+
function handleContinue() {
|
|
12
|
+
if (stepIndex < steps.length - 1) {
|
|
13
|
+
setStepIndex(stepIndex + 1);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!canAdvance)
|
|
17
|
+
return;
|
|
18
|
+
void form.handleSubmit(onSubmit)();
|
|
19
|
+
}
|
|
20
|
+
function handleBack() {
|
|
21
|
+
if (stepIndex > 0) {
|
|
22
|
+
setStepIndex(stepIndex - 1);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
onBack();
|
|
26
|
+
}
|
|
27
|
+
return { stepIndex, currentStep, canAdvance, handleContinue, handleBack };
|
|
28
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type GQLIntegration } from "@manta-eu/client";
|
|
2
|
+
export declare function useConnectedExternalIds(integration: GQLIntegration): ReadonlySet<string>;
|
|
3
|
+
export declare function useReconnectableExternalIds(integration: GQLIntegration): ReadonlySet<string>;
|
|
4
|
+
//# sourceMappingURL=useConnectedExternalIds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnectedExternalIds.d.ts","sourceRoot":"","sources":["../../../../../src/routes/integrations/components/connect-forms/useConnectedExternalIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlF,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,CAQxF;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,CAQ5F"}
|