@pelcro/react-pelcro-js 3.26.0-beta.76 → 3.26.0-beta.78

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/index.cjs.js CHANGED
@@ -3835,7 +3835,8 @@ var buttons$l = {
3835
3835
  var messages$10 = {
3836
3836
  orderConfirmed: {
3837
3837
  title: "Order confirmed!",
3838
- body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order."
3838
+ body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order.",
3839
+ bodyDigital: "Your order has been confirmed. You'll shortly receive an email confirmation of this order."
3839
3840
  },
3840
3841
  haveQuestions: "If you have any queries please don't hesitate to contact us!",
3841
3842
  multipleCurrencies: "Your cart currently contains items which are available in different currencies. In order to proceed with the checkout, please make sure that all items have the same currency.",
@@ -4797,9 +4798,10 @@ var buttons$f = {
4797
4798
  var messages$J = {
4798
4799
  orderConfirmed: {
4799
4800
  title: "Votre commande est confirmée !",
4800
- body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu."
4801
+ body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu.",
4802
+ bodyDigital: "Votre commande a été confirmée. Vous recevrez un courriel de confirmation sous peu."
4801
4803
  },
4802
- haveQuestions: "Nhésitez pas à nous contacter pour toute question !",
4804
+ haveQuestions: "N'hésitez pas à nous contacter pour toute question !",
4803
4805
  multipleCurrencies: "Votre panier contient des articles disponibles dans différentes devises. Avant de passer à la caisse, veuillez vous assurer que tous les articles ont la même devise.",
4804
4806
  currencyMismatch: "Les articles sélectionnés ne sont pas compatibles avec la devise associée à votre compte ({{currency}}). Veuillez choisir des articles uniquement offerts dans cette devise."
4805
4807
  };
@@ -5747,7 +5749,8 @@ var buttons$9 = {
5747
5749
  var messages$q = {
5748
5750
  orderConfirmed: {
5749
5751
  title: "주문이 확인되었습니다!",
5750
- body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
5752
+ body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다.",
5753
+ bodyDigital: "귀하의 주문이 확인되었습니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
5751
5754
  },
5752
5755
  haveQuestions: "질문이 있으면 언제든 저희에게 연락주시기 바랍니다!",
5753
5756
  multipleCurrencies: "장바구니에 다른 통화로만 결제가 가능한 아이템이 있습니다. 결제를 계속 진행하려면 모든 아이템의 결제 통화가 동일한지 확인하십시오.",
@@ -6800,7 +6803,8 @@ var buttons$3 = {
6800
6803
  var messages$7 = {
6801
6804
  orderConfirmed: {
6802
6805
  title: "¡Orden confirmada!",
6803
- body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden."
6806
+ body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden.",
6807
+ bodyDigital: "Tu orden ha sido confirmada. En breve recibirás un correo electrónico de confirmación de esta orden."
6804
6808
  },
6805
6809
  haveQuestions: "¡Si tienes alguna pregunta, no dudes en contactarnos!",
6806
6810
  multipleCurrencies: "Tu carrito actualmente contiene artículos que están disponibles en diferentes divisas. Para proceder a la compra, asegúrate de que todos los artículos tengan la misma divisa.",
@@ -18210,7 +18214,9 @@ class CybersourceGateway {
18210
18214
  quantity = 1,
18211
18215
  addressId,
18212
18216
  isExistingSource,
18213
- fingerprint_session_id
18217
+ fingerprint_session_id,
18218
+ cardExpirationMonth,
18219
+ cardExpirationYear
18214
18220
  } = options;
18215
18221
  const params = isExistingSource ? {
18216
18222
  source_id: token
@@ -18226,6 +18232,8 @@ class CybersourceGateway {
18226
18232
  coupon_code: couponCode,
18227
18233
  address_id: product.address_required ? addressId : null,
18228
18234
  fingerprint_session_id: fingerprint_session_id,
18235
+ card_expiration_month: cardExpirationMonth,
18236
+ card_expiration_year: cardExpirationYear,
18229
18237
  ...params
18230
18238
  }, (err, res) => {
18231
18239
  callback(err, res);
@@ -18242,7 +18250,9 @@ class CybersourceGateway {
18242
18250
  couponCode,
18243
18251
  product,
18244
18252
  addressId,
18245
- isExistingSource
18253
+ isExistingSource,
18254
+ cardExpirationMonth,
18255
+ cardExpirationYear
18246
18256
  } = options;
18247
18257
  const params = isExistingSource ? {
18248
18258
  source_id: token
@@ -18257,6 +18267,8 @@ class CybersourceGateway {
18257
18267
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
18258
18268
  subscription_id: subscriptionIdToRenew,
18259
18269
  address_id: product.address_required ? addressId : null,
18270
+ card_expiration_month: cardExpirationMonth,
18271
+ card_expiration_year: cardExpirationYear,
18260
18272
  ...params
18261
18273
  }, (err, res) => {
18262
18274
  callback(err, res);
@@ -18274,7 +18286,9 @@ class CybersourceGateway {
18274
18286
  giftRecipient,
18275
18287
  quantity = 1,
18276
18288
  addressId,
18277
- isExistingSource
18289
+ isExistingSource,
18290
+ cardExpirationMonth,
18291
+ cardExpirationYear
18278
18292
  } = options;
18279
18293
  const params = isExistingSource ? {
18280
18294
  source_id: token
@@ -18294,6 +18308,8 @@ class CybersourceGateway {
18294
18308
  gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
18295
18309
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
18296
18310
  address_id: product.address_required ? addressId : null,
18311
+ card_expiration_month: cardExpirationMonth,
18312
+ card_expiration_year: cardExpirationYear,
18297
18313
  ...params
18298
18314
  }, (err, res) => {
18299
18315
  callback(err, res);
@@ -18310,7 +18326,9 @@ class CybersourceGateway {
18310
18326
  plan,
18311
18327
  couponCode,
18312
18328
  addressId,
18313
- isExistingSource
18329
+ isExistingSource,
18330
+ cardExpirationMonth,
18331
+ cardExpirationYear
18314
18332
  } = options;
18315
18333
  const params = isExistingSource ? {
18316
18334
  source_id: token
@@ -18324,6 +18342,8 @@ class CybersourceGateway {
18324
18342
  coupon_code: couponCode,
18325
18343
  subscription_id: subscriptionIdToRenew,
18326
18344
  address_id: product.address_required ? addressId : null,
18345
+ card_expiration_month: cardExpirationMonth,
18346
+ card_expiration_year: cardExpirationYear,
18327
18347
  ...params
18328
18348
  }, (err, res) => {
18329
18349
  callback(err, res);
@@ -18338,7 +18358,9 @@ class CybersourceGateway {
18338
18358
  items,
18339
18359
  couponCode,
18340
18360
  addressId,
18341
- isExistingSource
18361
+ isExistingSource,
18362
+ cardExpirationMonth,
18363
+ cardExpirationYear
18342
18364
  } = options;
18343
18365
  const params = isExistingSource ? {
18344
18366
  source_id: token
@@ -18353,7 +18375,9 @@ class CybersourceGateway {
18353
18375
  ...params,
18354
18376
  ...(addressId && {
18355
18377
  address_id: addressId
18356
- })
18378
+ }),
18379
+ card_expiration_month: cardExpirationMonth,
18380
+ card_expiration_year: cardExpirationYear
18357
18381
  }, (err, res) => {
18358
18382
  callback(err, res);
18359
18383
  });
@@ -18794,7 +18818,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18794
18818
  }
18795
18819
  });
18796
18820
  }
18797
- handleCybersourcePayment(response.token, state);
18821
+ handleCybersourcePayment(response, state);
18798
18822
  });
18799
18823
  };
18800
18824
  function handleCybersourcePayment(paymentRequest, state) {
@@ -18812,7 +18836,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18812
18836
  window.Pelcro.source.create({
18813
18837
  auth_token: window.Pelcro.user.read().auth_token,
18814
18838
  token: paymentRequest,
18815
- gateway: "cybersource"
18839
+ gateway: "cybersource",
18840
+ cardExpirationMonth: state.month,
18841
+ cardExpirationYear: state.year
18816
18842
  }, (err, res) => {
18817
18843
  dispatch({
18818
18844
  type: DISABLE_SUBMIT,
@@ -18840,6 +18866,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18840
18866
  content: t("messages.sourceUpdated")
18841
18867
  }
18842
18868
  });
18869
+
18870
+ // Reinitialize Cybersource microform after successful payment
18871
+ setTimeout(() => {
18872
+ cybersourceInstanceRef.current = null;
18873
+ initCybersourceScript();
18874
+ }, 1000);
18843
18875
  onSuccess(res);
18844
18876
  } //
18845
18877
  );
@@ -18863,11 +18895,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18863
18895
  product,
18864
18896
  isExistingSource: isUsingExistingPaymentMethod,
18865
18897
  subscriptionIdToRenew,
18866
- addressId: selectedAddressId
18898
+ addressId: selectedAddressId,
18899
+ cardExpirationMonth: state.month,
18900
+ cardExpirationYear: state.year
18867
18901
  }, (err, res) => {
18868
18902
  if (err) {
18869
18903
  return handlePaymentError(err);
18870
18904
  }
18905
+
18906
+ // Reinitialize Cybersource microform after successful payment
18907
+ setTimeout(() => {
18908
+ cybersourceInstanceRef.current = null;
18909
+ initCybersourceScript();
18910
+ }, 1000);
18871
18911
  onSuccess(res);
18872
18912
  });
18873
18913
  } else if (giftSubscriprition) {
@@ -18880,11 +18920,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18880
18920
  product,
18881
18921
  isExistingSource: isUsingExistingPaymentMethod,
18882
18922
  giftRecipient,
18883
- addressId: selectedAddressId
18923
+ addressId: selectedAddressId,
18924
+ cardExpirationMonth: state.month,
18925
+ cardExpirationYear: state.year
18884
18926
  }, (err, res) => {
18885
18927
  if (err) {
18886
18928
  return handlePaymentError(err);
18887
18929
  }
18930
+
18931
+ // Reinitialize Cybersource microform after successful payment
18932
+ setTimeout(() => {
18933
+ cybersourceInstanceRef.current = null;
18934
+ initCybersourceScript();
18935
+ }, 1000);
18888
18936
  onSuccess(res);
18889
18937
  });
18890
18938
  } else if (renewSubscription) {
@@ -18897,11 +18945,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18897
18945
  product,
18898
18946
  isExistingSource: isUsingExistingPaymentMethod,
18899
18947
  subscriptionIdToRenew,
18900
- addressId: selectedAddressId
18948
+ addressId: selectedAddressId,
18949
+ cardExpirationMonth: state.month,
18950
+ cardExpirationYear: state.year
18901
18951
  }, (err, res) => {
18902
18952
  if (err) {
18903
18953
  return handlePaymentError(err);
18904
18954
  }
18955
+
18956
+ // Reinitialize Cybersource microform after successful payment
18957
+ setTimeout(() => {
18958
+ cybersourceInstanceRef.current = null;
18959
+ initCybersourceScript();
18960
+ }, 1000);
18905
18961
  onSuccess(res);
18906
18962
  });
