Skip to content
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"prettier": "^3.3.3",
"start-server-and-test": "^2.0.8",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
"typescript": "^5.9.3"
},
"browserslist": [
"since 2017-06"
Expand Down
102 changes: 53 additions & 49 deletions src/adapters/ecommerce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export default async (tracker: SnowplowTracker): Promise<void> => {
return;
}

const environments = context.environment.split(',').map(env => env.trim()).filter(env => env.length > 0);
const environments = context.environment
.split(",")
.map((env) => env.trim())
.filter((env) => env.length > 0);

for (const env of environments) {
switch (env) {
Expand Down Expand Up @@ -169,55 +172,56 @@ export default async (tracker: SnowplowTracker): Promise<void> => {
// description: "tnew is a just a test description"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }]
break;
case "weave":
import("../shared/environment-data-sources/weave").then(({ default: load }): void => load());
// description: "weave is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "webjoint":
import("../shared/environment-data-sources/webjoint").then(({ default: load }): void => load());
// description: "webjoint is a just a test description"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "wefunder":
import("../shared/environment-data-sources/wefunder").then(({ default: load }): void => load());
// description: "wefunder is a just a test description"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "wix":
import("../shared/environment-data-sources/wix").then(({ default: load }): void => load());
// description: "wix is a just a test description"
// events-tracked: [{ value: "add_to_cart", label: "Add to Cart" }, { value: "remove_from_cart", label: "Remove from Cart" }, { "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "woocommerce":
import("../shared/environment-data-sources/woocommerce").then(({ default: load }): void => load());
// description: "woocommerce is a just a test description"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "yotpo":
import("../shared/environment-data-sources/yotpo").then(({ default: load }): void => load());
// description: "yotpo is a just a test description"
// events-tracked: [{ value: "add_to_cart", label: "Add to Cart" }, { value: "remove_from_cart", label: "Remove from Cart" }, { "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "flowhub":
import("../shared/environment-data-sources/flowhub").then(({ default: load }): void => load(tracker));
// description: "flowhub is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }]
break;
case "thirdparty":
import("../shared/environment-data-sources/thirdparty").then(({ default: load }): void => load());
// description: "thirdparty is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }]
break;
case "carrot":
import("../shared/environment-data-sources/carrot").then(({ default: load }): void => load(tracker));
// description: "carrot is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }]
break;
case "weave":
import("../shared/environment-data-sources/weave").then(({ default: load }): void => load());
// description: "weave is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "webjoint":
import("../shared/environment-data-sources/webjoint").then(({ default: load }): void => load());
// description: "webjoint is a just a test description"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "wefunder":
import("../shared/environment-data-sources/wefunder").then(({ default: load }): void => load());
// description: "wefunder is a just a test description"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "wix":
import("../shared/environment-data-sources/wix").then(({ default: load }): void => load());
// description: "wix is a just a test description"
// events-tracked: [{ value: "add_to_cart", label: "Add to Cart" }, { value: "remove_from_cart", label: "Remove from Cart" }, { "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "woocommerce":
import("../shared/environment-data-sources/woocommerce").then(({ default: load }): void => load());
// description: "woocommerce is a just a test description"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "yotpo":
import("../shared/environment-data-sources/yotpo").then(({ default: load }): void => load());
// description: "yotpo is a just a test description"
// events-tracked: [{ value: "add_to_cart", label: "Add to Cart" }, { value: "remove_from_cart", label: "Remove from Cart" }, { "value": "transaction", "label": "Transaction" }, { "value": "basket_items", "label": "Basket Items" }]
break;
case "flowhub":
import("../shared/environment-data-sources/flowhub").then(({ default: load }): void => load(tracker));
// description: "flowhub is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }]
break;
case "thirdparty":
import("../shared/environment-data-sources/thirdparty").then(({ default: load }): void => load());
// description: "thirdparty is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }]
break;
case "carrot":
import("../shared/environment-data-sources/carrot").then(({ default: load }): void => load(tracker));
// description: "carrot is a just a test descriptions"
// events-tracked: [{ "value": "transaction", "label": "Transaction" }]
break;

default:
logger.warn("No event/environment specified, Only pageview is active");
break;
default:
logger.warn("No event/environment specified, Only pageview is active");
break;
}
}
};
}
2 changes: 1 addition & 1 deletion src/shared/environment-data-sources/foxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const foxyDataSource = () => {
city: "N/A",
state: "N/A",
country: "N/A",
couponCode: transaction.coupon || "N/A",
couponCode: transaction?.coupon || "N/A",
discount: 0,
currency: "USD",
items: products.map((product) => {
Expand Down
4 changes: 3 additions & 1 deletion src/shared/environment-data-sources/tymber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const tymberDataSource = () => {
try {
const transaction = data.ecommerce.actionField;
const products = data.ecommerce.products;
const { id, revenue, tax } = transaction;
const { id, revenue, tax, coupon } = transaction;

observable.notify({
transactionEvent: {
Expand All @@ -55,6 +55,8 @@ const tymberDataSource = () => {
tax: parseFloat(tax),
shipping: 0,
city: "N/A",
couponCode: coupon || "N/A",
discount: 0,
state: "N/A",
country: "N/A",
currency: "USD",
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/get-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getContext = (): QueryStringContext => {
return {
appId: appId || mediajelAppId, // Legacy support for old universal tag
version: version || "1", // tracker version
environment: params.environment || "production",
environment: params.environment || "thirdparty",
collector: params.test ? process.env.MJ_STAGING_COLLECTOR_URL : process.env.MJ_PRODUCTION_COLLECTOR_URL,
// Regex mainly used to remove the "&amp;" and the '\\"' from the outerHTML
tag: target.outerHTML.replace(/&amp;/g, "&").replace(/\\"/g, '"'),
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6375,10 +6375,10 @@ typescript@^4.5.4:
resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz"
integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==

typescript@^5.6.3:
version "5.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==
typescript@^5.9.3:
version "5.9.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==

uc.micro@^2.0.0, uc.micro@^2.1.0:
version "2.1.0"
Expand Down