@livepreso/api 6.50.1 → 6.51.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/CHANGELOG.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "@livepreso/api",
3
3
  "entries": [
4
+ {
5
+ "version": "6.51.0",
6
+ "tag": "@livepreso/api_v6.51.0",
7
+ "date": "Thu, 12 Jun 2025 03:07:46 GMT",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "comment": "Add support for deck keylist on deckversion model"
12
+ }
13
+ ],
14
+ "patch": [
15
+ {
16
+ "comment": "Rename keylist to layout"
17
+ }
18
+ ]
19
+ }
20
+ },
4
21
  {
5
22
  "version": "6.50.1",
6
23
  "tag": "@livepreso/api_v6.50.1",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # Change Log - @livepreso/api
2
2
 
3
- This log was last generated on Thu, 13 Mar 2025 05:17:54 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 12 Jun 2025 03:07:46 GMT and should not be manually modified.
4
+
5
+ ## 6.51.0
6
+ Thu, 12 Jun 2025 03:07:46 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Add support for deck keylist on deckversion model
11
+
12
+ ### Patches
13
+
14
+ - Rename keylist to layout
4
15
 
5
16
  ## 6.50.1
6
17
  Thu, 13 Mar 2025 05:17:54 GMT
@@ -44,7 +44,8 @@ var CustomerModel = exports.CustomerModel = _base.BaseModel.extend(/** @lends mo
44
44
  profile: "object",
45
45
  soft_deleted: "boolean",
46
46
  title: "stringSanitized",
47
- website: "string"
47
+ website: "string",
48
+ fixture_key: "string"
48
49
  },
49
50
  /**
50
51
  * @property {models.LocationModel} default_location
@@ -1 +1 @@
1
- {"version":3,"file":"customer.js","names":["require","_base","_stateRegister","CustomerModel","exports","BaseModel","extend","modelName","props","created_date","logo_128","logo_256","logo_512","logo_original","modified_date","notes","primary_colour","profile","soft_deleted","title","website","children","default_location","default_opportunity","collections","contact_set","opportunity_set","location_set","team_set","derived","logo","deps","fn","_this$profile","rea_image_large","primaryColour","fetch","_this","baseFetch","prototype","apply","arguments","then","topParent","curParent","parent","name","contactUrls","map","contact","_retrieveUrl","filteredContacts","filter","indexOf","set","toServer","data","_retrieveURL","id","register"],"sources":["../../src/models/customer.js"],"sourcesContent":["import \"../models/opportunity.js\";\nimport \"../collections/locations.js\";\nimport \"../collections/contacts.js\";\nimport \"../collections/locations.js\";\nimport \"../collections/opportunities.js\";\nimport \"../collections/teams.js\";\n\nimport { BaseModel } from \"./base.js\";\nimport { register } from \"../state-register.js\";\n\n/**\n * @constructor\n * @alias models.CustomerModel\n * @extends models.BaseModel\n */\nexport const CustomerModel = BaseModel.extend(\n\t/** @lends models.CustomerModel# */ {\n\t\tmodelName: \"customers\",\n\n\t\t/**\n\t\t * @property {date} created_date\n\t\t * @property {string} logo_128\n\t\t * @property {string} logo_256\n\t\t * @property {string} logo_512\n\t\t * @property {string} logo_original\n\t\t * @property {date} modified_date\n\t\t * @property {string} notes\n\t\t * @property {string} primary_colour\n\t\t * @property {object} profile\n\t\t * @property {boolean} soft_deleted\n\t\t * @property {string} title\n\t\t * @property {string} website\n\t\t */\n\t\tprops: {\n\t\t\tcreated_date: \"date\",\n\t\t\tlogo_128: \"string\",\n\t\t\tlogo_256: \"string\",\n\t\t\tlogo_512: \"string\",\n\t\t\tlogo_original: \"string\",\n\t\t\tmodified_date: \"date\",\n\t\t\tnotes: \"stringSanitized\",\n\t\t\tprimary_colour: \"string\",\n\t\t\tprofile: \"object\",\n\t\t\tsoft_deleted: \"boolean\",\n\t\t\ttitle: \"stringSanitized\",\n\t\t\twebsite: \"string\",\n\t\t},\n\n\t\t/**\n\t\t * @property {models.LocationModel} default_location\n\t\t * @property {models.OpportunityModel} default_opportunity\n\t\t */\n\t\tchildren: {\n\t\t\tdefault_location: \"LocationModel\",\n\t\t\tdefault_opportunity: \"OpportunityModel\",\n\t\t},\n\n\t\t/**\n\t\t * @property {collections.ContactCollection} contact_set\n\t\t * @property {collections.OpportunityCollection} opportunity_set\n\t\t * @property {collections.LocationCollection} location_set\n\t\t */\n\t\tcollections: {\n\t\t\tcontact_set: \"ContactCollection\",\n\t\t\topportunity_set: \"OpportunityCollection\",\n\t\t\tlocation_set: \"LocationCollection\",\n\t\t\tteam_set: \"TeamCollection\",\n\t\t},\n\n\t\t/**\n\t\t * @property {string} logo\n\t\t * @property {string} primaryColour\n\t\t */\n\t\tderived: {\n\t\t\tlogo: {\n\t\t\t\tdeps: [\"logo_512\", \"profile\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\t// HACK: Check for the REA usecase where it gets images from profile\n\t\t\t\t\tif (this.profile?.rea_image_large) {\n\t\t\t\t\t\treturn this.profile.rea_image_large;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this.logo_512;\n\t\t\t\t},\n\t\t\t},\n\t\t\tprimaryColour: {\n\t\t\t\tdeps: [\"primary_colour\", \"profile\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\t// HACK: Check for the REA usecase where it gets primary colour from profile\n\t\t\t\t\tif (this.profile && this.profile.primary_colour) {\n\t\t\t\t\t\treturn this.profile.primary_colour;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this.primary_colour;\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\tfetch() {\n\t\t\tconst baseFetch = BaseModel.prototype.fetch.apply(this, arguments);\n\n\t\t\treturn baseFetch.then(() => {\n\t\t\t\tlet topParent;\n\t\t\t\tlet curParent = this.parent;\n\n\t\t\t\twhile (typeof curParent !== \"undefined\") {\n\t\t\t\t\tcurParent = curParent.parent;\n\t\t\t\t\tif (curParent) {\n\t\t\t\t\t\ttopParent = curParent;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Filter contacts if this is fetched from an appointment\n\t\t\t\tif (topParent && topParent.name === \"appointments\") {\n\t\t\t\t\tconst contactUrls = this.contact_set.map((contact) =>\n\t\t\t\t\t\tthis._retrieveUrl(contact),\n\t\t\t\t\t);\n\n\t\t\t\t\tconst filteredContacts = topParent.contact_set.filter((contact) => {\n\t\t\t\t\t\treturn contactUrls.indexOf(this._retrieveUrl(contact)) > -1;\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.contact_set.set(filteredContacts);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\ttoServer() {\n\t\t\tconst data = {\n\t\t\t\tnotes: this.notes,\n\t\t\t\tprimary_colour: this.primary_colour,\n\t\t\t\ttitle: this.title,\n\t\t\t\twebsite: this.website,\n\t\t\t\tteam_set: this._retrieveURL(this.team_set),\n\t\t\t};\n\n\t\t\tif (this.id) {\n\t\t\t\tdata.id = this.id;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t},\n\t},\n);\n\nregister(\"CustomerModel\", CustomerModel);\n"],"mappings":";;;;;;AAAAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,eAAS,CAACC,MAAM,CAC5C,mCAAoC;EACnCC,SAAS,EAAE,WAAW;EAEtB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,KAAK,EAAE;IACNC,YAAY,EAAE,MAAM;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,QAAQ,EAAE,QAAQ;IAClBC,QAAQ,EAAE,QAAQ;IAClBC,aAAa,EAAE,QAAQ;IACvBC,aAAa,EAAE,MAAM;IACrBC,KAAK,EAAE,iBAAiB;IACxBC,cAAc,EAAE,QAAQ;IACxBC,OAAO,EAAE,QAAQ;IACjBC,YAAY,EAAE,SAAS;IACvBC,KAAK,EAAE,iBAAiB;IACxBC,OAAO,EAAE;EACV,CAAC;EAED;AACF;AACA;AACA;EACEC,QAAQ,EA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5B,IAAID,SAAS,EAAE;UACdD,SAAS,GAAGC,SAAS;QACtB;MACD;;MAEA;MACA,IAAID,SAAS,IAAIA,SAAS,CAACG,IAAI,KAAK,cAAc,EAAE;QACnD,IAAMC,WAAW,GAAGV,KAAI,CAACZ,WAAW,CAACuB,GAAG,CAAC,UAACC,OAAO;UAAA,OAChDZ,KAAI,CAACa,YAAY,CAACD,OAAO,CAAC;QAAA,CAC3B,CAAC;QAED,IAAME,gBAAgB,GAAGR,SAAS,CAAClB,WAAW,CAAC2B,MAAM,CAAC,UAACH,OAAO,EAAK;UAClE,OAAOF,WAAW,CAACM,OAAO,CAAChB,KAAI,CAACa,YAAY,CAACD,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC;QAEFZ,KAAI,CAACZ,WAAW,CAAC6B,GAAG,CAACH,gBAAgB,CAAC;MACvC;IACD,CAAC,CAAC;EACH,CAAC;EAEDI,QAAQ,WAARA,QAAQA,CAAA,EAAG;IACV,IAAMC,IAAI,GAAG;MACZzC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCG,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBQ,QAAQ,EAAE,IAAI,CAAC6B,YAAY,CAAC,IAAI,CAAC7B,QAAQ;IAC1C,CAAC;IAED,IAAI,IAAI,CAAC8B,EAAE,EAAE;MACZF,IAAI,CAACE,EAAE,GAAG,IAAI,CAACA,EAAE;IAClB;IAEA,OAAOF,IAAI;EACZ;AACD,CACD,CAAC;AAED,IAAAG,uBAAQ,EAAC,eAAe,EAAExD,aAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"customer.js","names":["require","_base","_stateRegister","CustomerModel","exports","BaseModel","extend","modelName","props","created_date","logo_128","logo_256","logo_512","logo_original","modified_date","notes","primary_colour","profile","soft_deleted","title","website","fixture_key","children","default_location","default_opportunity","collections","contact_set","opportunity_set","location_set","team_set","derived","logo","deps","fn","_this$profile","rea_image_large","primaryColour","fetch","_this","baseFetch","prototype","apply","arguments","then","topParent","curParent","parent","name","contactUrls","map","contact","_retrieveUrl","filteredContacts","filter","indexOf","set","toServer","data","_retrieveURL","id","register"],"sources":["../../src/models/customer.js"],"sourcesContent":["import \"../models/opportunity.js\";\nimport \"../collections/locations.js\";\nimport \"../collections/contacts.js\";\nimport \"../collections/locations.js\";\nimport \"../collections/opportunities.js\";\nimport \"../collections/teams.js\";\n\nimport { BaseModel } from \"./base.js\";\nimport { register } from \"../state-register.js\";\n\n/**\n * @constructor\n * @alias models.CustomerModel\n * @extends models.BaseModel\n */\nexport const CustomerModel = BaseModel.extend(\n\t/** @lends models.CustomerModel# */ {\n\t\tmodelName: \"customers\",\n\n\t\t/**\n\t\t * @property {date} created_date\n\t\t * @property {string} logo_128\n\t\t * @property {string} logo_256\n\t\t * @property {string} logo_512\n\t\t * @property {string} logo_original\n\t\t * @property {date} modified_date\n\t\t * @property {string} notes\n\t\t * @property {string} primary_colour\n\t\t * @property {object} profile\n\t\t * @property {boolean} soft_deleted\n\t\t * @property {string} title\n\t\t * @property {string} website\n\t\t */\n\t\tprops: {\n\t\t\tcreated_date: \"date\",\n\t\t\tlogo_128: \"string\",\n\t\t\tlogo_256: \"string\",\n\t\t\tlogo_512: \"string\",\n\t\t\tlogo_original: \"string\",\n\t\t\tmodified_date: \"date\",\n\t\t\tnotes: \"stringSanitized\",\n\t\t\tprimary_colour: \"string\",\n\t\t\tprofile: \"object\",\n\t\t\tsoft_deleted: \"boolean\",\n\t\t\ttitle: \"stringSanitized\",\n\t\t\twebsite: \"string\",\n\t\t\tfixture_key: \"string\",\n\t\t},\n\n\t\t/**\n\t\t * @property {models.LocationModel} default_location\n\t\t * @property {models.OpportunityModel} default_opportunity\n\t\t */\n\t\tchildren: {\n\t\t\tdefault_location: \"LocationModel\",\n\t\t\tdefault_opportunity: \"OpportunityModel\",\n\t\t},\n\n\t\t/**\n\t\t * @property {collections.ContactCollection} contact_set\n\t\t * @property {collections.OpportunityCollection} opportunity_set\n\t\t * @property {collections.LocationCollection} location_set\n\t\t */\n\t\tcollections: {\n\t\t\tcontact_set: \"ContactCollection\",\n\t\t\topportunity_set: \"OpportunityCollection\",\n\t\t\tlocation_set: \"LocationCollection\",\n\t\t\tteam_set: \"TeamCollection\",\n\t\t},\n\n\t\t/**\n\t\t * @property {string} logo\n\t\t * @property {string} primaryColour\n\t\t */\n\t\tderived: {\n\t\t\tlogo: {\n\t\t\t\tdeps: [\"logo_512\", \"profile\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\t// HACK: Check for the REA usecase where it gets images from profile\n\t\t\t\t\tif (this.profile?.rea_image_large) {\n\t\t\t\t\t\treturn this.profile.rea_image_large;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this.logo_512;\n\t\t\t\t},\n\t\t\t},\n\t\t\tprimaryColour: {\n\t\t\t\tdeps: [\"primary_colour\", \"profile\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\t// HACK: Check for the REA usecase where it gets primary colour from profile\n\t\t\t\t\tif (this.profile && this.profile.primary_colour) {\n\t\t\t\t\t\treturn this.profile.primary_colour;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this.primary_colour;\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\tfetch() {\n\t\t\tconst baseFetch = BaseModel.prototype.fetch.apply(this, arguments);\n\n\t\t\treturn baseFetch.then(() => {\n\t\t\t\tlet topParent;\n\t\t\t\tlet curParent = this.parent;\n\n\t\t\t\twhile (typeof curParent !== \"undefined\") {\n\t\t\t\t\tcurParent = curParent.parent;\n\t\t\t\t\tif (curParent) {\n\t\t\t\t\t\ttopParent = curParent;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Filter contacts if this is fetched from an appointment\n\t\t\t\tif (topParent && topParent.name === \"appointments\") {\n\t\t\t\t\tconst contactUrls = this.contact_set.map((contact) =>\n\t\t\t\t\t\tthis._retrieveUrl(contact),\n\t\t\t\t\t);\n\n\t\t\t\t\tconst filteredContacts = topParent.contact_set.filter((contact) => {\n\t\t\t\t\t\treturn contactUrls.indexOf(this._retrieveUrl(contact)) > -1;\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.contact_set.set(filteredContacts);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\ttoServer() {\n\t\t\tconst data = {\n\t\t\t\tnotes: this.notes,\n\t\t\t\tprimary_colour: this.primary_colour,\n\t\t\t\ttitle: this.title,\n\t\t\t\twebsite: this.website,\n\t\t\t\tteam_set: this._retrieveURL(this.team_set),\n\t\t\t};\n\n\t\t\tif (this.id) {\n\t\t\t\tdata.id = this.id;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t},\n\t},\n);\n\nregister(\"CustomerModel\", CustomerModel);\n"],"mappings":";;;;;;AAAAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,eAAS,CAACC,MAAM,CAC5C,mCAAoC;EACnCC,SAAS,EAAE,WAAW;EAEtB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,KAAK,EAAE;IACNC,YAAY,EAAE,MAAM;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,QAAQ,EAAE,QAAQ;IAClBC,QAAQ,EAAE,QAAQ;IAClBC,aAAa,EAAE,QAAQ;IACvBC,aAAa,EAAE,MAAM;IACrBC,KAAK,EAAE,iBAAiB;IACxBC,cAAc,EAAE,QAAQ;IACxBC,OAAO,EAAE,QAAQ;IACjBC,YAAY,EAAE,SAAS;IACvBC,KAAK,EAAE,iBAAiB;IACxBC,OAAO,EAAE,QAAQ;IACjBC,WAAW,EAAE;EACd,CAAC;EAED;AAC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GAAGA,SAAS,CAACC,MAAM;QAC5B,IAAID,SAAS,EAAE;UACdD,SAAS,GAAGC,SAAS;QACtB;MACD;;MAEA;MACA,IAAID,SAAS,IAAIA,SAAS,CAACG,IAAI,KAAK,cAAc,EAAE;QACnD,IAAMC,WAAW,GAAGV,KAAI,CAACZ,WAAW,CAACuB,GAAG,CAAC,UAACC,OAAO;UAAA,OAChDZ,KAAI,CAACa,YAAY,CAACD,OAAO,CAAC;QAAA,CAC3B,CAAC;QAED,IAAME,gBAAgB,GAAGR,SAAS,CAAClB,WAAW,CAAC2B,MAAM,CAAC,UAACH,OAAO,EAAK;UAClE,OAAOF,WAAW,CAACM,OAAO,CAAChB,KAAI,CAACa,YAAY,CAACD,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC;QAEFZ,KAAI,CAACZ,WAAW,CAAC6B,GAAG,CAACH,gBAAgB,CAAC;MACvC;IACD,CAAC,CAAC;EACH,CAAC;EAEDI,QAAQ,WAARA,QAAQA,CAAA,EAAG;IACV,IAAMC,IAAI,GAAG;MACZ1C,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCG,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBS,QAAQ,EAAE,IAAI,CAAC6B,YAAY,CAAC,IAAI,CAAC7B,QAAQ;IAC1C,CAAC;IAED,IAAI,IAAI,CAAC8B,EAAE,EAAE;MACZF,IAAI,CAACE,EAAE,GAAG,IAAI,CAACA,EAAE;IAClB;IAEA,OAAOF,IAAI;EACZ;AACD,CACD,CAAC;AAED,IAAAG,uBAAQ,EAAC,eAAe,EAAEzD,aAAa,CAAC","ignoreList":[]}
@@ -11,6 +11,7 @@ require("./pack.js");
11
11
  require("./deck.js");
12
12
  require("./asset.js");
13
13
  require("./manifest-json.js");
14
+ var _auth = require("../auth.js");
14
15
  var _base = require("./base.js");
15
16
  var _deckVersionScreenshots = require("../collections/deck-version-screenshots.js");
16
17
  var _bluebird = _interopRequireDefault(require("bluebird"));
@@ -196,6 +197,27 @@ var DeckVersionModel = exports.DeckVersionModel = _base.BaseModel.extend(/** @le
196
197
  // this port), causing havoc. If we see it, strip it.
197
198
  .replace(":443", "");
198
199
  },
200
+ fetchLayout: function fetchLayout(presetId, teamIds) {
201
+ var queryParams = {
202
+ version: this.version
203
+ };
204
+ if (presetId) {
205
+ queryParams.preset_id = presetId;
206
+ }
207
+ if (teamIds) {
208
+ queryParams.team_id = teamIds;
209
+ }
210
+ if (!this.id) {
211
+ return _bluebird.default.reject(new Error("DeckVersion has no ID."));
212
+ }
213
+ var path = "".concat(this.deck.url(), "layout/");
214
+ return _superagent.default.get(path).set(_auth.Auth.headers).query(queryParams).then(function (res) {
215
+ if (!res.ok) {
216
+ return _bluebird.default.reject(res);
217
+ }
218
+ return res.body;
219
+ });
220
+ },
199
221
  toServer: function toServer() {
200
222
  return {
201
223
  approval: this.approval,
@@ -1 +1 @@
1
- {"version":3,"file":"deck-version.js","names":["require","_base","_deckVersionScreenshots","_bluebird","_interopRequireDefault","_collections","_lodash","_stateRegister","_superagent","DeckVersionModel","exports","BaseModel","extend","modelName","props","image_128","image_256","image_512","image_128_archive","image_256_archive","image_512_archive","creation_status","creation_percent","update_description","version","approved","approval","pack_root_url","upgrade_description","friendly_release_notes","has_editable_share_support","has_signing_support","point_in_time_share_policy","tags","cmsvalkey_set","children","deck","index_asset","pack","manifest_json","collections","section_set","note_set","derived","screenshots","deps","fn","DeckVersionScreenshotCollection","deckversion","template_set","templates","TemplateCollection","data","id","scope","getHooksPath","_this","_ref","arguments","length","undefined","_ref$rootAssetPath","rootAssetPath","isNew","Error","Promise","resolve","concat","hooks","then","Object","keys","getSafeAttrs","fetch","rootAssetUrl","getRootAssetUrl","getHooks","_ref2","_ref2$rootAssetPath","hooksPath","SystemJS","import","default","getFixtures","fixtures","fixturePaths","imports","_","map","fixture","key","path","superagent","get","response","text","JSON","parse","body","catch","SuperagentPromiseError","e","all","_this2","prototype","apply","tap","indexAsset","_retrieveURL","split","slice","join","replace","toServer","register"],"sources":["../../src/models/deck-version.js"],"sourcesContent":["import \"../collections/sections.js\";\nimport \"../collections/deck-notes.js\";\nimport \"./pack.js\";\nimport \"./deck.js\";\nimport \"./asset.js\";\nimport \"./manifest-json.js\";\n\nimport { BaseModel } from \"./base.js\";\nimport { DeckVersionScreenshotCollection } from \"../collections/deck-version-screenshots.js\";\nimport Promise from \"bluebird\";\nimport { TemplateCollection } from \"../collections.js\";\nimport _ from \"lodash\";\nimport { register } from \"../state-register.js\";\nimport superagent from \"superagent\";\n\n/**\n * @constructor\n * @alias models.DeckVersionModel\n * @extends models.BaseModel\n */\nexport const DeckVersionModel = BaseModel.extend(\n\t/** @lends models.DeckVersionModel# */ {\n\t\tmodelName: \"deckversions\",\n\n\t\t/**\n\t\t * @property {string} image_128\n\t\t * @property {string} image_256\n\t\t * @property {string} image_512\n\t\t * @property {string} image_128_archive\n\t\t * @property {string} image_256_archive\n\t\t * @property {string} image_512_archive\n\t\t * @property {string} creation_status\n\t\t * @property {string} update_description\n\t\t * @property {version} version\n\t\t * @property {boolean} approved\n\t\t * @property {string} approval\n\t\t * @property {string} pack_root_url\n\t\t * @property {string} upgrade_description\n\t\t * @property {string} friendly_release_notes\n\t\t * @property {boolean} has_editable_share_support\n\t\t * @property {string} point_in_time_share_policy\n\t\t * @property {string[]} tags\n\t\t * @property {string[]} cmsvalkey_set\n\t\t */\n\t\tprops: {\n\t\t\timage_128: \"string\",\n\t\t\timage_256: \"string\",\n\t\t\timage_512: \"string\",\n\t\t\timage_128_archive: \"string\",\n\t\t\timage_256_archive: \"string\",\n\t\t\timage_512_archive: \"string\",\n\t\t\tcreation_status: \"string\",\n\t\t\tcreation_percent: \"number\",\n\t\t\tupdate_description: \"string\",\n\t\t\tversion: \"number\",\n\t\t\tapproved: \"boolean\",\n\t\t\tapproval: \"string\",\n\t\t\tpack_root_url: \"string\",\n\t\t\tupgrade_description: \"string\",\n\t\t\tfriendly_release_notes: \"string\",\n\t\t\thas_editable_share_support: \"boolean\",\n\t\t\thas_signing_support: \"boolean\",\n\t\t\tpoint_in_time_share_policy: \"string\",\n\t\t\ttags: \"array\",\n\t\t\tcmsvalkey_set: \"array\",\n\t\t},\n\n\t\t/**\n\t\t * @property {models.DeckModel} deck\n\t\t * @property {models.AssetModel} index_asset\n\t\t * @property {models.PackModel} pack\n\t\t * @property {models.ManifestJSONModel} manifest_json\n\t\t */\n\t\tchildren: {\n\t\t\tdeck: \"DeckModel\",\n\t\t\tindex_asset: \"AssetModel\",\n\t\t\tpack: \"PackModel\",\n\t\t\tmanifest_json: \"ManifestJSONModel\",\n\t\t},\n\n\t\t/**\n\t\t * @property {collections.SectionCollection} section_set\n\t\t * @property {models.DeckNoteCollection} note_set\n\t\t */\n\t\tcollections: {\n\t\t\tsection_set: \"SectionCollection\",\n\t\t\tnote_set: \"DeckNoteCollection\",\n\t\t},\n\n\t\t/**\n\t\t * @property {collections.DeckVersionScreenshotCollection} screenshots\n\t\t */\n\t\tderived: {\n\t\t\tscreenshots: {\n\t\t\t\tdeps: [\"id\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\tconst screenshots = new DeckVersionScreenshotCollection(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdeckversion: this,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\treturn screenshots;\n\t\t\t\t},\n\t\t\t},\n\n\t\t\ttemplate_set: {\n\t\t\t\tdeps: [\"id\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\tconst templates = new TemplateCollection(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdeckversion: this.id,\n\t\t\t\t\t\t\t\tscope: \"global\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\treturn templates;\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\tgetHooksPath({ rootAssetPath = null } = {}) {\n\t\t\tif (this.isNew()) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Can only get hooks from a fetched deckversion or at least have an ID\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (rootAssetPath) {\n\t\t\t\treturn Promise.resolve(`${rootAssetPath}${this.manifest_json.hooks}`);\n\t\t\t}\n\n\t\t\treturn Promise.resolve()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tObject.keys(this.getSafeAttrs()).length === 1 ||\n\t\t\t\t\t\t!this.index_asset\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn this.fetch();\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (this.manifest_json.isNew()) {\n\t\t\t\t\t\treturn this.manifest_json.fetch();\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tconst rootAssetUrl = this.getRootAssetUrl();\n\t\t\t\t\tif (!this.manifest_json.hooks) {\n\t\t\t\t\t\tthrow new Error(\"Manifest does not contain a hooks entry\");\n\t\t\t\t\t}\n\t\t\t\t\treturn `${rootAssetUrl}${this.manifest_json.hooks}`;\n\t\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * @todo This should eventually return a hooks interface\n\t\t * @returns {object}\n\t\t */\n\t\tgetHooks({ rootAssetPath = null } = {}) {\n\t\t\treturn this.getHooksPath({ rootAssetPath })\n\t\t\t\t.then((hooksPath) => {\n\t\t\t\t\treturn SystemJS.import(hooksPath);\n\t\t\t\t})\n\t\t\t\t.then((hooks) => {\n\t\t\t\t\tif (hooks.default) {\n\t\t\t\t\t\treturn hooks.default;\n\t\t\t\t\t}\n\t\t\t\t\treturn hooks;\n\t\t\t\t});\n\t\t},\n\n\t\tgetFixtures(fixtures = {}, rootAssetUrl = this.getRootAssetUrl()) {\n\t\t\tconst fixturePaths = this.manifest_json.fixtures || {};\n\n\t\t\tconst imports = _.map(fixturePaths, (fixture, key) => {\n\t\t\t\tconst path = `${rootAssetUrl}${fixture}`;\n\n\t\t\t\treturn superagent\n\t\t\t\t\t.get(path)\n\t\t\t\t\t.then((response) => {\n\t\t\t\t\t\tif (response.text) {\n\t\t\t\t\t\t\tfixtures[key] = JSON.parse(response.text);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfixtures[key] = response.body || {};\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(superagent.SuperagentPromiseError, (e) => {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn Promise.all(imports);\n\t\t},\n\n\t\tfetch() {\n\t\t\tconst fetch = BaseModel.prototype.fetch.apply(this, arguments);\n\n\t\t\treturn Promise.resolve(fetch).tap(() => {\n\t\t\t\t// `template_set` used to come on the deckversion response, but we have since\n\t\t\t\t// decided to request it separately (this helps with caching). To keep the app\n\t\t\t\t// working with minimal changes, we're making the extra request here.\n\t\t\t\treturn this.template_set.fetch();\n\t\t\t});\n\t\t},\n\n\t\tgetRootAssetUrl() {\n\t\t\tconst indexAsset = this._retrieveURL(this.index_asset);\n\t\t\treturn (\n\t\t\t\t`${indexAsset.split(\"/\").slice(0, -1).join(\"/\")}/`\n\t\t\t\t\t// HACK: We've got instances (see: myob) that are returning ports in their urls.\n\t\t\t\t\t// SystemJS gets confused and starts caching multiple versions (one with and without\n\t\t\t\t\t// this port), causing havoc. If we see it, strip it.\n\t\t\t\t\t.replace(\":443\", \"\")\n\t\t\t);\n\t\t},\n\n\t\ttoServer() {\n\t\t\treturn {\n\t\t\t\tapproval: this.approval,\n\t\t\t\tupgrade_description: this.upgrade_description,\n\t\t\t};\n\t\t},\n\t},\n);\n\nregister(\"DeckVersionModel\", DeckVersionModel);\n"],"mappings":";;;;;;;AAAAA,OAAA;AACAA,OAAA;A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,KAAKA,CAAA,EAAG;IAAA,IAAA8B,MAAA;IACP,IAAM9B,KAAK,GAAG9D,eAAS,CAAC6F,SAAS,CAAC/B,KAAK,CAACgC,KAAK,CAAC,IAAI,EAAE/C,SAAS,CAAC;IAE9D,OAAOO,iBAAO,CAACC,OAAO,CAACO,KAAK,CAAC,CAACiC,GAAG,CAAC,YAAM;MACvC;MACA;MACA;MACA,OAAOH,MAAI,CAACtD,YAAY,CAACwB,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC;EACH,CAAC;EAEDE,eAAe,WAAfA,eAAeA,CAAA,EAAG;IACjB,IAAMgC,UAAU,GAAG,IAAI,CAACC,YAAY,CAAC,IAAI,CAACvE,WAAW,CAAC;IACtD,OACC,GAAA8B,MAAA,CAAGwC,UAAU,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,OAC9C;IACA;IACA;IAAA,CACCC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;EAEvB,CAAC;EAEDC,QAAQ,WAARA,QAAQA,CAAA,EAAG;IACV,OAAO;MACNvF,QAAQ,EAAE,IAAI,CAACA,QAAQ;MACvBE,mBAAmB,EAAE,IAAI,CAACA;IAC3B,CAAC;EACF;AACD,CACD,CAAC;AAED,IAAAsF,uBAAQ,EAAC,kBAAkB,EAAEzG,gBAAgB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"deck-version.js","names":["require","_auth","_base","_deckVersionScreenshots","_bluebird","_interopRequireDefault","_collections","_lodash","_stateRegister","_superagent","DeckVersionModel","exports","BaseModel","extend","modelName","props","image_128","image_256","image_512","image_128_archive","image_256_archive","image_512_archive","creation_status","creation_percent","update_description","version","approved","approval","pack_root_url","upgrade_description","friendly_release_notes","has_editable_share_support","has_signing_support","point_in_time_share_policy","tags","cmsvalkey_set","children","deck","index_asset","pack","manifest_json","collections","section_set","note_set","derived","screenshots","deps","fn","DeckVersionScreenshotCollection","deckversion","template_set","templates","TemplateCollection","data","id","scope","getHooksPath","_this","_ref","arguments","length","undefined","_ref$rootAssetPath","rootAssetPath","isNew","Error","Promise","resolve","concat","hooks","then","Object","keys","getSafeAttrs","fetch","rootAssetUrl","getRootAssetUrl","getHooks","_ref2","_ref2$rootAssetPath","hooksPath","SystemJS","import","default","getFixtures","fixtures","fixturePaths","imports","_","map","fixture","key","path","superagent","get","response","text","JSON","parse","body","catch","SuperagentPromiseError","e","all","_this2","prototype","apply","tap","indexAsset","_retrieveURL","split","slice","join","replace","fetchLayout","presetId","teamIds","queryParams","preset_id","team_id","reject","url","set","Auth","headers","query","res","ok","toServer","register"],"sources":["../../src/models/deck-version.js"],"sourcesContent":["import \"../collections/sections.js\";\nimport \"../collections/deck-notes.js\";\nimport \"./pack.js\";\nimport \"./deck.js\";\nimport \"./asset.js\";\nimport \"./manifest-json.js\";\n\nimport { Auth } from \"../auth.js\";\nimport { BaseModel } from \"./base.js\";\nimport { DeckVersionScreenshotCollection } from \"../collections/deck-version-screenshots.js\";\nimport Promise from \"bluebird\";\nimport { TemplateCollection } from \"../collections.js\";\nimport _ from \"lodash\";\nimport { register } from \"../state-register.js\";\nimport superagent from \"superagent\";\n\n/**\n * @constructor\n * @alias models.DeckVersionModel\n * @extends models.BaseModel\n */\nexport const DeckVersionModel = BaseModel.extend(\n\t/** @lends models.DeckVersionModel# */ {\n\t\tmodelName: \"deckversions\",\n\n\t\t/**\n\t\t * @property {string} image_128\n\t\t * @property {string} image_256\n\t\t * @property {string} image_512\n\t\t * @property {string} image_128_archive\n\t\t * @property {string} image_256_archive\n\t\t * @property {string} image_512_archive\n\t\t * @property {string} creation_status\n\t\t * @property {string} update_description\n\t\t * @property {version} version\n\t\t * @property {boolean} approved\n\t\t * @property {string} approval\n\t\t * @property {string} pack_root_url\n\t\t * @property {string} upgrade_description\n\t\t * @property {string} friendly_release_notes\n\t\t * @property {boolean} has_editable_share_support\n\t\t * @property {string} point_in_time_share_policy\n\t\t * @property {string[]} tags\n\t\t * @property {string[]} cmsvalkey_set\n\t\t */\n\t\tprops: {\n\t\t\timage_128: \"string\",\n\t\t\timage_256: \"string\",\n\t\t\timage_512: \"string\",\n\t\t\timage_128_archive: \"string\",\n\t\t\timage_256_archive: \"string\",\n\t\t\timage_512_archive: \"string\",\n\t\t\tcreation_status: \"string\",\n\t\t\tcreation_percent: \"number\",\n\t\t\tupdate_description: \"string\",\n\t\t\tversion: \"number\",\n\t\t\tapproved: \"boolean\",\n\t\t\tapproval: \"string\",\n\t\t\tpack_root_url: \"string\",\n\t\t\tupgrade_description: \"string\",\n\t\t\tfriendly_release_notes: \"string\",\n\t\t\thas_editable_share_support: \"boolean\",\n\t\t\thas_signing_support: \"boolean\",\n\t\t\tpoint_in_time_share_policy: \"string\",\n\t\t\ttags: \"array\",\n\t\t\tcmsvalkey_set: \"array\",\n\t\t},\n\n\t\t/**\n\t\t * @property {models.DeckModel} deck\n\t\t * @property {models.AssetModel} index_asset\n\t\t * @property {models.PackModel} pack\n\t\t * @property {models.ManifestJSONModel} manifest_json\n\t\t */\n\t\tchildren: {\n\t\t\tdeck: \"DeckModel\",\n\t\t\tindex_asset: \"AssetModel\",\n\t\t\tpack: \"PackModel\",\n\t\t\tmanifest_json: \"ManifestJSONModel\",\n\t\t},\n\n\t\t/**\n\t\t * @property {collections.SectionCollection} section_set\n\t\t * @property {models.DeckNoteCollection} note_set\n\t\t */\n\t\tcollections: {\n\t\t\tsection_set: \"SectionCollection\",\n\t\t\tnote_set: \"DeckNoteCollection\",\n\t\t},\n\n\t\t/**\n\t\t * @property {collections.DeckVersionScreenshotCollection} screenshots\n\t\t */\n\t\tderived: {\n\t\t\tscreenshots: {\n\t\t\t\tdeps: [\"id\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\tconst screenshots = new DeckVersionScreenshotCollection(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdeckversion: this,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\treturn screenshots;\n\t\t\t\t},\n\t\t\t},\n\n\t\t\ttemplate_set: {\n\t\t\t\tdeps: [\"id\"],\n\t\t\t\tfn: function () {\n\t\t\t\t\tconst templates = new TemplateCollection(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tdeckversion: this.id,\n\t\t\t\t\t\t\t\tscope: \"global\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\treturn templates;\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\tgetHooksPath({ rootAssetPath = null } = {}) {\n\t\t\tif (this.isNew()) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Can only get hooks from a fetched deckversion or at least have an ID\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (rootAssetPath) {\n\t\t\t\treturn Promise.resolve(`${rootAssetPath}${this.manifest_json.hooks}`);\n\t\t\t}\n\n\t\t\treturn Promise.resolve()\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tObject.keys(this.getSafeAttrs()).length === 1 ||\n\t\t\t\t\t\t!this.index_asset\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn this.fetch();\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (this.manifest_json.isNew()) {\n\t\t\t\t\t\treturn this.manifest_json.fetch();\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tconst rootAssetUrl = this.getRootAssetUrl();\n\t\t\t\t\tif (!this.manifest_json.hooks) {\n\t\t\t\t\t\tthrow new Error(\"Manifest does not contain a hooks entry\");\n\t\t\t\t\t}\n\t\t\t\t\treturn `${rootAssetUrl}${this.manifest_json.hooks}`;\n\t\t\t\t});\n\t\t},\n\n\t\t/**\n\t\t * @todo This should eventually return a hooks interface\n\t\t * @returns {object}\n\t\t */\n\t\tgetHooks({ rootAssetPath = null } = {}) {\n\t\t\treturn this.getHooksPath({ rootAssetPath })\n\t\t\t\t.then((hooksPath) => {\n\t\t\t\t\treturn SystemJS.import(hooksPath);\n\t\t\t\t})\n\t\t\t\t.then((hooks) => {\n\t\t\t\t\tif (hooks.default) {\n\t\t\t\t\t\treturn hooks.default;\n\t\t\t\t\t}\n\t\t\t\t\treturn hooks;\n\t\t\t\t});\n\t\t},\n\n\t\tgetFixtures(fixtures = {}, rootAssetUrl = this.getRootAssetUrl()) {\n\t\t\tconst fixturePaths = this.manifest_json.fixtures || {};\n\n\t\t\tconst imports = _.map(fixturePaths, (fixture, key) => {\n\t\t\t\tconst path = `${rootAssetUrl}${fixture}`;\n\n\t\t\t\treturn superagent\n\t\t\t\t\t.get(path)\n\t\t\t\t\t.then((response) => {\n\t\t\t\t\t\tif (response.text) {\n\t\t\t\t\t\t\tfixtures[key] = JSON.parse(response.text);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfixtures[key] = response.body || {};\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(superagent.SuperagentPromiseError, (e) => {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn Promise.all(imports);\n\t\t},\n\n\t\tfetch() {\n\t\t\tconst fetch = BaseModel.prototype.fetch.apply(this, arguments);\n\n\t\t\treturn Promise.resolve(fetch).tap(() => {\n\t\t\t\t// `template_set` used to come on the deckversion response, but we have since\n\t\t\t\t// decided to request it separately (this helps with caching). To keep the app\n\t\t\t\t// working with minimal changes, we're making the extra request here.\n\t\t\t\treturn this.template_set.fetch();\n\t\t\t});\n\t\t},\n\n\t\tgetRootAssetUrl() {\n\t\t\tconst indexAsset = this._retrieveURL(this.index_asset);\n\t\t\treturn (\n\t\t\t\t`${indexAsset.split(\"/\").slice(0, -1).join(\"/\")}/`\n\t\t\t\t\t// HACK: We've got instances (see: myob) that are returning ports in their urls.\n\t\t\t\t\t// SystemJS gets confused and starts caching multiple versions (one with and without\n\t\t\t\t\t// this port), causing havoc. If we see it, strip it.\n\t\t\t\t\t.replace(\":443\", \"\")\n\t\t\t);\n\t\t},\n\n\t\tfetchLayout: function (presetId, teamIds) {\n\t\t\tlet queryParams = { version: this.version };\n\t\t\tif (presetId) {\n\t\t\t\tqueryParams.preset_id = presetId;\n\t\t\t}\n\t\t\tif (teamIds) {\n\t\t\t\tqueryParams.team_id = teamIds;\n\t\t\t}\n\n\t\t\tif (!this.id) {\n\t\t\t\treturn Promise.reject(new Error(\"DeckVersion has no ID.\"));\n\t\t\t}\n\n\t\t\tconst path = `${this.deck.url()}layout/`;\n\n\t\t\treturn superagent\n\t\t\t\t.get(path)\n\t\t\t\t.set(Auth.headers)\n\t\t\t\t.query(queryParams)\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\treturn Promise.reject(res);\n\t\t\t\t\t}\n\t\t\t\t\treturn res.body;\n\t\t\t\t});\n\t\t},\n\n\t\ttoServer() {\n\t\t\treturn {\n\t\t\t\tapproval: this.approval,\n\t\t\t\tupgrade_description: this.upgrade_description,\n\t\t\t};\n\t\t},\n\t},\n);\n\nregister(\"DeckVersionModel\", DeckVersionModel);\n"],"mappings":";;;;;;;AAAAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAJ,sBAAA,CAAAL,OAAA;AAEA;AACA;AACA;AACA;A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E,IAAI,CAACA,QAAQ;MACvBE,mBAAmB,EAAE,IAAI,CAACA;IAC3B,CAAC;EACF;AACD,CACD,CAAC;AAED,IAAAoG,uBAAQ,EAAC,kBAAkB,EAAEvH,gBAAgB,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@livepreso/api",
3
3
  "license": "UNLICENSED",
4
- "version": "6.50.1",
4
+ "version": "6.51.0",
5
5
  "description": "Everything to do with talking to the SalePreso API",
6
6
  "main": "index.js",
7
7
  "module": "esm/index.js",
@@ -56,8 +56,8 @@
56
56
  "jest-fixed-default-reporter": "~2.0.1",
57
57
  "rosie": "~2.1.0",
58
58
  "@faker-js/faker": "~7.5.0",
59
- "@livepreso/eslint-config": "1.0.0",
60
- "sp-test": "0.2.0"
59
+ "sp-test": "0.2.0",
60
+ "@livepreso/eslint-config": "1.0.0"
61
61
  },
62
62
  "scripts": {
63
63
  "test:debug": "node --inspect node_modules/.bin/jest --watch --runInBand",
@@ -44,6 +44,7 @@ export const CustomerModel = BaseModel.extend(
44
44
  soft_deleted: "boolean",
45
45
  title: "stringSanitized",
46
46
  website: "string",
47
+ fixture_key: "string",
47
48
  },
48
49
 
49
50
  /**
@@ -5,6 +5,7 @@ import "./deck.js";
5
5
  import "./asset.js";
6
6
  import "./manifest-json.js";
7
7
 
8
+ import { Auth } from "../auth.js";
8
9
  import { BaseModel } from "./base.js";
9
10
  import { DeckVersionScreenshotCollection } from "../collections/deck-version-screenshots.js";
10
11
  import Promise from "bluebird";
@@ -219,6 +220,33 @@ export const DeckVersionModel = BaseModel.extend(
219
220
  );
220
221
  },
221
222
 
223
+ fetchLayout: function (presetId, teamIds) {
224
+ let queryParams = { version: this.version };
225
+ if (presetId) {
226
+ queryParams.preset_id = presetId;
227
+ }
228
+ if (teamIds) {
229
+ queryParams.team_id = teamIds;
230
+ }
231
+
232
+ if (!this.id) {
233
+ return Promise.reject(new Error("DeckVersion has no ID."));
234
+ }
235
+
236
+ const path = `${this.deck.url()}layout/`;
237
+
238
+ return superagent
239
+ .get(path)
240
+ .set(Auth.headers)
241
+ .query(queryParams)
242
+ .then((res) => {
243
+ if (!res.ok) {
244
+ return Promise.reject(res);
245
+ }
246
+ return res.body;
247
+ });
248
+ },
249
+
222
250
  toServer() {
223
251
  return {
224
252
  approval: this.approval,