Skip to content

Commit 3b9145b

Browse files
authored
Merge pull request #199 from moderntribe/release/3.13.0
packaged version 3.13.0
2 parents a9607d7 + 01f739b commit 3b9145b

29 files changed

+1624
-809
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## [3.13.0]
4+
5+
### Added
6+
7+
- Added category and product view limitations to customers that are members of a
8+
group with product category visibility limitations.
9+
- Added a filter to modify the cache time of user group category visibility.
10+
`bigcommerce/product_category/group_filter_terms_user_cache_time` accepts a value,
11+
in seconds, for how long to cache the local list of terms by user.
12+
- Added a new tab to the Resources section in the plugin admin area. The
13+
new section, Tutorials, contains video tutorial links from BigCommerce's YouTube channel.
14+
15+
### Changed
16+
17+
- Added a feature that scrolls the browser to the top of the embedded checkout iframe
18+
upon completion of the order. This resolves an issue on smaller screens where
19+
the window would be stuck at the bottom of the page.
20+
21+
### Fixed
22+
23+
324
## [3.12.0]
425

526
### Added

assets/css/bc-admin.css

Lines changed: 185 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/bc-admin.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/admin/scripts.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/admin/scripts.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/scripts.js

Lines changed: 635 additions & 635 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/scripts.min.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/vendor.js

Lines changed: 111 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/vendor.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/src/admin/resources/resources.js

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import delegate from 'delegate';
77
import _ from 'lodash';
88
import * as tools from '../../utils/tools';
9-
import { resourceCard, tabButton, tabCardsContent, tabContentContainer, paginationLink, noDataAvailable } from '../templates/resources';
9+
import { resourceCard, resourceVideoCard, tabButton, tabCardsContent, tabVideoCardsContent, tabContentContainer, paginationLink, noDataAvailable, videoPlaylist } from '../templates/resources';
1010
import { ADMIN_IMAGES } from '../config/wp-settings';
1111
import { on, trigger } from '../../utils/events';
1212
import scrollTo from '../../utils/dom/scroll-to';
@@ -20,6 +20,7 @@ const el = {
2020
const tabInstances = {
2121
tabs: [],
2222
cards: [],
23+
videos: [],
2324
cards_per_page: 12,
2425
};
2526

@@ -58,6 +59,41 @@ const createCards = (cards, label) => {
5859
});
5960
};
6061

62+
/**
63+
* @function createVideoCards
64+
* @description Build the HTML elements for each video card data available in the bigcommerce_resources_json JSON.
65+
* @param videos
66+
* @param label
67+
* @param playlistLabel
68+
*/
69+
const createVideoCards = (videos = {}, label = '', playlistLabel = '') => {
70+
Object.values(videos).forEach((card) => {
71+
const smallThumb = _.get(card, 'thumbnail.small');
72+
const largeThumb = _.get(card, 'thumbnail.large');
73+
// If we have images, use them. Otherwise, we'll use the BigCommerce logo thumbnail placeholder.
74+
const image1 = smallThumb ? `${smallThumb} 1x,` : `${ADMIN_IMAGES}bigcommerce-resource-thumbnail.png 1x,`;
75+
const image2 = largeThumb ? `${largeThumb} 2x,` : `${ADMIN_IMAGES}bigcommerce-resource-thumbnail-2x.png 2x`;
76+
// Create a card and push it as a new indexed item in the cards array.
77+
tabInstances.videos[playlistLabel].push(resourceVideoCard(image1, image2, card.name, card.video_length, card.description, card.url));
78+
});
79+
};
80+
81+
/**
82+
* @function createVideoPlaylists
83+
* @description Creates an array of playlists with completed markup.
84+
* @param playlists
85+
* @param label
86+
*/
87+
const createVideoPlaylists = (playlists = {}, label = '') => {
88+
Object.values(playlists).forEach((playlist) => {
89+
const playlistLabel = playlist.playlist_label;
90+
tabInstances.videos[playlistLabel] = [];
91+
92+
tabInstances.videos[playlistLabel].push(createVideoCards(playlist.videos, label, playlistLabel));
93+
tabInstances.cards[label].push(videoPlaylist(playlistLabel, playlist.playlist, tabInstances.videos[playlistLabel].join(''), tabInstances.videos[playlistLabel].length - 1));
94+
});
95+
};
96+
6197
/**
6298
* @function createTabs
6399
* @description Create a new tab button for each available tabInstances.tabs;
@@ -104,7 +140,6 @@ const createTabContentContainers = () => {
104140
// Create a wrapper element to attach the containers to.
105141
const contentWrapper = document.createElement('div');
106142
tools.addClass(contentWrapper, 'bc-resources-tabs__content');
107-
tools.addClass(contentWrapper, 'bc-resources-tabs__max-width');
108143
el.contentContainer.appendChild(contentWrapper);
109144

110145
// Loop through the available keys and create the parent container tied to the tab button.
@@ -223,7 +258,12 @@ const getPaginatedItems = (e, cardKey = '', currentPage = 1) => {
223258
const offset = (currentPage - 1) * tabInstances.cards_per_page;
224259
const paginatedItems = tabInstances.cards[key].slice(offset, offset + tabInstances.cards_per_page);
225260

226-
cardPageWrapper.insertAdjacentHTML('beforeend', tabCardsContent(key, paginatedItems.join(''), currentPage));
261+
if (key === 'Tutorials') {
262+
cardPageWrapper.insertAdjacentHTML('beforeend', tabVideoCardsContent(key, paginatedItems.join(''), currentPage));
263+
} else {
264+
cardPageWrapper.insertAdjacentHTML('beforeend', tabCardsContent(key, paginatedItems.join(''), currentPage));
265+
}
266+
227267
focusFirstPagedCard(key, currentPage);
228268
};
229269

@@ -274,7 +314,12 @@ const initResourceCards = () => {
274314

275315
tabInstances.tabs.push(tabButton(section.label));
276316
tabInstances.cards[section.label] = [];
277-
createCards(section.resources, section.label);
317+
318+
if (section.label === 'Tutorials') {
319+
createVideoPlaylists(section.resources, section.label);
320+
} else {
321+
createCards(section.resources, section.label);
322+
}
278323
});
279324

280325
createTabs();

0 commit comments

Comments
 (0)