diff --git a/docs/content/advanced/backend/subscribers/events-list.md b/docs/content/advanced/backend/subscribers/events-list.md
index d653339f62..883fc0d91f 100644
--- a/docs/content/advanced/backend/subscribers/events-list.md
+++ b/docs/content/advanced/backend/subscribers/events-list.md
@@ -1,4 +1,4 @@
-# Events List
+# Events Reference
This document details all events in Medusa, when they are triggered, and what data your handler method will receive when the event is triggered.
@@ -45,7 +45,7 @@ Triggered when a batch job is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -66,7 +66,7 @@ Triggered when a batch job is updated.
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -87,7 +87,7 @@ Triggered when a batch job is canceled.
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -110,7 +110,7 @@ Triggered after the `preProcessBatchJob` of a batch job stategy is done executin
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -133,7 +133,7 @@ Triggered after the batch job is done pre-processing and the batch job is not in
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -154,7 +154,7 @@ Triggered when a batch job starts processing after it's confirmed.
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -175,7 +175,7 @@ Triggered when a batch job is done processing and is completed.
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -196,7 +196,7 @@ Triggered when an error occurs while running a batch job and the batch job fails
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of batch job
}
@@ -254,7 +254,7 @@ Triggered when a cart is created.
|
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of cart
}
@@ -319,7 +319,7 @@ Triggered when a claim is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of claim
no_notification //boolean indicating whether a notification should be sent or not
@@ -344,7 +344,7 @@ Triggered when a claim is updated.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of claim
no_notification //boolean indicating whether a notification should be sent or not
@@ -369,7 +369,7 @@ Triggered when a claim is canceled.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of claim
no_notification //boolean indicating whether a notification should be sent or not
@@ -394,7 +394,7 @@ Triggered when fulfillment is created for a claim.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of claim
fulfillment_id, //string ID of the fulfillment created
@@ -420,7 +420,7 @@ Triggered when a claim fulfillment is set as “shipped”.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of claim
fulfillment_id, //string ID of the fulfillment created
@@ -446,7 +446,7 @@ Triggered when a claim of type “refunded” has been refunded.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of claim
no_notification //boolean indicating whether a notification should be sent or not
@@ -493,7 +493,7 @@ Triggered when claim items are created and associated with a claim. This happens
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of claim item
}
@@ -517,7 +517,7 @@ Triggered when a claim item is updated. This happens when a claim is updated.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of claim item
}
@@ -541,7 +541,7 @@ Triggered when a claim is canceled.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of claim item
}
@@ -553,6 +553,52 @@ Object of the following format:
+## Currency Events
+
+This section holds all events related to currencies.
+
+
+
+
+|
+Event Name
+ |
+
+Description
+ |
+
+Event Data Payload
+ |
+
+
+
+
+|
+
+`currency.updated`
+
+ |
+
+
+Triggered when a currency is updated.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ code //string 3 character ISO code of the updated currency.
+}
+```
+
+ |
+
+
+
+
+
## Customer Events
This section holds all events related to customers.
@@ -623,7 +669,7 @@ Triggered when a customer requests to reset their password.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of customer
email, //string email of the customer
@@ -673,7 +719,7 @@ Triggered when a draft order is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of draft order
}
@@ -697,7 +743,7 @@ Triggered when a draft order and data associated with it (email, billing address
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of draft order
}
@@ -790,7 +836,7 @@ Triggered when an invite is created for a user to join the admin team.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of invite
token, //string token generated to validate the invited user
@@ -837,7 +883,7 @@ Triggered when a note is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of note
}
@@ -861,7 +907,7 @@ Triggered when a note is updated.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of note
}
@@ -885,7 +931,7 @@ Triggered when a note is deleted.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of note
}
@@ -996,7 +1042,7 @@ Triggered when a new order is placed.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
no_notification //boolean indicating whether a notification should be sent or not
@@ -1021,7 +1067,7 @@ Triggered when an order and data associated with it (shipping method, shipping a
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
no_notification //(optional) boolean indicating whether a notification should be sent or not
@@ -1046,7 +1092,7 @@ Triggered when an order is canceled.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
no_notification //boolean indicating whether a notification should be sent or not
@@ -1071,7 +1117,7 @@ Triggered when an order is completed.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
no_notification //boolean indicating whether a notification should be sent or not
@@ -1084,6 +1130,30 @@ Object of the following format:
|
|
+`order.orders_claimed`
+
+ |
+
+
+Triggered when an order is claimed.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id, //string ID of order
+}
+```
+
+ |
+
+
+
+|
+
`order.gift_card_created`
|
@@ -1096,7 +1166,7 @@ Triggered when a gift card in an order is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of order
}
@@ -1120,7 +1190,7 @@ Triggered when the payment of an order is captured.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
no_notification //boolean indicating whether a notification should be sent or not
@@ -1145,7 +1215,7 @@ Triggered when capturing the payment of an order fails.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
payment_id, //string ID of Payment
@@ -1172,7 +1242,7 @@ Triggered when fulfillment is created for an order.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
fulfillment_id, //string ID of fulfillment
@@ -1198,7 +1268,7 @@ Triggered when a shipment is created for fulfillment and the fulfillment is regi
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
fulfillment_id, //string ID of fulfillment
@@ -1224,7 +1294,7 @@ Triggered when fulfillment of an order is canceled.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
fulfillment_id, //string ID of fulfillment
@@ -1250,7 +1320,7 @@ Triggered when a return of an order is requested.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
return_id, //string ID of return
@@ -1276,7 +1346,7 @@ Triggered when the items of an order have been returned and the order has been r
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
return_id, //string ID of return
@@ -1302,7 +1372,7 @@ Triggered when the order is being registered as “returned” but there are add
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
return_id, //string ID of return
@@ -1328,7 +1398,7 @@ Triggered when the order’s payment is refunded.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
refund_id, //string ID of refund
@@ -1354,7 +1424,7 @@ Triggered when the refund of the order’s payment fails.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
}
@@ -1378,7 +1448,7 @@ Triggered when a swap for an order is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of order
}
@@ -1390,6 +1460,500 @@ Object of the following format:
+## Order Edit Events
+
+This section holds all events related to order edits.
+
+:::note
+
+As of Medusa v1.3.9, Order Edits are available but guarded by a feature flag. To use Order Edits either:
+
+1. Enable the `MEDUSA_FF_ORDER_EDITING` environment variable;
+2. Or enable the `order_editing` key in the Medusa server's settings.
+
+You can learn more about enabling it in the [feature flags](../feature-flags/toggle.md) documentation.
+
+:::
+
+
+
+
+|
+Event Name
+ |
+
+Description
+ |
+
+Event Data Payload
+ |
+
+
+
+
+|
+
+`order-edit.created`
+
+ |
+
+
+Triggered when a order edit is created.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id, //string ID of order edit
+}
+```
+
+ |
+
+
+
+|
+
+`order-edit.updated`
+
+ |
+
+
+Triggered when an order edit is updated.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id, //string ID of order edit
+}
+```
+
+ |
+
+
+
+|
+
+`order-edit.canceled`
+
+ |
+
+
+Triggered when an order edit is canceled.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id, //string ID of order edit
+}
+```
+
+ |
+
+
+
+|
+
+`order-edit.declined`
+
+ |
+
+
+Triggered when an order edit is declined.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id, //string ID of order edit
+}
+```
+
+ |
+
+
+
+|
+
+`order-edit.requested`
+
+ |
+
+
+Triggered when an order edit is requested.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id //string ID of order edit
+}
+```
+
+ |
+
+
+
+|
+
+`order-edit.confirmed`
+
+ |
+
+
+Triggered when an order edit is confirmed.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id, //string ID of order edit
+}
+```
+
+ |
+
+
+
+
+
+## Order Edit Item Changes Events
+
+This section holds all events related to order edit item changes.
+
+:::note
+
+As of Medusa v1.3.9, Order Edits are available but guarded by a feature flag. To use Order Edits either:
+
+1. Enable the `MEDUSA_FF_ORDER_EDITING` environment variable;
+2. Or enable the `order_editing` key in the Medusa server's settings.
+
+You can learn more about enabling it in the [feature flags](../feature-flags/toggle.md) documentation.
+
+:::
+
+
+
+
+|
+Event Name
+ |
+
+Description
+ |
+
+Event Data Payload
+ |
+
+
+
+
+|
+
+`order-edit-item-change.CREATED`
+
+ |
+
+
+Triggered when an order edit item change is created.
+
+ |
+
+
+```js noReport noCopy
+{
+ id //string ID of item change
+}
+```
+
+ |
+
+
+
+|
+
+`order-edit-item-change.DELETED`
+
+ |
+
+
+Triggered when an order edit item change is deleted.
+
+ |
+
+
+```js noReport noCopy
+{
+ id //string ID of item change
+}
+```
+
+ |
+
+
+
+
+
+## Payment Events
+
+This section holds all events related to payment.
+
+
+
+
+|
+Event Name
+ |
+
+Description
+ |
+
+Event Data Payload
+ |
+
+
+
+
+
+|
+
+`payment.created`
+
+ |
+
+
+Triggered when a payment is created.
+
+ |
+
+
+The entire payment passed as an object. You can refer to the [Payment entity](../../../references/entities/classes/Payment.md) for an idea of what fields to expect.
+
+ |
+
+
+
+|
+
+`payment.updated`
+
+ |
+
+
+Triggered when a payment is updated.
+
+ |
+
+
+The entire payment passed as an object. You can refer to the [Payment entity](../../../references/entities/classes/Payment.md) for an idea of what fields to expect.
+
+ |
+
+
+
+|
+
+`payment.payment_captured`
+
+ |
+
+
+Triggered when a payment is captured.
+
+ |
+
+
+The entire payment passed as an object. You can refer to the [Payment entity](../../../references/entities/classes/Payment.md) for an idea of what fields to expect.
+
+ |
+
+
+
+|
+
+`payment.payment_capture_failed`
+
+ |
+
+
+Triggered when the capturing of a payment fails.
+
+ |
+
+
+The entire payment passed as an object. You can refer to the [Payment entity](../../../references/entities/classes/Payment.md) for an idea of what fields to expect.
+
+In addition, an error object is passed within the same object as the Payment provider:
+
+```js noReport noCopy
+{
+ id, //string ID of payment
+ //... other payment fields
+ error: {
+ name, //string
+ nessage, //string
+ stack, //(optional) string
+ }
+}
+```
+
+ |
+
+
+
+|
+
+`payment.payment_refund_created`
+
+ |
+
+
+Triggered when a refund of a payment is created.
+
+ |
+
+
+The entire refund passed as an object. You can refer to the [Refund entity](../../../references/entities/classes/Refund.md) for an idea of what fields to expect.
+
+ |
+
+
+
+|
+
+`payment.payment_refund_failed`
+
+ |
+
+
+Triggered when a payment's refund fails.
+
+ |
+
+
+The entire payment passed as an object. You can refer to the [Payment entity](../../../references/entities/classes/Payment.md) for an idea of what fields to expect.
+
+ |
+
+
+
+
+
+## Payment Collection Events
+
+This section holds all events related to payment collections.
+
+
+
+
+|
+Event Name
+ |
+
+Description
+ |
+
+Event Data Payload
+ |
+
+
+
+
+
+|
+
+`payment-collection.created`
+
+ |
+
+
+Triggered when a payment collection is created.
+
+ |
+
+
+The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../../references/entities/classes/PaymentCollection.md) for an idea of what fields to expect.
+
+ |
+
+
+
+|
+
+`payment-collection.updated`
+
+ |
+
+
+Triggered when a payment collection is update.
+
+ |
+
+
+The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../../references/entities/classes/PaymentCollection.md) for an idea of what fields to expect.
+
+ |
+
+
+
+|
+
+`payment-collection.deleted`
+
+ |
+
+
+Triggered when a payment collection is deleted.
+
+ |
+
+
+The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../../references/entities/classes/PaymentCollection.md) for an idea of what fields to expect.
+
+ |
+
+
+
+|
+
+`payment-collection.payment_authorized`
+
+ |
+
+
+Triggered when a payment collection is either marked authorized or its payment session is authorized.
+
+ |
+
+
+The entire payment collection passed as an object. You can refer to the [Payment Collection entity](../../../references/entities/classes/PaymentCollection.md) for an idea of what fields to expect.
+
+ |
+
+
+
+
+
## Product Events
This section holds all events related to products.
@@ -1425,7 +1989,7 @@ Triggered when a product is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of product
}
@@ -1447,11 +2011,11 @@ Triggered when a product and data associated with it (options, variant orders, e
-The entire product passed as an object. You can refer to the [Product entity](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/models/product.ts) for an idea of what fields to expect.
+The entire product passed as an object. You can refer to the [Product entity](../../../references/entities/classes/Product.md) for an idea of what fields to expect.
In one case, when the `/admin/products/{id}` endpoint is used to update the product, the payload is an object of the following format:
-```js
+```js noReport noCopy
{
id, //id of product
fields //an array of field names that were updated
@@ -1476,7 +2040,7 @@ Triggered when a product is deleted.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of product
}
@@ -1522,7 +2086,7 @@ Triggered when a product variant is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of variant
product_id //string ID of product
@@ -1547,7 +2111,7 @@ Triggered when a product variant is updated.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of variant
product_id, //string ID of product
@@ -1573,7 +2137,7 @@ Triggered when a product variant is deleted.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of variant
product_id, //string ID of product
@@ -1587,6 +2151,88 @@ Object of the following format:
+## Publishable API Key Events
+
+This section holds all events related to publishable API keys.
+
+:::note
+
+As of Medusa v1.6.3, Publishable API Keys are available but guarded by a feature flag. To use Publishable API Keys either:
+
+1. Enable the `MEDUSA_FF_PUBLISHABLE_API_KEYS` environment variable;
+2. Or enable the `publishable_api_keys` key in the Medusa server's settings.
+
+You can learn more about enabling it in the [feature flags](../feature-flags/toggle.md) documentation.
+
+:::
+
+
+
+
+|
+Event Name
+ |
+
+Description
+ |
+
+Event Data Payload
+ |
+
+
+
+
+
+|
+
+`publishable_api_key.created`
+
+ |
+
+
+Triggered when a publishable API key is created.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id //string ID of publishable API key
+}
+```
+
+ |
+
+
+
+|
+
+`publishable_api_key.revoked`
+
+ |
+
+
+Triggered when a publishable API key is revoked.
+
+ |
+
+
+Object of the following format:
+
+```js noReport noCopy
+{
+ id //string ID of publishable API key
+}
+```
+
+ |
+
+
+
+
+
## Region Events
This section holds all events related to regions.
@@ -1621,7 +2267,7 @@ Triggered when a region is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of region
}
@@ -1645,7 +2291,7 @@ Triggered when a region or data associated with it (countries, fulfillment provi
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of region
fields //array of names of updated fields
@@ -1670,7 +2316,7 @@ Triggered when a region is deleted.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of region
}
@@ -1726,7 +2372,7 @@ Triggered when a sales channel is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of sales channel
}
@@ -1750,7 +2396,7 @@ Triggered when a sales channel is updated
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of sales channel
}
@@ -1774,7 +2420,7 @@ Triggered when a sales channel is deleted.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of sales channel
}
@@ -1819,7 +2465,7 @@ Triggered when a swap is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
no_notification //boolean indicating whether a notification should be sent or not
@@ -1844,7 +2490,7 @@ Triggered when a swap is registered as received.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
order_id, //string ID of order
@@ -1870,7 +2516,7 @@ Triggered when fulfillment is created for a swap.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
fulfillment_id, //string ID of fulfillment
@@ -1896,7 +2542,7 @@ Triggered when a shipment is created for a swap and the fulfillment associated w
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
fulfillment_id, //string ID of fulfillment
@@ -1922,7 +2568,7 @@ Triggered when payment is completed for a swap which happens when the cart assoc
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
no_notification //boolean indicating whether a notification should be sent or not
@@ -1947,7 +2593,7 @@ Triggered when the payment is captured for a swap.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
no_notification //boolean indicating whether a notification should be sent or not
@@ -1972,7 +2618,7 @@ Triggered when the capturing of the payment of a swap fails.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
no_notification //boolean indicating whether a notification should be sent or not
@@ -1997,7 +2643,7 @@ Triggered when a swap’s amount difference is processed and refunded.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
no_notification //boolean indicating whether a notification should be sent or not
@@ -2022,7 +2668,7 @@ Triggered when processing and refunding a swap’s amount difference fails.
Object of the following format:
-```js
+```js noReport noCopy
{
id, //string ID of swap
no_notification //boolean indicating whether a notification should be sent or not
@@ -2069,7 +2715,7 @@ Triggered when a user is created.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of user
}
@@ -2093,7 +2739,7 @@ Triggered when a user is updated.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of user
}
@@ -2117,7 +2763,7 @@ Triggered when a user requests to reset their password.
Object of the following format:
-```js
+```js noReport noCopy
{
email, //string email of user requesting to reset their password
token //token create to reset the password
@@ -2142,7 +2788,7 @@ Triggered when a user is deleted.
Object of the following format:
-```js
+```js noReport noCopy
{
id //string ID of user
}
diff --git a/docs/content/contribution-guidelines.md b/docs/content/contribution-guidelines.md
index a4966bb235..644a48550c 100644
--- a/docs/content/contribution-guidelines.md
+++ b/docs/content/contribution-guidelines.md
@@ -152,7 +152,7 @@ console.log("hello")
```
~~~
-### Remove Report Buttons
+### Remove Report Button
Some code block don't need a report button. To remove the report button, use the `noReport` metadata.
@@ -164,6 +164,18 @@ medusa new my-medusa-store --seed
```
~~~
+### Remove Copy Button
+
+Some code blocks don't need a copy button. To remove the copy button, use the `noCopy` metadata:
+
+For example:
+
+~~~md
+```bash noCopy
+medusa new my-medusa-store --seed
+```
+~~~
+
## NPM and Yarn Code Blocks
If you’re adding code blocks that use NPM and Yarn, you must use the [npm2yarn syntax](https://docusaurus.io/docs/markdown-features/code-blocks#npm2yarn-remark-plugin).
diff --git a/www/docs/src/css/_docspage.css b/www/docs/src/css/_docspage.css
index 4c553ecd8b..7d93f33ea8 100644
--- a/www/docs/src/css/_docspage.css
+++ b/www/docs/src/css/_docspage.css
@@ -30,6 +30,10 @@ details summary {
width: 50%;
}
+.reference-table .tooltip-container code {
+ white-space: nowrap;
+}
+
.reference-table .theme-code-block span {
max-width: 100%;
word-break: break-word;
diff --git a/www/docs/src/theme/CodeBlock/Content/String.js b/www/docs/src/theme/CodeBlock/Content/String.js
index a4a8dc2f5a..48e918776e 100644
--- a/www/docs/src/theme/CodeBlock/Content/String.js
+++ b/www/docs/src/theme/CodeBlock/Content/String.js
@@ -26,7 +26,8 @@ export default function CodeBlockString({
title: titleProp,
showLineNumbers: showLineNumbersProp,
language: languageProp,
- noReport = false
+ noReport = false,
+ noCopy = false
}) {
const {
prism: {defaultLanguage, magicComments},
@@ -101,12 +102,14 @@ export default function CodeBlockString({
)}
-
-
-
+ {!noCopy && (
+
+
+
+ )}
diff --git a/www/docs/src/theme/CodeBlock/index.js b/www/docs/src/theme/CodeBlock/index.js
index 72149f2b70..d24c7493d6 100644
--- a/www/docs/src/theme/CodeBlock/index.js
+++ b/www/docs/src/theme/CodeBlock/index.js
@@ -17,7 +17,7 @@ function maybeStringifyChildren(children) {
// The children is now guaranteed to be one/more plain strings
return Array.isArray(children) ? children.join('') : children;
}
-export default function CodeBlock({children: rawChildren, noReport = false, ...props}) {
+export default function CodeBlock({children: rawChildren, noReport = false, noCopy = false, ...props}) {
// The Prism theme on SSR is always the default theme but the site theme can
// be in a different mode. React hydration doesn't update DOM styles that come
// from SSR. Hence force a re-render after mounting to apply the current
@@ -37,7 +37,7 @@ export default function CodeBlock({children: rawChildren, noReport = false, ...p
{title}
)}
-
+
{children}
|