From bb68cdb9c27731fc3fcec07c97110afec8314b06 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Wed, 20 Dec 2023 14:27:59 +0800 Subject: [PATCH] critical patch for `StoreLocation` http resource --- addon/components/modals/import-products.hbs | 2 +- addon/components/widget/orders.js | 4 ++++ index.js | 15 +++++++++++++++ server/src/Http/Resources/StoreLocation.php | 3 +-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/addon/components/modals/import-products.hbs b/addon/components/modals/import-products.hbs index 2ba4490..e5cac32 100644 --- a/addon/components/modals/import-products.hbs +++ b/addon/components/modals/import-products.hbs @@ -3,7 +3,7 @@ {{#if @options.isProcessing}}
- +
{{else}} diff --git a/addon/components/widget/orders.js b/addon/components/widget/orders.js index 5e8befb..b2488a8 100644 --- a/addon/components/widget/orders.js +++ b/addon/components/widget/orders.js @@ -17,6 +17,10 @@ export default class WidgetOrdersComponent extends Component { return this.args.title ?? 'Recent Orders'; } + constructor() { + super(...arguments); + } + @action async setupWidget() { later( this, diff --git a/index.js b/index.js index f7ceeee..b981b51 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,8 @@ const { buildEngine } = require('ember-engines/lib/engine-addon'); const { name } = require('./package'); const Funnel = require('broccoli-funnel'); +const MergeTrees = require('broccoli-merge-trees'); +const path = require('path'); module.exports = buildEngine({ name, @@ -23,4 +25,17 @@ module.exports = buildEngine({ isDevelopingAddon() { return true; }, + + treeForPublic: function () { + const publicTree = this._super.treeForPublic.apply(this, arguments); + + const addonTree = [ + new Funnel(path.join(__dirname, 'assets'), { + destDir: '/', + }), + ]; + + // Merge the addon tree with the existing tree + return publicTree ? new MergeTrees([publicTree, ...addonTree], { overwrite: true }) : new MergeTrees([...addonTree], { overwrite: true }); + }, }); diff --git a/server/src/Http/Resources/StoreLocation.php b/server/src/Http/Resources/StoreLocation.php index eebf37e..41e7fef 100644 --- a/server/src/Http/Resources/StoreLocation.php +++ b/server/src/Http/Resources/StoreLocation.php @@ -3,7 +3,6 @@ namespace Fleetbase\Storefront\Http\Resources; use Fleetbase\FleetOps\Http\Resources\v1\Place; -use Fleetbase\FleetOps\Http\Resources\Internal\v1\Place as InternalPlace; use Fleetbase\Http\Resources\FleetbaseResource; use Fleetbase\Support\Http; @@ -24,7 +23,7 @@ public function toArray($request) 'store' => data_get($this, 'store.public_id'), 'store_data' => $this->when($request->boolean('with_store'), new Store($this->store)), 'name' => $this->name, - 'place' => $this->when(Http::isInternalRequest(), new InternalPlace($this->place), new Place($this->place)), + 'place' => $this->place ? new Place($this->place) : null, 'hours' => StoreHour::collection($this->hours), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at,