@payloadcms/plugin-stripe 4.0.0-internal.e16cf59 → 4.0.0-internal.e55ccef
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/LICENSE.md +1 -1
- package/dist/exports/client.d.ts +1 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/ui/LinkToDoc/index.css +26 -0
- package/dist/ui/{LinkToDoc.d.ts → LinkToDoc/index.d.ts} +2 -1
- package/dist/ui/LinkToDoc/index.d.ts.map +1 -0
- package/dist/ui/LinkToDoc/index.js +45 -0
- package/dist/ui/LinkToDoc/index.js.map +1 -0
- package/package.json +6 -6
- package/dist/ui/LinkToDoc.d.ts.map +0 -1
- package/dist/ui/LinkToDoc.js +0 -48
- package/dist/ui/LinkToDoc.js.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
3
|
+
Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { LinkToDoc } from '../ui/LinkToDoc.js';
|
|
1
|
+
export { LinkToDoc } from '../ui/LinkToDoc/index.js';
|
|
2
2
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA"}
|
package/dist/exports/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\n\nexport { LinkToDoc } from '../ui/LinkToDoc.js'\n"],"names":["LinkToDoc"],"mappings":"AAAA;AAEA,SAASA,SAAS,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\n\nexport { LinkToDoc } from '../ui/LinkToDoc/index.js'\n"],"names":["LinkToDoc"],"mappings":"AAAA;AAEA,SAASA,SAAS,QAAQ,2BAA0B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Config } from 'payload';
|
|
2
1
|
import type { StripePluginConfig } from './types.js';
|
|
3
2
|
export { stripeProxy } from './utilities/stripeProxy.js';
|
|
4
|
-
export declare const stripePlugin: (
|
|
3
|
+
export declare const stripePlugin: (options: StripePluginConfig) => import("payload").Plugin;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA+B,kBAAkB,EAAE,MAAM,YAAY,CAAA;AASjF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,eAAO,MAAM,YAAY,2DAoGvB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { definePlugin } from 'payload';
|
|
1
2
|
import { getFields } from './fields/getFields.js';
|
|
2
3
|
import { createNewInStripe } from './hooks/createNewInStripe.js';
|
|
3
4
|
import { deleteFromStripe } from './hooks/deleteFromStripe.js';
|
|
@@ -5,7 +6,9 @@ import { syncExistingWithStripe } from './hooks/syncExistingWithStripe.js';
|
|
|
5
6
|
import { stripeREST } from './routes/rest.js';
|
|
6
7
|
import { stripeWebhooks } from './routes/webhooks.js';
|
|
7
8
|
export { stripeProxy } from './utilities/stripeProxy.js';
|
|
8
|
-
export const stripePlugin = (
|
|
9
|
+
export const stripePlugin = definePlugin({
|
|
10
|
+
slug: '@payloadcms/plugin-stripe',
|
|
11
|
+
plugin: ({ config, options: incomingStripeConfig })=>{
|
|
9
12
|
const { collections } = config;
|
|
10
13
|
// set config defaults here
|
|
11
14
|
const pluginConfig = {
|
|
@@ -86,6 +89,7 @@ export const stripePlugin = (incomingStripeConfig)=>(config)=>{
|
|
|
86
89
|
}
|
|
87
90
|
config.endpoints = endpoints;
|
|
88
91
|
return config;
|
|
89
|
-
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
90
94
|
|
|
91
95
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Endpoint } from 'payload'\n\nimport { definePlugin } from 'payload'\n\nimport type { SanitizedStripePluginConfig, StripePluginConfig } from './types.js'\n\nimport { getFields } from './fields/getFields.js'\nimport { createNewInStripe } from './hooks/createNewInStripe.js'\nimport { deleteFromStripe } from './hooks/deleteFromStripe.js'\nimport { syncExistingWithStripe } from './hooks/syncExistingWithStripe.js'\nimport { stripeREST } from './routes/rest.js'\nimport { stripeWebhooks } from './routes/webhooks.js'\n\nexport { stripeProxy } from './utilities/stripeProxy.js'\n\nexport const stripePlugin = definePlugin<StripePluginConfig>({\n slug: '@payloadcms/plugin-stripe',\n plugin: ({ config, options: incomingStripeConfig }) => {\n const { collections } = config\n\n // set config defaults here\n const pluginConfig: SanitizedStripePluginConfig = {\n ...incomingStripeConfig,\n rest: incomingStripeConfig?.rest ?? false,\n sync: incomingStripeConfig?.sync || [],\n }\n\n // NOTE: env variables are never passed to the client, but we need to know if `stripeSecretKey` is a test key\n // unfortunately we must set the 'isTestKey' property on the config instead of using the following code:\n // const isTestKey = stripeConfig.stripeSecretKey?.startsWith('sk_test_');\n\n const endpoints: Endpoint[] = [\n ...(config?.endpoints || []),\n {\n handler: async (req) => {\n const res = await stripeWebhooks({\n config,\n pluginConfig,\n req,\n })\n\n return res\n },\n method: 'post',\n path: '/stripe/webhooks',\n },\n ]\n\n if (incomingStripeConfig?.rest) {\n endpoints.push({\n handler: async (req) => {\n const res = await stripeREST({\n pluginConfig,\n req,\n })\n\n return res\n },\n method: 'post' as Endpoint['method'],\n path: '/stripe/rest',\n })\n }\n\n for (const collection of collections!) {\n const { hooks: existingHooks } = collection\n\n const syncConfig = pluginConfig.sync?.find((sync) => sync.collection === collection.slug)\n\n if (!syncConfig) {\n continue\n }\n const fields = getFields({\n collection,\n pluginConfig,\n syncConfig,\n })\n collection.fields = fields\n\n if (!collection.hooks) {\n collection.hooks = {}\n }\n\n collection.hooks.afterDelete = [\n ...(existingHooks?.afterDelete || []),\n (args) =>\n deleteFromStripe({\n ...args,\n collection,\n pluginConfig,\n }),\n ]\n collection.hooks.beforeChange = [\n ...(existingHooks?.beforeChange || []),\n (args) =>\n syncExistingWithStripe({\n ...args,\n collection,\n pluginConfig,\n }),\n ]\n collection.hooks.beforeValidate = [\n ...(existingHooks?.beforeValidate || []),\n (args) =>\n createNewInStripe({\n ...args,\n collection,\n pluginConfig,\n }),\n ]\n }\n\n config.endpoints = endpoints\n\n return config\n },\n})\n"],"names":["definePlugin","getFields","createNewInStripe","deleteFromStripe","syncExistingWithStripe","stripeREST","stripeWebhooks","stripeProxy","stripePlugin","slug","plugin","config","options","incomingStripeConfig","collections","pluginConfig","rest","sync","endpoints","handler","req","res","method","path","push","collection","hooks","existingHooks","syncConfig","find","fields","afterDelete","args","beforeChange","beforeValidate"],"mappings":"AAEA,SAASA,YAAY,QAAQ,UAAS;AAItC,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D,SAASC,sBAAsB,QAAQ,oCAAmC;AAC1E,SAASC,UAAU,QAAQ,mBAAkB;AAC7C,SAASC,cAAc,QAAQ,uBAAsB;AAErD,SAASC,WAAW,QAAQ,6BAA4B;AAExD,OAAO,MAAMC,eAAeR,aAAiC;IAC3DS,MAAM;IACNC,QAAQ,CAAC,EAAEC,MAAM,EAAEC,SAASC,oBAAoB,EAAE;QAChD,MAAM,EAAEC,WAAW,EAAE,GAAGH;QAExB,2BAA2B;QAC3B,MAAMI,eAA4C;YAChD,GAAGF,oBAAoB;YACvBG,MAAMH,sBAAsBG,QAAQ;YACpCC,MAAMJ,sBAAsBI,QAAQ,EAAE;QACxC;QAEA,6GAA6G;QAC7G,wGAAwG;QACxG,0EAA0E;QAE1E,MAAMC,YAAwB;eACxBP,QAAQO,aAAa,EAAE;YAC3B;gBACEC,SAAS,OAAOC;oBACd,MAAMC,MAAM,MAAMf,eAAe;wBAC/BK;wBACAI;wBACAK;oBACF;oBAEA,OAAOC;gBACT;gBACAC,QAAQ;gBACRC,MAAM;YACR;SACD;QAED,IAAIV,sBAAsBG,MAAM;YAC9BE,UAAUM,IAAI,CAAC;gBACbL,SAAS,OAAOC;oBACd,MAAMC,MAAM,MAAMhB,WAAW;wBAC3BU;wBACAK;oBACF;oBAEA,OAAOC;gBACT;gBACAC,QAAQ;gBACRC,MAAM;YACR;QACF;QAEA,KAAK,MAAME,cAAcX,YAAc;YACrC,MAAM,EAAEY,OAAOC,aAAa,EAAE,GAAGF;YAEjC,MAAMG,aAAab,aAAaE,IAAI,EAAEY,KAAK,CAACZ,OAASA,KAAKQ,UAAU,KAAKA,WAAWhB,IAAI;YAExF,IAAI,CAACmB,YAAY;gBACf;YACF;YACA,MAAME,SAAS7B,UAAU;gBACvBwB;gBACAV;gBACAa;YACF;YACAH,WAAWK,MAAM,GAAGA;YAEpB,IAAI,CAACL,WAAWC,KAAK,EAAE;gBACrBD,WAAWC,KAAK,GAAG,CAAC;YACtB;YAEAD,WAAWC,KAAK,CAACK,WAAW,GAAG;mBACzBJ,eAAeI,eAAe,EAAE;gBACpC,CAACC,OACC7B,iBAAiB;wBACf,GAAG6B,IAAI;wBACPP;wBACAV;oBACF;aACH;YACDU,WAAWC,KAAK,CAACO,YAAY,GAAG;mBAC1BN,eAAeM,gBAAgB,EAAE;gBACrC,CAACD,OACC5B,uBAAuB;wBACrB,GAAG4B,IAAI;wBACPP;wBACAV;oBACF;aACH;YACDU,WAAWC,KAAK,CAACQ,cAAc,GAAG;mBAC5BP,eAAeO,kBAAkB,EAAE;gBACvC,CAACF,OACC9B,kBAAkB;wBAChB,GAAG8B,IAAI;wBACPP;wBACAV;oBACF;aACH;QACH;QAEAJ,OAAOO,SAAS,GAAGA;QAEnB,OAAOP;IACT;AACF,GAAE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@layer payload-default {
|
|
2
|
+
.link-to-doc {
|
|
3
|
+
margin-bottom: var(--spacing-field);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.link-to-doc__header {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
width: fit-content;
|
|
10
|
+
gap: var(--spacer-1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.link-to-doc__url {
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.link-to-doc__url a {
|
|
20
|
+
color: var(--color-text-secondary);
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
color: var(--color-text);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/LinkToDoc/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAKrD,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,SAAS,EAAE,sBA6BvB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CopyToClipboard, FieldLabel, useFormFields } from '@payloadcms/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import './index.css';
|
|
6
|
+
const baseClass = 'link-to-doc';
|
|
7
|
+
export const LinkToDoc = (props)=>{
|
|
8
|
+
const { field: { admin: { custom = {} } = {} } } = props;
|
|
9
|
+
const { isTestKey, nameOfIDField, stripeResourceType } = custom;
|
|
10
|
+
const field = useFormFields(([fields])=>fields && fields?.[nameOfIDField] || null);
|
|
11
|
+
const { value: stripeID } = field || {};
|
|
12
|
+
if (!stripeID) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const stripeEnv = isTestKey ? 'test/' : '';
|
|
16
|
+
const href = `https://dashboard.stripe.com/${stripeEnv}${stripeResourceType}/${stripeID}`;
|
|
17
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
18
|
+
className: baseClass,
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
21
|
+
className: `${baseClass}__header`,
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ _jsx(FieldLabel, {
|
|
24
|
+
htmlFor: baseClass,
|
|
25
|
+
label: "View in Stripe"
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ _jsx(CopyToClipboard, {
|
|
28
|
+
value: href
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsx("div", {
|
|
33
|
+
className: `${baseClass}__url`,
|
|
34
|
+
children: /*#__PURE__*/ _jsx("a", {
|
|
35
|
+
href: href,
|
|
36
|
+
rel: "noopener noreferrer",
|
|
37
|
+
target: "_blank",
|
|
38
|
+
children: href
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/LinkToDoc/index.tsx"],"sourcesContent":["'use client'\nimport type { UIFieldClientComponent } from 'payload'\n\nimport { CopyToClipboard, FieldLabel, useFormFields } from '@payloadcms/ui'\nimport React from 'react'\n\nimport './index.css'\n\nconst baseClass = 'link-to-doc'\n\nexport const LinkToDoc: UIFieldClientComponent = (props) => {\n const {\n field: { admin: { custom = {} } = {} },\n } = props\n const { isTestKey, nameOfIDField, stripeResourceType } = custom\n\n const field = useFormFields(([fields]) => (fields && fields?.[nameOfIDField]) || null)\n const { value: stripeID } = field || {}\n\n if (!stripeID) {\n return null\n }\n\n const stripeEnv = isTestKey ? 'test/' : ''\n const href = `https://dashboard.stripe.com/${stripeEnv}${stripeResourceType}/${stripeID}`\n\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__header`}>\n <FieldLabel htmlFor={baseClass} label=\"View in Stripe\" />\n <CopyToClipboard value={href} />\n </div>\n <div className={`${baseClass}__url`}>\n <a href={href} rel=\"noopener noreferrer\" target=\"_blank\">\n {href}\n </a>\n </div>\n </div>\n )\n}\n"],"names":["CopyToClipboard","FieldLabel","useFormFields","React","baseClass","LinkToDoc","props","field","admin","custom","isTestKey","nameOfIDField","stripeResourceType","fields","value","stripeID","stripeEnv","href","div","className","htmlFor","label","a","rel","target"],"mappings":"AAAA;;AAGA,SAASA,eAAe,EAAEC,UAAU,EAAEC,aAAa,QAAQ,iBAAgB;AAC3E,OAAOC,WAAW,QAAO;AAEzB,OAAO,cAAa;AAEpB,MAAMC,YAAY;AAElB,OAAO,MAAMC,YAAoC,CAACC;IAChD,MAAM,EACJC,OAAO,EAAEC,OAAO,EAAEC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EACvC,GAAGH;IACJ,MAAM,EAAEI,SAAS,EAAEC,aAAa,EAAEC,kBAAkB,EAAE,GAAGH;IAEzD,MAAMF,QAAQL,cAAc,CAAC,CAACW,OAAO,GAAK,AAACA,UAAUA,QAAQ,CAACF,cAAc,IAAK;IACjF,MAAM,EAAEG,OAAOC,QAAQ,EAAE,GAAGR,SAAS,CAAC;IAEtC,IAAI,CAACQ,UAAU;QACb,OAAO;IACT;IAEA,MAAMC,YAAYN,YAAY,UAAU;IACxC,MAAMO,OAAO,CAAC,6BAA6B,EAAED,YAAYJ,mBAAmB,CAAC,EAAEG,UAAU;IAEzF,qBACE,MAACG;QAAIC,WAAWf;;0BACd,MAACc;gBAAIC,WAAW,GAAGf,UAAU,QAAQ,CAAC;;kCACpC,KAACH;wBAAWmB,SAAShB;wBAAWiB,OAAM;;kCACtC,KAACrB;wBAAgBc,OAAOG;;;;0BAE1B,KAACC;gBAAIC,WAAW,GAAGf,UAAU,KAAK,CAAC;0BACjC,cAAA,KAACkB;oBAAEL,MAAMA;oBAAMM,KAAI;oBAAsBC,QAAO;8BAC7CP;;;;;AAKX,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-stripe",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.e55ccef",
|
|
4
4
|
"description": "Stripe plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -55,19 +55,19 @@
|
|
|
55
55
|
"lodash.get": "^4.4.2",
|
|
56
56
|
"stripe": "^10.2.0",
|
|
57
57
|
"uuid": "14.0.0",
|
|
58
|
-
"@payloadcms/translations": "4.0.0-internal.
|
|
59
|
-
"@payloadcms/ui": "4.0.0-internal.
|
|
58
|
+
"@payloadcms/translations": "4.0.0-internal.e55ccef",
|
|
59
|
+
"@payloadcms/ui": "4.0.0-internal.e55ccef"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/lodash.get": "^4.4.7",
|
|
63
63
|
"@types/react": "19.2.14",
|
|
64
64
|
"@types/react-dom": "19.2.3",
|
|
65
65
|
"@payloadcms/eslint-config": "3.28.0",
|
|
66
|
-
"@payloadcms/next": "4.0.0-internal.
|
|
67
|
-
"payload": "4.0.0-internal.
|
|
66
|
+
"@payloadcms/next": "4.0.0-internal.e55ccef",
|
|
67
|
+
"payload": "4.0.0-internal.e55ccef"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"payload": "4.0.0-internal.
|
|
70
|
+
"payload": "4.0.0-internal.e55ccef"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LinkToDoc.d.ts","sourceRoot":"","sources":["../../src/ui/LinkToDoc.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAKrD,eAAO,MAAM,SAAS,EAAE,sBA0CvB,CAAA"}
|
package/dist/ui/LinkToDoc.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { CopyToClipboard, useFormFields } from '@payloadcms/ui';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
export const LinkToDoc = (props)=>{
|
|
6
|
-
const { field: { admin: { custom = {} } = {} } } = props;
|
|
7
|
-
const { isTestKey, nameOfIDField, stripeResourceType } = custom;
|
|
8
|
-
const field = useFormFields(([fields])=>fields && fields?.[nameOfIDField] || null);
|
|
9
|
-
const { value: stripeID } = field || {};
|
|
10
|
-
const stripeEnv = isTestKey ? 'test/' : '';
|
|
11
|
-
const href = `https://dashboard.stripe.com/${stripeEnv}${stripeResourceType}/${stripeID}`;
|
|
12
|
-
if (stripeID) {
|
|
13
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
14
|
-
children: [
|
|
15
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
16
|
-
children: [
|
|
17
|
-
/*#__PURE__*/ _jsx("span", {
|
|
18
|
-
className: "label",
|
|
19
|
-
style: {
|
|
20
|
-
color: '#9A9A9A'
|
|
21
|
-
},
|
|
22
|
-
children: "View in Stripe"
|
|
23
|
-
}),
|
|
24
|
-
/*#__PURE__*/ _jsx(CopyToClipboard, {
|
|
25
|
-
value: href
|
|
26
|
-
})
|
|
27
|
-
]
|
|
28
|
-
}),
|
|
29
|
-
/*#__PURE__*/ _jsx("div", {
|
|
30
|
-
style: {
|
|
31
|
-
fontWeight: '600',
|
|
32
|
-
overflow: 'hidden',
|
|
33
|
-
textOverflow: 'ellipsis'
|
|
34
|
-
},
|
|
35
|
-
children: /*#__PURE__*/ _jsx("a", {
|
|
36
|
-
href: href,
|
|
37
|
-
rel: "noreferrer noopener",
|
|
38
|
-
target: "_blank",
|
|
39
|
-
children: href
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=LinkToDoc.js.map
|
package/dist/ui/LinkToDoc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/LinkToDoc.tsx"],"sourcesContent":["'use client'\nimport type { UIFieldClientComponent } from 'payload'\n\nimport { CopyToClipboard, useFormFields } from '@payloadcms/ui'\nimport React from 'react'\n\nexport const LinkToDoc: UIFieldClientComponent = (props) => {\n const {\n field: { admin: { custom = {} } = {} },\n } = props\n const { isTestKey, nameOfIDField, stripeResourceType } = custom\n\n const field = useFormFields(([fields]) => (fields && fields?.[nameOfIDField]) || null)\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":["CopyToClipboard","useFormFields","React","LinkToDoc","props","field","admin","custom","isTestKey","nameOfIDField","stripeResourceType","fields","value","stripeID","stripeEnv","href","div","span","className","style","color","fontWeight","overflow","textOverflow","a","rel","target"],"mappings":"AAAA;;AAGA,SAASA,eAAe,EAAEC,aAAa,QAAQ,iBAAgB;AAC/D,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,YAAoC,CAACC;IAChD,MAAM,EACJC,OAAO,EAAEC,OAAO,EAAEC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EACvC,GAAGH;IACJ,MAAM,EAAEI,SAAS,EAAEC,aAAa,EAAEC,kBAAkB,EAAE,GAAGH;IAEzD,MAAMF,QAAQJ,cAAc,CAAC,CAACU,OAAO,GAAK,AAACA,UAAUA,QAAQ,CAACF,cAAc,IAAK;IACjF,MAAM,EAAEG,OAAOC,QAAQ,EAAE,GAAGR,SAAS,CAAC;IAEtC,MAAMS,YAAYN,YAAY,UAAU;IACxC,MAAMO,OAAO,CAAC,6BAA6B,EAAED,YAAYJ,mBAAmB,CAAC,EAAEG,UAAU;IAEzF,IAAIA,UAAU;QACZ,qBACE,MAACG;;8BACC,MAACA;;sCACC,KAACC;4BACCC,WAAU;4BACVC,OAAO;gCACLC,OAAO;4BACT;sCACD;;sCAGD,KAACpB;4BAAgBY,OAAOG;;;;8BAE1B,KAACC;oBACCG,OAAO;wBACLE,YAAY;wBACZC,UAAU;wBACVC,cAAc;oBAChB;8BAEA,cAAA,KAACC;wBAAET,MAAMA;wBAAMU,KAAI;wBAAsBC,QAAO;kCAC7CX;;;;;IAKX;IAEA,OAAO;AACT,EAAC"}
|