mod-build 3.5.6 → 3.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,11 +3,13 @@ var source = require('vinyl-source-stream');
3
3
 
4
4
  // helper to allow us to define an "end" event to multiple streams
5
5
  function streamToDestination(gulp, siteSettings, inputPath, destPath, fileName) {
6
+ var url = `https://${siteSettings.nodeEnv}/quote/resources/mod-site${inputPath}`;
7
+
6
8
  return new Promise(resolve => { // eslint-disable-line no-undef
7
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site${inputPath}`)
9
+ request(url)
8
10
  .on('response', resp => {
9
11
  if (resp.statusCode !== 200) {
10
- throw new Error('Error fetching about/privacy/terms modals');
12
+ throw new Error(`Error fetching ${url}`);
11
13
  }
12
14
  })
13
15
  .pipe(source(fileName))
@@ -28,17 +30,9 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
28
30
  // key: inputPath, value: destPath
29
31
 
30
32
  externalResources = {
31
- '/templates/modals/about/': ['/templates/modals/about/', 'index.html'],
32
- '/templates/modals/privacy/': ['/templates/modals/privacy/', 'index.html'],
33
- '/templates/modals/terms/': ['/templates/modals/terms/', 'index.html'],
34
- '/templates/qs-modals/contact-us/': ['/templates/modals/contact-us/', 'index.html'],
35
33
  '/templates/scripts/trusted-form.html': ['/templates/scripts/', 'trusted-form.html']
36
34
  };
37
35
 
38
- if (includeFaqLink) {
39
- Object.assign(externalResources, {'/templates/modals/faq/': ['/templates/modals/faq/', 'index.html']});
40
- }
41
-
42
36
  Object.assign(externalResources, {'/templates/scripts/jornaya.html': ['/templates/scripts/', 'jornaya.html']});
43
37
 
44
38
  if (isModWhiteLabel || domainHasModernize) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.5.6",
3
+ "version": "3.6.0-beta.1",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,77 +0,0 @@
1
- /**
2
- * This file runs modals for links such as About us, Privacy,
3
- * and Terms (usually in the footer of a form page). It loads
4
- * respective page into a modal window.
5
- *
6
- * Requires:
7
- * - jQuery
8
- * - Twitter Bootstrap 3
9
- *
10
- * Links mark up example:
11
- * <a href="#privacy" data-bind="modal-link">Privacy Policy</a>
12
- *
13
- * It will load a '/templates/modals/privacy.html' via AJAX into a modal window
14
- */
15
-
16
- /* eslint brace-style: 0 */
17
- (function($) {
18
- var modalTplsUrl = '/modals',
19
- modalId = 'info-modal',
20
- modalTpl = [
21
- /* eslint-disable indent */
22
- '<div class="modal" id="' + modalId + '" tabindex="-1" role="dialog" aria-labelledby="infoModal" aria-hidden="true">',
23
- '<div class="modal-dialog">',
24
- '<div class="modal-content">',
25
- '<div class="modal-header">',
26
- '<h4 class="modal-title"></h4>',
27
- '</div>',
28
- '<div class="modal-body">Loading...</div>',
29
- '<div class="modal-footer">',
30
- '<button type="button" class="btn btn-primary close" data-dismiss="modal">Close</button>',
31
- '</div>',
32
- '</div>',
33
- '</div>',
34
- '</div>'
35
- /* eslint-enable indent */
36
- ].join('');
37
-
38
- $(document).ready(function() {
39
- $('body').on('click', 'a[data-bind="modal-link"]', function(e) {
40
- e.preventDefault();
41
-
42
- var $link = $(this),
43
- loadUrl;
44
-
45
- if ($link.attr('data-load')) {
46
- loadUrl = $link.attr('data-load');
47
- }
48
- else if ($link.attr('href') !== '') {
49
- loadUrl = modalTplsUrl + $link.attr('href');
50
- }
51
- else {
52
- return;
53
- }
54
-
55
- $('#' + modalId).remove();
56
- $('body').append($(modalTpl));
57
-
58
- var $modal = $('#' + modalId);
59
-
60
- $modal.find('.modal-title').text($link.text());
61
- $modal.find('.modal-body').load(loadUrl, function() {
62
- // Anchors inside of modal
63
- $modal.find('a[href*=\\#]').on('click', function(e) {
64
- e.preventDefault();
65
- $(this.hash)[0].scrollIntoView({behavior: 'smooth'});
66
- });
67
-
68
- var $anchor = $($link.data('anchor'));
69
-
70
- if ($anchor.length > 0) {
71
- $anchor[0].scrollIntoView();
72
- }
73
- });
74
- $modal.modal('show');
75
- });
76
- });
77
- })(jQuery);