@fleetbase/storefront-engine 0.0.5 → 0.0.6

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.
@@ -1,6 +1,8 @@
1
1
  import Service from '@ember/service';
2
2
  import Evented from '@ember/object/evented';
3
+ import config from 'ember-get-config';
3
4
  import { inject as service } from '@ember/service';
5
+ import { isBlank } from '@ember/utils';
4
6
 
5
7
  export default class StorefrontService extends Service.extend(Evented) {
6
8
  @service store;
@@ -80,6 +82,16 @@ export default class StorefrontService extends Service.extend(Evented) {
80
82
  });
81
83
  }
82
84
 
85
+ createSocketClusterClient() {
86
+ const socketConfig = { ...config.socket };
87
+
88
+ if (isBlank(socketConfig.hostname)) {
89
+ socketConfig.hostname = window.location.hostname;
90
+ }
91
+
92
+ return socketClusterClient.create(socketConfig);
93
+ }
94
+
83
95
  async listenForIncomingOrders() {
84
96
  const store = this.findActiveStore();
85
97
 
@@ -87,11 +99,8 @@ export default class StorefrontService extends Service.extend(Evented) {
87
99
  return;
88
100
  }
89
101
 
90
- const socket = socketClusterClient.create({
91
- hostname: 'socket.fleetbase.io',
92
- secure: true,
93
- port: 8000,
94
- });
102
+ // create socketcluster client
103
+ const socket = this.createSocketClusterClient();
95
104
 
96
105
  // listen on company channel
97
106
  const channel = socket.subscribe(`storefront.${store.public_id}`);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fleetbase/storefront-engine",
3
3
  "extension": "Storefront",
4
4
  "icon": "store",
5
- "version": "0.0.5",
5
+ "version": "0.0.6",
6
6
  "priority": 1,
7
7
  "description": "Fleetbase Storefront extension provides a headless commerce module for launching e-commerce stores, on-demand apps, or marketplaces.",
8
8
  "keywords": [
@@ -37,7 +37,7 @@
37
37
  "test:ember-compatibility": "ember try:each"
38
38
  },
39
39
  "dependencies": {
40
- "@fleetbase/ember-core": "^0.0.2",
40
+ "@fleetbase/ember-core": "^0.0.3",
41
41
  "@fleetbase/ember-ui": "^0.0.6",
42
42
  "@fleetbase/fleetops-data": "^0.0.2",
43
43
  "@fortawesome/ember-fontawesome": "^0.4.1",