| 1 |
(()=>{"use strict";var e={8158(e,t,n){const s=window.wp.blocks,a=window.wp.i18n,i=window.GetwidComponents,o=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"textdomain":"getwid","name":"getwid/instagram","description":"Displays posts from an Instagram account.","category":"getwid-blocks","title":"Instagram","supports":{"align":["wide","full"]},"attributes":{"photoCount":{"type":"number","default":6},"gridColumns":{"type":"number","default":3},"spacing":{"type":"string","default":"default"},"align":{"type":"string"},"className":{"type":"string"}},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'),r=window.wp.blockEditor,l=window.wp.components,c=window.wp.element,d=window.jQuery;var g=n.n(d);const u=window.ReactJSXRuntime;function p({attributes:e,setAttributes:t}){const{photoCount:n,gridColumns:s,spacing:i}=e;return(0,u.jsx)(r.InspectorControls,{children:(0,u.jsxs)(l.PanelBody,{title:(0,a.__)("Settings","getwid"),initialOpen:!0,children:[(0,u.jsx)(l.RangeControl,{label:(0,a.__)("Number of items","getwid"),value:n,onChange:(e=6)=>t({photoCount:e}),allowReset:!0,min:1,max:100,step:1}),(0,u.jsx)(l.RangeControl,{label:(0,a.__)("Columns","getwid"),value:s,onChange:(e=3)=>t({gridColumns:e}),allowReset:!0,min:1,max:6,step:1}),(0,u.jsx)(l.SelectControl,{label:(0,a.__)("Spacing","getwid"),value:i,onChange:e=>t({spacing:e}),options:[{value:"default",label:(0,a.__)("Default","getwid")},{value:"none",label:(0,a.__)("None","getwid")},{value:"small",label:(0,a.__)("Small","getwid")},{value:"medium",label:(0,a.__)("Medium","getwid")},{value:"normal",label:(0,a.__)("Normal","getwid")},{value:"large",label:(0,a.__)("Large","getwid")}]})]})})}const m=window.wp.serverSideRender,w=(0,u.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",x:"0px",y:"0px",children:[(0,u.jsx)("path",{d:"M17.11,2C19.81,2,22,4.19,22,6.89v10.22c0,2.7-2.19,4.89-4.89,4.89H6.89C4.19,22,2,19.81,2,17.11V6.89C2,4.19,4.19,2,6.89,2 H17.11 M17.11,0H6.89C3.09,0,0,3.09,0,6.89v10.22C0,20.91,3.09,24,6.89,24h10.22c3.81,0,6.89-3.09,6.89-6.89V6.89 C24,3.09,20.91,0,17.11,0L17.11,0z"}),(0,u.jsx)("path",{d:"M18.5,4L18.5,4C19.33,4,20,4.67,20,5.5v0C20,6.33,19.33,7,18.5,7h0C17.67,7,17,6.33,17,5.5v0C17,4.67,17.67,4,18.5,4z"}),(0,u.jsx)("path",{d:"M12,8c2.21,0,4,1.79,4,4s-1.79,4-4,4s-4-1.79-4-4S9.79,8,12,8 M12,6c-3.31,0-6,2.69-6,6s2.69,6,6,6s6-2.69,6-6S15.31,6,12,6 L12,6z"})]});(0,s.registerBlockType)(o,{title:(0,a.__)("Instagram","getwid"),icon:w,edit:(0,i.MaybeBlockIsDisabled)("getwid/instagram")||function(e){const{attributes:t,setAttributes:n,className:s}=e,[i,o]=(0,c.useState)(Getwid.settings.instagram_token_isset),d=(0,r.useBlockProps)();return i?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(p,{...e}),(0,u.jsx)("div",{...d,children:(0,u.jsx)(l.Disabled,{children:(0,u.jsx)(m.ServerSideRender,{block:"getwid/instagram",attributes:t})})})]}):(0,u.jsx)("div",{...d,children:(0,u.jsxs)("form",{className:`${s||"wp-block-getwid-instagram"}__key-form`,onSubmit:e=>{e.preventDefault(),g().post(Getwid.ajax_url,{action:"check_instagram_token",data:"",nonce:Getwid.nonces.check_instagram_token},e=>{const t=!!e.data;Getwid.settings.instagram_token_isset=t,o(t)})},children:[(0,u.jsx)("span",{className:"form-title",children:(0,a.__)("Connect Instagram Account","getwid")}),(0,u.jsxs)("div",{className:"form-wrapper",children:[(0,u.jsx)("a",{href:"https://www.instagram.com/oauth/authorize?enable_fb_login=0&force_authentication=0&client_id=1815611002603068&redirect_uri=https://api.getmotopress.com/get_instagram_token2.php&scope=instagram_business_basic&response_type=code&state="+Getwid.get_instagram_token_url,target:"_blank",rel:"noreferrer",className:"components-button is-button is-primary getwid-instagram-auth-button",children:(0,a.__)("Connect Instagram Account","getwid")}),(0,u.jsx)(l.Button,{variant:"secondary",type:"submit",children:(0,a.__)("Update","getwid")})]}),(0,u.jsx)("span",{className:"form-description",children:(0,a.__)("Click Connect Instagram Account and authorize the app in a new tab to receive access token. Then return to this tab and click Update. You can revoke the granted access any time in your Instagram profile settings.","getwid")})]})})},save:()=>null})}};const t={};function n(s){const a=t[s];if(void 0!==a)return a.exports;const i=t[s]={exports:{}};return e[s](i,i.exports,n),i.exports}n.m=e,(()=>{const e=[];n.O=(t,s,a,i)=>{if(s){i=i||0;for(var o=e.length;o>0&&e[o-1][2]>i;o--)e[o]=e[o-1];return void(e[o]=[s,a,i])}let r=1/0;for(o=0;o<e.length;o++){let[s,a,i]=e[o],c=!0;for(var l=0;l<s.length;l++)(!1&i||r>=i)&&Object.keys(n.O).every(e=>n.O[e](s[l]))?s.splice(l--,1):(c=!1,i<r&&(r=i));if(c){e.splice(o--,1);const n=a();void 0!==n&&(t=n)}}return t}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{if(Array.isArray(t))for(var s=0;s<t.length;){var a=t[s++],i=t[s++];n.o(e,a)?0===i&&s++:0===i?Object.defineProperty(e,a,{enumerable:!0,value:t[s++]}):Object.defineProperty(e,a,{enumerable:!0,get:i})}else for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={4504:0,4592:0};n.O.j=t=>0===e[t];const t=(t,s)=>{let[a,i,o]=s;var r,l,c=0;if(a.some(t=>0!==e[t])){for(r in i)n.o(i,r)&&(n.m[r]=i[r]);if(o)var d=o(n)}for(t&&t(s);c<a.length;c++)l=a[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(d)},s=globalThis.webpackChunkgetwid||=[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();let s=n.O(void 0,[4592],()=>n(8158));s=n.O(s)})(); |