18907
18963
  } else if (createSubscription) {
@@ -18914,22 +18970,27 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18914
18970
  product,
18915
18971
  isExistingSource: isUsingExistingPaymentMethod,
18916
18972
  addressId: selectedAddressId,
18917
- fingerprint_session_id: state.cyberSourceSessionId
18973
+ fingerprint_session_id: state.cyberSourceSessionId,
18974
+ cardExpirationMonth: state.month,
18975
+ cardExpirationYear: state.year
18918
18976
  }, (err, res) => {
18919
18977
  if (err) {
18920
18978
  return handlePaymentError(err);
18921
18979
  }
18980
+
18981
+ // Reinitialize Cybersource microform after successful payment
18982
+ setTimeout(() => {
18983
+ cybersourceInstanceRef.current = null;
18984
+ initCybersourceScript();
18985
+ }, 1000);
18922
18986
  onSuccess(res);
18923
18987
  });
18924
18988
  }
18925
18989
  }
18926
18990
  }
18927
- const tokenizeCard = (error, microformInstance) => {
18928
- if (error) {
18929
- return;
18930
- }
18931
- cybersourceInstanceRef.current = microformInstance;
18932
- };
18991
+
18992
+ // No longer needed - microform instance is stored directly in initCybersourceScript
18993
+
18933
18994
  const appendCybersourceFingerprintScripts = () => {
18934
18995
  var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4;
18935
18996
  const uniqueId = crypto.randomUUID();
@@ -18953,6 +19014,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18953
19014
  }
