@mjhls/mjh-framework 1.0.450 → 1.0.451

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.450
2
+ # mjh-framework v. 1.0.451
3
3
 
4
4
  > Foundation Framework
5
5
 
package/dist/cjs/View.js CHANGED
@@ -57,7 +57,7 @@ var getSerializers = require('./getSerializers.js');
57
57
  require('./util-f2c1b65b.js');
58
58
  require('react-bootstrap/Pagination');
59
59
  require('next/dynamic');
60
- var getTargeting = require('./getTargeting-37612527.js');
60
+ var getTargeting = require('./getTargeting-ec7dd217.js');
61
61
  var urlFor = require('./urlFor.js');
62
62
 
63
63
  var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
@@ -52,6 +52,8 @@ var getTargeting = function getTargeting(props) {
52
52
  context = context && context.split('?')[0];
53
53
  context = context && context.split('&')[0];
54
54
  var content_placement_urls = [];
55
+ // New variable to store document group
56
+ var document_group_urls = [];
55
57
  if (content_placement && prevUrl && prevUrl.length) {
56
58
  content_placement.forEach(function (item) {
57
59
  var path = item.path;
@@ -70,21 +72,32 @@ var getTargeting = function getTargeting(props) {
70
72
  });
71
73
  }
72
74
 
73
- if (content_placement) {
74
- if (content_placement_urls.length === 0) {
75
- content_placement_urls = content_placement.map(function (item) {
76
- return cpModificationRequired ? getContentPlacementUrl(item) : item.path;
77
- });
75
+ // Comparing document group with previous url to store in 'document_group_urls'.
76
+ if (document_group && prevUrl && prevUrl.length) {
77
+ var previous_url_to_check = prevUrl;
78
+ if (prevUrl.includes('?')) {
79
+ previous_url_to_check = prevUrl.split('?')[0];
78
80
  }
79
- } else {
80
- content_placement_urls = ['/'];
81
+
82
+ if (previous_url_to_check.endsWith(document_group)) {
83
+ document_group_urls.push(document_group);
84
+ }
85
+ }
86
+
87
+ // Updating condition to set content_placement only when 'document_group_urls' and 'content_placement_urls' is empty.
88
+ if (content_placement && content_placement_urls.length === 0 && document_group_urls.length === 0) {
89
+ content_placement_urls = content_placement.map(function (item) {
90
+ return cpModificationRequired ? getContentPlacementUrl(item) : item.path;
91
+ });
81
92
  }
93
+
82
94
  var articleKeywords = [].concat(toConsumableArray._toConsumableArray(internalTag), toConsumableArray._toConsumableArray(userDefinedTag), toConsumableArray._toConsumableArray(SponsorshipTag), toConsumableArray._toConsumableArray(seoTag));
83
95
  var targeting = {
84
96
  tags: articleKeywords,
85
- document_group: [document_group],
97
+ // making sure either 'document_group' or 'content_placement' is returned in targeting.
98
+ document_group: content_placement_urls && content_placement_urls.length ? '' : document_group_urls,
86
99
  document_url: [url],
87
- content_placement: content_placement_urls
100
+ content_placement: document_group_urls && document_group_urls.length ? '' : content_placement_urls
88
101
  };
89
102
 
90
103
  if (article.issue && article.issue.path) {
@@ -8,7 +8,7 @@ require('./from-ea347372.js');
8
8
  require('./toConsumableArray-ca04303b.js');
9
9
  require('./_object-pie-68c5bcbc.js');
10
10
  require('./extends-60837c34.js');
11
- var getTargeting = require('./getTargeting-37612527.js');
11
+ var getTargeting = require('./getTargeting-ec7dd217.js');
12
12
 
13
13
 
14
14
 
package/dist/cjs/index.js CHANGED
@@ -157,7 +157,7 @@ require('swr');
157
157
  require('passport-local');
158
158
  require('mysql');
159
159
  var View = require('./View.js');
160
- var getTargeting = require('./getTargeting-37612527.js');
160
+ var getTargeting = require('./getTargeting-ec7dd217.js');
161
161
  var urlFor = require('./urlFor.js');
162
162
  var getKeywords = require('./getKeywords.js');
163
163
  var getQuery = require('./getQuery.js');
package/dist/esm/View.js CHANGED
@@ -52,7 +52,7 @@ import getSerializers from './getSerializers.js';
52
52
  import './util-7700fc59.js';
53
53
  import 'react-bootstrap/Pagination';
54
54
  import 'next/dynamic';
55
- import { a as getContentPlacementUrl, g as getTargeting } from './getTargeting-8f4bd5db.js';
55
+ import { a as getContentPlacementUrl, g as getTargeting } from './getTargeting-02118961.js';
56
56
  import urlFor from './urlFor.js';
57
57
 
58
58
  var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
@@ -50,6 +50,8 @@ var getTargeting = function getTargeting(props) {
50
50
  context = context && context.split('?')[0];
51
51
  context = context && context.split('&')[0];
52
52
  var content_placement_urls = [];
53
+ // New variable to store document group
54
+ var document_group_urls = [];
53
55
  if (content_placement && prevUrl && prevUrl.length) {
54
56
  content_placement.forEach(function (item) {
55
57
  var path = item.path;
@@ -68,21 +70,32 @@ var getTargeting = function getTargeting(props) {
68
70
  });
69
71
  }
70
72
 
71
- if (content_placement) {
72
- if (content_placement_urls.length === 0) {
73
- content_placement_urls = content_placement.map(function (item) {
74
- return cpModificationRequired ? getContentPlacementUrl(item) : item.path;
75
- });
73
+ // Comparing document group with previous url to store in 'document_group_urls'.
74
+ if (document_group && prevUrl && prevUrl.length) {
75
+ var previous_url_to_check = prevUrl;
76
+ if (prevUrl.includes('?')) {
77
+ previous_url_to_check = prevUrl.split('?')[0];
76
78
  }
77
- } else {
78
- content_placement_urls = ['/'];
79
+
80
+ if (previous_url_to_check.endsWith(document_group)) {
81
+ document_group_urls.push(document_group);
82
+ }
83
+ }
84
+
85
+ // Updating condition to set content_placement only when 'document_group_urls' and 'content_placement_urls' is empty.
86
+ if (content_placement && content_placement_urls.length === 0 && document_group_urls.length === 0) {
87
+ content_placement_urls = content_placement.map(function (item) {
88
+ return cpModificationRequired ? getContentPlacementUrl(item) : item.path;
89
+ });
79
90
  }
91
+
80
92
  var articleKeywords = [].concat(_toConsumableArray(internalTag), _toConsumableArray(userDefinedTag), _toConsumableArray(SponsorshipTag), _toConsumableArray(seoTag));
81
93
  var targeting = {
82
94
  tags: articleKeywords,
83
- document_group: [document_group],
95
+ // making sure either 'document_group' or 'content_placement' is returned in targeting.
96
+ document_group: content_placement_urls && content_placement_urls.length ? '' : document_group_urls,
84
97
  document_url: [url],
85
- content_placement: content_placement_urls
98
+ content_placement: document_group_urls && document_group_urls.length ? '' : content_placement_urls
86
99
  };
87
100
 
88
101
  if (article.issue && article.issue.path) {
@@ -6,4 +6,4 @@ import './from-2c0a5f49.js';
6
6
  import './toConsumableArray-8712d678.js';
7
7
  import './_object-pie-33c40e79.js';
8
8
  import './extends-6e00b262.js';
9
- export { g as default } from './getTargeting-8f4bd5db.js';
9
+ export { g as default } from './getTargeting-02118961.js';
package/dist/esm/index.js CHANGED
@@ -153,7 +153,7 @@ import 'swr';
153
153
  import 'passport-local';
154
154
  import 'mysql';
155
155
  export { default as View } from './View.js';
156
- export { g as getTargeting } from './getTargeting-8f4bd5db.js';
156
+ export { g as getTargeting } from './getTargeting-02118961.js';
157
157
  export { default as urlFor } from './urlFor.js';
158
158
  export { default as getKeywords } from './getKeywords.js';
159
159
  export { default as getQuery } from './getQuery.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.450",
3
+ "version": "1.0.451",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",