@livepreso/api 6.42.1 → 6.45.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/.eslintrc.js +3 -0
- package/.rush/temp/256021b5963b4c0221d3dec247b697b9691a9b2c.log +10 -0
- package/.rush/temp/2a322f00f12cf9d1e64afe81275cc78d01c49050.log +10 -0
- package/.rush/temp/30061f1865447dcbb3f20a305061205f3dbe6091.log +10 -0
- package/.rush/temp/45522aea0dee8cb2be1a53248ba45bd235743b43.log +10 -0
- package/.rush/temp/58fcbb7f15a76326d40e0839ab179755da82a891.log +10 -0
- package/.rush/temp/5bc0bba70b733baa4dd976667ba0a1386e516186.log +10 -0
- package/.rush/temp/64f1bb696f8d7d7e72907b80df316b127f72e23e.log +10 -0
- package/.rush/temp/6f640f951414ea68adb65c17e4ed7527cde54faf.log +10 -0
- package/.rush/temp/7c7b958682d4ab5697530be47d0aac62efe1adf1.log +10 -0
- package/.rush/temp/82bfb987463fbcfebf04022e6ed00015c73879c8.log +10 -0
- package/.rush/temp/844034aa6e542115075e8f3dc5ffc640973e0064.log +10 -0
- package/.rush/temp/8b42957a7c15da1f29cb57bee125f13affa70dca.log +10 -0
- package/.rush/temp/a769db9d81a23000c0e9b1bf4f1a9a9e721d0d7c.log +10 -0
- package/.rush/temp/a87d3a8b4ece87ec66f27c86226a9f205617681f.log +10 -0
- package/.rush/temp/bb7a5bdcc4af4ad1507f81f33774b31f5b4e4fb7.log +10 -0
- package/.rush/temp/build-cache-tar.log +7 -0
- package/.rush/temp/c20e29ccaaa9231b38a28bb24451b4ce7562cdc0.log +10 -0
- package/.rush/temp/e21303db8f59b4625fd184c9114377d781fd24f8.log +10 -0
- package/.rush/temp/e6d303862765b6a5f41dd483d0f9ae083a1fae10.log +10 -0
- package/.rush/temp/eaf69fbc059d2f1258d7569136180d4a1d3c7072.log +10 -0
- package/.rush/temp/f85d279e2674966daaec83e1c3986a96f86ef304.log +10 -0
- package/.rush/temp/fc0a332c5b34c6b90006850cf2d93a48fb4b9a6e.log +10 -0
- package/.rush/temp/package-deps_build.json +152 -134
- package/.rush/temp/package-deps_test.json +172 -0
- package/.rush/temp/shrinkwrap-deps.json +946 -847
- package/CHANGELOG.json +41 -0
- package/CHANGELOG.md +22 -1
- package/api.build.log +3 -26
- package/babel.config.js +1 -1
- package/bin/test.sh +0 -1
- package/cjs/api.js +1 -1
- package/cjs/api.js.map +1 -1
- package/cjs/auth.js +38 -11
- package/cjs/auth.js.map +1 -1
- package/cjs/auth.spec.js +12 -6
- package/cjs/auth.spec.js.map +1 -1
- package/cjs/caching.js +3 -3
- package/cjs/collections/activity.js +2 -2
- package/cjs/collections/appointment-adjunct-tags.js +28 -0
- package/cjs/collections/appointment-adjunct-tags.js.map +1 -0
- package/cjs/collections/appointment-deckversion-tags.js +28 -0
- package/cjs/collections/appointment-deckversion-tags.js.map +1 -0
- package/cjs/collections/appointment-section-tags.js +28 -0
- package/cjs/collections/appointment-section-tags.js.map +1 -0
- package/cjs/collections/appointment-slide-tags.js +28 -0
- package/cjs/collections/appointment-slide-tags.js.map +1 -0
- package/cjs/collections/appointment-tags.js +208 -0
- package/cjs/collections/appointment-tags.js.map +1 -0
- package/cjs/collections/appointments.js +2 -2
- package/cjs/collections/auto-adjuncts.js +2 -2
- package/cjs/collections/base.js +84 -3
- package/cjs/collections/base.js.map +1 -1
- package/cjs/collections/base.spec.js +178 -0
- package/cjs/collections/base.spec.js.map +1 -1
- package/cjs/collections/deck-version-screenshots.js +62 -0
- package/cjs/collections/deck-version-screenshots.js.map +1 -0
- package/cjs/collections/deck-versions.js +2 -2
- package/cjs/collections/tags.js +28 -0
- package/cjs/collections/tags.js.map +1 -0
- package/cjs/collections.js +91 -0
- package/cjs/collections.js.map +1 -1
- package/cjs/models/activity-item.js +5 -3
- package/cjs/models/activity-item.js.map +1 -1
- package/cjs/models/appointment-adjunct-tags.js +52 -0
- package/cjs/models/appointment-adjunct-tags.js.map +1 -0
- package/cjs/models/appointment-deckversion-tags.js +52 -0
- package/cjs/models/appointment-deckversion-tags.js.map +1 -0
- package/cjs/models/appointment-duplicate.js +2 -2
- package/cjs/models/appointment-section-tags.js +52 -0
- package/cjs/models/appointment-section-tags.js.map +1 -0
- package/cjs/models/appointment-slide-tags.js +52 -0
- package/cjs/models/appointment-slide-tags.js.map +1 -0
- package/cjs/models/appointment-tags.js +16 -15
- package/cjs/models/appointment-tags.js.map +1 -1
- package/cjs/models/appointment.js +19 -3
- package/cjs/models/appointment.js.map +1 -1
- package/cjs/models/auto-adjunct.js +3 -1
- package/cjs/models/auto-adjunct.js.map +1 -1
- package/cjs/models/base.js +19 -1
- package/cjs/models/base.js.map +1 -1
- package/cjs/models/base.spec.js +9 -0
- package/cjs/models/base.spec.js.map +1 -1
- package/cjs/models/deck-tags.js +61 -0
- package/cjs/models/deck-tags.js.map +1 -0
- package/cjs/models/deck-version-screenshot.js +59 -0
- package/cjs/models/deck-version-screenshot.js.map +1 -0
- package/cjs/models/deck-version.js +30 -5
- package/cjs/models/deck-version.js.map +1 -1
- package/cjs/models/deck.js +4 -1
- package/cjs/models/deck.js.map +1 -1
- package/cjs/models/feed-data.js +5 -0
- package/cjs/models/feed-data.js.map +1 -1
- package/cjs/models/image.js +34 -0
- package/cjs/models/image.js.map +1 -1
- package/cjs/models/manifest-json.js +56 -13
- package/cjs/models/manifest-json.js.map +1 -1
- package/cjs/models/preset.js +21 -1
- package/cjs/models/preset.js.map +1 -1
- package/cjs/models/section.js +3 -1
- package/cjs/models/section.js.map +1 -1
- package/cjs/models/slide.js +3 -1
- package/cjs/models/slide.js.map +1 -1
- package/cjs/models/tag.js +54 -0
- package/cjs/models/tag.js.map +1 -0
- package/cjs/models/template.js +3 -1
- package/cjs/models/template.js.map +1 -1
- package/cjs/models/token.js +56 -0
- package/cjs/models/token.js.map +1 -0
- package/cjs/models/user.js +4 -2
- package/cjs/models/user.js.map +1 -1
- package/cjs/models.js +104 -0
- package/cjs/models.js.map +1 -1
- package/cjs/presentation/appointment-presentation.js +11 -4
- package/cjs/presentation/appointment-presentation.js.map +1 -1
- package/cjs/presentation/base-presentation-model.js +167 -9
- package/cjs/presentation/base-presentation-model.js.map +1 -1
- package/cjs/presentation/base-presentation-model.spec.js +96 -6
- package/cjs/presentation/base-presentation-model.spec.js.map +1 -1
- package/cjs/presentation/presentation-deck.js +36 -8
- package/cjs/presentation/presentation-deck.js.map +1 -1
- package/cjs/presentation/presentation-deck.spec.js +53 -0
- package/cjs/presentation/presentation-deck.spec.js.map +1 -1
- package/cjs/presentation/presentation-section.js +64 -25
- package/cjs/presentation/presentation-section.js.map +1 -1
- package/cjs/presentation/presentation-section.spec.js +536 -0
- package/cjs/presentation/presentation-section.spec.js.map +1 -0
- package/cjs/presentation/presentation-slide.js +43 -18
- package/cjs/presentation/presentation-slide.js.map +1 -1
- package/cjs/presentation/presentation-slide.spec.js +386 -0
- package/cjs/presentation/presentation-slide.spec.js.map +1 -0
- package/cjs/presentation/presentation-subslide.js +5 -2
- package/cjs/presentation/presentation-subslide.js.map +1 -1
- package/cjs/presentation/presentation-subslide.spec.js +58 -12
- package/cjs/presentation/presentation-subslide.spec.js.map +1 -1
- package/cjs/presentation/presentation.js +120 -6
- package/cjs/presentation/presentation.js.map +1 -1
- package/cjs/state-register.js +11 -1
- package/cjs/state-register.js.map +1 -1
- package/cjs/sync.js +1 -1
- package/cjs/utils.js +5 -5
- package/config/rush-project.json +11 -0
- package/jest.config.js +1 -0
- package/package.json +66 -66
- package/src/api.js +1 -1
- package/src/auth.js +44 -8
- package/src/auth.spec.js +2 -0
- package/src/collections/appointment-adjunct-tags.js +18 -0
- package/src/collections/appointment-deckversion-tags.js +21 -0
- package/src/collections/appointment-section-tags.js +18 -0
- package/src/collections/appointment-slide-tags.js +18 -0
- package/src/collections/appointment-tags.js +136 -0
- package/src/collections/base.js +80 -3
- package/src/collections/base.spec.js +108 -1
- package/src/collections/deck-version-screenshots.js +48 -0
- package/src/collections/tags.js +18 -0
- package/src/collections.js +7 -0
- package/src/models/activity-item.js +2 -0
- package/src/models/appointment-adjunct-tags.js +41 -0
- package/src/models/appointment-deckversion-tags.js +41 -0
- package/src/models/appointment-section-tags.js +41 -0
- package/src/models/appointment-slide-tags.js +41 -0
- package/src/models/appointment-tags.js +16 -14
- package/src/models/appointment.js +18 -1
- package/src/models/auto-adjunct.js +2 -0
- package/src/models/base.js +19 -1
- package/src/models/base.spec.js +16 -9
- package/src/models/deck-tags.js +52 -0
- package/src/models/deck-version-screenshot.js +48 -0
- package/src/models/deck-version.js +32 -4
- package/src/models/deck.js +2 -0
- package/src/models/feed-data.js +2 -0
- package/src/models/image.js +32 -0
- package/src/models/manifest-json.js +55 -7
- package/src/models/preset.js +19 -0
- package/src/models/section.js +2 -0
- package/src/models/slide.js +2 -0
- package/src/models/tag.js +42 -0
- package/src/models/template.js +2 -0
- package/src/models/token.js +47 -0
- package/src/models/user.js +4 -0
- package/src/models.js +8 -0
- package/src/presentation/appointment-presentation.js +13 -2
- package/src/presentation/base-presentation-model.js +129 -8
- package/src/presentation/base-presentation-model.spec.js +121 -6
- package/src/presentation/presentation-deck.js +41 -2
- package/src/presentation/presentation-deck.spec.js +53 -0
- package/src/presentation/presentation-section.js +57 -14
- package/src/presentation/presentation-section.spec.js +496 -0
- package/src/presentation/presentation-slide.js +41 -8
- package/src/presentation/presentation-slide.spec.js +352 -0
- package/src/presentation/presentation-subslide.js +7 -2
- package/src/presentation/presentation-subslide.spec.js +32 -3
- package/src/presentation/presentation.js +35 -6
- package/src/state-register.js +7 -0
- package/api.build.error.log +0 -16
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import { AdjunctSectionModel } from "../models/adjunct-section";
|
|
2
|
+
import { AutoAdjunctModel } from "../models/auto-adjunct";
|
|
3
|
+
import { DeckVersionScreenshotCollection } from "../collections/deck-version-screenshots.js";
|
|
4
|
+
import { PresentationSection } from "./presentation-section";
|
|
5
|
+
import { SectionModel } from "../models/section";
|
|
6
|
+
import { SlideModel } from "../models/slide";
|
|
7
|
+
|
|
8
|
+
describe("#createFromSection", () => {
|
|
9
|
+
const getSectionJSON = () => {
|
|
10
|
+
return {
|
|
11
|
+
adjunctslide_limit: 0,
|
|
12
|
+
created_date: "2021-07-19T01:17:59.522119Z",
|
|
13
|
+
deckversion: "https://staging-test.salespreso.com/api/deckversions/408/",
|
|
14
|
+
description: "",
|
|
15
|
+
enabled: true,
|
|
16
|
+
id: 1728,
|
|
17
|
+
image_128:
|
|
18
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/section/123/456.jpg",
|
|
19
|
+
image_256:
|
|
20
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/section/123/456.jpg",
|
|
21
|
+
image_512:
|
|
22
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/section/123/456.jpg",
|
|
23
|
+
index_asset: {
|
|
24
|
+
created_date: "2021-07-19T01:17:58.068483Z",
|
|
25
|
+
data: "sections/agenda/index.html",
|
|
26
|
+
hash_algorithm: "sha-256",
|
|
27
|
+
hash_digest:
|
|
28
|
+
"f84e1e0b43f4b25168e4a8997b11a2c1c2848376b128b2d72ba5bd4f44c17dcc",
|
|
29
|
+
id: 148115,
|
|
30
|
+
modified_date: "2021-07-19T01:17:58.068507Z",
|
|
31
|
+
orig_path: "sections/agenda",
|
|
32
|
+
pack: "https://staging-test.salespreso.com/api/packs/409/",
|
|
33
|
+
url: "https://staging-test-cdn.salespreso.com/media/pack/409/assets/sections/agenda/index.html",
|
|
34
|
+
},
|
|
35
|
+
key: "agenda",
|
|
36
|
+
modified_date: "2021-07-19T01:20:43.815965Z",
|
|
37
|
+
namespaced_key: "agenda",
|
|
38
|
+
sequence: 0,
|
|
39
|
+
slide_set: [],
|
|
40
|
+
tags: [],
|
|
41
|
+
title: "Agenda",
|
|
42
|
+
url: "https://staging-test.salespreso.com/api/sections/1728/",
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
it("should create a presentation section", async () => {
|
|
47
|
+
const section = new SectionModel(getSectionJSON());
|
|
48
|
+
const presentationSection = PresentationSection.createFromSection(section);
|
|
49
|
+
|
|
50
|
+
const expected = {
|
|
51
|
+
adjunctID: null,
|
|
52
|
+
adjunctSlideLimit: 0,
|
|
53
|
+
autoAdjunctID: null,
|
|
54
|
+
createdByAutoAdjunct: false,
|
|
55
|
+
createdByTemplate: false,
|
|
56
|
+
css: "https://staging-test-cdn.salespreso.com/media/pack/409/assets/sections/agenda/slide.css",
|
|
57
|
+
custom: false,
|
|
58
|
+
deckversion: 408,
|
|
59
|
+
editable: false,
|
|
60
|
+
html: "https://staging-test-cdn.salespreso.com/media/pack/409/assets/sections/agenda/index.html",
|
|
61
|
+
id: 1728,
|
|
62
|
+
impostor: false,
|
|
63
|
+
index: 0,
|
|
64
|
+
isWelcome: false,
|
|
65
|
+
key: "agenda",
|
|
66
|
+
selectionID: null,
|
|
67
|
+
sequence: 0,
|
|
68
|
+
slides: [],
|
|
69
|
+
tags: [],
|
|
70
|
+
templateID: null,
|
|
71
|
+
thumbnail:
|
|
72
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/section/123/456.jpg",
|
|
73
|
+
title: "Agenda",
|
|
74
|
+
url: "/api/sections/1728/",
|
|
75
|
+
visible: true,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
expect(presentationSection.toJSON()).toEqual(expected);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("should use deckTags when available", async () => {
|
|
82
|
+
const section = new SectionModel(getSectionJSON());
|
|
83
|
+
const options = {
|
|
84
|
+
deckTags: { agenda: ["section-tag"] },
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const presentationSection = PresentationSection.createFromSection(
|
|
88
|
+
section,
|
|
89
|
+
options
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
expect(presentationSection.tags).toEqual(["section-tag"]);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("Screenshots", () => {
|
|
96
|
+
it("should use the default image from the slide if no screenshot found", () => {
|
|
97
|
+
const data = getSectionJSON();
|
|
98
|
+
const section = new SectionModel(data);
|
|
99
|
+
const presentationSection =
|
|
100
|
+
PresentationSection.createFromSection(section);
|
|
101
|
+
expect(presentationSection.thumbnail).toEqual(data.image_256);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("should use the screenshot model if it matches", () => {
|
|
105
|
+
const section = new SectionModel(getSectionJSON());
|
|
106
|
+
const options = {
|
|
107
|
+
screenshots: new DeckVersionScreenshotCollection([
|
|
108
|
+
{ subject: section.url(), image_256: "test-screenshot.png" },
|
|
109
|
+
]),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const presentationSection = PresentationSection.createFromSection(
|
|
113
|
+
section,
|
|
114
|
+
options
|
|
115
|
+
);
|
|
116
|
+
expect(presentationSection.thumbnail).toEqual("test-screenshot.png");
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("#createFromAdjunctSection", () => {
|
|
122
|
+
const getAdjunctSectionJSON = (includeTemplate) => {
|
|
123
|
+
const template = {
|
|
124
|
+
id: 1,
|
|
125
|
+
image_256: "template.png",
|
|
126
|
+
index_asset: {
|
|
127
|
+
created_date: "2021-07-22T04:57:32.977770Z",
|
|
128
|
+
data: "index.html",
|
|
129
|
+
id: 148204,
|
|
130
|
+
modified_date: "2021-07-22T04:57:32.977790Z",
|
|
131
|
+
orig_path: "templates/test-template/foo",
|
|
132
|
+
pack: "https://staging-test.salespreso.com/api/packs/410/",
|
|
133
|
+
url: "https://staging-test-cdn.salespreso.com/media/pack/410/assets/sections/test-deck/slides/slide-key/index.html",
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
adjunct: "https://staging-test.salespreso.com/api/adjuncts/7470/",
|
|
139
|
+
appointment: "https://staging-test.salespreso.com/api/appointments/2422/",
|
|
140
|
+
created_by_autoadjunct: true,
|
|
141
|
+
created_date: "2021-09-20T01:57:55.125224Z",
|
|
142
|
+
creator_autoadjunct:
|
|
143
|
+
"https://staging-test.salespreso.com/api/autoadjuncts/545/",
|
|
144
|
+
deckversion: "https://staging-test.salespreso.com/api/deckversions/408/",
|
|
145
|
+
deleted: false,
|
|
146
|
+
enabled: true,
|
|
147
|
+
html_content:
|
|
148
|
+
'<img src="https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png">',
|
|
149
|
+
id: 1737,
|
|
150
|
+
image_128:
|
|
151
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
152
|
+
image_256:
|
|
153
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
154
|
+
image_512:
|
|
155
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
156
|
+
image_1024:
|
|
157
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.png",
|
|
158
|
+
image_original:
|
|
159
|
+
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
160
|
+
modified_date: "2021-09-20T01:57:55.125229Z",
|
|
161
|
+
sequence: 1,
|
|
162
|
+
tags: [],
|
|
163
|
+
template: includeTemplate ? template : null,
|
|
164
|
+
title: "Five",
|
|
165
|
+
url: "https://staging-test.salespreso.com/api/adjunctsections/1737/",
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
it("should create a presentation section", async () => {
|
|
170
|
+
const adjunctSection = new AdjunctSectionModel(getAdjunctSectionJSON());
|
|
171
|
+
const presentationSection = PresentationSection.createFromAdjunctSection(
|
|
172
|
+
adjunctSection,
|
|
173
|
+
{ id: 1 }
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const expected = {
|
|
177
|
+
adjunct: {
|
|
178
|
+
url: "https://staging-test.salespreso.com/api/adjuncts/7470/",
|
|
179
|
+
},
|
|
180
|
+
adjunctID: 1737,
|
|
181
|
+
adjunctSlideLimit: 0,
|
|
182
|
+
autoAdjunctID: 545,
|
|
183
|
+
createdByAutoAdjunct: true,
|
|
184
|
+
createdByTemplate: false,
|
|
185
|
+
custom: false,
|
|
186
|
+
deckversion: 1,
|
|
187
|
+
editable: false,
|
|
188
|
+
id: 1,
|
|
189
|
+
image:
|
|
190
|
+
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
191
|
+
impostor: false,
|
|
192
|
+
index: 1,
|
|
193
|
+
isWelcome: false,
|
|
194
|
+
key: "adjunct-1737",
|
|
195
|
+
sequence: 1,
|
|
196
|
+
slides: [],
|
|
197
|
+
tags: [],
|
|
198
|
+
templateID: null,
|
|
199
|
+
temporary: true,
|
|
200
|
+
thumbnail:
|
|
201
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
202
|
+
title: "Five",
|
|
203
|
+
url: "/api/adjunctsections/1737/",
|
|
204
|
+
visible: true,
|
|
205
|
+
cmsvalkey_set: [],
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
expect(presentationSection.toJSON()).toEqual(expected);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it("should use deckTags when available", async () => {
|
|
212
|
+
const adjunctSection = new AdjunctSectionModel(getAdjunctSectionJSON());
|
|
213
|
+
const options = {
|
|
214
|
+
deckTags: { "adjunct-1737": ["adjunctsection-tag"] },
|
|
215
|
+
};
|
|
216
|
+
const presentationSection = PresentationSection.createFromAdjunctSection(
|
|
217
|
+
adjunctSection,
|
|
218
|
+
{ id: 1 },
|
|
219
|
+
options
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
expect(presentationSection.tags).toEqual(["adjunctsection-tag"]);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe("Screenshots", () => {
|
|
226
|
+
it("should use the default image from the model if no screenshot found", () => {
|
|
227
|
+
const data = getAdjunctSectionJSON(true);
|
|
228
|
+
const adjunctSection = new AdjunctSectionModel(data);
|
|
229
|
+
const presentationSlide = PresentationSection.createFromAdjunctSection(
|
|
230
|
+
adjunctSection,
|
|
231
|
+
{ id: 1 }
|
|
232
|
+
);
|
|
233
|
+
expect(presentationSlide.thumbnail).toEqual(data.template.image_256);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("should use the screenshot model if it matches", () => {
|
|
237
|
+
const adjunctSection = new AdjunctSectionModel(
|
|
238
|
+
getAdjunctSectionJSON(true)
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const options = {
|
|
242
|
+
screenshots: new DeckVersionScreenshotCollection([
|
|
243
|
+
{
|
|
244
|
+
subject: "/api/autoadjuncts/545/",
|
|
245
|
+
image_256: "test-screenshot.png",
|
|
246
|
+
},
|
|
247
|
+
]),
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const presentationSection = PresentationSection.createFromAdjunctSection(
|
|
251
|
+
adjunctSection,
|
|
252
|
+
{ id: 1 },
|
|
253
|
+
options
|
|
254
|
+
);
|
|
255
|
+
expect(presentationSection.thumbnail).toEqual("test-screenshot.png");
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
describe("#createFromImpostorSection", () => {
|
|
261
|
+
const getImpostorSectionJSON = () => {
|
|
262
|
+
return {
|
|
263
|
+
created_date: "2021-09-20T02:59:06.968285Z",
|
|
264
|
+
description: "",
|
|
265
|
+
enabled: true,
|
|
266
|
+
id: 23898,
|
|
267
|
+
image_128:
|
|
268
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/slide/123/456.jpg",
|
|
269
|
+
image_256:
|
|
270
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/slide/123/456.jpg",
|
|
271
|
+
image_512:
|
|
272
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/slide/123/456.jpg",
|
|
273
|
+
index_asset: {
|
|
274
|
+
created_date: "2021-09-20T02:59:02.361498Z",
|
|
275
|
+
data: "sections/test-deck/slides/agenda/index.html",
|
|
276
|
+
hash_algorithm: "sha-256",
|
|
277
|
+
hash_digest:
|
|
278
|
+
"b77283717f1a99bce5b8aea67e007f11aad06473f5fe26412c15e707f8758343",
|
|
279
|
+
id: 153400,
|
|
280
|
+
modified_date: "2021-09-20T02:59:02.361528Z",
|
|
281
|
+
orig_path: "sections/test-deck/slides/agenda",
|
|
282
|
+
pack: "https://staging-test.salespreso.com/api/packs/427/",
|
|
283
|
+
url: "https://staging-test-cdn.salespreso.com/media/pack/427/assets/sections/test-deck/slides/agenda/index.html",
|
|
284
|
+
},
|
|
285
|
+
key: "agenda",
|
|
286
|
+
modified_date: "2021-09-20T03:05:27.811485Z",
|
|
287
|
+
namespaced_key: "test-deck/agenda",
|
|
288
|
+
section: {
|
|
289
|
+
id: 2,
|
|
290
|
+
deckversion: {
|
|
291
|
+
id: 3,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
sequence: 0,
|
|
295
|
+
subslide_set: [],
|
|
296
|
+
tags: ["section-header"],
|
|
297
|
+
title: "Agenda",
|
|
298
|
+
url: "https://staging-test.salespreso.com/api/slides/23898/",
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
it("should create a presentation section", async () => {
|
|
303
|
+
const impostorSection = new SlideModel(getImpostorSectionJSON());
|
|
304
|
+
const presentationSection =
|
|
305
|
+
PresentationSection.createFromImpostorSection(impostorSection);
|
|
306
|
+
|
|
307
|
+
const expected = {
|
|
308
|
+
adjunctID: null,
|
|
309
|
+
adjunctSlideLimit: 0,
|
|
310
|
+
autoAdjunctID: null,
|
|
311
|
+
createdByAutoAdjunct: false,
|
|
312
|
+
createdByTemplate: false,
|
|
313
|
+
css: "https://staging-test-cdn.salespreso.com/media/pack/427/assets/sections/test-deck/slides/agenda/slide.css",
|
|
314
|
+
custom: false,
|
|
315
|
+
deckversion: 3,
|
|
316
|
+
editable: false,
|
|
317
|
+
html: "https://staging-test-cdn.salespreso.com/media/pack/427/assets/sections/test-deck/slides/agenda/index.html",
|
|
318
|
+
id: 23898,
|
|
319
|
+
impostor: true,
|
|
320
|
+
index: 0,
|
|
321
|
+
isWelcome: false,
|
|
322
|
+
key: "agenda",
|
|
323
|
+
selectionID: null,
|
|
324
|
+
sequence: 0,
|
|
325
|
+
slides: [],
|
|
326
|
+
tags: ["section-header"],
|
|
327
|
+
templateID: null,
|
|
328
|
+
thumbnail:
|
|
329
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/slide/123/456.jpg",
|
|
330
|
+
title: "Agenda",
|
|
331
|
+
url: "/api/slides/23898/",
|
|
332
|
+
visible: true,
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
expect(presentationSection.toJSON()).toEqual(expected);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it("should use deckTags when available", async () => {
|
|
339
|
+
const impostorSection = new SlideModel(getImpostorSectionJSON());
|
|
340
|
+
const options = {
|
|
341
|
+
deckTags: { "test-deck/agenda": ["impostorsection-tag"] },
|
|
342
|
+
};
|
|
343
|
+
const presentationSection = PresentationSection.createFromImpostorSection(
|
|
344
|
+
impostorSection,
|
|
345
|
+
null,
|
|
346
|
+
options
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
expect(presentationSection.tags).toEqual(["impostorsection-tag"]);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
describe("Screenshots", () => {
|
|
353
|
+
it("should use the default image from the model if no screenshot found", () => {
|
|
354
|
+
const data = getImpostorSectionJSON();
|
|
355
|
+
const impostorSection = new SlideModel(data);
|
|
356
|
+
const presentationSection = PresentationSection.createFromImpostorSection(
|
|
357
|
+
impostorSection,
|
|
358
|
+
null
|
|
359
|
+
);
|
|
360
|
+
expect(presentationSection.thumbnail).toEqual(data.image_256);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it("should use the screenshot model if it matches", () => {
|
|
364
|
+
const impostorSection = new SlideModel(getImpostorSectionJSON());
|
|
365
|
+
const options = {
|
|
366
|
+
screenshots: new DeckVersionScreenshotCollection([
|
|
367
|
+
{ subject: impostorSection.url(), image_256: "test-screenshot.png" },
|
|
368
|
+
]),
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
const presentationSection = PresentationSection.createFromImpostorSection(
|
|
372
|
+
impostorSection,
|
|
373
|
+
null,
|
|
374
|
+
options
|
|
375
|
+
);
|
|
376
|
+
expect(presentationSection.thumbnail).toEqual("test-screenshot.png");
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
describe("#createFromAutoAdjunct", () => {
|
|
382
|
+
const getAutoAdjunctJSON = () => {
|
|
383
|
+
return {
|
|
384
|
+
after_key: "autoadjunct-i-am-template-section",
|
|
385
|
+
created_date: "2021-09-16T04:25:54.459641Z",
|
|
386
|
+
deck: "https://staging-test.salespreso.com/api/decks/6/",
|
|
387
|
+
enabled: true,
|
|
388
|
+
id: 545,
|
|
389
|
+
image_128:
|
|
390
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
391
|
+
image_256:
|
|
392
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
393
|
+
image_512:
|
|
394
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
395
|
+
image_1024:
|
|
396
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.png",
|
|
397
|
+
image_original:
|
|
398
|
+
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
399
|
+
key: "autoadjunct-five",
|
|
400
|
+
modified_date: "2021-09-20T01:57:55.090828Z",
|
|
401
|
+
name: "Five",
|
|
402
|
+
parent_key: "",
|
|
403
|
+
sequence: 1,
|
|
404
|
+
tags: [],
|
|
405
|
+
team: null,
|
|
406
|
+
template: null,
|
|
407
|
+
url: "https://staging-test.salespreso.com/api/autoadjuncts/545/",
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
it("should create a presentation section", async () => {
|
|
412
|
+
const autoAdjunct = new AutoAdjunctModel(getAutoAdjunctJSON());
|
|
413
|
+
const options = {
|
|
414
|
+
index: 3,
|
|
415
|
+
deckversionID: 12,
|
|
416
|
+
};
|
|
417
|
+
const presentationSection = PresentationSection.createFromAutoAdjunct(
|
|
418
|
+
autoAdjunct,
|
|
419
|
+
options
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
const expected = {
|
|
423
|
+
adjunctID: 545,
|
|
424
|
+
adjunctSlideLimit: 0,
|
|
425
|
+
autoAdjunctID: 545,
|
|
426
|
+
createdByAutoAdjunct: false,
|
|
427
|
+
createdByTemplate: false,
|
|
428
|
+
css: "",
|
|
429
|
+
deckversion: 12,
|
|
430
|
+
html: "",
|
|
431
|
+
id: 545,
|
|
432
|
+
image:
|
|
433
|
+
"https://staging-test-cdn.salespreso.com/media/autoadjunct/123.png",
|
|
434
|
+
impostor: false,
|
|
435
|
+
index: 3,
|
|
436
|
+
isWelcome: false,
|
|
437
|
+
key: "autoadjunct-five",
|
|
438
|
+
sequence: 3,
|
|
439
|
+
slides: [],
|
|
440
|
+
tags: [],
|
|
441
|
+
templateID: null,
|
|
442
|
+
temporary: true,
|
|
443
|
+
thumbnail:
|
|
444
|
+
"https://staging-test-cdn.salespreso.com/media/CACHE/images/autoadjunct/123/456.jpg",
|
|
445
|
+
title: "Five",
|
|
446
|
+
url: "/api/adjunctsections/545/",
|
|
447
|
+
visible: true,
|
|
448
|
+
};
|
|
449
|
+
expect(presentationSection.toJSON()).toEqual(expected);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it("should use deckTags when available", async () => {
|
|
453
|
+
const autoAdjunct = new AutoAdjunctModel(getAutoAdjunctJSON());
|
|
454
|
+
const options = {
|
|
455
|
+
index: 3,
|
|
456
|
+
deckversionID: 12,
|
|
457
|
+
deckTags: { "autoadjunct-five": ["autoadjunct-tag"] },
|
|
458
|
+
};
|
|
459
|
+
const presentationSection = PresentationSection.createFromAutoAdjunct(
|
|
460
|
+
autoAdjunct,
|
|
461
|
+
options
|
|
462
|
+
);
|
|
463
|
+
|
|
464
|
+
expect(presentationSection.tags).toEqual(["autoadjunct-tag"]);
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
describe("Screenshots", () => {
|
|
468
|
+
it("should use the default image from the model if no screenshot found", () => {
|
|
469
|
+
const data = getAutoAdjunctJSON();
|
|
470
|
+
const options = { index: 3, deckversionID: 12 };
|
|
471
|
+
const autoAdjunct = new AutoAdjunctModel(data);
|
|
472
|
+
const presentationSection = PresentationSection.createFromAutoAdjunct(
|
|
473
|
+
autoAdjunct,
|
|
474
|
+
options
|
|
475
|
+
);
|
|
476
|
+
expect(presentationSection.thumbnail).toEqual(data.image_256);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
it("should use the screenshot model if it matches", () => {
|
|
480
|
+
const autoAdjunct = new AutoAdjunctModel(getAutoAdjunctJSON());
|
|
481
|
+
const options = {
|
|
482
|
+
index: 3,
|
|
483
|
+
deckversionID: 12,
|
|
484
|
+
screenshots: new DeckVersionScreenshotCollection([
|
|
485
|
+
{ subject: autoAdjunct.url(), image_256: "test-screenshot.png" },
|
|
486
|
+
]),
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
const presentationSection = PresentationSection.createFromAutoAdjunct(
|
|
490
|
+
autoAdjunct,
|
|
491
|
+
options
|
|
492
|
+
);
|
|
493
|
+
expect(presentationSection.thumbnail).toEqual("test-screenshot.png");
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
});
|
|
@@ -41,6 +41,7 @@ export const PresentationSlide = BasePresentationModel.extend(
|
|
|
41
41
|
* @property {number} selectionID
|
|
42
42
|
* @property {bool} editable
|
|
43
43
|
* @property {array} tags
|
|
44
|
+
* @property {string[]} cmsvalkey_set
|
|
44
45
|
*/
|
|
45
46
|
props: {
|
|
46
47
|
id: "number",
|
|
@@ -77,6 +78,7 @@ export const PresentationSlide = BasePresentationModel.extend(
|
|
|
77
78
|
selectionID: "number",
|
|
78
79
|
editable: "boolean",
|
|
79
80
|
tags: "array",
|
|
81
|
+
cmsvalkey_set: "array",
|
|
80
82
|
},
|
|
81
83
|
|
|
82
84
|
/**
|
|
@@ -116,6 +118,7 @@ export const PresentationSlide = BasePresentationModel.extend(
|
|
|
116
118
|
PresentationSlide.createFromSlide = function (slideModel, options = {}) {
|
|
117
119
|
_.defaults(options, {
|
|
118
120
|
adjunctSubSlides: new collections.AdjunctSubSlideCollection(),
|
|
121
|
+
screenshots: new collections.DeckVersionScreenshotCollection(),
|
|
119
122
|
rootAssetPath: null,
|
|
120
123
|
selections: null,
|
|
121
124
|
choicelist: null,
|
|
@@ -154,9 +157,9 @@ PresentationSlide.createFromSlide = function (slideModel, options = {}) {
|
|
|
154
157
|
html,
|
|
155
158
|
css,
|
|
156
159
|
key: slideModel.key,
|
|
157
|
-
thumbnail: slideModel.
|
|
160
|
+
thumbnail: PresentationSlide.getThumbnail(slideModel, options.screenshots),
|
|
158
161
|
custom: false,
|
|
159
|
-
editable:
|
|
162
|
+
editable: tags.indexOf("editable") > -1,
|
|
160
163
|
title: slideModel.title,
|
|
161
164
|
section: slideModel.section.id,
|
|
162
165
|
tags,
|
|
@@ -164,6 +167,7 @@ PresentationSlide.createFromSlide = function (slideModel, options = {}) {
|
|
|
164
167
|
sequence: config.sequence,
|
|
165
168
|
visible: config.visible,
|
|
166
169
|
selectionID: config.selectionID,
|
|
170
|
+
cmsvalkey_set: slideModel.cmsvalkey_set,
|
|
167
171
|
});
|
|
168
172
|
|
|
169
173
|
slide.subslides.add(
|
|
@@ -183,7 +187,7 @@ PresentationSlide.createFromSlide = function (slideModel, options = {}) {
|
|
|
183
187
|
if (
|
|
184
188
|
adjunctSubslides.length &&
|
|
185
189
|
!slide.subslides.length &&
|
|
186
|
-
!(
|
|
190
|
+
!(tags.indexOf("subslide_container") > -1)
|
|
187
191
|
) {
|
|
188
192
|
slide.subslides.add(PresentationSubSlide.createFromSlide(slide));
|
|
189
193
|
}
|
|
@@ -229,6 +233,7 @@ PresentationSlide.createFromAdjunctSlide = function (
|
|
|
229
233
|
getUniqueAdjunctID: () => {
|
|
230
234
|
return parseInt(_.uniqueId(), 10);
|
|
231
235
|
},
|
|
236
|
+
screenshots: new collections.DeckVersionScreenshotCollection(),
|
|
232
237
|
});
|
|
233
238
|
|
|
234
239
|
const keyID =
|
|
@@ -243,6 +248,7 @@ PresentationSlide.createFromAdjunctSlide = function (
|
|
|
243
248
|
key = adjunctSlideModel.key;
|
|
244
249
|
} else if (keyID) {
|
|
245
250
|
key = `adjunct-${keyID}`;
|
|
251
|
+
adjunctSlideModel.key = key;
|
|
246
252
|
}
|
|
247
253
|
|
|
248
254
|
const config = PresentationSlide.getVisibilityAndSequence(
|
|
@@ -250,6 +256,8 @@ PresentationSlide.createFromAdjunctSlide = function (
|
|
|
250
256
|
options
|
|
251
257
|
);
|
|
252
258
|
|
|
259
|
+
const tags = PresentationSlide.getTags(adjunctSlideModel, options);
|
|
260
|
+
|
|
253
261
|
const slide = new PresentationSlide({
|
|
254
262
|
id: options.id || options.getUniqueAdjunctID(),
|
|
255
263
|
adjunct: adjunctSlideModel.adjunct ? adjunctSlideModel.adjunct.url() : null,
|
|
@@ -265,10 +273,11 @@ PresentationSlide.createFromAdjunctSlide = function (
|
|
|
265
273
|
temporary: adjunctSlideModel.created_by_autoadjunct,
|
|
266
274
|
title: adjunctSlideModel.title,
|
|
267
275
|
section: section ? section.id : null,
|
|
268
|
-
tags
|
|
276
|
+
tags,
|
|
269
277
|
index: config.sequence,
|
|
270
278
|
sequence: config.sequence,
|
|
271
279
|
visible: config.visible,
|
|
280
|
+
cmsvalkey_set: [],
|
|
272
281
|
});
|
|
273
282
|
|
|
274
283
|
if (adjunctSlideModel.template) {
|
|
@@ -293,7 +302,14 @@ PresentationSlide.createFromAdjunctSlide = function (
|
|
|
293
302
|
}
|
|
294
303
|
slide.html = html;
|
|
295
304
|
slide.css = css;
|
|
296
|
-
|
|
305
|
+
|
|
306
|
+
slide.thumbnail =
|
|
307
|
+
// Try and use autoadjunct screenshot (if there is one), otherwise
|
|
308
|
+
// use the template's image as a fallback
|
|
309
|
+
PresentationSlide.getThumbnail(
|
|
310
|
+
adjunctSlideModel.creator_autoadjunct,
|
|
311
|
+
options.screenshots
|
|
312
|
+
) || adjunctSlideModel.template.image_256;
|
|
297
313
|
} else {
|
|
298
314
|
slide.image = adjunctSlideModel.image_original;
|
|
299
315
|
}
|
|
@@ -323,6 +339,7 @@ PresentationSlide.createFromManifestJSON = function (
|
|
|
323
339
|
visible: true,
|
|
324
340
|
section: sectionID,
|
|
325
341
|
tags: manifestJSON.tags[key] || null,
|
|
342
|
+
cmsvalkey_set: [],
|
|
326
343
|
});
|
|
327
344
|
|
|
328
345
|
return slide;
|
|
@@ -365,11 +382,12 @@ PresentationSlide.createFromTemplate = function (
|
|
|
365
382
|
autoAdjunctID: Number(_.uniqueId()),
|
|
366
383
|
index,
|
|
367
384
|
createdByTemplate: true,
|
|
385
|
+
cmsvalkey_set: [],
|
|
368
386
|
});
|
|
369
387
|
return presentationSlide;
|
|
370
388
|
};
|
|
371
389
|
|
|
372
|
-
PresentationSlide.createFromAutoAdjunct = function (model, opts) {
|
|
390
|
+
PresentationSlide.createFromAutoAdjunct = function (model, opts = {}) {
|
|
373
391
|
const requiredKeys = ["index", "deckversionID"];
|
|
374
392
|
for (const key of requiredKeys) {
|
|
375
393
|
if (typeof opts[key] === "undefined") {
|
|
@@ -384,8 +402,18 @@ PresentationSlide.createFromAutoAdjunct = function (model, opts) {
|
|
|
384
402
|
deckversionID: -1,
|
|
385
403
|
sequence: opts.index,
|
|
386
404
|
impostor: false,
|
|
405
|
+
screenshots: new collections.DeckVersionScreenshotCollection(),
|
|
387
406
|
});
|
|
388
407
|
|
|
408
|
+
const tags = PresentationSlide.getTags(
|
|
409
|
+
{
|
|
410
|
+
isAutoAdjunct: true,
|
|
411
|
+
key: model.key,
|
|
412
|
+
tags: model.tags,
|
|
413
|
+
},
|
|
414
|
+
options
|
|
415
|
+
);
|
|
416
|
+
|
|
389
417
|
const autoAdjunct = new AutoAdjunctModel(model);
|
|
390
418
|
|
|
391
419
|
const autoAdjunctSlide = new PresentationSlide({
|
|
@@ -400,17 +428,22 @@ PresentationSlide.createFromAutoAdjunct = function (model, opts) {
|
|
|
400
428
|
index: options.index,
|
|
401
429
|
key: autoAdjunct.key,
|
|
402
430
|
createdByAutoAdjunct: false,
|
|
403
|
-
thumbnail: autoAdjunct.
|
|
431
|
+
thumbnail: PresentationSlide.getThumbnail(autoAdjunct, options.screenshots),
|
|
404
432
|
temporary: true,
|
|
405
433
|
title: autoAdjunct.name,
|
|
406
434
|
visible: options.visible,
|
|
407
435
|
allowConvert: options.allowConvert,
|
|
408
436
|
deckversion: options.deckversionID,
|
|
409
437
|
impostor: options.impostor,
|
|
438
|
+
tags,
|
|
439
|
+
cmsvalkey_set: autoAdjunct.cmsvalkey_set,
|
|
410
440
|
});
|
|
411
441
|
|
|
412
442
|
if (autoAdjunct.template) {
|
|
413
|
-
|
|
443
|
+
// If we've found a new screenshot for it, we don't want to override it here
|
|
444
|
+
if (!autoAdjunctSlide.thumbnail) {
|
|
445
|
+
autoAdjunctSlide.thumbnail = autoAdjunct.template.image_256;
|
|
446
|
+
}
|
|
414
447
|
autoAdjunctSlide.createdByTemplate = true;
|
|
415
448
|
autoAdjunctSlide.templateID = autoAdjunct.template.id;
|
|
416
449
|
autoAdjunctSlide.html = autoAdjunct.template.index_asset.url();
|