@hotwax/dxp-components 1.2.0 → 1.2.1
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/lib/components/Login.d.ts +1 -1
- package/lib/components/Login.js +9 -11
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lib/store/auth.js +2 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {}, {
|
|
2
2
|
errorMsg: string;
|
|
3
|
+
authStore: any;
|
|
3
4
|
router: any;
|
|
4
5
|
route: any;
|
|
5
|
-
authStore: any;
|
|
6
6
|
}, {}, {
|
|
7
7
|
handleUserFlow(token: string, oms: string, expirationTime: string): Promise<void>;
|
|
8
8
|
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
package/lib/components/Login.js
CHANGED
|
@@ -17,17 +17,15 @@ var _default = (0, _vue.defineComponent)({
|
|
|
17
17
|
data() {
|
|
18
18
|
return {
|
|
19
19
|
errorMsg: '',
|
|
20
|
+
authStore: {},
|
|
20
21
|
router: {},
|
|
21
|
-
route: {}
|
|
22
|
-
authStore: {}
|
|
22
|
+
route: {}
|
|
23
23
|
};
|
|
24
24
|
},
|
|
25
25
|
async mounted() {
|
|
26
|
-
// exporting the same from index.ts through globalProperties does not work as expected
|
|
27
|
-
const instance = (0, _vue.getCurrentInstance)();
|
|
28
|
-
this.route = instance.appContext.config.globalProperties.$route;
|
|
29
|
-
this.router = instance.appContext.config.globalProperties.$router;
|
|
30
26
|
this.authStore = (0, _index.useAuthStore)();
|
|
27
|
+
this.router = _index.appContext.config.globalProperties.$router;
|
|
28
|
+
this.route = _index.appContext.config.globalProperties.$route;
|
|
31
29
|
if (!Object.keys(this.route.query).length) {
|
|
32
30
|
this.errorMsg = 'Unable to login. Could not authenticate the user';
|
|
33
31
|
return;
|
|
@@ -41,7 +39,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
41
39
|
const appOms = this.authStore.oms;
|
|
42
40
|
const appExpirationTime = this.authStore.token.expiration;
|
|
43
41
|
|
|
44
|
-
// show alert if token/oms are different from the app's
|
|
42
|
+
// show alert if token/oms exist and are different from the app's
|
|
45
43
|
if (appToken && token && (appToken != token || appOms != oms)) {
|
|
46
44
|
// for backward compatibility
|
|
47
45
|
this.authStore.$patch({
|
|
@@ -51,9 +49,11 @@ var _default = (0, _vue.defineComponent)({
|
|
|
51
49
|
},
|
|
52
50
|
oms: appOms
|
|
53
51
|
});
|
|
54
|
-
|
|
52
|
+
_index.loginContext.confirmSessionEnd('dev-oms').then(isConfirmed => {
|
|
55
53
|
isConfirmed ? this.handleUserFlow(token, oms, expirationTime) : this.router.push('/');
|
|
56
54
|
});
|
|
55
|
+
} else {
|
|
56
|
+
this.handleUserFlow(token, oms, expirationTime);
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
methods: {
|
|
@@ -75,9 +75,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
75
75
|
token,
|
|
76
76
|
oms
|
|
77
77
|
});
|
|
78
|
-
this.router.
|
|
79
|
-
path: '/'
|
|
80
|
-
});
|
|
78
|
+
this.router.push('/');
|
|
81
79
|
} catch (error) {
|
|
82
80
|
console.error(error);
|
|
83
81
|
this.errorMsg = 'Unable to login. Please contact the administrator';
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import ShopifyImg from "./components/ShopifyImg";
|
|
|
5
5
|
import { goToOms } from "./utils";
|
|
6
6
|
declare let loginContext: any;
|
|
7
7
|
declare let shopifyImgContext: any;
|
|
8
|
+
declare let appContext: any;
|
|
8
9
|
export declare let dxpComponents: {
|
|
9
10
|
install(app: any, options: any): void;
|
|
10
11
|
};
|
|
11
|
-
export { useProductIdentificationStore, useAuthStore, Login, loginContext, shopifyImgContext, ShopifyImg, goToOms };
|
|
12
|
+
export { useProductIdentificationStore, useAuthStore, Login, loginContext, shopifyImgContext, ShopifyImg, goToOms, appContext };
|
package/lib/index.js
CHANGED
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "ShopifyImg", {
|
|
|
15
15
|
return _ShopifyImg.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
exports.dxpComponents = void 0;
|
|
18
|
+
exports.dxpComponents = exports.appContext = void 0;
|
|
19
19
|
Object.defineProperty(exports, "goToOms", {
|
|
20
20
|
enumerable: true,
|
|
21
21
|
get: function () {
|
|
@@ -50,11 +50,14 @@ pinia.use(_piniaPluginPersistedstate.default);
|
|
|
50
50
|
let loginContext = {};
|
|
51
51
|
exports.loginContext = loginContext;
|
|
52
52
|
let shopifyImgContext = {};
|
|
53
|
-
|
|
54
|
-
// executed on app initialization
|
|
55
53
|
exports.shopifyImgContext = shopifyImgContext;
|
|
54
|
+
let appContext = {};
|
|
55
|
+
// executed on app initialization
|
|
56
|
+
exports.appContext = appContext;
|
|
56
57
|
let dxpComponents = {
|
|
57
58
|
install(app, options) {
|
|
59
|
+
exports.appContext = appContext = app;
|
|
60
|
+
|
|
58
61
|
// registering pinia in the app
|
|
59
62
|
app.use(pinia);
|
|
60
63
|
app.component('Login', _Login.default);
|
package/lib/store/auth.js
CHANGED