Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media Collection support #370

Merged
merged 54 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b87150e
adding support for media
Nov 15, 2023
4df99d8
adding support for meedia in launch
Nov 21, 2023
72332de
adding media event types
Nov 21, 2023
a45e0e4
adding more functionality to the media events
Nov 29, 2023
7bdd97e
adding supoort for legacy media api
Nov 30, 2023
e052c70
refactoring
Dec 20, 2023
2a41e2e
adding the register session event details
Jan 21, 2024
e42d79a
moving sessionstart to send event action
Mar 9, 2024
19be162
add a section with data element component
Mar 10, 2024
f3b29ea
fix get initial values
Mar 10, 2024
5eefd93
remove create media session action
Mar 13, 2024
5abab60
remove Media session received event
Mar 13, 2024
70e75a5
add session start to sendMediaEvent action
Mar 13, 2024
73a9442
refactor sessionStart
Mar 17, 2024
8d89754
refactor ads section
Mar 17, 2024
0eb6f5e
renaming/ refactoring
Mar 21, 2024
3b787bc
adding changes to send media event actions
Mar 27, 2024
027e67d
resolving conflicts after merging main
Mar 27, 2024
092d5e3
not return empty string values, remove alloy import
Mar 27, 2024
6ffb81d
add custom metadata
Mar 28, 2024
9382dd5
refactor of the form
Mar 29, 2024
bf8ed88
add test for configurations
Mar 29, 2024
5605bf1
fix bug
Apr 1, 2024
355df35
add states to the UI, handle media sessions with caching
Apr 9, 2024
b898aad
fix naming
Apr 9, 2024
9816e96
adding qoe data element and adjusting the manifest
Apr 10, 2024
3794de7
remove custom metadata from ad break start
Apr 10, 2024
d385a83
fix playhead and qoe
Apr 17, 2024
ab35969
Merge branch 'main' into media
Apr 17, 2024
6cab319
add formated files
Apr 17, 2024
27bdd7f
fix number field component
Apr 17, 2024
6dc96b0
refactor the getMediaAnalyticsTracker
Apr 18, 2024
5702701
add changes to inputs for send media event
Apr 18, 2024
79c352b
add changes to inputs for configuration
Apr 18, 2024
e633214
add more refactoring
Apr 18, 2024
8ed5252
return session promise
Apr 22, 2024
2caff91
return session promise
Apr 22, 2024
2c34fec
rename to streaming media
Apr 25, 2024
9056050
revert extension name
Apr 25, 2024
b8d544c
remove campaignId required from ad start
May 3, 2024
bc317e4
add interactive configuration ui for media
May 3, 2024
86e6989
added some ui improvements
May 3, 2024
a2f1a7c
fix numberfield validation
May 7, 2024
21be45a
extracted predefined values andsorted
May 7, 2024
ce44adc
fix states updats form
May 7, 2024
64bd107
add a note for getmediatracker
May 7, 2024
c2f7104
merging main
May 7, 2024
948a7c7
feedback changes
May 8, 2024
2baf070
resolving conflicts
May 8, 2024
de715b4
add default extension settings in the send media event view
May 14, 2024
ee9ecff
add updated descriptions for extension config fields
May 16, 2024
b9d1d4d
fix onChange
May 16, 2024
a86a288
fix tests after renaming
May 16, 2024
9acf7f2
rename
May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,911 changes: 1,598 additions & 313 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactor-extension-alloy",
"version": "2.21.2",
"version": "2.21.4",
ninaceban marked this conversation as resolved.
Show resolved Hide resolved
"description": "The Adobe Experience Platform Web SDK allows for streaming data into the platform, syncing identities, personalizing content, and more.",
"author": {
"name": "Adobe",
Expand Down Expand Up @@ -36,7 +36,8 @@
"test:functional:watch:debug": "echo \"open chrome://inspect in Chrome and click 'inspect'\" && node --inspect-brk ./scripts/functional.js --watch",
"test": "npm-run-all --parallel test:unit test:functional",
"token": "node scripts/token.js",
"version": "./scripts/version.sh"
"version": "./scripts/version.sh",
"upload": "reactor-uploader --org-id=$REACTOR_UPLOADER_ORG_ID --tech-account-id=$REACTOR_UPLOADER_TECH_ACCOUNT_ID --api-key=$REACTOR_UPLOADER_API_KEY --client-secret=$REACTOR_IO_INTEGRATION_CLIENT_SECRET"
},
"lint-staged": {
"./*.{js,jsx}": [
Expand All @@ -53,7 +54,7 @@
]
},
"dependencies": {
"@adobe/alloy": "^2.19.0",
"@adobe/alloy": "file:../adobe/alloy",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to revert this before merging.

In the future, you can use the npm link command.

Suggested change
"@adobe/alloy": "file:../adobe/alloy",
"@adobe/alloy": "^2.19.0"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this work for beta? we need the beta version of alloy.js right?

"@adobe/react-spectrum": "^3.26.0",
"@react-stately/data": "^3.4.0",
"@spectrum-css/typography": "^3.0.2",
Expand All @@ -76,6 +77,7 @@
"@adobe/reactor-sandbox": "^12.5.0",
"@adobe/reactor-turbine": "^27.2.1",
"@adobe/reactor-turbine-schemas": "^10.5.0",
"@adobe/reactor-uploader": "^4.1.0",
"@babel/cli": "^7.12.16",
"@babel/core": "^7.12.16",
"@babel/plugin-proposal-class-properties": "^7.12.13",
Expand Down
113 changes: 112 additions & 1 deletion scripts/helpers/createExtensionManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const createExtensionManifest = ({ version }) => {
const extensionManifest = {
version,
displayName: "Adobe Experience Platform Web SDK",
name: "adobe-alloy",
name: "adobe-alloy-nina",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to revert this before merging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "adobe-alloy-nina",
name: "adobe-alloy",

iconPath: "resources/images/icon.svg",
exchangeUrl:
"https://exchange.adobe.com/experiencecloud.details.106387.aep-web-sdk.html",
Expand Down Expand Up @@ -309,6 +309,26 @@ const createExtensionManifest = ({ version }) => {
minLength: 1
},
edgeConfigOverrides: createEdgeConfigOverridesSchema(false),
mediaCollection: {
type: "object",
properties: {
channel: {
type: "string"
},
playerName: {
type: "string"
},
version: {
type: "string"
},
mainPingInterval: {
type: "integer"
},
adPingInterval: {
type: "integer"
}
}
},
personalizationStorageEnabled: {
type: "boolean"
}
Expand Down Expand Up @@ -788,6 +808,90 @@ const createExtensionManifest = ({ version }) => {
libPath: "dist/lib/actions/updateVariable/index.js",
viewPath: "actions/updateVariable.html"
},
{
displayName: "Create Media Analytics Session",
name: "create-media-session",
schema: {
$schema: "http://json-schema.org/draft-04/schema#",
type: "object",
properties: {
instanceName: {
type: "string",
minLength: 1
},
xdm: {
type: "string",
pattern: "^%[^%]+%$"
},
playerId: {
type: "string"
},
onBeforeMediaEvent: {
type: "string"
}
},
required: ["instanceName"],
additionalProperties: false
},
libPath: "dist/lib/actions/createMediaSession/index.js",
viewPath: "actions/createMediaSession.html",
transforms: [
{
type: "function",
propertyPath: "onBeforeMediaEvent",
parameters: ["content"]
}
]
},
{
displayName: "Send Media Analytics Event",
name: "send-media-event",
schema: {
$schema: "http://json-schema.org/draft-04/schema#",
type: "object",
properties: {
instanceName: {
type: "string",
minLength: 1
},
eventType: {
type: "string",
minLength: 1
},
playerId: {
type: "string",
minLength: 1
},
xdm: {
type: "object"
}
},
required: ["instanceName"]
},
libPath: "dist/lib/actions/sendMediaEvent/index.js",
viewPath: "actions/sendMediaAnalyticsEvent.html"
},
{
displayName: "Get Media Tracker API",
name: "get-media-tracker-api",
schema: {
$schema: "http://json-schema.org/draft-04/schema#",
type: "object",
properties: {
instanceName: {
type: "string",
minLength: 1
},
objectName: {
type: "string",
minLength: 1
}
},
required: ["instanceName"]
},
libPath: "dist/lib/actions/getMediaTrackerAPI/index.js",
viewPath: "actions/createMediaTracker.html"
},
{
displayName: "Evaluate rulesets",
name: "evaluate-rulesets",
Expand Down Expand Up @@ -883,6 +987,13 @@ const createExtensionManifest = ({ version }) => {
]
}
}
},
{
name: "media-session-id-received",
displayName: "Media Analytics Session ID received",
libPath:
"dist/lib/events/createMediaAnalyticsSessionIDComplete/index.js",
schema: {}
}
],
dataElements: [
Expand Down
41 changes: 41 additions & 0 deletions src/lib/actions/createMediaSession/createMediaSession.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2023 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

module.exports = ({
instanceManager,
mediaAnalyticsSessionCallbackStorage,
wrapOnBeforeMediaEvent
}) => settings => {
const { instanceName, ...createMediaSessionSettings } = settings;
const instance = instanceManager.getInstance(instanceName);

if (!instance) {
throw new Error(
`Failed to send event for instance "${instanceName}". No matching instance was configured with this name.`
);
}

const options = { xdm: createMediaSessionSettings.xdm };
if (
createMediaSessionSettings.playerId &&
createMediaSessionSettings.onBeforeMediaEvent
) {
options.playerId = createMediaSessionSettings.playerId;
options.onBeforeMediaEvent = wrapOnBeforeMediaEvent(
createMediaSessionSettings.onBeforeMediaEvent
);
}

return instance("createMediaSession", options).then(result => {
mediaAnalyticsSessionCallbackStorage.triggerEvent(result);
});
};
23 changes: 23 additions & 0 deletions src/lib/actions/createMediaSession/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const createMediaSession = require("./createMediaSession");
const instanceManager = require("../../instanceManager/index");
const { mediaAnalyticsSessionCallbackStorage } = require("../../index");
const injectWrapOnBeforeMediaEvent = require("./injectWrapOnBeforeMediaEvent");

const wrapOnBeforeMediaEvent = injectWrapOnBeforeMediaEvent();
module.exports = createMediaSession({
instanceManager,
mediaAnalyticsSessionCallbackStorage,
wrapOnBeforeMediaEvent
});
18 changes: 18 additions & 0 deletions src/lib/actions/createMediaSession/injectWrapOnBeforeMediaEvent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

module.exports = () => onBeforeMediaEventSend => content => {
if (onBeforeMediaEventSend) {
return onBeforeMediaEventSend(content);
ninaceban marked this conversation as resolved.
Show resolved Hide resolved
}
return undefined;
};
26 changes: 26 additions & 0 deletions src/lib/actions/getMediaTrackerAPI/getMediaTrackerAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2023 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

module.exports = ({ instanceManager, windowObject }) => settings => {
const { instanceName, objectName = "Media" } = settings;
const instance = instanceManager.getInstance(instanceName);

if (!instance) {
throw new Error(
`Failed to send event for instance "${instanceName}". No matching instance was configured with this name.`
ninaceban marked this conversation as resolved.
Show resolved Hide resolved
);
}

return instance("getMediaAnalyticsTracker", {}).then(result => {
windowObject[objectName] = result;
});
};
21 changes: 21 additions & 0 deletions src/lib/actions/getMediaTrackerAPI/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2023 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const getMediaTrackerAPI = require("./getMediaTrackerAPI");
const instanceManager = require("../../instanceManager/index");

const windowObject = window;

module.exports = getMediaTrackerAPI({
instanceManager,
windowObject
});
32 changes: 32 additions & 0 deletions src/lib/actions/sendMediaEvent/createSendMediaEvent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright 2023 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const { deepAssign } = require("../../alloy");

module.exports = ({ instanceManager }) => settings => {
const {
instanceName,
eventType,
playerId,
...createMediaEventSettings
} = settings;
const instance = instanceManager.getInstance(instanceName);

if (!instance) {
throw new Error(
`Failed to send event for instance "${instanceName}". No matching instance was configured with this name.`
);
}
const { xdm = {} } = createMediaEventSettings;
deepAssign(xdm, { eventType });
return instance("sendMediaEvent", { xdm, playerId });
};
18 changes: 18 additions & 0 deletions src/lib/actions/sendMediaEvent/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Copyright 2023 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const createMediaEvent = require("./createSendMediaEvent");
const instanceManager = require("../../instanceManager/index");

module.exports = createMediaEvent({
instanceManager
});
25 changes: 25 additions & 0 deletions src/lib/createMediaAnalyticsSessionCallbackStorage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright 2023 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

module.exports = () => {
const createMediaAnalyticsSessionCompleteTriggers = [];
return {
add(trigger) {
createMediaAnalyticsSessionCompleteTriggers.push(trigger);
},
triggerEvent(result) {
createMediaAnalyticsSessionCompleteTriggers.forEach(trigger => {
trigger(result);
});
}
};
};