@payloadcms/plugin-stripe 0.0.19 → 3.0.0-beta.23
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/README.md +3 -285
- package/dist/admin.d.ts +4 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +34 -0
- package/dist/admin.js.map +1 -0
- package/dist/fields/getFields.d.ts +12 -0
- package/dist/fields/getFields.d.ts.map +1 -0
- package/dist/fields/getFields.js +46 -0
- package/dist/fields/getFields.js.map +1 -0
- package/dist/hooks/createNewInStripe.d.ts +7 -2
- package/dist/hooks/createNewInStripe.d.ts.map +1 -0
- package/dist/hooks/createNewInStripe.js +70 -124
- package/dist/hooks/createNewInStripe.js.map +1 -1
- package/dist/hooks/deleteFromStripe.d.ts +7 -2
- package/dist/hooks/deleteFromStripe.d.ts.map +1 -0
- package/dist/hooks/deleteFromStripe.js +30 -87
- package/dist/hooks/deleteFromStripe.js.map +1 -1
- package/dist/hooks/syncExistingWithStripe.d.ts +7 -2
- package/dist/hooks/syncExistingWithStripe.d.ts.map +1 -0
- package/dist/hooks/syncExistingWithStripe.js +42 -94
- package/dist/hooks/syncExistingWithStripe.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -166
- package/dist/index.js.map +1 -1
- package/dist/routes/rest.d.ts +4 -6
- package/dist/routes/rest.d.ts.map +1 -0
- package/dist/routes/rest.js +33 -76
- package/dist/routes/rest.js.map +1 -1
- package/dist/routes/webhooks.d.ts +4 -6
- package/dist/routes/webhooks.d.ts.map +1 -0
- package/dist/routes/webhooks.js +49 -94
- package/dist/routes/webhooks.js.map +1 -1
- package/dist/types.d.ts +138 -11
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/dist/ui/LinkToDoc.d.ts +4 -7
- package/dist/ui/LinkToDoc.d.ts.map +1 -0
- package/dist/ui/LinkToDoc.js +29 -31
- package/dist/ui/LinkToDoc.js.map +1 -1
- package/dist/utilities/deepen.d.ts +1 -0
- package/dist/utilities/deepen.d.ts.map +1 -0
- package/dist/utilities/deepen.js +9 -16
- package/dist/utilities/deepen.js.map +1 -1
- package/dist/utilities/stripeProxy.d.ts +2 -1
- package/dist/utilities/stripeProxy.d.ts.map +1 -0
- package/dist/utilities/stripeProxy.js +37 -88
- package/dist/utilities/stripeProxy.js.map +1 -1
- package/dist/webhooks/handleCreatedOrUpdated.d.ts +3 -2
- package/dist/webhooks/handleCreatedOrUpdated.d.ts.map +1 -0
- package/dist/webhooks/handleCreatedOrUpdated.js +115 -196
- package/dist/webhooks/handleCreatedOrUpdated.js.map +1 -1
- package/dist/webhooks/handleDeleted.d.ts +2 -1
- package/dist/webhooks/handleDeleted.d.ts.map +1 -0
- package/dist/webhooks/handleDeleted.js +44 -102
- package/dist/webhooks/handleDeleted.js.map +1 -1
- package/dist/webhooks/index.d.ts +2 -1
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +46 -90
- package/dist/webhooks/index.js.map +1 -1
- package/package.json +50 -45
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/dist/extendWebpackConfig.d.ts +0 -3
- package/dist/extendWebpackConfig.js +0 -31
- package/dist/extendWebpackConfig.js.map +0 -1
- package/dist/mocks/serverModule.d.ts +0 -2
- package/dist/mocks/serverModule.js +0 -6
- package/dist/mocks/serverModule.js.map +0 -1
package/dist/routes/webhooks.js
CHANGED
|
@@ -1,112 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
1
|
+
import Stripe from 'stripe';
|
|
2
|
+
import { handleWebhooks } from '../webhooks/index.js';
|
|
3
|
+
export const stripeWebhooks = async (args)=>{
|
|
4
|
+
const { config, req, stripeConfig } = args;
|
|
5
|
+
let returnStatus = 200;
|
|
6
|
+
const { stripeSecretKey, stripeWebhooksEndpointSecret, webhooks } = stripeConfig;
|
|
7
|
+
if (stripeWebhooksEndpointSecret) {
|
|
8
|
+
const stripe = new Stripe(stripeSecretKey, {
|
|
9
|
+
// api version can only be the latest, stripe recommends ts ignoring it
|
|
10
|
+
apiVersion: '2022-08-01',
|
|
11
|
+
appInfo: {
|
|
12
|
+
name: 'Stripe Payload Plugin',
|
|
13
|
+
url: 'https://payloadcms.com'
|
|
32
14
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (!stripeWebhooksEndpointSecret) return [3 /*break*/, 2];
|
|
53
|
-
stripe = new stripe_1.default(stripeSecretKey, {
|
|
54
|
-
apiVersion: '2022-08-01',
|
|
55
|
-
appInfo: {
|
|
56
|
-
name: 'Stripe Payload Plugin',
|
|
57
|
-
url: 'https://payloadcms.com',
|
|
58
|
-
},
|
|
15
|
+
});
|
|
16
|
+
const body = await req.text();
|
|
17
|
+
const stripeSignature = req.headers.get('stripe-signature');
|
|
18
|
+
if (stripeSignature) {
|
|
19
|
+
let event;
|
|
20
|
+
try {
|
|
21
|
+
event = stripe.webhooks.constructEvent(body, stripeSignature, stripeWebhooksEndpointSecret);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
const msg = err instanceof Error ? err.message : JSON.stringify(err);
|
|
24
|
+
req.payload.logger.error(`Error constructing Stripe event: ${msg}`);
|
|
25
|
+
returnStatus = 400;
|
|
26
|
+
}
|
|
27
|
+
if (event) {
|
|
28
|
+
handleWebhooks({
|
|
29
|
+
config,
|
|
30
|
+
event,
|
|
31
|
+
payload: req.payload,
|
|
32
|
+
stripe,
|
|
33
|
+
stripeConfig
|
|
59
34
|
});
|
|
60
|
-
stripeSignature = req.headers['stripe-signature'];
|
|
61
|
-
if (!stripeSignature) return [3 /*break*/, 2];
|
|
62
|
-
try {
|
|
63
|
-
event_1 = stripe.webhooks.constructEvent(req.body, stripeSignature, stripeWebhooksEndpointSecret);
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
msg = err instanceof Error ? err.message : err;
|
|
67
|
-
req.payload.logger.error("Error constructing Stripe event: ".concat(msg));
|
|
68
|
-
res.status(400);
|
|
69
|
-
}
|
|
70
|
-
if (!event_1) return [3 /*break*/, 2];
|
|
71
|
-
return [4 /*yield*/, (0, webhooks_1.handleWebhooks)({
|
|
72
|
-
payload: req.payload,
|
|
73
|
-
event: event_1,
|
|
74
|
-
stripe: stripe,
|
|
75
|
-
config: config,
|
|
76
|
-
stripeConfig: stripeConfig,
|
|
77
|
-
})
|
|
78
|
-
// Fire external webhook handlers if they exist
|
|
79
|
-
];
|
|
80
|
-
case 1:
|
|
81
|
-
_a.sent();
|
|
82
35
|
// Fire external webhook handlers if they exist
|
|
83
36
|
if (typeof webhooks === 'function') {
|
|
84
37
|
webhooks({
|
|
38
|
+
config,
|
|
39
|
+
event,
|
|
85
40
|
payload: req.payload,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
config: config,
|
|
89
|
-
stripeConfig: stripeConfig,
|
|
41
|
+
stripe,
|
|
42
|
+
stripeConfig
|
|
90
43
|
});
|
|
91
44
|
}
|
|
92
45
|
if (typeof webhooks === 'object') {
|
|
93
|
-
webhookEventHandler = webhooks[
|
|
46
|
+
const webhookEventHandler = webhooks[event.type];
|
|
94
47
|
if (typeof webhookEventHandler === 'function') {
|
|
95
48
|
webhookEventHandler({
|
|
49
|
+
config,
|
|
50
|
+
event,
|
|
96
51
|
payload: req.payload,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
config: config,
|
|
100
|
-
stripeConfig: stripeConfig,
|
|
52
|
+
stripe,
|
|
53
|
+
stripeConfig
|
|
101
54
|
});
|
|
102
55
|
}
|
|
103
56
|
}
|
|
104
|
-
|
|
105
|
-
case 2:
|
|
106
|
-
res.json({ received: true });
|
|
107
|
-
return [2 /*return*/];
|
|
57
|
+
}
|
|
108
58
|
}
|
|
59
|
+
}
|
|
60
|
+
return Response.json({
|
|
61
|
+
received: true
|
|
62
|
+
}, {
|
|
63
|
+
status: returnStatus
|
|
109
64
|
});
|
|
110
|
-
}
|
|
111
|
-
|
|
65
|
+
};
|
|
66
|
+
|
|
112
67
|
//# sourceMappingURL=webhooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/routes/webhooks.ts"],"sourcesContent":["import type { Config as PayloadConfig } from 'payload/config'\nimport type { PayloadRequestWithData } from 'payload/types'\n\nimport Stripe from 'stripe'\n\nimport type { StripeConfig } from '../types.js'\n\nimport { handleWebhooks } from '../webhooks/index.js'\n\nexport const stripeWebhooks = async (args: {\n config: PayloadConfig\n req: PayloadRequestWithData\n stripeConfig: StripeConfig\n}): Promise<any> => {\n const { config, req, stripeConfig } = args\n let returnStatus = 200\n\n const { stripeSecretKey, stripeWebhooksEndpointSecret, webhooks } = stripeConfig\n\n if (stripeWebhooksEndpointSecret) {\n const stripe = new Stripe(stripeSecretKey, {\n // api version can only be the latest, stripe recommends ts ignoring it\n apiVersion: '2022-08-01',\n appInfo: {\n name: 'Stripe Payload Plugin',\n url: 'https://payloadcms.com',\n },\n })\n\n const body = await req.text()\n const stripeSignature = req.headers.get('stripe-signature')\n\n if (stripeSignature) {\n let event: Stripe.Event | undefined\n\n try {\n event = stripe.webhooks.constructEvent(body, stripeSignature, stripeWebhooksEndpointSecret)\n } catch (err: unknown) {\n const msg: string = err instanceof Error ? err.message : JSON.stringify(err)\n req.payload.logger.error(`Error constructing Stripe event: ${msg}`)\n returnStatus = 400\n }\n\n if (event) {\n handleWebhooks({\n config,\n event,\n payload: req.payload,\n stripe,\n stripeConfig,\n })\n\n // Fire external webhook handlers if they exist\n if (typeof webhooks === 'function') {\n webhooks({\n config,\n event,\n payload: req.payload,\n stripe,\n stripeConfig,\n })\n }\n\n if (typeof webhooks === 'object') {\n const webhookEventHandler = webhooks[event.type]\n if (typeof webhookEventHandler === 'function') {\n webhookEventHandler({\n config,\n event,\n payload: req.payload,\n stripe,\n stripeConfig,\n })\n }\n }\n }\n }\n }\n\n return Response.json(\n { received: true },\n {\n status: returnStatus,\n },\n )\n}\n"],"names":["Stripe","handleWebhooks","stripeWebhooks","args","config","req","stripeConfig","returnStatus","stripeSecretKey","stripeWebhooksEndpointSecret","webhooks","stripe","apiVersion","appInfo","name","url","body","text","stripeSignature","headers","get","event","constructEvent","err","msg","Error","message","JSON","stringify","payload","logger","error","webhookEventHandler","type","Response","json","received","status"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,OAAOA,YAAY,SAAQ;AAI3B,SAASC,cAAc,QAAQ,uBAAsB;AAErD,OAAO,MAAMC,iBAAiB,OAAOC;IAKnC,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAEC,YAAY,EAAE,GAAGH;IACtC,IAAII,eAAe;IAEnB,MAAM,EAAEC,eAAe,EAAEC,4BAA4B,EAAEC,QAAQ,EAAE,GAAGJ;IAEpE,IAAIG,8BAA8B;QAChC,MAAME,SAAS,IAAIX,OAAOQ,iBAAiB;YACzC,uEAAuE;YACvEI,YAAY;YACZC,SAAS;gBACPC,MAAM;gBACNC,KAAK;YACP;QACF;QAEA,MAAMC,OAAO,MAAMX,IAAIY,IAAI;QAC3B,MAAMC,kBAAkBb,IAAIc,OAAO,CAACC,GAAG,CAAC;QAExC,IAAIF,iBAAiB;YACnB,IAAIG;YAEJ,IAAI;gBACFA,QAAQV,OAAOD,QAAQ,CAACY,cAAc,CAACN,MAAME,iBAAiBT;YAChE,EAAE,OAAOc,KAAc;gBACrB,MAAMC,MAAcD,eAAeE,QAAQF,IAAIG,OAAO,GAAGC,KAAKC,SAAS,CAACL;gBACxElB,IAAIwB,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,iCAAiC,EAAEP,IAAI,CAAC;gBAClEjB,eAAe;YACjB;YAEA,IAAIc,OAAO;gBACTpB,eAAe;oBACbG;oBACAiB;oBACAQ,SAASxB,IAAIwB,OAAO;oBACpBlB;oBACAL;gBACF;gBAEA,+CAA+C;gBAC/C,IAAI,OAAOI,aAAa,YAAY;oBAClCA,SAAS;wBACPN;wBACAiB;wBACAQ,SAASxB,IAAIwB,OAAO;wBACpBlB;wBACAL;oBACF;gBACF;gBAEA,IAAI,OAAOI,aAAa,UAAU;oBAChC,MAAMsB,sBAAsBtB,QAAQ,CAACW,MAAMY,IAAI,CAAC;oBAChD,IAAI,OAAOD,wBAAwB,YAAY;wBAC7CA,oBAAoB;4BAClB5B;4BACAiB;4BACAQ,SAASxB,IAAIwB,OAAO;4BACpBlB;4BACAL;wBACF;oBACF;gBACF;YACF;QACF;IACF;IAEA,OAAO4B,SAASC,IAAI,CAClB;QAAEC,UAAU;IAAK,GACjB;QACEC,QAAQ9B;IACV;AAEJ,EAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,137 @@
|
|
|
1
|
+
/// <reference types="stripe/types/crypto/crypto.js" />
|
|
2
|
+
/// <reference types="stripe/types/shared.js" />
|
|
3
|
+
/// <reference types="stripe/types/Errors.js" />
|
|
4
|
+
/// <reference types="stripe/types/OAuth.js" />
|
|
5
|
+
/// <reference types="stripe/types/Webhooks.js" />
|
|
6
|
+
/// <reference types="stripe/types/2022-08-01/AccountLinks.js" />
|
|
7
|
+
/// <reference types="stripe/types/2022-08-01/Accounts.js" />
|
|
8
|
+
/// <reference types="stripe/types/2022-08-01/ApplePayDomains.js" />
|
|
9
|
+
/// <reference types="stripe/types/2022-08-01/ApplicationFees.js" />
|
|
10
|
+
/// <reference types="stripe/types/2022-08-01/Applications.js" />
|
|
11
|
+
/// <reference types="stripe/types/2022-08-01/Apps/Secrets.js" />
|
|
12
|
+
/// <reference types="stripe/types/2022-08-01/Balance.js" />
|
|
13
|
+
/// <reference types="stripe/types/2022-08-01/BalanceTransactions.js" />
|
|
14
|
+
/// <reference types="stripe/types/2022-08-01/BankAccounts.js" />
|
|
15
|
+
/// <reference types="stripe/types/2022-08-01/BillingPortal/Configurations.js" />
|
|
16
|
+
/// <reference types="stripe/types/2022-08-01/BillingPortal/Sessions.js" />
|
|
17
|
+
/// <reference types="stripe/types/2022-08-01/Capabilities.js" />
|
|
18
|
+
/// <reference types="stripe/types/2022-08-01/Cards.js" />
|
|
19
|
+
/// <reference types="stripe/types/2022-08-01/CashBalances.js" />
|
|
20
|
+
/// <reference types="stripe/types/2022-08-01/Charges.js" />
|
|
21
|
+
/// <reference types="stripe/types/2022-08-01/Checkout/Sessions.js" />
|
|
22
|
+
/// <reference types="stripe/types/2022-08-01/ConnectCollectionTransfers.js" />
|
|
23
|
+
/// <reference types="stripe/types/2022-08-01/CountrySpecs.js" />
|
|
24
|
+
/// <reference types="stripe/types/2022-08-01/Coupons.js" />
|
|
25
|
+
/// <reference types="stripe/types/2022-08-01/CreditNoteLineItems.js" />
|
|
26
|
+
/// <reference types="stripe/types/2022-08-01/CreditNotes.js" />
|
|
27
|
+
/// <reference types="stripe/types/2022-08-01/CustomerBalanceTransactions.js" />
|
|
28
|
+
/// <reference types="stripe/types/2022-08-01/CustomerCashBalanceTransactions.js" />
|
|
29
|
+
/// <reference types="stripe/types/2022-08-01/CustomerSources.js" />
|
|
30
|
+
/// <reference types="stripe/types/2022-08-01/Customers.js" />
|
|
31
|
+
/// <reference types="stripe/types/2022-08-01/Discounts.js" />
|
|
32
|
+
/// <reference types="stripe/types/2022-08-01/Disputes.js" />
|
|
33
|
+
/// <reference types="stripe/types/2022-08-01/EphemeralKeys.js" />
|
|
34
|
+
/// <reference types="stripe/types/2022-08-01/Events.js" />
|
|
35
|
+
/// <reference types="stripe/types/2022-08-01/ExchangeRates.js" />
|
|
36
|
+
/// <reference types="stripe/types/2022-08-01/ExternalAccounts.js" />
|
|
37
|
+
/// <reference types="stripe/types/2022-08-01/FeeRefunds.js" />
|
|
38
|
+
/// <reference types="stripe/types/2022-08-01/FileLinks.js" />
|
|
39
|
+
/// <reference types="stripe/types/2022-08-01/Files.js" />
|
|
40
|
+
/// <reference types="stripe/types/2022-08-01/FinancialConnections/AccountOwners.js" />
|
|
41
|
+
/// <reference types="stripe/types/2022-08-01/FinancialConnections/AccountOwnerships.js" />
|
|
42
|
+
/// <reference types="stripe/types/2022-08-01/FinancialConnections/Accounts.js" />
|
|
43
|
+
/// <reference types="stripe/types/2022-08-01/FinancialConnections/Sessions.js" />
|
|
44
|
+
/// <reference types="stripe/types/2022-08-01/FundingInstructions.js" />
|
|
45
|
+
/// <reference types="stripe/types/2022-08-01/Identity/VerificationReports.js" />
|
|
46
|
+
/// <reference types="stripe/types/2022-08-01/Identity/VerificationSessions.js" />
|
|
47
|
+
/// <reference types="stripe/types/2022-08-01/InvoiceItems.js" />
|
|
48
|
+
/// <reference types="stripe/types/2022-08-01/InvoiceLineItems.js" />
|
|
49
|
+
/// <reference types="stripe/types/2022-08-01/Invoices.js" />
|
|
50
|
+
/// <reference types="stripe/types/2022-08-01/Issuing/Authorizations.js" />
|
|
51
|
+
/// <reference types="stripe/types/2022-08-01/Issuing/Cardholders.js" />
|
|
52
|
+
/// <reference types="stripe/types/2022-08-01/Issuing/Cards.js" />
|
|
53
|
+
/// <reference types="stripe/types/2022-08-01/Issuing/Disputes.js" />
|
|
54
|
+
/// <reference types="stripe/types/2022-08-01/Issuing/Transactions.js" />
|
|
55
|
+
/// <reference types="stripe/types/2022-08-01/LineItems.js" />
|
|
56
|
+
/// <reference types="stripe/types/2022-08-01/LoginLinks.js" />
|
|
57
|
+
/// <reference types="stripe/types/2022-08-01/Mandates.js" />
|
|
58
|
+
/// <reference types="stripe/types/2022-08-01/Orders.js" />
|
|
59
|
+
/// <reference types="stripe/types/2022-08-01/PaymentIntents.js" />
|
|
60
|
+
/// <reference types="stripe/types/2022-08-01/PaymentLinks.js" />
|
|
61
|
+
/// <reference types="stripe/types/2022-08-01/PaymentMethods.js" />
|
|
62
|
+
/// <reference types="stripe/types/2022-08-01/Payouts.js" />
|
|
63
|
+
/// <reference types="stripe/types/2022-08-01/Persons.js" />
|
|
64
|
+
/// <reference types="stripe/types/2022-08-01/Plans.js" />
|
|
65
|
+
/// <reference types="stripe/types/2022-08-01/PlatformTaxFees.js" />
|
|
66
|
+
/// <reference types="stripe/types/2022-08-01/Prices.js" />
|
|
67
|
+
/// <reference types="stripe/types/2022-08-01/Products.js" />
|
|
68
|
+
/// <reference types="stripe/types/2022-08-01/PromotionCodes.js" />
|
|
69
|
+
/// <reference types="stripe/types/2022-08-01/Quotes.js" />
|
|
70
|
+
/// <reference types="stripe/types/2022-08-01/Radar/EarlyFraudWarnings.js" />
|
|
71
|
+
/// <reference types="stripe/types/2022-08-01/Radar/ValueListItems.js" />
|
|
72
|
+
/// <reference types="stripe/types/2022-08-01/Radar/ValueLists.js" />
|
|
73
|
+
/// <reference types="stripe/types/2022-08-01/Refunds.js" />
|
|
74
|
+
/// <reference types="stripe/types/2022-08-01/Reporting/ReportRuns.js" />
|
|
75
|
+
/// <reference types="stripe/types/2022-08-01/Reporting/ReportTypes.js" />
|
|
76
|
+
/// <reference types="stripe/types/2022-08-01/ReserveTransactions.js" />
|
|
77
|
+
/// <reference types="stripe/types/2022-08-01/Reviews.js" />
|
|
78
|
+
/// <reference types="stripe/types/2022-08-01/SKUs.js" />
|
|
79
|
+
/// <reference types="stripe/types/2022-08-01/SetupAttempts.js" />
|
|
80
|
+
/// <reference types="stripe/types/2022-08-01/SetupIntents.js" />
|
|
81
|
+
/// <reference types="stripe/types/2022-08-01/ShippingRates.js" />
|
|
82
|
+
/// <reference types="stripe/types/2022-08-01/Sigma/ScheduledQueryRuns.js" />
|
|
83
|
+
/// <reference types="stripe/types/2022-08-01/SourceMandateNotifications.js" />
|
|
84
|
+
/// <reference types="stripe/types/2022-08-01/SourceTransactions.js" />
|
|
85
|
+
/// <reference types="stripe/types/2022-08-01/Sources.js" />
|
|
86
|
+
/// <reference types="stripe/types/2022-08-01/SubscriptionItems.js" />
|
|
87
|
+
/// <reference types="stripe/types/2022-08-01/SubscriptionSchedules.js" />
|
|
88
|
+
/// <reference types="stripe/types/2022-08-01/Subscriptions.js" />
|
|
89
|
+
/// <reference types="stripe/types/2022-08-01/TaxCodes.js" />
|
|
90
|
+
/// <reference types="stripe/types/2022-08-01/TaxDeductedAtSources.js" />
|
|
91
|
+
/// <reference types="stripe/types/2022-08-01/TaxIds.js" />
|
|
92
|
+
/// <reference types="stripe/types/2022-08-01/TaxRates.js" />
|
|
93
|
+
/// <reference types="stripe/types/2022-08-01/Terminal/Configurations.js" />
|
|
94
|
+
/// <reference types="stripe/types/2022-08-01/Terminal/ConnectionTokens.js" />
|
|
95
|
+
/// <reference types="stripe/types/2022-08-01/Terminal/Locations.js" />
|
|
96
|
+
/// <reference types="stripe/types/2022-08-01/Terminal/Readers.js" />
|
|
97
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Customers.js" />
|
|
98
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Issuing/Cards.js" />
|
|
99
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Refunds.js" />
|
|
100
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Terminal/Readers.js" />
|
|
101
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/TestClocks.js" />
|
|
102
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Treasury/InboundTransfers.js" />
|
|
103
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Treasury/OutboundPayments.js" />
|
|
104
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Treasury/OutboundTransfers.js" />
|
|
105
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Treasury/ReceivedCredits.js" />
|
|
106
|
+
/// <reference types="stripe/types/2022-08-01/TestHelpers/Treasury/ReceivedDebits.js" />
|
|
107
|
+
/// <reference types="stripe/types/2022-08-01/Tokens.js" />
|
|
108
|
+
/// <reference types="stripe/types/2022-08-01/Topups.js" />
|
|
109
|
+
/// <reference types="stripe/types/2022-08-01/TransferReversals.js" />
|
|
110
|
+
/// <reference types="stripe/types/2022-08-01/Transfers.js" />
|
|
111
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/CreditReversals.js" />
|
|
112
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/DebitReversals.js" />
|
|
113
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/FinancialAccountFeatures.js" />
|
|
114
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/FinancialAccounts.js" />
|
|
115
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/InboundTransfers.js" />
|
|
116
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/OutboundPayments.js" />
|
|
117
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/OutboundTransfers.js" />
|
|
118
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/ReceivedCredits.js" />
|
|
119
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/ReceivedDebits.js" />
|
|
120
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/TransactionEntries.js" />
|
|
121
|
+
/// <reference types="stripe/types/2022-08-01/Treasury/Transactions.js" />
|
|
122
|
+
/// <reference types="stripe/types/2022-08-01/UsageRecordSummaries.js" />
|
|
123
|
+
/// <reference types="stripe/types/2022-08-01/UsageRecords.js" />
|
|
124
|
+
/// <reference types="stripe/types/2022-08-01/WebhookEndpoints.js" />
|
|
125
|
+
/// <reference types="stripe/types/lib.js" />
|
|
126
|
+
/// <reference types="stripe/types/net/net.js" />
|
|
1
127
|
import type { Payload } from 'payload';
|
|
2
128
|
import type { Config as PayloadConfig } from 'payload/config';
|
|
3
129
|
import type Stripe from 'stripe';
|
|
4
130
|
export type StripeWebhookHandler<T = any> = (args: {
|
|
5
|
-
|
|
131
|
+
config: PayloadConfig;
|
|
6
132
|
event: T;
|
|
133
|
+
payload: Payload;
|
|
7
134
|
stripe: Stripe;
|
|
8
|
-
config: PayloadConfig;
|
|
9
135
|
stripeConfig?: StripeConfig;
|
|
10
136
|
}) => void;
|
|
11
137
|
export interface StripeWebhookHandlers {
|
|
@@ -17,28 +143,29 @@ export interface FieldSyncConfig {
|
|
|
17
143
|
}
|
|
18
144
|
export interface SyncConfig {
|
|
19
145
|
collection: string;
|
|
146
|
+
fields: FieldSyncConfig[];
|
|
20
147
|
stripeResourceType: 'customers' | 'products';
|
|
21
148
|
stripeResourceTypeSingular: 'customer' | 'product';
|
|
22
|
-
fields: FieldSyncConfig[];
|
|
23
149
|
}
|
|
24
150
|
export interface StripeConfig {
|
|
25
|
-
stripeSecretKey: string;
|
|
26
151
|
isTestKey?: boolean;
|
|
27
|
-
|
|
152
|
+
logs?: boolean;
|
|
28
153
|
rest?: boolean;
|
|
29
|
-
|
|
154
|
+
stripeSecretKey: string;
|
|
155
|
+
stripeWebhooksEndpointSecret?: string;
|
|
30
156
|
sync?: SyncConfig[];
|
|
31
|
-
|
|
157
|
+
webhooks?: StripeWebhookHandler | StripeWebhookHandlers;
|
|
32
158
|
}
|
|
33
159
|
export type SanitizedStripeConfig = StripeConfig & {
|
|
34
160
|
sync: SyncConfig[];
|
|
35
161
|
};
|
|
36
162
|
export type StripeProxy = (args: {
|
|
37
|
-
stripeSecretKey: string;
|
|
38
|
-
stripeMethod: string;
|
|
39
163
|
stripeArgs: any[];
|
|
164
|
+
stripeMethod: string;
|
|
165
|
+
stripeSecretKey: string;
|
|
40
166
|
}) => Promise<{
|
|
41
|
-
status: number;
|
|
42
|
-
message?: string;
|
|
43
167
|
data?: any;
|
|
168
|
+
message?: string;
|
|
169
|
+
status: number;
|
|
44
170
|
}>;
|
|
171
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IACjD,MAAM,EAAE,aAAa,CAAA;IACrB,KAAK,EAAE,CAAC,CAAA;IACR,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,KAAK,IAAI,CAAA;AAEV,MAAM,WAAW,qBAAqB;IACpC,CAAC,WAAW,EAAE,MAAM,GAAG,oBAAoB,CAAA;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,kBAAkB,EAAE,WAAW,GAAG,UAAU,CAAA;IAC5C,0BAA0B,EAAE,UAAU,GAAG,SAAS,CAAA;CACnD;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,CAAC,EAAE,MAAM,CAAA;IACrC,IAAI,CAAC,EAAE,UAAU,EAAE,CAAA;IACnB,QAAQ,CAAC,EAAE,oBAAoB,GAAG,qBAAqB,CAAA;CACxD;AAED,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,UAAU,EAAE,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE;IAC/B,UAAU,EAAE,GAAG,EAAE,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;CACxB,KAAK,OAAO,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAC,CAAA"}
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { };
|
|
2
|
+
|
|
3
3
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Payload } from 'payload'\nimport type { Config as PayloadConfig } from 'payload/config'\nimport type Stripe from 'stripe'\n\nexport type StripeWebhookHandler<T = any> = (args: {\n config: PayloadConfig\n event: T\n payload: Payload\n stripe: Stripe\n stripeConfig?: StripeConfig\n}) => void\n\nexport interface StripeWebhookHandlers {\n [webhookName: string]: StripeWebhookHandler\n}\n\nexport interface FieldSyncConfig {\n fieldPath: string\n stripeProperty: string\n}\n\nexport interface SyncConfig {\n collection: string\n fields: FieldSyncConfig[]\n stripeResourceType: 'customers' | 'products' // TODO: get this from Stripe types\n stripeResourceTypeSingular: 'customer' | 'product' // TODO: there must be a better way to do this\n}\n\nexport interface StripeConfig {\n isTestKey?: boolean\n logs?: boolean\n // @deprecated this will default as `false` in the next major version release\n rest?: boolean\n stripeSecretKey: string\n stripeWebhooksEndpointSecret?: string\n sync?: SyncConfig[]\n webhooks?: StripeWebhookHandler | StripeWebhookHandlers\n}\n\nexport type SanitizedStripeConfig = StripeConfig & {\n sync: SyncConfig[] // convert to required\n}\n\nexport type StripeProxy = (args: {\n stripeArgs: any[]\n stripeMethod: string\n stripeSecretKey: string\n}) => Promise<{\n data?: any\n message?: string\n status: number\n}>\n"],"names":[],"rangeMappings":"","mappings":"AA2CA,WAQE"}
|
package/dist/ui/LinkToDoc.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { UIField } from 'payload/
|
|
3
|
-
export declare const LinkToDoc:
|
|
4
|
-
|
|
5
|
-
stripeResourceType: string;
|
|
6
|
-
nameOfIDField: string;
|
|
7
|
-
}>;
|
|
1
|
+
import type { CustomComponent } from 'payload/config';
|
|
2
|
+
import type { UIField } from 'payload/types';
|
|
3
|
+
export declare const LinkToDoc: CustomComponent<UIField>;
|
|
4
|
+
//# sourceMappingURL=LinkToDoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkToDoc.d.ts","sourceRoot":"","sources":["../../src/ui/LinkToDoc.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAO5C,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,OAAO,CAwC9C,CAAA"}
|
package/dist/ui/LinkToDoc.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var fields = _a[0];
|
|
14
|
-
return fields[nameOfIDField];
|
|
15
|
-
});
|
|
16
|
-
var stripeID = (field || {}).value;
|
|
17
|
-
var stripeEnv = isTestKey ? 'test/' : '';
|
|
18
|
-
var href = "https://dashboard.stripe.com/".concat(stripeEnv).concat(stripeResourceType, "/").concat(stripeID);
|
|
1
|
+
'use client';
|
|
2
|
+
import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider';
|
|
3
|
+
// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
|
|
4
|
+
import { useFormFields } from '@payloadcms/ui/forms/Form';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export const LinkToDoc = ()=>{
|
|
7
|
+
const { custom } = useFieldProps();
|
|
8
|
+
const { isTestKey, nameOfIDField, stripeResourceType } = custom;
|
|
9
|
+
const field = useFormFields(([fields])=>fields[nameOfIDField]);
|
|
10
|
+
const { value: stripeID } = field || {};
|
|
11
|
+
const stripeEnv = isTestKey ? 'test/' : '';
|
|
12
|
+
const href = `https://dashboard.stripe.com/${stripeEnv}${stripeResourceType}/${stripeID}`;
|
|
19
13
|
if (stripeID) {
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
return /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("span", {
|
|
15
|
+
className: "label",
|
|
16
|
+
style: {
|
|
17
|
+
color: '#9A9A9A'
|
|
18
|
+
}
|
|
19
|
+
}, "View in Stripe")), /*#__PURE__*/ React.createElement("div", {
|
|
20
|
+
style: {
|
|
21
|
+
fontWeight: '600',
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
textOverflow: 'ellipsis'
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/ React.createElement("a", {
|
|
26
|
+
href: href,
|
|
27
|
+
rel: "noreferrer noopener",
|
|
28
|
+
target: "_blank"
|
|
29
|
+
}, href)));
|
|
32
30
|
}
|
|
33
31
|
return null;
|
|
34
32
|
};
|
|
35
|
-
|
|
33
|
+
|
|
36
34
|
//# sourceMappingURL=LinkToDoc.js.map
|
package/dist/ui/LinkToDoc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/ui/LinkToDoc.tsx"],"sourcesContent":["'use client'\nimport type { CustomComponent } from 'payload/config'\nimport type { UIField } from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\n// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'\nimport { useFormFields } from '@payloadcms/ui/forms/Form'\nimport React from 'react'\n\nexport const LinkToDoc: CustomComponent<UIField> = () => {\n const { custom } = useFieldProps()\n const { isTestKey, nameOfIDField, stripeResourceType } = custom\n\n const field = useFormFields(([fields]) => fields[nameOfIDField])\n const { value: stripeID } = field || {}\n\n const stripeEnv = isTestKey ? 'test/' : ''\n const href = `https://dashboard.stripe.com/${stripeEnv}${stripeResourceType}/${stripeID}`\n\n if (stripeID) {\n return (\n <div>\n <div>\n <span\n className=\"label\"\n style={{\n color: '#9A9A9A',\n }}\n >\n View in Stripe\n </span>\n {/* <CopyToClipboard value={href} /> */}\n </div>\n <div\n style={{\n fontWeight: '600',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n <a href={href} rel=\"noreferrer noopener\" target=\"_blank\">\n {href}\n </a>\n </div>\n </div>\n )\n }\n\n return null\n}\n"],"names":["useFieldProps","useFormFields","React","LinkToDoc","custom","isTestKey","nameOfIDField","stripeResourceType","field","fields","value","stripeID","stripeEnv","href","div","span","className","style","color","fontWeight","overflow","textOverflow","a","rel","target"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,aAAa,QAAQ,0CAAyC;AACvE,uFAAuF;AACvF,SAASC,aAAa,QAAQ,4BAA2B;AACzD,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,YAAsC;IACjD,MAAM,EAAEC,MAAM,EAAE,GAAGJ;IACnB,MAAM,EAAEK,SAAS,EAAEC,aAAa,EAAEC,kBAAkB,EAAE,GAAGH;IAEzD,MAAMI,QAAQP,cAAc,CAAC,CAACQ,OAAO,GAAKA,MAAM,CAACH,cAAc;IAC/D,MAAM,EAAEI,OAAOC,QAAQ,EAAE,GAAGH,SAAS,CAAC;IAEtC,MAAMI,YAAYP,YAAY,UAAU;IACxC,MAAMQ,OAAO,CAAC,6BAA6B,EAAED,UAAU,EAAEL,mBAAmB,CAAC,EAAEI,SAAS,CAAC;IAEzF,IAAIA,UAAU;QACZ,qBACE,oBAACG,2BACC,oBAACA,2BACC,oBAACC;YACCC,WAAU;YACVC,OAAO;gBACLC,OAAO;YACT;WACD,kCAKH,oBAACJ;YACCG,OAAO;gBACLE,YAAY;gBACZC,UAAU;gBACVC,cAAc;YAChB;yBAEA,oBAACC;YAAET,MAAMA;YAAMU,KAAI;YAAsBC,QAAO;WAC7CX;IAKX;IAEA,OAAO;AACT,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepen.d.ts","sourceRoot":"","sources":["../../src/utilities/deepen.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,QAAS,OAAO,MAAM,EAAE,GAAG,CAAC,KAAG,OAAO,MAAM,EAAE,GAAG,CAiBnE,CAAA"}
|
package/dist/utilities/deepen.js
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// converts an object of dot notation keys to a nested object
|
|
3
2
|
// i.e. { 'price.stripePriceID': '123' } to { price: { stripePriceID: '123' } }
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var current = result;
|
|
12
|
-
keys.forEach(function (k, index) {
|
|
3
|
+
export const deepen = (obj)=>{
|
|
4
|
+
const result = {};
|
|
5
|
+
for(const key in obj){
|
|
6
|
+
const value = obj[key];
|
|
7
|
+
const keys = key.split('.');
|
|
8
|
+
let current = result;
|
|
9
|
+
keys.forEach((k, index)=>{
|
|
13
10
|
if (index === keys.length - 1) {
|
|
14
11
|
current[k] = value;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
12
|
+
} else {
|
|
17
13
|
current[k] = current[k] || {};
|
|
18
14
|
current = current[k];
|
|
19
15
|
}
|
|
20
16
|
});
|
|
21
|
-
};
|
|
22
|
-
for (var key in obj) {
|
|
23
|
-
_loop_1(key);
|
|
24
17
|
}
|
|
25
18
|
return result;
|
|
26
19
|
};
|
|
27
|
-
|
|
20
|
+
|
|
28
21
|
//# sourceMappingURL=deepen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/deepen.ts"],"sourcesContent":["// converts an object of dot notation keys to a nested object\n// i.e. { 'price.stripePriceID': '123' } to { price: { stripePriceID: '123' } }\n\nexport const deepen = (obj: Record<string, any>): Record<string, any> => {\n const result: Record<string, any> = {}\n\n for (const key in obj) {\n const value = obj[key]\n const keys = key.split('.')\n let current = result\n keys.forEach((k, index) => {\n if (index === keys.length - 1) {\n current[k] = value\n } else {\n current[k] = current[k] || {}\n current = current[k]\n }\n })\n }\n return result\n}\n"],"names":["deepen","obj","result","key","value","keys","split","current","forEach","k","index","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA,6DAA6D;AAC7D,+EAA+E;AAE/E,OAAO,MAAMA,SAAS,CAACC;IACrB,MAAMC,SAA8B,CAAC;IAErC,IAAK,MAAMC,OAAOF,IAAK;QACrB,MAAMG,QAAQH,GAAG,CAACE,IAAI;QACtB,MAAME,OAAOF,IAAIG,KAAK,CAAC;QACvB,IAAIC,UAAUL;QACdG,KAAKG,OAAO,CAAC,CAACC,GAAGC;YACf,IAAIA,UAAUL,KAAKM,MAAM,GAAG,GAAG;gBAC7BJ,OAAO,CAACE,EAAE,GAAGL;YACf,OAAO;gBACLG,OAAO,CAACE,EAAE,GAAGF,OAAO,CAACE,EAAE,IAAI,CAAC;gBAC5BF,UAAUA,OAAO,CAACE,EAAE;YACtB;QACF;IACF;IACA,OAAOP;AACT,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripeProxy.d.ts","sourceRoot":"","sources":["../../src/utilities/stripeProxy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,eAAO,MAAM,WAAW,EAAE,WAyCzB,CAAA"}
|