18954
19015
  };
18955
19016
  const initCybersourceScript = () => {
19017
+ // Clear existing card number field before reinitializing
19018
+ const cardNumberElement = document.querySelector("#cybersourceCardNumber");
19019
+ if (cardNumberElement) {
19020
+ cardNumberElement.innerHTML = "";
19021
+ }
19022
+
18956
19023
  // jwk api call
18957
19024
  window.Pelcro.payment.getJWK({
18958
19025
  auth_token: window.Pelcro.user.read().auth_token,
@@ -18977,35 +19044,56 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18977
19044
  });
18978
19045
  }
18979
19046
  const {
18980
- key: jwk
19047
+ key: jwk,
19048
+ captureContext,
19049
+ js_client
18981
19050
  } = res;
18982
- // SETUP MICROFORM
18983
- // eslint-disable-next-line no-undef
18984
- FLEX.microform({
18985
- keyId: jwk.kid,
18986
- keystore: jwk,
18987
- container: "#cybersourceCardNumber",
18988
- placeholder: "Card Number",
18989
- styles: {
18990
- input: {
18991
- "font-size": "14px",
18992
- "font-family": "helvetica, tahoma, calibri, sans-serif",
18993
- color: "#555"
18994
- },
18995
- ":focus": {
18996
- color: "blue"
18997
- },
18998
- ":disabled": {
18999
- cursor: "not-allowed"
19000
- },
19001
- valid: {
19002
- color: "#3c763d"
19003
- },
19004
- invalid: {
19005
- color: "#a94442"
19051
+
19052
+ // Load the SDK from the dynamic URL (if not already loaded)
19053
+ const existingScript = document.querySelector(`script[src="${js_client}"]`);
19054
+ if (!existingScript) {
19055
+ window.Pelcro.helpers.loadSDK(js_client, "cybersource-cdn");
19056
+ }
19057
+ const initializeMicroform = () => {
19058
+ // SETUP MICROFORM
19059
+ // eslint-disable-next-line no-undef
19060
+ const flex = new Flex(captureContext);
19061
+ const microform = flex.microform({
19062
+ styles: {
19063
+ input: {
19064
+ "font-size": "14px",
19065
+ "font-family": "helvetica, tahoma, calibri, sans-serif",
19066
+ color: "#555"
19067
+ },
19068
+ ":focus": {
19069
+ color: "blue"
19070
+ },
19071
+ ":disabled": {
19072
+ cursor: "not-allowed"
19073
+ },
19074
+ valid: {
19075
+ color: "#3c763d"
19076
+ },
19077
+ invalid: {
19078
+ color: "#a94442"
19079
+ }
19006
19080
  }
19007
- }
19008
- }, tokenizeCard);
19081
+ });
19082
+ const number = microform.createField("number", {
19083
+ placeholder: "Enter your card number"
19084
+ });
19085
+ number.load("#cybersourceCardNumber");
19086
+ cybersourceInstanceRef.current = microform;
19087
+ };
19088
+
19089
+ // Wait for SDK to load then initialize microform
19090
+ if (existingScript) {
19091
+ // Script already loaded, initialize immediately
19092
+ initializeMicroform();
19093
+ } else {
19094
+ // Wait for new script to load
19095
+ document.querySelector(`script[src="${js_client}"]`).addEventListener("load", initializeMicroform);
19096
+ }
19009
19097
  });
