@alma/widgets 3.0.4 → 3.1.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/dist/raw/widgets.css +0 -2
- package/dist/raw/widgets.js +34 -4
- package/dist/raw/widgets.js.map +1 -1
- package/dist/raw/widgets.m.js +34 -4
- package/dist/raw/widgets.m.js.map +1 -1
- package/dist/raw/widgets.modern.js +34 -4
- package/dist/raw/widgets.modern.js.map +1 -1
- package/dist/raw/widgets.umd.js +34 -4
- package/dist/raw/widgets.umd.js.map +1 -1
- package/dist/types/Widgets/EligibilityModal/ModalContainer.d.ts +2 -0
- package/dist/types/Widgets/PaymentPlans/index.d.ts +2 -0
- package/dist/types/hooks/useFetchEligibility.d.ts +1 -1
- package/dist/types/types.d.ts +4 -0
- package/dist/widgets.css +1 -1
- package/dist/widgets.js +1 -1
- package/dist/widgets.js.map +1 -1
- package/dist/widgets.m.js +1 -1
- package/dist/widgets.m.js.map +1 -1
- package/dist/widgets.modern.js +1 -1
- package/dist/widgets.modern.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/raw/widgets.css
CHANGED
package/dist/raw/widgets.js
CHANGED
|
@@ -2181,7 +2181,7 @@ var filterELigibility = function filterELigibility(eligibilities, configPlans) {
|
|
|
2181
2181
|
});
|
|
2182
2182
|
};
|
|
2183
2183
|
|
|
2184
|
-
var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans) {
|
|
2184
|
+
var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, plans, customerBillingCountry, customerShippingCountry) {
|
|
2185
2185
|
var domain = _ref.domain,
|
|
2186
2186
|
merchantId = _ref.merchantId;
|
|
2187
2187
|
|
|
@@ -2202,9 +2202,27 @@ var useFetchEligibility = function useFetchEligibility(purchaseAmount, _ref, pla
|
|
|
2202
2202
|
});
|
|
2203
2203
|
React.useEffect(function () {
|
|
2204
2204
|
if (status === apiStatus.PENDING) {
|
|
2205
|
+
var billing_address = null;
|
|
2206
|
+
|
|
2207
|
+
if (customerBillingCountry) {
|
|
2208
|
+
billing_address = {
|
|
2209
|
+
country: customerBillingCountry
|
|
2210
|
+
};
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
var shipping_address = null;
|
|
2214
|
+
|
|
2215
|
+
if (customerShippingCountry) {
|
|
2216
|
+
shipping_address = {
|
|
2217
|
+
country: customerShippingCountry
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2205
2221
|
fetchFromApi(domain + '/v2/payments/eligibility', {
|
|
2206
2222
|
purchase_amount: purchaseAmount,
|
|
2207
|
-
queries: configInstallments
|
|
2223
|
+
queries: configInstallments,
|
|
2224
|
+
billing_address: billing_address,
|
|
2225
|
+
shipping_address: shipping_address
|
|
2208
2226
|
}, {
|
|
2209
2227
|
Authorization: "Alma-Merchant-Auth " + merchantId
|
|
2210
2228
|
}).then(function (res) {
|
|
@@ -2948,10 +2966,12 @@ var ModalContainer = function ModalContainer(_ref) {
|
|
|
2948
2966
|
var purchaseAmount = _ref.purchaseAmount,
|
|
2949
2967
|
apiData = _ref.apiData,
|
|
2950
2968
|
configPlans = _ref.configPlans,
|
|
2969
|
+
customerBillingCountry = _ref.customerBillingCountry,
|
|
2970
|
+
customerShippingCountry = _ref.customerShippingCountry,
|
|
2951
2971
|
onClose = _ref.onClose,
|
|
2952
2972
|
cards = _ref.cards;
|
|
2953
2973
|
|
|
2954
|
-
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
|
|
2974
|
+
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
|
|
2955
2975
|
eligibilityPlans = _useFetchEligibility[0],
|
|
2956
2976
|
status = _useFetchEligibility[1];
|
|
2957
2977
|
|
|
@@ -3084,11 +3104,13 @@ var PaymentPlanWidget = function PaymentPlanWidget(_ref) {
|
|
|
3084
3104
|
purchaseAmount = _ref.purchaseAmount,
|
|
3085
3105
|
suggestedPaymentPlan = _ref.suggestedPaymentPlan,
|
|
3086
3106
|
cards = _ref.cards,
|
|
3107
|
+
customerBillingCountry = _ref.customerBillingCountry,
|
|
3108
|
+
customerShippingCountry = _ref.customerShippingCountry,
|
|
3087
3109
|
transitionDelay = _ref.transitionDelay,
|
|
3088
3110
|
_ref$hideBorder = _ref.hideBorder,
|
|
3089
3111
|
hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder;
|
|
3090
3112
|
|
|
3091
|
-
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans),
|
|
3113
|
+
var _useFetchEligibility = useFetchEligibility(purchaseAmount, apiData, configPlans, customerBillingCountry, customerShippingCountry),
|
|
3092
3114
|
eligibilityPlans = _useFetchEligibility[0],
|
|
3093
3115
|
status = _useFetchEligibility[1];
|
|
3094
3116
|
|
|
@@ -3247,6 +3269,8 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3247
3269
|
_options$monochrome = options.monochrome,
|
|
3248
3270
|
monochrome = _options$monochrome === void 0 ? true : _options$monochrome,
|
|
3249
3271
|
suggestedPaymentPlan = options.suggestedPaymentPlan,
|
|
3272
|
+
customerBillingCountry = options.customerBillingCountry,
|
|
3273
|
+
customerShippingCountry = options.customerShippingCountry,
|
|
3250
3274
|
_options$locale = options.locale,
|
|
3251
3275
|
locale = _options$locale === void 0 ? Locale.en : _options$locale,
|
|
3252
3276
|
cards = options.cards;
|
|
@@ -3262,6 +3286,8 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3262
3286
|
purchaseAmount: purchaseAmount,
|
|
3263
3287
|
suggestedPaymentPlan: suggestedPaymentPlan,
|
|
3264
3288
|
cards: cards,
|
|
3289
|
+
customerBillingCountry: customerBillingCountry,
|
|
3290
|
+
customerShippingCountry: customerShippingCountry,
|
|
3265
3291
|
transitionDelay: transitionDelay,
|
|
3266
3292
|
hideBorder: hideBorder
|
|
3267
3293
|
})), document.querySelector(container));
|
|
@@ -3275,6 +3301,8 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3275
3301
|
_plans = options.plans,
|
|
3276
3302
|
_options$locale2 = options.locale,
|
|
3277
3303
|
_locale = _options$locale2 === void 0 ? Locale.en : _options$locale2,
|
|
3304
|
+
_customerBillingCountry = options.customerBillingCountry,
|
|
3305
|
+
_customerShippingCountry = options.customerShippingCountry,
|
|
3278
3306
|
_cards = options.cards;
|
|
3279
3307
|
|
|
3280
3308
|
var close = function close() {
|
|
@@ -3288,6 +3316,8 @@ var WidgetsController = /*#__PURE__*/function () {
|
|
|
3288
3316
|
purchaseAmount: _purchaseAmount,
|
|
3289
3317
|
apiData: _this.apiData,
|
|
3290
3318
|
configPlans: _plans,
|
|
3319
|
+
customerBillingCountry: _customerBillingCountry,
|
|
3320
|
+
customerShippingCountry: _customerShippingCountry,
|
|
3291
3321
|
onClose: close,
|
|
3292
3322
|
cards: _cards
|
|
3293
3323
|
})), document.querySelector(_container));
|