@licklist/design 0.78.7-stage.18 → 0.78.7-stage.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/hooks/useTableData.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,oBAAoB,EAAe,MAAM,UAAU,CAAA;AAK5D,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAA;AAED,eAAO,MAAM,YAAY,oEAKtB,oBAAoB;;;;;IA2KtB,CAAA"}
1
+ {"version":3,"file":"useTableData.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/payment/order-items-table/hooks/useTableData.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,oBAAoB,EAAe,MAAM,UAAU,CAAA;AAQ5D,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAA;AAED,eAAO,MAAM,YAAY,oEAKtB,oBAAoB;;;;;IA+KtB,CAAA"}
@@ -65,52 +65,55 @@ var useTableData = function(param) {
65
65
  });
66
66
  };
67
67
  var renderCategoryItem = function(products) {
68
- var _products__productCategory, _products_;
69
- var _products__productCategory_name, _order_orderProducts;
68
+ var _products__productCategory;
69
+ var _products__productCategory_name;
70
70
  return {
71
71
  key: uniqueId('category-id-'),
72
- name: wrapLabelContent((_products__productCategory_name = (_products_ = products[0]) === null || _products_ === void 0 ? void 0 : (_products__productCategory = _products_.productCategory) === null || _products__productCategory === void 0 ? void 0 : _products__productCategory.name) !== null && _products__productCategory_name !== void 0 ? _products__productCategory_name : ''),
72
+ name: wrapLabelContent((_products__productCategory_name = (_products__productCategory = products[0].productCategory) === null || _products__productCategory === void 0 ? void 0 : _products__productCategory.name) !== null && _products__productCategory_name !== void 0 ? _products__productCategory_name : ''),
73
73
  quantity: '',
74
- price: wrapLabelContent("".concat(t('total'), ": ").concat(formatPrice(getTotalSumByCategory((_order_orderProducts = order.orderProducts) !== null && _order_orderProducts !== void 0 ? _order_orderProducts : [], products))))
74
+ price: wrapLabelContent("".concat(t('total'), ": ").concat(formatPrice(getTotalSumByCategory(order.orderProducts, products))))
75
75
  };
76
76
  };
