55 lines
2.4 KiB
HTML
55 lines
2.4 KiB
HTML
<script type="text/javascript">
|
||
RED.nodes.registerType("woocommerce-config", {
|
||
category: "config",
|
||
defaults: {
|
||
name: { value: "" },
|
||
baseUrl: { value: "https://shop.hanssonit.se/wp-json/wc/v3", required: true }
|
||
},
|
||
credentials: {
|
||
consumerKey: { type: "text" },
|
||
consumerSecret: { type: "password" }
|
||
},
|
||
label: function () {
|
||
return this.name || this.baseUrl || "WooCommerce";
|
||
},
|
||
labelStyle: function () {
|
||
return this.name ? "node_label_italic" : "";
|
||
}
|
||
});
|
||
</script>
|
||
|
||
<script type="text/x-red" data-template-name="woocommerce-config">
|
||
<div class="form-row">
|
||
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
||
<input type="text" id="node-config-input-name" placeholder="WooCommerce Config">
|
||
</div>
|
||
<div class="form-row">
|
||
<label for="node-config-input-baseUrl"><i class="fa fa-server"></i> Base URL</label>
|
||
<input type="text" id="node-config-input-baseUrl" placeholder="https://shop.hanssonit.se/wp-json/wc/v3">
|
||
</div>
|
||
<div class="form-row">
|
||
<label for="node-config-input-consumerKey"><i class="fa fa-key"></i> Consumer Key</label>
|
||
<input type="text" id="node-config-input-consumerKey" autocomplete="off">
|
||
</div>
|
||
<div class="form-row">
|
||
<label for="node-config-input-consumerSecret"><i class="fa fa-lock"></i> Consumer Secret</label>
|
||
<input type="password" id="node-config-input-consumerSecret" autocomplete="off">
|
||
<div class="form-tips" style="color:#888; font-size:11px; margin-top:4px;">
|
||
Create API key at: WooCommerce → Settings → Advanced → REST API.<br>
|
||
Key must have <b>Read</b> permission (preferably Read/Write).<br>
|
||
User bound to key must be <b>Administrator</b> or equivalent.
|
||
</div>
|
||
</div>
|
||
</script>
|
||
|
||
<script type="text/x-red" data-help-name="woocommerce-config">
|
||
<p>WooCommerce REST API configuration node.</p>
|
||
<h3>Details</h3>
|
||
<p>Configure your WooCommerce store connection.</p>
|
||
<ul>
|
||
<li><b>Base URL</b> – Must be <code>https://shop.hanssonit.se/wp-json/wc/v3</code></li>
|
||
<li><b>Consumer Key</b> – From WooCommerce → Settings → Advanced → REST API</li>
|
||
<li><b>Consumer Secret</b> – Paired with Consumer Key</li>
|
||
</ul>
|
||
</script>
|