@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.
Files changed (157) hide show
  1. package/LICENSE.MIT-AP +24 -0
  2. package/dist/index.d.ts +6 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +86 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/actions/create-a-product.d.ts +14 -0
  7. package/dist/lib/actions/create-a-product.d.ts.map +1 -0
  8. package/dist/lib/actions/create-a-product.js +80 -0
  9. package/dist/lib/actions/create-a-product.js.map +1 -0
  10. package/dist/lib/actions/create-blog-post.d.ts +16 -0
  11. package/dist/lib/actions/create-blog-post.d.ts.map +1 -0
  12. package/dist/lib/actions/create-blog-post.js +87 -0
  13. package/dist/lib/actions/create-blog-post.js.map +1 -0
  14. package/dist/lib/actions/create-customer-address.d.ts +25 -0
  15. package/dist/lib/actions/create-customer-address.d.ts.map +1 -0
  16. package/dist/lib/actions/create-customer-address.js +85 -0
  17. package/dist/lib/actions/create-customer-address.js.map +1 -0
  18. package/dist/lib/actions/create-customer.d.ts +13 -0
  19. package/dist/lib/actions/create-customer.d.ts.map +1 -0
  20. package/dist/lib/actions/create-customer.js +70 -0
  21. package/dist/lib/actions/create-customer.js.map +1 -0
  22. package/dist/lib/actions/delete-a-product.d.ts +8 -0
  23. package/dist/lib/actions/delete-a-product.d.ts.map +1 -0
  24. package/dist/lib/actions/delete-a-product.js +36 -0
  25. package/dist/lib/actions/delete-a-product.js.map +1 -0
  26. package/dist/lib/actions/find-or-create-customer.d.ts +13 -0
  27. package/dist/lib/actions/find-or-create-customer.d.ts.map +1 -0
  28. package/dist/lib/actions/find-or-create-customer.js +82 -0
  29. package/dist/lib/actions/find-or-create-customer.js.map +1 -0
  30. package/dist/lib/actions/find-or-create-customers-address.d.ts +25 -0
  31. package/dist/lib/actions/find-or-create-customers-address.d.ts.map +1 -0
  32. package/dist/lib/actions/find-or-create-customers-address.js +100 -0
  33. package/dist/lib/actions/find-or-create-customers-address.js.map +1 -0
  34. package/dist/lib/actions/find-or-create-product.d.ts +14 -0
  35. package/dist/lib/actions/find-or-create-product.d.ts.map +1 -0
  36. package/dist/lib/actions/find-or-create-product.js +84 -0
  37. package/dist/lib/actions/find-or-create-product.js.map +1 -0
  38. package/dist/lib/actions/get-order.d.ts +8 -0
  39. package/dist/lib/actions/get-order.d.ts.map +1 -0
  40. package/dist/lib/actions/get-order.js +36 -0
  41. package/dist/lib/actions/get-order.js.map +1 -0
  42. package/dist/lib/actions/list-categories.d.ts +8 -0
  43. package/dist/lib/actions/list-categories.d.ts.map +1 -0
  44. package/dist/lib/actions/list-categories.js +39 -0
  45. package/dist/lib/actions/list-categories.js.map +1 -0
  46. package/dist/lib/actions/list-orders.d.ts +9 -0
  47. package/dist/lib/actions/list-orders.d.ts.map +1 -0
  48. package/dist/lib/actions/list-orders.js +46 -0
  49. package/dist/lib/actions/list-orders.js.map +1 -0
  50. package/dist/lib/actions/search-customer-address.d.ts +17 -0
  51. package/dist/lib/actions/search-customer-address.d.ts.map +1 -0
  52. package/dist/lib/actions/search-customer-address.js +45 -0
  53. package/dist/lib/actions/search-customer-address.js.map +1 -0
  54. package/dist/lib/actions/search-customer.d.ts +10 -0
  55. package/dist/lib/actions/search-customer.d.ts.map +1 -0
  56. package/dist/lib/actions/search-customer.js +53 -0
  57. package/dist/lib/actions/search-customer.js.map +1 -0
  58. package/dist/lib/actions/search-product.d.ts +13 -0
  59. package/dist/lib/actions/search-product.d.ts.map +1 -0
  60. package/dist/lib/actions/search-product.js +77 -0
  61. package/dist/lib/actions/search-product.js.map +1 -0
  62. package/dist/lib/actions/update-a-product.d.ts +15 -0
  63. package/dist/lib/actions/update-a-product.d.ts.map +1 -0
  64. package/dist/lib/actions/update-a-product.js +81 -0
  65. package/dist/lib/actions/update-a-product.js.map +1 -0
  66. package/dist/lib/common/auth.d.ts +6 -0
  67. package/dist/lib/common/auth.d.ts.map +1 -0
  68. package/dist/lib/common/auth.js +50 -0
  69. package/dist/lib/common/auth.js.map +1 -0
  70. package/dist/lib/common/constants.d.ts +11 -0
  71. package/dist/lib/common/constants.d.ts.map +1 -0
  72. package/dist/lib/common/constants.js +14 -0
  73. package/dist/lib/common/constants.js.map +1 -0
  74. package/dist/lib/common/props.d.ts +23 -0
  75. package/dist/lib/common/props.d.ts.map +1 -0
  76. package/dist/lib/common/props.js +85 -0
  77. package/dist/lib/common/props.js.map +1 -0
  78. package/dist/lib/common/requests.d.ts +65 -0
  79. package/dist/lib/common/requests.d.ts.map +1 -0
  80. package/dist/lib/common/requests.js +179 -0
  81. package/dist/lib/common/requests.js.map +1 -0
  82. package/dist/lib/triggers/abandoned-cart.d.ts +19 -0
  83. package/dist/lib/triggers/abandoned-cart.d.ts.map +1 -0
  84. package/dist/lib/triggers/abandoned-cart.js +66 -0
  85. package/dist/lib/triggers/abandoned-cart.js.map +1 -0
  86. package/dist/lib/triggers/cart-created.d.ts +19 -0
  87. package/dist/lib/triggers/cart-created.d.ts.map +1 -0
  88. package/dist/lib/triggers/cart-created.js +68 -0
  89. package/dist/lib/triggers/cart-created.js.map +1 -0
  90. package/dist/lib/triggers/customer-address-created.d.ts +19 -0
  91. package/dist/lib/triggers/customer-address-created.d.ts.map +1 -0
  92. package/dist/lib/triggers/customer-address-created.js +68 -0
  93. package/dist/lib/triggers/customer-address-created.js.map +1 -0
  94. package/dist/lib/triggers/customer-address-updated.d.ts +19 -0
  95. package/dist/lib/triggers/customer-address-updated.d.ts.map +1 -0
  96. package/dist/lib/triggers/customer-address-updated.js +68 -0
  97. package/dist/lib/triggers/customer-address-updated.js.map +1 -0
  98. package/dist/lib/triggers/customer-created.d.ts +19 -0
  99. package/dist/lib/triggers/customer-created.d.ts.map +1 -0
  100. package/dist/lib/triggers/customer-created.js +70 -0
  101. package/dist/lib/triggers/customer-created.js.map +1 -0
  102. package/dist/lib/triggers/customer-updated.d.ts +19 -0
  103. package/dist/lib/triggers/customer-updated.d.ts.map +1 -0
  104. package/dist/lib/triggers/customer-updated.js +68 -0
  105. package/dist/lib/triggers/customer-updated.js.map +1 -0
  106. package/dist/lib/triggers/order-created.d.ts +19 -0
  107. package/dist/lib/triggers/order-created.d.ts.map +1 -0
  108. package/dist/lib/triggers/order-created.js +68 -0
  109. package/dist/lib/triggers/order-created.js.map +1 -0
  110. package/dist/lib/triggers/order-status-updated.d.ts +19 -0
  111. package/dist/lib/triggers/order-status-updated.d.ts.map +1 -0
  112. package/dist/lib/triggers/order-status-updated.js +68 -0
  113. package/dist/lib/triggers/order-status-updated.js.map +1 -0
  114. package/dist/lib/triggers/order-updated.d.ts +19 -0
  115. package/dist/lib/triggers/order-updated.d.ts.map +1 -0
  116. package/dist/lib/triggers/order-updated.js +68 -0
  117. package/dist/lib/triggers/order-updated.js.map +1 -0
  118. package/dist/lib/triggers/product-created.d.ts +19 -0
  119. package/dist/lib/triggers/product-created.d.ts.map +1 -0
  120. package/dist/lib/triggers/product-created.js +68 -0
  121. package/dist/lib/triggers/product-created.js.map +1 -0
  122. package/dist/lib/triggers/shipment-created.d.ts +19 -0
  123. package/dist/lib/triggers/shipment-created.d.ts.map +1 -0
  124. package/dist/lib/triggers/shipment-created.js +68 -0
  125. package/dist/lib/triggers/shipment-created.js.map +1 -0
  126. package/package.json +46 -0
  127. package/src/index.ts +81 -0
  128. package/src/lib/actions/create-a-product.ts +73 -0
  129. package/src/lib/actions/create-blog-post.ts +82 -0
  130. package/src/lib/actions/create-customer-address.ts +78 -0
  131. package/src/lib/actions/create-customer.ts +63 -0
  132. package/src/lib/actions/delete-a-product.ts +29 -0
  133. package/src/lib/actions/find-or-create-customer.ts +81 -0
  134. package/src/lib/actions/find-or-create-customers-address.ts +101 -0
  135. package/src/lib/actions/find-or-create-product.ts +81 -0
  136. package/src/lib/actions/get-order.ts +29 -0
  137. package/src/lib/actions/list-categories.ts +31 -0
  138. package/src/lib/actions/list-orders.ts +38 -0
  139. package/src/lib/actions/search-customer-address.ts +42 -0
  140. package/src/lib/actions/search-customer.ts +47 -0
  141. package/src/lib/actions/search-product.ts +69 -0
  142. package/src/lib/actions/update-a-product.ts +78 -0
  143. package/src/lib/common/auth.ts +44 -0
  144. package/src/lib/common/constants.ts +15 -0
  145. package/src/lib/common/props.ts +90 -0
  146. package/src/lib/common/requests.ts +252 -0
  147. package/src/lib/triggers/abandoned-cart.ts +58 -0
  148. package/src/lib/triggers/cart-created.ts +60 -0
  149. package/src/lib/triggers/customer-address-created.ts +60 -0
  150. package/src/lib/triggers/customer-address-updated.ts +60 -0
  151. package/src/lib/triggers/customer-created.ts +62 -0
  152. package/src/lib/triggers/customer-updated.ts +60 -0
  153. package/src/lib/triggers/order-created.ts +60 -0
  154. package/src/lib/triggers/order-status-updated.ts +60 -0
  155. package/src/lib/triggers/order-updated.ts +60 -0
  156. package/src/lib/triggers/product-created.ts +60 -0
  157. package/src/lib/triggers/shipment-created.ts +61 -0
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shipmentCreated = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/triggers/shipment-created.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
+ const TRIGGER_NAME = 'shipment created';
11
+ const CACHE_KEY = `${TRIGGER_NAME}-trigger-store-key`;
12
+ const TRIGGER_SCOPE = 'store/shipment/created';
13
+ exports.shipmentCreated = (0, pieces_framework_1.createTrigger)({
14
+ auth: auth_1.bigcommerceAuth,
15
+ name: 'shipmentCreated',
16
+ displayName: 'Shipment Created',
17
+ description: 'Triggers when a new shipment is created',
18
+ aiMetadata: {
19
+ description: 'Fires when a new shipment is created for an order in the BigCommerce store (items are shipped/fulfilled). The event identifies the new shipment.',
20
+ },
21
+ props: {},
22
+ sampleData: {
23
+ producer: 'stores/xqcaklwsso',
24
+ hash: 'd7b899890f5e0e98a3e074f018b14b07d5d89360',
25
+ created_at: 1761808595,
26
+ store_id: '1003425529',
27
+ scope: 'store/shipment/created',
28
+ data: {
29
+ type: 'shipment',
30
+ id: 2,
31
+ },
32
+ },
33
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
34
+ onEnable(context) {
35
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
36
+ const webhook = yield requests_1.bigCommerceApiService.createWebhook({
37
+ auth: context.auth.props,
38
+ payload: {
39
+ scope: TRIGGER_SCOPE,
40
+ destination: context.webhookUrl,
41
+ is_active: true,
42
+ },
43
+ });
44
+ yield context.store.put(CACHE_KEY, webhook.data.id);
45
+ });
46
+ },
47
+ onDisable(context) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ const webhookId = (yield context.store.get(CACHE_KEY));
50
+ if (webhookId) {
51
+ yield requests_1.bigCommerceApiService
52
+ .deleteWebhook({
53
+ auth: context.auth.props,
54
+ webhookId,
55
+ })
56
+ .then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
57
+ yield context.store.delete(CACHE_KEY);
58
+ }));
59
+ }
60
+ });
61
+ },
62
+ run(context) {
63
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
64
+ return [context.payload.body];
65
+ });
66
+ },
67
+ });
68
+ //# sourceMappingURL=shipment-created.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shipment-created.js","sourceRoot":"","sources":["../../../src/lib/triggers/shipment-created.ts"],"names":[],"mappings":";;;;AAAA,+GAA+G;AAC/G,qEAAqE;AACrE,gEAA2E;AAC3E,yCAAiD;AACjD,iDAA2D;AAE3D,MAAM,YAAY,GAAG,kBAAkB,CAAC;AACxC,MAAM,SAAS,GAAG,GAAG,YAAY,oBAAoB,CAAC;AACtD,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAElC,QAAA,eAAe,GAAG,IAAA,gCAAa,EAAC;IAC3C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,yCAAyC;IACtD,UAAU,EAAE;QACV,WAAW,EACT,kJAAkJ;KACrJ;IACD,KAAK,EAAE,EAAE;IACT,UAAU,EAAC;QACT,QAAQ,EAAE,mBAAmB;QAC7B,IAAI,EAAE,0CAA0C;QAChD,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,YAAY;QACtB,KAAK,EAAE,wBAAwB;QAC/B,IAAI,EAAE;YACJ,IAAI,EAAE,UAAU;YAChB,EAAE,EAAE,CAAC;SAEN;KACF;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;YACpB,MAAM,OAAO,GAAG,MAAM,gCAAqB,CAAC,aAAa,CAAC;gBACxD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACxB,OAAO,EAAE;oBACP,KAAK,EAAE,aAAa;oBACpB,WAAW,EAAE,OAAO,CAAC,UAAU;oBAC/B,SAAS,EAAE,IAAI;iBAChB;aACF,CAAC,CAAC;YAEH,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtD,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAW,CAAC;YAEjE,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,gCAAqB;qBACxB,aAAa,CAAC;oBACb,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;oBACxB,SAAS;iBACV,CAAC;qBACD,IAAI,CAAC,GAAS,EAAE;oBACf,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBACxC,CAAC,CAAA,CAAC,CAAC;YACP,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@agnocon/piece-bigcommerce",
3
+ "version": "0.1.11",
4
+ "description": "AgnoCon bigcommerce connector",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "require": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src",
17
+ "LICENSE.MIT-AP"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "vendor": "node ../scripts/vendor-ap.mjs piece-bigcommerce"
22
+ },
23
+ "dependencies": {
24
+ "@agnocon/core-utils": "0.2.0",
25
+ "@agnocon/piece-types": "0.3.1",
26
+ "@agnocon/pieces-common": "0.12.8",
27
+ "@agnocon/pieces-framework": "0.36.0",
28
+ "tslib": "2.6.2"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "20.17.6",
32
+ "typescript": "5.5.4"
33
+ },
34
+ "license": "MIT",
35
+ "agnocon": {
36
+ "originVersion": "0.1.11"
37
+ },
38
+ "publishConfig": {
39
+ "access": "restricted",
40
+ "tag": "latest"
41
+ },
42
+ "keywords": [
43
+ "agnocon",
44
+ "connector"
45
+ ]
46
+ }
package/src/index.ts ADDED
@@ -0,0 +1,81 @@
1
+ import { createPiece, PieceAuth } from '@agnocon/pieces-framework';
2
+ import { abandonedCart } from './lib/triggers/abandoned-cart';
3
+ import { cartCreated } from './lib/triggers/cart-created';
4
+ import { customerAddressCreated } from './lib/triggers/customer-address-created';
5
+ import { customerAddressUpdated } from './lib/triggers/customer-address-updated';
6
+ import { customerCreated } from './lib/triggers/customer-created';
7
+ import { customerUpdated } from './lib/triggers/customer-updated';
8
+ import { orderCreated } from './lib/triggers/order-created';
9
+ import { orderUpdated } from './lib/triggers/order-updated';
10
+ import { orderStatusUpdated } from './lib/triggers/order-status-updated';
11
+ import { productCreated } from './lib/triggers/product-created';
12
+ import { shipmentCreated } from './lib/triggers/shipment-created';
13
+ import { createCustomer } from './lib/actions/create-customer';
14
+ import { bigcommerceAuth } from './lib/common/auth';
15
+ import { createAProduct } from './lib/actions/create-a-product';
16
+ import { updateAProduct } from './lib/actions/update-a-product';
17
+ import { deleteAProduct } from './lib/actions/delete-a-product';
18
+ import { getOrder } from './lib/actions/get-order';
19
+ import { listOrders } from './lib/actions/list-orders';
20
+ import { listCategories } from './lib/actions/list-categories';
21
+ import { createBlogPost } from './lib/actions/create-blog-post';
22
+ import { createCustomerAddress } from './lib/actions/create-customer-address';
23
+ import { createCustomApiCallAction } from '@agnocon/pieces-common';
24
+ import { bigCommerceAuth, GET_BASE_URL } from './lib/common/constants';
25
+ import { searchCustomer } from './lib/actions/search-customer';
26
+ import { searchProduct } from './lib/actions/search-product';
27
+ import { searchCustomerAddress } from './lib/actions/search-customer-address';
28
+ import { findOrCreateCustomer } from './lib/actions/find-or-create-customer';
29
+ import { findOrCreateProduct } from './lib/actions/find-or-create-product';
30
+ import { findOrCreateCustomersAddress } from './lib/actions/find-or-create-customers-address';
31
+
32
+ export const bigcommerce = createPiece({
33
+ displayName: 'BigCommerce',
34
+ description:
35
+ 'BigCommerce is a leading e-commerce platform that enables businesses to create and manage online stores.',
36
+ auth: bigcommerceAuth,
37
+ minimumSupportedRelease: '0.36.1',
38
+ logoUrl: 'https://cdn.activepieces.com/pieces/bigcommerce.png',
39
+ authors: ['gs03-dev', 'sanket-a11y', 'Angelebeats'],
40
+ actions: [
41
+ createCustomer,
42
+ createAProduct,
43
+ updateAProduct,
44
+ deleteAProduct,
45
+ getOrder,
46
+ listOrders,
47
+ listCategories,
48
+ createBlogPost,
49
+ createCustomerAddress,
50
+ searchCustomer,
51
+ searchProduct,
52
+ searchCustomerAddress,
53
+ findOrCreateCustomer,
54
+ findOrCreateProduct,
55
+ findOrCreateCustomersAddress,
56
+ createCustomApiCallAction({
57
+ auth: bigcommerceAuth,
58
+ baseUrl: (auth) => auth ? GET_BASE_URL(auth.props.storeHash) : '',
59
+ authMapping: async (auth: any) => {
60
+ return {
61
+ 'X-Auth-Token': auth.props.accessToken,
62
+ 'Content-Type': 'application/json',
63
+ Accept: 'application/json',
64
+ };
65
+ },
66
+ }),
67
+ ],
68
+ triggers: [
69
+ abandonedCart,
70
+ cartCreated,
71
+ customerAddressCreated,
72
+ customerAddressUpdated,
73
+ customerCreated,
74
+ customerUpdated,
75
+ orderCreated,
76
+ orderUpdated,
77
+ orderStatusUpdated,
78
+ productCreated,
79
+ shipmentCreated,
80
+ ],
81
+ });
@@ -0,0 +1,73 @@
1
+ import { createAction, Property } from '@agnocon/pieces-framework';
2
+ import { bigcommerceAuth } from '../common/auth';
3
+ import { bigCommerceApiService } from '../common/requests';
4
+
5
+ export const createAProduct = createAction({
6
+ auth: bigcommerceAuth,
7
+ name: 'createAProduct',
8
+ displayName: 'Create a Product',
9
+ description: 'Creates a Product',
10
+ audience: 'both',
11
+ aiMetadata: {
12
+ description:
13
+ 'Creates a new catalog product in a BigCommerce store. Use to add an item to the store. Requires name, type (physical or digital), weight, and price; SKU, description, and brand_id are optional. Not idempotent: each call adds a new product, so search the catalog first if it may already exist.',
14
+ idempotent: false,
15
+ },
16
+ props: {
17
+ name: Property.ShortText({
18
+ displayName: 'Product Name',
19
+ description: 'Name of the product',
20
+ required: true,
21
+ }),
22
+ type: Property.StaticDropdown({
23
+ displayName: 'Product Type',
24
+ description: 'Type of product',
25
+ required: true,
26
+ options: {
27
+ options: [
28
+ { label: 'Physical', value: 'physical' },
29
+ { label: 'Digital', value: 'digital' },
30
+ ],
31
+ },
32
+ }),
33
+ sku: Property.ShortText({
34
+ displayName: 'SKU',
35
+ description: 'Product SKU',
36
+ required: false,
37
+ }),
38
+ description: Property.LongText({
39
+ displayName: 'Description',
40
+ description: 'Product description',
41
+ required: false,
42
+ }),
43
+ weight: Property.Number({
44
+ displayName: 'Weight',
45
+ description: 'Product weight',
46
+ required: true,
47
+ }),
48
+ price: Property.Number({
49
+ displayName: 'Price',
50
+ description: 'Product price',
51
+ required: true,
52
+ }),
53
+ brand_id: Property.Number({
54
+ displayName: 'Brand ID',
55
+ description: 'Brand ID',
56
+ required: false,
57
+ }),
58
+ },
59
+ async run(context) {
60
+ return await bigCommerceApiService.createProduct({
61
+ auth: context.auth.props,
62
+ payload: {
63
+ name: context.propsValue.name,
64
+ type: context.propsValue.type,
65
+ sku: context.propsValue.sku,
66
+ description: context.propsValue.description,
67
+ weight: context.propsValue.weight,
68
+ price: context.propsValue.price,
69
+ brand_id: context.propsValue.brand_id,
70
+ },
71
+ });
72
+ },
73
+ });
@@ -0,0 +1,82 @@
1
+ import { createAction, Property } from '@agnocon/pieces-framework';
2
+ import { bigcommerceAuth } from '../common/auth';
3
+ import { bigCommerceApiService } from '../common/requests';
4
+
5
+ export const createBlogPost = createAction({
6
+ auth: bigcommerceAuth,
7
+ name: 'createBlogPost',
8
+ displayName: 'Create Blog Post',
9
+ description: 'Creates a blog post',
10
+ audience: 'both',
11
+ aiMetadata: {
12
+ description:
13
+ "Creates a blog post in a BigCommerce store's blog. Requires a title and body (HTML supported); author, URL, published date, meta description/keywords, tags, and a published flag are optional. Use to publish store blog content. Not idempotent: each call creates a new post.",
14
+ idempotent: false,
15
+ },
16
+ props: {
17
+ title: Property.ShortText({
18
+ displayName: 'Title',
19
+ description: 'Blog post title',
20
+ required: true,
21
+ }),
22
+ body: Property.LongText({
23
+ displayName: 'Body',
24
+ description: 'Blog post content (HTML supported)',
25
+ required: true,
26
+ }),
27
+ author: Property.ShortText({
28
+ displayName: 'Author',
29
+ description: 'Author name',
30
+ required: false,
31
+ }),
32
+ url: Property.ShortText({
33
+ displayName: 'URL',
34
+ description:
35
+ 'URL for the public blog post. Example - /blog/welcome-bigcommerce/',
36
+ required: false,
37
+ }),
38
+ published_date: Property.DateTime({
39
+ displayName: 'Published Date',
40
+ description:
41
+ 'Published Date for the blog post. Example - Wed, 10 Aug 2022 15:39:15 -0500',
42
+ required: false,
43
+ }),
44
+ meta_description: Property.LongText({
45
+ displayName: 'Meta Description',
46
+ description: 'Description text for this blog post’s <meta/> element.',
47
+ required: false,
48
+ }),
49
+ meta_keywords: Property.LongText({
50
+ displayName: 'Meta Keywords',
51
+ description: 'Comma seperated (,) Keywords for this blog post’s <meta/> element. Eg welcome, bigcommerce',
52
+ required: false,
53
+ }),
54
+ tags: Property.Array({
55
+ displayName: 'Tags',
56
+ description: 'Array of tags',
57
+ required: false,
58
+ }),
59
+ is_published: Property.Checkbox({
60
+ displayName: 'Is Published',
61
+ description: 'Whether the post is published',
62
+ required: false,
63
+ defaultValue: true,
64
+ }),
65
+ },
66
+ async run(context) {
67
+ return await bigCommerceApiService.createBlogPost({
68
+ auth: context.auth.props,
69
+ payload: {
70
+ title: context.propsValue.title,
71
+ body: context.propsValue.body,
72
+ author: context.propsValue.author,
73
+ tags: context.propsValue.tags,
74
+ is_published: context.propsValue.is_published,
75
+ meta_description: context.propsValue.meta_description,
76
+ meta_keywords: context.propsValue.meta_keywords,
77
+ published_date: context.propsValue.published_date,
78
+ url: context.propsValue.url,
79
+ },
80
+ });
81
+ },
82
+ });
@@ -0,0 +1,78 @@
1
+ import { createAction, Property } from '@agnocon/pieces-framework';
2
+ import { bigcommerceAuth } from '../common/auth';
3
+ import { customerDropdown } from '../common/props';
4
+ import { bigCommerceApiService } from '../common/requests';
5
+
6
+ export const createCustomerAddress = createAction({
7
+ auth: bigcommerceAuth,
8
+ name: 'createCustomerAddress',
9
+ displayName: 'Create Customer Address',
10
+ description: "Creates a customer's address",
11
+ audience: 'both',
12
+ aiMetadata: {
13
+ description:
14
+ 'Adds a new address to an existing BigCommerce customer, identified by customer_id (selected from a dropdown of store customers). Requires name, address line 1, city, state/province, postal code, and an ISO 3166-1 alpha-2 country code. Use to attach a shipping or billing address to a customer. Not idempotent: each call appends a new address even if an identical one exists, so use Find or Create Customer’s Address to avoid duplicates.',
15
+ idempotent: false,
16
+ },
17
+ props: {
18
+ customer_id: customerDropdown({
19
+ required: true
20
+ }),
21
+ first_name: Property.ShortText({
22
+ displayName: 'First Name',
23
+ required: true,
24
+ }),
25
+ last_name: Property.ShortText({
26
+ displayName: 'Last Name',
27
+ required: true,
28
+ }),
29
+ address1: Property.ShortText({
30
+ displayName: 'Address Line 1',
31
+ required: true,
32
+ }),
33
+ address2: Property.ShortText({
34
+ displayName: 'Address Line 2',
35
+ required: false,
36
+ }),
37
+ city: Property.ShortText({
38
+ displayName: 'City',
39
+ required: true,
40
+ }),
41
+ state_or_province: Property.ShortText({
42
+ displayName: 'State/Province',
43
+ required: true,
44
+ }),
45
+ postal_code: Property.ShortText({
46
+ displayName: 'Postal Code',
47
+ required: true,
48
+ }),
49
+ country_code: Property.ShortText({
50
+ displayName: 'Country Code',
51
+ description: 'ISO 3166-1 alpha-2 country code',
52
+ required: true,
53
+ }),
54
+ phone: Property.ShortText({
55
+ displayName: 'Phone',
56
+ required: false,
57
+ }),
58
+ },
59
+ async run(context) {
60
+ return await bigCommerceApiService.createCustomerAddress({
61
+ auth: context.auth.props,
62
+ payload: [
63
+ {
64
+ customer_id: context.propsValue.customer_id,
65
+ first_name: context.propsValue.first_name,
66
+ last_name: context.propsValue.last_name,
67
+ address1: context.propsValue.address1,
68
+ address2: context.propsValue.address2,
69
+ city: context.propsValue.city,
70
+ state_or_province: context.propsValue.state_or_province,
71
+ postal_code: context.propsValue.postal_code,
72
+ country_code: context.propsValue.country_code,
73
+ phone: context.propsValue.phone,
74
+ },
75
+ ],
76
+ });
77
+ },
78
+ });
@@ -0,0 +1,63 @@
1
+ import { createAction, Property } from '@agnocon/pieces-framework';
2
+ import { bigcommerceAuth } from '../common/auth';
3
+ import { bigCommerceApiService } from '../common/requests';
4
+
5
+ export const createCustomer = createAction({
6
+ auth: bigcommerceAuth,
7
+ name: 'createCustomer',
8
+ displayName: 'Create Customer',
9
+ description: 'Creates a customer',
10
+ audience: 'both',
11
+ aiMetadata: {
12
+ description:
13
+ 'Creates a new customer record in a BigCommerce store from an email plus first/last name (company, phone, and notes optional). Use to register a shopper or contact. Not idempotent: each call adds a new customer, and BigCommerce rejects a duplicate email rather than returning the existing one, so call Search Customer or Find or Create Customer first if the customer may already exist.',
14
+ idempotent: false,
15
+ },
16
+ props: {
17
+ email: Property.ShortText({
18
+ displayName: 'Email',
19
+ description: 'Customer email address',
20
+ required: true,
21
+ }),
22
+ first_name: Property.ShortText({
23
+ displayName: 'First Name',
24
+ description: 'Customer first name',
25
+ required: true,
26
+ }),
27
+ last_name: Property.ShortText({
28
+ displayName: 'Last Name',
29
+ description: 'Customer last name',
30
+ required: true,
31
+ }),
32
+ company: Property.ShortText({
33
+ displayName: 'Company',
34
+ description: 'Customer company name',
35
+ required: false,
36
+ }),
37
+ phone: Property.ShortText({
38
+ displayName: 'Phone',
39
+ description: 'Customer phone number',
40
+ required: false,
41
+ }),
42
+ notes: Property.LongText({
43
+ displayName: 'Notes',
44
+ description: 'Customer notes',
45
+ required: false,
46
+ }),
47
+ },
48
+ async run(context) {
49
+ return await bigCommerceApiService.createCustomer({
50
+ auth: context.auth.props,
51
+ payload: [
52
+ {
53
+ email: context.propsValue.email,
54
+ first_name: context.propsValue.first_name,
55
+ last_name: context.propsValue.last_name,
56
+ company: context.propsValue.company,
57
+ phone: context.propsValue.phone,
58
+ notes: context.propsValue.notes,
59
+ },
60
+ ],
61
+ });
62
+ },
63
+ });
@@ -0,0 +1,29 @@
1
+ import { createAction, Property } from '@agnocon/pieces-framework';
2
+ import { bigcommerceAuth } from '../common/auth';
3
+ import { bigCommerceApiService } from '../common/requests';
4
+
5
+ export const deleteAProduct = createAction({
6
+ auth: bigcommerceAuth,
7
+ name: 'deleteAProduct',
8
+ displayName: 'Delete a Product',
9
+ description: 'Deletes an existing Product',
10
+ audience: 'both',
11
+ aiMetadata: {
12
+ description:
13
+ 'Permanently deletes a catalog product from a BigCommerce store by its productId. Use to remove an item from the store. This is destructive and cannot be undone. Effectively idempotent: deleting an already-removed product has no further effect, though the call may error if the id no longer exists.',
14
+ idempotent: true,
15
+ },
16
+ props: {
17
+ productId: Property.ShortText({
18
+ displayName: 'Product ID',
19
+ description: 'The ID of the product to delete',
20
+ required: true,
21
+ }),
22
+ },
23
+ async run(context) {
24
+ return await bigCommerceApiService.deleteProduct({
25
+ auth: context.auth.props,
26
+ productId: context.propsValue.productId,
27
+ });
28
+ },
29
+ });
@@ -0,0 +1,81 @@
1
+ import { createAction, Property } from '@agnocon/pieces-framework';
2
+ import { bigcommerceAuth } from '../common/auth';
3
+ import { bigCommerceApiService } from '../common/requests';
4
+
5
+ export const findOrCreateCustomer = createAction({
6
+ auth: bigcommerceAuth,
7
+ name: 'findOrCreateCustomer',
8
+ displayName: 'Find or Create Customer',
9
+ description: 'Finds or creates a customer',
10
+ audience: 'both',
11
+ aiMetadata: {
12
+ description:
13
+ 'Looks up a BigCommerce customer by email (and phone if given) and returns the match if found, otherwise creates a new customer from the supplied details. Use this instead of Create Customer when the customer may already exist, to avoid duplicate-email errors. Idempotent: repeated calls match the same existing record rather than creating duplicates.',
14
+ idempotent: true,
15
+ },
16
+ props: {
17
+ email: Property.ShortText({
18
+ displayName: 'Email',
19
+ description: 'Customer email address',
20
+ required: true,
21
+ }),
22
+ first_name: Property.ShortText({
23
+ displayName: 'First Name',
24
+ description: 'Customer first name',
25
+ required: true,
26
+ }),
27
+ last_name: Property.ShortText({
28
+ displayName: 'Last Name',
29
+ description: 'Customer last name',
30
+ required: true,
31
+ }),
32
+ company: Property.ShortText({
33
+ displayName: 'Company',
34
+ description: 'Customer company name',
35
+ required: false,
36
+ }),
37
+ phone: Property.ShortText({
38
+ displayName: 'Phone',
39
+ description: 'Customer phone number',
40
+ required: false,
41
+ }),
42
+ notes: Property.LongText({
43
+ displayName: 'Notes',
44
+ description: 'Customer notes',
45
+ required: false,
46
+ }),
47
+ },
48
+ async run(context) {
49
+ const params = new URLSearchParams();
50
+
51
+ params.append('email:in', context.propsValue.email);
52
+
53
+ if (context.propsValue.phone)
54
+ params.append('phone:in', context.propsValue.phone);
55
+
56
+ const response = await bigCommerceApiService.fetchCustomers({
57
+ auth: context.auth.props,
58
+ queryString: params.toString(),
59
+ });
60
+
61
+ if (response.data && response.data.length > 0) {
62
+ return { found: true, data: response.data };
63
+ }
64
+
65
+ const newCustomer = await bigCommerceApiService.createCustomer({
66
+ auth: context.auth.props,
67
+ payload: [
68
+ {
69
+ email: context.propsValue.email,
70
+ first_name: context.propsValue.first_name,
71
+ last_name: context.propsValue.last_name,
72
+ company: context.propsValue.company,
73
+ phone: context.propsValue.phone,
74
+ notes: context.propsValue.notes,
75
+ },
76
+ ],
77
+ });
78
+
79
+ return { found: false, data: newCustomer.data };
80
+ },
81
+ });