@livepreso/api 6.55.1 → 6.56.0
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/.rush/temp/shrinkwrap-deps.json +1013 -1191
- package/CHANGELOG.json +29 -0
- package/CHANGELOG.md +19 -1
- package/cjs/api.js +3 -5
- package/cjs/api.js.map +1 -1
- package/cjs/auth.spec.js +11 -11
- package/cjs/auth.spec.js.map +1 -1
- package/cjs/collections/appointment-tags.js +14 -15
- package/cjs/collections/appointment-tags.js.map +1 -1
- package/cjs/collections/base.spec.js +30 -30
- package/cjs/collections/base.spec.js.map +1 -1
- package/cjs/fixtures.js +1 -2
- package/cjs/fixtures.js.map +1 -1
- package/cjs/models/appointment.js +7 -7
- package/cjs/models/appointment.js.map +1 -1
- package/cjs/models/base.js +30 -12
- package/cjs/models/base.js.map +1 -1
- package/cjs/models/cms-val.spec.js +2 -2
- package/cjs/models/cms-val.spec.js.map +1 -1
- package/cjs/models/deck-version.js +14 -34
- package/cjs/models/deck-version.js.map +1 -1
- package/cjs/models/manifest-json.js +41 -5
- package/cjs/models/manifest-json.js.map +1 -1
- package/cjs/models/pack.js +2 -1
- package/cjs/models/pack.js.map +1 -1
- package/cjs/models/snapshot.spec.js +2 -2
- package/cjs/models/snapshot.spec.js.map +1 -1
- package/cjs/models/template.js +10 -10
- package/cjs/models/template.js.map +1 -1
- package/cjs/models/timing-log.spec.js +2 -2
- package/cjs/models/timing-log.spec.js.map +1 -1
- package/cjs/models/user.spec.js +4 -4
- package/cjs/models/user.spec.js.map +1 -1
- package/cjs/presentation/presentation-deck.js +19 -9
- package/cjs/presentation/presentation-deck.js.map +1 -1
- package/cjs/presentation/presentation-deck.spec.js +6 -6
- package/cjs/presentation/presentation-deck.spec.js.map +1 -1
- package/cjs/presentation/presentation-section.js +33 -10
- package/cjs/presentation/presentation-section.js.map +1 -1
- package/cjs/presentation/presentation-section.spec.js +24 -16
- package/cjs/presentation/presentation-section.spec.js.map +1 -1
- package/cjs/presentation/presentation-slide.js +18 -7
- package/cjs/presentation/presentation-slide.js.map +1 -1
- package/cjs/presentation/presentation-slide.spec.js +21 -12
- package/cjs/presentation/presentation-slide.spec.js.map +1 -1
- package/cjs/presentation/presentation-subslide.spec.js +10 -10
- package/cjs/presentation/presentation-subslide.spec.js.map +1 -1
- package/cjs/presentation/presentation.js +26 -26
- package/cjs/presentation/presentation.js.map +1 -1
- package/cjs/sync.js +1 -3
- package/cjs/sync.js.map +1 -1
- package/cjs/utils.js +33 -3
- package/cjs/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/api.js +3 -5
- package/src/models/base.js +27 -9
- package/src/models/deck-version.js +5 -31
- package/src/models/manifest-json.js +33 -5
- package/src/models/pack.js +1 -0
- package/src/presentation/presentation-deck.js +9 -9
- package/src/presentation/presentation-section.js +35 -12
- package/src/presentation/presentation-section.spec.js +8 -0
- package/src/presentation/presentation-slide.js +7 -4
- package/src/presentation/presentation-slide.spec.js +9 -0
- package/src/sync.js +1 -3
- package/src/utils.js +31 -2
package/src/models/pack.js
CHANGED
|
@@ -17,7 +17,7 @@ import _ from "lodash";
|
|
|
17
17
|
import { getAssetRoot } from "../index.js";
|
|
18
18
|
import log from "../log.js";
|
|
19
19
|
import { register } from "../state-register";
|
|
20
|
-
import
|
|
20
|
+
import { resolveURL } from "../utils.js";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @constructor
|
|
@@ -67,6 +67,9 @@ export const PresentationDeck = BasePresentationModel.extend(
|
|
|
67
67
|
version: "number",
|
|
68
68
|
namespacedKey: "string",
|
|
69
69
|
cmsvalkey_set: "array",
|
|
70
|
+
isWelcome: { type: "boolean", default: true },
|
|
71
|
+
isSlide: { type: "boolean", default: false },
|
|
72
|
+
isSection: { type: "boolean", default: false },
|
|
70
73
|
},
|
|
71
74
|
|
|
72
75
|
/**
|
|
@@ -406,8 +409,8 @@ PresentationDeck.createFromManifestJSON = function (manifestJSON, project) {
|
|
|
406
409
|
index: 0,
|
|
407
410
|
visible: true,
|
|
408
411
|
key: manifestJSON.key || "manifest_deck",
|
|
409
|
-
html:
|
|
410
|
-
css:
|
|
412
|
+
html: resolveURL(manifestJSON.getAssetPath(), "index.html"),
|
|
413
|
+
css: resolveURL(manifestJSON.getAssetPath(), "slide.css"),
|
|
411
414
|
common: manifestJSON.common,
|
|
412
415
|
thumbnail: null,
|
|
413
416
|
deckID: 1,
|
|
@@ -434,8 +437,8 @@ PresentationDeck.createFromManifestJSON = function (manifestJSON, project) {
|
|
|
434
437
|
return {
|
|
435
438
|
key: newKey,
|
|
436
439
|
sequence,
|
|
437
|
-
html:
|
|
438
|
-
css:
|
|
440
|
+
html: resolveURL(manifestJSON.getAssetPath(key), "index.html"),
|
|
441
|
+
css: resolveURL(manifestJSON.getAssetPath(key), "slide.css"),
|
|
439
442
|
title: manifestJSON.titles[key],
|
|
440
443
|
tags: manifestJSON.tags[key] || [],
|
|
441
444
|
cmsvalkey_set: [],
|
|
@@ -500,10 +503,7 @@ PresentationDeck.createFromManifestJSON = function (manifestJSON, project) {
|
|
|
500
503
|
key,
|
|
501
504
|
sequence: manifestJSON.templates[key].ordering,
|
|
502
505
|
index_asset: {
|
|
503
|
-
url:
|
|
504
|
-
manifestJSON.getTemplateAssetPath(key),
|
|
505
|
-
"index.html",
|
|
506
|
-
),
|
|
506
|
+
url: resolveURL(manifestJSON.getTemplateAssetPath(key), "index.html"),
|
|
507
507
|
},
|
|
508
508
|
cmsvalkey_set: cmsvals,
|
|
509
509
|
};
|
|
@@ -17,7 +17,7 @@ import { PresentationSlide } from "./presentation-slide.js";
|
|
|
17
17
|
import _ from "lodash";
|
|
18
18
|
import { getAssetRoot } from "../index.js";
|
|
19
19
|
import { register } from "../state-register.js";
|
|
20
|
-
import
|
|
20
|
+
import { resolveURL } from "../utils.js";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @constructor
|
|
@@ -102,11 +102,10 @@ export const PresentationSection = BasePresentationModel.extend(
|
|
|
102
102
|
tagsEditable: "boolean",
|
|
103
103
|
tags: "array",
|
|
104
104
|
impostor: "boolean",
|
|
105
|
-
isWelcome: {
|
|
106
|
-
type: "boolean",
|
|
107
|
-
default: false,
|
|
108
|
-
},
|
|
109
105
|
cmsvalkey_set: "array",
|
|
106
|
+
isWelcome: { type: "boolean", default: false },
|
|
107
|
+
isSlide: { type: "boolean", default: false },
|
|
108
|
+
isSection: { type: "boolean", default: true },
|
|
110
109
|
},
|
|
111
110
|
|
|
112
111
|
/**
|
|
@@ -445,8 +444,8 @@ PresentationSection.createFromManifestJSON = function (
|
|
|
445
444
|
id: parseInt(_.uniqueId(), 10),
|
|
446
445
|
index,
|
|
447
446
|
title: manifestJSON.titles[sectionKey],
|
|
448
|
-
html:
|
|
449
|
-
css:
|
|
447
|
+
html: resolveURL(manifestJSON.getAssetPath(sectionKey), "index.html"),
|
|
448
|
+
css: resolveURL(manifestJSON.getAssetPath(sectionKey), "slide.css"),
|
|
450
449
|
key: sectionKey,
|
|
451
450
|
sequence: manifestJSON.ordering[sectionKey] - 1,
|
|
452
451
|
thumbnail: null,
|
|
@@ -484,7 +483,10 @@ PresentationSection.createFromManifestImpostor = function (
|
|
|
484
483
|
const slides = section.slides || [];
|
|
485
484
|
section.slides = null;
|
|
486
485
|
|
|
487
|
-
|
|
486
|
+
// Single section with slides
|
|
487
|
+
const projectSection = project?.sections[0].slides.find(
|
|
488
|
+
(s) => s.key === section.key,
|
|
489
|
+
);
|
|
488
490
|
|
|
489
491
|
const presentationSection = new PresentationSection({
|
|
490
492
|
id: parseInt(_.uniqueId(), 10),
|
|
@@ -602,11 +604,32 @@ PresentationSection.createFromAutoAdjunct = function (model, opts = {}) {
|
|
|
602
604
|
return autoAdjunctSection;
|
|
603
605
|
};
|
|
604
606
|
|
|
605
|
-
PresentationSection.createFromTemplate = function (
|
|
607
|
+
PresentationSection.createFromTemplate = function (
|
|
608
|
+
template,
|
|
609
|
+
index,
|
|
610
|
+
minID = 0,
|
|
611
|
+
options = {},
|
|
612
|
+
) {
|
|
606
613
|
const templateModel = new TemplateModel(template);
|
|
607
614
|
|
|
615
|
+
_.defaults(options, {
|
|
616
|
+
rootAssetPath: null,
|
|
617
|
+
});
|
|
618
|
+
|
|
608
619
|
const deckversion = new DeckVersionModel(templateModel.deckversion);
|
|
609
|
-
|
|
620
|
+
|
|
621
|
+
let html;
|
|
622
|
+
let css;
|
|
623
|
+
|
|
624
|
+
if (options.rootAssetPath) {
|
|
625
|
+
const origPath = templateModel.index_asset.orig_path;
|
|
626
|
+
html = `${options.rootAssetPath}${origPath}/index.html`;
|
|
627
|
+
css = `${options.rootAssetPath}${origPath}/slide.css`;
|
|
628
|
+
} else {
|
|
629
|
+
const templateAssetRoot = getAssetRoot(templateModel.index_asset.url());
|
|
630
|
+
html = `${templateAssetRoot}index.html`;
|
|
631
|
+
css = `${templateAssetRoot}slide.css`;
|
|
632
|
+
}
|
|
610
633
|
|
|
611
634
|
const presentationSection = new PresentationSection({
|
|
612
635
|
id: minID + parseInt(_.uniqueId(), 10),
|
|
@@ -614,8 +637,8 @@ PresentationSection.createFromTemplate = function (template, index, minID = 0) {
|
|
|
614
637
|
template: templateModel,
|
|
615
638
|
key: `template-${templateModel.key}`,
|
|
616
639
|
title: templateModel.title,
|
|
617
|
-
html
|
|
618
|
-
css
|
|
640
|
+
html,
|
|
641
|
+
css,
|
|
619
642
|
custom: false,
|
|
620
643
|
visible: true,
|
|
621
644
|
thumbnail: templateModel.image_256,
|
|
@@ -63,6 +63,8 @@ describe("#createFromSection", () => {
|
|
|
63
63
|
id: 1728,
|
|
64
64
|
impostor: false,
|
|
65
65
|
index: 0,
|
|
66
|
+
isSection: true,
|
|
67
|
+
isSlide: false,
|
|
66
68
|
isWelcome: false,
|
|
67
69
|
key: "agenda",
|
|
68
70
|
namespacedKey: "agenda",
|
|
@@ -192,6 +194,8 @@ describe("#createFromAdjunctSection", () => {
|
|
|
192
194
|
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
193
195
|
impostor: false,
|
|
194
196
|
index: 1,
|
|
197
|
+
isSection: true,
|
|
198
|
+
isSlide: false,
|
|
195
199
|
isWelcome: false,
|
|
196
200
|
key: "adjunct-1737",
|
|
197
201
|
sequence: 1,
|
|
@@ -325,6 +329,8 @@ describe("#createFromImpostorSection", () => {
|
|
|
325
329
|
id: 23898,
|
|
326
330
|
impostor: true,
|
|
327
331
|
index: 0,
|
|
332
|
+
isSection: true,
|
|
333
|
+
isSlide: false,
|
|
328
334
|
isWelcome: false,
|
|
329
335
|
key: "agenda",
|
|
330
336
|
namespacedKey: "test-deck/agenda",
|
|
@@ -437,6 +443,8 @@ describe("#createFromAutoAdjunct", () => {
|
|
|
437
443
|
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
438
444
|
impostor: false,
|
|
439
445
|
index: 3,
|
|
446
|
+
isSection: true,
|
|
447
|
+
isSlide: false,
|
|
440
448
|
isWelcome: false,
|
|
441
449
|
key: "autoadjunct-five",
|
|
442
450
|
sequence: 3,
|
|
@@ -9,7 +9,7 @@ import { PresentationSubSlide } from "./presentation-subslide.js";
|
|
|
9
9
|
import _ from "lodash";
|
|
10
10
|
import { getAssetRoot } from "../index.js";
|
|
11
11
|
import { register } from "../state-register.js";
|
|
12
|
-
import
|
|
12
|
+
import { resolveURL } from "../utils.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @constructor
|
|
@@ -88,6 +88,9 @@ export const PresentationSlide = BasePresentationModel.extend(
|
|
|
88
88
|
tagsEditable: "boolean",
|
|
89
89
|
tags: "array",
|
|
90
90
|
cmsvalkey_set: "array",
|
|
91
|
+
isWelcome: { type: "boolean", default: false },
|
|
92
|
+
isSlide: { type: "boolean", default: true },
|
|
93
|
+
isSection: { type: "boolean", default: false },
|
|
91
94
|
},
|
|
92
95
|
|
|
93
96
|
/**
|
|
@@ -365,8 +368,8 @@ PresentationSlide.createFromManifestJSON = function (
|
|
|
365
368
|
id: parseInt(_.uniqueId(), 10),
|
|
366
369
|
title: manifestJSON.titles[key],
|
|
367
370
|
index,
|
|
368
|
-
html:
|
|
369
|
-
css:
|
|
371
|
+
html: resolveURL(manifestJSON.getAssetPath(key), "index.html"),
|
|
372
|
+
css: resolveURL(manifestJSON.getAssetPath(key), "slide.css"),
|
|
370
373
|
key: slideKey,
|
|
371
374
|
editable: false,
|
|
372
375
|
titleEditable: false,
|
|
@@ -429,9 +432,9 @@ PresentationSlide.createFromTemplate = function (
|
|
|
429
432
|
titleEditable: false,
|
|
430
433
|
notesEditable: false,
|
|
431
434
|
tagsEditable: false,
|
|
432
|
-
thumbnail: null,
|
|
433
435
|
custom: false,
|
|
434
436
|
visible: true,
|
|
437
|
+
thumbnail: template.image_256,
|
|
435
438
|
section: sectionID,
|
|
436
439
|
// Makes sure templates are rendered with unique IDs
|
|
437
440
|
autoAdjunctID: Number(_.uniqueId()),
|
|
@@ -52,6 +52,9 @@ describe("#createFromSlide", () => {
|
|
|
52
52
|
html: "https://staging-test-cdn.salespreso.com/media/pack/410/assets/sections/test-deck/slides/slide-key/index.html",
|
|
53
53
|
id: 23219,
|
|
54
54
|
index: 13,
|
|
55
|
+
isSection: false,
|
|
56
|
+
isSlide: true,
|
|
57
|
+
isWelcome: false,
|
|
55
58
|
key: "slide-key",
|
|
56
59
|
namespacedKey: "test-deck/slide-key",
|
|
57
60
|
section: 1738,
|
|
@@ -166,6 +169,9 @@ describe("#createFromAdjunctSlide", () => {
|
|
|
166
169
|
image:
|
|
167
170
|
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
168
171
|
index: 3,
|
|
172
|
+
isSection: false,
|
|
173
|
+
isSlide: true,
|
|
174
|
+
isWelcome: false,
|
|
169
175
|
key: "adjunct-10529",
|
|
170
176
|
section: null,
|
|
171
177
|
sequence: 3,
|
|
@@ -284,6 +290,9 @@ describe("#createFromAutoAdjunct", () => {
|
|
|
284
290
|
image:
|
|
285
291
|
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
286
292
|
index: 3,
|
|
293
|
+
isSection: false,
|
|
294
|
+
isSlide: true,
|
|
295
|
+
isWelcome: false,
|
|
287
296
|
key: "autoadjunct-three",
|
|
288
297
|
sectionKey: "",
|
|
289
298
|
sequence: 3,
|
package/src/sync.js
CHANGED
|
@@ -4,7 +4,6 @@ import _ from "lodash";
|
|
|
4
4
|
import log from "./log.js";
|
|
5
5
|
import { middlewares } from "./middleware.js";
|
|
6
6
|
import superagent from "superagent";
|
|
7
|
-
import url2 from "url";
|
|
8
7
|
|
|
9
8
|
const defaults = _.defaults;
|
|
10
9
|
const assign = _.assign;
|
|
@@ -30,11 +29,10 @@ export const defaultFetchURL = function ({ model }) {
|
|
|
30
29
|
|
|
31
30
|
export const buildURL = function ({ method, model }) {
|
|
32
31
|
const url = model.url();
|
|
33
|
-
const urlParse = url2.parse(url);
|
|
34
32
|
|
|
35
33
|
// If not a GET request, strip the query params from the url
|
|
36
34
|
if (method !== "read") {
|
|
37
|
-
return url.
|
|
35
|
+
return url.split("?")[0];
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
return url;
|
package/src/utils.js
CHANGED
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
2
|
/* eslint-disable no-control-regex */
|
|
3
|
-
import url2 from "url";
|
|
4
3
|
|
|
5
4
|
export const DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSSSSS[Z]";
|
|
6
5
|
export const DATE_FORMAT_T = "YYYY-MM-DDTHH:mm:ss.SSSSSS[Z]";
|
|
7
6
|
|
|
8
7
|
export function getShortURL(url) {
|
|
9
|
-
|
|
8
|
+
if (!url) return url;
|
|
9
|
+
if (typeof url !== "string") return url;
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
return new URL(url, "http://a.b").pathname;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return url;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Resolves a target URL relative to a base URL in a manner similar to a Web browser resolving an anchor tag.
|
|
20
|
+
* Matches url.resolve() behavior but handles relative bases.
|
|
21
|
+
*/
|
|
22
|
+
export function resolveURL(base, relative) {
|
|
23
|
+
if (!base) return relative;
|
|
24
|
+
if (!relative) return base;
|
|
25
|
+
|
|
26
|
+
const dummyBase = "http://a.b";
|
|
27
|
+
try {
|
|
28
|
+
// Try resolving normally (if base is absolute)
|
|
29
|
+
return new URL(relative, base).href;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
try {
|
|
32
|
+
// If base is relative, resolve it against a dummy base, then strip it
|
|
33
|
+
const resolved = new URL(relative, new URL(base, dummyBase));
|
|
34
|
+
return resolved.href.replace(dummyBase, "");
|
|
35
|
+
} catch (e2) {
|
|
36
|
+
return relative;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
10
39
|
}
|
|
11
40
|
|
|
12
41
|
/**
|