flowrix 1.0.1-beta.151 → 1.0.1-beta.152
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/dist/module.json +1 -1
- package/dist/runtime/components/product/PopUpCart.d.vue.ts +2 -2
- package/dist/runtime/components/product/PopUpCart.vue.d.ts +2 -2
- package/dist/runtime/composables/Extras/useCountry.js +1 -1
- package/dist/runtime/composables/Product/useProductComponent.d.ts +1 -3
- package/dist/runtime/composables/Product/useProductComponent.js +5 -4
- package/dist/runtime/composables/useMetaLayer.js +2 -2
- package/dist/runtime/pages/flowrix-default.vue +0 -2
- package/dist/runtime/server/api/product/[...slug].js +4 -3
- package/dist/runtime/stores/Cart.js +11 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -2,10 +2,10 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
4
|
$props: Partial<typeof __VLS_props>;
|
|
5
|
-
price?: any;
|
|
6
5
|
productData?: any;
|
|
6
|
+
price?: any;
|
|
7
7
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_props: {
|
|
9
|
-
readonly price?: any;
|
|
10
9
|
readonly productData?: any;
|
|
10
|
+
readonly price?: any;
|
|
11
11
|
};
|
|
@@ -2,10 +2,10 @@ declare const _default: typeof __VLS_export;
|
|
|
2
2
|
export default _default;
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
|
4
4
|
$props: Partial<typeof __VLS_props>;
|
|
5
|
-
price?: any;
|
|
6
5
|
productData?: any;
|
|
6
|
+
price?: any;
|
|
7
7
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_props: {
|
|
9
|
-
readonly price?: any;
|
|
10
9
|
readonly productData?: any;
|
|
10
|
+
readonly price?: any;
|
|
11
11
|
};
|
|
@@ -7,7 +7,8 @@ import { TikTok_view_item } from "../useTikTokDatalayer.js";
|
|
|
7
7
|
import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
|
|
8
8
|
export function useProductComponent(product) {
|
|
9
9
|
const route = useRoute();
|
|
10
|
-
|
|
10
|
+
console.log("product data", product);
|
|
11
|
+
const templateName = "Template-" + product?.template || "default";
|
|
11
12
|
const companyProfile = useCompanyProfile();
|
|
12
13
|
const components = import.meta.glob(
|
|
13
14
|
"~/components/Product/Template*/index.vue"
|
|
@@ -31,12 +32,12 @@ export function useProductComponent(product) {
|
|
|
31
32
|
websiteurl = window.location.origin;
|
|
32
33
|
}
|
|
33
34
|
const ifPromotioned = () => {
|
|
34
|
-
if (product
|
|
35
|
+
if (product?.rpfloat > product?.pricefloat) {
|
|
35
36
|
return {
|
|
36
37
|
"priceSpecification": [
|
|
37
38
|
{
|
|
38
39
|
"@type": "UnitPriceSpecification",
|
|
39
|
-
"price": product
|
|
40
|
+
"price": product?.rpfloat,
|
|
40
41
|
"priceCurrency": companyProfile.profile?.data?.currencyCode || "",
|
|
41
42
|
"priceComponentType": "https://schema.org/ListPrice"
|
|
42
43
|
}
|
|
@@ -49,7 +50,7 @@ export function useProductComponent(product) {
|
|
|
49
50
|
const faqSchema = {
|
|
50
51
|
"@context": "https://schema.org",
|
|
51
52
|
"@type": "FAQPage",
|
|
52
|
-
"name": `${product
|
|
53
|
+
"name": `${product?.name} - FAQs`,
|
|
53
54
|
"mainEntity": product?.faqs.map((faq) => ({
|
|
54
55
|
"@type": "Question",
|
|
55
56
|
"name": faq.question,
|
|
@@ -20,9 +20,9 @@ export function META_view_item(product, price = 0, rp = 0) {
|
|
|
20
20
|
if (fbq) {
|
|
21
21
|
let discount = rp > price ? Number((rp - price).toFixed(2)) : 0;
|
|
22
22
|
fbq("track", "ViewContent", {
|
|
23
|
-
content_ids: [product
|
|
23
|
+
content_ids: [product?.sku],
|
|
24
24
|
content_type: "product",
|
|
25
|
-
content_name: product
|
|
25
|
+
content_name: product?.name,
|
|
26
26
|
discount,
|
|
27
27
|
value: price,
|
|
28
28
|
currency: useCompanyProfile().profile?.data?.currencyCode
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import product from "../components/product/index.vue";
|
|
3
2
|
import { useRoute } from "vue-router";
|
|
4
3
|
import { defineAsyncComponent } from "vue";
|
|
5
4
|
const route = useRoute();
|
|
@@ -40,7 +39,6 @@ const NotFoundComponent = defineAsyncComponent(async () => {
|
|
|
40
39
|
</script>
|
|
41
40
|
|
|
42
41
|
<template>
|
|
43
|
-
{{ data.data.type }}
|
|
44
42
|
<template v-if="data">
|
|
45
43
|
</template>
|
|
46
44
|
<template v-else>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineEventHandler, getQuery, createError,
|
|
1
|
+
import { defineEventHandler, getQuery, createError, getCookie, setResponseStatus } from "h3";
|
|
2
2
|
import { writeFile, mkdir, readFile } from "fs/promises";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
@@ -16,7 +16,8 @@ export default defineEventHandler(async (event) => {
|
|
|
16
16
|
const slug = event.context.params._;
|
|
17
17
|
const customerType = getCookie(event, "customertype") || "";
|
|
18
18
|
let query = getQuery(event);
|
|
19
|
-
const body =
|
|
19
|
+
const body = query.body;
|
|
20
|
+
console.log("Request body:", body);
|
|
20
21
|
if (!slug) {
|
|
21
22
|
throw createError({ statusCode: 400, statusMessage: "Missing slug parameter" });
|
|
22
23
|
}
|
|
@@ -44,7 +45,7 @@ export default defineEventHandler(async (event) => {
|
|
|
44
45
|
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
45
46
|
},
|
|
46
47
|
query,
|
|
47
|
-
body
|
|
48
|
+
body
|
|
48
49
|
};
|
|
49
50
|
const product = await flowrixApi.post(`product/${slug}`, apiConfig, options);
|
|
50
51
|
if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
|
|
@@ -100,15 +100,25 @@ export const useCartStore = defineStore("cart", {
|
|
|
100
100
|
this.addedResponse = "";
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
|
+
async sha256(message) {
|
|
104
|
+
const encoder = new TextEncoder();
|
|
105
|
+
const data = encoder.encode(JSON.stringify(message));
|
|
106
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
107
|
+
return Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
108
|
+
},
|
|
103
109
|
async fetchRelated() {
|
|
104
110
|
try {
|
|
105
111
|
const request = {
|
|
106
112
|
cart: this.cart.items
|
|
107
113
|
};
|
|
108
114
|
const apiUrl = `/api/cart/related`;
|
|
115
|
+
const hash = await this.sha256(request);
|
|
109
116
|
const response = await $fetch(apiUrl, {
|
|
110
117
|
method: "POST",
|
|
111
|
-
body: request
|
|
118
|
+
body: request,
|
|
119
|
+
headers: {
|
|
120
|
+
"x-amz-content-sha256": hash
|
|
121
|
+
}
|
|
112
122
|
});
|
|
113
123
|
return response;
|
|
114
124
|
} catch (error) {
|