@fleetbase/storefront-engine 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/addon/controllers/products/index/category/new.js +5 -9
  2. package/addon/models/product-addon-category.js +10 -1
  3. package/addon/models/product-variant.js +0 -2
  4. package/addon/models/product.js +35 -2
  5. package/addon/serializers/product.js +16 -0
  6. package/addon/templates/products/index/category/new.hbs +2 -2
  7. package/composer.json +3 -3
  8. package/extension.json +1 -1
  9. package/package.json +132 -132
  10. package/server/src/Auth/Schemas/Storefront.php +31 -39
  11. package/server/src/Console/Commands/NotifyStorefrontOrderNearby.php +9 -11
  12. package/server/src/Expansions/ContactFilterExpansion.php +1 -1
  13. package/server/src/Expansions/EntityExpansion.php +12 -12
  14. package/server/src/Expansions/OrderFilterExpansion.php +1 -1
  15. package/server/src/Expansions/VendorFilterExpansion.php +1 -1
  16. package/server/src/Http/Controllers/ActionController.php +9 -11
  17. package/server/src/Http/Controllers/AddonCategoryController.php +1 -1
  18. package/server/src/Http/Controllers/CustomerController.php +1 -1
  19. package/server/src/Http/Controllers/GatewayController.php +1 -1
  20. package/server/src/Http/Controllers/MetricsController.php +17 -17
  21. package/server/src/Http/Controllers/NetworkController.php +16 -26
  22. package/server/src/Http/Controllers/NotificationChannelController.php +1 -1
  23. package/server/src/Http/Controllers/OrderController.php +18 -22
  24. package/server/src/Http/Controllers/ProductAddonCategoryController.php +1 -2
  25. package/server/src/Http/Controllers/ProductAddonController.php +1 -2
  26. package/server/src/Http/Controllers/ProductController.php +89 -44
  27. package/server/src/Http/Controllers/ProductHourController.php +1 -1
  28. package/server/src/Http/Controllers/ProductVariantController.php +1 -1
  29. package/server/src/Http/Controllers/ProductVariantOptionController.php +1 -1
  30. package/server/src/Http/Controllers/ReviewController.php +1 -1
  31. package/server/src/Http/Controllers/StoreController.php +1 -2
  32. package/server/src/Http/Controllers/StoreHourController.php +1 -1
  33. package/server/src/Http/Controllers/StoreLocationController.php +1 -1
  34. package/server/src/Http/Controllers/StorefrontController.php +0 -2
  35. package/server/src/Http/Controllers/VoteController.php +1 -1
  36. package/server/src/Http/Controllers/v1/CartController.php +16 -26
  37. package/server/src/Http/Controllers/v1/CategoryController.php +3 -4
  38. package/server/src/Http/Controllers/v1/CheckoutController.php +283 -286
  39. package/server/src/Http/Controllers/v1/CustomerController.php +54 -67
  40. package/server/src/Http/Controllers/v1/GatewayControllerController.php +0 -2
  41. package/server/src/Http/Controllers/v1/NetworkController.php +26 -23
  42. package/server/src/Http/Controllers/v1/PaymentMethodController.php +0 -2
  43. package/server/src/Http/Controllers/v1/ProductController.php +1 -4
  44. package/server/src/Http/Controllers/v1/ReviewController.php +31 -35
  45. package/server/src/Http/Controllers/v1/ServiceQuoteController.php +57 -53
  46. package/server/src/Http/Controllers/v1/StoreController.php +8 -16
  47. package/server/src/Http/Filter/AddonCategoryFilter.php +1 -1
  48. package/server/src/Http/Filter/OrderFilter.php +2 -2
  49. package/server/src/Http/Middleware/SetStorefrontSession.php +9 -20
  50. package/server/src/Http/Requests/AddStoreToNetworkCategory.php +3 -3
  51. package/server/src/Http/Requests/CreateCustomerRequest.php +5 -7
  52. package/server/src/Http/Requests/CreateReviewRequest.php +4 -5
  53. package/server/src/Http/Requests/GetServiceQuoteFromCart.php +2 -2
  54. package/server/src/Http/Requests/InitializeCheckoutRequest.php +5 -5
  55. package/server/src/Http/Requests/NetworkActionRequest.php +2 -2
  56. package/server/src/Http/Requests/VerifyCreateCustomerRequest.php +2 -2
  57. package/server/src/Http/Resources/Cart.php +19 -18
  58. package/server/src/Http/Resources/Category.php +12 -11
  59. package/server/src/Http/Resources/Customer.php +15 -14
  60. package/server/src/Http/Resources/Gateway.php +12 -11
  61. package/server/src/Http/Resources/Media.php +9 -8
  62. package/server/src/Http/Resources/Network.php +32 -31
  63. package/server/src/Http/Resources/Product.php +88 -85
  64. package/server/src/Http/Resources/Review.php +14 -13
  65. package/server/src/Http/Resources/ReviewCustomer.php +12 -11
  66. package/server/src/Http/Resources/Store.php +38 -36
  67. package/server/src/Http/Resources/StoreHour.php +9 -8
  68. package/server/src/Http/Resources/StoreLocation.php +9 -8
  69. package/server/src/Imports/ProductsImport.php +0 -2
  70. package/server/src/Jobs/DownloadProductImageUrl.php +7 -4
  71. package/server/src/Listeners/HandleOrderCompleted.php +2 -1
  72. package/server/src/Listeners/HandleOrderDispatched.php +2 -1
  73. package/server/src/Listeners/HandleOrderDriverAssigned.php +2 -1
  74. package/server/src/Listeners/HandleOrderStarted.php +4 -3
  75. package/server/src/Mail/StorefrontNetworkInvite.php +7 -6
  76. package/server/src/Models/AddonCategory.php +2 -4
  77. package/server/src/Models/Cart.php +117 -124
  78. package/server/src/Models/Checkout.php +14 -12
  79. package/server/src/Models/Customer.php +9 -9
  80. package/server/src/Models/Gateway.php +22 -22
  81. package/server/src/Models/Network.php +41 -52
  82. package/server/src/Models/NetworkStore.php +6 -5
  83. package/server/src/Models/NotificationChannel.php +11 -9
  84. package/server/src/Models/PaymentMethod.php +9 -7
  85. package/server/src/Models/Product.php +152 -30
  86. package/server/src/Models/ProductAddon.php +14 -11
  87. package/server/src/Models/ProductAddonCategory.php +9 -8
  88. package/server/src/Models/ProductHour.php +6 -5
  89. package/server/src/Models/ProductStoreLocation.php +7 -5
  90. package/server/src/Models/ProductVariant.php +15 -11
  91. package/server/src/Models/ProductVariantOption.php +12 -9
  92. package/server/src/Models/Review.php +9 -7
  93. package/server/src/Models/Store.php +68 -84
  94. package/server/src/Models/StoreHour.php +6 -5
  95. package/server/src/Models/StoreLocation.php +12 -8
  96. package/server/src/Models/StorefrontModel.php +1 -1
  97. package/server/src/Models/Vote.php +8 -6
  98. package/server/src/Notifications/StorefrontOrderCanceled.php +15 -19
  99. package/server/src/Notifications/StorefrontOrderCompleted.php +15 -19
  100. package/server/src/Notifications/StorefrontOrderCreated.php +31 -36
  101. package/server/src/Notifications/StorefrontOrderDriverAssigned.php +15 -20
  102. package/server/src/Notifications/StorefrontOrderEnroute.php +14 -19
  103. package/server/src/Notifications/StorefrontOrderNearby.php +16 -21
  104. package/server/src/Notifications/StorefrontOrderPreparing.php +15 -18
  105. package/server/src/Notifications/StorefrontOrderReadyForPickup.php +15 -18
  106. package/server/src/Observers/NetworkObserver.php +2 -3
  107. package/server/src/Observers/ProductObserver.php +17 -33
  108. package/server/src/Providers/EventServiceProvider.php +15 -4
  109. package/server/src/Providers/StorefrontServiceProvider.php +8 -10
  110. package/server/src/Support/Metrics.php +12 -12
  111. package/server/src/Support/OrderConfig.php +3 -2
  112. package/server/src/Support/QPay.php +22 -20
  113. package/server/src/Support/Storefront.php +18 -17
  114. package/server/src/routes.php +1 -1