19010
19098
  };
19011
19099
 
@@ -20201,13 +20289,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20201
20289
  if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
20202
20290
  initTapScript();
20203
20291
  }
20204
- if (cardProcessor === "cybersource" && !selectedPaymentMethodId && !window.FLEX) {
20205
- window.Pelcro.helpers.loadSDK("https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js", "cybersource-cdn");
20206
- document.querySelector('script[src="https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js"]').addEventListener("load", () => {
20207
- initCybersourceScript();
20208
- });
20209
- }
20210
- if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
20292
+ if (cardProcessor === "cybersource" && !selectedPaymentMethodId) {
20211
20293
  initCybersourceScript();
20212
20294
  }
20213
20295
  if (cardProcessor === "cybersource") {
@@ -20806,7 +20888,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20806
20888
  gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
20807
20889
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
20808
20890
  address_id: product.address_required ? selectedAddressId : null,
20809
- metadata: props === null || props === void 0 ? void 0 : props.subCreateMetadata
20891
+ metadata: props === null || props === void 0 ? void 0 : props.subCreateMetadata,
20892
+ cardExpirationMonth: state === null || state === void 0 ? void 0 : state.month,
20893
+ cardExpirationYear: state === null || state === void 0 ? void 0 : state.year
20810
20894
  }, (err, res) => {
20811
20895
  var _res$data;
20812
20896
  if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
@@ -20981,7 +21065,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20981
21065
  isExistingSource: Boolean(selectedPaymentMethodId),
20982
21066
  items: mappedOrderItems,
20983
21067
  addressId: selectedAddressId,
20984
- couponCode
21068
+ couponCode,
21069
+ cardExpirationMonth: state === null || state === void 0 ? void 0 : state.month,
21070
+ cardExpirationYear: state === null || state === void 0 ? void 0 : state.year
20985
21071
  }, (err, orderResponse) => {
20986
21072
  var _window$Pelcro14, _window$Pelcro14$user, _window$Pelcro14$user2;
20987
21073
  if (err) {
@@ -21329,7 +21415,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
21329
21415
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
21330
21416
  ...(selectedAddressId && {
21331
21417
  address_id: selectedAddressId
21332
- })
21418
+ }),
21419
+ card_expiration_month: state === null || state === void 0 ? void 0 : state.month,
21420
+ card_expiration_year: state === null || state === void 0 ? void 0 : state.year
21333
21421
  }, (err, res) => {
21334
21422
  if (err) {
21335
21423
  return handlePaymentError(err);
@@ -29244,6 +29332,12 @@ const OrderConfirmModal = props => {
29244
29332
  props === null || props === void 0 ? void 0 : (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
29245
29333
  resetView();
29246
29334
  };
29335
+
29336
+ // Check if any items in the order are shippable
29337
+ const hasShippableItems = latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.items.some(item => {
29338
+ const product = window.Pelcro.ecommerce.products.getBySkuId(item.product_sku_id);
29339
+ return product === null || product === void 0 ? void 0 : product.shippable;
29340
+ });
29247
29341
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
29248
29342
  id: "pelcro-order-confirm-modal",
29249
29343
  className: "plc-border-t-8 plc-border-primary-500",
@@ -29259,7 +29353,7 @@ const OrderConfirmModal = props => {
29259
29353
  className: "plc-text-center plc-text-gray-900"
29260
29354
  }, /*#__PURE__*/React__default['default'].createElement("h4", {
29261
29355
  className: "plc-mb-4 plc-text-3xl"
29262
- }, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default['default'].createElement("p", null, t("messages.orderConfirmed.body")), /*#__PURE__*/React__default['default'].createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default['default'].createElement("div", {
29356
+ }, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default['default'].createElement("p", null, hasShippableItems ? t("messages.orderConfirmed.body") : t("messages.orderConfirmed.bodyDigital")), /*#__PURE__*/React__default['default'].createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default['default'].createElement("div", {
29263
29357
  className: "plc-mt-5 pelcro-order-summary-wrapper"
29264
29358
  }, /*#__PURE__*/React__default['default'].createElement("p", {
29265
29359
  className: "plc-font-bold pelcro-order-summary-title"
package/dist/index.esm.js CHANGED
@@ -3805,7 +3805,8 @@ var buttons$l = {
3805
3805
  var messages$10 = {
3806
3806
  orderConfirmed: {
3807
3807
  title: "Order confirmed!",
3808
- body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order."
3808
+ body: "Your order has been confirmed and will be shipped within the next few days. You'll shortly receive an email confirmation of this order.",
3809
+ bodyDigital: "Your order has been confirmed. You'll shortly receive an email confirmation of this order."
3809
3810
  },
3810
3811
  haveQuestions: "If you have any queries please don't hesitate to contact us!",
3811
3812
  multipleCurrencies: "Your cart currently contains items which are available in different currencies. In order to proceed with the checkout, please make sure that all items have the same currency.",
@@ -4767,9 +4768,10 @@ var buttons$f = {
4767
4768
  var messages$J = {
4768
4769
  orderConfirmed: {
4769
4770
  title: "Votre commande est confirmée !",
4770
- body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu."
4771
+ body: "Votre commande a été confirmée et vous sera expédiée dans les prochains jours. Vous recevrez un courriel de confirmation sous peu.",
4772
+ bodyDigital: "Votre commande a été confirmée. Vous recevrez un courriel de confirmation sous peu."
4771
4773
  },
4772
- haveQuestions: "Nhésitez pas à nous contacter pour toute question !",
4774
+ haveQuestions: "N'hésitez pas à nous contacter pour toute question !",
4773
4775
  multipleCurrencies: "Votre panier contient des articles disponibles dans différentes devises. Avant de passer à la caisse, veuillez vous assurer que tous les articles ont la même devise.",
4774
4776
  currencyMismatch: "Les articles sélectionnés ne sont pas compatibles avec la devise associée à votre compte ({{currency}}). Veuillez choisir des articles uniquement offerts dans cette devise."
4775
4777
  };
@@ -5717,7 +5719,8 @@ var buttons$9 = {
5717
5719
  var messages$q = {
5718
5720
  orderConfirmed: {
5719
5721
  title: "주문이 확인되었습니다!",
5720
- body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
5722
+ body: "귀하의 주문이 확인되었으며 며칠 안에 배송될 예정입니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다.",
5723
+ bodyDigital: "귀하의 주문이 확인되었습니다. 이 주문의 확인 이메일이 귀하에게 전송됩니다."
5721
5724
  },
5722
5725
  haveQuestions: "질문이 있으면 언제든 저희에게 연락주시기 바랍니다!",
5723
5726
  multipleCurrencies: "장바구니에 다른 통화로만 결제가 가능한 아이템이 있습니다. 결제를 계속 진행하려면 모든 아이템의 결제 통화가 동일한지 확인하십시오.",
@@ -6770,7 +6773,8 @@ var buttons$3 = {
6770
6773
  var messages$7 = {
6771
6774
  orderConfirmed: {
6772
6775
  title: "¡Orden confirmada!",
6773
- body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden."
6776
+ body: "Tu orden ha sido confirmada y será enviada en los próximos días. En breve recibirás un correo electrónico de confirmación de esta orden.",
6777
+ bodyDigital: "Tu orden ha sido confirmada. En breve recibirás un correo electrónico de confirmación de esta orden."
6774
6778
  },
6775
6779
  haveQuestions: "¡Si tienes alguna pregunta, no dudes en contactarnos!",
6776
6780
  multipleCurrencies: "Tu carrito actualmente contiene artículos que están disponibles en diferentes divisas. Para proceder a la compra, asegúrate de que todos los artículos tengan la misma divisa.",
@@ -18180,7 +18184,9 @@ class CybersourceGateway {
18180
18184
  quantity = 1,
18181
18185
  addressId,
18182
18186
  isExistingSource,
18183
- fingerprint_session_id
18187
+ fingerprint_session_id,
18188
+ cardExpirationMonth,
18189
+ cardExpirationYear
18184
18190
  } = options;
18185
18191
  const params = isExistingSource ? {
18186
18192
  source_id: token
@@ -18196,6 +18202,8 @@ class CybersourceGateway {
18196
18202
  coupon_code: couponCode,
18197
18203
  address_id: product.address_required ? addressId : null,
18198
18204
  fingerprint_session_id: fingerprint_session_id,
18205
+ card_expiration_month: cardExpirationMonth,
18206
+ card_expiration_year: cardExpirationYear,
18199
18207
  ...params
18200
18208
  }, (err, res) => {
18201
18209
  callback(err, res);
@@ -18212,7 +18220,9 @@ class CybersourceGateway {
18212
18220
  couponCode,
18213
18221
  product,
18214
18222
  addressId,
18215
- isExistingSource
18223
+ isExistingSource,
18224
+ cardExpirationMonth,
18225
+ cardExpirationYear
18216
18226
  } = options;
18217
18227
  const params = isExistingSource ? {
18218
18228
  source_id: token
@@ -18227,6 +18237,8 @@ class CybersourceGateway {
18227
18237
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
18228
18238
  subscription_id: subscriptionIdToRenew,
18229
18239
  address_id: product.address_required ? addressId : null,
18240
+ card_expiration_month: cardExpirationMonth,
18241
+ card_expiration_year: cardExpirationYear,
18230
18242
  ...params
18231
18243
  }, (err, res) => {
18232
18244
  callback(err, res);
@@ -18244,7 +18256,9 @@ class CybersourceGateway {
18244
18256
  giftRecipient,
18245
18257
  quantity = 1,
18246
18258
  addressId,
18247
- isExistingSource
18259
+ isExistingSource,
18260
+ cardExpirationMonth,
18261
+ cardExpirationYear
18248
18262
  } = options;
18249
18263
  const params = isExistingSource ? {
18250
18264
  source_id: token
@@ -18264,6 +18278,8 @@ class CybersourceGateway {
18264
18278
  gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
18265
18279
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
18266
18280
  address_id: product.address_required ? addressId : null,
18281
+ card_expiration_month: cardExpirationMonth,
18282
+ card_expiration_year: cardExpirationYear,
18267
18283
  ...params
18268
18284
  }, (err, res) => {
18269
18285
  callback(err, res);
@@ -18280,7 +18296,9 @@ class CybersourceGateway {
18280
18296
  plan,
18281
18297
  couponCode,
18282
18298
  addressId,
18283
- isExistingSource
18299
+ isExistingSource,
18300
+ cardExpirationMonth,
18301
+ cardExpirationYear
18284
18302
  } = options;
18285
18303
  const params = isExistingSource ? {
18286
18304
  source_id: token
@@ -18294,6 +18312,8 @@ class CybersourceGateway {
18294
18312
  coupon_code: couponCode,
18295
18313
  subscription_id: subscriptionIdToRenew,
18296
18314
  address_id: product.address_required ? addressId : null,
18315
+ card_expiration_month: cardExpirationMonth,
18316
+ card_expiration_year: cardExpirationYear,
18297
18317
  ...params
18298
18318
  }, (err, res) => {
18299
18319
  callback(err, res);
@@ -18308,7 +18328,9 @@ class CybersourceGateway {
18308
18328
  items,
18309
18329
  couponCode,
18310
18330
  addressId,
18311
- isExistingSource
18331
+ isExistingSource,
18332
+ cardExpirationMonth,
18333
+ cardExpirationYear
18312
18334
  } = options;
18313
18335
  const params = isExistingSource ? {
18314
18336
  source_id: token
@@ -18323,7 +18345,9 @@ class CybersourceGateway {
18323
18345
  ...params,
18324
18346
  ...(addressId && {
18325
18347
  address_id: addressId
18326
- })
18348
+ }),
18349
+ card_expiration_month: cardExpirationMonth,
18350
+ card_expiration_year: cardExpirationYear
18327
18351
  }, (err, res) => {
18328
18352
  callback(err, res);
18329
18353
  });
@@ -18764,7 +18788,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18764
18788
  }
18765
18789
  });
18766
18790
  }
18767
- handleCybersourcePayment(response.token, state);
18791
+ handleCybersourcePayment(response, state);
18768
18792
  });
18769
18793
  };
18770
18794
  function handleCybersourcePayment(paymentRequest, state) {
@@ -18782,7 +18806,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18782
18806
  window.Pelcro.source.create({
18783
18807
  auth_token: window.Pelcro.user.read().auth_token,
18784
18808
  token: paymentRequest,
18785
- gateway: "cybersource"
18809
+ gateway: "cybersource",
18810
+ cardExpirationMonth: state.month,
18811
+ cardExpirationYear: state.year
18786
18812
  }, (err, res) => {
18787
18813
  dispatch({
18788
18814
  type: DISABLE_SUBMIT,
@@ -18810,6 +18836,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18810
18836
  content: t("messages.sourceUpdated")
18811
18837
  }
18812
18838
  });
18839
+
18840
+ // Reinitialize Cybersource microform after successful payment
18841
+ setTimeout(() => {
18842
+ cybersourceInstanceRef.current = null;
18843
+ initCybersourceScript();
18844
+ }, 1000);
18813
18845
  onSuccess(res);
18814
18846
  } //
18815
18847
  );
@@ -18833,11 +18865,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18833
18865
  product,
18834
18866
  isExistingSource: isUsingExistingPaymentMethod,
18835
18867
  subscriptionIdToRenew,
18836
- addressId: selectedAddressId
18868
+ addressId: selectedAddressId,
18869
+ cardExpirationMonth: state.month,
18870
+ cardExpirationYear: state.year
18837
18871
  }, (err, res) => {
18838
18872
  if (err) {
18839
18873
  return handlePaymentError(err);
18840
18874
  }
18875
+
18876
+ // Reinitialize Cybersource microform after successful payment
18877
+ setTimeout(() => {
18878
+ cybersourceInstanceRef.current = null;
18879
+ initCybersourceScript();
18880
+ }, 1000);
18841
18881
  onSuccess(res);
18842
18882
  });
18843
18883
  } else if (giftSubscriprition) {
@@ -18850,11 +18890,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18850
18890
  product,
18851
18891
  isExistingSource: isUsingExistingPaymentMethod,
18852
18892
  giftRecipient,
18853
- addressId: selectedAddressId
18893
+ addressId: selectedAddressId,
18894
+ cardExpirationMonth: state.month,
18895
+ cardExpirationYear: state.year
18854
18896
  }, (err, res) => {
18855
18897
  if (err) {
18856
18898
  return handlePaymentError(err);
18857
18899
  }
18900
+
18901
+ // Reinitialize Cybersource microform after successful payment
18902
+ setTimeout(() => {
18903
+ cybersourceInstanceRef.current = null;
18904
+ initCybersourceScript();
18905
+ }, 1000);
18858
18906
  onSuccess(res);
18859
18907
  });
18860
18908
  } else if (renewSubscription) {
@@ -18867,11 +18915,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18867
18915
  product,
18868
18916
  isExistingSource: isUsingExistingPaymentMethod,
18869
18917
  subscriptionIdToRenew,
18870
- addressId: selectedAddressId
18918
+ addressId: selectedAddressId,
18919
+ cardExpirationMonth: state.month,
18920
+ cardExpirationYear: state.year
18871
18921
  }, (err, res) => {
18872
18922
  if (err) {
18873
18923
  return handlePaymentError(err);
18874
18924
  }
18925
+
18926
+ // Reinitialize Cybersource microform after successful payment
18927
+ setTimeout(() => {
18928
+ cybersourceInstanceRef.current = null;
18929
+ initCybersourceScript();
18930
+ }, 1000);
18875
18931
  onSuccess(res);
18876
18932
  });
18877
18933
  } else if (createSubscription) {
@@ -18884,22 +18940,27 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18884
18940
  product,
18885
18941
  isExistingSource: isUsingExistingPaymentMethod,
18886
18942
  addressId: selectedAddressId,
18887
- fingerprint_session_id: state.cyberSourceSessionId
18943
+ fingerprint_session_id: state.cyberSourceSessionId,
18944
+ cardExpirationMonth: state.month,
18945
+ cardExpirationYear: state.year
18888
18946
  }, (err, res) => {
18889
18947
  if (err) {
18890
18948
  return handlePaymentError(err);
18891
18949
  }
18950
+
18951
+ // Reinitialize Cybersource microform after successful payment
18952
+ setTimeout(() => {
18953
+ cybersourceInstanceRef.current = null;
18954
+ initCybersourceScript();
18955
+ }, 1000);
18892
18956
  onSuccess(res);
18893
18957
  });
18894
18958
  }
18895
18959
  }
18896
18960
  }
18897
- const tokenizeCard = (error, microformInstance) => {
18898
- if (error) {
18899
- return;
18900
- }
18901
- cybersourceInstanceRef.current = microformInstance;
18902
- };
18961
+
18962
+ // No longer needed - microform instance is stored directly in initCybersourceScript
18963
+
18903
18964
  const appendCybersourceFingerprintScripts = () => {
18904
18965
  var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4;
18905
18966
  const uniqueId = crypto.randomUUID();
@@ -18923,6 +18984,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18923
18984
  }
18924
18985
  };
18925
18986
  const initCybersourceScript = () => {
18987
+ // Clear existing card number field before reinitializing
18988
+ const cardNumberElement = document.querySelector("#cybersourceCardNumber");
18989
+ if (cardNumberElement) {
18990
+ cardNumberElement.innerHTML = "";
18991
+ }
18992
+
18926
18993
  // jwk api call
18927
18994
  window.Pelcro.payment.getJWK({
18928
18995
  auth_token: window.Pelcro.user.read().auth_token,
@@ -18947,35 +19014,56 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18947
19014
  });
18948
19015
  }
18949
19016
  const {
18950
- key: jwk
19017
+ key: jwk,
19018
+ captureContext,
19019
+ js_client
18951
19020
  } = res;
18952
- // SETUP MICROFORM
18953
- // eslint-disable-next-line no-undef
18954
- FLEX.microform({
18955
- keyId: jwk.kid,
18956
- keystore: jwk,
18957
- container: "#cybersourceCardNumber",
18958
- placeholder: "Card Number",
18959
- styles: {
18960
- input: {
18961
- "font-size": "14px",
18962
- "font-family": "helvetica, tahoma, calibri, sans-serif",
18963
- color: "#555"
18964
- },
18965
- ":focus": {
18966
- color: "blue"
18967
- },
18968
- ":disabled": {
18969
- cursor: "not-allowed"
18970
- },
18971
- valid: {
18972
- color: "#3c763d"
18973
- },
18974
- invalid: {
18975
- color: "#a94442"
19021
+
19022
+ // Load the SDK from the dynamic URL (if not already loaded)
19023
+ const existingScript = document.querySelector(`script[src="${js_client}"]`);
19024
+ if (!existingScript) {
19025
+ window.Pelcro.helpers.loadSDK(js_client, "cybersource-cdn");
19026
+ }
19027
+ const initializeMicroform = () => {
19028
+ // SETUP MICROFORM
19029
+ // eslint-disable-next-line no-undef
19030
+ const flex = new Flex(captureContext);
19031
+ const microform = flex.microform({
19032
+ styles: {
19033
+ input: {
19034
+ "font-size": "14px",
19035
+ "font-family": "helvetica, tahoma, calibri, sans-serif",
19036
+ color: "#555"
19037
+ },
19038
+ ":focus": {
19039
+ color: "blue"
19040
+ },
19041
+ ":disabled": {
19042
+ cursor: "not-allowed"
19043
+ },
19044
+ valid: {
19045
+ color: "#3c763d"
19046
+ },
19047
+ invalid: {
19048
+ color: "#a94442"
19049
+ }
18976
19050
  }
18977
- }
18978
- }, tokenizeCard);
19051
+ });
19052
+ const number = microform.createField("number", {
19053
+ placeholder: "Enter your card number"
19054
+ });
19055
+ number.load("#cybersourceCardNumber");
19056
+ cybersourceInstanceRef.current = microform;
19057
+ };
19058
+
19059
+ // Wait for SDK to load then initialize microform
19060
+ if (existingScript) {
19061
+ // Script already loaded, initialize immediately
19062
+ initializeMicroform();
19063
+ } else {
19064
+ // Wait for new script to load
19065
+ document.querySelector(`script[src="${js_client}"]`).addEventListener("load", initializeMicroform);
19066
+ }
18979
19067
  });
18980
19068
  };