77
77
  var reworkProductStructure = function(order) {
78
- if (!order) return [];
79
- var _order_orderProductModifiersGroups;
80
- var groups = (_order_orderProductModifiersGroups = order === null || order === void 0 ? void 0 : order.orderProductModifiersGroups) !== null && _order_orderProductModifiersGroups !== void 0 ? _order_orderProductModifiersGroups : [];
81
- if (!Array.isArray(groups) || !groups.length) return [
82
- order
83
- ];
84
- return groups.flatMap(function(modGroup, idx) {
85
- var _order_deletedAt, _order_orderId, _order_price, _order_productId, _modGroup_productQuantity, _order_deposit, _modGroup_modifiers, _map;
86
- return {
87
- deletedAt: (_order_deletedAt = order.deletedAt) !== null && _order_deletedAt !== void 0 ? _order_deletedAt : null,
88
- id: "".concat(order.id, "-").concat(idx + 1),
89
- orderId: (_order_orderId = order.orderId) !== null && _order_orderId !== void 0 ? _order_orderId : null,
90
- price: (_order_price = order.price) !== null && _order_price !== void 0 ? _order_price : 0,
91
- productId: (_order_productId = order.productId) !== null && _order_productId !== void 0 ? _order_productId : '',
92
- quantity: (_modGroup_productQuantity = modGroup === null || modGroup === void 0 ? void 0 : modGroup.productQuantity) !== null && _modGroup_productQuantity !== void 0 ? _modGroup_productQuantity : 1,
93
- deposit: (_order_deposit = order.deposit) !== null && _order_deposit !== void 0 ? _order_deposit : 0,
94
- orderProductModifiers: (_map = ((_modGroup_modifiers = modGroup === null || modGroup === void 0 ? void 0 : modGroup.modifiers) !== null && _modGroup_modifiers !== void 0 ? _modGroup_modifiers : []).map(function(mod) {
95
- var _mod_modifierId, _mod_price, _mod_productId, _mod_quantity, _mod_modifierSetId, _mod_modifier;
96
- return {
97
- modifierId: (_mod_modifierId = mod === null || mod === void 0 ? void 0 : mod.modifierId) !== null && _mod_modifierId !== void 0 ? _mod_modifierId : '',
98
- price: (_mod_price = mod === null || mod === void 0 ? void 0 : mod.price) !== null && _mod_price !== void 0 ? _mod_price : 0,
99
- productId: (_mod_productId = mod === null || mod === void 0 ? void 0 : mod.productId) !== null && _mod_productId !== void 0 ? _mod_productId : '',
100
- quantity: (_mod_quantity = mod === null || mod === void 0 ? void 0 : mod.quantity) !== null && _mod_quantity !== void 0 ? _mod_quantity : 1,
101
- modifierSetId: (_mod_modifierSetId = mod === null || mod === void 0 ? void 0 : mod.modifierSetId) !== null && _mod_modifierSetId !== void 0 ? _mod_modifierSetId : '',
102
- modifier: (_mod_modifier = mod === null || mod === void 0 ? void 0 : mod.modifier) !== null && _mod_modifier !== void 0 ? _mod_modifier : null
103
- };
104
- })) !== null && _map !== void 0 ? _map : []
105
- };
106
- });
78
+ return order ? flatMap(order, function(item) {
79
+ if (!item || !Array.isArray(item)) return [];
80
+ return item.map(function(modGroup, idx) {
81
+ var _order_deletedAt, _order_orderId, _order_price, _order_productId, _modGroup_productQuantity, _order_deposit;
82
+ return {
83
+ deletedAt: (_order_deletedAt = order.deletedAt) !== null && _order_deletedAt !== void 0 ? _order_deletedAt : null,
84
+ id: "".concat(order.id, "-").concat(idx + 1),
85
+ orderId: (_order_orderId = order.orderId) !== null && _order_orderId !== void 0 ? _order_orderId : null,
86
+ price: (_order_price = order.price) !== null && _order_price !== void 0 ? _order_price : 0,
87
+ productId: (_order_productId = order.productId) !== null && _order_productId !== void 0 ? _order_productId : '',
88
+ quantity: (_modGroup_productQuantity = modGroup.productQuantity) !== null && _modGroup_productQuantity !== void 0 ? _modGroup_productQuantity : 1,
89
+ deposit: (_order_deposit = order.deposit) !== null && _order_deposit !== void 0 ? _order_deposit : 0,
90
+ orderProductModifiers: modGroup.modifiers.map(function(mod) {
91
+ var _mod_modifierId, _mod_price, _mod_productId, _mod_quantity, _mod_modifierSetId, _mod_modifier;
92
+ return {
93
+ modifierId: (_mod_modifierId = mod.modifierId) !== null && _mod_modifierId !== void 0 ? _mod_modifierId : '',
94
+ price: (_mod_price = mod.price) !== null && _mod_price !== void 0 ? _mod_price : 0,
95
+ productId: (_mod_productId = mod.productId) !== null && _mod_productId !== void 0 ? _mod_productId : '',
96
+ quantity: (_mod_quantity = mod.quantity) !== null && _mod_quantity !== void 0 ? _mod_quantity : 1,
97
+ modifierSetId: (_mod_modifierSetId = mod.modifierSetId) !== null && _mod_modifierSetId !== void 0 ? _mod_modifierSetId : '',
98
+ modifier: (_mod_modifier = mod.modifier) !== null && _mod_modifier !== void 0 ? _mod_modifier : null
99
+ };
100
+ })
101
+ };
102
+ });
103
+ }) : [];
107
104
  };
