@commercelayer/react-components 4.11.2-beta.0 → 4.11.2-beta.1
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.
|
@@ -6,7 +6,7 @@ import { type CommerceLayerClient, type Order } from '@commercelayer/sdk';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function hasSubscriptions(order: Order): boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Check if the given `order` has a linked `order_subscription`
|
|
9
|
+
* Check if the given `order` has a linked `order_subscription` to replace its `customer_payment_source` with the updated `order`'s `payment_source`.
|
|
10
10
|
* @param order Order
|
|
11
11
|
* @returns void
|
|
12
12
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.updateSubscriptionCustomerPaymentSource=exports.hasSubscriptions=void 0;function hasSubscriptions(order){var _a;return((_a=order?.line_items)===null||_a===void 0?void 0:_a.some(li=>li.frequency!=null))!=null}exports.hasSubscriptions=hasSubscriptions;function updateSubscriptionCustomerPaymentSource(order,sdk){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.updateSubscriptionCustomerPaymentSource=exports.hasSubscriptions=void 0;function hasSubscriptions(order){var _a;return((_a=order?.line_items)===null||_a===void 0?void 0:_a.some(li=>li.frequency!=null))!=null}exports.hasSubscriptions=hasSubscriptions;function updateSubscriptionCustomerPaymentSource(order,sdk){order.subscription_created_at!=null&&sdk.orders.retrieve(order.id,{include:["payment_source","order_subscription","order_subscription.customer_payment_source"]}).then(order2=>{order2.payment_source!=null&&order2.order_subscription!=null&&sdk.customer_payment_sources.list({filters:{payment_source_id_eq:order2.payment_source.id}}).then(customerPaymentSources=>{var _a;if(customerPaymentSources.length>0&&order2.order_subscription!=null){const customerPaymentSource=customerPaymentSources[0];customerPaymentSource!=null&&sdk.order_subscriptions.update({id:(_a=order2.order_subscription)===null||_a===void 0?void 0:_a.id,customer_payment_source:sdk.customer_payment_sources.relationship(customerPaymentSource.id)})}})})}exports.updateSubscriptionCustomerPaymentSource=updateSubscriptionCustomerPaymentSource;
|
|
@@ -6,7 +6,7 @@ import { type CommerceLayerClient, type Order } from '@commercelayer/sdk';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function hasSubscriptions(order: Order): boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Check if the given `order` has a linked `order_subscription`
|
|
9
|
+
* Check if the given `order` has a linked `order_subscription` to replace its `customer_payment_source` with the updated `order`'s `payment_source`.
|
|
10
10
|
* @param order Order
|
|
11
11
|
* @returns void
|
|
12
12
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export function hasSubscriptions(order){return order?.line_items?.some(li=>li.frequency!=null)!=null}export function updateSubscriptionCustomerPaymentSource(order,sdk){
|
|
2
|
+
export function hasSubscriptions(order){return order?.line_items?.some(li=>li.frequency!=null)!=null}export function updateSubscriptionCustomerPaymentSource(order,sdk){order.subscription_created_at!=null&&sdk.orders.retrieve(order.id,{include:["payment_source","order_subscription","order_subscription.customer_payment_source"]}).then(order2=>{order2.payment_source!=null&&order2.order_subscription!=null&&sdk.customer_payment_sources.list({filters:{payment_source_id_eq:order2.payment_source.id}}).then(customerPaymentSources=>{if(customerPaymentSources.length>0&&order2.order_subscription!=null){const customerPaymentSource=customerPaymentSources[0];customerPaymentSource!=null&&sdk.order_subscriptions.update({id:order2.order_subscription?.id,customer_payment_source:sdk.customer_payment_sources.relationship(customerPaymentSource.id)})}})})}
|