Initial commit

This commit is contained in:
2025-10-02 08:54:03 +02:00
commit ea54638227
1642 changed files with 53677 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
const { bigcommerceApiOAuth, serverBaseURL, bigcommerceStoreHash } = require("../config.js")
;(function () {
const data = context.data
if (context?.user?.auth()?.id) {
if (context.data.type === "printful") {
throw {
status: 500,
message: "Printful webhooks update are not supported",
}
} else {
let url = `https://api.bigcommerce.com/stores/${bigcommerceStoreHash}/v3/hooks/${context.data.webhookId}`
let options = {
method: "PUT",
headers: { "Content-Type": "application/json", "X-Auth-Token": bigcommerceApiOAuth },
body: JSON.stringify({
scope: context?.data?.scope,
destination: `${serverBaseURL}webhook`,
is_active: context?.data?.active,
events_history_enabled: true,
headers: { token: "super_secure_and_extremely_secret_big_commerce_webhook_token_123" },
}),
}
const response = context.http.fetch(url, options).body.json()
}
}
})()