@rebuy/rebuy 1.3.11 → 1.3.12
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.
- package/api.js +8 -1
- package/client.js +7 -2
- package/package.json +1 -1
package/api.js
CHANGED
|
@@ -5,6 +5,7 @@ const config = {
|
|
|
5
5
|
domain: 'https://rebuyengine.com',
|
|
6
6
|
cdnDomain: 'https://cdn.rebuyengine.com',
|
|
7
7
|
eventDomain: 'https://rebuyengine.com',
|
|
8
|
+
shop: null,
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
const staging = {
|
|
@@ -21,7 +22,9 @@ const stagingDomains = [
|
|
|
21
22
|
'rebuy-staging-regression.myshopify.com',
|
|
22
23
|
'rebuy-uat.myshopify.com',
|
|
23
24
|
'rebuy-regression-qa.myshopify.com',
|
|
24
|
-
'
|
|
25
|
+
'senator-staging.myshopify.com',
|
|
26
|
+
'mike-reids-test-store.myshopify.com',
|
|
27
|
+
'dash-ext-hoke.myshopify.com',
|
|
25
28
|
];
|
|
26
29
|
|
|
27
30
|
const makeCall = async (method, path, data, origin, options = {}) => {
|
|
@@ -77,6 +80,10 @@ export class Api {
|
|
|
77
80
|
Object.assign(config, staging);
|
|
78
81
|
break;
|
|
79
82
|
}
|
|
83
|
+
if (typeof config.shop === 'string' && config.shop.includes(domain)) {
|
|
84
|
+
Object.assign(config, staging);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
80
87
|
}
|
|
81
88
|
}
|
|
82
89
|
|
package/client.js
CHANGED
|
@@ -8,6 +8,7 @@ const config = {
|
|
|
8
8
|
contextParameters: null,
|
|
9
9
|
api: null,
|
|
10
10
|
identity: null,
|
|
11
|
+
shop: null,
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const trackEvent = async (eventData) => {
|
|
@@ -60,7 +61,7 @@ const makeCall = async (endpoint, params, format, options = {}) => {
|
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
export class RebuyClient {
|
|
63
|
-
constructor(key, defaultParameters) {
|
|
64
|
+
constructor(key, defaultParameters, shop) {
|
|
64
65
|
if (typeof key == 'string') {
|
|
65
66
|
config.key = key;
|
|
66
67
|
}
|
|
@@ -69,7 +70,11 @@ export class RebuyClient {
|
|
|
69
70
|
config.defaultParameters = defaultParameters;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
if (typeof shop == 'string' && shop.endsWith('.myshopify.com')) {
|
|
74
|
+
config.shop = shop;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
config.api = new Api({ key: config.key, shop: config.shop });
|
|
73
78
|
config.identity = new Identity();
|
|
74
79
|
}
|
|
75
80
|
|