@agnocon/piece-bigcommerce 0.1.11
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/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/create-a-product.d.ts +14 -0
- package/dist/lib/actions/create-a-product.d.ts.map +1 -0
- package/dist/lib/actions/create-a-product.js +80 -0
- package/dist/lib/actions/create-a-product.js.map +1 -0
- package/dist/lib/actions/create-blog-post.d.ts +16 -0
- package/dist/lib/actions/create-blog-post.d.ts.map +1 -0
- package/dist/lib/actions/create-blog-post.js +87 -0
- package/dist/lib/actions/create-blog-post.js.map +1 -0
- package/dist/lib/actions/create-customer-address.d.ts +25 -0
- package/dist/lib/actions/create-customer-address.d.ts.map +1 -0
- package/dist/lib/actions/create-customer-address.js +85 -0
- package/dist/lib/actions/create-customer-address.js.map +1 -0
- package/dist/lib/actions/create-customer.d.ts +13 -0
- package/dist/lib/actions/create-customer.d.ts.map +1 -0
- package/dist/lib/actions/create-customer.js +70 -0
- package/dist/lib/actions/create-customer.js.map +1 -0
- package/dist/lib/actions/delete-a-product.d.ts +8 -0
- package/dist/lib/actions/delete-a-product.d.ts.map +1 -0
- package/dist/lib/actions/delete-a-product.js +36 -0
- package/dist/lib/actions/delete-a-product.js.map +1 -0
- package/dist/lib/actions/find-or-create-customer.d.ts +13 -0
- package/dist/lib/actions/find-or-create-customer.d.ts.map +1 -0
- package/dist/lib/actions/find-or-create-customer.js +82 -0
- package/dist/lib/actions/find-or-create-customer.js.map +1 -0
- package/dist/lib/actions/find-or-create-customers-address.d.ts +25 -0
- package/dist/lib/actions/find-or-create-customers-address.d.ts.map +1 -0
- package/dist/lib/actions/find-or-create-customers-address.js +100 -0
- package/dist/lib/actions/find-or-create-customers-address.js.map +1 -0
- package/dist/lib/actions/find-or-create-product.d.ts +14 -0
- package/dist/lib/actions/find-or-create-product.d.ts.map +1 -0
- package/dist/lib/actions/find-or-create-product.js +84 -0
- package/dist/lib/actions/find-or-create-product.js.map +1 -0
- package/dist/lib/actions/get-order.d.ts +8 -0
- package/dist/lib/actions/get-order.d.ts.map +1 -0
- package/dist/lib/actions/get-order.js +36 -0
- package/dist/lib/actions/get-order.js.map +1 -0
- package/dist/lib/actions/list-categories.d.ts +8 -0
- package/dist/lib/actions/list-categories.d.ts.map +1 -0
- package/dist/lib/actions/list-categories.js +39 -0
- package/dist/lib/actions/list-categories.js.map +1 -0
- package/dist/lib/actions/list-orders.d.ts +9 -0
- package/dist/lib/actions/list-orders.d.ts.map +1 -0
- package/dist/lib/actions/list-orders.js +46 -0
- package/dist/lib/actions/list-orders.js.map +1 -0
- package/dist/lib/actions/search-customer-address.d.ts +17 -0
- package/dist/lib/actions/search-customer-address.d.ts.map +1 -0
- package/dist/lib/actions/search-customer-address.js +45 -0
- package/dist/lib/actions/search-customer-address.js.map +1 -0
- package/dist/lib/actions/search-customer.d.ts +10 -0
- package/dist/lib/actions/search-customer.d.ts.map +1 -0
- package/dist/lib/actions/search-customer.js +53 -0
- package/dist/lib/actions/search-customer.js.map +1 -0
- package/dist/lib/actions/search-product.d.ts +13 -0
- package/dist/lib/actions/search-product.d.ts.map +1 -0
- package/dist/lib/actions/search-product.js +77 -0
- package/dist/lib/actions/search-product.js.map +1 -0
- package/dist/lib/actions/update-a-product.d.ts +15 -0
- package/dist/lib/actions/update-a-product.d.ts.map +1 -0
- package/dist/lib/actions/update-a-product.js +81 -0
- package/dist/lib/actions/update-a-product.js.map +1 -0
- package/dist/lib/common/auth.d.ts +6 -0
- package/dist/lib/common/auth.d.ts.map +1 -0
- package/dist/lib/common/auth.js +50 -0
- package/dist/lib/common/auth.js.map +1 -0
- package/dist/lib/common/constants.d.ts +11 -0
- package/dist/lib/common/constants.d.ts.map +1 -0
- package/dist/lib/common/constants.js +14 -0
- package/dist/lib/common/constants.js.map +1 -0
- package/dist/lib/common/props.d.ts +23 -0
- package/dist/lib/common/props.d.ts.map +1 -0
- package/dist/lib/common/props.js +85 -0
- package/dist/lib/common/props.js.map +1 -0
- package/dist/lib/common/requests.d.ts +65 -0
- package/dist/lib/common/requests.d.ts.map +1 -0
- package/dist/lib/common/requests.js +179 -0
- package/dist/lib/common/requests.js.map +1 -0
- package/dist/lib/triggers/abandoned-cart.d.ts +19 -0
- package/dist/lib/triggers/abandoned-cart.d.ts.map +1 -0
- package/dist/lib/triggers/abandoned-cart.js +66 -0
- package/dist/lib/triggers/abandoned-cart.js.map +1 -0
- package/dist/lib/triggers/cart-created.d.ts +19 -0
- package/dist/lib/triggers/cart-created.d.ts.map +1 -0
- package/dist/lib/triggers/cart-created.js +68 -0
- package/dist/lib/triggers/cart-created.js.map +1 -0
- package/dist/lib/triggers/customer-address-created.d.ts +19 -0
- package/dist/lib/triggers/customer-address-created.d.ts.map +1 -0
- package/dist/lib/triggers/customer-address-created.js +68 -0
- package/dist/lib/triggers/customer-address-created.js.map +1 -0
- package/dist/lib/triggers/customer-address-updated.d.ts +19 -0
- package/dist/lib/triggers/customer-address-updated.d.ts.map +1 -0
- package/dist/lib/triggers/customer-address-updated.js +68 -0
- package/dist/lib/triggers/customer-address-updated.js.map +1 -0
- package/dist/lib/triggers/customer-created.d.ts +19 -0
- package/dist/lib/triggers/customer-created.d.ts.map +1 -0
- package/dist/lib/triggers/customer-created.js +70 -0
- package/dist/lib/triggers/customer-created.js.map +1 -0
- package/dist/lib/triggers/customer-updated.d.ts +19 -0
- package/dist/lib/triggers/customer-updated.d.ts.map +1 -0
- package/dist/lib/triggers/customer-updated.js +68 -0
- package/dist/lib/triggers/customer-updated.js.map +1 -0
- package/dist/lib/triggers/order-created.d.ts +19 -0
- package/dist/lib/triggers/order-created.d.ts.map +1 -0
- package/dist/lib/triggers/order-created.js +68 -0
- package/dist/lib/triggers/order-created.js.map +1 -0
- package/dist/lib/triggers/order-status-updated.d.ts +19 -0
- package/dist/lib/triggers/order-status-updated.d.ts.map +1 -0
- package/dist/lib/triggers/order-status-updated.js +68 -0
- package/dist/lib/triggers/order-status-updated.js.map +1 -0
- package/dist/lib/triggers/order-updated.d.ts +19 -0
- package/dist/lib/triggers/order-updated.d.ts.map +1 -0
- package/dist/lib/triggers/order-updated.js +68 -0
- package/dist/lib/triggers/order-updated.js.map +1 -0
- package/dist/lib/triggers/product-created.d.ts +19 -0
- package/dist/lib/triggers/product-created.d.ts.map +1 -0
- package/dist/lib/triggers/product-created.js +68 -0
- package/dist/lib/triggers/product-created.js.map +1 -0
- package/dist/lib/triggers/shipment-created.d.ts +19 -0
- package/dist/lib/triggers/shipment-created.d.ts.map +1 -0
- package/dist/lib/triggers/shipment-created.js +68 -0
- package/dist/lib/triggers/shipment-created.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +81 -0
- package/src/lib/actions/create-a-product.ts +73 -0
- package/src/lib/actions/create-blog-post.ts +82 -0
- package/src/lib/actions/create-customer-address.ts +78 -0
- package/src/lib/actions/create-customer.ts +63 -0
- package/src/lib/actions/delete-a-product.ts +29 -0
- package/src/lib/actions/find-or-create-customer.ts +81 -0
- package/src/lib/actions/find-or-create-customers-address.ts +101 -0
- package/src/lib/actions/find-or-create-product.ts +81 -0
- package/src/lib/actions/get-order.ts +29 -0
- package/src/lib/actions/list-categories.ts +31 -0
- package/src/lib/actions/list-orders.ts +38 -0
- package/src/lib/actions/search-customer-address.ts +42 -0
- package/src/lib/actions/search-customer.ts +47 -0
- package/src/lib/actions/search-product.ts +69 -0
- package/src/lib/actions/update-a-product.ts +78 -0
- package/src/lib/common/auth.ts +44 -0
- package/src/lib/common/constants.ts +15 -0
- package/src/lib/common/props.ts +90 -0
- package/src/lib/common/requests.ts +252 -0
- package/src/lib/triggers/abandoned-cart.ts +58 -0
- package/src/lib/triggers/cart-created.ts +60 -0
- package/src/lib/triggers/customer-address-created.ts +60 -0
- package/src/lib/triggers/customer-address-updated.ts +60 -0
- package/src/lib/triggers/customer-created.ts +62 -0
- package/src/lib/triggers/customer-updated.ts +60 -0
- package/src/lib/triggers/order-created.ts +60 -0
- package/src/lib/triggers/order-status-updated.ts +60 -0
- package/src/lib/triggers/order-updated.ts +60 -0
- package/src/lib/triggers/product-created.ts +60 -0
- package/src/lib/triggers/shipment-created.ts +61 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchCustomer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/actions/search-customer.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const requests_1 = require("../common/requests");
|
|
10
|
+
exports.searchCustomer = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.bigcommerceAuth,
|
|
12
|
+
name: 'searchCustomer',
|
|
13
|
+
displayName: 'Search Customer',
|
|
14
|
+
description: 'Searches for a registered customer',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: {
|
|
17
|
+
description: 'Searches registered customers in a BigCommerce store by email, phone, and/or name. With no filters it returns all customers; supplying any filter narrows to matches. Use to look up a customer or check whether one exists before creating it. Idempotent read-only query with no side effects.',
|
|
18
|
+
idempotent: true,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
email: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Email',
|
|
23
|
+
description: 'Customer email to search for',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
phone: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Phone Number',
|
|
28
|
+
description: 'Phone Number to search for',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
name: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Name',
|
|
33
|
+
description: 'Customer name to search for',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
37
|
+
run(context) {
|
|
38
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const params = new URLSearchParams();
|
|
40
|
+
if (context.propsValue.email)
|
|
41
|
+
params.append('email:in', context.propsValue.email);
|
|
42
|
+
if (context.propsValue.name)
|
|
43
|
+
params.append('name:in', `${context.propsValue.name}`);
|
|
44
|
+
if (context.propsValue.phone)
|
|
45
|
+
params.append('phone:in', context.propsValue.phone);
|
|
46
|
+
return yield requests_1.bigCommerceApiService.fetchCustomers({
|
|
47
|
+
auth: context.auth.props,
|
|
48
|
+
queryString: params.toString(),
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=search-customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-customer.js","sourceRoot":"","sources":["../../../src/lib/actions/search-customer.ts"],"names":[],"mappings":";;;;AAAA,6GAA6G;AAC7G,qEAAqE;AACrE,gEAAmE;AACnE,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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,kSAAkS;QACpS,UAAU,EAAE,IAAI;KACjB;IACD,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,CAAC,KAAK;gBACxB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const searchProduct: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
name: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
sku: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
type: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
brand_id: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
weight: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
11
|
+
price: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=search-product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-product.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/search-product.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;EAgExB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchProduct = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/actions/search-product.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const requests_1 = require("../common/requests");
|
|
10
|
+
exports.searchProduct = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.bigcommerceAuth,
|
|
12
|
+
name: 'searchProduct',
|
|
13
|
+
displayName: 'Search Product',
|
|
14
|
+
description: 'Searches for a product in the catalog',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: {
|
|
17
|
+
description: 'Searches the BigCommerce product catalog by name, SKU, type, brand, weight, and/or price. With no filters it returns all products; supplying any filter narrows to matches. Use to find a product or its id, or to check whether one exists before creating it. Idempotent read-only query with no side effects.',
|
|
18
|
+
idempotent: true,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
name: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Product Name',
|
|
23
|
+
description: 'Product name to search for',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
sku: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'SKU',
|
|
28
|
+
description: 'Product SKU to search for',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
32
|
+
displayName: 'Product Type',
|
|
33
|
+
required: false,
|
|
34
|
+
options: {
|
|
35
|
+
options: [
|
|
36
|
+
{ label: 'Physical', value: 'physical' },
|
|
37
|
+
{ label: 'Digital', value: 'digital' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
brand_id: pieces_framework_1.Property.ShortText({
|
|
42
|
+
displayName: 'Brand ID',
|
|
43
|
+
description: 'Brand ID to search for',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
weight: pieces_framework_1.Property.Number({
|
|
47
|
+
displayName: 'Weight',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
price: pieces_framework_1.Property.Number({
|
|
51
|
+
displayName: 'Price',
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
55
|
+
run(context) {
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const params = new URLSearchParams();
|
|
58
|
+
if (context.propsValue.name)
|
|
59
|
+
params.append('name', context.propsValue.name);
|
|
60
|
+
if (context.propsValue.sku)
|
|
61
|
+
params.append('sku', context.propsValue.sku);
|
|
62
|
+
if (context.propsValue.brand_id)
|
|
63
|
+
params.append('brand_id', context.propsValue.brand_id);
|
|
64
|
+
if (context.propsValue.type)
|
|
65
|
+
params.append('type', context.propsValue.type);
|
|
66
|
+
if (context.propsValue.price)
|
|
67
|
+
params.append('price', String(context.propsValue.price));
|
|
68
|
+
if (context.propsValue.weight)
|
|
69
|
+
params.append('weight', String(context.propsValue.weight));
|
|
70
|
+
return yield requests_1.bigCommerceApiService.fetchProducts({
|
|
71
|
+
auth: context.auth.props,
|
|
72
|
+
queryString: params.toString(),
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=search-product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-product.js","sourceRoot":"","sources":["../../../src/lib/actions/search-product.ts"],"names":[],"mappings":";;;;AAAA,4GAA4G;AAC5G,qEAAqE;AACrE,gEAAmE;AACnE,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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,kTAAkT;QACpT,UAAU,EAAE,IAAI;KACjB;IACD,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,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;oBACxC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;iBACvC;aACF;SACF,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,E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EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACxB,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const updateAProduct: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
productId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
name: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
type: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
sku: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
description: import("@agnocon/pieces-framework").LongTextProperty<false>;
|
|
11
|
+
weight: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
12
|
+
price: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
13
|
+
brand_id: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=update-a-product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-a-product.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/update-a-product.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc;;;;;;;;;;;;;EAyEzB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateAProduct = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/actions/update-a-product.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const requests_1 = require("../common/requests");
|
|
10
|
+
exports.updateAProduct = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.bigcommerceAuth,
|
|
12
|
+
name: 'updateAProduct',
|
|
13
|
+
displayName: 'Update a Product',
|
|
14
|
+
description: 'Updates an existing Product',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: {
|
|
17
|
+
description: 'Updates an existing catalog product in a BigCommerce store, identified by its productId. Only the fields you supply are sent (null/undefined values are dropped so existing data is preserved), so use it for partial edits to name, type, SKU, description, weight, price, or brand. Idempotent: re-applying the same field values leaves the product in the same state.',
|
|
18
|
+
idempotent: true,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
productId: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Product ID',
|
|
23
|
+
description: 'The ID of the product to update',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
name: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Product Name',
|
|
28
|
+
description: 'Name of the product',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
32
|
+
displayName: 'Product Type',
|
|
33
|
+
description: 'Type of product',
|
|
34
|
+
required: false,
|
|
35
|
+
options: {
|
|
36
|
+
options: [
|
|
37
|
+
{ label: 'Physical', value: 'physical' },
|
|
38
|
+
{ label: 'Digital', value: 'digital' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
sku: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'SKU',
|
|
44
|
+
description: 'Product SKU',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
description: pieces_framework_1.Property.LongText({
|
|
48
|
+
displayName: 'Description',
|
|
49
|
+
description: 'Product description',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
weight: pieces_framework_1.Property.Number({
|
|
53
|
+
displayName: 'Weight',
|
|
54
|
+
description: 'Product weight',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
price: pieces_framework_1.Property.Number({
|
|
58
|
+
displayName: 'Price',
|
|
59
|
+
description: 'Product price',
|
|
60
|
+
required: false,
|
|
61
|
+
}),
|
|
62
|
+
brand_id: pieces_framework_1.Property.Number({
|
|
63
|
+
displayName: 'Brand ID',
|
|
64
|
+
description: 'Brand ID',
|
|
65
|
+
required: false,
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
run(context) {
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const _a = context.propsValue, { productId } = _a, payload = tslib_1.__rest(_a, ["productId"]);
|
|
71
|
+
// Filter out null/undefined values to prevent overwriting existing data with nulls
|
|
72
|
+
const filteredPayload = Object.fromEntries(Object.entries(payload).filter(([_, v]) => v !== null && v !== undefined));
|
|
73
|
+
return yield requests_1.bigCommerceApiService.updateProduct({
|
|
74
|
+
auth: context.auth.props,
|
|
75
|
+
productId,
|
|
76
|
+
payload: filteredPayload,
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=update-a-product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-a-product.js","sourceRoot":"","sources":["../../../src/lib/actions/update-a-product.ts"],"names":[],"mappings":";;;;AAAA,8GAA8G;AAC9G,qEAAqE;AACrE,gEAAmE;AACnE,yCAAiD;AACjD,iDAA2D;AAE9C,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EA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,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,KAA4B,OAAO,CAAC,UAAU,EAA9C,EAAE,SAAS,OAAmC,EAA9B,OAAO,sBAAvB,aAAyB,CAAqB,CAAC;YAErD,mFAAmF;YACnF,MAAM,eAAe,GAAG,MAAM,CAAC,WAAW,CACxC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,CAAC,CAC1E,CAAC;YAEF,OAAO,MAAM,gCAAqB,CAAC,aAAa,CAAC;gBAC/C,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACxB,SAAS;gBACT,OAAO,EAAE,eAAe;aACzB,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const bigcommerceAuth: import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;EAwC1B,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bigcommerceAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/common/auth.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const requests_1 = require("./requests");
|
|
9
|
+
exports.bigcommerceAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
10
|
+
description: 'Enter your BigCommerce API credentials. ',
|
|
11
|
+
props: {
|
|
12
|
+
instruction: pieces_framework_1.Property.MarkDown({
|
|
13
|
+
value: `1. Login to https://www.bigcommerce.com/essentials/
|
|
14
|
+
2. Go to Settings
|
|
15
|
+
3. Scroll down to API
|
|
16
|
+
4. Click on "Store Level API Accounts"
|
|
17
|
+
5. Click "Create API Account" button
|
|
18
|
+
6. Enter a name and add required scopes
|
|
19
|
+
7. Save - you will get a downloaded file containing your access token and store hash`,
|
|
20
|
+
}),
|
|
21
|
+
storeHash: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Store Hash',
|
|
23
|
+
description: 'Your BigCommerce store hash (e.g., abcd1234)',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
accessToken: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Access Token',
|
|
28
|
+
description: 'Your BigCommerce API access token',
|
|
29
|
+
required: true,
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
required: true,
|
|
33
|
+
validate(context) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
try {
|
|
36
|
+
yield requests_1.bigCommerceApiService.fetchProducts({
|
|
37
|
+
auth: context.auth,
|
|
38
|
+
});
|
|
39
|
+
return { valid: true };
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
return {
|
|
43
|
+
valid: false,
|
|
44
|
+
error: 'Could not validate credentials. please check your credentials are correct.',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,iGAAiG;AACjG,qEAAqE;AACrE,gEAAgE;AAChE,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,11 @@
|
|
|
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
|
+
};
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/common/constants.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB,CAAA;AAED,eAAO,MAAM,YAAY,cAAe,MAAM,WACK,CAAC;AAEpD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM;;;;EAM9C"}
|
|
@@ -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":["../../../src/lib/common/constants.ts"],"names":[],"mappings":";;;AAUA,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,23 @@
|
|
|
1
|
+
export declare const customerDropdown: ({ required }: {
|
|
2
|
+
required: boolean;
|
|
3
|
+
}) => import("@agnocon/pieces-framework").DropdownProperty<unknown, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
4
|
+
instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
5
|
+
storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
}>> | import("@agnocon/pieces-framework").DropdownProperty<unknown, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
9
|
+
storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
11
|
+
}>>;
|
|
12
|
+
export declare const multiCustomerDropdown: ({ required }: {
|
|
13
|
+
required: boolean;
|
|
14
|
+
}) => import("@agnocon/pieces-framework").MultiSelectDropdownProperty<unknown, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
16
|
+
storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
17
|
+
accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
18
|
+
}>> | import("@agnocon/pieces-framework").MultiSelectDropdownProperty<unknown, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
19
|
+
instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
20
|
+
storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
21
|
+
accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
22
|
+
}>>;
|
|
23
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/lib/common/props.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,iBAAkB;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE;;;;;;;;GAyChE,CAAC;AAEL,eAAO,MAAM,qBAAqB,iBAAkB;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE;;;;;;;;GAyCrE,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiCustomerDropdown = exports.customerDropdown = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/common/props.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const requests_1 = require("./requests");
|
|
10
|
+
const auth_1 = require("./auth");
|
|
11
|
+
const customerDropdown = ({ required }) => pieces_framework_1.Property.Dropdown({
|
|
12
|
+
auth: auth_1.bigcommerceAuth,
|
|
13
|
+
displayName: 'Customer',
|
|
14
|
+
description: 'Select the customer',
|
|
15
|
+
required,
|
|
16
|
+
refreshers: ['auth'],
|
|
17
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
18
|
+
if (!auth)
|
|
19
|
+
return (0, constants_1.handleDropdownError)('Please connect your account first');
|
|
20
|
+
try {
|
|
21
|
+
const response = yield requests_1.bigCommerceApiService.fetchCustomers({ auth: auth.props });
|
|
22
|
+
const data = Array.isArray(response === null || response === void 0 ? void 0 : response.data) ? response.data : [];
|
|
23
|
+
if (data.length === 0) {
|
|
24
|
+
return (0, constants_1.handleDropdownError)('No customers found');
|
|
25
|
+
}
|
|
26
|
+
const options = data.map((user) => {
|
|
27
|
+
const fullName = [user.first_name, user.last_name]
|
|
28
|
+
.filter((p) => typeof p === 'string' && p.trim() !== '')
|
|
29
|
+
.join(' ') ||
|
|
30
|
+
user.email ||
|
|
31
|
+
user.id;
|
|
32
|
+
return {
|
|
33
|
+
label: fullName,
|
|
34
|
+
value: user.id,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
disabled: false,
|
|
39
|
+
options,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return (0, constants_1.handleDropdownError)('Failed to load customers');
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
exports.customerDropdown = customerDropdown;
|
|
48
|
+
const multiCustomerDropdown = ({ required }) => pieces_framework_1.Property.MultiSelectDropdown({
|
|
49
|
+
auth: auth_1.bigcommerceAuth,
|
|
50
|
+
displayName: 'Customers',
|
|
51
|
+
description: 'Select the customers',
|
|
52
|
+
required,
|
|
53
|
+
refreshers: ['auth'],
|
|
54
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
55
|
+
if (!auth)
|
|
56
|
+
return (0, constants_1.handleDropdownError)('Please connect your account first');
|
|
57
|
+
try {
|
|
58
|
+
const response = yield requests_1.bigCommerceApiService.fetchCustomers({ auth: auth.props });
|
|
59
|
+
const data = Array.isArray(response === null || response === void 0 ? void 0 : response.data) ? response.data : [];
|
|
60
|
+
if (data.length === 0) {
|
|
61
|
+
return (0, constants_1.handleDropdownError)('No customers found');
|
|
62
|
+
}
|
|
63
|
+
const options = data.map((user) => {
|
|
64
|
+
const fullName = [user.first_name, user.last_name]
|
|
65
|
+
.filter((p) => typeof p === 'string' && p.trim() !== '')
|
|
66
|
+
.join(' ') ||
|
|
67
|
+
user.email ||
|
|
68
|
+
user.id;
|
|
69
|
+
return {
|
|
70
|
+
label: fullName,
|
|
71
|
+
value: user.id,
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
disabled: false,
|
|
76
|
+
options,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
return (0, constants_1.handleDropdownError)('Failed to load customers');
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
exports.multiCustomerDropdown = multiCustomerDropdown;
|
|
85
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,kGAAkG;AAClG,qEAAqE;AACrE,gEAAqD;AACrD,2CAAkD;AAClD,yCAAmD;AACnD,iCAAyC;AAElC,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAyB,EAAE,EAAE,CACtE,2BAAQ,CAAC,QAAQ,CAAC;IAChB,IAAI,EAAE,sBAAe;IACrB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,qBAAqB;IAClC,QAAQ;IACR,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,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,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YAElF,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CA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uth;
|
|
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: unknown;
|
|
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: unknown;
|
|
30
|
+
}): Promise<any>;
|
|
31
|
+
updateProduct({ auth, productId, payload, }: {
|
|
32
|
+
auth: bigCommerceAuth;
|
|
33
|
+
productId: string | number;
|
|
34
|
+
payload: unknown;
|
|
35
|
+
}): Promise<any>;
|
|
36
|
+
deleteProduct({ auth, productId, }: {
|
|
37
|
+
auth: bigCommerceAuth;
|
|
38
|
+
productId: string | number;
|
|
39
|
+
}): Promise<any>;
|
|
40
|
+
fetchOrders({ auth, queryString, }: {
|
|
41
|
+
auth: bigCommerceAuth;
|
|
42
|
+
queryString?: string;
|
|
43
|
+
}): Promise<any>;
|
|
44
|
+
fetchOrder({ auth, orderId, }: {
|
|
45
|
+
auth: bigCommerceAuth;
|
|
46
|
+
orderId: string | number;
|
|
47
|
+
}): Promise<any>;
|
|
48
|
+
fetchCategories({ auth, queryString, }: {
|
|
49
|
+
auth: bigCommerceAuth;
|
|
50
|
+
queryString?: string;
|
|
51
|
+
}): Promise<any>;
|
|
52
|
+
createBlogPost({ auth, payload, }: {
|
|
53
|
+
auth: bigCommerceAuth;
|
|
54
|
+
payload: unknown;
|
|
55
|
+
}): Promise<any>;
|
|
56
|
+
createCustomerAddress({ auth, payload, }: {
|
|
57
|
+
auth: bigCommerceAuth;
|
|
58
|
+
payload: unknown;
|
|
59
|
+
}): Promise<any>;
|
|
60
|
+
deleteWebhook({ auth, webhookId, }: {
|
|
61
|
+
auth: bigCommerceAuth;
|
|
62
|
+
webhookId: string;
|
|
63
|
+
}): Promise<any>;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=requests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/lib/common/requests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAgB,MAAM,aAAa,CAAC;AAyC5D,eAAO,MAAM,qBAAqB;sCAI7B;QACD,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE;YACP,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,OAAO,CAAC;SACpB,CAAC;KACH;uCAWE;QACD,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC;KAClB;2CAWE;QACD,IAAI,EAAE,eAAe,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;mDAUE;QACD,IAAI,EAAE,eAAe,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;0CAUE;QACD,IAAI,EAAE,eAAe,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;sCAUE;QACD,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC;KAClB;iDAaE;QACD,IAAI,EAAE,eAAe,CAAC;QACtB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;QAC3B,OAAO,EAAE,OAAO,CAAC;KAClB;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