@@ -17,6 +17,7 @@ export default class ProductsIndexCategoryNewController extends BaseController {
17
17
  @service fetch;
18
18
  @service loader;
19
19
  @service crud;
20
+ @service hostRouter;
20
21
  @alias('storefront.activeStore') activeStore;
21
22
  @tracked product = this.store.createRecord('product', { store_uuid: this.activeStore.id, currency: this.activeStore.currency, tags: [], meta_array: [] });
22
23
  @tracked uploadQueue = [];
@@ -58,15 +59,13 @@ export default class ProductsIndexCategoryNewController extends BaseController {
58
59
  this.product
59
60
  .serializeMeta()
60
61
  .save()
61
- .then((product) => {
62
+ .then(() => {
62
63
  this.loader.removeLoader(loader);
63
64
  this.isSaving = false;
64
65
  this.notifications.success('New product created successfully!');
65
66
 
66
67
  return this.transitionToRoute('products.index.category').then(() => {
67
- console.log(this.productsIndexCategoryController);
68
- console.log(this.productsIndexCategoryController.products);
69
- this.productsIndexCategoryController?.products?.pushObject(product);
68
+ return this.hostRouter.refresh();
70
69
  });
71
70
  })
72
71
  .catch((error) => {
@@ -81,8 +80,7 @@ export default class ProductsIndexCategoryNewController extends BaseController {
81
80
  this.product.tags = [];
82
81
  }
83
82
 
84
- this.product.tags?.pushObject(tag);
85
- console.log('this.product.tags', this.product.tags);
83
+ this.product.tags.pushObject(tag);
86
84
  }
87
85
 
88
86
  @action removeTag(index) {
@@ -191,7 +189,7 @@ export default class ProductsIndexCategoryNewController extends BaseController {
191
189
  });
192
190
  });
193
191
 
194
- product.addon_categories = productAddonCategories;
192
+ product.addon_categories.pushObjects(productAddonCategories);
195
193
  },
196
194
  });