108
- var renderModifierItem = function(orderModifier) {
109
- if (!orderModifier || orderModifier.quantity === 0) return null;
110
- var quantity = orderModifier.quantity, modifier = orderModifier.modifier, modifierId = orderModifier.modifierId, price = orderModifier.price;
105
+ var renderProductItem = function(param) {
106
+ var product = param.product, productsForCategory = param.productsForCategory;
107
+ var _productsForCategory_find, _product_orderProductModifiers;
108
+ if (product.quantity === 0) {
109
+ return null;
110
+ }
111
+ var name = ((_productsForCategory_find = productsForCategory.find(function(item) {
112
+ return item.id === product.productId;
113
+ })) === null || _productsForCategory_find === void 0 ? void 0 : _productsForCategory_find.name) || '';
111
114
  return {
112
- key: modifierId,
113
- name: " - ".concat((modifier === null || modifier === void 0 ? void 0 : modifier.name) || ''),
115
+ key: product.id,
116
+ name: name,
114
117
  quantity: /*#__PURE__*/ jsxs("div", {
115
118
  className: "quantity",
116
119
  children: [
@@ -118,23 +121,21 @@ var useTableData = function(param) {
118
121
  className: "multiplier",
119
122
  children: "x"
120
123
  }),
121
- quantity
124
+ product.quantity
122
125
  ]
123
126
  }),
124
- price: formatPrice(price !== null && price !== void 0 ? price : 0)
127
+ price: formatPrice(product.price),
128
+ modifier: (product === null || product === void 0 ? void 0 : (_product_orderProductModifiers = product.orderProductModifiers) === null || _product_orderProductModifiers === void 0 ? void 0 : _product_orderProductModifiers.map(renderModifierItem)) || []
125
129
  };
126
130
  };
127
- var renderProductItem = function(param) {
128
- var product = param.product, productsForCategory = param.productsForCategory;
129
- var _productsForCategory_find, _product_orderProductModifiers;
130
- if (!product || product.quantity === 0) return null;
131
- var name = ((_productsForCategory_find = productsForCategory.find(function(item) {
132
- return item.id === product.productId;
133
- })) === null || _productsForCategory_find === void 0 ? void 0 : _productsForCategory_find.name) || '';
134
- var _product_price, _product_orderProductModifiers_map;
131
+ var renderModifierItem = function(orderModifier) {
132
+ var quantity = orderModifier.quantity, modifier = orderModifier.modifier, modifierId = orderModifier.modifierId, price = orderModifier.price;
133
+ if (quantity === 0) {
134
+ return null;
135
+ }
135
136
  return {
136
- key: product.id,
137
- name: name,
137
+ key: modifierId,
138
+ name: " - ".concat((modifier === null || modifier === void 0 ? void 0 : modifier.name) || ''),
138
139
  quantity: /*#__PURE__*/ jsxs("div", {
139
140
  className: "quantity",
140
141
  children: [
@@ -142,51 +143,47 @@ var useTableData = function(param) {
142
143
  className: "multiplier",
143
144
  children: "x"
144
145
  }),
145
- product.quantity
146
+ quantity
146
147
  ]
147
148
  }),
148
- price: formatPrice((_product_price = product.price) !== null && _product_price !== void 0 ? _product_price : 0),
149
- modifier: ((_product_orderProductModifiers_map = product === null || product === void 0 ? void 0 : (_product_orderProductModifiers = product.orderProductModifiers) === null || _product_orderProductModifiers === void 0 ? void 0 : _product_orderProductModifiers.map(renderModifierItem)) !== null && _product_orderProductModifiers_map !== void 0 ? _product_orderProductModifiers_map : []).filter(Boolean)
149
+ price: formatPrice(price)
150
150
  };
151
151
  };
