@storecraft/sdk 1.2.5 → 1.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storecraft/sdk",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "description": "Official storecraft Universal Javascript SDK",
5
5
  "license": "MIT",
6
6
  "author": "Tomer Shalev (https://github.com/store-craft)",
package/src/checkout.js CHANGED
@@ -66,7 +66,7 @@ export default class Checkout {
66
66
  * @description calculate the pricing of an `order`.
67
67
  * Using auto-discounts, coupons, shipping and line-items.
68
68
  * @param {CheckoutCreateTypeAfterValidation} order
69
- * @returns {Promise<Partial<PricingData>>}
69
+ * @returns {Promise<Partial<Pick<OrderData, "pricing" | "validation">>>}
70
70
  */
71
71
  pricing = async (order) => {
72
72
 
package/src/payments.js CHANGED
@@ -6,7 +6,8 @@
6
6
  import { StorecraftSDK } from '../index.js'
7
7
  import {
8
8
  fetchApiWithAuth, get_from_collection_resource,
9
- list_from_collection_resource
9
+ list_from_collection_resource,
10
+ url
10
11
  } from './utils.api.fetch.js';
11
12
 
12
13
  /**
@@ -94,6 +95,18 @@ export default class Payments {
94
95
  )
95
96
  }
96
97
 
98
+ /**
99
+ * Get an optional HTML Pay UI of the `payment gateway`
100
+ * @param {string} order_id the `id` of the `order`
101
+ * @returns {string} buy UI url
102
+ */
103
+ getBuyUiUrl(order_id) {
104
+ return url(
105
+ this.sdk.config,
106
+ `/payments/buy_ui/${order_id}`
107
+ );
108
+ }
109
+
97
110
  /**
98
111
  * invoke the webhook endpoint for async payment
99
112
  * @param {string} gateway_handle The handle of the `payment gateway`