@fleetbase/storefront-engine 0.3.17 → 0.3.18

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 (31) hide show
  1. package/addon/components/modals/manage-addons.js +6 -2
  2. package/addon/controllers/products/index/category/new.js +2 -1
  3. package/addon/controllers/products/index/index.js +0 -23
  4. package/addon/controllers/settings/gateways.js +14 -18
  5. package/addon/models/product-addon-category.js +3 -0
  6. package/addon/styles/storefront-engine.css +7 -0
  7. package/addon/templates/products/index/category/new.hbs +4 -1
  8. package/addon/templates/settings/gateways.hbs +1 -1
  9. package/addon/templates/settings/index.hbs +2 -2
  10. package/composer.json +1 -1
  11. package/extension.json +1 -1
  12. package/package.json +1 -1
  13. package/server/src/Http/Controllers/ProductController.php +2 -0
  14. package/server/src/Http/Controllers/v1/CheckoutController.php +331 -33
  15. package/server/src/Http/Controllers/v1/CustomerController.php +77 -0
  16. package/server/src/Http/Controllers/v1/StoreController.php +35 -5
  17. package/server/src/Http/Requests/CreateStripeSetupIntentRequest.php +31 -0
  18. package/server/src/Http/Requests/CustomerRequest.php +31 -0
  19. package/server/src/Http/Resources/Cart.php +18 -1
  20. package/server/src/Http/Resources/Customer.php +19 -14
  21. package/server/src/Http/Resources/Store.php +5 -1
  22. package/server/src/Models/AddonCategory.php +14 -16
  23. package/server/src/Models/Cart.php +10 -5
  24. package/server/src/Models/Customer.php +2 -2
  25. package/server/src/Models/Gateway.php +9 -4
  26. package/server/src/Models/Product.php +9 -10
  27. package/server/src/Models/ProductAddonCategory.php +2 -0
  28. package/server/src/Support/QPay.php +35 -1
  29. package/server/src/Support/StripeUtils.php +38 -0
  30. package/server/src/routes.php +19 -0
  31. package/translations/en-us.yaml +2 -1
@@ -117,8 +117,12 @@ export default class ModalsManageAddonsComponent extends Component {
117
117
  owner_uuid: this.activeStore.id,
118
118
  });
119
119
 
120
- yield category.save();
121
- this.categories.pushObject(category);
120
+ try {
121
+ yield category.save();
122
+ this.categories.pushObject(category);
123
+ } catch (error) {
124
+ this.notifications.serverError(error);
125
+ }
122
126
  }
123
127
 
124
128
  /**
@@ -21,11 +21,12 @@ export default class ProductsIndexCategoryNewController extends BaseController {
21
21
  @service crud;
22
22
  @service hostRouter;
23
23
  @alias('storefront.activeStore') activeStore;
24
- @tracked product = this.store.createRecord('product', { store_uuid: this.activeStore.id, currency: this.activeStore.currency, tags: [], meta_array: [] });
24
+ @tracked product = this.store.createRecord('product', { store_uuid: this.activeStore.id, currency: this.activeStore.currency, tags: [], meta_array: [], status: 'published' });
25
25
  @tracked uploadQueue = [];
26
26
  @tracked uploadedFiles = [];
27
27
  @tracked primaryFile = null;
28
28
  @tracked isSaving = false;
29
+ @tracked statusOptions = ['published', 'draft'];
29
30
  abilityPermission = 'storefront create product';
30
31
 
31
32
  /** overlay options */
@@ -7,32 +7,9 @@ import { timeout } from 'ember-concurrency';
7
7
  import { task } from 'ember-concurrency-decorators';
8
8
 
