cloudcommerce 2.14.0 → 2.14.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/CHANGELOG.md +8 -0
- package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
- package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barradoce/package.json +2 -2
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/affiliate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mandae/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagaleve/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/pagarme-v5/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/src/lib/components/AccountLink.vue +14 -3
- package/packages/storefront/src/lib/scripts/vbeta-app.ts +4 -2
- package/packages/storefront/src/lib/state/customer-session.ts +16 -11
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.14.1](https://github.com/ecomplus/cloud-commerce/compare/v2.14.0...v2.14.1) (2024-04-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **storefront:** Prevent hydration mismatch with `<AccountLink>` on logged state ([a4d1be9](https://github.com/ecomplus/cloud-commerce/commit/a4d1be9a171fe292794da2b0013f34d9b690a567))
|
|
11
|
+
* **storefront:** Properly set `ecomPassport` session auth for vbeta-app ([a6d8e4e](https://github.com/ecomplus/cloud-commerce/commit/a6d8e4ebf27f134fc29da0ab5025c8bc73431426))
|
|
12
|
+
|
|
5
13
|
## [2.14.0](https://github.com/ecomplus/cloud-commerce/compare/v2.13.1...v2.14.0) (2024-04-16)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^2.
|
|
19
|
-
"@cloudcommerce/firebase": "^2.
|
|
20
|
-
"@cloudcommerce/passport": "^2.
|
|
18
|
+
"@cloudcommerce/feeds": "^2.14.0",
|
|
19
|
+
"@cloudcommerce/firebase": "^2.14.0",
|
|
20
|
+
"@cloudcommerce/passport": "^2.14.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@cloudcommerce/api": "^2.
|
|
23
|
-
"@cloudcommerce/firebase": "^2.
|
|
24
|
-
"@cloudcommerce/ssr": "^2.
|
|
22
|
+
"@cloudcommerce/api": "^2.14.0",
|
|
23
|
+
"@cloudcommerce/firebase": "^2.14.0",
|
|
24
|
+
"@cloudcommerce/ssr": "^2.14.0",
|
|
25
25
|
"@headlessui/vue": "^1.7.18",
|
|
26
26
|
"micromark": "^4.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/i18n": "^2.
|
|
30
|
-
"@cloudcommerce/storefront": "^2.
|
|
31
|
-
"@cloudcommerce/types": "^2.
|
|
29
|
+
"@cloudcommerce/i18n": "^2.14.0",
|
|
30
|
+
"@cloudcommerce/storefront": "^2.14.0",
|
|
31
|
+
"@cloudcommerce/types": "^2.14.0",
|
|
32
32
|
"@iconify-json/mingcute": "^1.1.16",
|
|
33
33
|
"photoswipe": "^5.4.3"
|
|
34
34
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^2.
|
|
19
|
-
"@cloudcommerce/firebase": "^2.
|
|
20
|
-
"@cloudcommerce/modules": "^2.
|
|
18
|
+
"@cloudcommerce/events": "^2.14.0",
|
|
19
|
+
"@cloudcommerce/firebase": "^2.14.0",
|
|
20
|
+
"@cloudcommerce/modules": "^2.14.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cloudcommerce/cli": "^2.
|
|
29
|
+
"@cloudcommerce/cli": "^2.14.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cloudcommerce/eslint": "^2.
|
|
32
|
+
"@cloudcommerce/eslint": "^2.14.0",
|
|
33
33
|
"husky": "^9.0.10",
|
|
34
34
|
"lint-staged": "^15.2.2"
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.14.
|
|
4
|
+
"version": "2.14.1",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"vite": "^5.2.8",
|
|
37
37
|
"vitest": "^1.5.0",
|
|
38
38
|
"zx": "^7.2.3",
|
|
39
|
-
"@cloudcommerce/eslint": "2.14.
|
|
39
|
+
"@cloudcommerce/eslint": "2.14.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"fix-install": "bash scripts/pre-install.sh && pnpm i",
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ref,
|
|
4
|
+
computed,
|
|
5
|
+
nextTick,
|
|
6
|
+
onMounted,
|
|
7
|
+
} from 'vue';
|
|
3
8
|
import { isLogged } from '@@sf/state/customer-session';
|
|
4
9
|
|
|
5
10
|
export interface Props {
|
|
@@ -18,9 +23,13 @@ if (globalThis.location?.href) {
|
|
|
18
23
|
locationUrl.value = globalThis.location.href;
|
|
19
24
|
});
|
|
20
25
|
}
|
|
26
|
+
const isMounted = ref(false);
|
|
27
|
+
onMounted(() => { isMounted.value = true; });
|
|
21
28
|
const href = computed(() => {
|
|
22
29
|
const returnUrl = props.returnUrl || locationUrl.value;
|
|
23
|
-
const loggedTo =
|
|
30
|
+
const loggedTo = isMounted.value && isLogged.value
|
|
31
|
+
? (props.to || 'account')
|
|
32
|
+
: null;
|
|
24
33
|
if (!loggedTo) {
|
|
25
34
|
let { loginUrl } = props;
|
|
26
35
|
if (props.isSignUp) {
|
|
@@ -28,7 +37,9 @@ const href = computed(() => {
|
|
|
28
37
|
} else {
|
|
29
38
|
loginUrl += '?';
|
|
30
39
|
}
|
|
31
|
-
return returnUrl
|
|
40
|
+
return returnUrl
|
|
41
|
+
? `${loginUrl}return_url=${returnUrl}`
|
|
42
|
+
: `${loginUrl}#/account/${props.to || ''}`;
|
|
32
43
|
}
|
|
33
44
|
const { settings } = globalThis.$storefront;
|
|
34
45
|
if (loggedTo === 'orders' && settings.ordersUrl) {
|
|
@@ -218,7 +218,7 @@ if (!import.meta.env.SSR) {
|
|
|
218
218
|
if (isAuthenticated.value) {
|
|
219
219
|
ecomPassport.setSession({
|
|
220
220
|
auth: {
|
|
221
|
-
|
|
221
|
+
token: session.auth,
|
|
222
222
|
id: session.auth?.customer_id,
|
|
223
223
|
level: 3,
|
|
224
224
|
},
|
|
@@ -242,7 +242,9 @@ if (!import.meta.env.SSR) {
|
|
|
242
242
|
ecomPassport.on('logout', () => {
|
|
243
243
|
if (isAuthenticated.value) {
|
|
244
244
|
logout();
|
|
245
|
-
|
|
245
|
+
watch(isAuthenticated, () => {
|
|
246
|
+
window.location.href = '/';
|
|
247
|
+
}, { once: true });
|
|
246
248
|
}
|
|
247
249
|
});
|
|
248
250
|
}, 400);
|
|
@@ -2,7 +2,7 @@ import type { Customers } from '@cloudcommerce/api/types';
|
|
|
2
2
|
import type { Auth } from 'firebase/auth';
|
|
3
3
|
import api from '@cloudcommerce/api';
|
|
4
4
|
import { nickname as getNickname } from '@ecomplus/utils';
|
|
5
|
-
import { ref, computed } from 'vue';
|
|
5
|
+
import { ref, computed, watch } from 'vue';
|
|
6
6
|
import { requestIdleCallback } from '@@sf/sf-lib';
|
|
7
7
|
import useStorage from '@@sf/state/use-storage';
|
|
8
8
|
|
|
@@ -40,18 +40,10 @@ const customerEmail = computed({
|
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
let firebaseAuth: Auth;
|
|
43
|
+
let firebaseAuth: Auth | undefined;
|
|
44
44
|
const isLogged = computed(() => {
|
|
45
45
|
return isAuthenticated.value || !!firebaseAuth?.currentUser?.emailVerified;
|
|
46
46
|
});
|
|
47
|
-
const logout = () => {
|
|
48
|
-
firebaseAuth.signOut().then(() => {
|
|
49
|
-
session.auth = emptySession.auth;
|
|
50
|
-
session.customer = emptySession.customer;
|
|
51
|
-
localStorage.removeItem(storageKey);
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
47
|
const throwNoAuth = (msg = 'Not authenticated') => {
|
|
56
48
|
const err: any = new Error(msg);
|
|
57
49
|
err.isNoAuth = true;
|
|
@@ -59,7 +51,7 @@ const throwNoAuth = (msg = 'Not authenticated') => {
|
|
|
59
51
|
};
|
|
60
52
|
|
|
61
53
|
const authenticate = async () => {
|
|
62
|
-
const authToken = await firebaseAuth
|
|
54
|
+
const authToken = await firebaseAuth?.currentUser?.getIdToken();
|
|
63
55
|
if (!authToken) {
|
|
64
56
|
throwNoAuth('Can\'t get Firebase user ID token');
|
|
65
57
|
return;
|
|
@@ -155,6 +147,19 @@ const initializeFirebaseAuth = (canWaitIdle?: boolean) => {
|
|
|
155
147
|
}
|
|
156
148
|
};
|
|
157
149
|
|
|
150
|
+
const logout = () => {
|
|
151
|
+
if (!firebaseAuth) {
|
|
152
|
+
initializeFirebaseAuth();
|
|
153
|
+
watch(isAuthReady, () => logout(), { once: true });
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
firebaseAuth.signOut().then(() => {
|
|
157
|
+
session.auth = emptySession.auth;
|
|
158
|
+
session.customer = emptySession.customer;
|
|
159
|
+
localStorage.removeItem(storageKey);
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
|
|
158
163
|
export default session;
|
|
159
164
|
|
|
160
165
|
export {
|