152
152
  var renderProductsContent = function() {
153
153
  var productCategories = _to_consumable_array(new Set(order.products.map(function(product) {
154
154
  return product.productCategoryId;
155
155
  })));
156
- return productCategories.reduce(function(acc, categoryId) {
157
- var _order_orderProducts;
158
- var _order_products_filter;
159
- var productsForCategory = (_order_products_filter = order === null || order === void 0 ? void 0 : order.products.filter(function(p) {
160
- return p.productCategoryId === categoryId;
161
- })) !== null && _order_products_filter !== void 0 ? _order_products_filter : [];
162
- var _order_orderProducts_filter;
163
- var products = (_order_orderProducts_filter = order === null || order === void 0 ? void 0 : (_order_orderProducts = order.orderProducts) === null || _order_orderProducts === void 0 ? void 0 : _order_orderProducts.filter(function(el) {
164
- return productsForCategory.map(function(p) {
165
- return p.id;
156
+ return productCategories.reduce(function(previousValues, categoryId) {
157
+ var productsForCategory = order === null || order === void 0 ? void 0 : order.products.filter(function(product) {
158
+ return product.productCategoryId === categoryId;
159
+ });
160
+ var products = order.orderProducts.filter(function(el) {
161
+ return productsForCategory.map(function(product) {
162
+ return product.id;
166
163
  }).includes(el.productId);
167
- })) !== null && _order_orderProducts_filter !== void 0 ? _order_orderProducts_filter : [];
168
- if (!products.length) return acc;
164
+ });
165
+ if (!products.length) {
166
+ return previousValues;
167
+ }
169
168
  var productsWithReworkedModifier = products.map(function(product) {
170
- var _product_orderProductModifiers;
171
- if (!(product === null || product === void 0 ? void 0 : (_product_orderProductModifiers = product.orderProductModifiers) === null || _product_orderProductModifiers === void 0 ? void 0 : _product_orderProductModifiers.length)) return product;
169
+ if (!product.orderProductModifiers.length) return product;
172
170
  return reworkProductStructure(product);
173
171
  });
174
- var filteredProducts = flatten(productsWithReworkedModifier).map(function(p) {
172
+ var filteredProducts = flatten(productsWithReworkedModifier).map(function(product) {
175
173
  return renderProductItem({
176
- product: p,
174
+ product: product,
177
175
  productsForCategory: productsForCategory
178
176
  });
179
- }).filter(function(row) {
180
- return Boolean(row);
181
177
  });
182
- if (!filteredProducts.length) return acc;
183
- var productWithModifier = flatMap(filteredProducts, function(row) {
184
- var _row_modifier;
178
+ var productWithModifier = flatMap(filteredProducts, function(item) {
185
179
  return [
186
- row
187
- ].concat(_to_consumable_array((_row_modifier = row.modifier) !== null && _row_modifier !== void 0 ? _row_modifier : []));
180
+ item
181
+ ].concat(_to_consumable_array(item.modifier));
188
182
  });
189
- return _to_consumable_array(acc).concat([
183
+ if (!filteredProducts.length) {
184
+ return previousValues;
185
+ }
186
+ return _to_consumable_array(previousValues).concat([
190
187
  renderCategoryItem(productsForCategory)
191
188
  ], _to_consumable_array(productWithModifier));
192
189
  }, []);
@@ -203,18 +200,20 @@ var useTableData = function(param) {
203
200
  });
204
201
  };
205
202
  var data = useMemo(function() {
206
- if (!order) return [];
203
+ if (!order) {
204
+ return [];
205
+ }
207
206
  return _to_consumable_array(renderProductsContent()).concat(_to_consumable_array(renderSummaryItems(getOrderSummaryItems({
208
207
  order: order,
209
208
  paymentDetail: paymentDetail,
210
209
  isPaymentProcessed: isPaymentProcessed,
211
210
  externalDiscount: externalDiscount
212
211
  }))));
213
- }, [
212
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
213
+ [
214
214
  order,
215
215
  externalDiscount,
216
- isPaymentProcessed,
217
- paymentDetail
216
+ isPaymentProcessed
218
217
  ]);
219
218
  return data;
220
219
  };
@@ -191,6 +191,8 @@ var PaymentPage = function(_param) {
191
191
  var totalPaidWithRemainingToPay = (data === null || data === void 0 ? void 0 : data.amount_to_pay) && !!Number(data === null || data === void 0 ? void 0 : data.amount_to_pay);
192
192
  var _bookingSummaryProps_transactionFee;
193
193
  var totalBooked = paymentMetadata ? paymentMetadata.paid ? paymentMetadata.total - paymentMetadata.paid : paymentMetadata.total : orderTotalAmountByFormValues + ((_bookingSummaryProps_transactionFee = bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) !== null && _bookingSummaryProps_transactionFee !== void 0 ? _bookingSummaryProps_transactionFee : 0);
194
+ var _bookingSummaryProps_transactionFee1;
195
+ console.log(totalBooked, "totalBooked", orderTotalAmountByFormValues, (_bookingSummaryProps_transactionFee1 = bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) !== null && _bookingSummaryProps_transactionFee1 !== void 0 ? _bookingSummaryProps_transactionFee1 : 0);
194
196
  return /*#__PURE__*/ jsx(Page, {
195
197
  className: "payment_link",
196
198
  children: /*#__PURE__*/ jsx(PageBody, {
@@ -213,7 +215,7 @@ var PaymentPage = function(_param) {
213
215
  }),
214
216
  footer: /*#__PURE__*/ jsx("div", {
215
217
  className: "d-flex flex-column justify-content-between",
216
- children: (paymentMetadata === null || paymentMetadata === void 0 ? void 0 : paymentMetadata.total) ? /*#__PURE__*/ jsxs(Fragment, {
218
+ children: paymentMetadata ? /*#__PURE__*/ jsxs(Fragment, {
217
219
  children: [
218
220
  /*#__PURE__*/ jsx(SummaryTotalBlock, {
219
221
  label: t('paidSum'),
@@ -226,15 +228,15 @@ var PaymentPage = function(_param) {
226
228
  ]
227
229
  }) : /*#__PURE__*/ jsxs(Fragment, {
228
230
  children: [
229
- !!isCalculatedAmountGreaterThanOrderAmount && /*#__PURE__*/ jsx(SummaryTotalBlock, {
231
+ isCalculatedAmountGreaterThanOrderAmount && /*#__PURE__*/ jsx(SummaryTotalBlock, {
230
232
  label: t(hasRemaingToPay ? 'payNow' : 'total'),
231
233
  amount: orderCartAmountByFormValues + ((bookingSummaryProps === null || bookingSummaryProps === void 0 ? void 0 : bookingSummaryProps.transactionFee) || 0)
232
234
  }),
233
- !!hasRemaingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
235
+ hasRemaingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
234
236
  label: t('remaining'),
235
237
  amount: orderTotalAmountByFormValues - orderCartAmountByFormValues
236
238
  }),
237
- !!isPaymentLinkWithRemainingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
239
+ isPaymentLinkWithRemainingToPay && /*#__PURE__*/ jsx(SummaryTotalBlock, {
238
240
  label: t('remaningToPay'),
239
241
  amount: Number(data === null || data === void 0 ? void 0 : data.remaining_to_pay)
240
242
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"RyftPaymentForm.d.ts","sourceRoot":"","sources":["../../../src/iframe/ryft/RyftPaymentForm.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,sBAAsB,EACvB,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0EAA0E,CAAA;AAIlH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAW/C,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAOzD,MAAM,WAAW,oBAAoB;IAEnC,SAAS,EAAE,GAAG,CAAA;IACd,eAAe,EAAE,OAAO,CAAA;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAA;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,CACR,SAAS,EAAE,MAAM,IAAI,EACrB,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,QAAQ,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAC/C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;CAClD;AAED,eAAO,MAAM,eAAe,8JAUzB,oBAAoB,4CAsNtB,CAAA"}
1
+ {"version":3,"file":"RyftPaymentForm.d.ts","sourceRoot":"","sources":["../../../src/iframe/ryft/RyftPaymentForm.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,sBAAsB,EACvB,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0EAA0E,CAAA;AAIlH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAW/C,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAOzD,MAAM,WAAW,oBAAoB;IAEnC,SAAS,EAAE,GAAG,CAAA;IACd,eAAe,EAAE,OAAO,CAAA;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAA;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,CACR,SAAS,EAAE,MAAM,IAAI,EACrB,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,KAChC,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,QAAQ,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAC/C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;CAClD;AAED,eAAO,MAAM,eAAe,8JAUzB,oBAAoB,4CAwLtB,CAAA"}
@@ -198,14 +198,14 @@ var ryftErrorMap = {
198
198
  };
199
199
  var RyftPaymentForm = function(param) {
200
200
  var accountId = param.accountId, isCreateLoading = param.isCreateLoading, isAppUsingInIframe = param.isAppUsingInIframe, providerPaymentSettings = param.providerPaymentSettings, onApplePayButtonClick = param.onApplePayButtonClick, initRyft = param.initRyft, resetReferrer = param.resetReferrer, onSubmit = param.onSubmit, payButtonDisabled = param.payButtonDisabled;
201
- var _formRef_current_childNodes, _formRef_current, _accountId_data, _formRef_current_childNodes1, _formRef_current1;
201
+ var _accountId_data;
202
202
  var t = useTranslation([
203
203
  'Design',
204
204
  'Validation',
205
205
  'Ryft'
206
206
  ]).t;
207
207
  var formRef = useRef(null);
208
- var showApplePayButton = isAppUsingInIframe && (providerPaymentSettings === null || providerPaymentSettings === void 0 ? void 0 : providerPaymentSettings.additionalPaymentMethodsEnabled);
208
+ var hasRyftInitialized = useRef(false);
209
209
  var _useState = _sliced_to_array(useState(false), 2), isValid = _useState[0], setIsValid = _useState[1];
210
210
  var _useState1 = _sliced_to_array(useState(false), 2), isBtnDisabled = _useState1[0], setIsBtnDisabled = _useState1[1];
211
211
  var _useState2 = _sliced_to_array(useState(false), 2), ryftInitFailure = _useState2[0], setRyftInitFailure = _useState2[1];
@@ -218,8 +218,6 @@ var RyftPaymentForm = function(param) {
218
218
  };
219
219
  var redirectOnFailAttempt = function(paymentSession) {
220
220
  if (!(paymentSession === null || paymentSession === void 0 ? void 0 : paymentSession.id) || !(paymentSession === null || paymentSession === void 0 ? void 0 : paymentSession.returnUrl)) return;
221
- // Handle there cases when orderStatus - Captured, Approved,
222
- // or when no redirect URL and orderStatus - PendingAction
223
221
  window.location.href = "".concat(paymentSession.returnUrl, "&ps=").concat(paymentSession.id);
224
222
  setReferrerBeforePayment();
225
223
  };
@@ -254,6 +252,10 @@ var RyftPaymentForm = function(param) {
254
252
  paymentSession = _tmp;
255
253
  if (!paymentSession) {
256
254
  setRyftError('unknown_error');
255
+ setIsBtnDisabled(false);
256
+ return [
257
+ 2
258
+ ];
257
259
  }
258
260
  if ('requiredAction' in paymentSession) {
259
261
  if (paymentSession.status !== STATUS_PENDING_ACTION || !((_paymentSession_requiredAction = paymentSession.requiredAction) === null || _paymentSession_requiredAction === void 0 ? void 0 : _paymentSession_requiredAction.url)) {
@@ -264,6 +266,9 @@ var RyftPaymentForm = function(param) {
264
266
  }
265
267
  window.location.href = paymentSession.requiredAction.url;
266
268
  setReferrerBeforePayment();
269
+ return [
270
+ 2
271
+ ];
267
272
  }
268
273
  if (paymentSession.status === STATUS_APPROVED || paymentSession.status === STATUS_CAPTURED || paymentSession.status === STATUS_PENDING_PAYMENT) {
269
274
  redirectOnFailAttempt(paymentSession);
@@ -302,72 +307,50 @@ var RyftPaymentForm = function(param) {
302
307
  return _ref.apply(this, arguments);
303
308
  };
304
309
  }();
305
- console.log((_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : (_formRef_current_childNodes = _formRef_current.childNodes) === null || _formRef_current_childNodes === void 0 ? void 0 : _formRef_current_childNodes.length, 'formRef.current?.childNodes?.length ');
306
- // useEffect(() => {
307
- // const formBox = document.getElementById('form-disable-box')
308
- // const cardContainer = document.getElementById('ryft-pay-iframe')
309
- // const googleButton = document.getElementById(
310
- // 'gpay-button-online-api-id',
311
- // ) as HTMLButtonElement | null
312
- // const appleButton = document.getElementById(
313
- // 'ryft-pay-apple-pay-button',
314
- // ) as HTMLButtonElement | null
315
- // if (cardContainer) {
316
- // cardContainer.style.opacity = payButtonDisabled ? '0.6' : '1'
317
- // cardContainer.setAttribute('aria-disabled', payButtonDisabled.toString())
318
- // }
319
- // if (googleButton) {
320
- // googleButton.disabled = payButtonDisabled
321
- // googleButton.style.opacity = payButtonDisabled ? '0.6' : '1'
322
- // }
323
- // if (appleButton) {
324
- // appleButton.disabled = payButtonDisabled
325
- // appleButton.style.opacity = payButtonDisabled ? '0.6' : '1'
326
- // }
327
- // if (formBox) {
328
- // formBox.style.display = payButtonDisabled ? 'block' : 'none'
329
- // }
330
- // }, [payButtonDisabled])
331
310
  useEffect(function() {
332
311
  var _accountId_data;
333
- if (!((_accountId_data = accountId.data) === null || _accountId_data === void 0 ? void 0 : _accountId_data.account_id) || accountId.isError) return;
312
+ if (!((_accountId_data = accountId.data) === null || _accountId_data === void 0 ? void 0 : _accountId_data.account_id) || accountId.isError || hasRyftInitialized.current) {
313
+ return;
314
+ }
315
+ hasRyftInitialized.current = true;
334
316
  initRyft(function() {
317
+ setRyftInitFailure(false);
318
+ // Add event listeners
335
319
  addEventHandler('cardValidationChanged', function(e) {
336
320
  setIsValid(e.isValid);
337
321
  });
338
322
  addEventHandler('walletPaymentSessionResult', function(e) {
339
323
  handleSubmit(e.paymentSession);
340
324
  });
341
- setRyftInitFailure(false);
325
+ // Inject other components into the form now that it's ready
326
+ injectComponentsInRyftForm({
327
+ t: t,
328
+ isAppUsingInIframe: isAppUsingInIframe,
329
+ onApplePayButtonClick: onApplePayButtonClick,
330
+ isDisableButton: !payButtonDisabled,
331
+ additionalPaymentMethodsEnabled: providerPaymentSettings === null || providerPaymentSettings === void 0 ? void 0 : providerPaymentSettings.additionalPaymentMethodsEnabled
332
+ });
342
333
  }, function() {
343
334
  return setRyftInitFailure(true);
344
335
  });
345
336
  // eslint-disable-next-line react-hooks/exhaustive-deps
346
337
  }, [
347
- (_accountId_data = accountId.data) === null || _accountId_data === void 0 ? void 0 : _accountId_data.account_id
338
+ (_accountId_data = accountId.data) === null || _accountId_data === void 0 ? void 0 : _accountId_data.account_id,
339
+ accountId.isError,
340
+ addEventHandler,
341
+ initRyft,
342
+ t,
343
+ isAppUsingInIframe,
344
+ onApplePayButtonClick,
345
+ payButtonDisabled,
346
+ providerPaymentSettings === null || providerPaymentSettings === void 0 ? void 0 : providerPaymentSettings.additionalPaymentMethodsEnabled
348
347
  ]);
349
- useEffect(function() {
350
- var _formRef_current_childNodes, _formRef_current, _formRef_current_childNodes1, _formRef_current1, _accountId_data;
351
- if (!((_formRef_current = formRef.current) === null || _formRef_current === void 0 ? void 0 : (_formRef_current_childNodes = _formRef_current.childNodes) === null || _formRef_current_childNodes === void 0 ? void 0 : _formRef_current_childNodes.length) || ((_formRef_current1 = formRef.current) === null || _formRef_current1 === void 0 ? void 0 : (_formRef_current_childNodes1 = _formRef_current1.childNodes) === null || _formRef_current_childNodes1 === void 0 ? void 0 : _formRef_current_childNodes1.length) < 3 || !((_accountId_data = accountId.data) === null || _accountId_data === void 0 ? void 0 : _accountId_data.account_id)) {
352
- return;
353
- }
354
- injectComponentsInRyftForm({
355
- t: t,
356
- isAppUsingInIframe: isAppUsingInIframe,
357
- onApplePayButtonClick: onApplePayButtonClick,
358
- isDisableButton: !payButtonDisabled,
359
- additionalPaymentMethodsEnabled: providerPaymentSettings === null || providerPaymentSettings === void 0 ? void 0 : providerPaymentSettings.additionalPaymentMethodsEnabled
348
+ if (accountId.isLoading || accountId.isFetching || isCreateLoading) {
349
+ return /*#__PURE__*/ jsx("div", {
350
+ className: "mt-5 pt-5",
351
+ children: /*#__PURE__*/ jsx(BlockLoader, {})
360
352
  });
361
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
362
- [
363
- (_formRef_current1 = formRef.current) === null || _formRef_current1 === void 0 ? void 0 : (_formRef_current_childNodes1 = _formRef_current1.childNodes) === null || _formRef_current_childNodes1 === void 0 ? void 0 : _formRef_current_childNodes1.length,
364
- showApplePayButton,
365
- payButtonDisabled
366
- ]);
367
- if (accountId.isLoading || accountId.isFetching || isCreateLoading) return /*#__PURE__*/ jsx("div", {
368
- className: "mt-5 pt-5",
369
- children: /*#__PURE__*/ jsx(BlockLoader, {})
370
- });
353
+ }
371
354
  if (accountId.isError) {
372
355
  return /*#__PURE__*/ jsx("div", {
373
356
  className: "mt-5 ryft-init-failure",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.78.7-stage.18",
3
+ "version": "0.78.7-stage.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"