18981
19069
 
@@ -20171,13 +20259,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20171
20259
  if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
20172
20260
  initTapScript();
20173
20261
  }
20174
- if (cardProcessor === "cybersource" && !selectedPaymentMethodId && !window.FLEX) {
20175
- window.Pelcro.helpers.loadSDK("https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js", "cybersource-cdn");
20176
- document.querySelector('script[src="https://flex.cybersource.com/cybersource/assets/microform/0.4/flex-microform.min.js"]').addEventListener("load", () => {
20177
- initCybersourceScript();
20178
- });
20179
- }
20180
- if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
20262
+ if (cardProcessor === "cybersource" && !selectedPaymentMethodId) {
20181
20263
  initCybersourceScript();
20182
20264
  }
20183
20265
  if (cardProcessor === "cybersource") {
@@ -20776,7 +20858,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20776
20858
  gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
20777
20859
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
20778
20860
  address_id: product.address_required ? selectedAddressId : null,
20779
- metadata: props === null || props === void 0 ? void 0 : props.subCreateMetadata
20861
+ metadata: props === null || props === void 0 ? void 0 : props.subCreateMetadata,
20862
+ cardExpirationMonth: state === null || state === void 0 ? void 0 : state.month,
20863
+ cardExpirationYear: state === null || state === void 0 ? void 0 : state.year
20780
20864
  }, (err, res) => {
20781
20865
  var _res$data;
20782
20866
  if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
@@ -20951,7 +21035,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20951
21035
  isExistingSource: Boolean(selectedPaymentMethodId),
20952
21036
  items: mappedOrderItems,
20953
21037
  addressId: selectedAddressId,
20954
- couponCode
21038
+ couponCode,
21039
+ cardExpirationMonth: state === null || state === void 0 ? void 0 : state.month,
21040
+ cardExpirationYear: state === null || state === void 0 ? void 0 : state.year
20955
21041
  }, (err, orderResponse) => {
20956
21042
  var _window$Pelcro14, _window$Pelcro14$user, _window$Pelcro14$user2;
20957
21043
  if (err) {
@@ -21299,7 +21385,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
21299
21385
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
21300
21386
  ...(selectedAddressId && {
21301
21387
  address_id: selectedAddressId
21302
- })
21388
+ }),
21389
+ card_expiration_month: state === null || state === void 0 ? void 0 : state.month,
21390
+ card_expiration_year: state === null || state === void 0 ? void 0 : state.year
21303
21391
  }, (err, res) => {
21304
21392
  if (err) {
21305
21393
  return handlePaymentError(err);
@@ -29214,6 +29302,12 @@ const OrderConfirmModal = props => {
29214
29302
  props === null || props === void 0 ? void 0 : (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
29215
29303
  resetView();
29216
29304
  };
29305
+
29306
+ // Check if any items in the order are shippable
29307
+ const hasShippableItems = latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.items.some(item => {
29308
+ const product = window.Pelcro.ecommerce.products.getBySkuId(item.product_sku_id);
29309
+ return product === null || product === void 0 ? void 0 : product.shippable;
29310
+ });
29217
29311
  return /*#__PURE__*/React__default.createElement(Modal, {
29218
29312
  id: "pelcro-order-confirm-modal",
29219
29313
  className: "plc-border-t-8 plc-border-primary-500",
@@ -29229,7 +29323,7 @@ const OrderConfirmModal = props => {
29229
29323
  className: "plc-text-center plc-text-gray-900"
29230
29324
  }, /*#__PURE__*/React__default.createElement("h4", {
29231
29325
  className: "plc-mb-4 plc-text-3xl"
29232
- }, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default.createElement("p", null, t("messages.orderConfirmed.body")), /*#__PURE__*/React__default.createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default.createElement("div", {
29326
+ }, t("messages.orderConfirmed.title")), /*#__PURE__*/React__default.createElement("p", null, hasShippableItems ? t("messages.orderConfirmed.body") : t("messages.orderConfirmed.bodyDigital")), /*#__PURE__*/React__default.createElement("p", null, t("messages.haveQuestions")))), /*#__PURE__*/React__default.createElement("div", {
29233
29327
  className: "plc-mt-5 pelcro-order-summary-wrapper"
29234
29328
  }, /*#__PURE__*/React__default.createElement("p", {
29235
29329
  className: "plc-font-bold pelcro-order-summary-title"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.26.0-beta.76",
4
+ "version": "3.26.0-beta.78",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",