diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index b7353733..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 066b2d92..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 2278001a..00000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: Question -about: Have a question about using Prebid Universal Creative - ---- - - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..e63bb31e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js 22.19.0 + uses: actions/setup-node@v4 + with: + node-version: 22.19.0 + + - name: Install dependencies + run: npm install + + - name: Run gulp tests + run: gulp test diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 68aa33ba..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,98 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL Advanced" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: '34 11 * * 6' - -jobs: - analyze: - name: Analyze (${{ matrix.language }}) - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners (GitHub.com only) - # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - permissions: - # required for all workflows - security-events: write - - # required to fetch internal or private CodeQL packs - packages: read - - # only required for workflows in private repositories - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - include: - - language: javascript-typescript - build-mode: none - # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' - # Use `c-cpp` to analyze code written in C, C++ or both - # Use 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, - # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. - # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how - # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Add any setup steps before running the `github/codeql-action/init` action. - # This includes steps like installing compilers or runtimes (`actions/setup-node` - # or others). This is typically only required for manual builds. - # - name: Setup runtime (example) - # uses: actions/setup-example@v1 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" diff --git a/.github/workflows/issue_tracker.yml b/.github/workflows/issue_tracker.yml deleted file mode 100644 index 2ff00fac..00000000 --- a/.github/workflows/issue_tracker.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Issue tracking -on: - issues: - types: - - opened -permissions: - contents: read -jobs: - track_issue: - permissions: - contents: none - runs-on: ubuntu-latest - steps: - - name: Generate token - id: generate_token - uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c - with: - app_id: ${{ secrets.ISSUE_APP_ID }} - private_key: ${{ secrets.ISSUE_APP_PEM }} - - - name: Get project data - env: - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - ORGANIZATION: prebid - DATE_FIELD: Created on - PROJECT_NUMBER: 2 - run: | - gh api graphql -f query=' - query($org: String!, $number: Int!) { - organization(login: $org){ - projectV2(number: $number) { - id - fields(first:100) { - nodes { - ... on ProjectV2Field { - id - name - } - ... on ProjectV2SingleSelectField { - id - name - options { - id - name - } - } - } - } - } - } - }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json - - echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV - echo 'DATE_FIELD_ID='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name=="'"$DATE_FIELD"'") | .id' project_data.json) >> $GITHUB_ENV - - - name: Add issue to project - env: - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - ISSUE_ID: ${{ github.event.issue.node_id }} - run: | - gh api graphql -f query=' - mutation($project:ID!, $issue:ID!) { - addProjectV2ItemById(input: {projectId: $project, contentId: $issue}) { - item { - id - content { - ... on Issue { - createdAt - } - ... on PullRequest { - createdAt - } - } - } - } - }' -f project=$PROJECT_ID -f issue=$ISSUE_ID > issue_data.json - - echo 'ITEM_ID='$(jq '.data.addProjectV2ItemById.item.id' issue_data.json) >> $GITHUB_ENV - echo 'ITEM_CREATION_DATE='$(jq '.data.addProjectV2ItemById.item.content.createdAt' issue_data.json | cut -c 2-11) >> $GITHUB_ENV - - - name: Set fields - env: - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - run: | - gh api graphql -f query=' - mutation ( - $project: ID! - $item: ID! - $date_field: ID! - $date_value: Date! - ) { - set_creation_date: updateProjectV2ItemFieldValue(input: { - projectId: $project - itemId: $item - fieldId: $date_field - value: { - date: $date_value - } - }) { - projectV2Item { - id - } - } - }' -f project=$PROJECT_ID -f item=$ITEM_ID -f date_field=$DATE_FIELD_ID -f date_value=$ITEM_CREATION_DATE --silent diff --git a/package-lock.json b/package-lock.json index ed89bd24..efb0e896 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "prebid-universal-creative", + "name": "openads-universal-creative", "version": "1.18.0-pre", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "prebid-universal-creative", + "name": "openads-universal-creative", "version": "1.18.0-pre", "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 36f627e0..2c8497c9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "prebid-universal-creative", + "name": "openads-universal-creative", "version": "1.18.0-pre", - "description": "Universal creative for Prebid apps", + "description": "Universal creative for Openads apps", "main": "dist/creative.js", "scripts": { "test": "gulp test", @@ -9,18 +9,18 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/prebid/prebid-universal-creative.git" + "url": "git+https://github.com/OpenAds-Auction/OpenAdsUniversalCreative.git" }, "keywords": [ - "Prebid.js" + "Openads.js" ], - "globalVarName": "pbjs", - "author": "Prebid.org Contributors", + "globalVarName": "oajs", + "author": "OpenAds Contributors", "license": "Apache-2.0", "bugs": { - "url": "https://github.com/prebid/prebid-universal-creative/issues" + "url": "https://github.com/OpenAds-Auction/OpenAdsUniversalCreative/issues" }, - "homepage": "https://github.com/prebid/prebid-universal-creative#readme", + "homepage": "https://github.com/OpenAds-Auction/OpenAdsUniversalCreative#readme", "devDependencies": { "@babel/core": "^7.2.2", "@babel/plugin-transform-modules-commonjs": "^7.6.0", diff --git a/src/messaging.js b/src/messaging.js index a99c76d6..302b03ed 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -1,5 +1,5 @@ import {parseUrl} from './utils.js'; -export const PREBID_EVENT = 'Prebid Event'; +export const PREBID_EVENT = 'OpenAds Event'; export const AD_RENDER_SUCCEEDED = 'adRenderSucceeded'; export const AD_RENDER_FAILED = 'adRenderFailed'; diff --git a/src/nativeAssetManager.js b/src/nativeAssetManager.js index e242164c..dc8ce746 100644 --- a/src/nativeAssetManager.js +++ b/src/nativeAssetManager.js @@ -13,25 +13,25 @@ import {hasDynamicRenderer, runDynamicRenderer} from './dynamicRenderer.js'; * https://github.com/prebid/Prebid.js/blob/8635c91942de9df4ec236672c39b19448545a812/src/constants.json#L67 */ const NATIVE_KEYS = { - title: 'hb_native_title', - body: 'hb_native_body', - body2: 'hb_native_body2', - privacyLink: 'hb_native_privacy', - privacyIcon: 'hb_native_privicon', - sponsoredBy: 'hb_native_brand', - image: 'hb_native_image', - icon: 'hb_native_icon', - clickUrl: 'hb_native_linkurl', - displayUrl: 'hb_native_displayurl', - cta: 'hb_native_cta', - rating: 'hb_native_rating', - address: 'hb_native_address', - downloads: 'hb_native_downloads', - likes: 'hb_native_likes', - phone: 'hb_native_phone', - price: 'hb_native_price', - salePrice: 'hb_native_saleprice', - rendererUrl: 'hb_renderer_url', + title: 'oa_native_title', + body: 'oa_native_body', + body2: 'oa_native_body2', + privacyLink: 'oa_native_privacy', + privacyIcon: 'oa_native_privicon', + sponsoredBy: 'oa_native_brand', + image: 'oa_native_image', + icon: 'oa_native_icon', + clickUrl: 'oa_native_linkurl', + displayUrl: 'oa_native_displayurl', + cta: 'oa_native_cta', + rating: 'oa_native_rating', + address: 'oa_native_address', + downloads: 'oa_native_downloads', + likes: 'oa_native_likes', + phone: 'oa_native_phone', + price: 'oa_native_price', + salePrice: 'oa_native_saleprice', + rendererUrl: 'oa_renderer_url', }; // Asset type mapping as per Native IAB spec 1.2 @@ -203,7 +203,7 @@ export function newNativeAssetManager(win, nativeTag, mkMessenger = prebidMessen if (hasPbNativeData() && win.pbNativeData.hasOwnProperty('assetsToReplace')) { win.pbNativeData.assetsToReplace.forEach((asset) => { - const key = (asset.match(/hb_native_/i)) ? asset : NATIVE_KEYS[asset]; + const key = (asset.match(/oa_native_/i)) ? asset : NATIVE_KEYS[asset]; if (key) {placeholders.push(key);} }); } @@ -250,7 +250,7 @@ export function newNativeAssetManager(win, nativeTag, mkMessenger = prebidMessen */ function requestAssets(adId, assets) { const message = { - message: 'Prebid Native', + message: 'OpenAds Native', action: 'assetRequest', adId, assets, @@ -265,7 +265,7 @@ export function newNativeAssetManager(win, nativeTag, mkMessenger = prebidMessen */ function requestAllAssets(adId) { const message = { - message: 'Prebid Native', + message: 'OpenAds Native', action: 'allAssetRequest', adId, }; @@ -277,7 +277,7 @@ export function newNativeAssetManager(win, nativeTag, mkMessenger = prebidMessen */ function requestHeightResize(adId, height, width) { const message = { - message: 'Prebid Native', + message: 'OpenAds Native', action: 'resizeNativeHeight', adId, height, @@ -459,20 +459,20 @@ export function newNativeAssetManager(win, nativeTag, mkMessenger = prebidMessen } ortb.assets.forEach(asset => { - html = html.replaceAll(`##hb_native_asset_id_${asset.id}##`, getAssetValue(asset)); + html = html.replaceAll(`##oa_native_asset_id_${asset.id}##`, getAssetValue(asset)); if (asset.link && asset.link.url) { - html = html.replaceAll(`##hb_native_asset_link_id_${asset.id}##`, asset.link.url); + html = html.replaceAll(`##oa_native_asset_link_id_${asset.id}##`, asset.link.url); } }); - html = html.replaceAll(/##hb_native_asset_id_\d+##/gm, ''); + html = html.replaceAll(/##oa_native_asset_id_\d+##/gm, ''); if (ortb.privacy) { - html = html.replaceAll("##hb_native_privacy##", ortb.privacy); + html = html.replaceAll("##oa_native_privacy##", ortb.privacy); } if (ortb.link) { - html = html.replaceAll("##hb_native_linkurl##", ortb.link.url); + html = html.replaceAll("##oa_native_linkurl##", ortb.link.url); } return html; diff --git a/src/nativeORTBTrackerManager.js b/src/nativeORTBTrackerManager.js index 08b30469..a8f17d34 100644 --- a/src/nativeORTBTrackerManager.js +++ b/src/nativeORTBTrackerManager.js @@ -1,11 +1,11 @@ import { loadScript, triggerPixel } from "./utils"; const AD_ANCHOR_CLASS_NAME = 'pb-click'; -const ASSET_ID_ELEMENT_ATTRIBUTE = 'hb_native_asset_id'; +const ASSET_ID_ELEMENT_ATTRIBUTE = 'oa_native_asset_id'; export function fireNativeImpressionTrackers(adId, sendMessage) { const message = { - message: 'Prebid Native', + message: 'OpenAds Native', action: 'fireNativeImpressionTrackers', adId }; @@ -14,7 +14,7 @@ export function fireNativeImpressionTrackers(adId, sendMessage) { export function addNativeClickTrackers(adId, sendMessage) { const message = { - message: 'Prebid Native', + message: 'OpenAds Native', action: 'click', adId }; diff --git a/src/nativeRenderManager.js b/src/nativeRenderManager.js index e78daa92..1dbe0504 100644 --- a/src/nativeRenderManager.js +++ b/src/nativeRenderManager.js @@ -34,7 +34,7 @@ export function newNativeRenderManager(win, mkMessenger = prebidMessenger, asset }); } else { signalResult(null, {reason: 'missingDocOrAdid'}); - console.warn('Prebid Native Tag object was missing \'adId\'.'); + console.warn('OpenAds Native Tag object was missing \'adId\'.'); } } catch (e) { signalResult(nativeTag && nativeTag.adId, {reason: 'exception', message: e.message}); diff --git a/src/nativeTrackerManager.js b/src/nativeTrackerManager.js index e836fe9e..e4d3beb9 100644 --- a/src/nativeTrackerManager.js +++ b/src/nativeTrackerManager.js @@ -55,9 +55,9 @@ export function newNativeTrackerManager(win) { function fireTracker(adId, action) { if (adId === '') { - console.warn('Prebid tracking event was missing \'adId\'. Was adId macro set in the HTML attribute ' + AD_DATA_ADID_ATTRIBUTE + 'on the ad\'s anchor element'); + console.warn('OpenAds tracking event was missing \'adId\'. Was adId macro set in the HTML attribute ' + AD_DATA_ADID_ATTRIBUTE + 'on the ad\'s anchor element'); } else { - let message = { message: 'Prebid Native', adId: adId }; + let message = { message: 'OpenAds Native', adId: adId }; // fires click trackers when called via link if (action === 'click') { diff --git a/src/renderingManager.js b/src/renderingManager.js index 27a7b3e9..7cd26b78 100644 --- a/src/renderingManager.js +++ b/src/renderingManager.js @@ -63,7 +63,7 @@ export function renderCrossDomain(win, adId, pubAdServerDomain = '', pubUrl) { if ( adObject.message && - adObject.message === "Prebid Response" && + adObject.message === "OpenAds Response" && adObject.adId === adId ) { if (hasDynamicRenderer(adObject)) { @@ -116,7 +116,7 @@ export function renderCrossDomain(win, adId, pubAdServerDomain = '', pubUrl) { function requestAdFromPrebid() { let message = { - message: 'Prebid Request', + message: 'OpenAds Request', adId: adId, adServerDomain: fullAdServerDomain } diff --git a/src/utils.js b/src/utils.js index 4ea8fa2e..2929261a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -115,14 +115,14 @@ export function transformAuctionTargetingData(tagData) { // this map object translates the Prebid.js auction keys to their equivalent Prebid Universal Creative keys // when the publisher uses their adserver's generic macro that provides all targeting keys (ie tagData.targetingMap), we need to convert the keys const auctionKeyMap = { - hb_adid: 'adId', - hb_cache_host: 'cacheHost', - hb_cache_path: 'cachePath', - hb_cache_id: 'uuid', - hb_format: 'mediaType', - hb_env: 'env', - hb_size: 'size', - hb_pb: 'hbPb' + oa_adid: 'adId', + oa_cache_host: 'cacheHost', + oa_cache_path: 'cachePath', + oa_cache_id: 'uuid', + oa_format: 'mediaType', + oa_env: 'env', + oa_size: 'size', + oa_pb: 'hbPb' }; /** diff --git a/test/spec/environment_spec.js b/test/spec/environment_spec.js index 45f3b8f3..f18e3751 100644 --- a/test/spec/environment_spec.js +++ b/test/spec/environment_spec.js @@ -43,7 +43,7 @@ describe('environment module', function() { let localWindow = { parent: { parent: { - pbjs: { + oajs: { fakeFn: () => {} } } diff --git a/test/spec/nativeAssetManager_spec.js b/test/spec/nativeAssetManager_spec.js index 51aaeec8..8622f80b 100644 --- a/test/spec/nativeAssetManager_spec.js +++ b/test/spec/nativeAssetManager_spec.js @@ -11,25 +11,25 @@ const ORIGIN = 'https://origin.com' const AD_ID = 'abc123'; const AD_ID2 = 'def456'; const NATIVE_KEYS = { - title: 'hb_native_title', - body: 'hb_native_body', - body2: 'hb_native_body2', - privacyLink: 'hb_native_privacy', - privacyIcon: 'hb_native_privicon', - sponsoredBy: 'hb_native_brand', - image: 'hb_native_image', - icon: 'hb_native_icon', - clickUrl: 'hb_native_linkurl', - displayUrl: 'hb_native_displayurl', - cta: 'hb_native_cta', - rating: 'hb_native_rating', - address: 'hb_native_address', - downloads: 'hb_native_downloads', - likes: 'hb_native_likes', - phone: 'hb_native_phone', - price: 'hb_native_price', - salePrice: 'hb_native_saleprice', - rendererUrl: 'hb_renderer_url', + title: 'oa_native_title', + body: 'oa_native_body', + body2: 'oa_native_body2', + privacyLink: 'oa_native_privacy', + privacyIcon: 'oa_native_privicon', + sponsoredBy: 'oa_native_brand', + image: 'oa_native_image', + icon: 'oa_native_icon', + clickUrl: 'oa_native_linkurl', + displayUrl: 'oa_native_displayurl', + cta: 'oa_native_cta', + rating: 'oa_native_rating', + address: 'oa_native_address', + downloads: 'oa_native_downloads', + likes: 'oa_native_likes', + phone: 'oa_native_phone', + price: 'oa_native_price', + salePrice: 'oa_native_saleprice', + rendererUrl: 'oa_renderer_url', }; const mockDocument = { @@ -80,7 +80,7 @@ function createAltAllResponder(assets,url,template) { // creates mock html markup responsse from renderUrl function generateRenderer(assets) { - let newhtml = '
##hb_native_body##<\/p>\r\n \t
##oa_native_body##<\/p>\r\n \t
hb_native_body:${AD_ID}
- Click Here +oa_native_body:${AD_ID}
+ Click Here `; win.addEventListener = createResponder([ { key: 'body', value: 'new value' }, @@ -155,13 +155,13 @@ describe('nativeAssetManager', () => { Click Here `); // title was not a requested asset so this should stay as is - expect(win.document.body.innerHTML).to.include('