9
9
  export default class ProductsIndexIndexController extends BaseController {
10
- /**
11
- * Inject the `filters` service
12
- *
13
- * @var {Service}
14
- */
15
10
  @service filters;
16
-
17
- /**
18
- * Inject the `intl` service
19
- *
20
- * @var {Service}
21
- */
22
11
  @service intl;
23
-
24
- /**
25
- * Inject the `currentUser` service
26
- *
27
- * @var {Service}
28
- */
29
12
  @service currentUser;
30
-
31
- /**
32
- * Inject the `currentUser` service
33
- *
34
- * @var {Service}
35
- */
36
13
  @service modalsManager;
37
14
 
38
15
  /**
@@ -8,6 +8,7 @@ import getGatewaySchemas from '../../utils/get-gateway-schemas';
8
8
  export default class SettingsGatewaysController extends Controller {
9
9
  @service notifications;
10
10
  @service intl;
11
+ @service hostRouter;
11
12
  @service modalsManager;
12
13
  @service store;
13
14
  @service crud;
@@ -33,7 +34,7 @@ export default class SettingsGatewaysController extends Controller {
33
34
  return;
34
35
  }
35
36
 
36
- this.gateways.pushObject(gateway);
37
+ this.hostRouter.refresh();
37
38
  },
38
39
  });
39
40
  }
@@ -70,25 +71,20 @@ export default class SettingsGatewaysController extends Controller {
70
71
 
71
72
  set(gateway.config, key, value);
72
73
  },
73
- confirm: (modal, done) => {
74
+ confirm: async (modal, done) => {
74
75
  modal.startLoading();
75
76
 
76
- gateway
77
- .save()
78
- .then((gateway) => {
79
- if (typeof options.successNotification === 'function') {
80
- this.notifications.success(options.successNotification(gateway));
81
- } else {
82
- this.notifications.success(options.successNotification || `${gateway.name} details updated.`);
83
- }
84
-
85
- done();
86
- })
87
- .catch((error) => {
88
- // gateway.rollbackAttributes();
89
- modal.stopLoading();
90
- this.notifications.serverError(error);
91
- });
77
+ try {
78
+ await gateway.save();
79
+ if (typeof options.successNotification === 'function') {
80
+ this.notifications.success(options.successNotification(gateway));
81
+ } else {
82
+ this.notifications.success(options.successNotification || `${gateway.name} details updated.`);
83
+ }
84
+ } catch (error) {
85
+ modal.stopLoading();
86
+ this.notifications.serverError(error);
87
+ }
92
88
  },
93
89
  ...options,
94
90
  });
@@ -12,6 +12,8 @@ export default class ProductAddonCategoryModel extends Model {
12
12
 
13
13
  /** @attributes */
14
14
  @attr('string') name;
15
+ @attr('number') max_selectable;
16
+ @attr('boolean') is_required;
15
17
  @attr('raw') excluded_addons;
16
18
 
17
19
  /** @dates */
@@ -25,6 +27,7 @@ export default class ProductAddonCategoryModel extends Model {
25
27
  category_uuid: this.category_uuid,
26
28
  product_uuid: this.product_uuid,
27
29
  name: this.name,
30
+ max_selectable: this.max_selectable,
28
31
  excluded_addons: getWithDefault(this, 'excluded_addons', []),
29
32
  updated_at: this.updated_at,
30
33
  created_at: this.created_at,
@@ -4,3 +4,10 @@
4
4
  .ui-combo-box .selected-list a.combo-box-option.selected:hover {
5
5
  background-color: #76a9fa !important;
6
6
  }
7
+
8
+ /** hotfix tag input */
9
+ .emberTagInput.form-input {
10
+ flex-wrap: wrap !important;
11
+ gap: 0.35rem !important;
12
+ height: auto !important;
13
+ }
@@ -23,6 +23,9 @@
23
23
  <InputGroup @name="Product Description" @helpText="Enter a description of your product">
24
24
  <Textarea @value={{this.product.description}} class="form-input w-full" placeholder="Enter a description of your product...." disabled={{unauthorized}} rows={{4}} />
25
25
  </InputGroup>
26
+ <InputGroup @name="Product Status">
27
+ <Select class="w-full" @value={{this.product.status}} @placeholder="Select product status" @options={{this.statusOptions}} @onSelect={{fn (mut this.product.status)}} @humanize={{true}} />
28
+ </InputGroup>
26
29
  <InputGroup @name="Product Tags">
27
30
  <TagInput
28
31
  class="form-input"
@@ -261,7 +264,7 @@
261
264
  {{addon.description}}
262
265
  </div>
263
266
  <div class="col-span-2">
264
- {{format-currency addon.price}}
267
+ {{format-currency addon.price this.product.currency}}
265
268
  </div>
266
269
  </div>
267
270
  {{/each}}
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  </div>
17
17
 
18
- {{#each this.model as |gateway|}}
18
+ {{#each @model as |gateway|}}
19
19
  <ContentPanel @title={{gateway.name}} @open={{true}} @pad={{true}}>
20
20
  <InputGroup @name={{t "storefront.settings.gateways.gateway-name"}} @value={{gateway.name}} @helpText={{t "storefront.settings.gateways.helpText"}} />
21
21
  <InputGroup
@@ -293,14 +293,14 @@
293
293
  <div class="input-group">
294
294
  <Toggle @isToggled={{@model.options.tips_enabled}} @onToggle={{fn (mut @model.options.tips_enabled)}}>
295
295
  <FaIcon @icon="cash-register" class="text-gray-600 dark:text-gray-400 mx-2" /><span class="dark:text-gray-100 text-sm">{{t
296
- "storefront.settings.index.enable-tip"
296
+ "storefront.settings.index.enable-tips"
297
297
  }}</span>
298
298
  </Toggle>
299
299
  </div>
300
300
  <div class="input-group">
301
301
  <Toggle @isToggled={{@model.options.delivery_tips_enabled}} @onToggle={{fn (mut @model.options.delivery_tips_enabled)}}>
302
302
  <FaIcon @icon="face-smile" class="text-gray-600 dark:text-gray-400 mx-2" /><span class="dark:text-gray-100 text-sm">{{t
303
- "storefront.settings.index.enable-integrated-vendors"
303
+ "storefront.settings.index.enable-delivery-tips"
304
304
  }}</span>
305
305
  </Toggle>
306
306
  </div>
package/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/storefront-api",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Storefront",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/storefront",
6
6
  "license": "AGPL-3.0-or-later",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/storefront-engine",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "fleetbase": {
6
6
  "route": "storefront",
@@ -41,6 +41,8 @@ class ProductController extends StorefrontController
41
41
  $variants = $request->array('product.variants');
42
42
  $files = $request->array('product.files');
43
43
 
44
+ // dd($addonCategories);
45
+
44
46
  // save addon categories
45
47
  $product->setAddonCategories($addonCategories);
46
48