@livepreso/api 6.44.0 → 6.46.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/1aebf46f78ad5c45f82f8147751890adb37bef9d.log +10 -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/3cdc82c352e8ed90607952873f3aa4c200490874.log +10 -0
- package/.rush/temp/45522aea0dee8cb2be1a53248ba45bd235743b43.log +10 -0
- package/.rush/temp/5489ab737e406518983c16c57fc3e1edc07c0341.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/924652444ab5a6063f328a2217123a2227058896.log +10 -0
- package/.rush/temp/9f2030f96d62f3e38052e35201819a216566f14f.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/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/operation/test/all.log +19 -0
- package/.rush/temp/operation/test/state.json +3 -0
- package/.rush/temp/{package-deps_test.json → package-deps_build.json} +11 -11
- package/.rush/temp/shrinkwrap-deps.json +605 -597
- package/CHANGELOG.json +29 -0
- package/CHANGELOG.md +15 -1
- package/README.md +4 -4
- package/api.build.log +1 -1
- package/api.test.cache.log +1 -0
- package/api.test.log +19 -0
- package/bin/test.sh +0 -1
- package/cjs/api.js +18 -17
- package/cjs/api.js.map +1 -1
- package/cjs/api.spec.js +0 -4
- package/cjs/api.spec.js.map +1 -1
- package/cjs/auth.js +35 -36
- package/cjs/auth.js.map +1 -1
- package/cjs/auth.spec.js +52 -71
- package/cjs/auth.spec.js.map +1 -1
- package/cjs/caching.js +2 -7
- package/cjs/caching.js.map +1 -1
- package/cjs/collections/activity.js +16 -56
- package/cjs/collections/activity.js.map +1 -1
- package/cjs/collections/adjunct-sections.js +1 -10
- package/cjs/collections/adjunct-sections.js.map +1 -1
- package/cjs/collections/adjunct-slides.js +1 -10
- package/cjs/collections/adjunct-slides.js.map +1 -1
- package/cjs/collections/adjunct-sub-slides.js +1 -9
- package/cjs/collections/adjunct-sub-slides.js.map +1 -1
- package/cjs/collections/appointment-adjunct-tags.js +1 -9
- package/cjs/collections/appointment-adjunct-tags.js.map +1 -1
- package/cjs/collections/appointment-deckversion-tags.js +1 -9
- package/cjs/collections/appointment-deckversion-tags.js.map +1 -1
- package/cjs/collections/appointment-duplicates.js +1 -9
- package/cjs/collections/appointment-duplicates.js.map +1 -1
- package/cjs/collections/appointment-editors.js +1 -10
- package/cjs/collections/appointment-editors.js.map +1 -1
- package/cjs/collections/appointment-section-tags.js +1 -9
- package/cjs/collections/appointment-section-tags.js.map +1 -1
- package/cjs/collections/appointment-slide-tags.js +1 -9
- package/cjs/collections/appointment-slide-tags.js.map +1 -1
- package/cjs/collections/appointment-tags.js +66 -103
- package/cjs/collections/appointment-tags.js.map +1 -1
- package/cjs/collections/appointment-templates.js +27 -0
- package/cjs/collections/appointment-templates.js.map +1 -0
- package/cjs/collections/appointments.js +9 -29
- package/cjs/collections/appointments.js.map +1 -1
- package/cjs/collections/assets.js +1 -9
- package/cjs/collections/assets.js.map +1 -1
- package/cjs/collections/auto-adjuncts.js +6 -21
- package/cjs/collections/auto-adjuncts.js.map +1 -1
- package/cjs/collections/base.js +46 -112
- package/cjs/collections/base.js.map +1 -1
- package/cjs/collections/base.spec.js +204 -233
- package/cjs/collections/base.spec.js.map +1 -1
- package/cjs/collections/cms-vals.js +9 -16
- package/cjs/collections/cms-vals.js.map +1 -1
- package/cjs/collections/contact-phones.js +20 -0
- package/cjs/collections/contact-phones.js.map +1 -0
- package/cjs/collections/contacts.js +1 -9
- package/cjs/collections/contacts.js.map +1 -1
- package/cjs/collections/created-assets.js +1 -10
- package/cjs/collections/created-assets.js.map +1 -1
- package/cjs/collections/customers.js +1 -9
- package/cjs/collections/customers.js.map +1 -1
- package/cjs/collections/deck-notes.js +1 -10
- package/cjs/collections/deck-notes.js.map +1 -1
- package/cjs/collections/deck-version-screenshots.js +49 -0
- package/cjs/collections/deck-version-screenshots.js.map +1 -0
- package/cjs/collections/deck-versions.js +5 -20
- package/cjs/collections/deck-versions.js.map +1 -1
- package/cjs/collections/decks.js +1 -9
- package/cjs/collections/decks.js.map +1 -1
- package/cjs/collections/deleted-assets.js +1 -10
- package/cjs/collections/deleted-assets.js.map +1 -1
- package/cjs/collections/dispatches.js +1 -13
- package/cjs/collections/dispatches.js.map +1 -1
- package/cjs/collections/event-objects.js +1 -9
- package/cjs/collections/event-objects.js.map +1 -1
- package/cjs/collections/events.js +1 -9
- package/cjs/collections/events.js.map +1 -1
- package/cjs/collections/groups.js +1 -9
- package/cjs/collections/groups.js.map +1 -1
- package/cjs/collections/images.js +1 -9
- package/cjs/collections/images.js.map +1 -1
- package/cjs/collections/locations.js +1 -9
- package/cjs/collections/locations.js.map +1 -1
- package/cjs/collections/opportunities.js +1 -9
- package/cjs/collections/opportunities.js.map +1 -1
- package/cjs/collections/pack-diffs.js +1 -9
- package/cjs/collections/pack-diffs.js.map +1 -1
- package/cjs/collections/packs.js +1 -9
- package/cjs/collections/packs.js.map +1 -1
- package/cjs/collections/presets.js +1 -9
- package/cjs/collections/presets.js.map +1 -1
- package/cjs/collections/section-selections.js +1 -9
- package/cjs/collections/section-selections.js.map +1 -1
- package/cjs/collections/sections.js +1 -9
- package/cjs/collections/sections.js.map +1 -1
- package/cjs/collections/slide-selections.js +1 -9
- package/cjs/collections/slide-selections.js.map +1 -1
- package/cjs/collections/slides.js +1 -9
- package/cjs/collections/slides.js.map +1 -1
- package/cjs/collections/snapshots.js +1 -9
- package/cjs/collections/snapshots.js.map +1 -1
- package/cjs/collections/sub-slides.js +1 -9
- package/cjs/collections/sub-slides.js.map +1 -1
- package/cjs/collections/tags.js +1 -9
- package/cjs/collections/tags.js.map +1 -1
- package/cjs/collections/teams.js +1 -9
- package/cjs/collections/teams.js.map +1 -1
- package/cjs/collections/templates.js +1 -9
- package/cjs/collections/templates.js.map +1 -1
- package/cjs/collections/uploads.js +1 -9
- package/cjs/collections/uploads.js.map +1 -1
- package/cjs/collections/users.js +1 -9
- package/cjs/collections/users.js.map +1 -1
- package/cjs/collections.js +33 -86
- package/cjs/collections.js.map +1 -1
- package/cjs/fixtures.js +187 -0
- package/cjs/fixtures.js.map +1 -0
- package/cjs/index.js +0 -10
- package/cjs/index.js.map +1 -1
- package/cjs/log.js +0 -1
- package/cjs/log.js.map +1 -1
- package/cjs/middleware.js +2 -7
- package/cjs/middleware.js.map +1 -1
- package/cjs/middlewares/auth.js +1 -17
- package/cjs/middlewares/auth.js.map +1 -1
- package/cjs/middlewares/base.js +3 -9
- package/cjs/middlewares/base.js.map +1 -1
- package/cjs/middlewares/json.js +1 -19
- package/cjs/middlewares/json.js.map +1 -1
- package/cjs/middlewares/redirect.js +5 -21
- package/cjs/middlewares/redirect.js.map +1 -1
- package/cjs/models/activity-item.js +6 -20
- package/cjs/models/activity-item.js.map +1 -1
- package/cjs/models/adjunct-section.js +8 -21
- package/cjs/models/adjunct-section.js.map +1 -1
- package/cjs/models/adjunct-slide.js +8 -21
- package/cjs/models/adjunct-slide.js.map +1 -1
- package/cjs/models/adjunct-sub-slide.js +1 -16
- package/cjs/models/adjunct-sub-slide.js.map +1 -1
- package/cjs/models/adjunct.js +34 -10
- package/cjs/models/adjunct.js.map +1 -1
- package/cjs/models/api.js +1 -6
- package/cjs/models/api.js.map +1 -1
- package/cjs/models/appointment-adjunct-tags.js +1 -13
- package/cjs/models/appointment-adjunct-tags.js.map +1 -1
- package/cjs/models/appointment-deckversion-tags.js +1 -13
- package/cjs/models/appointment-deckversion-tags.js.map +1 -1
- package/cjs/models/appointment-duplicate.js +3 -25
- package/cjs/models/appointment-duplicate.js.map +1 -1
- package/cjs/models/appointment-editor.js +1 -14
- package/cjs/models/appointment-editor.js.map +1 -1
- package/cjs/models/appointment-section-tags.js +1 -13
- package/cjs/models/appointment-section-tags.js.map +1 -1
- package/cjs/models/appointment-slide-tags.js +1 -13
- package/cjs/models/appointment-slide-tags.js.map +1 -1
- package/cjs/models/appointment-stats.js +1 -11
- package/cjs/models/appointment-stats.js.map +1 -1
- package/cjs/models/appointment-tags.js +1 -10
- package/cjs/models/appointment-tags.js.map +1 -1
- package/cjs/models/appointment-template.js +23 -0
- package/cjs/models/appointment-template.js.map +1 -0
- package/cjs/models/appointment-viewing.js +1 -8
- package/cjs/models/appointment-viewing.js.map +1 -1
- package/cjs/models/appointment.js +94 -69
- package/cjs/models/appointment.js.map +1 -1
- package/cjs/models/asset.js +12 -11
- package/cjs/models/asset.js.map +1 -1
- package/cjs/models/auto-adjunct-key-check.js +1 -15
- package/cjs/models/auto-adjunct-key-check.js.map +1 -1
- package/cjs/models/auto-adjunct.js +5 -14
- package/cjs/models/auto-adjunct.js.map +1 -1
- package/cjs/models/base.js +89 -173
- package/cjs/models/base.js.map +1 -1
- package/cjs/models/base.spec.js +8 -30
- package/cjs/models/base.spec.js.map +1 -1
- package/cjs/models/choicelist.js +1 -8
- package/cjs/models/choicelist.js.map +1 -1
- package/cjs/models/cms-val.js +28 -15
- package/cjs/models/cms-val.js.map +1 -1
- package/cjs/models/cms-val.spec.js +25 -0
- package/cjs/models/cms-val.spec.js.map +1 -0
- package/cjs/models/contact-phone.js +54 -0
- package/cjs/models/contact-phone.js.map +1 -0
- package/cjs/models/contact.js +1 -18
- package/cjs/models/contact.js.map +1 -1
- package/cjs/models/customer.js +5 -30
- package/cjs/models/customer.js.map +1 -1
- package/cjs/models/deck-note.js +1 -9
- package/cjs/models/deck-note.js.map +1 -1
- package/cjs/models/deck-tags.js +1 -12
- package/cjs/models/deck-tags.js.map +1 -1
- package/cjs/models/deck-version-screenshot.js +47 -0
- package/cjs/models/deck-version-screenshot.js.map +1 -0
- package/cjs/models/deck-version.js +54 -47
- package/cjs/models/deck-version.js.map +1 -1
- package/cjs/models/deck.js +1 -14
- package/cjs/models/deck.js.map +1 -1
- package/cjs/models/dispatch-preview.js +1 -13
- package/cjs/models/dispatch-preview.js.map +1 -1
- package/cjs/models/dispatch.js +1 -23
- package/cjs/models/dispatch.js.map +1 -1
- package/cjs/models/envs.js +1 -6
- package/cjs/models/envs.js.map +1 -1
- package/cjs/models/event-object.js +1 -11
- package/cjs/models/event-object.js.map +1 -1
- package/cjs/models/event.js +1 -13
- package/cjs/models/event.js.map +1 -1
- package/cjs/models/feed-data.js +6 -13
- package/cjs/models/feed-data.js.map +1 -1
- package/cjs/models/file.js +1 -11
- package/cjs/models/file.js.map +1 -1
- package/cjs/models/group.js +1 -11
- package/cjs/models/group.js.map +1 -1
- package/cjs/models/handover.js +1 -13
- package/cjs/models/handover.js.map +1 -1
- package/cjs/models/hosted-preso.js +1 -15
- package/cjs/models/hosted-preso.js.map +1 -1
- package/cjs/models/image.js +30 -11
- package/cjs/models/image.js.map +1 -1
- package/cjs/models/location.js +1 -13
- package/cjs/models/location.js.map +1 -1
- package/cjs/models/manifest-json.js +75 -74
- package/cjs/models/manifest-json.js.map +1 -1
- package/cjs/models/onshare.js +1 -14
- package/cjs/models/onshare.js.map +1 -1
- package/cjs/models/opportunity.js +1 -14
- package/cjs/models/opportunity.js.map +1 -1
- package/cjs/models/pack-diff.js +1 -14
- package/cjs/models/pack-diff.js.map +1 -1
- package/cjs/models/pack.js +1 -12
- package/cjs/models/pack.js.map +1 -1
- package/cjs/models/preset.js +4 -20
- package/cjs/models/preset.js.map +1 -1
- package/cjs/models/refresh-request.js +17 -11
- package/cjs/models/refresh-request.js.map +1 -1
- package/cjs/models/room.js +1 -9
- package/cjs/models/room.js.map +1 -1
- package/cjs/models/salesforce-lookup.js +1 -12
- package/cjs/models/salesforce-lookup.js.map +1 -1
- package/cjs/models/section-selection.js +1 -14
- package/cjs/models/section-selection.js.map +1 -1
- package/cjs/models/section.js +4 -15
- package/cjs/models/section.js.map +1 -1
- package/cjs/models/slide-selection.js +1 -14
- package/cjs/models/slide-selection.js.map +1 -1
- package/cjs/models/slide.js +4 -15
- package/cjs/models/slide.js.map +1 -1
- package/cjs/models/snapshot.js +13 -15
- package/cjs/models/snapshot.js.map +1 -1
- package/cjs/models/snapshot.spec.js +44 -0
- package/cjs/models/snapshot.spec.js.map +1 -0
- package/cjs/models/sub-slide.js +1 -12
- package/cjs/models/sub-slide.js.map +1 -1
- package/cjs/models/support-ticket.js +1 -11
- package/cjs/models/support-ticket.js.map +1 -1
- package/cjs/models/tag.js +1 -13
- package/cjs/models/tag.js.map +1 -1
- package/cjs/models/team.js +14 -13
- package/cjs/models/team.js.map +1 -1
- package/cjs/models/template.js +89 -15
- package/cjs/models/template.js.map +1 -1
- package/cjs/models/tenancy.js +4 -11
- package/cjs/models/tenancy.js.map +1 -1
- package/cjs/models/timing-log.js +21 -78
- package/cjs/models/timing-log.js.map +1 -1
- package/cjs/models/timing-log.spec.js +24 -37
- package/cjs/models/timing-log.spec.js.map +1 -1
- package/cjs/models/token.js +46 -0
- package/cjs/models/token.js.map +1 -0
- package/cjs/models/transcribe-socket.js +1 -8
- package/cjs/models/transcribe-socket.js.map +1 -1
- package/cjs/models/upload.js +1 -7
- package/cjs/models/upload.js.map +1 -1
- package/cjs/models/user.js +11 -28
- package/cjs/models/user.js.map +1 -1
- package/cjs/models/user.spec.js +20 -30
- package/cjs/models/user.spec.js.map +1 -1
- package/cjs/models.js +44 -128
- package/cjs/models.js.map +1 -1
- package/cjs/presentation/appointment-presentation.js +14 -36
- package/cjs/presentation/appointment-presentation.js.map +1 -1
- package/cjs/presentation/base-presentation-collection.js +1 -7
- package/cjs/presentation/base-presentation-collection.js.map +1 -1
- package/cjs/presentation/base-presentation-model.js +108 -33
- package/cjs/presentation/base-presentation-model.js.map +1 -1
- package/cjs/presentation/base-presentation-model.spec.js +58 -23
- package/cjs/presentation/base-presentation-model.spec.js.map +1 -1
- package/cjs/presentation/presentation-deck.js +73 -83
- package/cjs/presentation/presentation-deck.js.map +1 -1
- package/cjs/presentation/presentation-deck.spec.js +118 -88
- package/cjs/presentation/presentation-deck.spec.js.map +1 -1
- package/cjs/presentation/presentation-decks.js +1 -9
- package/cjs/presentation/presentation-decks.js.map +1 -1
- package/cjs/presentation/presentation-section.js +70 -84
- package/cjs/presentation/presentation-section.js.map +1 -1
- package/cjs/presentation/presentation-section.spec.js +296 -238
- package/cjs/presentation/presentation-section.spec.js.map +1 -1
- package/cjs/presentation/presentation-sections.js +1 -9
- package/cjs/presentation/presentation-sections.js.map +1 -1
- package/cjs/presentation/presentation-slide.js +74 -84
- package/cjs/presentation/presentation-slide.js.map +1 -1
- package/cjs/presentation/presentation-slide.spec.js +211 -166
- package/cjs/presentation/presentation-slide.spec.js.map +1 -1
- package/cjs/presentation/presentation-slides.js +1 -9
- package/cjs/presentation/presentation-slides.js.map +1 -1
- package/cjs/presentation/presentation-subslide.js +3 -23
- package/cjs/presentation/presentation-subslide.js.map +1 -1
- package/cjs/presentation/presentation-subslide.spec.js +101 -125
- package/cjs/presentation/presentation-subslide.spec.js.map +1 -1
- package/cjs/presentation/presentation-subslides.js +1 -9
- package/cjs/presentation/presentation-subslides.js.map +1 -1
- package/cjs/presentation/presentation.js +87 -32
- package/cjs/presentation/presentation.js.map +1 -1
- package/cjs/presentation.js +0 -20
- package/cjs/presentation.js.map +1 -1
- package/cjs/selections.js +81 -0
- package/cjs/selections.js.map +1 -0
- package/cjs/state-register.js +3 -11
- package/cjs/state-register.js.map +1 -1
- package/cjs/sync.js +32 -76
- package/cjs/sync.js.map +1 -1
- package/cjs/utils.js +51 -42
- package/cjs/utils.js.map +1 -1
- package/cjs/utils.spec.js +0 -4
- package/cjs/utils.spec.js.map +1 -1
- package/jest.config.js +5 -3
- package/package.json +11 -8
- package/src/api.js +17 -2
- package/src/auth.js +45 -9
- package/src/auth.spec.js +2 -0
- package/src/collections/activity.js +4 -4
- package/src/collections/adjunct-sections.js +1 -1
- package/src/collections/adjunct-slides.js +1 -1
- package/src/collections/adjunct-sub-slides.js +1 -1
- package/src/collections/appointment-adjunct-tags.js +1 -1
- package/src/collections/appointment-deckversion-tags.js +2 -2
- package/src/collections/appointment-duplicates.js +1 -1
- package/src/collections/appointment-editors.js +1 -1
- package/src/collections/appointment-section-tags.js +1 -1
- package/src/collections/appointment-slide-tags.js +1 -1
- package/src/collections/appointment-tags.js +20 -18
- package/src/collections/appointment-templates.js +26 -0
- package/src/collections/appointments.js +9 -9
- package/src/collections/assets.js +1 -1
- package/src/collections/auto-adjuncts.js +1 -1
- package/src/collections/base.js +20 -10
- package/src/collections/base.spec.js +19 -5
- package/src/collections/cms-vals.js +5 -1
- package/src/collections/contact-phones.js +18 -0
- package/src/collections/contacts.js +1 -1
- package/src/collections/created-assets.js +1 -1
- package/src/collections/customers.js +1 -1
- package/src/collections/deck-notes.js +1 -1
- package/src/collections/deck-version-screenshots.js +48 -0
- package/src/collections/deck-versions.js +1 -1
- package/src/collections/decks.js +1 -1
- package/src/collections/deleted-assets.js +1 -1
- package/src/collections/dispatches.js +2 -2
- package/src/collections/event-objects.js +1 -1
- package/src/collections/events.js +1 -1
- package/src/collections/groups.js +1 -1
- package/src/collections/images.js +1 -1
- package/src/collections/locations.js +1 -1
- package/src/collections/opportunities.js +1 -1
- package/src/collections/pack-diffs.js +1 -1
- package/src/collections/packs.js +1 -1
- package/src/collections/presets.js +1 -1
- package/src/collections/section-selections.js +1 -1
- package/src/collections/sections.js +1 -1
- package/src/collections/slide-selections.js +1 -1
- package/src/collections/slides.js +1 -1
- package/src/collections/snapshots.js +1 -1
- package/src/collections/sub-slides.js +1 -1
- package/src/collections/tags.js +1 -1
- package/src/collections/teams.js +1 -1
- package/src/collections/templates.js +1 -1
- package/src/collections/uploads.js +1 -1
- package/src/collections/users.js +1 -1
- package/src/collections.js +3 -0
- package/src/fixtures.js +193 -0
- package/src/models/activity-item.js +3 -1
- package/src/models/adjunct-section.js +7 -2
- package/src/models/adjunct-slide.js +7 -2
- package/src/models/adjunct-sub-slide.js +1 -1
- package/src/models/adjunct.js +39 -1
- package/src/models/appointment-adjunct-tags.js +1 -1
- package/src/models/appointment-deckversion-tags.js +1 -1
- package/src/models/appointment-duplicate.js +1 -1
- package/src/models/appointment-editor.js +1 -1
- package/src/models/appointment-section-tags.js +1 -1
- package/src/models/appointment-slide-tags.js +1 -1
- package/src/models/appointment-stats.js +1 -1
- package/src/models/appointment-tags.js +1 -1
- package/src/models/appointment-template.js +19 -0
- package/src/models/appointment-viewing.js +1 -1
- package/src/models/appointment.js +112 -37
- package/src/models/asset.js +15 -1
- package/src/models/auto-adjunct-key-check.js +1 -1
- package/src/models/auto-adjunct.js +4 -1
- package/src/models/base.js +55 -22
- package/src/models/base.spec.js +34 -27
- package/src/models/choicelist.js +1 -1
- package/src/models/cms-val.js +24 -1
- package/src/models/cms-val.spec.js +14 -0
- package/src/models/contact-phone.js +57 -0
- package/src/models/contact.js +1 -1
- package/src/models/customer.js +3 -3
- package/src/models/deck-note.js +1 -1
- package/src/models/deck-tags.js +1 -1
- package/src/models/deck-version-screenshot.js +48 -0
- package/src/models/deck-version.js +60 -9
- package/src/models/deck.js +1 -1
- package/src/models/dispatch-preview.js +1 -1
- package/src/models/dispatch.js +1 -1
- package/src/models/event-object.js +1 -1
- package/src/models/event.js +1 -1
- package/src/models/feed-data.js +3 -1
- package/src/models/file.js +1 -1
- package/src/models/group.js +1 -1
- package/src/models/handover.js +1 -1
- package/src/models/hosted-preso.js +1 -1
- package/src/models/image.js +33 -1
- package/src/models/location.js +1 -1
- package/src/models/manifest-json.js +57 -6
- package/src/models/onshare.js +1 -1
- package/src/models/opportunity.js +1 -1
- package/src/models/pack-diff.js +1 -1
- package/src/models/pack.js +1 -1
- package/src/models/preset.js +3 -1
- package/src/models/refresh-request.js +15 -1
- package/src/models/room.js +1 -1
- package/src/models/salesforce-lookup.js +1 -1
- package/src/models/section-selection.js +1 -1
- package/src/models/section.js +3 -1
- package/src/models/slide-selection.js +1 -1
- package/src/models/slide.js +3 -1
- package/src/models/snapshot.js +11 -2
- package/src/models/snapshot.spec.js +31 -0
- package/src/models/sub-slide.js +1 -1
- package/src/models/support-ticket.js +1 -1
- package/src/models/tag.js +1 -1
- package/src/models/team.js +14 -3
- package/src/models/template.js +74 -2
- package/src/models/tenancy.js +4 -1
- package/src/models/timing-log.js +2 -2
- package/src/models/timing-log.spec.js +1 -1
- package/src/models/token.js +47 -0
- package/src/models/transcribe-socket.js +1 -1
- package/src/models/user.js +15 -2
- package/src/models.js +4 -0
- package/src/presentation/appointment-presentation.js +13 -5
- package/src/presentation/base-presentation-collection.js +1 -1
- package/src/presentation/base-presentation-model.js +88 -3
- package/src/presentation/base-presentation-model.spec.js +80 -3
- package/src/presentation/presentation-deck.js +65 -22
- package/src/presentation/presentation-deck.spec.js +55 -2
- package/src/presentation/presentation-decks.js +1 -1
- package/src/presentation/presentation-section.js +91 -31
- package/src/presentation/presentation-section.spec.js +142 -10
- package/src/presentation/presentation-sections.js +1 -1
- package/src/presentation/presentation-slide.js +69 -23
- package/src/presentation/presentation-slide.spec.js +105 -9
- package/src/presentation/presentation-slides.js +1 -1
- package/src/presentation/presentation-subslide.js +5 -5
- package/src/presentation/presentation-subslide.spec.js +3 -3
- package/src/presentation/presentation-subslides.js +1 -1
- package/src/presentation/presentation.js +27 -8
- package/src/selections.js +71 -0
- package/src/sync.js +1 -1
- package/src/utils.js +31 -8
- package/src/utils.spec.js +4 -4
package/src/models/asset.js
CHANGED
|
@@ -33,6 +33,20 @@ export const AssetModel = BaseModel.extend(
|
|
|
33
33
|
orig_path: "string",
|
|
34
34
|
},
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The asset serializer actually returns the file in question for the URL.
|
|
38
|
+
* This method returns the actual URL of the asset endpoint, for example:
|
|
39
|
+
*
|
|
40
|
+
* /api/assets/2/
|
|
41
|
+
*/
|
|
42
|
+
assetURL() {
|
|
43
|
+
// HACK: For some reason the API endpoint returns a url with a pack in it, but
|
|
44
|
+
// this doesn't actually work. We just want the 'asset' url.
|
|
45
|
+
return `${this.getResourceURL().replace("/packs/{pack.id}", "")}${
|
|
46
|
+
this.id
|
|
47
|
+
}/`;
|
|
48
|
+
},
|
|
49
|
+
|
|
36
50
|
/**
|
|
37
51
|
* @property {models.PackModel} pack
|
|
38
52
|
*/
|
|
@@ -43,7 +57,7 @@ export const AssetModel = BaseModel.extend(
|
|
|
43
57
|
url() {
|
|
44
58
|
return this._url;
|
|
45
59
|
},
|
|
46
|
-
}
|
|
60
|
+
},
|
|
47
61
|
);
|
|
48
62
|
|
|
49
63
|
register("AssetModel", AssetModel);
|
|
@@ -25,6 +25,7 @@ export const AutoAdjunctModel = BaseModel.extend(
|
|
|
25
25
|
* @property {string} after_key
|
|
26
26
|
* @property {boolean} enabled
|
|
27
27
|
* @property {number} sequence
|
|
28
|
+
* @property {string[]} cmsvalkey_set
|
|
28
29
|
*/
|
|
29
30
|
props: {
|
|
30
31
|
image_128: "string",
|
|
@@ -39,6 +40,8 @@ export const AutoAdjunctModel = BaseModel.extend(
|
|
|
39
40
|
enabled: "boolean",
|
|
40
41
|
sequence: "number",
|
|
41
42
|
tags: "array",
|
|
43
|
+
cmsvalkey_set: "array",
|
|
44
|
+
_tenancy: "object",
|
|
42
45
|
},
|
|
43
46
|
|
|
44
47
|
/**
|
|
@@ -50,7 +53,7 @@ export const AutoAdjunctModel = BaseModel.extend(
|
|
|
50
53
|
template: "TemplateModel",
|
|
51
54
|
team: "TeamModel",
|
|
52
55
|
},
|
|
53
|
-
}
|
|
56
|
+
},
|
|
54
57
|
);
|
|
55
58
|
|
|
56
59
|
register("AutoAdjunctModel", AutoAdjunctModel);
|
package/src/models/base.js
CHANGED
|
@@ -21,11 +21,16 @@ export const BaseModel = Model.extend(
|
|
|
21
21
|
/** @lends models.BaseModel# */ {
|
|
22
22
|
modelName: null,
|
|
23
23
|
queryData: {},
|
|
24
|
+
detailType: "number",
|
|
24
25
|
|
|
25
26
|
// This is unfortunately necessary to avoid the default ampersand model/state
|
|
26
27
|
// behaviour from automatically hydrating all children and collections on a fetch.
|
|
27
28
|
isFetching: false,
|
|
28
29
|
|
|
30
|
+
// Useful to figure out whether the model is just a URL (unfetched), or has been
|
|
31
|
+
// fetched from the server (an object).
|
|
32
|
+
_isFetched: true,
|
|
33
|
+
|
|
29
34
|
// Object of regexes that should be used to match a url in `matchesURL`
|
|
30
35
|
// For example the URL: /api/foo/{pk}/bar/ might have the following:
|
|
31
36
|
//
|
|
@@ -38,11 +43,13 @@ export const BaseModel = Model.extend(
|
|
|
38
43
|
// ```
|
|
39
44
|
urlMatchKeys: {},
|
|
40
45
|
|
|
41
|
-
constructor(
|
|
46
|
+
constructor(_data = {}, opts = {}) {
|
|
42
47
|
const options = _.defaults(opts, {
|
|
43
48
|
data: {},
|
|
44
49
|
});
|
|
45
50
|
|
|
51
|
+
let data = _data;
|
|
52
|
+
|
|
46
53
|
this._unsetChildren = {};
|
|
47
54
|
this._unsetCollections = {};
|
|
48
55
|
this._expandedValues = {};
|
|
@@ -61,6 +68,13 @@ export const BaseModel = Model.extend(
|
|
|
61
68
|
// Convert any strings into a url format we can understand
|
|
62
69
|
if (_.isString(data)) {
|
|
63
70
|
data = { url: data };
|
|
71
|
+
this._isFetched = false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Convert model ids into a format we can understand
|
|
75
|
+
if (_.isNumber(data)) {
|
|
76
|
+
data = { id: data };
|
|
77
|
+
this._isFetched = false;
|
|
64
78
|
}
|
|
65
79
|
|
|
66
80
|
const dataCopy = _.extend({}, data);
|
|
@@ -86,6 +100,15 @@ export const BaseModel = Model.extend(
|
|
|
86
100
|
if (def && (def.isState || def instanceof Collection)) {
|
|
87
101
|
dataCopy[key] = def.toJSON();
|
|
88
102
|
}
|
|
103
|
+
|
|
104
|
+
if (def && Array.isArray(def)) {
|
|
105
|
+
dataCopy[key] = def.map((obj) => {
|
|
106
|
+
if (obj instanceof Model) {
|
|
107
|
+
return obj.toJSON();
|
|
108
|
+
}
|
|
109
|
+
return obj;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
89
112
|
}
|
|
90
113
|
|
|
91
114
|
this.registerStates();
|
|
@@ -118,7 +141,7 @@ export const BaseModel = Model.extend(
|
|
|
118
141
|
for (const derivedProp of Object.keys(this._data[derivedKey])) {
|
|
119
142
|
this[derivedKey].set(
|
|
120
143
|
derivedProp,
|
|
121
|
-
this._data[derivedKey][derivedProp]
|
|
144
|
+
this._data[derivedKey][derivedProp],
|
|
122
145
|
);
|
|
123
146
|
}
|
|
124
147
|
}
|
|
@@ -139,9 +162,9 @@ export const BaseModel = Model.extend(
|
|
|
139
162
|
const replacements = _.extend(
|
|
140
163
|
{},
|
|
141
164
|
{
|
|
142
|
-
detailKey:
|
|
165
|
+
detailKey: this.detailType,
|
|
143
166
|
},
|
|
144
|
-
this.urlMatchKeys
|
|
167
|
+
this.urlMatchKeys,
|
|
145
168
|
);
|
|
146
169
|
|
|
147
170
|
const regexes = Object.keys(replacements).reduce((result, key) => {
|
|
@@ -149,6 +172,8 @@ export const BaseModel = Model.extend(
|
|
|
149
172
|
const name = key.replace(/\./g, "_");
|
|
150
173
|
if (type === "number") {
|
|
151
174
|
result[name] = "\\d+";
|
|
175
|
+
} else if (type === "uuid") {
|
|
176
|
+
result[name] = "([a-z]|[0-9]|-)+";
|
|
152
177
|
} else if (type === "string") {
|
|
153
178
|
result[name] = "\\w+";
|
|
154
179
|
} else {
|
|
@@ -195,7 +220,7 @@ export const BaseModel = Model.extend(
|
|
|
195
220
|
Failed to match URL '${url}' for model '${this.modelName}'.
|
|
196
221
|
This is usually because the regex type for a key hasn't been set.
|
|
197
222
|
Error: `,
|
|
198
|
-
e
|
|
223
|
+
e,
|
|
199
224
|
);
|
|
200
225
|
return false;
|
|
201
226
|
}
|
|
@@ -213,8 +238,8 @@ export const BaseModel = Model.extend(
|
|
|
213
238
|
// and we want to ignore the hostname (https://staging-demo.salespreso.com)
|
|
214
239
|
// and strip out the '/api' from both the resource url and the variable url
|
|
215
240
|
// so that we can use the remaining part to isolate the id
|
|
216
|
-
_getIDFromURL(url) {
|
|
217
|
-
const resourceURL = this.getResourceURL();
|
|
241
|
+
_getIDFromURL(url, resource = "") {
|
|
242
|
+
const resourceURL = resource || this.getResourceURL();
|
|
218
243
|
|
|
219
244
|
if (!url || !resourceURL) {
|
|
220
245
|
return null;
|
|
@@ -305,7 +330,7 @@ export const BaseModel = Model.extend(
|
|
|
305
330
|
const Model = registeredStates[model];
|
|
306
331
|
if (!Model) {
|
|
307
332
|
throw new Error(
|
|
308
|
-
`'${model}' not found! Did you forget to import it on the '${this.modelName}' model
|
|
333
|
+
`'${model}' not found! Did you forget to import it on the '${this.modelName}' model?`,
|
|
309
334
|
);
|
|
310
335
|
}
|
|
311
336
|
this._children[prop] = Model;
|
|
@@ -315,7 +340,7 @@ export const BaseModel = Model.extend(
|
|
|
315
340
|
const Collection = state[collection];
|
|
316
341
|
if (!Collection) {
|
|
317
342
|
throw new Error(
|
|
318
|
-
`'${collection}' not found! Did you forget to import it on the '${this.modelName}' model
|
|
343
|
+
`'${collection}' not found! Did you forget to import it on the '${this.modelName}' model?`,
|
|
319
344
|
);
|
|
320
345
|
}
|
|
321
346
|
this._collections[prop] = Collection;
|
|
@@ -349,7 +374,7 @@ export const BaseModel = Model.extend(
|
|
|
349
374
|
}
|
|
350
375
|
}
|
|
351
376
|
},
|
|
352
|
-
this
|
|
377
|
+
this,
|
|
353
378
|
);
|
|
354
379
|
|
|
355
380
|
// Loop throught the collections and replace with the registered collection
|
|
@@ -360,7 +385,7 @@ export const BaseModel = Model.extend(
|
|
|
360
385
|
this._registerCollection(registeredStates, prop, collection);
|
|
361
386
|
}
|
|
362
387
|
},
|
|
363
|
-
this
|
|
388
|
+
this,
|
|
364
389
|
);
|
|
365
390
|
},
|
|
366
391
|
|
|
@@ -402,6 +427,7 @@ export const BaseModel = Model.extend(
|
|
|
402
427
|
|
|
403
428
|
this.isFetching = true;
|
|
404
429
|
return Model.prototype.fetch.apply(this, arguments).tap((response) => {
|
|
430
|
+
this._isFetched = true;
|
|
405
431
|
this.isFetching = false;
|
|
406
432
|
this._updateResponse(response);
|
|
407
433
|
});
|
|
@@ -421,6 +447,10 @@ export const BaseModel = Model.extend(
|
|
|
421
447
|
});
|
|
422
448
|
},
|
|
423
449
|
|
|
450
|
+
isFetched() {
|
|
451
|
+
return this._isFetched;
|
|
452
|
+
},
|
|
453
|
+
|
|
424
454
|
getSafeAttrs(key) {
|
|
425
455
|
if (!_.isUndefined(key)) {
|
|
426
456
|
return !_.isUndefined(this._expandedValues[key])
|
|
@@ -434,10 +464,10 @@ export const BaseModel = Model.extend(
|
|
|
434
464
|
_.concat(
|
|
435
465
|
_.concat(
|
|
436
466
|
Object.keys(this._unsetChildren),
|
|
437
|
-
Object.keys(this._unsetCollections)
|
|
467
|
+
Object.keys(this._unsetCollections),
|
|
438
468
|
),
|
|
439
|
-
Object.keys(this._values)
|
|
440
|
-
)
|
|
469
|
+
Object.keys(this._values),
|
|
470
|
+
),
|
|
441
471
|
);
|
|
442
472
|
|
|
443
473
|
keys.forEach((key) => {
|
|
@@ -490,12 +520,12 @@ export const BaseModel = Model.extend(
|
|
|
490
520
|
if (typeof this._children[child] === "function") {
|
|
491
521
|
this._safeSet(
|
|
492
522
|
child,
|
|
493
|
-
new this._children[child](val, { parent: this })
|
|
523
|
+
new this._children[child](val, { parent: this }),
|
|
494
524
|
);
|
|
495
525
|
this.listenTo(
|
|
496
526
|
this[child],
|
|
497
527
|
"all",
|
|
498
|
-
this._getCachedEventBubblingHandler(child)
|
|
528
|
+
this._getCachedEventBubblingHandler(child),
|
|
499
529
|
);
|
|
500
530
|
} else {
|
|
501
531
|
this._safeSet(child, val);
|
|
@@ -523,7 +553,7 @@ export const BaseModel = Model.extend(
|
|
|
523
553
|
if (typeof this._collections[coll] === "function") {
|
|
524
554
|
this._safeSet(
|
|
525
555
|
coll,
|
|
526
|
-
new this._collections[coll](val, { parent: this })
|
|
556
|
+
new this._collections[coll](val, { parent: this }),
|
|
527
557
|
);
|
|
528
558
|
} else {
|
|
529
559
|
this._safeSet(coll, val);
|
|
@@ -583,7 +613,6 @@ export const BaseModel = Model.extend(
|
|
|
583
613
|
if (this._url && this.isNew()) {
|
|
584
614
|
return this.getFullURLPath(this._url);
|
|
585
615
|
}
|
|
586
|
-
|
|
587
616
|
return this.getFullURLPath(this.getPlainURL());
|
|
588
617
|
},
|
|
589
618
|
|
|
@@ -599,6 +628,10 @@ export const BaseModel = Model.extend(
|
|
|
599
628
|
resp += "/";
|
|
600
629
|
}
|
|
601
630
|
|
|
631
|
+
if (!resp.includes("{") || !resp.includes("}")) {
|
|
632
|
+
return resp;
|
|
633
|
+
}
|
|
634
|
+
|
|
602
635
|
// Replace any values in a url with one from the model.
|
|
603
636
|
// So if you have /path/to/{model.id}/
|
|
604
637
|
// It will check the model from "this.model.id" and replace
|
|
@@ -637,7 +670,7 @@ export const BaseModel = Model.extend(
|
|
|
637
670
|
return sync.apply(this, arguments);
|
|
638
671
|
},
|
|
639
672
|
|
|
640
|
-
serialize() {
|
|
673
|
+
serialize(opts = { derived: true }) {
|
|
641
674
|
// Return nothing if data passed is falsy. More than likely this is
|
|
642
675
|
// a null value
|
|
643
676
|
if (!this._data) {
|
|
@@ -647,7 +680,7 @@ export const BaseModel = Model.extend(
|
|
|
647
680
|
const data = Model.prototype.serialize.apply(this, arguments);
|
|
648
681
|
data.url = this.url();
|
|
649
682
|
|
|
650
|
-
let derived = this.getAttributes(
|
|
683
|
+
let derived = this.getAttributes(opts);
|
|
651
684
|
derived = Object.keys(derived).reduce((object, key) => {
|
|
652
685
|
let value = derived[key];
|
|
653
686
|
if (value instanceof Collection || value instanceof Model) {
|
|
@@ -698,7 +731,7 @@ export const BaseModel = Model.extend(
|
|
|
698
731
|
|
|
699
732
|
return null;
|
|
700
733
|
},
|
|
701
|
-
}
|
|
734
|
+
},
|
|
702
735
|
);
|
|
703
736
|
|
|
704
737
|
function replacePropertyDefinition(object, name) {
|
|
@@ -767,7 +800,7 @@ function replacePropertyDefinition(object, name) {
|
|
|
767
800
|
get() {
|
|
768
801
|
if (!this._values) {
|
|
769
802
|
throw new Error(
|
|
770
|
-
`Trying to retrieve value ${name} of model ${object.modelName} during constructor
|
|
803
|
+
`Trying to retrieve value ${name} of model ${object.modelName} during constructor`,
|
|
771
804
|
);
|
|
772
805
|
}
|
|
773
806
|
|
package/src/models/base.spec.js
CHANGED
|
@@ -7,7 +7,7 @@ import log from "../log.js";
|
|
|
7
7
|
import moment from "moment";
|
|
8
8
|
import td from "testdouble";
|
|
9
9
|
|
|
10
|
-
it("should set date types correctly (SP-2698)",
|
|
10
|
+
it("should set date types correctly (SP-2698)", () => {
|
|
11
11
|
const TestModel = BaseModel.extend({ props: { testDate: "date" } });
|
|
12
12
|
|
|
13
13
|
const model = new TestModel();
|
|
@@ -48,35 +48,35 @@ it("should not append a slash to a get query", () => {
|
|
|
48
48
|
expect(model.url()).toEqual("/api/tests/?foo=bar");
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
it("should replace child model strings with the registered model",
|
|
51
|
+
it("should replace child model strings with the registered model", () => {
|
|
52
52
|
const TestModel = G(BaseModel, "TestModel");
|
|
53
53
|
const Model = G(
|
|
54
54
|
BaseModel.extend({
|
|
55
55
|
children: { test: "TestModel" },
|
|
56
|
-
})
|
|
56
|
+
}),
|
|
57
57
|
);
|
|
58
58
|
const model = new Model({ test: 1 });
|
|
59
59
|
expect(model.test).toBeInstanceOf(TestModel);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
it("should allow the model to be passed in",
|
|
62
|
+
it("should allow the model to be passed in", () => {
|
|
63
63
|
const TestModel = G(BaseModel, "TestModel");
|
|
64
64
|
const Model = G(
|
|
65
65
|
BaseModel.extend({
|
|
66
66
|
children: { test: "TestModel" },
|
|
67
|
-
})
|
|
67
|
+
}),
|
|
68
68
|
);
|
|
69
69
|
const model = new Model({ test: new TestModel({ id: 1 }) });
|
|
70
70
|
expect(model.test.id).toEqual(1);
|
|
71
71
|
expect(model.test).toBeInstanceOf(TestModel);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
it("should reference parent model if foreign key exists",
|
|
74
|
+
it("should reference parent model if foreign key exists", () => {
|
|
75
75
|
G(BaseModel, "TestModel");
|
|
76
76
|
const Model = G(
|
|
77
77
|
BaseModel.extend({
|
|
78
78
|
children: { test: "TestModel" },
|
|
79
|
-
})
|
|
79
|
+
}),
|
|
80
80
|
);
|
|
81
81
|
const model = new Model({ test: 1 });
|
|
82
82
|
expect(model).toEqual(model.test.parent);
|
|
@@ -86,46 +86,53 @@ it("should throw an error if the child model doesn't exist", () => {
|
|
|
86
86
|
const Model = G(
|
|
87
87
|
BaseModel.extend({
|
|
88
88
|
children: { test: "DoesntExist" },
|
|
89
|
-
})
|
|
89
|
+
}),
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
expect(() => new Model()).toThrow();
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
it("should convert a url into a model",
|
|
95
|
+
it("should convert a url into a model", () => {
|
|
96
96
|
G(BaseModel.extend({ modelName: "tests" }), "TestModel");
|
|
97
97
|
const Model = G(
|
|
98
98
|
BaseModel.extend({
|
|
99
99
|
children: { test: "TestModel" },
|
|
100
|
-
})
|
|
100
|
+
}),
|
|
101
101
|
);
|
|
102
102
|
const model = new Model({ test: "/api/tests/1/" });
|
|
103
103
|
expect(model.test.id).toEqual(1);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
it("should convert an
|
|
106
|
+
it("should convert an id into a model", () => {
|
|
107
|
+
const TestModel = BaseModel.extend({ modelName: "test" });
|
|
108
|
+
const testModel = new TestModel(1);
|
|
109
|
+
expect(testModel.id).toEqual(1);
|
|
110
|
+
expect(testModel.url()).toEqual("/test/1/");
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("should convert an object into a model", () => {
|
|
107
114
|
G(BaseModel, "TestModel");
|
|
108
115
|
const Model = G(
|
|
109
116
|
BaseModel.extend({
|
|
110
117
|
children: { test: "TestModel" },
|
|
111
|
-
})
|
|
118
|
+
}),
|
|
112
119
|
);
|
|
113
120
|
const model = new Model({ test: { id: 1 } });
|
|
114
121
|
expect(model.test.id).toEqual(1);
|
|
115
122
|
});
|
|
116
123
|
|
|
117
|
-
it("should replace collection strings with their registered state",
|
|
124
|
+
it("should replace collection strings with their registered state", () => {
|
|
118
125
|
G(BaseModel, "TestModel");
|
|
119
126
|
const TestCollection = G(
|
|
120
127
|
BaseCollection.extend({
|
|
121
128
|
model: "TestModel",
|
|
122
129
|
}),
|
|
123
|
-
"TestCollection"
|
|
130
|
+
"TestCollection",
|
|
124
131
|
);
|
|
125
132
|
const Model = G(
|
|
126
133
|
BaseModel.extend({
|
|
127
134
|
collections: { tests: "TestCollection" },
|
|
128
|
-
})
|
|
135
|
+
}),
|
|
129
136
|
);
|
|
130
137
|
const model = new Model({
|
|
131
138
|
tests: [{ id: 1 }],
|
|
@@ -133,18 +140,18 @@ it("should replace collection strings with their registered state", function ()
|
|
|
133
140
|
expect(model.tests).toBeInstanceOf(TestCollection);
|
|
134
141
|
});
|
|
135
142
|
|
|
136
|
-
it("should allow a list of models to be passed into a collection",
|
|
143
|
+
it("should allow a list of models to be passed into a collection", () => {
|
|
137
144
|
const TestModel = G(BaseModel, "TestModel");
|
|
138
145
|
G(
|
|
139
146
|
BaseCollection.extend({
|
|
140
147
|
model: "TestModel",
|
|
141
148
|
}),
|
|
142
|
-
"TestCollection"
|
|
149
|
+
"TestCollection",
|
|
143
150
|
);
|
|
144
151
|
const Model = G(
|
|
145
152
|
BaseModel.extend({
|
|
146
153
|
collections: { tests: "TestCollection" },
|
|
147
|
-
})
|
|
154
|
+
}),
|
|
148
155
|
);
|
|
149
156
|
const test = new TestModel({ id: 1 });
|
|
150
157
|
const model = new Model({
|
|
@@ -159,12 +166,12 @@ it("should allow a collection to be passed in directly", () => {
|
|
|
159
166
|
BaseCollection.extend({
|
|
160
167
|
model: "TestModel",
|
|
161
168
|
}),
|
|
162
|
-
"TestCollection"
|
|
169
|
+
"TestCollection",
|
|
163
170
|
);
|
|
164
171
|
const Model = G(
|
|
165
172
|
BaseModel.extend({
|
|
166
173
|
collections: { tests: "TestCollection" },
|
|
167
|
-
})
|
|
174
|
+
}),
|
|
168
175
|
);
|
|
169
176
|
const model = new Model({
|
|
170
177
|
tests: new TestCollection([{ id: 1 }]),
|
|
@@ -185,12 +192,12 @@ it("should convert a url into a collection", () => {
|
|
|
185
192
|
BaseCollection.extend({
|
|
186
193
|
model: "TestModel",
|
|
187
194
|
}),
|
|
188
|
-
"TestCollection"
|
|
195
|
+
"TestCollection",
|
|
189
196
|
);
|
|
190
197
|
const Model = G(
|
|
191
198
|
BaseModel.extend({
|
|
192
199
|
collections: { tests: "TestCollection" },
|
|
193
|
-
})
|
|
200
|
+
}),
|
|
194
201
|
);
|
|
195
202
|
const model = new Model({ tests: "/api/tests/" });
|
|
196
203
|
expect(model.tests).toBeInstanceOf(TestCollection);
|
|
@@ -202,7 +209,7 @@ it("should convert an array of objects into a collection", () => {
|
|
|
202
209
|
const Model = G(
|
|
203
210
|
BaseModel.extend({
|
|
204
211
|
collections: { tests: "TestCollection" },
|
|
205
|
-
})
|
|
212
|
+
}),
|
|
206
213
|
);
|
|
207
214
|
const model = new Model({
|
|
208
215
|
tests: [{ id: 1 }, { id: 2 }],
|
|
@@ -211,7 +218,7 @@ it("should convert an array of objects into a collection", () => {
|
|
|
211
218
|
expect(model.tests.at(1).id).toEqual(2);
|
|
212
219
|
});
|
|
213
220
|
|
|
214
|
-
it("should correctly sanitize strings of multibyte characters (preserving spaces)",
|
|
221
|
+
it("should correctly sanitize strings of multibyte characters (preserving spaces)", () => {
|
|
215
222
|
const TestModel = BaseModel.extend({
|
|
216
223
|
props: {
|
|
217
224
|
normalString: "string",
|
|
@@ -324,13 +331,13 @@ it("should pass through values into a derived collection", () => {
|
|
|
324
331
|
name: "string",
|
|
325
332
|
},
|
|
326
333
|
}),
|
|
327
|
-
"DerivedModel"
|
|
334
|
+
"DerivedModel",
|
|
328
335
|
);
|
|
329
336
|
|
|
330
337
|
const DerivedCollection = G(
|
|
331
338
|
BaseCollection.extend({
|
|
332
339
|
model: "DerivedModel",
|
|
333
|
-
})
|
|
340
|
+
}),
|
|
334
341
|
);
|
|
335
342
|
|
|
336
343
|
const TestModel = G(
|
|
@@ -344,7 +351,7 @@ it("should pass through values into a derived collection", () => {
|
|
|
344
351
|
},
|
|
345
352
|
},
|
|
346
353
|
}),
|
|
347
|
-
"TestModel"
|
|
354
|
+
"TestModel",
|
|
348
355
|
);
|
|
349
356
|
|
|
350
357
|
const model = new TestModel({
|
package/src/models/choicelist.js
CHANGED
package/src/models/cms-val.js
CHANGED
|
@@ -4,6 +4,7 @@ import "./deck.js";
|
|
|
4
4
|
|
|
5
5
|
import { BaseModel } from "../models/base.js";
|
|
6
6
|
import { register } from "../state-register.js";
|
|
7
|
+
import { sanitizeBase64 } from "../utils.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @constructor
|
|
@@ -21,6 +22,7 @@ export const CMSValModel = BaseModel.extend(
|
|
|
21
22
|
scope: "string",
|
|
22
23
|
mime: "string",
|
|
23
24
|
value: "string",
|
|
25
|
+
_tenancy: "object",
|
|
24
26
|
},
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -55,7 +57,28 @@ export const CMSValModel = BaseModel.extend(
|
|
|
55
57
|
|
|
56
58
|
return data;
|
|
57
59
|
},
|
|
58
|
-
|
|
60
|
+
|
|
61
|
+
toServer() {
|
|
62
|
+
const obj = BaseModel.prototype.toServer.call(this);
|
|
63
|
+
return {
|
|
64
|
+
...obj,
|
|
65
|
+
// We shouldn't allow any base64 to get in here, otherwise it can
|
|
66
|
+
// KO all users appointments.
|
|
67
|
+
value: sanitizeBase64(obj.value),
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
toCompactJSON() {
|
|
72
|
+
const json = this.toJSON();
|
|
73
|
+
const wanted = ["key", "value", "mime", "scope"];
|
|
74
|
+
|
|
75
|
+
const compact = Object.fromEntries(
|
|
76
|
+
Object.entries(json).filter(([key, val]) => wanted.includes(key)),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return compact;
|
|
80
|
+
},
|
|
81
|
+
},
|
|
59
82
|
);
|
|
60
83
|
|
|
61
84
|
register("CMSValModel", CMSValModel);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { G } from "sp-test/api";
|
|
2
|
+
|
|
3
|
+
it("should remove large base64 strings from value when saving", async () => {
|
|
4
|
+
const CMSValModel = G("CMSValModel");
|
|
5
|
+
const largeBase64 =
|
|
6
|
+
"data:image/gif;base64," + new Array(50_000).fill("a").join("");
|
|
7
|
+
|
|
8
|
+
const cmsVal = new CMSValModel({
|
|
9
|
+
mime: "image",
|
|
10
|
+
value: largeBase64,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(cmsVal.toServer().value).toEqual("");
|
|
14
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import "./customer.js";
|
|
2
|
+
|
|
3
|
+
import { BaseModel } from "./base.js";
|
|
4
|
+
import { register } from "../state-register.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @constructor
|
|
8
|
+
* @alias models.ContactModel
|
|
9
|
+
* @extends models.BaseModel
|
|
10
|
+
*/
|
|
11
|
+
export const ContactPhoneModel = BaseModel.extend(
|
|
12
|
+
/** @lends models.ContactPhoneModel# */ {
|
|
13
|
+
modelName: "contact-phones",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @property {date} created_date
|
|
17
|
+
* @property {date} modified_date
|
|
18
|
+
* @property {boolean} is_valid
|
|
19
|
+
* @property {string} raw
|
|
20
|
+
* @property {string} e164_format
|
|
21
|
+
* @property {string} national_format
|
|
22
|
+
* @property {string} number_type
|
|
23
|
+
*/
|
|
24
|
+
props: {
|
|
25
|
+
created_date: "date",
|
|
26
|
+
modified_date: "date",
|
|
27
|
+
is_valid: "boolean",
|
|
28
|
+
raw: "string",
|
|
29
|
+
e164_format: "string",
|
|
30
|
+
national_format: "string",
|
|
31
|
+
number_type: "string",
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @property {models.ContactModel} contact
|
|
36
|
+
*/
|
|
37
|
+
children: {
|
|
38
|
+
contact: "ContactModel",
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
toServer() {
|
|
42
|
+
/* Only write to `raw` field. The others are derived on the server */
|
|
43
|
+
const data = {
|
|
44
|
+
raw: this.raw,
|
|
45
|
+
contact: this._retrieveURL(this.contact),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (this.id) {
|
|
49
|
+
data.id = this.id;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return data;
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
register("ContactPhoneModel", ContactPhoneModel);
|
package/src/models/contact.js
CHANGED
package/src/models/customer.js
CHANGED
|
@@ -76,7 +76,7 @@ export const CustomerModel = BaseModel.extend(
|
|
|
76
76
|
deps: ["logo_512", "profile"],
|
|
77
77
|
fn: function () {
|
|
78
78
|
// HACK: Check for the REA usecase where it gets images from profile
|
|
79
|
-
if (this.profile
|
|
79
|
+
if (this.profile?.rea_image_large) {
|
|
80
80
|
return this.profile.rea_image_large;
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -113,7 +113,7 @@ export const CustomerModel = BaseModel.extend(
|
|
|
113
113
|
// Filter contacts if this is fetched from an appointment
|
|
114
114
|
if (topParent && topParent.name === "appointments") {
|
|
115
115
|
const contactUrls = this.contact_set.map((contact) =>
|
|
116
|
-
this._retrieveUrl(contact)
|
|
116
|
+
this._retrieveUrl(contact),
|
|
117
117
|
);
|
|
118
118
|
|
|
119
119
|
const filteredContacts = topParent.contact_set.filter((contact) => {
|
|
@@ -140,7 +140,7 @@ export const CustomerModel = BaseModel.extend(
|
|
|
140
140
|
|
|
141
141
|
return data;
|
|
142
142
|
},
|
|
143
|
-
}
|
|
143
|
+
},
|
|
144
144
|
);
|
|
145
145
|
|
|
146
146
|
register("CustomerModel", CustomerModel);
|