@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,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bigCommerceApiService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/common/requests.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ const constants_1 = require("./constants");
9
+ function fireHttpRequest(_a) {
10
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ method, path, body, auth, filter = false, }) {
11
+ const BASE_URL = (0, constants_1.GET_BASE_URL)(auth.storeHash);
12
+ const cleanBody = filter && body ? (Array.isArray(body)
13
+ ? body.map(item => filterNulls(item))
14
+ : filterNulls(body)) : body;
15
+ return yield pieces_common_1.httpClient
16
+ .sendRequest({
17
+ method,
18
+ url: `${BASE_URL}${path}`,
19
+ headers: {
20
+ 'X-Auth-Token': auth.accessToken,
21
+ 'Content-Type': 'application/json',
22
+ Accept: 'application/json',
23
+ },
24
+ body: cleanBody,
25
+ })
26
+ .then((res) => res.body)
27
+ .catch((err) => {
28
+ throw new Error(`Error in request to ${path}: ${err.message || JSON.stringify(err)}`);
29
+ });
30
+ });
31
+ }
32
+ exports.bigCommerceApiService = {
33
+ createWebhook(_a) {
34
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, payload, }) {
35
+ return yield fireHttpRequest({
36
+ auth,
37
+ path: '/v3/hooks',
38
+ method: pieces_common_1.HttpMethod.POST,
39
+ body: payload,
40
+ });
41
+ });
42
+ },
43
+ createCustomer(_a) {
44
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, payload, }) {
45
+ return yield fireHttpRequest({
46
+ auth,
47
+ path: '/v3/customers',
48
+ method: pieces_common_1.HttpMethod.POST,
49
+ body: payload,
50
+ });
51
+ });
52
+ },
53
+ fetchCustomers(_a) {
54
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, queryString, }) {
55
+ return yield fireHttpRequest({
56
+ auth,
57
+ path: `/v3/customers${queryString ? `?${queryString}` : ''}`,
58
+ method: pieces_common_1.HttpMethod.GET,
59
+ });
60
+ });
61
+ },
62
+ fetchCustomerAddresses(_a) {
63
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, queryString, }) {
64
+ return yield fireHttpRequest({
65
+ auth,
66
+ path: `/v3/customers/addresses${queryString ? `?${queryString}` : ''}`,
67
+ method: pieces_common_1.HttpMethod.GET,
68
+ });
69
+ });
70
+ },
71
+ fetchProducts(_a) {
72
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, queryString, }) {
73
+ return yield fireHttpRequest({
74
+ auth,
75
+ path: `/v3/catalog/products${queryString ? `?${queryString}` : ''}`,
76
+ method: pieces_common_1.HttpMethod.GET,
77
+ });
78
+ });
79
+ },
80
+ createProduct(_a) {
81
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, payload, }) {
82
+ return yield fireHttpRequest({
83
+ auth,
84
+ path: '/v3/catalog/products',
85
+ method: pieces_common_1.HttpMethod.POST,
86
+ body: payload,
87
+ filter: true,
88
+ });
89
+ });
90
+ },
91
+ updateProduct(_a) {
92
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, productId, payload, }) {
93
+ return yield fireHttpRequest({
94
+ auth,
95
+ path: `/v3/catalog/products/${productId}`,
96
+ method: pieces_common_1.HttpMethod.PUT,
97
+ body: payload,
98
+ filter: true,
99
+ });
100
+ });
101
+ },
102
+ deleteProduct(_a) {
103
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, productId, }) {
104
+ return yield fireHttpRequest({
105
+ auth,
106
+ path: `/v3/catalog/products/${productId}`,
107
+ method: pieces_common_1.HttpMethod.DELETE,
108
+ });
109
+ });
110
+ },
111
+ fetchOrders(_a) {
112
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, queryString, }) {
113
+ return yield fireHttpRequest({
114
+ auth,
115
+ path: `/v2/orders${queryString ? `?${queryString}` : ''}`,
116
+ method: pieces_common_1.HttpMethod.GET,
117
+ });
118
+ });
119
+ },
120
+ fetchOrder(_a) {
121
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, orderId, }) {
122
+ return yield fireHttpRequest({
123
+ auth,
124
+ path: `/v2/orders/${orderId}`,
125
+ method: pieces_common_1.HttpMethod.GET,
126
+ });
127
+ });
128
+ },
129
+ fetchCategories(_a) {
130
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, queryString, }) {
131
+ return yield fireHttpRequest({
132
+ auth,
133
+ path: `/v3/catalog/categories${queryString ? `?${queryString}` : ''}`,
134
+ method: pieces_common_1.HttpMethod.GET,
135
+ });
136
+ });
137
+ },
138
+ createBlogPost(_a) {
139
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, payload, }) {
140
+ return yield fireHttpRequest({
141
+ auth,
142
+ path: '/v2/blog/posts',
143
+ method: pieces_common_1.HttpMethod.POST,
144
+ body: payload,
145
+ });
146
+ });
147
+ },
148
+ createCustomerAddress(_a) {
149
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, payload, }) {
150
+ return yield fireHttpRequest({
151
+ auth,
152
+ path: '/v3/customers/addresses',
153
+ method: pieces_common_1.HttpMethod.POST,
154
+ body: payload,
155
+ });
156
+ });
157
+ },
158
+ deleteWebhook(_a) {
159
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookId, }) {
160
+ return yield fireHttpRequest({
161
+ auth,
162
+ path: `/v3/hooks/${webhookId}`,
163
+ method: pieces_common_1.HttpMethod.DELETE,
164
+ });
165
+ });
166
+ },
167
+ };
168
+ function filterNulls(obj) {
169
+ if (obj === null || obj === undefined)
170
+ return undefined;
171
+ if (typeof obj !== 'object')
172
+ return obj;
173
+ if (Array.isArray(obj))
174
+ return obj.map(filterNulls);
175
+ return Object.fromEntries(Object.entries(obj)
176
+ .filter(([_, v]) => v !== null && v !== undefined)
177
+ .map(([k, v]) => [k, filterNulls(v)]));
178
+ }
179
+ //# sourceMappingURL=requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.js","sourceRoot":"","sources":["../../../src/lib/common/requests.ts"],"names":[],"mappings":";;;;AAAA,qGAAqG;AACrG,qEAAqE;AACrE,0DAAgE;AAChE,2CAA4D;AAE5D,SAAe,eAAe;iEAAC,EAC7B,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,GAAG,KAAK,GAOf;QACC,MAAM,QAAQ,GAAG,IAAA,wBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE9C,MAAM,SAAS,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YACrD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACrC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAG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IAAI,EACJ,SAAS,GAIV;YACC,OAAO,MAAM,eAAe,CAAC;gBAC3B,IAAI;gBACJ,IAAI,EAAE,aAAa,SAAS,EAAE;gBAC9B,MAAM,EAAE,0BAAU,CAAC,MAAM;aAC1B,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC;AAEF,SAAS,WAAW,CAAC,GAAY;IAC/B,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxD,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAA8B,CAAC;SAC3C,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,CAAC;SACjD,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const abandonedCart: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
4
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
6
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
7
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
8
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
9
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
11
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
12
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
13
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
14
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, 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
+ }>, {}>;
19
+ //# sourceMappingURL=abandoned-cart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abandoned-cart.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/abandoned-cart.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;OAiDxB,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.abandonedCart = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/triggers/abandoned-cart.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 = 'abandoned cart';
11
+ const CACHE_KEY = `${TRIGGER_NAME}-trigger-store-key`;
12
+ const TRIGGER_SCOPE = 'store/cart/abandoned';
13
+ exports.abandonedCart = (0, pieces_framework_1.createTrigger)({
14
+ auth: auth_1.bigcommerceAuth,
15
+ name: 'abandonedCart',
16
+ displayName: 'Abandoned Cart',
17
+ description: 'Triggers when a cart is abandoned',
18
+ aiMetadata: {
19
+ description: 'Fires when a shopper abandons a cart in the BigCommerce store (the cart sits inactive without checkout completing). The event identifies the affected cart; use it to drive abandoned-cart recovery flows.',
20
+ },
21
+ props: {},
22
+ sampleData: {
23
+ producer: 'stores/dxqdddcaklwsso',
24
+ hash: '3610addd127e330084ddddd7ddd09b78abfd1a85',
25
+ created_at: 1761809622,
26
+ store_id: '1003425529',
27
+ scope: 'store/cart/abandoned',
28
+ data: {
29
+ type: 'cart',
30
+ id: 'ss-598f-4c95-813b-0ess950562770d',
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.deleteWebhook({
52
+ auth: context.auth.props,
53
+ webhookId,
54
+ }).then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
55
+ yield context.store.delete(CACHE_KEY);
56
+ }));
57
+ }
58
+ });
59
+ },
60
+ run(context) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ return [context.payload.body];
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=abandoned-cart.js.map
@@ -0,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AC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAW,CAAC;YAE/D,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,gCAAqB,CAAC,aAAa,CAAC;oBACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;oBACxB,SAAS;iBACV,CAAC,CAAC,IAAI,CAAC,GAAS,EAAE;oBACjB,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;gBACvC,CAAC,CAAA,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const cartCreated: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
4
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
6
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
7
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
8
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
9
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
11
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
12
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
13
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
14
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, 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
+ }>, {}>;
19
+ //# sourceMappingURL=cart-created.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-created.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/cart-created.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ3E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;OAmDtB,CAAC"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cartCreated = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/triggers/cart-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 = 'cart created';
11
+ const CACHE_KEY = `${TRIGGER_NAME}-trigger-store-key`;
12
+ const TRIGGER_SCOPE = 'store/cart/created';
13
+ exports.cartCreated = (0, pieces_framework_1.createTrigger)({
14
+ auth: auth_1.bigcommerceAuth,
15
+ name: 'cartCreated',
16
+ displayName: 'Cart Created',
17
+ description: 'Triggers when a new cart is created',
18
+ aiMetadata: {
19
+ description: 'Fires when a new shopping cart is created in the BigCommerce store (a shopper adds the first item to a fresh cart). The event identifies the new cart.',
20
+ },
21
+ props: {},
22
+ sampleData: {
23
+ producer: 'stores/dxqdddcaklwsso',
24
+ hash: '3610addd127e330084ddddd7ddd09b78abfd1a85',
25
+ created_at: 1761809622,
26
+ store_id: '1003425529',
27
+ scope: 'store/cart/created',
28
+ data: {
29
+ type: 'cart',
30
+ id: 'ss-598f-4c95-813b-0ess950562770d',
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=cart-created.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-created.js","sourceRoot":"","sources":["../../../src/lib/triggers/cart-created.ts"],"names":[],"mappings":";;;;AAAA,2GAA2G;AAC3G,qEAAqE;AACrE,gEAA2E;AAC3E,yCAAiD;AACjD,iDAA2D;AAE3D,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,SAAS,GAAG,GAAG,YAAY,oBAAoB,CAAC;AACtD,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE9B,QAAA,WAAW,GAAG,IAAA,gCAAa,EAAC;IACvC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,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CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const customerAddressCreated: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
4
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
6
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
7
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
8
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
9
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
11
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
12
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
13
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
14
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, 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
+ }>, {}>;
19
+ //# sourceMappingURL=customer-address-created.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-address-created.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/customer-address-created.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ3E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;OAmDjC,CAAC"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customerAddressCreated = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/triggers/customer-address-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 = 'customer address created';
11
+ const CACHE_KEY = `${TRIGGER_NAME}-trigger-store-key`;
12
+ const TRIGGER_SCOPE = 'store/customer/address/created';
13
+ exports.customerAddressCreated = (0, pieces_framework_1.createTrigger)({
14
+ auth: auth_1.bigcommerceAuth,
15
+ name: 'customerAddressCreated',
16
+ displayName: 'Customer Address Created',
17
+ description: 'Triggers when a new customer address is created',
18
+ aiMetadata: {
19
+ description: 'Fires when a new address is added to a customer in the BigCommerce store. The event identifies the affected customer.',
20
+ },
21
+ props: {},
22
+ sampleData: {
23
+ producer: 'stores/xqcaklwsso',
24
+ hash: 'd7b899890f5e0e98a3e074f018b14b07d5d89360',
25
+ created_at: 1761808595,
26
+ store_id: '1003425529',
27
+ scope: 'store/customer/address/created',
28
+ data: {
29
+ type: 'customer',
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=customer-address-created.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-address-created.js","sourceRoot":"","sources":["../../../src/lib/triggers/customer-address-created.ts"],"names":[],"mappings":";;;;AAAA,uHAAuH;AACvH,qEAAqE;AACrE,gEAA2E;AAC3E,yCAAiD;AACjD,iDAA2D;AAE3D,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAChD,MAAM,SAAS,GAAG,GAAG,YAAY,oBAAoB,CAAC;AACtD,MAAM,aAAa,GAAG,gCAAgC,CAAC;AAE1C,QAAA,sBAAsB,GAAG,IAAA,gCAAa,EAAC;IAClD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,iDAAiD;IAC9D,UAAU,EAAE;QACV,WAAW,EACT,uHAAuH;KAC1H;IACD,KAAK,EAAE,EAAE;IACT,UAAU,EAAE;QACV,QAAQ,EAAE,mBAAmB;QAC7B,IAAI,EAAE,0CAA0C;QAChD,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,YAAY;QACtB,KAAK,EAAE,gCAAgC;QACvC,IAAI,EAAE;YACJ,IAAI,EAAE,UAAU;YAChB,EAAE,EAAE,CAAC;SACN;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"}
@@ -0,0 +1,19 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const customerAddressUpdated: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
4
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
6
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
7
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
8
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
9
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
11
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
12
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
13
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
14
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, 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
+ }>, {}>;
19
+ //# sourceMappingURL=customer-address-updated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-address-updated.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/customer-address-updated.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ3E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;OAmDjC,CAAC"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customerAddressUpdated = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bigcommerce/src/lib/triggers/customer-address-updated.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 = 'customer address updated';
11
+ const CACHE_KEY = `${TRIGGER_NAME}-trigger-store-key`;
12
+ const TRIGGER_SCOPE = 'store/customer/address/updated';
13
+ exports.customerAddressUpdated = (0, pieces_framework_1.createTrigger)({
14
+ auth: auth_1.bigcommerceAuth,
15
+ name: 'customerAddressUpdated',
16
+ displayName: 'Customer Address Updated',
17
+ description: 'Triggers when a new customer address is updated',
18
+ aiMetadata: {
19
+ description: 'Fires when an existing customer address is updated in the BigCommerce store. The event identifies the affected customer.',
20
+ },
21
+ props: {},
22
+ sampleData: {
23
+ producer: 'stores/xqcaklwsso',
24
+ hash: 'd7b899890f5e0e98a3e074f018b14b07d5d89360',
25
+ created_at: 1761808595,
26
+ store_id: '1003425529',
27
+ scope: 'store/customer/address/updated',
28
+ data: {
29
+ type: 'customer',
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=customer-address-updated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-address-updated.js","sourceRoot":"","sources":["../../../src/lib/triggers/customer-address-updated.ts"],"names":[],"mappings":";;;;AAAA,uHAAuH;AACvH,qEAAqE;AACrE,gEAA2E;AAC3E,yCAAiD;AACjD,iDAA2D;AAE3D,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAChD,MAAM,SAAS,GAAG,GAAG,YAAY,oBAAoB,CAAC;AACtD,MAAM,aAAa,GAAG,gCAAgC,CAAC;AAE1C,QAAA,sBAAsB,GAAG,IAAA,gCAAa,EAAC;IAClD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,iDAAiD;IAC9D,UAAU,EAAE;QACV,WAAW,EACT,0HAA0H;KAC7H;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,gCAAgC;QACvC,IAAI,EAAE;YACJ,IAAI,EAAE,UAAU;YAChB,EAAE,EAAE,CAAC;SACN;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"}
@@ -0,0 +1,19 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const customerCreated: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
4
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
6
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
7
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
8
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
9
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
11
+ instruction: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
12
+ storeHash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
13
+ accessToken: import("@agnocon/pieces-framework").ShortTextProperty<true>;
14
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, 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
+ }>, {}>;
19
+ //# sourceMappingURL=customer-created.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-created.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/customer-created.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ3E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;OAqD1B,CAAC"}