flowrix 1.0.1-beta.80 → 1.0.1-beta.82
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/composables/Checkout/useCheckout.js +2 -2
- package/dist/runtime/composables/Customer/useRegister.d.ts +2 -0
- package/dist/runtime/composables/Customer/useRegister.js +119 -44
- package/dist/runtime/composables/Customer/useWishlists.d.ts +2 -2
- package/dist/runtime/composables/Customer/useWishlists.js +4 -3
- package/dist/runtime/stores/Checkout.js +0 -19
- package/dist/runtime/stores/wishlists.d.ts +10 -2
- package/dist/runtime/stores/wishlists.js +13 -4
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -122,7 +122,7 @@ export default function() {
|
|
|
122
122
|
inputData.value.shipping_mobile = shippingAddres.mobile;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
} else if (isAuthenticated
|
|
125
|
+
} else if (isAuthenticated && sameasbilling == true) {
|
|
126
126
|
inputData.value.shipping_firstname = inputData.value.billing_firstname ? inputData.value.billing_firstname : "";
|
|
127
127
|
inputData.value.shipping_lastname = inputData.value.billing_lastname ? inputData.value.billing_lastname : "";
|
|
128
128
|
inputData.value.shipping_address = inputData.value.billing_address ? inputData.value.billing_address : "";
|
|
@@ -256,7 +256,7 @@ export default function() {
|
|
|
256
256
|
return false;
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
if (isAuthenticated
|
|
259
|
+
if (isAuthenticated) {
|
|
260
260
|
sessiondata.value.fields.firstname = inputData.value.billing_firstname;
|
|
261
261
|
sessiondata.value.fields.lastname = inputData.value.billing_lastname;
|
|
262
262
|
}
|
|
@@ -48,10 +48,13 @@ export default function(countries) {
|
|
|
48
48
|
const companyName = ref("");
|
|
49
49
|
const abn = ref("");
|
|
50
50
|
const address = ref("");
|
|
51
|
-
const sameAsCustomerDetails = ref(
|
|
51
|
+
const sameAsCustomerDetails = ref(true);
|
|
52
52
|
const showPassword = ref(false);
|
|
53
53
|
const showConfirmPassword = ref(false);
|
|
54
54
|
const isLoading = ref(false);
|
|
55
|
+
const alertMessage = ref("");
|
|
56
|
+
const alertType = ref("danger");
|
|
57
|
+
const showAlert = ref(false);
|
|
55
58
|
const getStates = (countryId) => {
|
|
56
59
|
const activeCountry = countries.data.find((country) => country.id == countryId);
|
|
57
60
|
return activeCountry ? activeCountry.states : [];
|
|
@@ -65,8 +68,8 @@ export default function(countries) {
|
|
|
65
68
|
if (!inputData.value.address.trim()) return "Address is required";
|
|
66
69
|
if (!String(inputData.value.billing_country).trim()) return "Country is required";
|
|
67
70
|
if (!String(inputData.value.billing_state).trim()) return "State is required";
|
|
68
|
-
if (!inputData.value.
|
|
69
|
-
if (!inputData.value.
|
|
71
|
+
if (!inputData.value.billing_postcode.trim()) return "Post Code is required";
|
|
72
|
+
if (!inputData.value.billing_suburb.trim()) return "Suburb is required";
|
|
70
73
|
if (!validateEmail(inputData.value.email)) return "Please enter a valid email address";
|
|
71
74
|
if (inputData.value.email !== inputData.value.email_confirmation) return "Email addresses do not match";
|
|
72
75
|
if (inputData.value.password.length < 6) return "Password must be at least 6 characters";
|
|
@@ -96,8 +99,8 @@ export default function(countries) {
|
|
|
96
99
|
const handleSameAsCustomerDetails = () => {
|
|
97
100
|
if (sameAsCustomerDetails.value) {
|
|
98
101
|
const billingAddr = isBusinessAccount.value ? address.value : inputData.value.address;
|
|
99
|
-
const billingSuburb = inputData.value.
|
|
100
|
-
const billingPostcode = inputData.value.
|
|
102
|
+
const billingSuburb = inputData.value.billing_suburb;
|
|
103
|
+
const billingPostcode = inputData.value.billing_postcode;
|
|
101
104
|
const billingMobile = inputData.value.mobile;
|
|
102
105
|
inputData.value.shipping_address = billingAddr;
|
|
103
106
|
inputData.value.shipping_country = inputData.value.billing_country;
|
|
@@ -106,15 +109,23 @@ export default function(countries) {
|
|
|
106
109
|
inputData.value.shipping_suburb = billingSuburb;
|
|
107
110
|
inputData.value.shipping_postcode = billingPostcode;
|
|
108
111
|
inputData.value.shipping_mobile = billingMobile;
|
|
112
|
+
} else {
|
|
113
|
+
inputData.value.shipping_address = "";
|
|
114
|
+
inputData.value.shipping_town = "";
|
|
115
|
+
inputData.value.shipping_suburb = "";
|
|
116
|
+
inputData.value.shipping_postcode = "";
|
|
117
|
+
inputData.value.shipping_mobile = "";
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const initializeShippingData = () => {
|
|
121
|
+
if (sameAsCustomerDetails.value) {
|
|
122
|
+
handleSameAsCustomerDetails();
|
|
109
123
|
}
|
|
110
124
|
};
|
|
111
125
|
const dismissAlert = () => {
|
|
112
126
|
showAlert.value = false;
|
|
113
127
|
alertMessage.value = "";
|
|
114
128
|
};
|
|
115
|
-
const alertMessage = ref("");
|
|
116
|
-
const alertType = ref("danger");
|
|
117
|
-
const showAlert = ref(false);
|
|
118
129
|
const displayAlert = (message, type) => {
|
|
119
130
|
alertMessage.value = message;
|
|
120
131
|
alertType.value = type;
|
|
@@ -125,6 +136,42 @@ export default function(countries) {
|
|
|
125
136
|
}, 5e3);
|
|
126
137
|
}
|
|
127
138
|
};
|
|
139
|
+
watch(() => inputData.value.billing_postcode, (newPostcode) => {
|
|
140
|
+
if (sameAsCustomerDetails.value && newPostcode) {
|
|
141
|
+
inputData.value.shipping_postcode = newPostcode;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
watch(() => inputData.value.billing_suburb, (newSuburb) => {
|
|
145
|
+
if (sameAsCustomerDetails.value && newSuburb) {
|
|
146
|
+
inputData.value.shipping_suburb = newSuburb;
|
|
147
|
+
inputData.value.shipping_town = newSuburb;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
watch(() => inputData.value.address, (newAddress) => {
|
|
151
|
+
if (sameAsCustomerDetails.value && newAddress) {
|
|
152
|
+
inputData.value.shipping_address = newAddress;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
watch(() => inputData.value.mobile, (newMobile) => {
|
|
156
|
+
if (sameAsCustomerDetails.value && newMobile) {
|
|
157
|
+
inputData.value.shipping_mobile = newMobile;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
watch(() => inputData.value.billing_country, (newCountry) => {
|
|
161
|
+
if (sameAsCustomerDetails.value && newCountry) {
|
|
162
|
+
inputData.value.shipping_country = newCountry;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
watch(() => inputData.value.billing_state, (newState) => {
|
|
166
|
+
if (sameAsCustomerDetails.value && newState) {
|
|
167
|
+
inputData.value.shipping_state = newState;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
watch(isBusinessAccount, (newValue) => {
|
|
171
|
+
if (sameAsCustomerDetails.value) {
|
|
172
|
+
handleSameAsCustomerDetails();
|
|
173
|
+
}
|
|
174
|
+
});
|
|
128
175
|
watch(logResponse, (newres) => {
|
|
129
176
|
if (newres?.status == "Success") {
|
|
130
177
|
router.push({ name: "dashboard-profile" });
|
|
@@ -132,6 +179,12 @@ export default function(countries) {
|
|
|
132
179
|
});
|
|
133
180
|
const handleSignup = async () => {
|
|
134
181
|
isLoading.value = true;
|
|
182
|
+
inputData.value.billing_mobile = inputData.value.mobile;
|
|
183
|
+
inputData.value.billing_address = inputData.value.address;
|
|
184
|
+
inputData.value.billing_firstname = inputData.value.firstname;
|
|
185
|
+
inputData.value.billing_lastname = inputData.value.lastname;
|
|
186
|
+
inputData.value.suburb = inputData.value.billing_suburb;
|
|
187
|
+
inputData.value.postCode = inputData.value.billing_postcode;
|
|
135
188
|
const validationError = validateForm();
|
|
136
189
|
if (validationError !== true) {
|
|
137
190
|
displayAlert(validationError, "danger");
|
|
@@ -139,28 +192,23 @@ export default function(countries) {
|
|
|
139
192
|
return;
|
|
140
193
|
}
|
|
141
194
|
try {
|
|
142
|
-
if (inputData.value.mobile) {
|
|
143
|
-
inputData.value.billing_mobile = inputData.value.mobile;
|
|
144
|
-
}
|
|
145
|
-
inputData.value.billing_suburb = inputData.value.suburb;
|
|
146
|
-
inputData.value.billing_address = inputData.value.address;
|
|
147
|
-
inputData.value.billing_firstname = inputData.value.firstname;
|
|
148
|
-
inputData.value.billing_lastname = inputData.value.lastname;
|
|
149
|
-
inputData.value.billing_postcode = inputData.value.postCode;
|
|
150
|
-
inputData.value.shipping_suburb = inputData.value.shipping_town;
|
|
151
195
|
if (isBusinessAccount.value) {
|
|
152
196
|
inputData.value.company_name = companyName.value;
|
|
153
197
|
inputData.value.abn = abn.value;
|
|
154
|
-
inputData.value.
|
|
198
|
+
inputData.value.businessAddress = address.value;
|
|
199
|
+
if (address.value) {
|
|
200
|
+
inputData.value.billing_address = address.value;
|
|
201
|
+
}
|
|
155
202
|
}
|
|
156
203
|
if (sameAsCustomerDetails.value) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
inputData.value.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
inputData.value.
|
|
163
|
-
|
|
204
|
+
handleSameAsCustomerDetails();
|
|
205
|
+
} else {
|
|
206
|
+
if (inputData.value.shipping_town && !inputData.value.shipping_suburb) {
|
|
207
|
+
inputData.value.shipping_suburb = inputData.value.shipping_town;
|
|
208
|
+
}
|
|
209
|
+
if (inputData.value.shipping_suburb && !inputData.value.shipping_town) {
|
|
210
|
+
inputData.value.shipping_town = inputData.value.shipping_suburb;
|
|
211
|
+
}
|
|
164
212
|
}
|
|
165
213
|
await CustomerRegister(inputData.value);
|
|
166
214
|
if (!regResponse.value || regResponse.value.status !== "Success") {
|
|
@@ -192,24 +240,7 @@ export default function(countries) {
|
|
|
192
240
|
}
|
|
193
241
|
const successMsg = typeof regResponse.value.message === "string" ? regResponse.value.message : "Registration successful! Welcome aboard.";
|
|
194
242
|
displayAlert(successMsg, "success");
|
|
195
|
-
|
|
196
|
-
inputData.value.lastname = "";
|
|
197
|
-
inputData.value.address = "";
|
|
198
|
-
inputData.value.billing_country = "";
|
|
199
|
-
inputData.value.billing_state = "";
|
|
200
|
-
inputData.value.suburb = "";
|
|
201
|
-
inputData.value.postCode = "";
|
|
202
|
-
inputData.value.email = "";
|
|
203
|
-
inputData.value.email_confirmation = "";
|
|
204
|
-
inputData.value.password = "";
|
|
205
|
-
inputData.value.password_confirmation = "";
|
|
206
|
-
inputData.value.mobile = "";
|
|
207
|
-
isBusinessAccount.value = false;
|
|
208
|
-
companyName.value = "";
|
|
209
|
-
abn.value = "";
|
|
210
|
-
address.value = "";
|
|
211
|
-
sameAsCustomerDetails.value = false;
|
|
212
|
-
inputData.value.newsletterSignup = false;
|
|
243
|
+
resetForm();
|
|
213
244
|
setTimeout(() => {
|
|
214
245
|
router.push("/dashboard/profile");
|
|
215
246
|
}, 1e3);
|
|
@@ -221,6 +252,47 @@ export default function(countries) {
|
|
|
221
252
|
isLoading.value = false;
|
|
222
253
|
}
|
|
223
254
|
};
|
|
255
|
+
const resetForm = () => {
|
|
256
|
+
inputData.value = {
|
|
257
|
+
abn: "",
|
|
258
|
+
addresses: [],
|
|
259
|
+
address: "",
|
|
260
|
+
postCode: "",
|
|
261
|
+
suburb: "",
|
|
262
|
+
billing_address: "",
|
|
263
|
+
businessAddress: "",
|
|
264
|
+
billing_country: "",
|
|
265
|
+
billing_firstname: "",
|
|
266
|
+
billing_lastname: "",
|
|
267
|
+
billing_mobile: "",
|
|
268
|
+
billing_postcode: "",
|
|
269
|
+
billing_state: "",
|
|
270
|
+
billing_suburb: "",
|
|
271
|
+
company_name: "",
|
|
272
|
+
email: "",
|
|
273
|
+
email_confirmation: "",
|
|
274
|
+
firstname: "",
|
|
275
|
+
lastname: "",
|
|
276
|
+
mobile: "",
|
|
277
|
+
newsletterSignup: false,
|
|
278
|
+
password: "",
|
|
279
|
+
password_confirmation: "",
|
|
280
|
+
recaptcha: "",
|
|
281
|
+
shipping_address: "",
|
|
282
|
+
shipping_country: "",
|
|
283
|
+
shipping_postcode: "",
|
|
284
|
+
shipping_state: "",
|
|
285
|
+
shipping_suburb: "",
|
|
286
|
+
shipping_town: "",
|
|
287
|
+
shipping_mobile: "",
|
|
288
|
+
subscribe: false
|
|
289
|
+
};
|
|
290
|
+
isBusinessAccount.value = false;
|
|
291
|
+
companyName.value = "";
|
|
292
|
+
abn.value = "";
|
|
293
|
+
address.value = "";
|
|
294
|
+
sameAsCustomerDetails.value = true;
|
|
295
|
+
};
|
|
224
296
|
return {
|
|
225
297
|
router,
|
|
226
298
|
route,
|
|
@@ -245,6 +317,9 @@ export default function(countries) {
|
|
|
245
317
|
showAlert,
|
|
246
318
|
displayAlert,
|
|
247
319
|
dismissAlert,
|
|
248
|
-
handleSignup
|
|
320
|
+
handleSignup,
|
|
321
|
+
initializeShippingData,
|
|
322
|
+
// Make sure this is returned
|
|
323
|
+
resetForm
|
|
249
324
|
};
|
|
250
325
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Wishlist, type WishlistProduct, type CreateWishlistData, type UpdateWishlistData, type AddToWishlistData, type ApiResponse } from '../../stores/wishlists.js';
|
|
2
2
|
export declare function useWishlists(): {
|
|
3
|
-
fetchWishlists: () => Promise<ApiResponse<Wishlist[]>>;
|
|
3
|
+
fetchWishlists: (force?: boolean) => Promise<ApiResponse<Wishlist[]>>;
|
|
4
4
|
fetchWishlistProducts: (listId: number) => Promise<ApiResponse<{
|
|
5
5
|
id: number;
|
|
6
6
|
title: string;
|
|
@@ -19,7 +19,7 @@ export declare function useWishlists(): {
|
|
|
19
19
|
default: boolean;
|
|
20
20
|
created_at: string;
|
|
21
21
|
}[]>;
|
|
22
|
-
wishlistProducts: (listId: number) =>
|
|
22
|
+
wishlistProducts: (listId: number) => WishlistProduct[];
|
|
23
23
|
loading: import("vue").ComputedRef<boolean>;
|
|
24
24
|
error: import("vue").ComputedRef<string | null>;
|
|
25
25
|
};
|
|
@@ -19,11 +19,11 @@ function formatErrorMessage(message) {
|
|
|
19
19
|
}
|
|
20
20
|
export function useWishlists() {
|
|
21
21
|
const store = useWishlistsStore();
|
|
22
|
-
async function fetchWishlists() {
|
|
22
|
+
async function fetchWishlists(force) {
|
|
23
23
|
store.setLoading(true);
|
|
24
24
|
store.setError(null);
|
|
25
25
|
try {
|
|
26
|
-
const response = await store.fetchWishlists();
|
|
26
|
+
const response = await store.fetchWishlists(force || false);
|
|
27
27
|
if (response.status === "Success") {
|
|
28
28
|
return response;
|
|
29
29
|
} else {
|
|
@@ -175,7 +175,8 @@ export function useWishlists() {
|
|
|
175
175
|
updateWishlist,
|
|
176
176
|
deleteWishlist,
|
|
177
177
|
wishlists: computed(() => store.getWishlists),
|
|
178
|
-
|
|
178
|
+
// Fixed: Remove extra computed wrapper - direct getter for reactivity
|
|
179
|
+
wishlistProducts: (listId) => store.getWishlistProducts(listId),
|
|
179
180
|
loading: computed(() => store.isLoading),
|
|
180
181
|
error: computed(() => store.getError)
|
|
181
182
|
};
|
|
@@ -189,25 +189,6 @@ export const useCheckoutStore = defineStore("checkout", {
|
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
async saveToCheckoutSession(fieldsData) {
|
|
192
|
-
this.loading = true;
|
|
193
|
-
fieldsData.firstname = fieldsData.billing_firstname ?? void 0;
|
|
194
|
-
fieldsData.lastname = fieldsData.billing_lastname ?? void 0;
|
|
195
|
-
fieldsData.mobile = fieldsData.billing_mobile ?? void 0;
|
|
196
|
-
fieldsData.fullname = `${fieldsData.billing_firstname} ${fieldsData.billing_lastname}`;
|
|
197
|
-
fieldsData.billing_fullname = `${fieldsData.billing_firstname} ${fieldsData.billing_lastname}`;
|
|
198
|
-
fieldsData.shipping_fullname = `${fieldsData.billing_firstname} ${fieldsData.billing_lastname}`;
|
|
199
|
-
if (fieldsData.shippingasbilling === true) {
|
|
200
|
-
fieldsData.billing_address = fieldsData.shipping_address ?? void 0;
|
|
201
|
-
fieldsData.billing_country = fieldsData.shipping_country ?? null;
|
|
202
|
-
fieldsData.billing_state = fieldsData.shipping_state ?? void 0;
|
|
203
|
-
fieldsData.billing_suburb = fieldsData.shipping_suburb ?? void 0;
|
|
204
|
-
fieldsData.billing_firstname = fieldsData.shipping_firstname ?? void 0;
|
|
205
|
-
fieldsData.billing_fullname = fieldsData.shipping_fullname ?? null;
|
|
206
|
-
fieldsData.billing_lastname = fieldsData.shipping_lastname ?? void 0;
|
|
207
|
-
fieldsData.billing_middlename = fieldsData.shipping_middlename ?? void 0;
|
|
208
|
-
fieldsData.billing_mobile = fieldsData.shipping_mobile ?? void 0;
|
|
209
|
-
fieldsData.billing_postcode = fieldsData.shipping_postcode ?? void 0;
|
|
210
|
-
}
|
|
211
192
|
this.checkoutSession.fields = {
|
|
212
193
|
...this.checkoutSession.fields,
|
|
213
194
|
...fieldsData
|
|
@@ -6,7 +6,15 @@ export interface Wishlist {
|
|
|
6
6
|
}
|
|
7
7
|
export interface WishlistProduct {
|
|
8
8
|
id: number;
|
|
9
|
-
|
|
9
|
+
slug: string;
|
|
10
|
+
name: string;
|
|
11
|
+
image: string;
|
|
12
|
+
price: string;
|
|
13
|
+
pricefloat: number;
|
|
14
|
+
rp: string;
|
|
15
|
+
rpfloat: number;
|
|
16
|
+
type: string;
|
|
17
|
+
brandimage: string;
|
|
10
18
|
}
|
|
11
19
|
export interface WishlistProducts {
|
|
12
20
|
[listId: number]: WishlistProduct[];
|
|
@@ -113,7 +121,7 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
|
|
|
113
121
|
addWishlistProduct(listId: number, product: WishlistProduct): void;
|
|
114
122
|
removeWishlistProduct(listId: number, productSlug: string): void;
|
|
115
123
|
clearWishlistProducts(listId: number): void;
|
|
116
|
-
fetchWishlists(): Promise<ApiResponse<Wishlist[]>>;
|
|
124
|
+
fetchWishlists(force?: boolean): Promise<ApiResponse<Wishlist[]>>;
|
|
117
125
|
fetchWishlistProducts(listId: number): Promise<ApiResponse<{
|
|
118
126
|
id: number;
|
|
119
127
|
title: string;
|
|
@@ -42,15 +42,23 @@ export const useWishlistsStore = defineStore("wishlists", {
|
|
|
42
42
|
removeWishlistProduct(listId, productSlug) {
|
|
43
43
|
if (this.wishlistProducts[listId]) {
|
|
44
44
|
this.wishlistProducts[listId] = this.wishlistProducts[listId].filter(
|
|
45
|
-
(product) => product.
|
|
45
|
+
(product) => product.slug !== productSlug
|
|
46
|
+
// Changed from productSlug to slug
|
|
46
47
|
);
|
|
47
48
|
}
|
|
48
49
|
},
|
|
49
50
|
clearWishlistProducts(listId) {
|
|
50
51
|
delete this.wishlistProducts[listId];
|
|
51
52
|
},
|
|
52
|
-
// Fetch all wishlists
|
|
53
|
-
async fetchWishlists() {
|
|
53
|
+
// Fetch all wishlists - Added force param for cache bypass
|
|
54
|
+
async fetchWishlists(force = false) {
|
|
55
|
+
if (!force && this.wishlists.length > 0) {
|
|
56
|
+
return {
|
|
57
|
+
status: "Success",
|
|
58
|
+
data: this.wishlists,
|
|
59
|
+
message: null
|
|
60
|
+
};
|
|
61
|
+
}
|
|
54
62
|
try {
|
|
55
63
|
const config = useRuntimeConfig();
|
|
56
64
|
let rawCookies = "";
|
|
@@ -115,7 +123,7 @@ export const useWishlistsStore = defineStore("wishlists", {
|
|
|
115
123
|
body: data
|
|
116
124
|
});
|
|
117
125
|
if (response.status === "Success") {
|
|
118
|
-
await this.fetchWishlists();
|
|
126
|
+
await this.fetchWishlists(true);
|
|
119
127
|
return response;
|
|
120
128
|
} else {
|
|
121
129
|
return response;
|
|
@@ -165,6 +173,7 @@ export const useWishlistsStore = defineStore("wishlists", {
|
|
|
165
173
|
const apiUrl = `mystore/customer/wishlist/${listId}/item/delete`;
|
|
166
174
|
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
167
175
|
body: { ids: { productSlug } }
|
|
176
|
+
// Assuming API expects this format
|
|
168
177
|
});
|
|
169
178
|
if (response.status === "Success") {
|
|
170
179
|
this.removeWishlistProduct(listId, productSlug);
|