Skip to content

Commit 9c2b86d

Browse files
authored
Reuse Clio components to all Clio apps (#17672)
* migrate components * pnpm-lock.yaml * pnpm-lock.yaml * pnpm-lock.yaml * fix app files
1 parent eccf8d3 commit 9c2b86d

File tree

28 files changed

+577
-21
lines changed

28 files changed

+577
-21
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../clio_australia.app.mjs";
2+
import common from "@pipedream/clio/actions/create-matter/create-matter.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "clio_australia-create-matter",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
app,
20+
...props,
21+
},
22+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../clio_australia.app.mjs";
2+
import common from "@pipedream/clio/actions/create-task/create-task.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "clio_australia-create-task",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
app,
20+
...props,
21+
},
22+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../clio_australia.app.mjs";
2+
import common from "@pipedream/clio/actions/update-matter/update-matter.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "clio_australia-update-matter",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
app,
20+
...props,
21+
},
22+
};
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
import clio from "@pipedream/clio";
2+
import constants from "@pipedream/clio/common/constants.mjs";
3+
14
export default {
5+
...clio,
26
type: "app",
37
app: "clio_australia",
4-
propDefinitions: {},
58
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
9+
...clio.methods,
10+
getUrl(path) {
11+
return `https://au.app.clio.com${constants.VERSION_PATH}${path}`;
912
},
1013
},
1114
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
export function adjustPropDefinitions(props, app) {
2+
return Object.fromEntries(
3+
Object.entries(props).map(([
4+
key,
5+
prop,
6+
]) => {
7+
if (typeof prop === "string") return [
8+
key,
9+
prop,
10+
];
11+
const {
12+
propDefinition, ...otherValues
13+
} = prop;
14+
if (propDefinition) {
15+
const [
16+
, ...otherDefs
17+
] = propDefinition;
18+
return [
19+
key,
20+
{
21+
propDefinition: [
22+
app,
23+
...otherDefs,
24+
],
25+
...otherValues,
26+
},
27+
];
28+
}
29+
return [
30+
key,
31+
otherValues.type === "app"
32+
? null
33+
: otherValues,
34+
];
35+
})
36+
.filter(([
37+
, value,
38+
]) => value),
39+
);
40+
}

components/clio_australia/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/clio_australia",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Clio - Australia Components",
55
"main": "clio_australia.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/clio": "^0.1.1"
1417
}
15-
}
18+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../clio_australia.app.mjs";
2+
import common from "@pipedream/clio/sources/bill-state-updated-instant/bill-state-updated-instant.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "clio_australia-bill-state-updated-instant",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
app,
20+
...props,
21+
},
22+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../clio_australia.app.mjs";
2+
import common from "@pipedream/clio/sources/new-activity-instant/new-activity-instant.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "clio_australia-new-activity-instant",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
app,
20+
...props,
21+
},
22+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../clio_australia.app.mjs";
2+
import common from "@pipedream/clio/sources/new-document-instant/new-document-instant.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "clio_australia-new-document-instant",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
app,
20+
...props,
21+
},
22+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../clio_canada.app.mjs";
2+
import common from "@pipedream/clio/actions/create-matter/create-matter.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "clio_canada-create-matter",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
app,
20+
...props,
21+
},
22+
};

0 commit comments

Comments
 (0)