From 051beebae0dbe9aaaea6780427875104fcd46768 Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Tue, 11 Jul 2023 21:46:08 +1200 Subject: [PATCH] A bunch of changes --- _graphql/queries.yml | 2 +- client/dist/js/bundle.js | 2 +- .../src/components/AbstractLinkField/linkFieldHOC.js | 3 ++- src/Form/JsonField.php | 1 - src/Form/MultiLinkField.php | 4 ++-- src/Models/EmailLink.php | 2 +- src/Models/Link.php | 3 +++ src/Models/PhoneLink.php | 10 ++++++++-- tests/php/Form/MultiLinkFieldTest.php | 10 +++++----- tests/php/GraphQL/LinkDescriptionResolverTest.php | 2 +- tests/php/LinkModelTest.php | 6 +++--- tests/php/LinkModelTest.yml | 6 +++--- tests/php/LinkOwner.php | 4 ++-- 13 files changed, 32 insertions(+), 23 deletions(-) diff --git a/_graphql/queries.yml b/_graphql/queries.yml index 7b372075..5ccb987a 100644 --- a/_graphql/queries.yml +++ b/_graphql/queries.yml @@ -1,6 +1,6 @@ 'readLinkDescription(dataStr: String!)': type: '[LinkDescription]' - resolver: ['SilverStripe\Link\GraphQL\LinkDescriptionResolver', 'resolve'] + resolver: ['SilverStripe\LinkField\GraphQL\LinkDescriptionResolver', 'resolve'] 'readLinkTypes(keys: [ID])': type: '[LinkType]' resolver: ['SilverStripe\LinkField\GraphQL\LinkTypeResolver', 'resolve'] diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index f0a7d28e..916f74b7 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(){"use strict";var e={274:function(e,t,n){var r=i(n(180)),a=i(n(521)),o=i(n(154));function i(e){return e&&e.__esModule?e:{default:e}}document.addEventListener("DOMContentLoaded",(()=>{(0,a.default)(),(0,o.default)(),(0,r.default)()}))},521:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=d(n(648)),a=d(n(809)),o=d(n(909)),i=d(n(852)),l=d(n(184)),u=d(n(117)),f=d(n(606));function d(e){return e&&e.__esModule?e:{default:e}}var s=()=>{r.default.component.registerMany({LinkPicker:a.default,LinkField:i.default,MultiLinkPicker:o.default,MultiLinkField:l.default,"LinkModal.FormBuilderModal":u.default,"LinkModal.InsertMediaModal":f.default})};t.default=s},154:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(648)),a=i(n(689)),o=i(n(287));function i(e){return e&&e.__esModule?e:{default:e}}var l=()=>{r.default.query.register("readLinkTypes",a.default),r.default.query.register("readLinkDescription",o.default)};t.default=l},180:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=()=>{};t.default=n},513:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.linkFieldPropTypes=t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(363)),a=n(648),o=u(n(86)),i=u(n(686)),l=u(n(384));function u(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}const d=e=>{let{id:t,loading:n,Loading:o,Picker:i,onChange:l,types:u,clearLinkData:f,buildLinkProps:d,updateLinkData:s,selectLinkData:c}=e;if(n)return r.default.createElement(o,null);const[p,y]=(0,r.useState)(!1),[v,g]=(0,r.useState)(""),m=c(p),k=u[m&&m.typeKey||v],h={...d(),onEdit:e=>{y(e)},onClear:(e,n)=>{"function"==typeof l&&l(e,{id:t,value:f(n)})},onSelect:e=>{g(e),y(!0)},types:Object.values(u)},_={type:k,editing:!1!==p,onSubmit:e=>{const{SecurityID:n,action_insert:r,...a}=e;return"function"==typeof l&&l(void 0,{id:t,value:s(a)}),y(!1),g(""),Promise.resolve()},onClosed:()=>(y(!1),Promise.resolve()),data:m},b=k?k.handlerName:"FormBuilderModal",O=(0,a.loadComponent)(`LinkModal.${b}`);return r.default.createElement(r.Fragment,null,r.default.createElement(i,h),r.default.createElement(O,_))},s={id:o.default.string.isRequired,loading:o.default.bool,Loading:o.default.elementType,data:o.default.any,Picker:o.default.elementType,onChange:o.default.func,types:o.default.objectOf(i.default),linkDescriptions:o.default.arrayOf(l.default)};t.linkFieldPropTypes=s,d.propTypes={...s,clearLinkData:o.default.func.isRequired,buildLinkProps:o.default.func.isRequired,updateLinkData:o.default.func.isRequired,selectLinkData:o.default.func.isRequired};var c=d;t.default=c},701:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(363)),a=n(827),o=n(939),i=n(648),l=u(n(42));function u(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;tt=>{let{data:n,value:a,...o}=t,i=a||n;return"string"==typeof i&&(i=JSON.parse(i)),r.default.createElement(e,f({dataStr:JSON.stringify(i)},o,{data:i}))}),(0,i.injectGraphql)("readLinkTypes"),(0,i.injectGraphql)("readLinkDescription"),o.withApollo,l.default);t.default=d},480:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(363)),a=i(n(86)),o=i(n(820));function i(e){return e&&e.__esModule?e:{default:e}}const l=e=>{let{className:t,children:n}=e;return r.default.createElement("div",{className:(0,o.default)("link-box","form-control",t)},n)};l.propTypes={className:a.default.string};var u=l;t.default=u},852:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(363)),a=n(827),o=n(648),i=(d(n(86)),d(n(266))),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(513)),u=d(n(701));function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const t={buildLinkProps:()=>{const{data:t,linkDescriptions:n,types:r}=e,{typeKey:a}=t,o=r[a],i=n.length>0?n[0]:{},{title:l,description:u}=i;return{title:l,description:u,type:o||void 0}},clearLinkData:()=>({}),updateLinkData:e=>e,selectLinkData:()=>e.data};return r.default.createElement(l.default,s({},e,t))};t.Component=c,c.propTypes={...l.linkFieldPropTypes,data:i.default};var p=(0,a.compose)((0,o.inject)(["LinkPicker","Loading"],((e,t)=>({Picker:e,Loading:t}))),u.default)(c);t.default=p},606:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var l=a?Object.getOwnPropertyDescriptor(e,o):null;l&&(l.get||l.set)?Object.defineProperty(r,o,l):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(363)),o=(r=n(475))&&r.__esModule?r:{default:r};function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;te({type:"INIT_FORM_SCHEMA_STACK",payload:{formSchema:{type:"insert-link",nextType:"admin"}}}),reset:()=>e({type:"RESET"})}}}))((e=>{let{type:t,editing:n,data:r,actions:i,onSubmit:u,...f}=e;if(!t)return!1;(0,a.useEffect)((()=>{n?i.initModal():i.reset()}),[n]);const d=r?{ID:r.FileID,Description:r.Title,TargetBlank:!!r.OpenInNew}:{};return a.default.createElement(o.default,l({isOpen:n,type:"insert-link",title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:d,onInsert:e=>{let{ID:n,Description:a,TargetBlank:o}=e;return u({FileID:n,ID:r?r.ID:void 0,Title:a,OpenInNew:o,typeKey:t.key},"",(()=>{}))}},f))}));t.default=u},117:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(363)),a=u(n(912)),o=u(n(872)),i=u(n(902)),l=u(n(510));function u(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{schemaUrl:n}=l.default.getSection("SilverStripe\\Admin\\LeftAndMain").form.DynamicLink,r=o.default.parse(n),a=i.default.parse(r.query);return a.key=e,t&&(a.data=JSON.stringify(t)),o.default.format({...r,search:i.default.stringify(a)})};var s=e=>{let{type:t,editing:n,data:o,...i}=e;return!!t&&r.default.createElement(a.default,f({title:t.title,isOpen:n,schemaUrl:d(t.key,o),identifier:"Link.EditingLinkInfo"},i))};t.default=s},809:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(363)),a=d(n(86)),o=d(n(820)),i=d(n(97)),l=d(n(734)),u=d(n(480)),f=d(n(686));function d(e){return e&&e.__esModule?e:{default:e}}const s=e=>{let{types:t,onSelect:n,title:a,description:f,type:d,onEdit:s,onClear:c}=e;return r.default.createElement(u.default,{className:(0,o.default)("link-picker",{"link-picker--selected":d})},d?r.default.createElement(l.default,{description:f,title:a,type:d,onClear:c,onClick:()=>s&&s()}):r.default.createElement(i.default,{types:t,onSelect:n}))};t.Component=s,s.propTypes={...i.default.propTypes,onEdit:a.default.func,onClear:a.default.func,title:a.default.string,description:a.default.string,type:f.default};var c=s;t.default=c},97:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=f(n(754)),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(363)),o=f(n(86)),i=n(127),l=f(n(686));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function f(e){return e&&e.__esModule?e:{default:e}}const d=e=>{let{types:t,onSelect:n}=e;const[o,l]=(0,a.useState)(!1);return a.default.createElement(i.Dropdown,{isOpen:o,toggle:()=>l((e=>!e)),className:"link-menu"},a.default.createElement(i.DropdownToggle,{className:"link-menu__toggle font-icon-link",caret:!0},r.default._t("Link.ADD_LINK","Add Link")),a.default.createElement(i.DropdownMenu,null,t.map((e=>{let{key:t,title:r,icon:o}=e;return a.default.createElement(i.DropdownItem,{className:`font-icon-${o||"link"}`,key:t,onClick:()=>n(t)},r)}))))};d.propTypes={types:o.default.arrayOf(l.default).isRequired,onSelect:o.default.func.isRequired};var s=d;t.default=s},734:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(754)),a=u(n(363)),o=u(n(86)),i=u(n(686)),l=n(127);function u(e){return e&&e.__esModule?e:{default:e}}const f=e=>t=>{t.nativeEvent.stopImmediatePropagation(),t.preventDefault(),t.nativeEvent.preventDefault(),t.stopPropagation(),e&&e()},d=e=>{let{title:t,type:n,description:o,onClear:i,onClick:u,className:d}=e;return a.default.createElement(l.Button,{className:classnames("link-title",`font-icon-${n.icon||"link"}`,d),color:"secondary",onClick:f(u)},a.default.createElement("div",{className:"link-title__detail"},a.default.createElement("div",{className:"link-title__title"},t),a.default.createElement("small",{className:"link-title__type"},n.title,": ",a.default.createElement("span",{className:"link-title__url"},o))),a.default.createElement(l.Button,{tag:"a",className:"link-title__clear",color:"link",onClick:f(i)},r.default._t("Link.CLEAR","Clear")))};d.propTypes={title:o.default.string.isRequired,type:i.default,description:o.default.string,onClear:o.default.func,onClick:o.default.func},d.defaultProps={type:{}};var s=d;t.default=s},184:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(363)),a=n(827),o=n(648),i=c(n(86)),l=n(614),u=c(n(266)),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(513)),d=c(n(701));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const t={buildLinkProps:()=>{return{links:(t=e.data,n=e.linkDescriptions,t.map((e=>{const t=n.find((t=>{let{id:n}=t;return n.toString()===e.ID.toString()}));return{...e,...t}})))};var t,n},clearLinkData:t=>e.data.filter((e=>{let{ID:n}=e;return n!==t})),updateLinkData:t=>{const{data:n}=e;return t.ID?n.map((e=>e.ID===t.ID?t:e)):[...n,{...t,ID:(0,l.v4)(),isNew:!0}]},selectLinkData:t=>e.data.find((e=>{let{ID:n}=e;return n===t}))||void 0};return r.default.createElement(f.default,p({},e,t))};t.Component=y,y.propTypes={...f.linkFieldPropTypes,data:i.default.arrayOf(u.default)};var v=(0,a.compose)((0,o.inject)(["MultiLinkPicker","Loading"],((e,t)=>({Picker:e,Loading:t}))),d.default)(y);t.default=v},909:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=u(n(363)),a=u(n(86)),o=u(n(97)),i=u(n(734)),l=u(n(480));function u(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{types:t,onSelect:n,links:a,onEdit:u,onClear:d}=e;return r.default.createElement("div",{className:"multi-link-picker"},r.default.createElement(l.default,{className:"multi-link-picker__picker"},r.default.createElement(o.default,{types:t,onSelect:n})),a.length>0&&r.default.createElement(l.default,{className:"multi-link-picker__list"},a.map((e=>{let{ID:n,...a}=e;return r.default.createElement(i.default,f({},a,{className:"multi-link-picker__link",type:t.find((e=>e.key===a.typeKey)),key:`${n} ${a.description}`,onClear:e=>d(e,n),onClick:()=>u(n)}))}))))};t.Component=d,d.propTypes={...o.default.propTypes,links:a.default.arrayOf(a.default.shape(i.default.propTypes)),onEdit:a.default.func,onClear:a.default.func};var s=d;t.default=s},115:function(e,t,n){var r=l(n(311)),a=l(n(363)),o=l(n(691)),i=n(648);function l(e){return e&&e.__esModule?e:{default:e}}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e(".js-injector-boot .entwine-jsonfield").entwine({Component:null,Root:null,onmatch(){const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=this.data("schema-component"),r=(0,i.loadComponent)(n,t);this.setComponent(r),this.setRoot(o.default.createRoot(this[0])),this._super(),this.refresh()},refresh(){const e=this.getProps(),t=this.getComponent();this.getRoot().render(a.default.createElement(t,u({},e,{noHolder:!0})))},handleChange(t,n){let{value:r}=n;const a=e(this).data("field-id");e(`#${a}`).val(JSON.stringify(r)).trigger("change"),this.refresh()},getProps(){const t=e(this).data("field-id"),n=e(`#${t}`).val();return{id:t,value:n?JSON.parse(n):void 0,onChange:this.handleChange.bind(this)}},onunmatch(){this.getRoot().unmount()}})}))},287:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(648);const a={props(e){const{data:{error:t,readLinkDescription:n,loading:r}}=e;return{loading:r,linkDescriptions:n||[],graphQLErrors:t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message))}}},{READ:o}=r.graphqlTemplates;var i={apolloConfig:a,templateName:o,pluralName:"LinkDescription",pagination:!1,params:{dataStr:"String!"},args:{root:{dataStr:"dataStr"}},fields:["id","description","title"]};t.default=i},689:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(648);const a={props(e){const{data:{error:t,readLinkTypes:n,loading:r}}=e,a=t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message));return{loading:r,types:n?n.reduce(((e,t)=>({...e,[t.key]:t})),{}):{},graphQLErrors:a}}},{READ:o}=r.graphqlTemplates;var i={apolloConfig:a,templateName:o,pluralName:"LinkTypes",pagination:!1,params:{keys:"[ID]"},args:{root:{keys:"keys"}},fields:["key","title","handlerName","icon"]};t.default=i},266:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=(r=n(86))&&r.__esModule?r:{default:r};var o=a.default.shape({typeKey:a.default.string,Title:a.default.string,OpenInNew:a.default.bool});t.default=o},384:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=(r=n(86))&&r.__esModule?r:{default:r};var o=a.default.shape({title:a.default.string,description:a.default.string});t.default=o},686:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=(r=n(86))&&r.__esModule?r:{default:r};var o=a.default.shape({key:a.default.string.isRequired,icon:a.default.string,title:a.default.string.isRequired});t.default=o},614:function(e,t,n){var r;n.r(t),n.d(t,{NIL:function(){return T},parse:function(){return g},stringify:function(){return c},v1:function(){return v},v3:function(){return L},v4:function(){return C},v5:function(){return S},validate:function(){return l},version:function(){return R}});var a=new Uint8Array(16);function o(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(a)}var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var l=function(e){return"string"==typeof e&&i.test(e)},u=[],f=0;f<256;++f)u.push((f+256).toString(16).substr(1));var d,s,c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase();if(!l(n))throw TypeError("Stringified UUID is invalid");return n},p=0,y=0;var v=function(e,t,n){var r=t&&n||0,a=t||new Array(16),i=(e=e||{}).node||d,l=void 0!==e.clockseq?e.clockseq:s;if(null==i||null==l){var u=e.random||(e.rng||o)();null==i&&(i=d=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==l&&(l=s=16383&(u[6]<<8|u[7]))}var f=void 0!==e.msecs?e.msecs:Date.now(),v=void 0!==e.nsecs?e.nsecs:y+1,g=f-p+(v-y)/1e4;if(g<0&&void 0===e.clockseq&&(l=l+1&16383),(g<0||f>p)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=f,y=v,s=l;var m=(1e4*(268435455&(f+=122192928e5))+v)%4294967296;a[r++]=m>>>24&255,a[r++]=m>>>16&255,a[r++]=m>>>8&255,a[r++]=255&m;var k=f/4294967296*1e4&268435455;a[r++]=k>>>8&255,a[r++]=255&k,a[r++]=k>>>24&15|16,a[r++]=k>>>16&255,a[r++]=l>>>8|128,a[r++]=255&l;for(var h=0;h<6;++h)a[r+h]=i[h];return t||c(a)};var g=function(e){if(!l(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};var m="6ba7b810-9dad-11d1-80b4-00c04fd430c8",k="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function h(e,t,n){function r(e,r,a,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n>>9<<4)+1}function b(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function O(e,t,n,r,a,o){return b((i=b(b(t,e),b(r,o)))<<(l=a)|i>>>32-l,n);var i,l}function j(e,t,n,r,a,o,i){return O(t&n|~t&r,e,t,a,o,i)}function M(e,t,n,r,a,o,i){return O(t&r|n&~r,e,t,a,o,i)}function P(e,t,n,r,a,o,i){return O(t^n^r,e,t,a,o,i)}function w(e,t,n,r,a,o,i){return O(n^(t|~r),e,t,a,o,i)}var D=function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n>5]>>>a%32&255,i=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<>>32-t}var N=function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var a=0;a>>0;h=k,k=m,m=I(g,30)>>>0,g=v,v=O}n[0]=n[0]+v>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+m>>>0,n[3]=n[3]+k>>>0,n[4]=n[4]+h>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]},S=h("v5",80,N),T="00000000-0000-0000-0000-000000000000";var R=function(e){if(!l(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},939:function(e){e.exports=ApolloClient},510:function(e){e.exports=Config},42:function(e){e.exports=FieldHolder},912:function(e){e.exports=FormBuilderModal},648:function(e){e.exports=Injector},475:function(e){e.exports=InsertMediaModal},872:function(e){e.exports=NodeUrl},86:function(e){e.exports=PropTypes},363:function(e){e.exports=React},691:function(e){e.exports=ReactDomClient},624:function(e){e.exports=ReactRedux},127:function(e){e.exports=Reactstrap},827:function(e){e.exports=Redux},820:function(e){e.exports=classnames},754:function(e){e.exports=i18n},311:function(e){e.exports=jQuery},902:function(e){e.exports=qs}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(274),n(115)}(); \ No newline at end of file +!function(){"use strict";var e={274:function(e,t,n){var r=i(n(180)),a=i(n(521)),o=i(n(154));function i(e){return e&&e.__esModule?e:{default:e}}document.addEventListener("DOMContentLoaded",(()=>{(0,a.default)(),(0,o.default)(),(0,r.default)()}))},521:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=d(n(648)),a=d(n(809)),o=d(n(909)),i=d(n(852)),l=d(n(184)),u=d(n(117)),f=d(n(606));function d(e){return e&&e.__esModule?e:{default:e}}var s=()=>{r.default.component.registerMany({LinkPicker:a.default,LinkField:i.default,MultiLinkPicker:o.default,MultiLinkField:l.default,"LinkModal.FormBuilderModal":u.default,"LinkModal.InsertMediaModal":f.default})};t.default=s},154:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(648)),a=i(n(689)),o=i(n(287));function i(e){return e&&e.__esModule?e:{default:e}}var l=()=>{r.default.query.register("readLinkTypes",a.default),r.default.query.register("readLinkDescription",o.default)};t.default=l},180:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=()=>{};t.default=n},513:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.linkFieldPropTypes=t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(363)),a=n(648),o=u(n(86)),i=u(n(686)),l=u(n(384));function u(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}const d=e=>{let{id:t,loading:n,Loading:o,Picker:i,onChange:l,types:u,clearLinkData:f,buildLinkProps:d,updateLinkData:s,selectLinkData:c}=e;if(n)return r.default.createElement(o,null);const[p,y]=(0,r.useState)(!1),[v,g]=(0,r.useState)(""),m=c(p),k=u[m&&m.typeKey||v],h={...d(),onEdit:e=>{y(e)},onClear:(e,n)=>{"function"==typeof l&&l(e,{id:t,value:f(n)})},onSelect:e=>{g(e),y(!0)},types:Object.values(u)},_={type:k,editing:!1!==p,onSubmit:e=>{const{SecurityID:n,action_insert:r,...a}=e;return"function"==typeof l&&l(void 0,{id:t,value:s(a)}),y(!1),g(""),Promise.resolve()},onClosed:()=>(y(!1),Promise.resolve()),data:m},b=k?k.handlerName:"FormBuilderModal",O=(0,a.loadComponent)(`LinkModal.${b}`);return r.default.createElement(r.Fragment,null,r.default.createElement(i,h),r.default.createElement(O,_))},s={id:o.default.string.isRequired,loading:o.default.bool,Loading:o.default.elementType,data:o.default.any,Picker:o.default.elementType,onChange:o.default.func,types:o.default.objectOf(i.default),linkDescriptions:o.default.arrayOf(l.default)};t.linkFieldPropTypes=s,d.propTypes={...s,clearLinkData:o.default.func.isRequired,buildLinkProps:o.default.func.isRequired,updateLinkData:o.default.func.isRequired,selectLinkData:o.default.func.isRequired};var c=d;t.default=c},701:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(363)),a=n(827),o=n(732),i=n(648),l=u(n(42));function u(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;tt=>{let{data:n,value:a,...o}=t,i=a||n;return"string"==typeof i&&(i=JSON.parse(i)),r.default.createElement(e,f({dataStr:JSON.stringify(i)},o,{data:i}))}),(0,i.injectGraphql)("readLinkTypes"),(0,i.injectGraphql)("readLinkDescription"),o.withApollo,l.default);t.default=d},480:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(363)),a=i(n(86)),o=i(n(820));function i(e){return e&&e.__esModule?e:{default:e}}const l=e=>{let{className:t,children:n}=e;return r.default.createElement("div",{className:(0,o.default)("link-box","form-control",t)},n)};l.propTypes={className:a.default.string};var u=l;t.default=u},852:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(363)),a=n(827),o=n(648),i=(d(n(86)),d(n(266))),l=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(513)),u=d(n(701));function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const t={buildLinkProps:()=>{const{data:t,linkDescriptions:n,types:r}=e,{typeKey:a}=t,o=r[a],i=n.length>0?n[0]:{},{title:l,description:u}=i;return{title:l,description:u,type:o||void 0}},clearLinkData:()=>({}),updateLinkData:e=>e,selectLinkData:()=>e.data};return r.default.createElement(l.default,s({},e,t))};t.Component=c,c.propTypes={...l.linkFieldPropTypes,data:i.default};var p=(0,a.compose)((0,o.inject)(["LinkPicker","Loading"],((e,t)=>({Picker:e,Loading:t}))),u.default)(c);t.default=p},606:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var l=a?Object.getOwnPropertyDescriptor(e,o):null;l&&(l.get||l.set)?Object.defineProperty(r,o,l):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(363)),o=(r=n(475))&&r.__esModule?r:{default:r};function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;te({type:"INIT_FORM_SCHEMA_STACK",payload:{formSchema:{type:"insert-link",nextType:"admin"}}}),reset:()=>e({type:"RESET"})}}}))((e=>{let{type:t,editing:n,data:r,actions:i,onSubmit:u,...f}=e;if(!t)return!1;(0,a.useEffect)((()=>{n?i.initModal():i.reset()}),[n]);const d=r?{ID:r.FileID,Description:r.Title,TargetBlank:!!r.OpenInNew}:{};return a.default.createElement(o.default,l({isOpen:n,type:"insert-link",title:!1,bodyClassName:"modal__dialog",className:"insert-link__dialog-wrapper--internal",fileAttributes:d,onInsert:e=>{let{ID:n,Description:a,TargetBlank:o}=e;return u({FileID:n,ID:r?r.ID:void 0,Title:a,OpenInNew:o,typeKey:t.key},"",(()=>{}))}},f))}));t.default=u},117:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(363)),a=u(n(912)),o=u(n(872)),i=u(n(902)),l=u(n(510));function u(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{schemaUrl:n}=l.default.getSection("SilverStripe\\Admin\\LeftAndMain").form.DynamicLink,r=o.default.parse(n),a=i.default.parse(r.query);return a.key=e,t&&(a.data=JSON.stringify(t)),o.default.format({...r,search:i.default.stringify(a)})};var s=e=>{let{type:t,editing:n,data:o,...i}=e;return!!t&&r.default.createElement(a.default,f({title:t.title,isOpen:n,schemaUrl:d(t.key,o),identifier:"Link.EditingLinkInfo"},i))};t.default=s},809:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=d(n(363)),a=d(n(86)),o=d(n(820)),i=d(n(97)),l=d(n(734)),u=d(n(480)),f=d(n(686));function d(e){return e&&e.__esModule?e:{default:e}}const s=e=>{let{types:t,onSelect:n,title:a,description:f,type:d,onEdit:s,onClear:c}=e;return r.default.createElement(u.default,{className:(0,o.default)("link-picker",{"link-picker--selected":d})},d?r.default.createElement(l.default,{description:f,title:a,type:d,onClear:c,onClick:()=>s&&s()}):r.default.createElement(i.default,{types:t,onSelect:n}))};t.Component=s,s.propTypes={...i.default.propTypes,onEdit:a.default.func,onClear:a.default.func,title:a.default.string,description:a.default.string,type:f.default};var c=s;t.default=c},97:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=f(n(754)),a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(363)),o=f(n(86)),i=n(127),l=f(n(686));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function f(e){return e&&e.__esModule?e:{default:e}}const d=e=>{let{types:t,onSelect:n}=e;const[o,l]=(0,a.useState)(!1);return a.default.createElement(i.Dropdown,{isOpen:o,toggle:()=>l((e=>!e)),className:"link-menu"},a.default.createElement(i.DropdownToggle,{className:"link-menu__toggle font-icon-link",caret:!0},r.default._t("Link.ADD_LINK","Add Link")),a.default.createElement(i.DropdownMenu,null,t.map((e=>{let{key:t,title:r,icon:o}=e;return a.default.createElement(i.DropdownItem,{className:`font-icon-${o||"link"}`,key:t,onClick:()=>n(t)},r)}))))};d.propTypes={types:o.default.arrayOf(l.default).isRequired,onSelect:o.default.func.isRequired};var s=d;t.default=s},734:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(754)),a=u(n(363)),o=u(n(86)),i=u(n(686)),l=n(127);function u(e){return e&&e.__esModule?e:{default:e}}const f=e=>t=>{t.nativeEvent.stopImmediatePropagation(),t.preventDefault(),t.nativeEvent.preventDefault(),t.stopPropagation(),e&&e()},d=e=>{let{title:t,type:n,description:o,onClear:i,onClick:u,className:d}=e;return a.default.createElement(l.Button,{className:classnames("link-title",`font-icon-${n.icon||"link"}`,d),color:"secondary",onClick:f(u)},a.default.createElement("div",{className:"link-title__detail"},a.default.createElement("div",{className:"link-title__title"},t),a.default.createElement("small",{className:"link-title__type"},n.title,": ",a.default.createElement("span",{className:"link-title__url"},o))),a.default.createElement(l.Button,{tag:"a",className:"link-title__clear",color:"link",onClick:f(i)},r.default._t("Link.CLEAR","Clear")))};d.propTypes={title:o.default.string.isRequired,type:i.default,description:o.default.string,onClear:o.default.func,onClick:o.default.func},d.defaultProps={type:{}};var s=d;t.default=s},184:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=c(n(363)),a=n(827),o=n(648),i=c(n(86)),l=n(614),u=c(n(266)),f=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(513)),d=c(n(701));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}function c(e){return e&&e.__esModule?e:{default:e}}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const t={buildLinkProps:()=>{return{links:(t=e.data,n=e.linkDescriptions,t.map((e=>{const t=n.find((t=>{let{id:n}=t;return n.toString()===e.ID.toString()}));return{...e,...t}})))};var t,n},clearLinkData:t=>e.data.filter((e=>{let{ID:n}=e;return n!==t})),updateLinkData:t=>{const{data:n}=e;return t.ID?n.map((e=>e.ID===t.ID?t:e)):[...n,{...t,ID:(0,l.v4)(),isNew:!0}]},selectLinkData:t=>e.data.find((e=>{let{ID:n}=e;return n===t}))||void 0};return r.default.createElement(f.default,p({},e,t))};t.Component=y,y.propTypes={...f.linkFieldPropTypes,data:i.default.arrayOf(u.default)};var v=(0,a.compose)((0,o.inject)(["MultiLinkPicker","Loading"],((e,t)=>({Picker:e,Loading:t}))),d.default)(y);t.default=v},909:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var r=u(n(363)),a=u(n(86)),o=u(n(97)),i=u(n(734)),l=u(n(480));function u(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{types:t,onSelect:n,links:a,onEdit:u,onClear:d}=e;return r.default.createElement("div",{className:"multi-link-picker"},r.default.createElement(l.default,{className:"multi-link-picker__picker"},r.default.createElement(o.default,{types:t,onSelect:n})),a.length>0&&r.default.createElement(l.default,{className:"multi-link-picker__list"},a.map((e=>{let{ID:n,...a}=e;return r.default.createElement(i.default,f({},a,{className:"multi-link-picker__link",type:t.find((e=>e.key===a.typeKey)),key:`${n} ${a.description}`,onClear:e=>d(e,n),onClick:()=>u(n)}))}))))};t.Component=d,d.propTypes={...o.default.propTypes,links:a.default.arrayOf(a.default.shape(i.default.propTypes)),onEdit:a.default.func,onClear:a.default.func};var s=d;t.default=s},115:function(e,t,n){var r=l(n(311)),a=l(n(363)),o=l(n(691)),i=n(648);function l(e){return e&&e.__esModule?e:{default:e}}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e(".js-injector-boot .entwine-jsonfield").entwine({Component:null,Root:null,onmatch(){const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=this.data("schema-component"),r=(0,i.loadComponent)(n,t);this.setComponent(r),this.setRoot(o.default.createRoot(this[0])),this._super(),this.refresh()},refresh(){const e=this.getProps(),t=this.getComponent();this.getRoot().render(a.default.createElement(t,u({},e,{noHolder:!0})))},handleChange(t,n){let{value:r}=n;const a=e(this).data("field-id");e(`#${a}`).val(JSON.stringify(r)).trigger("change"),this.refresh()},getProps(){const t=e(this).data("field-id"),n=e(`#${t}`).val();return{id:t,value:n?JSON.parse(n):void 0,onChange:this.handleChange.bind(this)}},onunmatch(){this.getRoot().unmount()}})}))},287:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(648);const a={props(e){const{data:{error:t,readLinkDescription:n,loading:r}}=e;return{loading:r,linkDescriptions:n||[],graphQLErrors:t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message))}}},{READ:o}=r.graphqlTemplates;var i={apolloConfig:a,templateName:o,pluralName:"LinkDescription",pagination:!1,params:{dataStr:"String!"},args:{root:{dataStr:"dataStr"}},fields:["id","description","title"]};t.default=i},689:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(648);const a={props(e){const{data:{error:t,readLinkTypes:n,loading:r}}=e,a=t&&t.graphQLErrors&&t.graphQLErrors.map((e=>e.message));return{loading:r,types:n?n.reduce(((e,t)=>({...e,[t.key]:t})),{}):{},graphQLErrors:a}}},{READ:o}=r.graphqlTemplates;var i={apolloConfig:a,templateName:o,pluralName:"LinkTypes",pagination:!1,params:{keys:"[ID]"},args:{root:{keys:"keys"}},fields:["key","title","handlerName","icon"]};t.default=i},266:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=(r=n(86))&&r.__esModule?r:{default:r};var o=a.default.shape({typeKey:a.default.string,Title:a.default.string,OpenInNew:a.default.bool});t.default=o},384:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=(r=n(86))&&r.__esModule?r:{default:r};var o=a.default.shape({title:a.default.string,description:a.default.string});t.default=o},686:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,a=(r=n(86))&&r.__esModule?r:{default:r};var o=a.default.shape({key:a.default.string.isRequired,icon:a.default.string,title:a.default.string.isRequired});t.default=o},614:function(e,t,n){var r;n.r(t),n.d(t,{NIL:function(){return T},parse:function(){return g},stringify:function(){return c},v1:function(){return v},v3:function(){return L},v4:function(){return C},v5:function(){return S},validate:function(){return l},version:function(){return R}});var a=new Uint8Array(16);function o(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(a)}var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var l=function(e){return"string"==typeof e&&i.test(e)},u=[],f=0;f<256;++f)u.push((f+256).toString(16).substr(1));var d,s,c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase();if(!l(n))throw TypeError("Stringified UUID is invalid");return n},p=0,y=0;var v=function(e,t,n){var r=t&&n||0,a=t||new Array(16),i=(e=e||{}).node||d,l=void 0!==e.clockseq?e.clockseq:s;if(null==i||null==l){var u=e.random||(e.rng||o)();null==i&&(i=d=[1|u[0],u[1],u[2],u[3],u[4],u[5]]),null==l&&(l=s=16383&(u[6]<<8|u[7]))}var f=void 0!==e.msecs?e.msecs:Date.now(),v=void 0!==e.nsecs?e.nsecs:y+1,g=f-p+(v-y)/1e4;if(g<0&&void 0===e.clockseq&&(l=l+1&16383),(g<0||f>p)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=f,y=v,s=l;var m=(1e4*(268435455&(f+=122192928e5))+v)%4294967296;a[r++]=m>>>24&255,a[r++]=m>>>16&255,a[r++]=m>>>8&255,a[r++]=255&m;var k=f/4294967296*1e4&268435455;a[r++]=k>>>8&255,a[r++]=255&k,a[r++]=k>>>24&15|16,a[r++]=k>>>16&255,a[r++]=l>>>8|128,a[r++]=255&l;for(var h=0;h<6;++h)a[r+h]=i[h];return t||c(a)};var g=function(e){if(!l(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};var m="6ba7b810-9dad-11d1-80b4-00c04fd430c8",k="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function h(e,t,n){function r(e,r,a,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n>>9<<4)+1}function b(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function O(e,t,n,r,a,o){return b((i=b(b(t,e),b(r,o)))<<(l=a)|i>>>32-l,n);var i,l}function j(e,t,n,r,a,o,i){return O(t&n|~t&r,e,t,a,o,i)}function M(e,t,n,r,a,o,i){return O(t&r|n&~r,e,t,a,o,i)}function P(e,t,n,r,a,o,i){return O(t^n^r,e,t,a,o,i)}function w(e,t,n,r,a,o,i){return O(n^(t|~r),e,t,a,o,i)}var D=function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n>5]>>>a%32&255,i=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<>>32-t}var N=function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var a=0;a>>0;h=k,k=m,m=I(g,30)>>>0,g=v,v=O}n[0]=n[0]+v>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+m>>>0,n[3]=n[3]+k>>>0,n[4]=n[4]+h>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]},S=h("v5",80,N),T="00000000-0000-0000-0000-000000000000";var R=function(e){if(!l(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},732:function(e){e.exports=ApolloClientReactHoc},510:function(e){e.exports=Config},42:function(e){e.exports=FieldHolder},912:function(e){e.exports=FormBuilderModal},648:function(e){e.exports=Injector},475:function(e){e.exports=InsertMediaModal},872:function(e){e.exports=NodeUrl},86:function(e){e.exports=PropTypes},363:function(e){e.exports=React},691:function(e){e.exports=ReactDomClient},624:function(e){e.exports=ReactRedux},127:function(e){e.exports=Reactstrap},827:function(e){e.exports=Redux},820:function(e){e.exports=classnames},754:function(e){e.exports=i18n},311:function(e){e.exports=jQuery},902:function(e){e.exports=qs}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(274),n(115)}(); \ No newline at end of file diff --git a/client/src/components/AbstractLinkField/linkFieldHOC.js b/client/src/components/AbstractLinkField/linkFieldHOC.js index 54cb7063..4fb7a3d8 100644 --- a/client/src/components/AbstractLinkField/linkFieldHOC.js +++ b/client/src/components/AbstractLinkField/linkFieldHOC.js @@ -1,6 +1,6 @@ import React from 'react'; import { compose } from 'redux'; -import { withApollo } from '@apollo/client'; +import { withApollo } from '@apollo/client/react/hoc'; import { injectGraphql } from 'lib/Injector'; import fieldHolder from 'components/FieldHolder/FieldHolder'; @@ -16,6 +16,7 @@ const stringifyData = (Component) => (({ data, value, ...props }) => { return ; }); + /** * Wires a Link field into GraphQL normalise the initial data to a proper objects */ diff --git a/src/Form/JsonField.php b/src/Form/JsonField.php index 055a8af9..22da4f4c 100644 --- a/src/Form/JsonField.php +++ b/src/Form/JsonField.php @@ -8,7 +8,6 @@ use SilverStripe\LinkField\JsonData; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; -use SilverStripe\Link\JsonData; /** * Field designed to edit complex data passed as a JSON string. Other FormFields can be built on top of this one. diff --git a/src/Form/MultiLinkField.php b/src/Form/MultiLinkField.php index 7065838a..8ae2cf17 100644 --- a/src/Form/MultiLinkField.php +++ b/src/Form/MultiLinkField.php @@ -1,9 +1,9 @@ 'Varchar(255)', ]; - public function generateLinkDescription(array $data): string + public function generateLinkDescription(array $data): array { $description = isset($data['Email']) ? $data['Email'] : ''; $title = empty($data['Title']) ? $description : $data['Title']; diff --git a/src/Models/Link.php b/src/Models/Link.php index 60c4d806..f007572a 100644 --- a/src/Models/Link.php +++ b/src/Models/Link.php @@ -209,6 +209,9 @@ public function jsonSerialize(): mixed } $data = $this->toMap(); + + $data['OpenInNew'] = boolval($data['OpenInNew']); + $data['typeKey'] = $typeKey; // Some of our models (SiteTreeLink in particular) have defined getTitle() methods. We *don't* want to override // the 'Title' field (which represent the literal 'Title' Database field) - if we did that, then it would also diff --git a/src/Models/PhoneLink.php b/src/Models/PhoneLink.php index 855e3b1c..e4db2914 100644 --- a/src/Models/PhoneLink.php +++ b/src/Models/PhoneLink.php @@ -15,9 +15,15 @@ class PhoneLink extends Link 'Phone' => 'Varchar(255)', ]; - public function generateLinkDescription(array $data): string + public function generateLinkDescription(array $data): array { - return isset($data['Phone']) ? $data['Phone'] : ''; + if (isset($data)) { + return [ + 'title' => $data['Phone'] + ]; + } + + return []; } public function getURL(): string diff --git a/tests/php/Form/MultiLinkFieldTest.php b/tests/php/Form/MultiLinkFieldTest.php index aa420a16..4c67c7f9 100644 --- a/tests/php/Form/MultiLinkFieldTest.php +++ b/tests/php/Form/MultiLinkFieldTest.php @@ -1,12 +1,12 @@ SilverStripe\Link\Tests\LinkOwner.link-owner-1 -SilverStripe\Link\Tests\LinkOwner: +SilverStripe\LinkField\Tests\LinkOwner: link-owner-1: Title: A Link owner Links: - - =>SilverStripe\Link\Models\ExternalLink.link-2 + - =>SilverStripe\LinkField\Models\ExternalLink.link-2 diff --git a/tests/php/LinkOwner.php b/tests/php/LinkOwner.php index aa2c2afb..92f6d0f2 100644 --- a/tests/php/LinkOwner.php +++ b/tests/php/LinkOwner.php @@ -1,10 +1,10 @@