Skip to content

Commit

Permalink
Merge pull request #596 from adobecom/2410
Browse files Browse the repository at this point in the history
DC MILO 0.2410
  • Loading branch information
Blainegunn authored Mar 5, 2024
2 parents acf1a98 + f1baff3 commit 24f9aef
Show file tree
Hide file tree
Showing 38 changed files with 1,720 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
test/e2e
test/e2e
test/edgeworkers
edgeworkers
51 changes: 51 additions & 0 deletions .github/workflows/deploy-edgeworker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: EdgeWorker

on:
workflow_dispatch:
inputs:
testCodeBranch:
description: 'Test Code Branch'
required: true
default: 'stage'
type: string
edgeworker:
description: 'Edge Worker'
type: choice
required: true
default: 'Acrobat_DC_web_stg'
options:
- 'Acrobat_DC_web_stg'
- 'Acrobat_DC_web_prod'
network:
description: 'Network'
type: choice
required: true
default: 'staging'
options:
- 'staging'
- 'production'

jobs:
deploy-edgeworker:
name: Deploy EdgeWorker
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.testCodeBranch }}

- name: Build Edge Worker Scripts
run: |
npm run ewbuild
npm run ewprod2stg
- name: Deploy Edge Worker
uses: jdmevo123/akamai-edgeworker-action@1.1
env:
EDGERC: ${{ secrets.AKAMAI_EDGERC }}
WORKER_DIR: edgeworkers/${{ inputs.edgeworker }}
with:
edgeworkersName: ${{ inputs.edgeworker }}
network: ${{ inputs.network }}
groupid: '58544'
9 changes: 9 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DC CODEOWNERS
# When you create a new block or tool please establish ownership in this file.
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

# DC Core
/acrobat/ @NadiiaSokolova

# DC Blocks
/acrobat/blocks/ @NadiiaSokolova
8 changes: 4 additions & 4 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
orientation..

## Our Standards

Expand Down Expand Up @@ -41,7 +41,7 @@ Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful..
threatening, offensive, or harmful.

## Scope

Expand All @@ -59,11 +59,11 @@ reported by contacting the project team at Grp-opensourceoffice@adobe.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately..
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
members of the project's leadership..

## Attribution

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For other contributors, a maintainer of the project has to approve the pull requ
2. Make some changes on a branch on your fork
3. Create a pull request from your branch

In your pull request, outline:
In your pull request, outline::

* What the changes intend
* How they change the existing code
Expand Down
2 changes: 1 addition & 1 deletion acrobat/blocks/eventwrapper/eventwrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Allows for content variation depeding on whcih events the DC Widget emits. The a
|--------------------------|
| Fragment or content |

*Note: Several fragments can be stacked in the same cell.*
*Note: Several fragments can be stacked in the same cell..*

## Debug
Use the following URL query to see all Event Wrapper blocks on a page `eventsAll`. They will be highlighted in shardes of blue.
6 changes: 3 additions & 3 deletions acrobat/blocks/pricing-card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
```
| pricing-card |
|---------------------------------------------------------------------------------------------------------------------------------------------- |
| title | Text that will be shown in header of card. Text styled as H1 will have font size 24h, and other text will have font size 20px |
| title | Text that will be shown in header of card Text styled as H1 will have font size 24h, and other text will have font size 20px |
| optionN | Options from 1 to N that will be listed as radio buttons in middle section of the pricing card |
| priceN | Prices from 1 to N that will be displayed below the card title, when corresponding option is selected |
| ctaN | Button/buttons group from 1 to N that will be displayed in the footer of the card, when corresponding option is selected |
| disclaimerN | Disclaimer text from 1 to N that will be displayed below the price, when corresponding option is selected |
| initialOption | Optional. Name of option that will be selected by default. If not defined, option1 will be used as default. |
| initialOption | Optional. Name of option that will be selected by default. If not defined, option1 will be used as default.. |
| promotionText | Optional property. If defined, card will have yellow border and yellow box in top right corner, with promotion text. |
| | Text styled as H1 inside promotion text will be bold with font-size:14px, and the rest of text will have font-size:12px |
```

Pricing cards should be defined inside one section, with section-metadata (style "pricing-card-columns"). For example:
Pricing cards should be defined inside one section, with section-metadata (style "pricing-card-columns"). For example.:

