@activepieces/piece-bigcommerce 0.0.1
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 +7 -0
- package/package.json +32 -0
- package/src/index.d.ts +5 -0
- package/src/index.js +74 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-a-product.d.ts +13 -0
- package/src/lib/actions/create-a-product.js +74 -0
- package/src/lib/actions/create-a-product.js.map +1 -0
- package/src/lib/actions/create-blog-post.d.ts +15 -0
- package/src/lib/actions/create-blog-post.js +80 -0
- package/src/lib/actions/create-blog-post.js.map +1 -0
- package/src/lib/actions/create-customer-address.d.ts +16 -0
- package/src/lib/actions/create-customer-address.js +78 -0
- package/src/lib/actions/create-customer-address.js.map +1 -0
- package/src/lib/actions/create-customer.d.ts +12 -0
- package/src/lib/actions/create-customer.js +63 -0
- package/src/lib/actions/create-customer.js.map +1 -0
- package/src/lib/actions/find-or-create-customer.d.ts +12 -0
- package/src/lib/actions/find-or-create-customer.js +75 -0
- package/src/lib/actions/find-or-create-customer.js.map +1 -0
- package/src/lib/actions/find-or-create-customers-address.d.ts +16 -0
- package/src/lib/actions/find-or-create-customers-address.js +93 -0
- package/src/lib/actions/find-or-create-customers-address.js.map +1 -0
- package/src/lib/actions/find-or-create-product.d.ts +13 -0
- package/src/lib/actions/find-or-create-product.js +77 -0
- package/src/lib/actions/find-or-create-product.js.map +1 -0
- package/src/lib/actions/search-customer-address.d.ts +8 -0
- package/src/lib/actions/search-customer-address.js +38 -0
- package/src/lib/actions/search-customer-address.js.map +1 -0
- package/src/lib/actions/search-customer.d.ts +9 -0
- package/src/lib/actions/search-customer.js +46 -0
- package/src/lib/actions/search-customer.js.map +1 -0
- package/src/lib/actions/search-product.d.ts +12 -0
- package/src/lib/actions/search-product.js +70 -0
- package/src/lib/actions/search-product.js.map +1 -0
- package/src/lib/common/auth.d.ts +5 -0
- package/src/lib/common/auth.js +48 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/constants.d.ts +10 -0
- package/src/lib/common/constants.js +14 -0
- package/src/lib/common/constants.js.map +1 -0
- package/src/lib/common/props.d.ts +6 -0
- package/src/lib/common/props.js +80 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/common/requests.d.ts +43 -0
- package/src/lib/common/requests.js +115 -0
- package/src/lib/common/requests.js.map +1 -0
- package/src/lib/triggers/abandoned-cart.d.ts +14 -0
- package/src/lib/triggers/abandoned-cart.js +61 -0
- package/src/lib/triggers/abandoned-cart.js.map +1 -0
- package/src/lib/triggers/cart-created.d.ts +14 -0
- package/src/lib/triggers/cart-created.js +63 -0
- package/src/lib/triggers/cart-created.js.map +1 -0
- package/src/lib/triggers/customer-address-created.d.ts +14 -0
- package/src/lib/triggers/customer-address-created.js +63 -0
- package/src/lib/triggers/customer-address-created.js.map +1 -0
- package/src/lib/triggers/customer-address-updated.d.ts +14 -0
- package/src/lib/triggers/customer-address-updated.js +63 -0
- package/src/lib/triggers/customer-address-updated.js.map +1 -0
- package/src/lib/triggers/customer-created.d.ts +14 -0
- package/src/lib/triggers/customer-created.js +65 -0
- package/src/lib/triggers/customer-created.js.map +1 -0
- package/src/lib/triggers/customer-updated.d.ts +14 -0
- package/src/lib/triggers/customer-updated.js +63 -0
- package/src/lib/triggers/customer-updated.js.map +1 -0
- package/src/lib/triggers/order-created.d.ts +14 -0
- package/src/lib/triggers/order-created.js +63 -0
- package/src/lib/triggers/order-created.js.map +1 -0
- package/src/lib/triggers/order-status-updated.d.ts +14 -0
- package/src/lib/triggers/order-status-updated.js +63 -0
- package/src/lib/triggers/order-status-updated.js.map +1 -0
- package/src/lib/triggers/order-updated.d.ts +14 -0
- package/src/lib/triggers/order-updated.js +63 -0
- package/src/lib/triggers/order-updated.js.map +1 -0
- package/src/lib/triggers/product-created.d.ts +14 -0
- package/src/lib/triggers/product-created.js +63 -0
- package/src/lib/triggers/product-created.js.map +1 -0
- package/src/lib/triggers/shipment-created.d.ts +14 -0
- package/src/lib/triggers/shipment-created.js +63 -0
- package/src/lib/triggers/shipment-created.js.map +1 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findOrCreateCustomersAddress = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
exports.findOrCreateCustomersAddress = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.bigcommerceAuth,
|
|
11
|
+
name: 'findOrCreateCustomersAddress',
|
|
12
|
+
displayName: 'Find or Create Customer’s Address',
|
|
13
|
+
description: 'Finds or creates a customer’s address',
|
|
14
|
+
props: {
|
|
15
|
+
customer_id: (0, props_1.customerDropdown)({
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
first_name: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'First Name',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
last_name: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Last Name',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
address1: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Address Line 1',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
address2: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Address Line 2',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
city: pieces_framework_1.Property.ShortText({
|
|
35
|
+
displayName: 'City',
|
|
36
|
+
required: true,
|
|
37
|
+
}),
|
|
38
|
+
state_or_province: pieces_framework_1.Property.ShortText({
|
|
39
|
+
displayName: 'State/Province',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
postal_code: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Postal Code',
|
|
44
|
+
required: true,
|
|
45
|
+
}),
|
|
46
|
+
country_code: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'Country Code',
|
|
48
|
+
description: 'ISO 3166-1 alpha-2 country code',
|
|
49
|
+
required: true,
|
|
50
|
+
}),
|
|
51
|
+
phone: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Phone',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const params = new URLSearchParams();
|
|
59
|
+
params.append('customer_id:in', context.propsValue.customer_id);
|
|
60
|
+
const response = yield requests_1.bigCommerceApiService.fetchCustomerAddresses({
|
|
61
|
+
auth: context.auth,
|
|
62
|
+
queryString: params.toString(),
|
|
63
|
+
});
|
|
64
|
+
if (response.data && response.data.length > 0) {
|
|
65
|
+
const existingAddress = response.data.find((addr) => addr.address1 === context.propsValue.address1 &&
|
|
66
|
+
addr.city === context.propsValue.city &&
|
|
67
|
+
addr.postal_code === context.propsValue.postal_code);
|
|
68
|
+
if (existingAddress) {
|
|
69
|
+
return { found: true, data: existingAddress };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const newAddress = yield requests_1.bigCommerceApiService.createCustomerAddress({
|
|
73
|
+
auth: context.auth,
|
|
74
|
+
payload: [
|
|
75
|
+
{
|
|
76
|
+
customer_id: context.propsValue.customer_id,
|
|
77
|
+
first_name: context.propsValue.first_name,
|
|
78
|
+
last_name: context.propsValue.last_name,
|
|
79
|
+
address1: context.propsValue.address1,
|
|
80
|
+
address2: context.propsValue.address2,
|
|
81
|
+
city: context.propsValue.city,
|
|
82
|
+
state_or_province: context.propsValue.state_or_province,
|
|
83
|
+
postal_code: context.propsValue.postal_code,
|
|
84
|
+
country_code: context.propsValue.country_code,
|
|
85
|
+
phone: context.propsValue.phone,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
return { found: false, data: newAddress.data };
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=find-or-create-customers-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-or-create-customers-address.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/actions/find-or-create-customers-address.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,2CAAmD;AACnD,iDAA2D;AAE9C,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,mCAAmC;IAChD,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,WAAW,EAAE,IAAA,wBAAgB,EAAC;YAC5B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,gBAAgB;YAC7B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,gBAAgB;YAC7B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,iBAAiB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACpC,WAAW,EAAE,gBAAgB;YAC7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,MAAM,gCAAqB,CAAC,qBAAqB,CAAC;gBACnE,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE;oBACP;wBACE,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;wBAC3C,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU;wBACzC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS;wBACvC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;wBACrC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;wBACrC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;wBAC7B,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,iBAAiB;wBACvD,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;wBAC3C,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY;wBAC7C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;qBAChC;iBACF;aACF,CAAC,CAAC;YAEH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;QACjD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const findOrCreateProduct: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
sku: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
9
|
+
weight: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
10
|
+
price: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
11
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
12
|
+
brand_id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findOrCreateProduct = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const requests_1 = require("../common/requests");
|
|
8
|
+
exports.findOrCreateProduct = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.bigcommerceAuth,
|
|
10
|
+
name: 'findOrCreateProduct',
|
|
11
|
+
displayName: 'Find or Create Product',
|
|
12
|
+
description: 'Finds or creates a product',
|
|
13
|
+
props: {
|
|
14
|
+
name: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Product Name',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
sku: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'SKU',
|
|
20
|
+
required: false,
|
|
21
|
+
}),
|
|
22
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
23
|
+
displayName: 'Product Type',
|
|
24
|
+
required: true,
|
|
25
|
+
options: {
|
|
26
|
+
options: [
|
|
27
|
+
{ label: 'Physical', value: 'physical' },
|
|
28
|
+
{ label: 'Digital', value: 'digital' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
weight: pieces_framework_1.Property.Number({
|
|
33
|
+
displayName: 'Weight',
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
price: pieces_framework_1.Property.Number({
|
|
37
|
+
displayName: 'Price',
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
description: pieces_framework_1.Property.LongText({
|
|
41
|
+
displayName: 'Description',
|
|
42
|
+
required: false,
|
|
43
|
+
}),
|
|
44
|
+
brand_id: pieces_framework_1.Property.Number({
|
|
45
|
+
displayName: 'Brand ID',
|
|
46
|
+
description: 'Brand ID',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
run(context) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const params = new URLSearchParams();
|
|
53
|
+
params.append('name', context.propsValue.name);
|
|
54
|
+
const response = yield requests_1.bigCommerceApiService.fetchProducts({
|
|
55
|
+
auth: context.auth,
|
|
56
|
+
queryString: params.toString(),
|
|
57
|
+
});
|
|
58
|
+
if (response.data && response.data.length > 0) {
|
|
59
|
+
return { found: true, data: response.data };
|
|
60
|
+
}
|
|
61
|
+
const newProduct = yield requests_1.bigCommerceApiService.createProduct({
|
|
62
|
+
auth: context.auth,
|
|
63
|
+
payload: {
|
|
64
|
+
name: context.propsValue.name,
|
|
65
|
+
type: context.propsValue.type,
|
|
66
|
+
sku: context.propsValue.sku,
|
|
67
|
+
description: context.propsValue.description,
|
|
68
|
+
weight: context.propsValue.weight,
|
|
69
|
+
price: context.propsValue.price,
|
|
70
|
+
brand_id: context.propsValue.brand_id,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
return { found: false, data: newProduct.data };
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=find-or-create-product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-or-create-product.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/actions/find-or-create-product.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,iDAA2D;AAE9C,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,sBAA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CAAC,aAAa,CAAC;gBACzD,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE;aAC/B,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC9C,CAAC;YAED,MAAM,UAAU,GAAG,MAAM,gCAAqB,CAAC,aAAa,CAAC;gBAC3D,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;oBAC7B,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;oBAC7B,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG;oBAC3B,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;oBAC3C,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;oBACjC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;oBAC/B,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;iBACtC;aACF,CAAC,CAAC;YAEH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;QACjD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const searchCustomerAddress: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
customer_ids: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, true>;
|
|
7
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchCustomerAddress = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const requests_1 = require("../common/requests");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
exports.searchCustomerAddress = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.bigcommerceAuth,
|
|
11
|
+
name: 'searchCustomerAddress',
|
|
12
|
+
displayName: 'Search Customer Address',
|
|
13
|
+
description: 'Searches for a customer’s address',
|
|
14
|
+
props: {
|
|
15
|
+
customer_ids: (0, props_1.multiCustomerDropdown)({
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
name: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Name',
|
|
20
|
+
description: 'Customer name to search for',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
run(context) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const params = new URLSearchParams();
|
|
27
|
+
if (context.propsValue.customer_ids)
|
|
28
|
+
params.append('customer_ids:in', context.propsValue.customer_ids.join(','));
|
|
29
|
+
if (context.propsValue.name)
|
|
30
|
+
params.append('name:in', `${context.propsValue.name}`);
|
|
31
|
+
return yield requests_1.bigCommerceApiService.fetchCustomerAddresses({
|
|
32
|
+
auth: context.auth,
|
|
33
|
+
queryString: params.toString(),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=search-customer-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-customer-address.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/actions/search-customer-address.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,iDAA2D;AAC3D,yCAAiD;AACjD,2CAAwD;AAE3C,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE;QACL,YAAY,EAAE,IAAA,6BAAqB,EAAC;YAClC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,UAAU,CAAC,YAAY;gBACjC,MAAM,CAAC,MAAM,CACX,iBAAiB,EAChB,OAAO,CAAC,UAAU,CAAC,YAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CACxD,CAAC;YACJ,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI;gBACzB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;YAEzD,OAAO,MAAM,gCAAqB,CAAC,sBAAsB,CAAC;gBACxD,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const searchCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchCustomer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const requests_1 = require("../common/requests");
|
|
8
|
+
exports.searchCustomer = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.bigcommerceAuth,
|
|
10
|
+
name: 'searchCustomer',
|
|
11
|
+
displayName: 'Search Customer',
|
|
12
|
+
description: 'Searches for a registered customer',
|
|
13
|
+
props: {
|
|
14
|
+
email: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Email',
|
|
16
|
+
description: 'Customer email to search for',
|
|
17
|
+
required: false,
|
|
18
|
+
}),
|
|
19
|
+
phone: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Phone Number',
|
|
21
|
+
description: 'Phone Number to search for',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
name: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Name',
|
|
26
|
+
description: 'Customer name to search for',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
run(context) {
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const params = new URLSearchParams();
|
|
33
|
+
if (context.propsValue.email)
|
|
34
|
+
params.append('email:in', context.propsValue.email);
|
|
35
|
+
if (context.propsValue.name)
|
|
36
|
+
params.append('name:in', `${context.propsValue.name}`);
|
|
37
|
+
if (context.propsValue.phone)
|
|
38
|
+
params.append('phone:in', context.propsValue.phone);
|
|
39
|
+
return yield requests_1.bigCommerceApiService.fetchCustomers({
|
|
40
|
+
auth: context.auth,
|
|
41
|
+
queryString: params.toString(),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=search-customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-customer.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/actions/search-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,iDAA2D;AAE9C,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK;gBAC1B,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI;gBACzB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;YACzD,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK;gBAC1B,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAEtD,OAAO,MAAM,gCAAqB,CAAC,cAAc,CAAC;gBAChD,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const searchProduct: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
sku: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
brand_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
weight: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
11
|
+
price: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchProduct = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const requests_1 = require("../common/requests");
|
|
8
|
+
exports.searchProduct = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.bigcommerceAuth,
|
|
10
|
+
name: 'searchProduct',
|
|
11
|
+
displayName: 'Search Product',
|
|
12
|
+
description: 'Searches for a product in the catalog',
|
|
13
|
+
props: {
|
|
14
|
+
name: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Product Name',
|
|
16
|
+
description: 'Product name to search for',
|
|
17
|
+
required: false,
|
|
18
|
+
}),
|
|
19
|
+
sku: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'SKU',
|
|
21
|
+
description: 'Product SKU to search for',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
25
|
+
displayName: 'Product Type',
|
|
26
|
+
required: false,
|
|
27
|
+
options: {
|
|
28
|
+
options: [
|
|
29
|
+
{ label: 'Physical', value: 'physical' },
|
|
30
|
+
{ label: 'Digital', value: 'digital' },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
brand_id: pieces_framework_1.Property.ShortText({
|
|
35
|
+
displayName: 'Brand ID',
|
|
36
|
+
description: 'Brand ID to search for',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
weight: pieces_framework_1.Property.Number({
|
|
40
|
+
displayName: 'Weight',
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
43
|
+
price: pieces_framework_1.Property.Number({
|
|
44
|
+
displayName: 'Price',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
run(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const params = new URLSearchParams();
|
|
51
|
+
if (context.propsValue.name)
|
|
52
|
+
params.append('name', context.propsValue.name);
|
|
53
|
+
if (context.propsValue.sku)
|
|
54
|
+
params.append('sku', context.propsValue.sku);
|
|
55
|
+
if (context.propsValue.brand_id)
|
|
56
|
+
params.append('brand_id', context.propsValue.brand_id);
|
|
57
|
+
if (context.propsValue.type)
|
|
58
|
+
params.append('type', context.propsValue.type);
|
|
59
|
+
if (context.propsValue.price)
|
|
60
|
+
params.append('price', String(context.propsValue.price));
|
|
61
|
+
if (context.propsValue.weight)
|
|
62
|
+
params.append('weight', String(context.propsValue.weight));
|
|
63
|
+
return yield requests_1.bigCommerceApiService.fetchProducts({
|
|
64
|
+
auth: context.auth,
|
|
65
|
+
queryString: params.toString(),
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=search-product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-product.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/actions/search-product.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,iDAA2D;AAE9C,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,KAAK;YAClB,W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AC,UAAU,CAAC,IAAI,CAAC,CAAC;YACjD,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK;gBAC1B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;YAC3D,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM;gBAC3B,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YAE7D,OAAO,MAAM,gCAAqB,CAAC,aAAa,CAAC;gBAC/C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const bigcommerceAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bigcommerceAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const requests_1 = require("./requests");
|
|
7
|
+
exports.bigcommerceAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
8
|
+
description: 'Enter your BigCommerce API credentials. ',
|
|
9
|
+
props: {
|
|
10
|
+
instruction: pieces_framework_1.Property.MarkDown({
|
|
11
|
+
value: `1. Login to https://www.bigcommerce.com/essentials/
|
|
12
|
+
2. Go to Settings
|
|
13
|
+
3. Scroll down to API
|
|
14
|
+
4. Click on "Store Level API Accounts"
|
|
15
|
+
5. Click "Create API Account" button
|
|
16
|
+
6. Enter a name and add required scopes
|
|
17
|
+
7. Save - you will get a downloaded file containing your access token and store hash`,
|
|
18
|
+
}),
|
|
19
|
+
storeHash: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Store Hash',
|
|
21
|
+
description: 'Your BigCommerce store hash (e.g., abcd1234)',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
accessToken: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Access Token',
|
|
26
|
+
description: 'Your BigCommerce API access token',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
required: true,
|
|
31
|
+
validate(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
try {
|
|
34
|
+
yield requests_1.bigCommerceApiService.fetchProducts({
|
|
35
|
+
auth: context.auth,
|
|
36
|
+
});
|
|
37
|
+
return { valid: true };
|
|
38
|
+
}
|
|
39
|
+
catch (_a) {
|
|
40
|
+
return {
|
|
41
|
+
valid: false,
|
|
42
|
+
error: 'Could not validate credentials. please check your credentials are correct.',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,yCAAmD;AAEtC,QAAA,eAAe,GAAG,4BAAS,CAAC,UAAU,CAAC;IAClD,WAAW,EACT,0CAA0C;IAE5C,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,KAAK,EAAE;;;;;;qFAMwE;SAChF,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,IAAI;IACR,QAAQ,CAAC,OAAO;;YACpB,IAAI,CAAC;gBACH,MAAM,gCAAqB,CAAC,aAAa,CAAC;oBACxC,IAAI,EAAE,OAAO,CAAC,IAAI;iBACnB,CAAC,CAAC;gBACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACzB,CAAC;YAAC,WAAM,CAAC;gBACP,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EACH,4EAA4E;iBAC/E,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type bigCommerceAuth = {
|
|
2
|
+
storeHash: string;
|
|
3
|
+
accessToken: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const GET_BASE_URL: (storeHash: string) => string;
|
|
6
|
+
export declare function handleDropdownError(msg: string): {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
options: never[];
|
|
9
|
+
placeholder: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_BASE_URL = void 0;
|
|
4
|
+
exports.handleDropdownError = handleDropdownError;
|
|
5
|
+
const GET_BASE_URL = (storeHash) => `https://api.bigcommerce.com/stores/${storeHash}`;
|
|
6
|
+
exports.GET_BASE_URL = GET_BASE_URL;
|
|
7
|
+
function handleDropdownError(msg) {
|
|
8
|
+
return {
|
|
9
|
+
disabled: true,
|
|
10
|
+
options: [],
|
|
11
|
+
placeholder: msg,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/common/constants.ts"],"names":[],"mappings":";;;AAQA,kDAMC;AATM,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,EAAE,CAChD,sCAAsC,SAAS,EAAE,CAAC;AADvC,QAAA,YAAY,gBAC2B;AAEpD,SAAgB,mBAAmB,CAAC,GAAW;IAC7C,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,GAAG;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const customerDropdown: ({ required }: {
|
|
2
|
+
required: boolean;
|
|
3
|
+
}) => import("@activepieces/pieces-framework").DropdownProperty<unknown, false> | import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
export declare const multiCustomerDropdown: ({ required }: {
|
|
5
|
+
required: boolean;
|
|
6
|
+
}) => import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, true>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiCustomerDropdown = exports.customerDropdown = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const requests_1 = require("./requests");
|
|
8
|
+
const customerDropdown = ({ required }) => pieces_framework_1.Property.Dropdown({
|
|
9
|
+
displayName: 'Customer',
|
|
10
|
+
description: 'Select the customer',
|
|
11
|
+
required,
|
|
12
|
+
refreshers: ['auth'],
|
|
13
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
14
|
+
if (!auth)
|
|
15
|
+
return (0, constants_1.handleDropdownError)('Please connect your account first');
|
|
16
|
+
try {
|
|
17
|
+
const response = yield requests_1.bigCommerceApiService.fetchCustomers({ auth });
|
|
18
|
+
const data = Array.isArray(response === null || response === void 0 ? void 0 : response.data) ? response.data : [];
|
|
19
|
+
if (data.length === 0) {
|
|
20
|
+
return (0, constants_1.handleDropdownError)('No customers found');
|
|
21
|
+
}
|
|
22
|
+
const options = data.map((user) => {
|
|
23
|
+
const fullName = [user.first_name, user.last_name]
|
|
24
|
+
.filter((p) => typeof p === 'string' && p.trim() !== '')
|
|
25
|
+
.join(' ') ||
|
|
26
|
+
user.email ||
|
|
27
|
+
user.id;
|
|
28
|
+
return {
|
|
29
|
+
label: fullName,
|
|
30
|
+
value: user.id,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
disabled: false,
|
|
35
|
+
options,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return (0, constants_1.handleDropdownError)('Failed to load customers');
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
exports.customerDropdown = customerDropdown;
|
|
44
|
+
const multiCustomerDropdown = ({ required }) => pieces_framework_1.Property.MultiSelectDropdown({
|
|
45
|
+
displayName: 'Customers',
|
|
46
|
+
description: 'Select the customers',
|
|
47
|
+
required,
|
|
48
|
+
refreshers: ['auth'],
|
|
49
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
50
|
+
if (!auth)
|
|
51
|
+
return (0, constants_1.handleDropdownError)('Please connect your account first');
|
|
52
|
+
try {
|
|
53
|
+
const response = yield requests_1.bigCommerceApiService.fetchCustomers({ auth });
|
|
54
|
+
const data = Array.isArray(response === null || response === void 0 ? void 0 : response.data) ? response.data : [];
|
|
55
|
+
if (data.length === 0) {
|
|
56
|
+
return (0, constants_1.handleDropdownError)('No customers found');
|
|
57
|
+
}
|
|
58
|
+
const options = data.map((user) => {
|
|
59
|
+
const fullName = [user.first_name, user.last_name]
|
|
60
|
+
.filter((p) => typeof p === 'string' && p.trim() !== '')
|
|
61
|
+
.join(' ') ||
|
|
62
|
+
user.email ||
|
|
63
|
+
user.id;
|
|
64
|
+
return {
|
|
65
|
+
label: fullName,
|
|
66
|
+
value: user.id,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
disabled: false,
|
|
71
|
+
options,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return (0, constants_1.handleDropdownError)('Failed to load customers');
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
exports.multiCustomerDropdown = multiCustomerDropdown;
|
|
80
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bigcommerce/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,2CAAkD;AAClD,yCAAmD;AAE5C,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAyB,EAAE,EAAE,CACtE,2BAAQ,CAAC,QAAQ,CAAC;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,qBAAqB;IAClC,QAAQ;IACR,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,OAAO,EAAE,KAAsB,EAAE,oDAAjB,EAAE,IAAI,EAAO;QAC3B,IAAI,CAAC,IAAI;YACP,OAAO,IAAA,+BAAmB,EAAC,mCAAmC,CAAC,CAAC;QAElE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,gCAAqB,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YAEtE,MAAM,IAAI,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Auth } from './constants';
|
|
2
|
+
export declare const bigCommerceApiService: {
|
|
3
|
+
createWebhook({ auth, payload, }: {
|
|
4
|
+
auth: bigCommerceAuth;
|
|
5
|
+
payload: {
|
|
6
|
+
scope: string;
|
|
7
|
+
destination: string;
|
|
8
|
+
is_active: boolean;
|
|
9
|
+
};
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
createCustomer({ auth, payload, }: {
|
|
12
|
+
auth: bigCommerceAuth;
|
|
13
|
+
payload: any;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
fetchCustomers({ auth, queryString, }: {
|
|
16
|
+
auth: bigCommerceAuth;
|
|
17
|
+
queryString?: string;
|
|
18
|
+
}): Promise<any>;
|
|
19
|
+
fetchCustomerAddresses({ auth, queryString, }: {
|
|
20
|
+
auth: bigCommerceAuth;
|
|
21
|
+
queryString?: string;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
fetchProducts({ auth, queryString, }: {
|
|
24
|
+
auth: bigCommerceAuth;
|
|
25
|
+
queryString?: string;
|
|
26
|
+
}): Promise<any>;
|
|
27
|
+
createProduct({ auth, payload, }: {
|
|
28
|
+
auth: bigCommerceAuth;
|
|
29
|
+
payload: any;
|
|
30
|
+
}): Promise<any>;
|
|
31
|
+
createBlogPost({ auth, payload, }: {
|
|
32
|
+
auth: bigCommerceAuth;
|
|
33
|
+
payload: any;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
createCustomerAddress({ auth, payload, }: {
|
|
36
|
+
auth: bigCommerceAuth;
|
|
37
|
+
payload: any;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
deleteWebhook({ auth, webhookId, }: {
|
|
40
|
+
auth: bigCommerceAuth;
|
|
41
|
+
webhookId: string;
|
|
42
|
+
}): Promise<any>;
|
|
43
|
+
};
|