{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/ad-engine/pulls/comments/241786004","pull_request_review_id":185150023,"id":241786004,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTc4NjAwNA==","diff_hunk":"@@ -154,19 +152,136 @@ export class A9 extends BaseBidder {\n \t}\n \n \tgetTargetingParams(slotName) {\n-\t\treturn this.bids[slotName] || {};\n+\t\treturn this.bids[this.getSlotAlias(slotName)] || {};\n \t}\n \n \tinsertScript() {\n-\t\tutils.scriptLoader.loadScript(\n-\t\t\t'//c.amazon-adsystem.com/aax2/apstag.js',\n-\t\t\t'text/javascript',\n-\t\t\ttrue,\n-\t\t\t'first',\n-\t\t);\n+\t\tutils.scriptLoader\n+\t\t\t.loadScript('//c.amazon-adsystem.com/aax2/apstag.js', 'text/javascript', true, 'first')\n+\t\t\t.then(() => this.overwriteRenderImp());\n \t}\n \n+\t/**\n+\t * Wraps apstag.renderImp\n+\t *\n+\t * Calls this.refreshBid() if bids refreshing is enabled.\n+\t */\n+\toverwriteRenderImp() {\n+\t\tutils.logger(logGroup, 'overwriting window.apstag.renderImp');\n+\t\twindow.apstag.renderImp = ((original) => (doc, impId) => {\n+\t\t\toriginal(doc, impId);\n+\n+\t\t\tconst slot = this.getRenderedSlot(impId);\n+\t\t\tconst slotName = slot.getSlotName();\n+\n+\t\t\tutils.logger(logGroup, `bid used for slot ${slotName}`);\n+\t\t\tdelete this.bids[this.getSlotAlias(slotName)];\n+\n+\t\t\tif (window.apstag.renderImp && this.isBidsRefreshingEnabled) {\n+\t\t\t\tthis.refreshBid(slot);\n+\t\t\t}\n+\t\t})(window.apstag.renderImp);\n+\t}\n+\n+\t/**\n+\t * Checks if slot with given name is supported by bidder.\n+\t *\n+\t * @param {string} slotName\n+\t * @returns {boolean}\n+\t */\n \tisSupported(slotName) {\n-\t\treturn !!this.slots[slotName];\n+\t\treturn !!this.slots[this.getSlotAlias(slotName)];\n+\t}\n+\n+\t/**\n+\t * Checks if slot should be refreshed.\n+\t *\n+\t * @param {AdSlot} slot\n+\t * @returns {boolean}\n+\t */\n+\tshouldRefreshSlot(slot) {\n+\t\treturn this.bidsRefreshing.slots.includes(this.getSlotAlias(slot.getSlotName()));\n+\t}\n+\n+\t/**\n+\t * Returns slot which used bid with given impression id.\n+\t *\n+\t * @param {string | number} impId\n+\t * @returns {AdSlot | undefined }\n+\t */\n+\tgetRenderedSlot(impId) {\n+\t\tlet renderedSlot;\n+\n+\t\tslotService.forEach((slot) => {\n+\t\t\tif (slot.getTargeting().amzniid === impId) {\n+\t\t\t\trenderedSlot = slot;\n+\t\t\t}\n+\t\t});\n+\n+\t\treturn renderedSlot;\n+\t}\n+\n+\t/**\n+\t * Refreshes bid for given slot.\n+\t *\n+\t * @param {string | number} impId\n+\t */\n+\trefreshBid(slot) {\n+\t\tif (!this.shouldRefreshSlot(slot)) {\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tconst slotDef = this.createSlotDefinition(slot.getSlotName());\n+\n+\t\tif (slotDef) {\n+\t\t\tutils.logger(logGroup, 'refresh bids for slot', slotDef);\n+\t\t\tthis.fetchBids([slotDef]);","path":"src/ad-bidders/a9/index.js","position":225,"original_position":225,"commit_id":"2169cc7ca32f533a98bf898bc1ebcb7422b1ad06","original_commit_id":"2169cc7ca32f533a98bf898bc1ebcb7422b1ad06","user":{"login":"jacekbj","id":40768156,"node_id":"MDQ6VXNlcjQwNzY4MTU2","avatar_url":"https://avatars2.githubusercontent.com/u/40768156?v=4","gravatar_id":"","url":"https://api.github.com/users/jacekbj","html_url":"https://github.com/jacekbj","followers_url":"https://api.github.com/users/jacekbj/followers","following_url":"https://api.github.com/users/jacekbj/following{/other_user}","gists_url":"https://api.github.com/users/jacekbj/gists{/gist_id}","starred_url":"https://api.github.com/users/jacekbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacekbj/subscriptions","organizations_url":"https://api.github.com/users/jacekbj/orgs","repos_url":"https://api.github.com/users/jacekbj/repos","events_url":"https://api.github.com/users/jacekbj/events{/privacy}","received_events_url":"https://api.github.com/users/jacekbj/received_events","type":"User","site_admin":false},"body":"Yes, it is. Function called once bids are fetched updates only the slots for which bids were fetched.","created_at":"2018-12-14T15:12:25Z","updated_at":"2018-12-14T15:12:26Z","html_url":"https://github.com/Wikia/ad-engine/pull/248#discussion_r241786004","pull_request_url":"https://api.github.com/repos/Wikia/ad-engine/pulls/248","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Wikia/ad-engine/pulls/comments/241786004"},"html":{"href":"https://github.com/Wikia/ad-engine/pull/248#discussion_r241786004"},"pull_request":{"href":"https://api.github.com/repos/Wikia/ad-engine/pulls/248"}},"in_reply_to_id":241755136},"pull_request":{"url":"https://api.github.com/repos/Wikia/ad-engine/pulls/248","id":238432983,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4NDMyOTgz","html_url":"https://github.com/Wikia/ad-engine/pull/248","diff_url":"https://github.com/Wikia/ad-engine/pull/248.diff","patch_url":"https://github.com/Wikia/ad-engine/pull/248.patch","issue_url":"https://api.github.com/repos/Wikia/ad-engine/issues/248","number":248,"state":"open","locked":false,"title":"ADEN-7541 Add A9 to incontent_boxads. Enable bid refreshing for A9.","user":{"login":"jacekbj","id":40768156,"node_id":"MDQ6VXNlcjQwNzY4MTU2","avatar_url":"https://avatars2.githubusercontent.com/u/40768156?v=4","gravatar_id":"","url":"https://api.github.com/users/jacekbj","html_url":"https://github.com/jacekbj","followers_url":"https://api.github.com/users/jacekbj/followers","following_url":"https://api.github.com/users/jacekbj/following{/other_user}","gists_url":"https://api.github.com/users/jacekbj/gists{/gist_id}","starred_url":"https://api.github.com/users/jacekbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacekbj/subscriptions","organizations_url":"https://api.github.com/users/jacekbj/orgs","repos_url":"https://api.github.com/users/jacekbj/repos","events_url":"https://api.github.com/users/jacekbj/events{/privacy}","received_events_url":"https://api.github.com/users/jacekbj/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-13T15:36:32Z","updated_at":"2018-12-14T15:12:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc3fcbc2eb9fa48a41bb404158531d732667052a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":801456981,"node_id":"MDU6TGFiZWw4MDE0NTY5ODE=","url":"https://api.github.com/repos/Wikia/ad-engine/labels/Minor%20change","name":"Minor change","color":"c2e0c6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/ad-engine/pulls/248/commits","review_comments_url":"https://api.github.com/repos/Wikia/ad-engine/pulls/248/comments","review_comment_url":"https://api.github.com/repos/Wikia/ad-engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/ad-engine/issues/248/comments","statuses_url":"https://api.github.com/repos/Wikia/ad-engine/statuses/2169cc7ca32f533a98bf898bc1ebcb7422b1ad06","head":{"label":"Wikia:ADEN-7541","ref":"ADEN-7541","sha":"2169cc7ca32f533a98bf898bc1ebcb7422b1ad06","user":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":61872387,"node_id":"MDEwOlJlcG9zaXRvcnk2MTg3MjM4Nw==","name":"ad-engine","full_name":"Wikia/ad-engine","private":false,"owner":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Wikia/ad-engine","description":null,"fork":false,"url":"https://api.github.com/repos/Wikia/ad-engine","forks_url":"https://api.github.com/repos/Wikia/ad-engine/forks","keys_url":"https://api.github.com/repos/Wikia/ad-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/ad-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/ad-engine/teams","hooks_url":"https://api.github.com/repos/Wikia/ad-engine/hooks","issue_events_url":"https://api.github.com/repos/Wikia/ad-engine/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/ad-engine/events","assignees_url":"https://api.github.com/repos/Wikia/ad-engine/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/ad-engine/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/ad-engine/tags","blobs_url":"https://api.github.com/repos/Wikia/ad-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/ad-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/ad-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/ad-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/ad-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/ad-engine/languages","stargazers_url":"https://api.github.com/repos/Wikia/ad-engine/stargazers","contributors_url":"https://api.github.com/repos/Wikia/ad-engine/contributors","subscribers_url":"https://api.github.com/repos/Wikia/ad-engine/subscribers","subscription_url":"https://api.github.com/repos/Wikia/ad-engine/subscription","commits_url":"https://api.github.com/repos/Wikia/ad-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/ad-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/ad-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/ad-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/ad-engine/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/ad-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/ad-engine/merges","archive_url":"https://api.github.com/repos/Wikia/ad-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/ad-engine/downloads","issues_url":"https://api.github.com/repos/Wikia/ad-engine/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/ad-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/ad-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/ad-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/ad-engine/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/ad-engine/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/ad-engine/deployments","created_at":"2016-06-24T09:11:48Z","updated_at":"2018-12-13T13:41:43Z","pushed_at":"2018-12-14T14:41:09Z","git_url":"git://github.com/Wikia/ad-engine.git","ssh_url":"git@github.com:Wikia/ad-engine.git","clone_url":"https://github.com/Wikia/ad-engine.git","svn_url":"https://github.com/Wikia/ad-engine","homepage":null,"size":19447,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":2,"open_issues":5,"watchers":6,"default_branch":"dev"}},"base":{"label":"Wikia:dev","ref":"dev","sha":"e4c290a22048c0e4edecd14653c9e2c1bc609015","user":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":61872387,"node_id":"MDEwOlJlcG9zaXRvcnk2MTg3MjM4Nw==","name":"ad-engine","full_name":"Wikia/ad-engine","private":false,"owner":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Wikia/ad-engine","description":null,"fork":false,"url":"https://api.github.com/repos/Wikia/ad-engine","forks_url":"https://api.github.com/repos/Wikia/ad-engine/forks","keys_url":"https://api.github.com/repos/Wikia/ad-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/ad-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/ad-engine/teams","hooks_url":"https://api.github.com/repos/Wikia/ad-engine/hooks","issue_events_url":"https://api.github.com/repos/Wikia/ad-engine/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/ad-engine/events","assignees_url":"https://api.github.com/repos/Wikia/ad-engine/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/ad-engine/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/ad-engine/tags","blobs_url":"https://api.github.com/repos/Wikia/ad-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/ad-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/ad-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/ad-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/ad-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/ad-engine/languages","stargazers_url":"https://api.github.com/repos/Wikia/ad-engine/stargazers","contributors_url":"https://api.github.com/repos/Wikia/ad-engine/contributors","subscribers_url":"https://api.github.com/repos/Wikia/ad-engine/subscribers","subscription_url":"https://api.github.com/repos/Wikia/ad-engine/subscription","commits_url":"https://api.github.com/repos/Wikia/ad-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/ad-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/ad-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/ad-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/ad-engine/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/ad-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/ad-engine/merges","archive_url":"https://api.github.com/repos/Wikia/ad-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/ad-engine/downloads","issues_url":"https://api.github.com/repos/Wikia/ad-engine/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/ad-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/ad-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/ad-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/ad-engine/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/ad-engine/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/ad-engine/deployments","created_at":"2016-06-24T09:11:48Z","updated_at":"2018-12-13T13:41:43Z","pushed_at":"2018-12-14T14:41:09Z","git_url":"git://github.com/Wikia/ad-engine.git","ssh_url":"git@github.com:Wikia/ad-engine.git","clone_url":"https://github.com/Wikia/ad-engine.git","svn_url":"https://github.com/Wikia/ad-engine","homepage":null,"size":19447,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":2,"open_issues":5,"watchers":6,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/ad-engine/pulls/248"},"html":{"href":"https://github.com/Wikia/ad-engine/pull/248"},"issue":{"href":"https://api.github.com/repos/Wikia/ad-engine/issues/248"},"comments":{"href":"https://api.github.com/repos/Wikia/ad-engine/issues/248/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/ad-engine/pulls/248/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/ad-engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/ad-engine/pulls/248/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/ad-engine/statuses/2169cc7ca32f533a98bf898bc1ebcb7422b1ad06"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jacekbj"}}