197
195
  });
@@ -265,8 +263,6 @@ export default class ProductsIndexCategoryNewController extends BaseController {
265
263
  } else {
266
264
  productAddonCategory.excluded_addons.pushObject(id);
267
265
  }
268
-
269
- console.log(productAddonCategory);
270
266
  }
271
267
 
272
268
  @action addMetaField() {
@@ -1,5 +1,6 @@
1
1
  import Model, { attr, belongsTo } from '@ember-data/model';
2
2
  import { format, formatDistanceToNow } from 'date-fns';
3
+ import getWithDefault from '@fleetbase/ember-core/utils/get-with-default';
3
4
 
4
5
  export default class ProductAddonCategoryModel extends Model {
5
6
  /** @ids */
@@ -19,7 +20,15 @@ export default class ProductAddonCategoryModel extends Model {
19
20
 
20
21
  /** @methods */
21
22
  toJSON() {
22
- return this.serialize();
23
+ return {
24
+ uuid: this.id,
25
+ category_uuid: this.category_uuid,
26
+ product_uuid: this.product_uuid,
27
+ name: this.name,
28
+ excluded_addons: getWithDefault(this, 'excluded_addons', []),
29
+ updated_at: this.updated_at,
30
+ created_at: this.created_at,
31
+ };
23
32
  }
24
33
 
25
34
  /** @computed */
@@ -4,8 +4,6 @@ import { format, formatDistanceToNow } from 'date-fns';
4
4
  export default class ProductVariantModel extends Model {
5
5
  /** @ids */
6
6
  @attr('string') product_uuid;
7
- @attr('string') created_by_uuid;
8
- @attr('string') company_uuid;
9
7
 
10
8
  /** @relationships */
11
9
  @hasMany('product-variant-option') options;
@@ -20,7 +20,7 @@ export default class ProductModel extends Model {
20
20
  @belongsTo('file') primary_image;
21
21
  @hasMany('file') files;
22
22
  @hasMany('product-variant', { async: false }) variants;
23
- @hasMany('product-addon-category') addon_categories;
23
+ @hasMany('product-addon-category', { async: false }) addon_categories;
24
24
  @hasMany('product-hour') hours;
25
25
 
26
26
  /** @attributes */
@@ -56,7 +56,40 @@ export default class ProductModel extends Model {
56
56
 
57
57
  /** @methods */
58
58
  toJSON() {
59
- return this.serialize();
59
+ return {
60
+ uuid: this.id,
61
+ created_by_uuid: this.created_by_uuid,
62
+ company_uuid: this.company_uuid,
63
+ store_uuid: this.store_uuid,
64
+ category_uuid: this.category_uuid,
65
+ primary_image_uuid: this.primary_image_uuid,
66
+ public_id: this.public_id,
67
+ name: this.name,
68
+ category: this.category,
69
+ primary_image: this.primary_image,
70
+ files: this.files,
71
+ variants: this.variants,
72
+ addon_categories: this.addon_categories,
73
+ hours: this.hours,
74
+ description: this.description,
75
+ primary_image_url: this.primary_image_url,
76
+ sku: this.sku,
77
+ currency: this.currency,
78
+ price: this.price,
79
+ sale_price: this.sale_price,
80
+ tags: this.tags,
81
+ youtube_urls: this.youtube_urls,
82
+ translations: this.translations,
83
+ is_on_sale: this.is_on_sale,
84
+ is_recommended: this.is_recommended,
85
+ is_service: this.is_service,
86
+ is_available: this.is_available,
87
+ is_bookable: this.is_bookable,
88
+ status: this.status,
89
+ slug: this.slug,
90
+ created_at: this.created_at,
91
+ updated_at: this.updated_at,
92
+ };
60
93
  }
61
94
 
62
95
  /** @computed */
@@ -1,5 +1,6 @@
1
1
  import ApplicationSerializer from '@fleetbase/ember-core/serializers/application';
2
2
  import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
3
+ import { isArray } from '@ember/array';
3
4
 
4
5
  export default class ProductSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
5
6
  /**
@@ -17,4 +18,19 @@ export default class ProductSerializer extends ApplicationSerializer.extend(Embe
17
18
  category: { embedded: 'always' },
18
19
  };
19
20
  }
21
+
22
+ serializeHasMany(snapshot, json, relationship) {
23
+ let key = relationship.key;
24
+
25
+ if (key === 'addon_categories') {
26
+ const addonCategories = snapshot.record.get('addon_categories');
27
+
28
+ if (isArray(addonCategories)) {
29
+ json.addon_categories = addonCategories;
30
+ }
31
+ return;
32
+ }
33
+
34
+ return super.serializeHasMany(...arguments);
35
+ }
20
36
  }
@@ -117,7 +117,7 @@
117
117
  </ContentPanel>
118
118
 
119
119
  <ContentPanel @title="Add-Ons" @open={{this.product.addon_categories.length}} @pad={{false}} @panelBodyWrapperClass="px-0 py-4" @panelBodyClass="bg-white dark:bg-gray-800">
120
- <div class="px-4 py-3">
120
+ <div class="px-4">
121
121
  <div class="flex items-center justify-end mb-3">
122
122
  <Button @text="Select Addon Categories" @icon="plus" @iconPrefix="fas" @onClick={{this.selectAddonCategory}} />
123
123
  </div>
@@ -139,7 +139,7 @@
139
139
  {{#each addonCategory.category.addons as |addon|}}
140
140
  <div class="grid grid-cols-10 gap-1 px-3 py-2 rounded-md border border-gray-200 dark:border-gray-900 dark:text-gray-100 dark:bg-gray-800 bg-gray-200">
141
141
  <div class="flex items-center">
142
- <Checkbox @value={{not-in-array addon.id addonCategory.excluded_addons}} @onToggle={{fn this.excludeAddon index addon}} />
142
+ <Checkbox @value={{not (in-array addon.id addonCategory.excluded_addons)}} @onToggle={{fn this.excludeAddon index addon}} />
143
143
  </div>
144
144
  <div class="col-span-3 flex items-center">
145
145
  {{addon.name}}
package/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/storefront-api",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
@@ -22,8 +22,8 @@
22
22
  ],
23
23
  "require": {
24
24
  "php": "^7.4|^8.0",
25
- "fleetbase/core-api": "^1.3.2",
26
- "fleetbase/fleetops-api": "^0.3.5",
25
+ "fleetbase/core-api": "^1.3.10",
26
+ "fleetbase/fleetops-api": "^0.4.0",
27
27
  "geocoder-php/google-maps-places-provider": "^1.4",
28
28
  "laravel-notification-channels/apn": "^3.8",
29
29
  "laravel-notification-channels/fcm": "^2.7",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Storefront",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/storefront",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,134 +1,134 @@
1
1
  {
2
- "name": "@fleetbase/storefront-engine",
3
- "version": "0.2.5",
4
- "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
- "fleetbase": {
6
- "route": "storefront",
7
- "dashboard": "storefront/int/v1/dashboard"
8
- },
9
- "keywords": [
10
- "fleetbase-extension",
11
- "fleetbase-storefront",
12
- "fleetbase",
13
- "e-commerce",
14
- "headless-commerce",
15
- "headless-marketplace",
16
- "ember-engine",
17
- "ember-addon"
18
- ],
19
- "repository": "https://github.com/fleetbase/storefront",
20
- "license": "MIT",
21
- "author": "Fleetbase Pte Ltd <hello@fleetbase.io>",
22
- "directories": {
23
- "app": "app",
24
- "addon": "addon",
25
- "tests": "tests"
26
- },
27
- "scripts": {
28
- "build": "ember build --environment=production",
29
- "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
30
- "lint:css": "stylelint \"**/*.css\"",
31
- "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
32
- "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
33
- "lint:hbs": "ember-template-lint .",
34
- "lint:hbs:fix": "ember-template-lint . --fix",
35
- "lint:js": "eslint . --cache",
36
- "lint:js:fix": "eslint . --fix",
37
- "start": "ember serve",
38
- "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
39
- "test:ember": "ember test",
40
- "test:ember-compatibility": "ember try:each",
41
- "publish:npm": "npm config set registry https://registry.npmjs.org/ && npm publish",
42
- "publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish"
43
- },
44
- "dependencies": {
45
- "@fleetbase/ember-core": "^0.1.9",
46
- "@fleetbase/ember-ui": "^0.2.8",
47
- "@fleetbase/fleetops-data": "^0.1.6",
48
- "@babel/core": "^7.23.2",
49
- "@fortawesome/ember-fontawesome": "^0.4.1",
50
- "@fortawesome/fontawesome-svg-core": "^6.4.0",
51
- "@fortawesome/free-solid-svg-icons": "^6.4.0",
52
- "ember-cli-babel": "^8.2.0",
53
- "ember-cli-htmlbars": "^6.3.0",
54
- "ember-intl": "6.3.2",
55
- "ember-tag-input": "^3.1.0",
56
- "ember-wormhole": "^0.6.0"
57
- },
58
- "devDependencies": {
59
- "@babel/eslint-parser": "^7.22.15",
60
- "@babel/plugin-proposal-decorators": "^7.23.2",
61
- "@ember/optional-features": "^2.0.0",
62
- "@ember/test-helpers": "^3.2.0",
63
- "@embroider/test-setup": "^3.0.2",
64
- "@glimmer/component": "^1.1.2",
65
- "@glimmer/tracking": "^1.1.2",
66
- "broccoli-asset-rev": "^3.0.0",
67
- "broccoli-funnel": "^3.0.8",
68
- "broccoli-merge-trees": "^4.2.0",
69
- "concurrently": "^8.2.2",
70
- "ember-auto-import": "^2.6.3",
71
- "ember-classic-decorator": "^3.0.0",
72
- "ember-cli": "~5.4.1",
73
- "ember-cli-clean-css": "^3.0.0",
74
- "ember-cli-dependency-checker": "^3.3.2",
75
- "ember-cli-inject-live-reload": "^2.1.0",
76
- "ember-cli-sri": "^2.1.1",
77
- "ember-cli-terser": "^4.0.2",
78
- "ember-concurrency": "^3.1.1",
79
- "ember-concurrency-decorators": "^2.0.3",
80
- "ember-data": "^4.12.5",
81
- "ember-engines": "^0.9.0",
82
- "ember-load-initializers": "^2.1.2",
83
- "ember-math-helpers": "^4.0.0",
84
- "ember-page-title": "^8.0.0",
85
- "ember-qunit": "^8.0.1",
86
- "ember-resolver": "^11.0.1",
87
- "ember-responsive": "^5.0.0",
88
- "ember-source": "~5.4.0",
89
- "ember-source-channel-url": "^3.0.0",
90
- "ember-template-lint": "^5.11.2",
91
- "ember-try": "^3.0.0",
92
- "eslint": "^8.52.0",
93
- "eslint-config-prettier": "^9.0.0",
94
- "eslint-plugin-ember": "^11.11.1",
95
- "eslint-plugin-n": "^16.2.0",
96
- "eslint-plugin-prettier": "^5.0.1",
97
- "eslint-plugin-qunit": "^8.0.1",
98
- "loader.js": "^4.7.0",
99
- "prettier": "^3.0.3",
100
- "qunit": "^2.20.0",
101
- "qunit-dom": "^2.0.0",
102
- "stylelint": "^15.11.0",
103
- "stylelint-config-standard": "^34.0.0",
104
- "stylelint-prettier": "^4.0.2",
105
- "webpack": "^5.89.0"
106
- },
107
- "peerDependencies": {
108
- "ember-engines": "^0.9.0"
109
- },
110
- "engines": {
111
- "node": ">= 18"
112
- },
113
- "ember": {
114
- "edition": "octane"
115
- },
116
- "ember-addon": {
117
- "configPath": "tests/dummy/config"
118
- },
119
- "prettier": {
120
- "trailingComma": "es5",
121
- "tabWidth": 4,
122
- "semi": true,
123
- "singleQuote": true,
124
- "printWidth": 190,
125
- "overrides": [
126
- {
127
- "files": "*.hbs",
128
- "options": {
129
- "singleQuote": false
130
- }
131
- }
132
- ]
133
- }
2
+ "name": "@fleetbase/storefront-engine",
3
+ "version": "0.2.7",
4
+ "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
+ "fleetbase": {
6
+ "route": "storefront",
7
+ "dashboard": "storefront/int/v1/dashboard"
8
+ },
9
+ "keywords": [
10
+ "fleetbase-extension",
11
+ "fleetbase-storefront",
12
+ "fleetbase",
13
+ "e-commerce",
14
+ "headless-commerce",
15
+ "headless-marketplace",
16
+ "ember-engine",
17
+ "ember-addon"
18
+ ],
19
+ "repository": "https://github.com/fleetbase/storefront",
20
+ "license": "MIT",
21
+ "author": "Fleetbase Pte Ltd <hello@fleetbase.io>",
22
+ "directories": {
23
+ "app": "app",
24
+ "addon": "addon",
25
+ "tests": "tests"
26
+ },
27
+ "scripts": {
28
+ "build": "ember build --environment=production",
29
+ "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
30
+ "lint:css": "stylelint \"**/*.css\"",
31
+ "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
32
+ "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
33
+ "lint:hbs": "ember-template-lint .",
34
+ "lint:hbs:fix": "ember-template-lint . --fix",
35
+ "lint:js": "eslint . --cache",
36
+ "lint:js:fix": "eslint . --fix",
37
+ "start": "ember serve",
38
+ "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
39
+ "test:ember": "ember test",
40
+ "test:ember-compatibility": "ember try:each",
41
+ "publish:npm": "npm config set registry https://registry.npmjs.org/ && npm publish",
42
+ "publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish"
43
+ },
44
+ "dependencies": {
45
+ "@fleetbase/ember-core": "^0.2.0",
46
+ "@fleetbase/ember-ui": "^0.2.9",
47
+ "@fleetbase/fleetops-data": "^0.1.7",
48
+ "@babel/core": "^7.23.2",
49
+ "@fortawesome/ember-fontawesome": "^0.4.1",
50
+ "@fortawesome/fontawesome-svg-core": "^6.4.0",
51
+ "@fortawesome/free-solid-svg-icons": "^6.4.0",
52
+ "ember-cli-babel": "^8.2.0",
53
+ "ember-cli-htmlbars": "^6.3.0",
54
+ "ember-intl": "6.3.2",
55
+ "ember-tag-input": "^3.1.0",
56
+ "ember-wormhole": "^0.6.0"
57
+ },
58
+ "devDependencies": {
59
+ "@babel/eslint-parser": "^7.22.15",
60
+ "@babel/plugin-proposal-decorators": "^7.23.2",
61
+ "@ember/optional-features": "^2.0.0",
62
+ "@ember/test-helpers": "^3.2.0",
63
+ "@embroider/test-setup": "^3.0.2",
64
+ "@glimmer/component": "^1.1.2",
65
+ "@glimmer/tracking": "^1.1.2",
66
+ "broccoli-asset-rev": "^3.0.0",
67
+ "broccoli-funnel": "^3.0.8",
68
+ "broccoli-merge-trees": "^4.2.0",
69
+ "concurrently": "^8.2.2",
70
+ "ember-auto-import": "^2.6.3",
71
+ "ember-classic-decorator": "^3.0.0",
72
+ "ember-cli": "~5.4.1",
73
+ "ember-cli-clean-css": "^3.0.0",
74
+ "ember-cli-dependency-checker": "^3.3.2",
75
+ "ember-cli-inject-live-reload": "^2.1.0",
76
+ "ember-cli-sri": "^2.1.1",
77
+ "ember-cli-terser": "^4.0.2",
78
+ "ember-concurrency": "^3.1.1",
79
+ "ember-concurrency-decorators": "^2.0.3",
80
+ "ember-data": "^4.12.5",
81
+ "ember-engines": "^0.9.0",
82
+ "ember-load-initializers": "^2.1.2",
83
+ "ember-math-helpers": "^4.0.0",
84
+ "ember-page-title": "^8.0.0",
85
+ "ember-qunit": "^8.0.1",
86
+ "ember-resolver": "^11.0.1",
87
+ "ember-responsive": "^5.0.0",
88
+ "ember-source": "~5.4.0",
89
+ "ember-source-channel-url": "^3.0.0",
90
+ "ember-template-lint": "^5.11.2",
91
+ "ember-try": "^3.0.0",
92
+ "eslint": "^8.52.0",
93
+ "eslint-config-prettier": "^9.0.0",
94
+ "eslint-plugin-ember": "^11.11.1",
95
+ "eslint-plugin-n": "^16.2.0",
96
+ "eslint-plugin-prettier": "^5.0.1",
97
+ "eslint-plugin-qunit": "^8.0.1",
98
+ "loader.js": "^4.7.0",
99
+ "prettier": "^3.0.3",
100
+ "qunit": "^2.20.0",
101
+ "qunit-dom": "^2.0.0",
102
+ "stylelint": "^15.11.0",
103
+ "stylelint-config-standard": "^34.0.0",
104
+ "stylelint-prettier": "^4.0.2",
105
+ "webpack": "^5.89.0"
106
+ },
107
+ "peerDependencies": {
108
+ "ember-engines": "^0.9.0"
109
+ },
110
+ "engines": {
111
+ "node": ">= 18"
112
+ },
113
+ "ember": {
114
+ "edition": "octane"
115
+ },
116
+ "ember-addon": {
117
+ "configPath": "tests/dummy/config"
118
+ },
119
+ "prettier": {
120
+ "trailingComma": "es5",
121
+ "tabWidth": 4,
122
+ "semi": true,
123
+ "singleQuote": true,
124
+ "printWidth": 190,
125
+ "overrides": [
126
+ {
127
+ "files": "*.hbs",
128
+ "options": {
129
+ "singleQuote": false
130
+ }
131
+ }
132
+ ]
133
+ }
134
134
  }
@@ -6,90 +6,82 @@ class Storefront
6
6
  {
7
7
  /**
8
8
  * The permission schema Name.
9
- *
10
- * @var string
11
9
  */
12
10
  public string $name = 'storefront';
13
11
 
14
12
  /**
15
13
  * The permission schema Polict Name.
16
- *
17
- * @var string
18
14
  */
19
15
  public string $policyName = 'Storefront';
20
16
 
21
17
  /**
22
18
  * Guards these permissions should apply to.
23
- *
24
- * @var array
25
19
  */
26
20
  public array $guards = ['web', 'api'];
27
21
 
28
22
  /**
29
23
  * The permission schema resources.
30
- *
31
- * @var array
32
24
  */
33
25
  public array $resources = [
34
26
  [
35
- 'name' => 'order',
36
- 'actions' => ['accept', 'mark-as-ready', 'mark-as-completed', 'reject']
27
+ 'name' => 'order',
28
+ 'actions' => ['accept', 'mark-as-ready', 'mark-as-completed', 'reject'],
37
29
  ],
38
30
  [
39
- 'name' => 'product',
40
- 'actions' => ['import']
31
+ 'name' => 'product',
32
+ 'actions' => ['import'],
41
33
  ],
42
34
  [
43
- 'name' => 'product-addon',
44
- 'actions' => []
35
+ 'name' => 'product-addon',
36
+ 'actions' => [],
45
37
  ],
46
38
  [
47
- 'name' => 'product-addon-category',
48
- 'actions' => []
39
+ 'name' => 'product-addon-category',
40
+ 'actions' => [],
49
41
  ],
50
42
  [
51
- 'name' => 'product-hour',
52
- 'actions' => []
43
+ 'name' => 'product-hour',
44
+ 'actions' => [],
53
45
  ],
54
46
  [
55
- 'name' => 'product-store-location',
56
- 'actions' => []
47
+ 'name' => 'product-store-location',
48
+ 'actions' => [],
57
49
  ],
58
50
  [
59
- 'name' => 'product-variant',
60
- 'actions' => []
51
+ 'name' => 'product-variant',
52
+ 'actions' => [],
61
53
  ],
62
54
  [
63
- 'name' => 'product-variant-option',
64
- 'actions' => []
55
+ 'name' => 'product-variant-option',
56
+ 'actions' => [],
65
57
  ],
66
58
  [
67
- 'name' => 'gateway',
68
- 'actions' => []
59
+ 'name' => 'gateway',
60
+ 'actions' => [],
69
61
  ],
70
62
  [
71
- 'name' => 'notification-channel',
72
- 'actions' => []
63
+ 'name' => 'notification-channel',
64
+ 'actions' => [],
73
65
  ],
74
66
  [
75
- 'name' => 'network',
76
- 'actions' => []
67
+ 'name' => 'network',
68
+ 'actions' => [],
77
69
  ],
78
70
  [
79
- 'name' => 'network-store',
80
- 'actions' => []
71
+ 'name' => 'network-store',
72
+ 'actions' => [],
81
73
  ],
82
74
  [
83
- 'name' => 'store',
84
- 'actions' => []
75
+ 'name' => 'store',
76
+ 'actions' => [],
85
77
  ],
86
78
  [
87
- 'name' => 'store-location',
88
- 'actions' => []
79
+ 'name' => 'store-location',
80
+ 'actions' => [],
89
81
  ],
90
82
  [
91
- 'name' => 'store-hour',
92
- 'actions' => []
93
- ]
83
+ 'name' => 'store-hour',
84
+ 'actions' => [],
85
+ ],
94
86
  ];
95
87
  }
@@ -33,17 +33,17 @@ class NotifyStorefrontOrderNearby extends Command
33
33
  // Get storefront orders that are enroute
34
34
  $orders = $this->getActiveStorefrontOrders();
35
35
 
36
- // Notify and update
36
+ // Notify and update
37
37
  $this->alert('Found (' . $orders->count() . ') Storefront Orders which are Enroute.');
38
38
 
39
39
  // Iterate each order
40
40
  $orders->each(
41
41
  function ($order) {
42
- $origin = $order->payload->getPickupOrFirstWaypoint();
42
+ $origin = $order->payload->getPickupOrFirstWaypoint();
43
43
  $destination = $order->payload->getDropoffOrLastWaypoint();
44
- $matrix = Utils::getDrivingDistanceAndTime($origin, $destination);
45
- $distance = $matrix->distance;
46
- $time = $matrix->time;
44
+ $matrix = Utils::getDrivingDistanceAndTime($origin, $destination);
45
+ $distance = $matrix->distance;
46
+ $time = $matrix->time;
47
47
 
48
48
  if (!$distance || !$time) {
49
49
  return;
@@ -63,21 +63,19 @@ class NotifyStorefrontOrderNearby extends Command
63
63
 
64
64
  /**
65
65
  * Fetches active storefront orders based on certain criteria.
66
- *
67
- * @return \Illuminate\Database\Eloquent\Collection
68
66
  */
69
67
  public function getActiveStorefrontOrders(): \Illuminate\Database\Eloquent\Collection
70
68
  {
71
69
  return Order::where(
72
70
  [
73
- 'status' => 'driver_enroute',
74
- 'type' => 'storefront',
75
- 'dispatched' => true
71
+ 'status' => 'driver_enroute',
72
+ 'type' => 'storefront',
73
+ 'dispatched' => true,
76
74
  ]
77
75
  )->with(
78
76
  [
79
77
  'payload',
80
- 'customer'
78
+ 'customer',
81
79
  ]
82
80
  )
83
81
  ->withoutGlobalScopes()