Skip to content

Commit

Permalink
sync: master to develop
Browse files Browse the repository at this point in the history
sync: master to develop
  • Loading branch information
ovh-ux-cds authored Oct 22, 2024
2 parents b7e6569 + f79f55e commit ffecea3
Show file tree
Hide file tree
Showing 361 changed files with 1,715 additions and 3,522 deletions.
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sonar.projectName=manager
sonar.sources=.
sonar.sourceEncoding=UTF-8
sonar.ws.timeout=60
sonar.projectVersion=tungsten-raccoon-5
sonar.projectVersion=tungsten-raccoon-6

sonar.exclusions=node_modules/**, **/node_modules/**, **/dist/**, **/semantic/**, **/coverage/**, **/static/**, **/mock/**, **/mockServiceWorker.js
sonar.coverage.exclusions=**/*.spec.js
Expand Down
8 changes: 8 additions & 0 deletions packages/components/ng-at-internet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [5.11.14](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-21)

**Note:** Version bump only for package @ovh-ux/ng-at-internet





## [5.11.13](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-03)

**Note:** Version bump only for package @ovh-ux/ng-at-internet
Expand Down
4 changes: 2 additions & 2 deletions packages/components/ng-at-internet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ovh-ux/ng-at-internet",
"version": "5.11.13",
"version": "5.11.14",
"private": true,
"description": "ATInternet tracking library wrapper for AngularJS",
"keywords": [
Expand Down Expand Up @@ -36,7 +36,7 @@
"start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/ng-at-internet' --include-dependencies -- yarn run dev:watch"
},
"dependencies": {
"@ovh-ux/ovh-at-internet": "^0.14.0"
"@ovh-ux/ovh-at-internet": "^0.14.1"
},
"devDependencies": {
"@ovh-ux/component-rollup-config": "^13.0.1"
Expand Down
8 changes: 8 additions & 0 deletions packages/components/ng-shell-tracking/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.5.11](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-21)

**Note:** Version bump only for package @ovh-ux/ng-shell-tracking





## [0.5.10](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-03)

**Note:** Version bump only for package @ovh-ux/ng-shell-tracking
Expand Down
4 changes: 2 additions & 2 deletions packages/components/ng-shell-tracking/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ovh-ux/ng-shell-tracking",
"version": "0.5.10",
"version": "0.5.11",
"private": true,
"description": "ATInternet tracking library wrapper for AngularJS",
"keywords": [
Expand Down Expand Up @@ -37,7 +37,7 @@
"start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/ng-shell-tracking' --include-dependencies -- yarn run dev:watch"
},
"dependencies": {
"@ovh-ux/ovh-at-internet": "^0.14.0"
"@ovh-ux/ovh-at-internet": "^0.14.1"
},
"devDependencies": {
"@ovh-ux/component-rollup-config": "^13.0.1"
Expand Down
8 changes: 8 additions & 0 deletions packages/components/ovh-at-internet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.14.1](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-21)

**Note:** Version bump only for package @ovh-ux/ovh-at-internet





# [0.14.0](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-03)


Expand Down
4 changes: 2 additions & 2 deletions packages/components/ovh-at-internet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ovh-ux/ovh-at-internet",
"version": "0.14.0",
"version": "0.14.1",
"private": true,
"description": "ATInternet tracking library for OVHcloud.",
"keywords": [
Expand Down Expand Up @@ -35,7 +35,7 @@
"start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/manager-config' --include-dependencies -- yarn run dev:watch"
},
"dependencies": {
"@ovh-ux/manager-config": "^7.4.0",
"@ovh-ux/manager-config": "^7.5.0",
"@types/lodash-es": "^4.17.5",
"lodash-es": "^4.17.15"
}
Expand Down
148 changes: 108 additions & 40 deletions packages/components/ovh-at-internet/src/mix-commander.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import { GenericTrackingData } from './track';

declare global {
interface Window {
tC: {
trackPage(
user_id: string,
cty: string,
page_name: string,
additional_params: Record<string, unknown>,
): void;
};
}
}

const getMixCommanderScript = (clientId: string, region: string) => `
window.tC = window.tC || {};
Expand Down Expand Up @@ -280,46 +293,101 @@ tC.detectDevice = tC.detectDevice || function() {
: 'Mobile';
}
if (typeof tC.msr !== "object") {
tC.msr = [];
}
tC.msr.dns = tC.getClientCollectDns() || tC.getClientCampaignDns();
tC.msr.id_site = "3810";
tC.msr.page_name = "";
tC.msr.page_type = "Manager";
tC.msr.sbrand = [];
tC.msr.sbrand[0] = "";
tC.msr.sbrand[1] = "";
tC.msr.sbrand[2] = "";
tC.msr.sbrand[3] = "";
tC.msr.user_id = "${clientId}";
tC.msr.provided_excluded_referrer = "ovh.com,eu.ovh.com,ca.ovh.com,us.ovh.com,www.ovh.com,ovhcloud.com,www.ovhcloud.com,ovh.co.uk,www.ovh.co.uk,www.ovh.com.au,www.ovh.cz,ovh.de,www.ovh.de,ovh.es,www.ovh.es,ovh.ie,www.ovh.ie,ovh.it,www.ovh.it,ovh.nl,www.ovh.nl,www.ovh.lt,ovh.pl,www.ovh.pl,www.ovh.pt,ovh.sn,www.ovh.sn,www.ovh-hosting.fi,help.ovhcloud.com,partner.ovhcloud.com,opentrustedcloud.ovhcloud.com,ovh.slgnt.eu,news.ovhcloud.com,ovhh.pl,open-solidarity.com".split(','); // has to be a string of referrers (domains or subdomains) with a "," as a separator
var tc_search_engine = "ecosia|q,com.google.android.gm|q,com.google.android.googlequicksearchbox|q,qwant|q"; // has to be a string: search_engine|key in query string, search_engine|key (google|q,qwant|q)
if (tc_search_engine !== '') {
var tc_search_engine_fs = tc_search_engine.split(",")
tC.msr.provided_search_engines = (function() {
var pl = [];
for (var i = 0; i < tc_search_engine_fs.length; ++i) {
pl.push(tc_search_engine_fs[i].split('|'));
}
return pl;
})()
}
tC.msr.provided_social_networks = "".split(',');
tC.msr.provided_brand_urls = "".split(',');
tC.msr.internal_subdmomains = "ovhtelecom.fr,www.ovhtelecom.fr,www.kimsufi.com,hubic.com,api.hubic.com,us.ovhcloud.com,docs.ovh.com,ca.soyoustart.com,eu.soyoustart.com,www.soyoustart.com,community.ovh.com,blog.ovh.com,labs.ovh.com,omm.ovh.net,forum.ovh.com,weathermap.ovh.net,www.nic.ovh".split(',') // has to be a string separated by , - can be domains only or domains and subdomains or everything between protocal and ? or "
tC.msr.additional_params = "&user_id=" + "${clientId}";
tC.msr.additional_params += "&dev=" + tC.detectDevice();
tC.msr.additional_params += "&cty=" + "${region}";
tC.msr.additional_params += "&site_domain=www.ovh.com/manager/";
tC.msr.scriptElt1 = document.createElement("script");
tC.msr.scriptElt1.id = "tc_script_msr_1";
tC.msr.scriptElt1.src = "//analytics.ovh.com/measure/measure.js";
tC.msr.scriptElt1.async = true;
tC.msr.scriptElt1.defer = 'defer';
tC.msr.tmp = tC.getParamURL("tmp");
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] || document.getElementsByTagName('script')[0].parentNode).insertBefore(tC.msr.scriptElt1, null);
`;
tC.scriptCount = (tC.scriptCount || 0) + 1;
tC.trackPage = function(user_id, cty, page_name, additional_params) {
if (typeof tC.msr !== "object") {
tC.msr = [];
}
tC.msr.dns = tC.getClientCollectDns() || tC.getClientCampaignDns();
tC.msr.id_site = "3810";
tC.msr.page_name = page_name;
tC.msr.page_type = "Manager";
tC.msr.sbrand = [];
tC.msr.sbrand[0] = "";
tC.msr.sbrand[1] = "";
tC.msr.sbrand[2] = "";
tC.msr.sbrand[3] = "";
tC.msr.user_id = user_id;
tC.msr.provided_excluded_referrer = "ovh.com,eu.ovh.com,ca.ovh.com,us.ovh.com,www.ovh.com,ovhcloud.com,www.ovhcloud.com,ovh.co.uk,www.ovh.co.uk,www.ovh.com.au,www.ovh.cz,ovh.de,www.ovh.de,ovh.es,www.ovh.es,ovh.ie,www.ovh.ie,ovh.it,www.ovh.it,ovh.nl,www.ovh.nl,www.ovh.lt,ovh.pl,www.ovh.pl,www.ovh.pt,ovh.sn,www.ovh.sn,www.ovh-hosting.fi,help.ovhcloud.com,partner.ovhcloud.com,opentrustedcloud.ovhcloud.com,ovh.slgnt.eu,news.ovhcloud.com,ovhh.pl,open-solidarity.com".split(','); // has to be a string of referrers (domains or subdomains) with a "," as a separator
var tc_search_engine = "ecosia|q,com.google.android.gm|q,com.google.android.googlequicksearchbox|q,qwant|q"; // has to be a string: search_engine|key in query string, search_engine|key (google|q,qwant|q)
if (tc_search_engine !== '') {
var tc_search_engine_fs = tc_search_engine.split(",")
tC.msr.provided_search_engines = (function() {
var pl = [];
for (var i = 0; i < tc_search_engine_fs.length; ++i) {
pl.push(tc_search_engine_fs[i].split('|'));
}
return pl;
})()
}
tC.msr.provided_social_networks = "".split(',');
tC.msr.provided_brand_urls = "".split(',');
tC.msr.internal_subdmomains = "ovhtelecom.fr,www.ovhtelecom.fr,www.kimsufi.com,hubic.com,api.hubic.com,us.ovhcloud.com,docs.ovh.com,ca.soyoustart.com,eu.soyoustart.com,www.soyoustart.com,community.ovh.com,blog.ovh.com,labs.ovh.com,omm.ovh.net,forum.ovh.com,weathermap.ovh.net,www.nic.ovh".split(',') // has to be a string separated by , - can be domains only or domains and subdomains or everything between protocal and ? or "
tC.msr.additional_params = "&user_id=" + user_id;
tC.msr.additional_params += "&dev=" + tC.detectDevice();
tC.msr.additional_params += "&cty=" + cty;
tC.msr.additional_params += "&site_domain=www.ovh.com/manager/";
Object.entries(additional_params ?? {}).forEach(([param, value]) => {
tC.msr.additional_params += "&" + param + "=" + encodeURIComponent(value);
})
tC.msr['scriptElt' + tC.scriptCount] = document.createElement("script");
tC.msr['scriptElt' + tC.scriptCount].id = "tc_script_msr_" + tC.scriptCount;
tC.msr['scriptElt' + tC.scriptCount].src = "//analytics.ovh.com/measure/measure.js";
tC.msr['scriptElt' + tC.scriptCount].async = true;
tC.msr['scriptElt' + tC.scriptCount].defer = 'defer';
tC.msr.tmp = tC.getParamURL("tmp");
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] || document.getElementsByTagName('script')[0].parentNode).insertBefore(tC.msr['scriptElt' + tC.scriptCount], null);
tC.scriptCount += 1;
};
if(tC.getParamURL("mix_redirect") === "true"){
tC.setCookie("mix_redirect","true",(1/24/2))
if (typeof tC.msr !== "object") {
tC.msr = [];
}
tC.msr.dns = tC.getClientCollectDns() || tC.getClientCampaignDns();
tC.msr.id_site = "3810";
tC.msr.page_name = "";
tC.msr.page_type = "Manager";
tC.msr.rand = Math.random();
tC.msr.additional_params = "&user_id=" + "${clientId}";
tC.msr.additional_params += "&dev=" + tC.detectDevice();
tC.msr.additional_params += "&cty=" + "${region}";
tC.msr.additional_params += "&site_domain=www.ovh.com/manager/";
tC.msr.px = new Image();
tC.msr.px.id = "tc_img__1";
tC.msr.src = '';
tC.msr.alt = 'MixCo Site Tracking Only V4.0';
if (typeof tC.msr.page_name !== 'undefined' && tC.msr.page_name != null && tC.msr.page_name != '') {
tC.msr.src += '&p=' + tC.msr.page_name;
}
if (typeof tC.msr.page_type !== 'undefined' && tC.msr.page_type != null && tC.msr.page_type != '') {
tC.msr.src += '&pt=' + tC.msr.page_type;
}
if (typeof tC.msr.additional_params !== 'undefined' && tC.msr.additional_params != null && tC.msr.additional_params != '') {
tC.msr.src += tC.msr.additional_params;
}
tC.msr.hdoc = '';
try {
if (typeof top != 'undefined' && typeof top.document != 'undefined') {
tC.msr.hdoc = top.document;
}
} catch (e) {}
if (tC.msr.hdoc === '') {
tC.msr.hdoc = document;
};
if (typeof tC.msr.hdoc.referrer !== 'undefined' && tC.msr.hdoc.referrer != null && tC.msr.hdoc.referrer != '') {
if (tC.msr.hdoc.referrer.indexOf("?") != -1) {
tC.msr.src += '&ref=' + tC.msr.hdoc.referrer.substr(0, tC.msr.hdoc.referrer.indexOf("?"));
} else {
tC.msr.src += '&ref=' + tC.msr.hdoc.referrer;
}
}
tC.msr.px.src = 'https://' + tC.msr.dns + '/mix/s3/?tcs=' + tC.msr.id_site + '&rand=' + tC.msr.rand + tC.msr.src;
(document.getElementsByTagName('body')[0] || document.getElementsByTagName('head')[0]).appendChild(tC.msr.px);
} else {
tC.trackPage("${clientId}", "${region}");
}`;

const initMixCommander = ({
user_id: userId,
Expand Down
40 changes: 39 additions & 1 deletion packages/components/ovh-at-internet/src/ovh-at-internet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ export default class OvhAtInternet extends OvhAtInternetConfig {
);
}

shouldUseMixCommander() {
if (isTrackingDebug()) {
return true;
}

return !!window.tC && window.location?.hostname !== 'localhost';
}

initTag(withConsent: boolean): Promise<void> {
// check if the tag is not already initialized
if (this.tag) {
Expand Down Expand Up @@ -255,7 +263,14 @@ export default class OvhAtInternet extends OvhAtInternetConfig {

sendEvent(type: string, data: any) {
debug('tracking send', type, data);
if (this.shouldUsePianoAnalytics()) {
if (type.startsWith('mix-commander') && this.shouldUseMixCommander()) {
window.tC.trackPage(
data.user_id,
data.country,
data.page,
data.tc_additional_params,
);
} else if (this.shouldUsePianoAnalytics()) {
const trackingData = { ...filterTrackingData(data) };
window.pa.setUser(trackingData.user_id, trackingData.user_category);
delete trackingData.user_id;
Expand Down Expand Up @@ -315,6 +330,29 @@ export default class OvhAtInternet extends OvhAtInternetConfig {
}
}

trackMixCommanderS3(data: LegacyTrackingData): void {
if (this.canTrack()) {
const tracking = {
...this.getGenericTrackingData(data),
...getPageTrackingData(data),
tc_additional_params: data.tc_additional_params,
};
if (tracking.page) {
this.sendEvent('mix-commander.display', filterTrackingData(tracking));
} else {
console.error(
'tC.trackPage invalid data: missing name attribute',
data,
);
}
} else {
this.trackQueue.push({
type: 'trackMixCommanderS3',
data,
});
}
}

trackClick(data: LegacyTrackingData): void {
if (this.canTrack()) {
const pageTrackingData = getPageTrackingData(data);
Expand Down
3 changes: 2 additions & 1 deletion packages/components/ovh-at-internet/src/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export type TrackType =
| 'trackEvent'
| 'trackImpression'
| 'trackClickImpression'
| 'trackMVTest';
| 'trackMVTest'
| 'trackMixCommanderS3';

export interface LegacyTrackingData {
name: string;
Expand Down
8 changes: 8 additions & 0 deletions packages/components/ovh-shell/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.9.1](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-21)

**Note:** Version bump only for package @ovh-ux/shell





# [3.9.0](https://github.com/ovh/manager/compare/@ovh-ux/[email protected]...@ovh-ux/[email protected]) (2024-10-17)


Expand Down
6 changes: 3 additions & 3 deletions packages/components/ovh-shell/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ovh-ux/shell",
"version": "3.9.0",
"version": "3.9.1",
"private": true,
"description": "Communication and interaction between applications",
"repository": {
Expand All @@ -23,8 +23,8 @@
"start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/shell' --include-dependencies -- npm run dev:watch --if-present"
},
"dependencies": {
"@ovh-ux/manager-config": "^7.4.0",
"@ovh-ux/ovh-at-internet": "^0.14.0",
"@ovh-ux/manager-config": "^7.5.0",
"@ovh-ux/ovh-at-internet": "^0.14.1",
"@ovh-ux/ovh-reket": "^2.1.2",
"@ovh-ux/request-tagger": "^0.3.0",
"@ovh-ux/url-builder": "^1.2.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/components/ovh-shell/src/plugin/tracking/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface TrackingAPI {
onUserConsentFromModal(consent: boolean): PromiseLike<void>;
trackClick(data: LegacyTrackingData): PromiseLike<void>;
trackPage(data: LegacyTrackingData): PromiseLike<void>;
trackMixCommanderS3(data: LegacyTrackingData): void;
trackEvent(data: LegacyTrackingData): PromiseLike<void>;
trackImpression(data: TrackImpressionData): PromiseLike<void>;
trackClickImpression(data: TrackClickImpressionData): PromiseLike<void>;
Expand Down Expand Up @@ -55,6 +56,12 @@ export function exposeTrackingAPI(shellClient: ShellClient): TrackingAPI {
method: 'trackPage',
args: [data],
}),
trackMixCommanderS3: (data: LegacyTrackingData) =>
shellClient.invokePluginMethod<void>({
plugin: 'tracking',
method: 'trackMixCommanderS3',
args: [data],
}),
trackEvent: (data: LegacyTrackingData) =>
shellClient.invokePluginMethod<void>({
plugin: 'tracking',
Expand Down
Loading

0 comments on commit ffecea3

Please sign in to comment.