---
|pricing-card|
Expand Down
55 changes: 55 additions & 0 deletions acrobat/scripts/geo-phoneNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-disable compat/compat */
/* c8 ignore next 53 */
export default async function geoPhoneNumber() {
const geoTwo = await fetch('https://geo2.adobe.com/json/');
const urlParams = new URLSearchParams(window.location.search);
const geoData = await geoTwo.json();

let newLocale = urlParams.get('akamaiLocale')?.toLowerCase()
|| geoData?.country?.toLowerCase()
|| JSON.parse(sessionStorage.getItem('international'))?.country?.toLowerCase()
|| JSON.parse(sessionStorage.getItem('feds_location'))?.country?.toLowerCase()
|| '';

if (newLocale === 'us' || newLocale === '/' || newLocale === '//') {
newLocale = '/';
} else {
newLocale = `/${newLocale}/`;
}

const updatePhoneNumber = (visNum, i) => {
const phoneNumberEle = document.querySelector(`.${i}`);
phoneNumberEle.href = `tel:${visNum}`;
phoneNumberEle.innerText = visNum;
};

const placeHolderJson = await fetch(`${newLocale}dc-shared/placeholders.json`);
if (placeHolderJson.status !== 200) return;
const placeHolderJsonData = await placeHolderJson.json();
window.dcpns = placeHolderJsonData.data;
const globalPhoneNumbers = new CustomEvent('DCNumbers:Ready');
window.dispatchEvent(globalPhoneNumbers);

document.querySelectorAll('a[class*="geo-pn"]').forEach((phoneNumber) => {
const numberType = phoneNumber.getAttribute('number-type');
const numberID = phoneNumber.classList[0];
placeHolderJsonData.data.forEach((val) => {
if (val.key === numberType) {
updatePhoneNumber(val.value, numberID);
}
});
});
}

const frags = document.querySelectorAll('.fragment [href*="tel"]');
window.addEventListener('DCNumbers:Ready', () => {
frags.forEach((f) => {
const fragPhoneType = `phone-${f.href.split(' ')[1]}`;
window.dcpns.forEach((val) => {
if (val.key === fragPhoneType) {
f.innerText = val.value;
f.href = `tel: ${val.value}`;
}
});
});
});
25 changes: 24 additions & 1 deletion acrobat/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
* governing permissions and limitations under the License.
*/

const pattern = /{{phone-\S\w*\S\w*}}/g;
document.querySelectorAll('a').forEach((p, idx) => {
if (pattern.exec(p.innerHTML)) {
p.setAttribute('number-type', p.innerHTML.match(pattern)[0].replace(/[&/\\#,+()$~%.'":*?<>{}]/g, ''));
p.classList.add(`geo-pn${idx}`);
}
});

/**
* The decision engine for where to get Milo's libs from.
*/
Expand Down Expand Up @@ -248,7 +256,15 @@ const CONFIG = {
commerce: { checkoutClientId: 'doc_cloud' },
local: {
edgeConfigId: 'da46a629-be9b-40e5-8843-4b1ac848745cdfdga',
pdfViewerClientId: '5bfb3a784f2642f88ecf9d2ff4cd573e',
pdfViewerClientId: 'ec572982b2a849d4b16c47d9558d66d1',
pdfViewerReportSuite: 'adbadobedxqa',
},
dcmain: {
pdfViewerClientId: 'a42d91c0e5ec46f982d2da0846d9f7d0',
pdfViewerReportSuite: 'adbadobedxqa',
},
dcstage: {
pdfViewerClientId: '2522674a708e4ddf8bbd62e18585ae4b',
pdfViewerReportSuite: 'adbadobedxqa',
},
stage: {
Expand Down Expand Up @@ -383,4 +399,11 @@ const { ietf } = getLocale(locales);
window.dispatchEvent(imsIsReady);
}
}, 1000);

if (document.querySelectorAll('a[class*="geo-pn"]').length > 0 || document.querySelectorAll('a[href*="geo"]').length > 0) {
const { default: geoPhoneNumber } = await import('./geo-phoneNumber.js');
geoPhoneNumber();
}
}());


4 changes: 4 additions & 0 deletions edgeworkers/Acrobat_DC_web_prod/bundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"edgeworker-version": "0.83",
"description" : "remove hash for legacy.js IE/Trident script"
}
Loading

0 comments on commit 24f9aef

Please sign in to comment.