cloudcommerce 0.0.92 → 0.0.94
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 +19 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/cli/config/firebase.json +7 -2
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/lib/firebase.js +2 -1
- package/packages/events/lib/index.js +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/modules/lib/firebase/checkout.js +162 -0
- package/packages/modules/lib/firebase/checkout.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/fix-items.js +200 -0
- package/packages/modules/lib/firebase/functions-checkout/fix-items.js.map +1 -0
- package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js +34 -0
- package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js.map +1 -0
- package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js +123 -0
- package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js.map +1 -0
- package/packages/modules/lib/firebase/functions-checkout/new-order.js +191 -0
- package/packages/modules/lib/firebase/functions-checkout/new-order.js.map +1 -0
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js +67 -0
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js.map +1 -0
- package/packages/modules/lib/firebase/functions-checkout/utils.js +227 -0
- package/packages/modules/lib/firebase/functions-checkout/utils.js.map +1 -0
- package/packages/modules/lib/firebase/serve-modules-api.js +9 -4
- package/packages/modules/lib/firebase/serve-modules-api.js.map +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/modules/schemas/@checkout.cjs +1 -1
- package/packages/modules/src/firebase/checkout.ts +235 -0
- package/packages/modules/src/firebase/functions-checkout/fix-items.ts +219 -0
- package/packages/modules/src/firebase/functions-checkout/get-custumerId.ts +33 -0
- package/packages/modules/src/firebase/functions-checkout/handle-order-transaction.ts +195 -0
- package/packages/modules/src/firebase/functions-checkout/new-order.ts +273 -0
- package/packages/modules/src/firebase/functions-checkout/request-to-module.ts +76 -0
- package/packages/modules/src/firebase/functions-checkout/utils.ts +301 -0
- package/packages/modules/src/firebase/serve-modules-api.ts +9 -4
- package/packages/modules/src/types/index.d.ts +67 -0
- package/packages/passport/lib/firebase/handle-passport.js +3 -1
- package/packages/passport/lib/firebase/handle-passport.js.map +1 -1
- package/packages/passport/lib/index.js +1 -0
- package/packages/passport/lib/index.js.map +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/passport/src/firebase/handle-passport.ts +2 -0
- package/packages/passport/src/index.ts +1 -0
- package/packages/ssr/lib/firebase.js +5 -3
- package/packages/ssr/lib/firebase.js.map +1 -1
- package/packages/ssr/package.json +1 -4
- package/packages/ssr/src/firebase.ts +6 -3
- package/packages/storefront/astro.config.mjs +4 -9
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +23 -348
- package/packages/storefront/package.json +1 -2
- package/packages/storefront/src/lib/helpers/image.ts +16 -29
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +2 -5
- package/packages/storefront/storefront.config.mjs +7 -7
- package/packages/types/package.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import type { Response } from 'firebase-functions';
|
|
2
|
+
import type {
|
|
3
|
+
CheckoutBodyWithItems,
|
|
4
|
+
BodyOrder,
|
|
5
|
+
BodyPayment,
|
|
6
|
+
PaymentGateways,
|
|
7
|
+
PaymentMethod,
|
|
8
|
+
Amount,
|
|
9
|
+
Item,
|
|
10
|
+
ShippingSerive,
|
|
11
|
+
ShippingLine,
|
|
12
|
+
} from '../../types/index';
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line padding-line-between-statements
|
|
15
|
+
import logger from 'firebase-functions/lib/logger';
|
|
16
|
+
|
|
17
|
+
type BodyResouce = {[key:string]:any}
|
|
18
|
+
|
|
19
|
+
const sendError = (
|
|
20
|
+
res:Response,
|
|
21
|
+
status: number,
|
|
22
|
+
errorCode: string | number,
|
|
23
|
+
message: string,
|
|
24
|
+
userMessage?: {[key:string]:string},
|
|
25
|
+
moreInfo?:string,
|
|
26
|
+
) => {
|
|
27
|
+
return res.status(status)
|
|
28
|
+
.send({
|
|
29
|
+
status,
|
|
30
|
+
error_code: errorCode,
|
|
31
|
+
message,
|
|
32
|
+
user_message: userMessage,
|
|
33
|
+
more_info: moreInfo,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const fixAmount = (
|
|
38
|
+
amount: Amount,
|
|
39
|
+
body: CheckoutBodyWithItems,
|
|
40
|
+
orderBody: BodyOrder,
|
|
41
|
+
) => {
|
|
42
|
+
Object.keys(amount).forEach((field) => {
|
|
43
|
+
if (amount[field] > 0 && field !== 'total') {
|
|
44
|
+
amount[field] = Math.round(amount[field] * 100) / 100;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
amount.total = Math.round(
|
|
49
|
+
((amount.subtotal || 0) + (amount.freight || 0) - (amount.discount || 0)) * 100,
|
|
50
|
+
) / 100;
|
|
51
|
+
if (amount.total < 0) {
|
|
52
|
+
amount.total = 0;
|
|
53
|
+
}
|
|
54
|
+
// also save amount to checkout and order body objects
|
|
55
|
+
body.amount = amount;
|
|
56
|
+
orderBody.amount = amount;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const getValidResults = (
|
|
60
|
+
results: {[key:string]:any} [],
|
|
61
|
+
checkProp?:string,
|
|
62
|
+
) => {
|
|
63
|
+
// results array returned from module
|
|
64
|
+
// see ./#applications.js
|
|
65
|
+
const validResults: {[key:string]:any}[] = [];
|
|
66
|
+
if (Array.isArray(results)) {
|
|
67
|
+
for (let i = 0; i < results.length; i++) {
|
|
68
|
+
const result = results[i];
|
|
69
|
+
if (result.validated) {
|
|
70
|
+
if (checkProp) {
|
|
71
|
+
// validate one property from response object
|
|
72
|
+
const responseProp = result.response[checkProp];
|
|
73
|
+
if (!responseProp || (Array.isArray(responseProp) && !responseProp.length)) {
|
|
74
|
+
// try next module result
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// use it
|
|
79
|
+
validResults.push(result);
|
|
80
|
+
} else {
|
|
81
|
+
// help identify likely app response errors
|
|
82
|
+
logger.error(result.response_errors);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return validResults;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleListPayments = (
|
|
90
|
+
body: CheckoutBodyWithItems,
|
|
91
|
+
listPayment: {[key:string]:any},
|
|
92
|
+
paymentsBody: BodyPayment,
|
|
93
|
+
amount:Amount,
|
|
94
|
+
orderBody: BodyOrder,
|
|
95
|
+
) => {
|
|
96
|
+
for (let i = 0; i < listPayment.length; i++) {
|
|
97
|
+
const result = listPayment[i];
|
|
98
|
+
// treat list payments response
|
|
99
|
+
const { response } = result;
|
|
100
|
+
if (response && response.payment_gateways) {
|
|
101
|
+
// check chosen payment method code and name
|
|
102
|
+
const paymentMethod: PaymentMethod = paymentsBody.transaction.payment_method;
|
|
103
|
+
let paymentMethodCode: PaymentMethod['code'];
|
|
104
|
+
let paymentMethodName:PaymentMethod['name'];
|
|
105
|
+
if (paymentMethod) {
|
|
106
|
+
paymentMethodCode = paymentMethod.code;
|
|
107
|
+
paymentMethodName = paymentMethod.name;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// filter gateways by method code
|
|
111
|
+
const possibleGateways: PaymentGateways = response.payment_gateways.filter(
|
|
112
|
+
(paymentGatewayFound: PaymentGateways[number]) => {
|
|
113
|
+
const paymentMethodFound = paymentGatewayFound.payment_method;
|
|
114
|
+
return !paymentMethodCode
|
|
115
|
+
|| (paymentMethodFound && paymentMethodFound.code === paymentMethodCode);
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
let paymentGateway: PaymentGateways[number] | undefined;
|
|
119
|
+
if (possibleGateways.length > 1 && paymentMethodName) {
|
|
120
|
+
// prefer respective method name
|
|
121
|
+
paymentGateway = possibleGateways.find(
|
|
122
|
+
(paymentGatewayFound: PaymentGateways[number]) => {
|
|
123
|
+
return paymentGatewayFound.payment_method.name === paymentMethodName;
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
if (!paymentGateway) {
|
|
128
|
+
[paymentGateway] = possibleGateways;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (paymentGateway) {
|
|
132
|
+
const { discount } = paymentGateway;
|
|
133
|
+
|
|
134
|
+
// handle discount by payment method
|
|
135
|
+
const applyDiscountIn = discount && discount.apply_at;
|
|
136
|
+
if (applyDiscountIn && discount.value && amount[applyDiscountIn]) {
|
|
137
|
+
const maxDiscount: number = amount[applyDiscountIn] || 0;
|
|
138
|
+
// update amount discount and total
|
|
139
|
+
let discountValue: number;
|
|
140
|
+
if (discount.type === 'percentage') {
|
|
141
|
+
discountValue = (maxDiscount * discount.value) / 100;
|
|
142
|
+
} else {
|
|
143
|
+
discountValue = discount.value;
|
|
144
|
+
if (discountValue > maxDiscount) {
|
|
145
|
+
discountValue = maxDiscount;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
amount.discount = amount.discount ? amount.discount : 0;
|
|
149
|
+
amount.discount += discountValue;
|
|
150
|
+
fixAmount(amount, body, orderBody);
|
|
151
|
+
}
|
|
152
|
+
// add to order body
|
|
153
|
+
orderBody.payment_method_label = paymentGateway.label || '';
|
|
154
|
+
|
|
155
|
+
// finally start creating new order
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// simulate requets to calculate shipping endpoint
|
|
162
|
+
const handleShippingServices = (
|
|
163
|
+
body: CheckoutBodyWithItems,
|
|
164
|
+
listShipping: BodyResouce,
|
|
165
|
+
amount:Amount,
|
|
166
|
+
orderBody: BodyOrder,
|
|
167
|
+
) => {
|
|
168
|
+
for (let i = 0; i < listShipping.length; i++) {
|
|
169
|
+
const result = listShipping[i];
|
|
170
|
+
// treat calculate shipping response
|
|
171
|
+
const { response } = result;
|
|
172
|
+
if (response && response.shipping_services) {
|
|
173
|
+
// check chosen shipping code
|
|
174
|
+
const shippingCode = body.shipping.service_code;
|
|
175
|
+
|
|
176
|
+
for (let index = 0; index < response.shipping_services.length; index++) {
|
|
177
|
+
const shippingService: ShippingSerive = response.shipping_services[index];
|
|
178
|
+
const shippingLine: ShippingLine = shippingService.shipping_line;
|
|
179
|
+
if (shippingLine && (!shippingCode || shippingCode === shippingService.service_code)) {
|
|
180
|
+
// update amount freight and total
|
|
181
|
+
const priceFreight = (typeof shippingLine.price === 'number'
|
|
182
|
+
? shippingLine.price
|
|
183
|
+
: 0);
|
|
184
|
+
let freight = typeof shippingLine.total_price === 'number'
|
|
185
|
+
? shippingLine.total_price
|
|
186
|
+
: priceFreight;
|
|
187
|
+
if (freight < 0) {
|
|
188
|
+
freight = 0;
|
|
189
|
+
}
|
|
190
|
+
amount.freight = freight;
|
|
191
|
+
fixAmount(amount, body, orderBody);
|
|
192
|
+
|
|
193
|
+
// app info
|
|
194
|
+
const shippingApp = {
|
|
195
|
+
app: { _id: result._id, ...shippingService },
|
|
196
|
+
};
|
|
197
|
+
// remove shipping line property
|
|
198
|
+
delete shippingApp.app.shipping_line;
|
|
199
|
+
|
|
200
|
+
// sum production time to posting deadline
|
|
201
|
+
let maxProductionDays = 0;
|
|
202
|
+
if (orderBody.items) {
|
|
203
|
+
orderBody.items.forEach(
|
|
204
|
+
(item:Item) => {
|
|
205
|
+
const productionTime = item.production_time;
|
|
206
|
+
if (productionTime) {
|
|
207
|
+
let productionDays = productionTime.days;
|
|
208
|
+
if (productionDays && productionTime.cumulative) {
|
|
209
|
+
productionDays *= item.quantity;
|
|
210
|
+
}
|
|
211
|
+
if (productionTime.max_time) {
|
|
212
|
+
if (productionDays > productionTime.max_time) {
|
|
213
|
+
productionDays = productionTime.max_time;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (maxProductionDays < productionDays) {
|
|
217
|
+
maxProductionDays = productionDays;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
if (maxProductionDays) {
|
|
224
|
+
if (!shippingLine.posting_deadline) {
|
|
225
|
+
shippingLine.posting_deadline = {
|
|
226
|
+
days: 0,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
shippingLine.posting_deadline.days += maxProductionDays;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// add to order body
|
|
233
|
+
orderBody.shipping_lines = [
|
|
234
|
+
// generate new object id and compose shipping line object
|
|
235
|
+
{ ...shippingApp, ...shippingLine },
|
|
236
|
+
];
|
|
237
|
+
orderBody.shipping_method_label = shippingService.label || '';
|
|
238
|
+
|
|
239
|
+
// continue to discount step
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const handleApplyDiscount = (
|
|
247
|
+
body: CheckoutBodyWithItems,
|
|
248
|
+
listDiscount: BodyResouce,
|
|
249
|
+
amount:Amount,
|
|
250
|
+
orderBody: BodyOrder,
|
|
251
|
+
) => {
|
|
252
|
+
// simulate request to apply discount endpoint to get extra discount value
|
|
253
|
+
for (let i = 0; i < listDiscount.length; i++) {
|
|
254
|
+
const result = listDiscount[i];
|
|
255
|
+
// treat apply discount response
|
|
256
|
+
const { response } = result;
|
|
257
|
+
if (response && response.discount_rule) {
|
|
258
|
+
// check discount value
|
|
259
|
+
const discountRule = response.discount_rule;
|
|
260
|
+
const extraDiscount = discountRule.extra_discount;
|
|
261
|
+
|
|
262
|
+
if (extraDiscount && extraDiscount.value) {
|
|
263
|
+
// update amount and save extra discount to order body
|
|
264
|
+
amount.discount += extraDiscount.value;
|
|
265
|
+
fixAmount(amount, body, orderBody);
|
|
266
|
+
orderBody.extra_discount = {
|
|
267
|
+
...body.discount,
|
|
268
|
+
...extraDiscount,
|
|
269
|
+
// app info
|
|
270
|
+
app: {
|
|
271
|
+
...discountRule,
|
|
272
|
+
_id: result._id,
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
if (response.freebie_product_ids) {
|
|
277
|
+
// mark items provided for free
|
|
278
|
+
orderBody.items.forEach((item) => {
|
|
279
|
+
if (!item.flags) {
|
|
280
|
+
item.flags = [];
|
|
281
|
+
}
|
|
282
|
+
if (response.freebie_product_ids.includes(item.product_id)) {
|
|
283
|
+
item.flags.push('discount-set-free');
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// proceed to list payments
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export {
|
|
295
|
+
sendError,
|
|
296
|
+
fixAmount,
|
|
297
|
+
getValidResults,
|
|
298
|
+
handleShippingServices,
|
|
299
|
+
handleApplyDiscount,
|
|
300
|
+
handleListPayments,
|
|
301
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Request, Response } from 'firebase-functions';
|
|
2
2
|
import { schemas } from '../index';
|
|
3
3
|
import handleModule from './handle-module';
|
|
4
|
+
import checkout from './checkout';
|
|
4
5
|
|
|
5
6
|
export default (req: Request, res: Response) => {
|
|
6
7
|
const { method } = req;
|
|
@@ -29,10 +30,14 @@ export default (req: Request, res: Response) => {
|
|
|
29
30
|
|
|
30
31
|
if (modName === '@checkout') {
|
|
31
32
|
if (url === '/@checkout') {
|
|
32
|
-
|
|
33
|
-
status
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
if (method === 'GET') {
|
|
34
|
+
return res.status(405)
|
|
35
|
+
.send({
|
|
36
|
+
error_code: 'CKT101',
|
|
37
|
+
message: 'GET is acceptable only to JSON schema, at /@checkout/schema',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return checkout(schemas[modName].params, req, res, req.hostname);
|
|
36
41
|
}
|
|
37
42
|
if (url === '/@checkout/schema') {
|
|
38
43
|
return sendSchema();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CheckoutBody,
|
|
3
|
+
Carts,
|
|
4
|
+
Orders,
|
|
5
|
+
CalculateShippingResponse,
|
|
6
|
+
ListPaymentsResponse
|
|
7
|
+
} from '@cloudcommerce/types';
|
|
8
|
+
import { Transaction } from '@cloudcommerce/types/modules/@checkout:params';
|
|
9
|
+
|
|
10
|
+
type Items = Carts['items']
|
|
11
|
+
type Item = Items[number]
|
|
12
|
+
|
|
13
|
+
type Amount = Orders['amount']
|
|
14
|
+
|
|
15
|
+
type CheckoutBodyWithItems = Omit<CheckoutBody, 'items'> & {
|
|
16
|
+
items: Items
|
|
17
|
+
subtotal: number,
|
|
18
|
+
amount: Amount
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type CustomerCheckout = Exclude<CheckoutBody['customer'], undefined>
|
|
22
|
+
type BodyOrder = Omit<Orders, '_id' | 'created_at' | 'updated_at' | 'store_id' | 'items' > & {
|
|
23
|
+
items : Item[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type TransactionOrder = Exclude<Orders['transactions'], undefined>[number]
|
|
27
|
+
type StatusTransactionOrder = Pick<TransactionOrder, 'status'>['status']
|
|
28
|
+
type BodyTransactionOrder = Omit<TransactionOrder, 'status'> & {
|
|
29
|
+
status: StatusTransactionOrder
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type OrderPaymentHistory = Pick<Orders,'payments_history'| 'financial_status' | 'amount'>
|
|
33
|
+
type BodyPaymentHistory = Exclude<Pick<Orders,'payments_history'>['payments_history'], undefined>[number]
|
|
34
|
+
|
|
35
|
+
type CheckoutTransaction = Exclude<CheckoutBody['transaction'], Transaction[]>
|
|
36
|
+
|
|
37
|
+
type BodyPayment = Omit<CheckoutBodyItems, 'transaction'> & {
|
|
38
|
+
transaction: CheckoutTransaction
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type CheckoutShippingService = CalculateShippingResponse['shipping_services'][number]
|
|
42
|
+
type ShippingLine = CheckoutShippingSerive['shipping_line']
|
|
43
|
+
type ShippingSerive = Omit<CheckoutShippingService, 'shipping_line'> & {
|
|
44
|
+
shipping_line?: ShippingLine
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type PaymentGateways = ListPaymentsResponse['payment_gateways']
|
|
48
|
+
type PaymentMethod = Pick<PaymentGateways[number]['payment_method'], 'code' | 'name'>
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
CheckoutBodyWithItems,
|
|
52
|
+
BodyPayment,
|
|
53
|
+
Items,
|
|
54
|
+
Item,
|
|
55
|
+
CustomerCheckout,
|
|
56
|
+
BodyOrder,
|
|
57
|
+
PaymentMethod,
|
|
58
|
+
Amount,
|
|
59
|
+
ShippingSerive,
|
|
60
|
+
ShippingLine,
|
|
61
|
+
PaymentGateways,
|
|
62
|
+
CheckoutTransaction,
|
|
63
|
+
TransactionOrder,
|
|
64
|
+
OrderPaymentHistory,
|
|
65
|
+
BodyTransactionOrder,
|
|
66
|
+
BodyPaymentHistory
|
|
67
|
+
};
|
|
@@ -106,5 +106,7 @@ const sendError = (res, msg, status = 400) => {
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
export {
|
|
109
|
+
export {
|
|
110
|
+
sendError, getAuthCustomerApi, findCustomerByEmail, generateAccessToken,
|
|
111
|
+
};
|
|
110
112
|
// # sourceMappingURL=handle-passport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-passport.js","sourceRoot":"","sources":["../../src/firebase/handle-passport.ts"],"names":[],"mappings":"AAKA,OA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CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YACtB,MAAM;YACN,KAAK,EAAE,GAAG;SACX,CAAC,CAAC;KACJ;SAAM;QACL,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,uBAAuB;SAC/B,CAAC,CAAC;KACJ;AACH,CAAC,CAAC;AAEF,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { findCustomerByEmail, generateAccessToken } from './firebase/handle-passport';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
import '@cloudcommerce/
|
|
3
|
-
|
|
1
|
+
/* eslint-disable import/prefer-default-export, import/no-unresolved, import/first */
|
|
2
|
+
import '@cloudcommerce/api/fetch-polyfill';
|
|
3
|
+
import { initializeApp } from 'firebase-admin/app';
|
|
4
|
+
|
|
5
|
+
initializeApp();
|
|
4
6
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
7
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
8
|
import serveStorefront from './firebase/serve-storefront.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,aAAa,EAAE,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;IAC3B,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,QAAQ;IAChB,mBAAmB;IACnB,GAAG,oBAAoB;CACxB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACd,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/ssr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.94",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -37,9 +37,6 @@
|
|
|
37
37
|
"mime": "^3.0.0",
|
|
38
38
|
"path-browserify": "^1.0.1",
|
|
39
39
|
"path-to-regexp": "^6.2.1",
|
|
40
|
-
"sharp": "^0.31.0",
|
|
41
|
-
"slash": "^4.0.0",
|
|
42
|
-
"source-map-support": "^0.5.21",
|
|
43
40
|
"string-width": "^5.1.2",
|
|
44
41
|
"vue": "^3.2.39"
|
|
45
42
|
},
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
import '@cloudcommerce/
|
|
3
|
-
|
|
1
|
+
/* eslint-disable import/prefer-default-export, import/no-unresolved, import/first */
|
|
2
|
+
import '@cloudcommerce/api/fetch-polyfill';
|
|
3
|
+
import { initializeApp } from 'firebase-admin/app';
|
|
4
|
+
|
|
5
|
+
initializeApp();
|
|
6
|
+
|
|
4
7
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
8
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
9
|
import serveStorefront from './firebase/serve-storefront';
|
|
@@ -4,7 +4,6 @@ import * as dotenv from 'dotenv';
|
|
|
4
4
|
import { defineConfig } from 'astro/config';
|
|
5
5
|
import node from '@astrojs/node';
|
|
6
6
|
import vue from '@astrojs/vue';
|
|
7
|
-
import image from '@astrojs/image';
|
|
8
7
|
import partytown from '@astrojs/partytown';
|
|
9
8
|
import prefetch from '@astrojs/prefetch';
|
|
10
9
|
import sitemap from '@astrojs/sitemap';
|
|
@@ -65,15 +64,12 @@ const _vitePWAOptions = {
|
|
|
65
64
|
cacheName: 'assets',
|
|
66
65
|
},
|
|
67
66
|
}, {
|
|
68
|
-
urlPattern:
|
|
67
|
+
urlPattern: settings.logo
|
|
68
|
+
? new RegExp(`^${(settings.mini_logo ? `(?:${settings.mini_logo}|${settings.logo})` : settings.logo)}$`)
|
|
69
|
+
: /^\/(?:img\/uploads\/|img\/)?logo\.(?:png|jpg|jpeg|webp|avif|svg)$/,
|
|
69
70
|
handler: 'StaleWhileRevalidate',
|
|
70
71
|
options: {
|
|
71
|
-
cacheName: '
|
|
72
|
-
expiration: {
|
|
73
|
-
maxEntries: 50,
|
|
74
|
-
maxAgeSeconds: 60 * 60 * 24 * 30, // 30 days
|
|
75
|
-
purgeOnQuotaError: true,
|
|
76
|
-
},
|
|
72
|
+
cacheName: 'logo',
|
|
77
73
|
},
|
|
78
74
|
}, {
|
|
79
75
|
urlPattern: /^\/img\/uploads\/.*\.(?:png|jpg|jpeg|webp|avif|svg|gif)$/,
|
|
@@ -130,7 +126,6 @@ const genAstroConfig = ({
|
|
|
130
126
|
adapter: node(),
|
|
131
127
|
integrations: [
|
|
132
128
|
vue(),
|
|
133
|
-
image(),
|
|
134
129
|
partytown(),
|
|
135
130
|
prefetch(),
|
|
136
131
|
sitemap(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,
|
|
1
|
+
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let a={};const t=e=>n(e,r),c={module:{uri:r},exports:a,require:t};s[r]=Promise.all(i.map((e=>c[e]||t(e)))).then((e=>(o(...e),a)))}}define(["./workbox-6f0d1f78"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"chunks/workbox-window.prod.es5.4b654ae6.js",revision:null},{url:"client.80baece3.js",revision:null},{url:"hoisted.46e058d2.js",revision:null},{url:"page.3aa82516.js",revision:null},{url:"img/icon.png",revision:"791be7ee6538f26bb57bc31243a6e17e"},{url:"img/large-icon.png",revision:"0b35db516cfa7475b1c2f8c081e8d54d"},{url:"manifest.webmanifest",revision:"f3f24fe1b3d542152ca2f18813168ad6"}],{ignoreURLParametersMatching:[/.*/]}),e.cleanupOutdatedCaches(),e.registerRoute(/^\/$/,new e.NetworkFirst,"GET"),e.registerRoute(/\/((?!(?:admin|assets|img)(\/|$))[^.]+)(\.(?!js|css|xml|txt|png|jpg|jpeg|webp|avif|svg|gif)[^.]+)*$/,new e.NetworkFirst({cacheName:"pages",plugins:[new e.ExpirationPlugin({maxEntries:50,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^\/assets\//,new e.StaleWhileRevalidate({cacheName:"assets",plugins:[]}),"GET"),e.registerRoute(/^\/img\/uploads\/logo.webp$/,new e.StaleWhileRevalidate({cacheName:"logo",plugins:[]}),"GET"),e.registerRoute(/^\/img\/uploads\/.*\.(?:png|jpg|jpeg|webp|avif|svg|gif)$/,new e.StaleWhileRevalidate({cacheName:"cms-images",plugins:[new e.ExpirationPlugin({maxEntries:20,maxAgeSeconds:2592e3,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/ecomplus\.io/,new e.NetworkFirst({cacheName:"store-api",plugins:[new e.ExpirationPlugin({maxEntries:50,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/(((\w+\.)?ecoms\d)|(ecom[\w-]+(\.\w+)*\.digitaloceanspaces))\.com.*\/imgs\/normal\//,new e.CacheFirst({cacheName:"product-thumbnails",plugins:[new e.ExpirationPlugin({maxEntries:100,maxAgeSeconds:2592e3,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/(((\w+\.)?ecoms\d)|(ecom[\w-]+(\.\w+)*\.digitaloceanspaces))\.com.*\/imgs\/big\//,new e.CacheFirst({cacheName:"product-pictures",plugins:[new e.ExpirationPlugin({maxEntries:10,maxAgeSeconds:604800,purgeOnQuotaError:!0})]}),"GET")}));
|