amelia-booking
5 months ago
amelia-catalog
5 months ago
amelia-catalog-booking
2 months ago
amelia-events
5 months ago
amelia-events-calendar-booking
2 months ago
amelia-events-list-booking
2 months ago
amelia-events-list-booking-button
3 months ago
amelia-step-booking
2 months ago
amelia-step-booking-button
2 months ago
amelia-block-icon.js
2 months ago
amelia-gutenberg-placeholder.css
5 months ago
amelia-block-icon.js
134 lines
| 1 | /* eslint-disable quotes */ |
| 2 | (function (wp) { |
| 3 | var el = wp.element.createElement |
| 4 | |
| 5 | // Shared Amelia block icon |
| 6 | window.ameliaBlockIcon = el( |
| 7 | "svg", |
| 8 | { |
| 9 | width: "20", |
| 10 | height: "20", |
| 11 | viewBox: "0 0 20 20", |
| 12 | fill: "none", |
| 13 | xmlns: "http://www.w3.org/2000/svg" |
| 14 | }, |
| 15 | el("path", { |
| 16 | d: "M11.0084 1.32972V7.10632C11.0084 7.58281 11.2628 8.02212 11.675 8.25862L16.6701 11.1222C17.5529 11.6284 18.6513 10.9892 18.6513 9.96993V4.22064C18.6513 3.74647 18.3991 3.30833 17.9893 3.07124L12.9942 0.179748C12.1114 -0.331029 11.0078 0.307587 11.0078 1.32914L11.0084 1.32972Z", |
| 17 | fill: "#4A3BD6" |
| 18 | }), |
| 19 | el("path", { |
| 20 | d: "M9.64395 1.32972V7.10632C9.64395 7.58281 9.3895 8.02212 8.97739 8.25862L3.98222 11.1222C3.09946 11.6284 2.00108 10.9892 2.00108 9.96993V4.22064C2.00108 3.74647 2.25321 3.30833 2.663 3.07124L7.65817 0.179748C8.54093 -0.331029 9.64453 0.307587 9.64453 1.32914L9.64395 1.32972Z", |
| 21 | fill: "#7165DF" |
| 22 | }), |
| 23 | el("path", { |
| 24 | d: "M9.5927 9.40127L4.56913 12.2811C3.68231 12.7896 3.67941 14.0709 4.56449 14.5828L9.58806 17.4906C9.99785 17.7277 10.5027 17.7277 10.9119 17.4906L15.9355 14.5828C16.8206 14.0709 16.8177 12.7896 15.9308 12.2811L10.9073 9.40127C10.4998 9.16767 10.0002 9.16767 9.5927 9.40127Z", |
| 25 | fill: "#9E94F8" |
| 26 | }) |
| 27 | ) |
| 28 | |
| 29 | // Shared Gutenberg helpers (icon script loads first for all Amelia blocks). |
| 30 | window.ameliaGutenbergShared = window.ameliaGutenbergShared || {} |
| 31 | |
| 32 | window.ameliaGutenbergShared.getSharedShortcodeDepricatedAttributes = function () { |
| 33 | return { |
| 34 | ivy: {type: 'string', default: ''}, |
| 35 | trigger: {type: 'string', default: ''}, |
| 36 | trigger_type: {type: 'string', default: 'id'}, |
| 37 | in_dialog: {type: 'boolean', default: false}, |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | window.ameliaGutenbergShared.getSharedShortcodeAttributes = function () { |
| 42 | return { |
| 43 | ivy: { |
| 44 | type: 'string', |
| 45 | default: '' |
| 46 | }, |
| 47 | trigger: { |
| 48 | type: 'string', |
| 49 | default: '' |
| 50 | }, |
| 51 | trigger_type: { |
| 52 | type: 'string', |
| 53 | default: 'id' |
| 54 | }, |
| 55 | in_dialog: { |
| 56 | type: 'boolean', |
| 57 | default: false |
| 58 | }, |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | window.ameliaGutenbergShared.setSharedShortcodeElements = function (inspectorElements, components, attributes, props, options, data) { |
| 63 | inspectorElements.push(el(components.TextControl, { |
| 64 | id: 'amelia-js-trigger', |
| 65 | label: wpAmeliaLabels.manually_loading, |
| 66 | value: attributes.trigger, |
| 67 | help: wpAmeliaLabels.manually_loading_description, |
| 68 | onChange: function (TextControl) { |
| 69 | return props.setAttributes({trigger: TextControl}) |
| 70 | } |
| 71 | })) |
| 72 | |
| 73 | if (attributes.trigger) { |
| 74 | inspectorElements.push(el(components.SelectControl, { |
| 75 | id: 'amelia-js-trigger_type', |
| 76 | label: wpAmeliaLabels.trigger_type, |
| 77 | value: attributes.trigger_type, |
| 78 | options: options.trigger_type, |
| 79 | help: wpAmeliaLabels.trigger_type_tooltip, |
| 80 | onChange: function (selectControl) { |
| 81 | return props.setAttributes({trigger_type: selectControl}) |
| 82 | } |
| 83 | })) |
| 84 | |
| 85 | inspectorElements.push(el(components.PanelRow, |
| 86 | {}, |
| 87 | el('label', {htmlFor: 'amelia-js-in-dialog'}, wpAmeliaLabels.in_dialog), |
| 88 | el(components.FormToggle, { |
| 89 | id: 'amelia-js-in-dialog', |
| 90 | checked: attributes.in_dialog, |
| 91 | onChange: function () { |
| 92 | return props.setAttributes({in_dialog: !props.attributes.in_dialog}) |
| 93 | } |
| 94 | }) |
| 95 | )) |
| 96 | } |
| 97 | |
| 98 | if (!attributes.trigger && data.ivy && data.ivy.length) { |
| 99 | inspectorElements.push(el(components.SelectControl, { |
| 100 | id: "amelia-js-select-ivy", |
| 101 | label: wpAmeliaLabels.ivy, |
| 102 | help: wpAmeliaLabels.ivy_tooltip, |
| 103 | value: String(attributes.ivy), |
| 104 | options: data.ivy, |
| 105 | onChange: function (selectControl) { |
| 106 | return props.setAttributes({ivy: selectControl}) |
| 107 | } |
| 108 | })) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | window.ameliaGutenbergShared.getSharedShortcodeString = function (attributes) { |
| 113 | let shortCode = '' |
| 114 | |
| 115 | if (attributes.trigger) { |
| 116 | shortCode += ' trigger=' + attributes.trigger + '' |
| 117 | } |
| 118 | |
| 119 | if (attributes.trigger && attributes.trigger_type) { |
| 120 | shortCode += ' trigger_type=' + attributes.trigger_type + '' |
| 121 | } |
| 122 | |
| 123 | if (attributes.trigger && attributes.in_dialog) { |
| 124 | shortCode += ' in_dialog=1' |
| 125 | } |
| 126 | |
| 127 | if (attributes.trigger === '' && attributes.ivy) { |
| 128 | shortCode += ' ivy=' + attributes.ivy + '' |
| 129 | } |
| 130 | |
| 131 | return shortCode |
| 132 | } |
| 133 | })(window.wp) |
| 134 |