prismic-javascript
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,7 +5,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
else if(typeof define === 'function' && define.amd) | ||
define("prismic-javascript", ["fetch-everywhere"], factory); | ||
define("PrismicJS", ["fetch-everywhere"], factory); | ||
else if(typeof exports === 'object') | ||
exports["prismic-javascript"] = factory(require("fetch-everywhere")); | ||
exports["PrismicJS"] = factory(require("fetch-everywhere")); | ||
else | ||
root["prismic-javascript"] = factory(root["fetch-everywhere"]); | ||
root["PrismicJS"] = factory(root["fetch-everywhere"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) { | ||
@@ -12,0 +12,0 @@ return /******/ (function(modules) { // webpackBootstrap |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("fetch-everywhere")):"function"==typeof define&&define.amd?define("prismic-javascript",["fetch-everywhere"],e):"object"==typeof exports?exports["prismic-javascript"]=e(require("fetch-everywhere")):t["prismic-javascript"]=e(t["fetch-everywhere"])}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=10)}([function(t,e,r){"use strict";e.__esModule=!0;var n=function(){function t(t){this.data={},this.data=t}return t.prototype.id=function(){return this.data.id},t.prototype.ref=function(){return this.data.ref},t.prototype.label=function(){return this.data.label},t}();e.Variation=n;var i=function(){function t(t){this.data={},this.data=t,this.variations=(t.variations||[]).map(function(t){new n(t)})}return t.prototype.id=function(){return this.data.id},t.prototype.googleId=function(){return this.data.ref},t.prototype.name=function(){return this.data.label},t}();e.Experiment=i;var o=function(){function t(t){t&&(this.drafts=(t.drafts||[]).map(function(t){new i(t)}),this.running=(t.running||[]).map(function(t){new i(t)}))}return t.prototype.current=function(){return this.running.length>0?this.running[0]:null},t.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split(" ");if(e.length<2)return null;var r=e[0],n=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()==r&&t.variations.length>n})[0];return i?i.variations[n].ref():null},t}();e.Experiments=o},function(t,e,r){"use strict";e.__esModule=!0;var n;!function(t){t[t.at=0]="at",t[t.not=1]="not",t[t.missing=2]="missing",t[t.has=3]="has",t[t.any=4]="any",t[t.in=5]="in",t[t.fulltext=6]="fulltext",t[t.similar=7]="similar",t[t["number.gt"]=8]="number.gt",t[t["number.lt"]=9]="number.lt",t[t["number.inRange"]=10]="number.inRange",t[t["date.before"]=11]="date.before",t[t["date.after"]=12]="date.after",t[t["date.between"]=13]="date.between",t[t["date.day-of-month"]=14]="date.day-of-month",t[t["date.day-of-month-after"]=15]="date.day-of-month-after",t[t["date.day-of-month-before"]=16]="date.day-of-month-before",t[t["date.day-of-week"]=17]="date.day-of-week",t[t["date.day-of-week-after"]=18]="date.day-of-week-after",t[t["date.day-of-week-before"]=19]="date.day-of-week-before",t[t["date.month"]=20]="date.month",t[t["date.month-before"]=21]="date.month-before",t[t["date.month-after"]=22]="date.month-after",t[t["date.year"]=23]="date.year",t[t["date.hour"]=24]="date.hour",t[t["date.hour-before"]=25]="date.hour-before",t[t["date.hour-after"]=26]="date.hour-after",t[t["geopoint.near"]=27]="geopoint.near"}(n=e.Operator||(e.Operator={}));var i=function(){function t(t,e){this.op=n.at,this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+', "'+this.value+'")]'},t}();e.AtPredicate=i;var o=function(){function t(t,e){this.op=n.not,this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+', "'+this.value+'")]'},t}();e.NotPredicate=o;var s=function(){function t(t){this.op=n.missing,this.fragment=t}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+")]"},t}();e.MissingPredicate=s;var a=function(){function t(t){this.op=n.has,this.fragment=t}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+")]"},t}();e.HasPredicate=a;var u=function(){function t(t,e){this.op=n.any,this.fragment=t,this.values=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", ["+this.values.join(",")+"])]"},t}();e.AnyPredicate=u;var f=function(){function t(t,e){this.op=n.in,this.fragment=t,this.values=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", ["+this.values.join(",")+"])]"},t}();e.InPredicate=f;var h=function(){function t(t,e){this.op=n.fulltext,this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+', "'+this.value+'")]'},t}();e.FulltextPredicate=h;var c=function(){function t(t,e){this.op=n.similar,this.documentId=t,this.maxResults=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+'("'+this.documentId+'", '+this.maxResults+")]"},t}();e.SimilarPredicate=c;var p=function(){function t(t,e){this.op=n["number.gt"],this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.value+")]"},t}();e.GtPredicate=p;var d=function(){function t(t,e){this.op=n["number.lt"],this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.value+")]"},t}();e.LtPredicate=d;var l=function(){function t(t,e,r){this.op=n["number.inRange"],this.fragment=t,this.before=e,this.after=r}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.before+", "+this.after+")]"},t}();e.InRangePredicate=l;var m=function(){function t(t,e){this.op=n["date.before"],this.fragment=t,this.before=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.before.getTime()+")]"},t}();e.DateBeforePredicate=m;var y=function(){function t(t,e){this.op=n["date.after"],this.fragment=t,this.after=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.after.getTime()+")]"},t}();e.DateAfterPredicate=y;var g=function(){function t(t,e,r){this.op=n["date.between"],this.fragment=t,this.before=e,this.after=r}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.before.getTime()+", "+this.after.getTime()+")]"},t}();e.DateBetweenPredicate=g;var v=function(){function t(t,e){this.op=n["date.day-of-month"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfMonthPredicate=v;var k=function(){function t(t,e){this.op=n["date.day-of-month-after"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfMonthAfterPredicate=k;var w=function(){function t(t,e){this.op=n["date.day-of-month-before"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfMonthBeforePredicate=w;var b=function(){function t(t,e){this.op=n["date.day-of-week"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfWeekPredicate=b;var _=function(){function t(t,e){this.op=n["date.day-of-week-after"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfWeekAfterPredicate=_;var x=function(){function t(t,e){this.op=n["date.day-of-week-before"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfWeekBeforePredicate=x;var P=function(){function t(t,e){this.op=n["date.month"],this.fragment=t,this.month=e}return t.prototype.toString=function(){return"number"==typeof this.month?"[:d = "+n[this.op]+"("+this.fragment+", "+this.month+")]":"[:d = "+n[this.op]+"("+this.fragment+', "'+this.month+'")]'},t}();e.MonthPredicate=P;var S=function(){function t(t,e){this.op=n["date.month-before"],this.fragment=t,this.month=e}return t.prototype.toString=function(){return"number"==typeof this.month?"[:d = "+n[this.op]+"("+this.fragment+", "+this.month+")]":"[:d = "+n[this.op]+"("+this.fragment+', "'+this.month+'")]'},t}();e.MonthBeforePredicate=S;var q=function(){function t(t,e){this.op=n["date.month-after"],this.fragment=t,this.month=e}return t.prototype.toString=function(){return"number"==typeof this.month?"[:d = "+n[this.op]+"("+this.fragment+", "+this.month+")]":"[:d = "+n[this.op]+"("+this.fragment+', "'+this.month+'")]'},t}();e.MonthAfterPredicate=q;var D=function(){function t(t,e){this.op=n["date.year"],this.fragment=t,this.year=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.year+")]"},t}();e.YearPredicate=D;var M=function(){function t(t,e){this.op=n["date.hour"],this.fragment=t,this.hour=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.hour+")]"},t}();e.HourPredicate=M;var A=function(){function t(t,e){this.op=n["date.hour-before"],this.fragment=t,this.hour=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.hour+")]"},t}();e.HourBeforePredicate=A;var C=function(){function t(t,e){this.op=n["date.hour-after"],this.fragment=t,this.hour=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.hour+")]"},t}();e.HourAfterPredicate=C;var O=function(){function t(t,e,r,i){this.op=n["geopoint.near"],this.fragment=t,this.latitude=e,this.longitude=r,this.radius=i}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.latitude+", "+this.longitude+", "+this.radius+")]"},t}();e.NearPredicate=O,e.Predicates={at:i,not:o,missing:s,has:a,any:u,in:f,fulltext:h,similar:c,gt:p,lt:d,inRange:l,before:m,after:y,between:g,dayOfMonth:v,dayOfMonthAfter:k,dayOfMonthBefore:w,dayOfWeek:b,dayOfWeekAfter:_,dayOfWeekBefore:x,month:P,monthBefore:S,monthAfter:q,year:D,hour:M,hourBefore:A,hourAfter:C,near:O}},function(t,e,r){"use strict";function n(t,e){var r=new o.Api(t,e);return new Promise(function(t,n){var i=function(r,i){e.complete&&e.complete(r,i),r?n(r):t(i)};return r.get(function(t,e){!t&&e&&(r.data=e,r.bookmarks=e.bookmarks,r.experiments=new a.Experiments(e.experiments)),i(t,r)}),r})}e.__esModule=!0;var i=r(7),o=r(4),s=r(1),a=r(0);e.default={experimentCookie:o.ExperimentCookie,previewCookie:o.PreviewCookie,Document:i.Document,SearchForm:o.SearchForm,Form:o.Form,Experiments:a.Experiments,Predicates:s,api:n}},function(e,r){e.exports=t},function(t,e,r){"use strict";e.__esModule=!0;var n=r(1),i=r(0),o=r(9),s=r(5),a=r(6);e.PreviewCookie="io.prismic.preview",e.ExperimentCookie="io.prismic.experiment";var u=function(){function t(t,e,r,n,i){this.ref=t,this.label=e,this.isMaster=r,this.scheduledAt=n,this.id=i}return t}();e.Ref=u;var f=function(){function t(t,e,r,n,i,o){this.fields=t,this.action=e,this.name=r,this.rel=n,this.form_method=i,this.enctype=o}return t.prototype.getField=function(t){return this.fields[t]},t.prototype.getFieldSafe=function(t){var e=this.fields[t];if(!e)throw new Error("Missing field "+e+" in form fields "+this.fields);return e},t}();e.Form=f;var h=function(){function t(t,e,r){this.api=t,this.form=e,this.data=r||{};for(var n in e.fields)e.getFieldSafe(n).default&&(this.data[n]=[e.fields[n].default])}return t.prototype.set=function(t,e){var r=this.form.getField(t);if(!r)throw new Error("Unknown field "+t);var n=""===e||void 0===e?null:e,i=this.data[t]||[];return i=r.multiple?n?i.concat([n]):i:n?[n]:i,this.data[t]=i,this},t.prototype.ref=function(t){return this.set("ref",t)},t.prototype.query=function(t){if("string"==typeof t)return this.set("q",t);if(t instanceof Array){var e=t.map(function(t){return t.toString()});return this.query("["+e.join("")+"]")}return this.query([t])},t.prototype.pageSize=function(t){return this.set("pageSize",t)},t.prototype.fetch=function(t){var e=t instanceof Array?t.join(","):t;return this.set("fetch",e)},t.prototype.fetchLinks=function(t){var e=t instanceof Array?t.join(","):t;return this.set("fetchLinks",e)},t.prototype.lang=function(t){return this.set("lang",t)},t.prototype.page=function(t){return this.set("page",t)},t.prototype.orderings=function(t){return t?this.set("orderings","["+t.join(",")+"]"):this},t.prototype.submit=function(t){var e=this.form.action;if(this.data){var r=e.indexOf("?")>-1?"&":"?";for(var n in this.data)if(this.data.hasOwnProperty(n)){var i=this.data[n];if(i)for(var o=0;o<i.length;o++)e+=r+n+"="+encodeURIComponent(i[o]),r="&"}}return this.api.request(e,t)},t}();e.SearchForm=h;var c=function(){function t(t,e,r,n,i,o,s,a){this.page=t,this.results_per_page=e,this.results_size=r,this.total_results_size=n,this.total_pages=i,this.next_page=o,this.prev_page=s,this.results=a}return t}();e.ApiResponse=c;var p=function(){function t(t,e){var r=e||{};return this.accessToken=r.accessToken,this.url=t+(this.accessToken?(t.indexOf("?")>-1?"&":"?")+"access_token="+this.accessToken:""),this.req=r.req,this.apiCache=r.apiCache||new s.DefaultApiCache,this.requestHandler=r.requestHandler||new o.DefaultRequestHandler,this.apiCacheKey=this.url+(this.accessToken?"#"+this.accessToken:""),this.apiDataTTL=r.apiDataTTL||5,this}return t.prototype.get=function(t){var e=this,r=this.apiCacheKey;return new Promise(function(n,i){var o=function(e,r,o,s){t&&t(e,r,o,s),r&&n(r),e&&i(e)};e.apiCache.get(r,function(t,n){if(t||n)return void o(t,n);e.requestHandler.request(e.url,function(t,n,i,s){if(t)return void o(t,null,i,s);var a=e.parse(n);s=s||e.apiDataTTL,e.apiCache.set(r,a,s,function(t){o(t,a,i,s)})})})})},t.prototype.refresh=function(t){var e=this.apiCacheKey;return new Promise(function(r,n){var o=this,s=function(e,i,o){t&&t(e,i,o),i&&r(i),e&&n(e)};this.apiCache.remove(e,function(t){if(t)return void s(t);o.get(function(t,e){if(t)return void s(t);o.data=e,o.bookmarks=e.bookmarks,o.experiments=new i.Experiments(e.experiments),s()})})})},t.prototype.parse=function(t){var e=this,r=Object.keys(t.forms||[]).reduce(function(r,n,i){if(t.forms.hasOwnProperty(n)){var o=t.forms[n];e.accessToken&&(o.fields.access_token={},o.fields.access_token.type="string",o.fields.access_token.default=e.accessToken);var s=new f(o.fields,o.action,o.name,o.rel,o.form_method,o.enctype);return r[n]=s,r}return r},{}),n=t.refs.map(function(t){return new u(t.ref,t.label,t.isMasterRef,t.scheduledAt,t.id)})||[],i=n.filter(function(t){return!0===t.isMaster}),o=t.types,s=t.tags;if(0===i.length)throw"No master ref.";return{bookmarks:t.bookmarks||{},refs:n,forms:r,master:i[0],types:o,tags:s,experiments:t.experiments,oauthInitiate:t.oauth_initiate,oauthToken:t.oauth_token,quickRoutes:t.quickRoutes}},t.prototype.form=function(t){var e=this.data.forms[t];return e?new h(this,e,{}):null},t.prototype.everything=function(){var t=this.form("everything");if(!t)throw new Error("Missing everything form");return t},t.prototype.master=function(){return this.data.master.ref},t.prototype.ref=function(t){for(var e=0;e<this.data.refs.length;e++)if(this.data.refs[e].label==t)return this.data.refs[e].ref;return null},t.prototype.currentExperiment=function(){return this.experiments.current()},t.prototype.quickRoutesEnabled=function(){return this.data.quickRoutes.enabled},t.prototype.getQuickRoutes=function(t){var e=this;return new Promise(function(r,n){e.requestHandler.request(e.data.quickRoutes.url,function(e,i,o){t&&t(e,i,o),e&&n(e),i&&r(i)})})},t.prototype.query=function(t,r,n){var i="function"==typeof r?{options:{},callback:r}:{options:r||{},callback:n},o=i.options,s=i.callback,u=o,f=this.everything();for(var h in u)f=f.set(h,u[h]);if(!u.ref){var c="";this.req?c=this.req.headers.cookie||"":"undefined"!=typeof window&&window.document&&(c=window.document.cookie||"");var p=a.default.parse(c),d=p[e.PreviewCookie],l=this.experiments.refFromCookie(p[e.ExperimentCookie]);f=f.ref(d||l||this.master())}return t&&f.query(t),f.submit(s)},t.prototype.queryFirst=function(t,e,r){var n="function"==typeof e?{options:{},callback:e}:{options:e||{},callback:r},i=n.options,o=n.callback,s=i;return s.page=1,s.pageSize=1,this.query(t,s,function(t,e){if(o){var r=e&&e.results&&e.results[0];o(t,r)}}).then(function(t){return t&&t.results&&t.results[0]}).catch(function(t){console.log(t)})},t.prototype.getByID=function(t,e,r){return e=e||{},e.lang||(e.lang="*"),this.queryFirst(new n.Predicates.at("document.id",t),e,r)},t.prototype.getByIDs=function(t,e,r){return e=e||{},e.lang||(e.lang="*"),this.query(new n.Predicates.in("document.id",t),e,r)},t.prototype.getByUID=function(t,e,r,i){return r=r||{},r.lang||(r.lang="*"),this.queryFirst(new n.Predicates.at("my."+t+".uid",e),r,i)},t.prototype.getSingle=function(t,e,r){return this.queryFirst(new n.Predicates.at("document.type",t),e,r)},t.prototype.getBookmark=function(t,e,r){return new Promise(function(e,n){var i=this.bookmarks[t];if(i)e(i);else{var o=new Error("Error retrieving bookmarked id");r&&r(o),n(o)}}).then(function(t){return this.getByID(t,e,r)})},t.prototype.previewSession=function(t,e,r,i){var o=this;return new Promise(function(s,a){var u=function(t,e,r){i&&i(t,e,r),t?a(t):s(e)};o.requestHandler.request(t,function(i,s,a){if(i)return void u(i,r,a);try{var f=s.mainDocument;f?o.everything().query(new n.Predicates.at("document.id",f)).ref(t).lang("*").submit(function(t,n){t&&u(t);try{0===n.results.length?u(null,r,a):u(null,e(n.results[0]),a)}catch(t){u(t)}}):u(null,r,a)}catch(t){u(t,r,a)}})})},t.prototype.request=function(t,e){function r(e){o.get(i,function(r,s){if(r||s)return void e(r,n.response(s));n.requestHandler.request(t,function(t,r,s,a){if(t)return void e(t,null,s);a?o.set(i,r,a,function(t){e(t,n.response(r))}):e(null,n.response(r))})})}var n=this,i=t+(this.accessToken?"#"+this.accessToken:""),o=this.apiCache;return new Promise(function(t,n){r(function(r,i,o){e&&e(r,i,o),r&&n(r),i&&t(i)})})},t.prototype.getNextPage=function(t,e){return this.request(t+(this.accessToken?"&access_token="+this.accessToken:""),e)},t.prototype.response=function(t){return new c(t.page,t.results_per_page,t.results_size,t.total_results_size,t.total_pages,t.next_page,t.prev_page,t.results||[])},t}();e.Api=p},function(t,e,r){"use strict";e.__esModule=!0;var n=r(8),i=function(){function t(t){this.lru=n.MakeLRUCache(t)}return t.prototype.isExpired=function(t){var e=this.lru.get(t,!1);return!!e&&0!==e.expiredIn&&e.expiredIn<Date.now()},t.prototype.get=function(t,e){var r=this.lru.get(t,!1);r&&!this.isExpired(t)&&e(null,r.data),e()},t.prototype.set=function(t,e,r,n){this.lru.remove(t),this.lru.put(t,{data:e,expiredIn:r?Date.now()+1e3*r:0}),n()},t.prototype.remove=function(t,e){this.lru.remove(t),e()},t.prototype.clear=function(t){this.lru.removeAll(),t()},t}();e.DefaultApiCache=i},function(t,e,r){"use strict";function n(t,e){try{return e(t)}catch(e){return t}}function i(t,e){if("string"!=typeof t)throw new TypeError("argument str must be a string");var r={},i=e||{},s=i.decode||o;return t.split(/; */).forEach(function(t){var e=t.indexOf("=");if(!(e<0)){var i=t.substr(0,e).trim(),o=t.substr(++e,t.length).trim();'"'==o[0]&&(o=o.slice(1,-1)),void 0==r[i]&&(r[i]=n(o,s))}}),r}e.__esModule=!0;var o=decodeURIComponent;e.default={parse:i}},function(t,e,r){"use strict";e.__esModule=!0;var n=function(){function t(t,e,r,n,i,o,s,a,u,f,h,c){this.id=t,this.uid=h,this.type=e,this.href=r,this.tags=n,this.slug=i[0],this.slugs=o,this.lang=c,this.alternateLanguages=s,this.firstPublicationDate=a?new Date(a):null,this.lastPublicationDate=u?new Date(u):null,this.data=f}return t}();e.Document=n;var i=function(){function t(t){this.data=t}return t}();e.GroupDoc=i},function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.size=0,this.limit=t,this._keymap={}}e.__esModule=!0,e.MakeLRUCache=n,i.prototype.put=function(t,e){var r={key:t,value:e};if(this._keymap[t]=r,this.tail?(this.tail.newer=r,r.older=this.tail):this.head=r,this.tail=r,this.size===this.limit)return this.shift();this.size++},i.prototype.shift=function(){var t=this.head;return t&&(this.head.newer?(this.head=this.head.newer,this.head.older=void 0):this.head=void 0,t.newer=t.older=void 0,delete this._keymap[t.key]),console.log("purging ",t.key),t},i.prototype.get=function(t,e){var r=this._keymap[t];if(void 0!==r)return r===this.tail?e?r:r.value:(r.newer&&(r===this.head&&(this.head=r.newer),r.newer.older=r.older),r.older&&(r.older.newer=r.newer),r.newer=void 0,r.older=this.tail,this.tail&&(this.tail.newer=r),this.tail=r,e?r:r.value)},i.prototype.find=function(t){return this._keymap[t]},i.prototype.set=function(t,e){var r,n=this.get(t,!0);return n?(r=n.value,n.value=e):(r=this.put(t,e))&&(r=r.value),r},i.prototype.remove=function(t){var e=this._keymap[t];if(e)return delete this._keymap[e.key],e.newer&&e.older?(e.older.newer=e.newer,e.newer.older=e.older):e.newer?(e.newer.older=void 0,this.head=e.newer):e.older?(e.older.newer=void 0,this.tail=e.older):this.head=this.tail=void 0,this.size--,e.value},i.prototype.removeAll=function(){this.head=this.tail=void 0,this.size=0,this._keymap={}},"function"==typeof Object.keys?i.prototype.keys=function(){return Object.keys(this._keymap)}:i.prototype.keys=function(){var t=[];for(var e in this._keymap)t.push(e);return t},i.prototype.forEach=function(t,e,r){var n;if(!0===e?(r=!0,e=void 0):"object"!=typeof e&&(e=this),r)for(n=this.tail;n;)t.call(e,n.key,n.value,this),n=n.older;else for(n=this.head;n;)t.call(e,n.key,n.value,this),n=n.newer},i.prototype.toString=function(){for(var t="",e=this.head;e;)t+=String(e.key)+":"+e.value,(e=e.newer)&&(t+=" < ");return t}},function(t,e,r){"use strict";function n(t,e){return{name:"prismic-request-error",message:e,status:t}}function i(t,e,r){return fetch(t,{headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit"}}).then(function(e){if(~~(e.status/100!=2))throw n(e.status,"Unexpected status code ["+e.status+"] on URL "+t);return e.json().then(function(t){return{response:e,json:t}})}).then(function(t){var r=t.response,n=t.json,i=r.headers["cache-control"],o=i?/max-age=(\d+)/.exec(i):null,s=o?parseInt(o[1],10):void 0;e({result:n,xhr:r,ttl:s})}).catch(function(t){r({error:t})})}function o(){if(!(0===u.length||a>=s)){a++;var t=u.shift();i(t.url,function(e){var r=e.result,n=e.xhr,i=e.ttl;a--,t.callback(null,r,n,i),o()},function(e){var r=e.error;t.callback(r)})}}e.__esModule=!0;var s=20,a=0,u=[],f=function(){function t(){}return t.prototype.request=function(t,e){u.push({url:t,callback:e}),o()},t}();e.DefaultRequestHandler=f},function(t,e,r){r(3),t.exports=r(2)}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("fetch-everywhere")):"function"==typeof define&&define.amd?define("PrismicJS",["fetch-everywhere"],e):"object"==typeof exports?exports.PrismicJS=e(require("fetch-everywhere")):t.PrismicJS=e(t["fetch-everywhere"])}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=10)}([function(t,e,r){"use strict";e.__esModule=!0;var n=function(){function t(t){this.data={},this.data=t}return t.prototype.id=function(){return this.data.id},t.prototype.ref=function(){return this.data.ref},t.prototype.label=function(){return this.data.label},t}();e.Variation=n;var i=function(){function t(t){this.data={},this.data=t,this.variations=(t.variations||[]).map(function(t){new n(t)})}return t.prototype.id=function(){return this.data.id},t.prototype.googleId=function(){return this.data.ref},t.prototype.name=function(){return this.data.label},t}();e.Experiment=i;var o=function(){function t(t){t&&(this.drafts=(t.drafts||[]).map(function(t){new i(t)}),this.running=(t.running||[]).map(function(t){new i(t)}))}return t.prototype.current=function(){return this.running.length>0?this.running[0]:null},t.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split(" ");if(e.length<2)return null;var r=e[0],n=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()==r&&t.variations.length>n})[0];return i?i.variations[n].ref():null},t}();e.Experiments=o},function(t,e,r){"use strict";e.__esModule=!0;var n;!function(t){t[t.at=0]="at",t[t.not=1]="not",t[t.missing=2]="missing",t[t.has=3]="has",t[t.any=4]="any",t[t.in=5]="in",t[t.fulltext=6]="fulltext",t[t.similar=7]="similar",t[t["number.gt"]=8]="number.gt",t[t["number.lt"]=9]="number.lt",t[t["number.inRange"]=10]="number.inRange",t[t["date.before"]=11]="date.before",t[t["date.after"]=12]="date.after",t[t["date.between"]=13]="date.between",t[t["date.day-of-month"]=14]="date.day-of-month",t[t["date.day-of-month-after"]=15]="date.day-of-month-after",t[t["date.day-of-month-before"]=16]="date.day-of-month-before",t[t["date.day-of-week"]=17]="date.day-of-week",t[t["date.day-of-week-after"]=18]="date.day-of-week-after",t[t["date.day-of-week-before"]=19]="date.day-of-week-before",t[t["date.month"]=20]="date.month",t[t["date.month-before"]=21]="date.month-before",t[t["date.month-after"]=22]="date.month-after",t[t["date.year"]=23]="date.year",t[t["date.hour"]=24]="date.hour",t[t["date.hour-before"]=25]="date.hour-before",t[t["date.hour-after"]=26]="date.hour-after",t[t["geopoint.near"]=27]="geopoint.near"}(n=e.Operator||(e.Operator={}));var i=function(){function t(t,e){this.op=n.at,this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+', "'+this.value+'")]'},t}();e.AtPredicate=i;var o=function(){function t(t,e){this.op=n.not,this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+', "'+this.value+'")]'},t}();e.NotPredicate=o;var s=function(){function t(t){this.op=n.missing,this.fragment=t}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+")]"},t}();e.MissingPredicate=s;var a=function(){function t(t){this.op=n.has,this.fragment=t}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+")]"},t}();e.HasPredicate=a;var u=function(){function t(t,e){this.op=n.any,this.fragment=t,this.values=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", ["+this.values.join(",")+"])]"},t}();e.AnyPredicate=u;var f=function(){function t(t,e){this.op=n.in,this.fragment=t,this.values=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", ["+this.values.join(",")+"])]"},t}();e.InPredicate=f;var h=function(){function t(t,e){this.op=n.fulltext,this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+', "'+this.value+'")]'},t}();e.FulltextPredicate=h;var c=function(){function t(t,e){this.op=n.similar,this.documentId=t,this.maxResults=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+'("'+this.documentId+'", '+this.maxResults+")]"},t}();e.SimilarPredicate=c;var p=function(){function t(t,e){this.op=n["number.gt"],this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.value+")]"},t}();e.GtPredicate=p;var d=function(){function t(t,e){this.op=n["number.lt"],this.fragment=t,this.value=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.value+")]"},t}();e.LtPredicate=d;var l=function(){function t(t,e,r){this.op=n["number.inRange"],this.fragment=t,this.before=e,this.after=r}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.before+", "+this.after+")]"},t}();e.InRangePredicate=l;var m=function(){function t(t,e){this.op=n["date.before"],this.fragment=t,this.before=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.before.getTime()+")]"},t}();e.DateBeforePredicate=m;var y=function(){function t(t,e){this.op=n["date.after"],this.fragment=t,this.after=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.after.getTime()+")]"},t}();e.DateAfterPredicate=y;var g=function(){function t(t,e,r){this.op=n["date.between"],this.fragment=t,this.before=e,this.after=r}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.before.getTime()+", "+this.after.getTime()+")]"},t}();e.DateBetweenPredicate=g;var v=function(){function t(t,e){this.op=n["date.day-of-month"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfMonthPredicate=v;var k=function(){function t(t,e){this.op=n["date.day-of-month-after"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfMonthAfterPredicate=k;var w=function(){function t(t,e){this.op=n["date.day-of-month-before"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfMonthBeforePredicate=w;var b=function(){function t(t,e){this.op=n["date.day-of-week"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfWeekPredicate=b;var P=function(){function t(t,e){this.op=n["date.day-of-week-after"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfWeekAfterPredicate=P;var _=function(){function t(t,e){this.op=n["date.day-of-week-before"],this.fragment=t,this.day=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.day+")]"},t}();e.DayOfWeekBeforePredicate=_;var x=function(){function t(t,e){this.op=n["date.month"],this.fragment=t,this.month=e}return t.prototype.toString=function(){return"number"==typeof this.month?"[:d = "+n[this.op]+"("+this.fragment+", "+this.month+")]":"[:d = "+n[this.op]+"("+this.fragment+', "'+this.month+'")]'},t}();e.MonthPredicate=x;var S=function(){function t(t,e){this.op=n["date.month-before"],this.fragment=t,this.month=e}return t.prototype.toString=function(){return"number"==typeof this.month?"[:d = "+n[this.op]+"("+this.fragment+", "+this.month+")]":"[:d = "+n[this.op]+"("+this.fragment+', "'+this.month+'")]'},t}();e.MonthBeforePredicate=S;var q=function(){function t(t,e){this.op=n["date.month-after"],this.fragment=t,this.month=e}return t.prototype.toString=function(){return"number"==typeof this.month?"[:d = "+n[this.op]+"("+this.fragment+", "+this.month+")]":"[:d = "+n[this.op]+"("+this.fragment+', "'+this.month+'")]'},t}();e.MonthAfterPredicate=q;var D=function(){function t(t,e){this.op=n["date.year"],this.fragment=t,this.year=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.year+")]"},t}();e.YearPredicate=D;var M=function(){function t(t,e){this.op=n["date.hour"],this.fragment=t,this.hour=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.hour+")]"},t}();e.HourPredicate=M;var A=function(){function t(t,e){this.op=n["date.hour-before"],this.fragment=t,this.hour=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.hour+")]"},t}();e.HourBeforePredicate=A;var C=function(){function t(t,e){this.op=n["date.hour-after"],this.fragment=t,this.hour=e}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.hour+")]"},t}();e.HourAfterPredicate=C;var O=function(){function t(t,e,r,i){this.op=n["geopoint.near"],this.fragment=t,this.latitude=e,this.longitude=r,this.radius=i}return t.prototype.toString=function(){return"[:d = "+n[this.op]+"("+this.fragment+", "+this.latitude+", "+this.longitude+", "+this.radius+")]"},t}();e.NearPredicate=O,e.Predicates={at:i,not:o,missing:s,has:a,any:u,in:f,fulltext:h,similar:c,gt:p,lt:d,inRange:l,before:m,after:y,between:g,dayOfMonth:v,dayOfMonthAfter:k,dayOfMonthBefore:w,dayOfWeek:b,dayOfWeekAfter:P,dayOfWeekBefore:_,month:x,monthBefore:S,monthAfter:q,year:D,hour:M,hourBefore:A,hourAfter:C,near:O}},function(t,e,r){"use strict";function n(t,e){var r=new o.Api(t,e);return new Promise(function(t,n){var i=function(r,i){e.complete&&e.complete(r,i),r?n(r):t(i)};return r.get(function(t,e){!t&&e&&(r.data=e,r.bookmarks=e.bookmarks,r.experiments=new a.Experiments(e.experiments)),i(t,r)}),r})}e.__esModule=!0;var i=r(7),o=r(4),s=r(1),a=r(0);e.default={experimentCookie:o.ExperimentCookie,previewCookie:o.PreviewCookie,Document:i.Document,SearchForm:o.SearchForm,Form:o.Form,Experiments:a.Experiments,Predicates:s,api:n}},function(e,r){e.exports=t},function(t,e,r){"use strict";e.__esModule=!0;var n=r(1),i=r(0),o=r(9),s=r(5),a=r(6);e.PreviewCookie="io.prismic.preview",e.ExperimentCookie="io.prismic.experiment";var u=function(){function t(t,e,r,n,i){this.ref=t,this.label=e,this.isMaster=r,this.scheduledAt=n,this.id=i}return t}();e.Ref=u;var f=function(){function t(t,e,r,n,i,o){this.fields=t,this.action=e,this.name=r,this.rel=n,this.form_method=i,this.enctype=o}return t.prototype.getField=function(t){return this.fields[t]},t.prototype.getFieldSafe=function(t){var e=this.fields[t];if(!e)throw new Error("Missing field "+e+" in form fields "+this.fields);return e},t}();e.Form=f;var h=function(){function t(t,e,r){this.api=t,this.form=e,this.data=r||{};for(var n in e.fields)e.getFieldSafe(n).default&&(this.data[n]=[e.fields[n].default])}return t.prototype.set=function(t,e){var r=this.form.getField(t);if(!r)throw new Error("Unknown field "+t);var n=""===e||void 0===e?null:e,i=this.data[t]||[];return i=r.multiple?n?i.concat([n]):i:n?[n]:i,this.data[t]=i,this},t.prototype.ref=function(t){return this.set("ref",t)},t.prototype.query=function(t){if("string"==typeof t)return this.set("q",t);if(t instanceof Array){var e=t.map(function(t){return t.toString()});return this.query("["+e.join("")+"]")}return this.query([t])},t.prototype.pageSize=function(t){return this.set("pageSize",t)},t.prototype.fetch=function(t){var e=t instanceof Array?t.join(","):t;return this.set("fetch",e)},t.prototype.fetchLinks=function(t){var e=t instanceof Array?t.join(","):t;return this.set("fetchLinks",e)},t.prototype.lang=function(t){return this.set("lang",t)},t.prototype.page=function(t){return this.set("page",t)},t.prototype.orderings=function(t){return t?this.set("orderings","["+t.join(",")+"]"):this},t.prototype.submit=function(t){var e=this.form.action;if(this.data){var r=e.indexOf("?")>-1?"&":"?";for(var n in this.data)if(this.data.hasOwnProperty(n)){var i=this.data[n];if(i)for(var o=0;o<i.length;o++)e+=r+n+"="+encodeURIComponent(i[o]),r="&"}}return this.api.request(e,t)},t}();e.SearchForm=h;var c=function(){function t(t,e,r,n,i,o,s,a){this.page=t,this.results_per_page=e,this.results_size=r,this.total_results_size=n,this.total_pages=i,this.next_page=o,this.prev_page=s,this.results=a}return t}();e.ApiResponse=c;var p=function(){function t(t,e){var r=e||{};return this.accessToken=r.accessToken,this.url=t+(this.accessToken?(t.indexOf("?")>-1?"&":"?")+"access_token="+this.accessToken:""),this.req=r.req,this.apiCache=r.apiCache||new s.DefaultApiCache,this.requestHandler=r.requestHandler||new o.DefaultRequestHandler,this.apiCacheKey=this.url+(this.accessToken?"#"+this.accessToken:""),this.apiDataTTL=r.apiDataTTL||5,this}return t.prototype.get=function(t){var e=this,r=this.apiCacheKey;return new Promise(function(n,i){var o=function(e,r,o,s){t&&t(e,r,o,s),r&&n(r),e&&i(e)};e.apiCache.get(r,function(t,n){if(t||n)return void o(t,n);e.requestHandler.request(e.url,function(t,n,i,s){if(t)return void o(t,null,i,s);var a=e.parse(n);s=s||e.apiDataTTL,e.apiCache.set(r,a,s,function(t){o(t,a,i,s)})})})})},t.prototype.refresh=function(t){var e=this.apiCacheKey;return new Promise(function(r,n){var o=this,s=function(e,i,o){t&&t(e,i,o),i&&r(i),e&&n(e)};this.apiCache.remove(e,function(t){if(t)return void s(t);o.get(function(t,e){if(t)return void s(t);o.data=e,o.bookmarks=e.bookmarks,o.experiments=new i.Experiments(e.experiments),s()})})})},t.prototype.parse=function(t){var e=this,r=Object.keys(t.forms||[]).reduce(function(r,n,i){if(t.forms.hasOwnProperty(n)){var o=t.forms[n];e.accessToken&&(o.fields.access_token={},o.fields.access_token.type="string",o.fields.access_token.default=e.accessToken);var s=new f(o.fields,o.action,o.name,o.rel,o.form_method,o.enctype);return r[n]=s,r}return r},{}),n=t.refs.map(function(t){return new u(t.ref,t.label,t.isMasterRef,t.scheduledAt,t.id)})||[],i=n.filter(function(t){return!0===t.isMaster}),o=t.types,s=t.tags;if(0===i.length)throw"No master ref.";return{bookmarks:t.bookmarks||{},refs:n,forms:r,master:i[0],types:o,tags:s,experiments:t.experiments,oauthInitiate:t.oauth_initiate,oauthToken:t.oauth_token,quickRoutes:t.quickRoutes}},t.prototype.form=function(t){var e=this.data.forms[t];return e?new h(this,e,{}):null},t.prototype.everything=function(){var t=this.form("everything");if(!t)throw new Error("Missing everything form");return t},t.prototype.master=function(){return this.data.master.ref},t.prototype.ref=function(t){for(var e=0;e<this.data.refs.length;e++)if(this.data.refs[e].label==t)return this.data.refs[e].ref;return null},t.prototype.currentExperiment=function(){return this.experiments.current()},t.prototype.quickRoutesEnabled=function(){return this.data.quickRoutes.enabled},t.prototype.getQuickRoutes=function(t){var e=this;return new Promise(function(r,n){e.requestHandler.request(e.data.quickRoutes.url,function(e,i,o){t&&t(e,i,o),e&&n(e),i&&r(i)})})},t.prototype.query=function(t,r,n){var i="function"==typeof r?{options:{},callback:r}:{options:r||{},callback:n},o=i.options,s=i.callback,u=o,f=this.everything();for(var h in u)f=f.set(h,u[h]);if(!u.ref){var c="";this.req?c=this.req.headers.cookie||"":"undefined"!=typeof window&&window.document&&(c=window.document.cookie||"");var p=a.default.parse(c),d=p[e.PreviewCookie],l=this.experiments.refFromCookie(p[e.ExperimentCookie]);f=f.ref(d||l||this.master())}return t&&f.query(t),f.submit(s)},t.prototype.queryFirst=function(t,e,r){var n="function"==typeof e?{options:{},callback:e}:{options:e||{},callback:r},i=n.options,o=n.callback,s=i;return s.page=1,s.pageSize=1,this.query(t,s,function(t,e){if(o){var r=e&&e.results&&e.results[0];o(t,r)}}).then(function(t){return t&&t.results&&t.results[0]}).catch(function(t){console.log(t)})},t.prototype.getByID=function(t,e,r){return e=e||{},e.lang||(e.lang="*"),this.queryFirst(new n.Predicates.at("document.id",t),e,r)},t.prototype.getByIDs=function(t,e,r){return e=e||{},e.lang||(e.lang="*"),this.query(new n.Predicates.in("document.id",t),e,r)},t.prototype.getByUID=function(t,e,r,i){return r=r||{},r.lang||(r.lang="*"),this.queryFirst(new n.Predicates.at("my."+t+".uid",e),r,i)},t.prototype.getSingle=function(t,e,r){return this.queryFirst(new n.Predicates.at("document.type",t),e,r)},t.prototype.getBookmark=function(t,e,r){return new Promise(function(e,n){var i=this.bookmarks[t];if(i)e(i);else{var o=new Error("Error retrieving bookmarked id");r&&r(o),n(o)}}).then(function(t){return this.getByID(t,e,r)})},t.prototype.previewSession=function(t,e,r,i){var o=this;return new Promise(function(s,a){var u=function(t,e,r){i&&i(t,e,r),t?a(t):s(e)};o.requestHandler.request(t,function(i,s,a){if(i)return void u(i,r,a);try{var f=s.mainDocument;f?o.everything().query(new n.Predicates.at("document.id",f)).ref(t).lang("*").submit(function(t,n){t&&u(t);try{0===n.results.length?u(null,r,a):u(null,e(n.results[0]),a)}catch(t){u(t)}}):u(null,r,a)}catch(t){u(t,r,a)}})})},t.prototype.request=function(t,e){function r(e){o.get(i,function(r,s){if(r||s)return void e(r,n.response(s));n.requestHandler.request(t,function(t,r,s,a){if(t)return void e(t,null,s);a?o.set(i,r,a,function(t){e(t,n.response(r))}):e(null,n.response(r))})})}var n=this,i=t+(this.accessToken?"#"+this.accessToken:""),o=this.apiCache;return new Promise(function(t,n){r(function(r,i,o){e&&e(r,i,o),r&&n(r),i&&t(i)})})},t.prototype.getNextPage=function(t,e){return this.request(t+(this.accessToken?"&access_token="+this.accessToken:""),e)},t.prototype.response=function(t){return new c(t.page,t.results_per_page,t.results_size,t.total_results_size,t.total_pages,t.next_page,t.prev_page,t.results||[])},t}();e.Api=p},function(t,e,r){"use strict";e.__esModule=!0;var n=r(8),i=function(){function t(t){this.lru=n.MakeLRUCache(t)}return t.prototype.isExpired=function(t){var e=this.lru.get(t,!1);return!!e&&0!==e.expiredIn&&e.expiredIn<Date.now()},t.prototype.get=function(t,e){var r=this.lru.get(t,!1);r&&!this.isExpired(t)&&e(null,r.data),e()},t.prototype.set=function(t,e,r,n){this.lru.remove(t),this.lru.put(t,{data:e,expiredIn:r?Date.now()+1e3*r:0}),n()},t.prototype.remove=function(t,e){this.lru.remove(t),e()},t.prototype.clear=function(t){this.lru.removeAll(),t()},t}();e.DefaultApiCache=i},function(t,e,r){"use strict";function n(t,e){try{return e(t)}catch(e){return t}}function i(t,e){if("string"!=typeof t)throw new TypeError("argument str must be a string");var r={},i=e||{},s=i.decode||o;return t.split(/; */).forEach(function(t){var e=t.indexOf("=");if(!(e<0)){var i=t.substr(0,e).trim(),o=t.substr(++e,t.length).trim();'"'==o[0]&&(o=o.slice(1,-1)),void 0==r[i]&&(r[i]=n(o,s))}}),r}e.__esModule=!0;var o=decodeURIComponent;e.default={parse:i}},function(t,e,r){"use strict";e.__esModule=!0;var n=function(){function t(t,e,r,n,i,o,s,a,u,f,h,c){this.id=t,this.uid=h,this.type=e,this.href=r,this.tags=n,this.slug=i[0],this.slugs=o,this.lang=c,this.alternateLanguages=s,this.firstPublicationDate=a?new Date(a):null,this.lastPublicationDate=u?new Date(u):null,this.data=f}return t}();e.Document=n;var i=function(){function t(t){this.data=t}return t}();e.GroupDoc=i},function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.size=0,this.limit=t,this._keymap={}}e.__esModule=!0,e.MakeLRUCache=n,i.prototype.put=function(t,e){var r={key:t,value:e};if(this._keymap[t]=r,this.tail?(this.tail.newer=r,r.older=this.tail):this.head=r,this.tail=r,this.size===this.limit)return this.shift();this.size++},i.prototype.shift=function(){var t=this.head;return t&&(this.head.newer?(this.head=this.head.newer,this.head.older=void 0):this.head=void 0,t.newer=t.older=void 0,delete this._keymap[t.key]),console.log("purging ",t.key),t},i.prototype.get=function(t,e){var r=this._keymap[t];if(void 0!==r)return r===this.tail?e?r:r.value:(r.newer&&(r===this.head&&(this.head=r.newer),r.newer.older=r.older),r.older&&(r.older.newer=r.newer),r.newer=void 0,r.older=this.tail,this.tail&&(this.tail.newer=r),this.tail=r,e?r:r.value)},i.prototype.find=function(t){return this._keymap[t]},i.prototype.set=function(t,e){var r,n=this.get(t,!0);return n?(r=n.value,n.value=e):(r=this.put(t,e))&&(r=r.value),r},i.prototype.remove=function(t){var e=this._keymap[t];if(e)return delete this._keymap[e.key],e.newer&&e.older?(e.older.newer=e.newer,e.newer.older=e.older):e.newer?(e.newer.older=void 0,this.head=e.newer):e.older?(e.older.newer=void 0,this.tail=e.older):this.head=this.tail=void 0,this.size--,e.value},i.prototype.removeAll=function(){this.head=this.tail=void 0,this.size=0,this._keymap={}},"function"==typeof Object.keys?i.prototype.keys=function(){return Object.keys(this._keymap)}:i.prototype.keys=function(){var t=[];for(var e in this._keymap)t.push(e);return t},i.prototype.forEach=function(t,e,r){var n;if(!0===e?(r=!0,e=void 0):"object"!=typeof e&&(e=this),r)for(n=this.tail;n;)t.call(e,n.key,n.value,this),n=n.older;else for(n=this.head;n;)t.call(e,n.key,n.value,this),n=n.newer},i.prototype.toString=function(){for(var t="",e=this.head;e;)t+=String(e.key)+":"+e.value,(e=e.newer)&&(t+=" < ");return t}},function(t,e,r){"use strict";function n(t,e){return{name:"prismic-request-error",message:e,status:t}}function i(t,e,r){return fetch(t,{headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit"}}).then(function(e){if(~~(e.status/100!=2))throw n(e.status,"Unexpected status code ["+e.status+"] on URL "+t);return e.json().then(function(t){return{response:e,json:t}})}).then(function(t){var r=t.response,n=t.json,i=r.headers["cache-control"],o=i?/max-age=(\d+)/.exec(i):null,s=o?parseInt(o[1],10):void 0;e({result:n,xhr:r,ttl:s})}).catch(function(t){r({error:t})})}function o(){if(!(0===u.length||a>=s)){a++;var t=u.shift();i(t.url,function(e){var r=e.result,n=e.xhr,i=e.ttl;a--,t.callback(null,r,n,i),o()},function(e){var r=e.error;t.callback(r)})}}e.__esModule=!0;var s=20,a=0,u=[],f=function(){function t(){}return t.prototype.request=function(t,e){u.push({url:t,callback:e}),o()},t}();e.DefaultRequestHandler=f},function(t,e,r){r(3),t.exports=r(2)}])}); |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"devDependencies": { | ||
@@ -16,0 +16,0 @@ "json-loader": "^0.5.4", |
@@ -139,3 +139,3 @@ ## JavaScript development kit v2 for prismic.io | ||
Custom type | ||
``` | ||
```javascript | ||
"video" : { | ||
@@ -147,3 +147,3 @@ "type" : "Embed" | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.video.embed_url | ||
@@ -154,3 +154,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"photo" : { | ||
@@ -181,3 +181,3 @@ "type" : "Image", | ||
Template JS | ||
``` | ||
```javascript | ||
//main view | ||
@@ -197,3 +197,3 @@ doc.data.photo.url | ||
Custom type | ||
``` | ||
```javascript | ||
"title" : { | ||
@@ -205,3 +205,3 @@ "type" : "Text", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.title | ||
@@ -211,3 +211,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"count" : { | ||
@@ -219,3 +219,3 @@ "type" : "Text", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.count | ||
@@ -225,3 +225,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"publication" : { | ||
@@ -233,3 +233,3 @@ "type" : "Date", | ||
Template JS | ||
``` | ||
```javascript | ||
import { Date } from 'prismic-dom' | ||
@@ -245,3 +245,3 @@ | ||
Custom type | ||
``` | ||
```javascript | ||
"time" : { | ||
@@ -253,3 +253,3 @@ "type" : "Timestamp", | ||
Template JS | ||
``` | ||
```javascript | ||
import { Date } from 'prismic-dom' | ||
@@ -264,3 +264,3 @@ | ||
Custom type | ||
``` | ||
```javascript | ||
"gender" : { | ||
@@ -272,3 +272,3 @@ "type" : "Select", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.gender | ||
@@ -278,3 +278,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"background" : { | ||
@@ -286,3 +286,3 @@ "type" : "Color", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.background | ||
@@ -292,3 +292,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"description" : { | ||
@@ -300,3 +300,3 @@ "type" : "StructuredText", | ||
Template JS | ||
``` | ||
```javascript | ||
import { RichText } from 'prismic-dom' | ||
@@ -312,3 +312,3 @@ | ||
Custom type | ||
``` | ||
```javascript | ||
"linktoweb" : { | ||
@@ -323,3 +323,3 @@ "type" : "Link", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.linktoweb.url | ||
@@ -329,3 +329,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"linktodoc" : { | ||
@@ -342,3 +342,3 @@ "type" : "Link", | ||
Template JS | ||
``` | ||
```javascript | ||
//return url of the document link | ||
@@ -351,3 +351,3 @@ doc.data.linktodoc | ||
Custom type | ||
``` | ||
```javascript | ||
"linktomedia" : { | ||
@@ -362,3 +362,3 @@ "type" : "Link", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.linktomedia.url | ||
@@ -368,3 +368,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"linktofile" : { | ||
@@ -379,3 +379,3 @@ "type" : "Link", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.linktofile.url | ||
@@ -385,3 +385,3 @@ ``` | ||
Custom type | ||
``` | ||
```javascript | ||
"feature" : { | ||
@@ -404,3 +404,3 @@ "type" : "Group", | ||
Template JS | ||
``` | ||
```javascript | ||
import { RichText } from 'prismic-dom' | ||
@@ -415,3 +415,3 @@ | ||
Custom type | ||
``` | ||
```javascript | ||
"location" : { | ||
@@ -423,3 +423,3 @@ "type" : "GeoPoint", | ||
Template JS | ||
``` | ||
```javascript | ||
doc.data.latitude | ||
@@ -432,3 +432,3 @@ doc.data.longitude | ||
Custom type | ||
``` | ||
```javascript | ||
"contentAsSlices" : { | ||
@@ -460,3 +460,3 @@ "fieldset" : "Dynamic page zone...", | ||
Template JS | ||
``` | ||
```javascript | ||
for(slice in doc.data.contentAsSlices) { | ||
@@ -477,3 +477,3 @@ switch(slice.slice_type) { | ||
Custom type | ||
``` | ||
```javascript | ||
"contentAsSlices" : { | ||
@@ -493,3 +493,3 @@ "fieldset" : "Dynamic page zone...", | ||
Template JS | ||
``` | ||
```javascript | ||
import { RichText } from 'prismic-dom' | ||
@@ -509,3 +509,3 @@ | ||
the new Slice type allow you to create a repeatable area and a non repeatable one. | ||
``` | ||
```javascript | ||
"contentAsSlices" : { | ||
@@ -535,3 +535,3 @@ "fieldset" : "Dynamic page zone...", | ||
Template JS | ||
``` | ||
```javascript | ||
import { RichText } from 'prismic-dom' | ||
@@ -562,3 +562,3 @@ | ||
``` | ||
```bash | ||
npm install | ||
@@ -565,0 +565,0 @@ npm run dev |
@@ -5,3 +5,4 @@ var webpack = require('webpack'), | ||
var libraryName = 'prismic-javascript', | ||
var fileName = 'prismic-javascript', | ||
libraryName = 'PrismicJS', | ||
plugins = [], | ||
@@ -12,5 +13,5 @@ outputFile; | ||
plugins.push(new webpack.optimize.UglifyJsPlugin({ minimize: true })); | ||
outputFile = libraryName + '.min.js'; | ||
outputFile = fileName + '.min.js'; | ||
} else { | ||
outputFile = libraryName + '.js'; | ||
outputFile = fileName + '.js'; | ||
} | ||
@@ -17,0 +18,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5424
1948339