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

Feature: Add multi-seller auction #910

Merged
merged 35 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b6bef2c
Create separate function for multi-seller auction
mohdsayed Jan 2, 2025
adf1bfd
Merge branch 'develop' of github.com:GoogleChromeLabs/ps-analysis-too…
mohdsayed Jan 2, 2025
214e1e6
Update next set of flow for multi-seller
mohdsayed Jan 2, 2025
16314c3
Move setupShowWinningAd to its own folder
mohdsayed Jan 2, 2025
a864eb5
Create Publisher Ad Server Flow
mohdsayed Jan 2, 2025
00441ff
Add horizontal and vertical lines
mohdsayed Jan 2, 2025
373578c
Merge branch 'develop' of github.com:GoogleChromeLabs/ps-analysis-too…
mohdsayed Jan 6, 2025
2b7dde6
Create seperate functions for component auctions
mohdsayed Jan 6, 2025
a294b07
Add more items in component auction
mohdsayed Jan 6, 2025
2871071
Move auctions to its own folder
mohdsayed Jan 7, 2025
e46c018
Move all multi-seller and single-seller functions to its own folder
mohdsayed Jan 7, 2025
34e0f85
Refactor setupRunAdAuction flow
mohdsayed Jan 7, 2025
612799c
Increase canvas height by updating the magic number
mohdsayed Jan 7, 2025
64d0ed2
Refactor code into multiple files
mohdsayed Jan 8, 2025
b00da84
Refactor code
mohdsayed Jan 8, 2025
af0c20f
Add first auction flow for component auction
mohdsayed Jan 8, 2025
a9cec85
Create new Text component
mohdsayed Jan 8, 2025
f389f9e
Add SSP B auction and increase canvas width
mohdsayed Jan 8, 2025
a785de2
Use loop to render components
mohdsayed Jan 8, 2025
4fc68d0
Provide config to each component auction
mohdsayed Jan 8, 2025
ba77d3e
Refactor code
mohdsayed Jan 9, 2025
caf8807
Add flow after component auction
mohdsayed Jan 9, 2025
a0d6051
Merge branch 'develop' of github.com:GoogleChromeLabs/ps-analysis-too…
mohdsayed Jan 13, 2025
9878b65
Reduce title text boldness
mohdsayed Jan 13, 2025
b08f9ff
Introduce a new Custom component
mohdsayed Jan 13, 2025
5832f15
Draw no fill box after ripple effect is completed
mohdsayed Jan 14, 2025
25ef211
Align all component auctions vertically
mohdsayed Jan 14, 2025
94f3b06
Add show winning ad box
mohdsayed Jan 14, 2025
c1a8ec2
Remove stopper for large auction
mohdsayed Jan 14, 2025
a30635c
Add checkbox for multi seller
mohdsayed Jan 14, 2025
ba1c928
Reset protectedAudience/app.js
mohdsayed Jan 14, 2025
b48ee91
Update todos
mohdsayed Jan 14, 2025
cf50ba1
Update isMultiseller and reset auctions data on multi-seller change
mohdsayed Jan 14, 2025
36ffb1a
Reset on multi-seller checkbox change
mohdsayed Jan 14, 2025
94c0ff3
Play after reset
mohdsayed Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2024 Google LLC
*
* Licensed 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
*
* https://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 CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Custom component to allow rendering any shape which are used in only some specific cases and are not resuable
* as the flow relies on a component to be used for each step.
* @param {object} props Component props
* @param props.render Render fuction to execute inside the Custom function.
* @returns {any} Return anything that render function wants to return, mostly nextTip object.
*/
const Custom = ({ render }) => {
return render();
};

export default Custom;
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ export { default as Branches } from './branches';
export { default as ProgressLine } from './progressLine';
export { default as RippleEffect } from './rippleEffect';
export { default as FlowExpander } from './flowExpander';
export { default as Text } from './text';
export { default as Custom } from './custom';
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2024 Google LLC
*
* Licensed 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
*
* https://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 CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Internal dependencies.
*/
import app from '../app';
import config from '../config';

const Text = ({ text, x, y }) => {
x = typeof x === 'function' ? x() : x;
y = typeof y === 'function' ? y() : y;

const nextTip = {
x: x,
y: y,
};

const p = app.p;

p.push();
p.textAlign(p.CENTER, p.CENTER);
p.fill(config.flow.colors.box.text);
p.strokeWeight(0);
p.textFont('sans-serif');
p.text(text, x, y);
p.pop();

return nextTip;
};

export default Text;
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const config = {
canvas: {
width: 700,
height: 500,
extraHeight: 1600, // @todo: It needs to be calculated based on the content.
extraWidth: 450, // @todo: It needs to be calculated based on the content.
background: '#fff',
fontSize: 12,
},
Expand Down
11 changes: 11 additions & 0 deletions packages/explorable-explanations/src/protectedAudience/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,17 @@ app.toggleMultSeller = (event) => {

// Define the sketch
export const sketch = (p) => {
p.updateWithProps = (props) => {
if (app.isMultiSeller !== props.isMultiSeller) {
app.reset();
setTimeout(() => {
app.play(true);
}, 500);
}

app.isMultiSeller = props.isMultiSeller;
};

app.promiseQueue = new Queue({
concurrency: 1,
autostart: false,
Expand Down
Loading
Loading