Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c32eeaa
added fixed for shopping tag rendering
jshamble Apr 7, 2022
9c807f0
added shopping json patch that fixed regression
jshamble Apr 11, 2022
86dd0f3
resolved promise .all
jshamble Apr 11, 2022
ab39a72
updated template
jshamble Apr 11, 2022
0bb58ce
refactored state update
jshamble Apr 11, 2022
52c0312
fixed promise resolution
jshamble Apr 12, 2022
2088558
added more descriptive error message
jshamble Apr 15, 2022
5618cb7
cahnged order of ternary
jshamble Apr 15, 2022
05cac5f
added history check for page refresh
jshamble Apr 18, 2022
d341d6b
updated hsitory service to store all data, not jsut the activeData
jshamble Apr 18, 2022
781fe65
added shopping element
jshamble Apr 18, 2022
2103d85
added shopping attachment logic for page refresh, added back active p…
jshamble Apr 18, 2022
0b685ac
added set history state test
jshamble Apr 18, 2022
8d05b46
cleaned up some minor nits
jshamble Apr 18, 2022
a2e94fe
added unit test for shopping tag history
jshamble Apr 18, 2022
f818401
history stub
jshamble Apr 18, 2022
d0f5d36
added shopping if clause optimizations
jshamble Apr 19, 2022
a87a927
added dependencies
jshamble Apr 19, 2022
cfb87f2
added dependencies
jshamble Apr 19, 2022
0b78d51
added dependencies
jshamble Apr 19, 2022
8a3fcd3
updated unit tests
jshamble Apr 19, 2022
723981b
updated unit tests
jshamble Apr 19, 2022
e05b6ce
updated unit tests
jshamble Apr 19, 2022
ed8d8f3
removed check
jshamble Apr 19, 2022
b75b6e5
browser test safari
jshamble Apr 19, 2022
b44c364
browser test safari
jshamble Apr 19, 2022
b5130a5
added better url checks
jshamble Apr 19, 2022
66e7b9a
added stuff
jshamble Apr 19, 2022
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
30 changes: 19 additions & 11 deletions extensions/amp-story-shopping/0.1/amp-story-shopping-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,26 @@ export class AmpStoryShoppingAttachment extends AMP.BaseElement {
/** @override */
buildCallback() {
this.pageEl_ = this.element.closest('amp-story-page');

this.shoppingTags_ = Array.from(
this.pageEl_.querySelectorAll('amp-story-shopping-tag')
);

getShoppingConfig(this.element, this.pageEl_.id).then((config) =>
storeShoppingConfig(this.pageEl_, config)
Comment thread
jshamble marked this conversation as resolved.
);
return getShoppingConfig(this.element, this.pageEl_.id)
.then((config) => {
if (
this.shoppingTags_.length === 0 ||
Object.keys(config).length === 0
) {
return;
}

if (this.shoppingTags_.length === 0) {
return;
}
storeShoppingConfig(this.pageEl_, config);

return this.localizationService_
.getLocalizedStringAsync(
LocalizedStringId_Enum.AMP_STORY_SHOPPING_CTA_LABEL
)
return this.localizationService_.getLocalizedStringAsync(
LocalizedStringId_Enum.AMP_STORY_SHOPPING_CTA_LABEL
);
})
.then((ctaText) => {
this.attachmentEl_ = (
<amp-story-page-attachment
Expand All @@ -110,7 +114,11 @@ export class AmpStoryShoppingAttachment extends AMP.BaseElement {

/** @override */
layoutCallback() {
if (this.shoppingTags_.length === 0) {
Comment thread
jshamble marked this conversation as resolved.
if (
this.shoppingTags_.length === 0 ||
this.storeService_.get(StateProperty.SHOPPING_DATA)[this.pageEl_.id] ===
undefined
) {
return;
}
loadFonts(this.win, FONTS_TO_LOAD);
Expand Down