Skip to content

Commit 3ffbd2d

Browse files
authored
Merge pull request #35 from mcclatchy/dsp-check
DSP try/catch check
2 parents 59c3ae8 + 626b32c commit 3ffbd2d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,22 @@ import * as config from "./lib/config.js";
77
import * as story from "./lib/story.js";
88

99
async function distributeZones(locker) {
10-
const subscriber = locker.user.isSubscriber();
10+
let subscriber, dma;
11+
12+
// DSP limited to production domains
13+
try {
14+
subscriber = locker.user.isSubscriber();
15+
dma = await locker.user.isInDMA();
16+
} catch(e) {
17+
subscriber = false;
18+
dma = false
19+
console.warn("DSP is not available");
20+
}
1121

1222
// Setup
1323
zones.setLocker(locker);
1424
zones.setConfig("subscriber", subscriber);
15-
zones.setConfig("dma", subscriber ? true : await locker.user.isInDMA());
25+
zones.setConfig("dma", subscriber ? true : dma);
1626
zones.setConfig("ads", locker.getYozonsLocker("core").areAdsAllowed());
1727

1828
// Config files

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mcclatchy/zones",
3-
"version": "1.10.0",
3+
"version": "1.10.1",
44
"description": "A Yozons extension to dynamically distribute or re-distribute zones on the websites.",
55
"main": "index.js",
66
"directories": {

0 commit comments

Comments
 (0)