cloudcommerce 0.0.91 → 0.0.93
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 +14 -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 +4 -2
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +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/package.json +1 -1
- package/packages/storefront/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/pnpm-workspace.yaml +1 -0
|
@@ -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,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAErD,MAAM,mBAAmB,GAAG,KAAK,EAAE,KAAyB,EAAE,EAAE;IAC9D,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,wBAAwB,KAAK,EAAE,CAAC,CAAC;QAChE,IAAI,IAAI,CAAC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,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';
|
package/pnpm-workspace.yaml
CHANGED