@weareconceptstudio/account 2.1.13 → 2.1.14
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/cli/init-config.js +221 -0
- package/cli/postinstall.js +31 -0
- package/cli/test-user-integration.mjs +150 -0
- package/dist/AccountProvider.d.ts.map +1 -1
- package/dist/AccountProvider.js +14 -11
- package/dist/AccountProvider.js.map +1 -1
- package/dist/components/AccountButton/index.d.ts.map +1 -1
- package/dist/components/AccountButton/index.js +33 -5
- package/dist/components/AccountButton/index.js.map +1 -1
- package/dist/components/AccountButton/style.d.ts +2 -0
- package/dist/components/AccountButton/style.d.ts.map +1 -1
- package/dist/components/AccountButton/style.js +74 -0
- package/dist/components/AccountButton/style.js.map +1 -1
- package/dist/components/CartPageDetector.d.ts.map +1 -1
- package/dist/components/CartPageDetector.js +13 -0
- package/dist/components/CartPageDetector.js.map +1 -1
- package/dist/components/CustomCheckbox/index.d.ts +1 -1
- package/dist/components/CustomCheckbox/index.d.ts.map +1 -1
- package/dist/components/CustomCheckbox/index.js +4 -3
- package/dist/components/CustomCheckbox/index.js.map +1 -1
- package/dist/components/LineItemAttributes/index.d.ts +7 -0
- package/dist/components/LineItemAttributes/index.d.ts.map +1 -0
- package/dist/components/LineItemAttributes/index.js +24 -0
- package/dist/components/LineItemAttributes/index.js.map +1 -0
- package/dist/components/LineItemProductInfo/index.d.ts +14 -0
- package/dist/components/LineItemProductInfo/index.d.ts.map +1 -0
- package/dist/components/LineItemProductInfo/index.js +24 -0
- package/dist/components/LineItemProductInfo/index.js.map +1 -0
- package/dist/components/TotalCheckout/index.js +1 -1
- package/dist/components/TotalCheckout/index.js.map +1 -1
- package/dist/components/WarningMessageForPopup/index.js +3 -3
- package/dist/components/WarningMessageForPopup/index.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/account/AccountSettingsTemplate/AccountInfo/index.js +1 -1
- package/dist/modules/account/AccountSettingsTemplate/AccountInfo/index.js.map +1 -1
- package/dist/modules/account/AccountSettingsTemplate/AccountPassword/index.js +1 -1
- package/dist/modules/account/AccountSettingsTemplate/AccountPassword/index.js.map +1 -1
- package/dist/modules/account/AccountSettingsTemplate/Subscription/index.js +1 -1
- package/dist/modules/account/AccountSettingsTemplate/Subscription/index.js.map +1 -1
- package/dist/modules/address/AddressForm/index.d.ts.map +1 -1
- package/dist/modules/address/AddressForm/index.js +14 -11
- package/dist/modules/address/AddressForm/index.js.map +1 -1
- package/dist/modules/address/AddressForm/style.d.ts.map +1 -1
- package/dist/modules/address/AddressForm/style.js +71 -0
- package/dist/modules/address/AddressForm/style.js.map +1 -1
- package/dist/modules/address/AddressProvider.d.ts +2 -1
- package/dist/modules/address/AddressProvider.d.ts.map +1 -1
- package/dist/modules/address/AddressProvider.js +2 -1
- package/dist/modules/address/AddressProvider.js.map +1 -1
- package/dist/modules/address/SelectAddressPopup/index.js +1 -1
- package/dist/modules/address/SelectAddressPopup/index.js.map +1 -1
- package/dist/modules/address/ShippingBillingInfo/index.d.ts.map +1 -1
- package/dist/modules/address/ShippingBillingInfo/index.js +4 -33
- package/dist/modules/address/ShippingBillingInfo/index.js.map +1 -1
- package/dist/modules/auth/ForgotPasswordTemplate/index.js +1 -1
- package/dist/modules/auth/ForgotPasswordTemplate/index.js.map +1 -1
- package/dist/modules/auth/ResetPasswordTemplate/index.js +2 -2
- package/dist/modules/auth/ResetPasswordTemplate/index.js.map +1 -1
- package/dist/modules/auth/SignInTemplate/index.js +2 -2
- package/dist/modules/auth/SignInTemplate/index.js.map +1 -1
- package/dist/modules/auth/SignUpTemplate/index.d.ts.map +1 -1
- package/dist/modules/auth/SignUpTemplate/index.js +5 -5
- package/dist/modules/auth/SignUpTemplate/index.js.map +1 -1
- package/dist/modules/auth/SignUpTemplate/style.d.ts.map +1 -1
- package/dist/modules/auth/SignUpTemplate/style.js +6 -0
- package/dist/modules/auth/SignUpTemplate/style.js.map +1 -1
- package/dist/modules/auth/VerifyEmailAddressTemplate/index.js +1 -1
- package/dist/modules/auth/VerifyEmailAddressTemplate/index.js.map +1 -1
- package/dist/modules/cart/CartModificationWarningPopup/index.d.ts +6 -0
- package/dist/modules/cart/CartModificationWarningPopup/index.d.ts.map +1 -0
- package/dist/modules/cart/CartModificationWarningPopup/index.js +17 -0
- package/dist/modules/cart/CartModificationWarningPopup/index.js.map +1 -0
- package/dist/modules/cart/CartModificationWarningPopup/style.d.ts +3 -0
- package/dist/modules/cart/CartModificationWarningPopup/style.d.ts.map +1 -0
- package/dist/modules/cart/CartModificationWarningPopup/style.js +77 -0
- package/dist/modules/cart/CartModificationWarningPopup/style.js.map +1 -0
- package/dist/modules/cart/EmptyCart/index.d.ts.map +1 -1
- package/dist/modules/cart/EmptyCart/index.js +7 -3
- package/dist/modules/cart/EmptyCart/index.js.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/EditButton.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/EditButton.js +0 -1
- package/dist/modules/cart/components/CartItems/Item/EditButton.js.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/ItemActions.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/ItemActions.js +0 -1
- package/dist/modules/cart/components/CartItems/Item/ItemActions.js.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/ItemAttributes.d.ts +3 -1
- package/dist/modules/cart/components/CartItems/Item/ItemAttributes.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/ItemAttributes.js +11 -34
- package/dist/modules/cart/components/CartItems/Item/ItemAttributes.js.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/ItemImage.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/ItemImage.js +0 -1
- package/dist/modules/cart/components/CartItems/Item/ItemImage.js.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/QuantitySelector.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/QuantitySelector.js +3 -12
- package/dist/modules/cart/components/CartItems/Item/QuantitySelector.js.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/index.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/Item/index.js +2 -5
- package/dist/modules/cart/components/CartItems/Item/index.js.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemActions.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemActions.js +0 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemActions.js.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemAttributes.d.ts +3 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemAttributes.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemAttributes.js +11 -34
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemAttributes.js.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemImage.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemImage.js +0 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemImage.js.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemQuantity.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemQuantity.js +3 -12
- package/dist/modules/cart/components/CartItems/ItemMobile/MobileItemQuantity.js.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/index.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/ItemMobile/index.js +2 -5
- package/dist/modules/cart/components/CartItems/ItemMobile/index.js.map +1 -1
- package/dist/modules/cart/components/CartItems/index.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/index.js +0 -1
- package/dist/modules/cart/components/CartItems/index.js.map +1 -1
- package/dist/modules/cart/components/CartItems/style.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/style.js +6 -3
- package/dist/modules/cart/components/CartItems/style.js.map +1 -1
- package/dist/modules/cart/components/CartItems/util.d.ts.map +1 -1
- package/dist/modules/cart/components/CartItems/util.js +1 -2
- package/dist/modules/cart/components/CartItems/util.js.map +1 -1
- package/dist/modules/cart/index.d.ts +1 -0
- package/dist/modules/cart/index.d.ts.map +1 -1
- package/dist/modules/cart/index.js +1 -0
- package/dist/modules/cart/index.js.map +1 -1
- package/dist/modules/checkout/CheckoutTemplate/StepReview/index.d.ts.map +1 -1
- package/dist/modules/checkout/CheckoutTemplate/StepReview/index.js +2 -6
- package/dist/modules/checkout/CheckoutTemplate/StepReview/index.js.map +1 -1
- package/dist/modules/checkout/CheckoutTemplate/index.d.ts +2 -1
- package/dist/modules/checkout/CheckoutTemplate/index.d.ts.map +1 -1
- package/dist/modules/checkout/CheckoutTemplate/index.js +12 -6
- package/dist/modules/checkout/CheckoutTemplate/index.js.map +1 -1
- package/dist/modules/checkout/CheckoutTemplate/style.d.ts.map +1 -1
- package/dist/modules/checkout/CheckoutTemplate/style.js +6 -1
- package/dist/modules/checkout/CheckoutTemplate/style.js.map +1 -1
- package/dist/modules/checkout/PaymentFailedTemplate/index.d.ts.map +1 -1
- package/dist/modules/checkout/PaymentFailedTemplate/index.js +3 -0
- package/dist/modules/checkout/PaymentFailedTemplate/index.js.map +1 -1
- package/dist/modules/checkout/ThankYouTemplate/index.d.ts.map +1 -1
- package/dist/modules/checkout/ThankYouTemplate/index.js +3 -0
- package/dist/modules/checkout/ThankYouTemplate/index.js.map +1 -1
- package/dist/modules/delivery/DeliveryOptions/index.d.ts.map +1 -1
- package/dist/modules/delivery/DeliveryOptions/index.js +11 -212
- package/dist/modules/delivery/DeliveryOptions/index.js.map +1 -1
- package/dist/modules/index.d.ts +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/order/OrderDetails/index.d.ts.map +1 -1
- package/dist/modules/order/OrderDetails/index.js +0 -1
- package/dist/modules/order/OrderDetails/index.js.map +1 -1
- package/dist/modules/order/OrderIndividualTemplate/index.d.ts.map +1 -1
- package/dist/modules/order/OrderIndividualTemplate/index.js +2 -10
- package/dist/modules/order/OrderIndividualTemplate/index.js.map +1 -1
- package/dist/modules/order/OrderedItems/Item/index.d.ts.map +1 -1
- package/dist/modules/order/OrderedItems/Item/index.js +2 -30
- package/dist/modules/order/OrderedItems/Item/index.js.map +1 -1
- package/dist/modules/order/OrderedItems/ItemMobile/index.d.ts.map +1 -1
- package/dist/modules/order/OrderedItems/ItemMobile/index.js +2 -28
- package/dist/modules/order/OrderedItems/ItemMobile/index.js.map +1 -1
- package/dist/modules/order/OrderedItems/Review/Popup/style.js +1 -1
- package/dist/modules/order/OrderedItems/Review/index.js +1 -1
- package/dist/modules/order/OrderedItems/Review/index.js.map +1 -1
- package/dist/modules/order/OrderedItems/index.d.ts.map +1 -1
- package/dist/modules/order/OrderedItems/index.js +0 -1
- package/dist/modules/order/OrderedItems/index.js.map +1 -1
- package/dist/modules/order/OrderedItems/style.d.ts.map +1 -1
- package/dist/modules/order/OrderedItems/style.js +8 -3
- package/dist/modules/order/OrderedItems/style.js.map +1 -1
- package/dist/modules/order/OrdersList/Item/index.d.ts.map +1 -1
- package/dist/modules/order/OrdersList/Item/index.js +0 -1
- package/dist/modules/order/OrdersList/Item/index.js.map +1 -1
- package/dist/modules/order/OrdersList/ItemMobile/index.d.ts.map +1 -1
- package/dist/modules/order/OrdersList/ItemMobile/index.js +0 -1
- package/dist/modules/order/OrdersList/ItemMobile/index.js.map +1 -1
- package/dist/modules/order/OrdersList/index.d.ts.map +1 -1
- package/dist/modules/order/OrdersList/index.js +0 -1
- package/dist/modules/order/OrdersList/index.js.map +1 -1
- package/dist/modules/order/OrdersList/style.d.ts.map +1 -1
- package/dist/modules/order/OrdersList/style.js +0 -1
- package/dist/modules/order/OrdersList/style.js.map +1 -1
- package/dist/modules/payment/PaymentMethodIcon/index.d.ts +8 -0
- package/dist/modules/payment/PaymentMethodIcon/index.d.ts.map +1 -0
- package/dist/modules/payment/PaymentMethodIcon/index.js +17 -0
- package/dist/modules/payment/PaymentMethodIcon/index.js.map +1 -0
- package/dist/modules/payment/PaymentMethodIcon/style.d.ts +3 -0
- package/dist/modules/payment/PaymentMethodIcon/style.d.ts.map +1 -0
- package/dist/modules/payment/PaymentMethodIcon/style.js +25 -0
- package/dist/modules/payment/PaymentMethodIcon/style.js.map +1 -0
- package/dist/modules/payment/PaymentMethodItem/index.d.ts.map +1 -1
- package/dist/modules/payment/PaymentMethodItem/index.js +2 -13
- package/dist/modules/payment/PaymentMethodItem/index.js.map +1 -1
- package/dist/modules/payment/SelectPaymentMethodPopup/index.js +1 -1
- package/dist/modules/payment/SelectPaymentMethodPopup/index.js.map +1 -1
- package/dist/modules/payment/icons.d.ts +2 -0
- package/dist/modules/payment/icons.d.ts.map +1 -1
- package/dist/modules/payment/icons.js +35 -27
- package/dist/modules/payment/icons.js.map +1 -1
- package/dist/modules/payment/index.d.ts +1 -0
- package/dist/modules/payment/index.d.ts.map +1 -1
- package/dist/modules/payment/index.js +1 -0
- package/dist/modules/payment/index.js.map +1 -1
- package/dist/modules/payment/paymentIconMap.d.ts +12 -0
- package/dist/modules/payment/paymentIconMap.d.ts.map +1 -0
- package/dist/modules/payment/paymentIconMap.js +31 -0
- package/dist/modules/payment/paymentIconMap.js.map +1 -0
- package/dist/modules/unsubscribe/UnsubscribeMessage.js +1 -1
- package/dist/modules/unsubscribe/UnsubscribeMessage.js.map +1 -1
- package/dist/modules/unsubscribe/UnsubscribeTemplate.js +1 -1
- package/dist/modules/unsubscribe/UnsubscribeTemplate.js.map +1 -1
- package/dist/server.d.ts +6 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -0
- package/dist/stores/orderStore.d.ts.map +1 -1
- package/dist/stores/orderStore.js.map +1 -1
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +5 -0
- package/dist/styles/theme.js.map +1 -1
- package/dist/styles/variables.d.ts.map +1 -1
- package/dist/styles/variables.js +4 -0
- package/dist/styles/variables.js.map +1 -1
- package/dist/translations/en.d.ts +20 -7
- package/dist/translations/en.d.ts.map +1 -1
- package/dist/translations/en.js +21 -8
- package/dist/translations/en.js.map +1 -1
- package/dist/translations/hy.d.ts +2 -7
- package/dist/translations/hy.d.ts.map +1 -1
- package/dist/translations/hy.js +3 -8
- package/dist/translations/hy.js.map +1 -1
- package/dist/translations/index.d.ts +26 -28
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/translations/it.d.ts +2 -7
- package/dist/translations/it.d.ts.map +1 -1
- package/dist/translations/it.js +3 -8
- package/dist/translations/it.js.map +1 -1
- package/dist/translations/ru.d.ts +2 -7
- package/dist/translations/ru.d.ts.map +1 -1
- package/dist/translations/ru.js +3 -8
- package/dist/translations/ru.js.map +1 -1
- package/dist/user/UserProvider.d.ts +6 -0
- package/dist/user/UserProvider.d.ts.map +1 -0
- package/dist/user/UserProvider.js +128 -0
- package/dist/user/UserProvider.js.map +1 -0
- package/dist/user/checkUserRedirection.d.ts +21 -0
- package/dist/user/checkUserRedirection.d.ts.map +1 -0
- package/dist/user/checkUserRedirection.js +62 -0
- package/dist/user/checkUserRedirection.js.map +1 -0
- package/dist/user/createUserMethods.d.ts +21 -0
- package/dist/user/createUserMethods.d.ts.map +1 -0
- package/dist/user/createUserMethods.js +162 -0
- package/dist/user/createUserMethods.js.map +1 -0
- package/dist/user/getUser.d.ts +14 -0
- package/dist/user/getUser.d.ts.map +1 -0
- package/dist/user/getUser.js +60 -0
- package/dist/user/getUser.js.map +1 -0
- package/dist/user/index.d.ts +6 -0
- package/dist/user/index.d.ts.map +1 -0
- package/dist/user/index.js +6 -0
- package/dist/user/index.js.map +1 -0
- package/dist/user/langPath.d.ts +3 -0
- package/dist/user/langPath.d.ts.map +1 -0
- package/dist/user/langPath.js +23 -0
- package/dist/user/langPath.js.map +1 -0
- package/dist/user/types.d.ts +139 -0
- package/dist/user/types.d.ts.map +1 -0
- package/dist/user/types.js +2 -0
- package/dist/user/types.js.map +1 -0
- package/dist/user/userConfig.d.ts +23 -0
- package/dist/user/userConfig.d.ts.map +1 -0
- package/dist/user/userConfig.js +24 -0
- package/dist/user/userConfig.js.map +1 -0
- package/dist/utils/buttonClassNames.d.ts +9 -0
- package/dist/utils/buttonClassNames.d.ts.map +1 -0
- package/dist/utils/buttonClassNames.js +10 -0
- package/dist/utils/buttonClassNames.js.map +1 -0
- package/dist/utils/buttonTypes.d.ts +12 -0
- package/dist/utils/buttonTypes.d.ts.map +1 -0
- package/dist/utils/buttonTypes.js +18 -0
- package/dist/utils/buttonTypes.js.map +1 -0
- package/dist/utils/config.d.ts +14 -7
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +35 -5
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/createAccountButtonEntry.d.ts +5 -0
- package/dist/utils/createAccountButtonEntry.d.ts.map +1 -0
- package/dist/utils/createAccountButtonEntry.js +33 -0
- package/dist/utils/createAccountButtonEntry.js.map +1 -0
- package/dist/utils/lineItemDisplay.d.ts +11 -0
- package/dist/utils/lineItemDisplay.d.ts.map +1 -0
- package/dist/utils/lineItemDisplay.js +165 -0
- package/dist/utils/lineItemDisplay.js.map +1 -0
- package/dist/utils/payment.d.ts +56 -11
- package/dist/utils/payment.d.ts.map +1 -1
- package/dist/utils/payment.js +43 -5
- package/dist/utils/payment.js.map +1 -1
- package/package.json +30 -7
- package/templates/README.md +41 -0
- package/templates/account.config.example.ts +77 -0
- package/templates/address.config.example.ts +55 -0
- package/templates/index.example.ts +24 -0
- package/templates/integrations.config.example.ts +28 -0
- package/templates/routes.config.example.ts +56 -0
- package/templates/user.config.example.ts +45 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared line-item title and attribute resolution for cart, checkout, and order views.
|
|
3
|
+
* Projects can send `display_attributes` from the API, or fall back to variants / config keys.
|
|
4
|
+
*/
|
|
5
|
+
export const normalizeDisplayAttribute = (entry) => {
|
|
6
|
+
if (entry == null || entry === '') {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (typeof entry === 'string' || typeof entry === 'number') {
|
|
10
|
+
return { text: String(entry) };
|
|
11
|
+
}
|
|
12
|
+
if (typeof entry === 'object') {
|
|
13
|
+
const value = entry.value ?? entry.text;
|
|
14
|
+
if (value == null || value === '') {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
label: entry.label,
|
|
19
|
+
text: String(value),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
export const resolveLineItemTitle = (data, display = {}) => {
|
|
25
|
+
const keys = display.itemTitleKeys || ['product_name', 'name', 'title'];
|
|
26
|
+
for (const key of keys) {
|
|
27
|
+
const value = data?.[key] ?? data?.product?.[key];
|
|
28
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return data?.product?.name || data?.product_name || null;
|
|
33
|
+
};
|
|
34
|
+
const isTourBookingProduct = (product) => product?.type === 'group' || product?.type === 'private';
|
|
35
|
+
const buildTourBookingAttributes = (data, translate) => {
|
|
36
|
+
const product = data?.product;
|
|
37
|
+
if (!isTourBookingProduct(product)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const attributes = [];
|
|
41
|
+
const tourType = product.type;
|
|
42
|
+
const tourTypeValue = translate?.(tourType === 'private' ? 'account.tour_booking.privateTour' : 'account.tour_booking.groupTour');
|
|
43
|
+
if (tourTypeValue) {
|
|
44
|
+
attributes.push({
|
|
45
|
+
label: translate?.('account.tour_booking.tourType'),
|
|
46
|
+
text: tourTypeValue,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const selectedDate = product?.start_date || data?.start_date;
|
|
50
|
+
if (selectedDate) {
|
|
51
|
+
attributes.push({
|
|
52
|
+
label: translate?.('account.tour_booking.selectedDate'),
|
|
53
|
+
text: String(selectedDate),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const adults = Number(product?.adults ?? data?.adults ?? 0);
|
|
57
|
+
const children = Number(product?.children ?? data?.children ?? 0);
|
|
58
|
+
const totalParticipants = adults + children;
|
|
59
|
+
if (totalParticipants > 0) {
|
|
60
|
+
attributes.push({
|
|
61
|
+
label: translate?.('account.tour_booking.participants'),
|
|
62
|
+
text: translate?.('account.tour_booking.people', { count: totalParticipants }) ||
|
|
63
|
+
String(totalParticipants),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const language = product?.tour_language;
|
|
67
|
+
if (language) {
|
|
68
|
+
attributes.push({
|
|
69
|
+
label: translate?.('account.tour_booking.language'),
|
|
70
|
+
text: String(language),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const duration = product?.duration;
|
|
74
|
+
if (duration) {
|
|
75
|
+
attributes.push({
|
|
76
|
+
label: translate?.('account.tour_booking.duration'),
|
|
77
|
+
text: String(duration),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (tourType === 'private') {
|
|
81
|
+
if (product?.have_lunch) {
|
|
82
|
+
const lunchSelected = product?.selected_addons?.lunch;
|
|
83
|
+
attributes.push({
|
|
84
|
+
label: translate?.('account.tour_booking.lunch'),
|
|
85
|
+
text: lunchSelected
|
|
86
|
+
? translate?.('account.tour_booking.included')
|
|
87
|
+
: translate?.('account.tour_booking.notIncluded'),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (product?.tickets_price) {
|
|
91
|
+
const ticketsSelected = product?.selected_addons?.tickets;
|
|
92
|
+
attributes.push({
|
|
93
|
+
label: translate?.('account.tour_booking.tickets'),
|
|
94
|
+
text: ticketsSelected
|
|
95
|
+
? translate?.('account.tour_booking.included')
|
|
96
|
+
: translate?.('account.tour_booking.notIncluded'),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else if (product?.have_lunch) {
|
|
101
|
+
attributes.push({
|
|
102
|
+
label: translate?.('account.tour_booking.lunch'),
|
|
103
|
+
text: translate?.('account.tour_booking.included'),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return attributes.length > 0 ? attributes : null;
|
|
107
|
+
};
|
|
108
|
+
export const resolveLineItemAttributes = (data, display = {}, options = {}) => {
|
|
109
|
+
const { selectedVariant, selectedOption, translate } = options;
|
|
110
|
+
const product = data?.product;
|
|
111
|
+
const isTourBooking = isTourBookingProduct(product);
|
|
112
|
+
const apiAttributes = data?.display_attributes ?? product?.display_attributes;
|
|
113
|
+
if (Array.isArray(apiAttributes) && apiAttributes.length > 0) {
|
|
114
|
+
return apiAttributes.map(normalizeDisplayAttribute).filter(Boolean);
|
|
115
|
+
}
|
|
116
|
+
if (isTourBooking) {
|
|
117
|
+
const tourAttributes = buildTourBookingAttributes(data, translate);
|
|
118
|
+
if (tourAttributes) {
|
|
119
|
+
return tourAttributes;
|
|
120
|
+
}
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
const variantAttributes = [];
|
|
124
|
+
if (selectedVariant?.color?.name) {
|
|
125
|
+
variantAttributes.push({
|
|
126
|
+
label: translate?.('account.general_actions.color'),
|
|
127
|
+
text: selectedVariant.color.name,
|
|
128
|
+
capitalize: true,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else if (data?.color) {
|
|
132
|
+
variantAttributes.push({
|
|
133
|
+
label: translate?.('account.general_actions.color'),
|
|
134
|
+
text: data.color,
|
|
135
|
+
capitalize: true,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (selectedOption?.size?.name) {
|
|
139
|
+
variantAttributes.push({
|
|
140
|
+
label: translate?.('account.general_actions.size'),
|
|
141
|
+
text: selectedOption.size.name,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else if (data?.size) {
|
|
145
|
+
variantAttributes.push({
|
|
146
|
+
label: translate?.('account.general_actions.size'),
|
|
147
|
+
text: data.size,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (variantAttributes.length > 0) {
|
|
151
|
+
return variantAttributes;
|
|
152
|
+
}
|
|
153
|
+
const attributeKeys = display.itemAttributeKeys || [];
|
|
154
|
+
if (attributeKeys.length > 0) {
|
|
155
|
+
return attributeKeys
|
|
156
|
+
.map((key) => data?.[key] ?? data?.product?.[key])
|
|
157
|
+
.filter((value) => value !== undefined && value !== null && value !== '')
|
|
158
|
+
.map((text) => ({ text: String(text) }));
|
|
159
|
+
}
|
|
160
|
+
return [data?.product?.short_info_1, data?.product?.short_info_2]
|
|
161
|
+
.filter((value) => value !== undefined && value !== null && value !== '')
|
|
162
|
+
.map((text) => ({ text: String(text) }));
|
|
163
|
+
};
|
|
164
|
+
export const canOpenLineItemProduct = (data, itemTitle) => Boolean(data?.product) || Boolean(itemTitle);
|
|
165
|
+
//# sourceMappingURL=lineItemDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineItemDisplay.js","sourceRoot":"","sources":["../../src/utils/lineItemDisplay.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,EAAE;IAClD,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC;QAExC,IAAI,KAAK,IAAI,IA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AE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC;SAC/D,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;SACxE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/utils/payment.d.ts
CHANGED
|
@@ -1,33 +1,78 @@
|
|
|
1
|
-
export namespace
|
|
2
|
-
let
|
|
3
|
-
let
|
|
1
|
+
export namespace PAYMENT_METHOD_VALUES {
|
|
2
|
+
let CREDIT_CARD: string;
|
|
3
|
+
let APPLE_PAY: string;
|
|
4
|
+
let GOOGLE_PAY: string;
|
|
5
|
+
let PAYPAL: string;
|
|
6
|
+
let CASH_ON_DELIVERY: string;
|
|
7
|
+
let IDRAM: string;
|
|
8
|
+
let TELCELL: string;
|
|
9
|
+
let POS_TERMINAL: string;
|
|
10
|
+
let INECOPAY: string;
|
|
11
|
+
let VISA: string;
|
|
12
|
+
let MASTERCARD: string;
|
|
4
13
|
}
|
|
5
|
-
export namespace
|
|
14
|
+
export namespace creditCardPaymentOption {
|
|
15
|
+
export let label: string;
|
|
16
|
+
import value = PAYMENT_METHOD_VALUES.CREDIT_CARD;
|
|
17
|
+
export { value };
|
|
18
|
+
export let withForm: boolean;
|
|
19
|
+
}
|
|
20
|
+
export namespace applePayPaymentOption {
|
|
6
21
|
let label_1: string;
|
|
7
22
|
export { label_1 as label };
|
|
8
|
-
|
|
23
|
+
import value_1 = PAYMENT_METHOD_VALUES.APPLE_PAY;
|
|
9
24
|
export { value_1 as value };
|
|
10
25
|
}
|
|
11
|
-
export namespace
|
|
26
|
+
export namespace googlePayPaymentOption {
|
|
12
27
|
let label_2: string;
|
|
13
28
|
export { label_2 as label };
|
|
14
|
-
|
|
29
|
+
import value_2 = PAYMENT_METHOD_VALUES.GOOGLE_PAY;
|
|
15
30
|
export { value_2 as value };
|
|
16
31
|
}
|
|
17
|
-
export namespace
|
|
32
|
+
export namespace paypalPaymentOption {
|
|
18
33
|
let label_3: string;
|
|
19
34
|
export { label_3 as label };
|
|
20
|
-
|
|
35
|
+
import value_3 = PAYMENT_METHOD_VALUES.PAYPAL;
|
|
21
36
|
export { value_3 as value };
|
|
22
37
|
}
|
|
23
|
-
export namespace
|
|
38
|
+
export namespace cashOnDeliveryPaymentOption {
|
|
24
39
|
let label_4: string;
|
|
25
40
|
export { label_4 as label };
|
|
26
|
-
|
|
41
|
+
import value_4 = PAYMENT_METHOD_VALUES.CASH_ON_DELIVERY;
|
|
27
42
|
export { value_4 as value };
|
|
28
43
|
}
|
|
44
|
+
export namespace idramPaymentOption {
|
|
45
|
+
let label_5: string;
|
|
46
|
+
export { label_5 as label };
|
|
47
|
+
import value_5 = PAYMENT_METHOD_VALUES.IDRAM;
|
|
48
|
+
export { value_5 as value };
|
|
49
|
+
}
|
|
50
|
+
export namespace posTerminalPaymentOption {
|
|
51
|
+
let label_6: string;
|
|
52
|
+
export { label_6 as label };
|
|
53
|
+
import value_6 = PAYMENT_METHOD_VALUES.POS_TERMINAL;
|
|
54
|
+
export { value_6 as value };
|
|
55
|
+
}
|
|
56
|
+
export namespace telcellPaymentOption {
|
|
57
|
+
let label_7: string;
|
|
58
|
+
export { label_7 as label };
|
|
59
|
+
import value_7 = PAYMENT_METHOD_VALUES.TELCELL;
|
|
60
|
+
export { value_7 as value };
|
|
61
|
+
}
|
|
62
|
+
export namespace inecopayPaymentOption {
|
|
63
|
+
let label_8: string;
|
|
64
|
+
export { label_8 as label };
|
|
65
|
+
import value_8 = PAYMENT_METHOD_VALUES.INECOPAY;
|
|
66
|
+
export { value_8 as value };
|
|
67
|
+
}
|
|
68
|
+
/** Default regional / offline methods */
|
|
29
69
|
export const defaultPaymentOptions: {
|
|
30
70
|
label: string;
|
|
31
71
|
value: string;
|
|
32
72
|
}[];
|
|
73
|
+
/** Example set for card + wallet checkout (use in checkout.paymentOptions) */
|
|
74
|
+
export const walletCheckoutPaymentOptions: {
|
|
75
|
+
label: string;
|
|
76
|
+
value: string;
|
|
77
|
+
}[];
|
|
33
78
|
//# sourceMappingURL=payment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/utils/payment.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/utils/payment.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,yCAAyC;AACzC;;;IAME;AAEF,8EAA8E;AAC9E;;;IAKE"}
|
package/dist/utils/payment.js
CHANGED
|
@@ -1,23 +1,54 @@
|
|
|
1
|
+
export const PAYMENT_METHOD_VALUES = {
|
|
2
|
+
CREDIT_CARD: 'credit_card',
|
|
3
|
+
APPLE_PAY: 'apple_pay',
|
|
4
|
+
GOOGLE_PAY: 'google_pay',
|
|
5
|
+
PAYPAL: 'paypal',
|
|
6
|
+
CASH_ON_DELIVERY: 'cash_on_delivery',
|
|
7
|
+
IDRAM: 'idram',
|
|
8
|
+
TELCELL: 'telcell',
|
|
9
|
+
POS_TERMINAL: 'pos_terminal',
|
|
10
|
+
INECOPAY: 'inecopay',
|
|
11
|
+
VISA: 'visa',
|
|
12
|
+
MASTERCARD: 'mastercard',
|
|
13
|
+
};
|
|
14
|
+
export const creditCardPaymentOption = {
|
|
15
|
+
label: 'account.payment_management.creditCard',
|
|
16
|
+
value: PAYMENT_METHOD_VALUES.CREDIT_CARD,
|
|
17
|
+
withForm: true,
|
|
18
|
+
};
|
|
19
|
+
export const applePayPaymentOption = {
|
|
20
|
+
label: 'account.payment_management.applePay',
|
|
21
|
+
value: PAYMENT_METHOD_VALUES.APPLE_PAY,
|
|
22
|
+
};
|
|
23
|
+
export const googlePayPaymentOption = {
|
|
24
|
+
label: 'account.payment_management.googlePay',
|
|
25
|
+
value: PAYMENT_METHOD_VALUES.GOOGLE_PAY,
|
|
26
|
+
};
|
|
27
|
+
export const paypalPaymentOption = {
|
|
28
|
+
label: 'account.payment_management.paypal',
|
|
29
|
+
value: PAYMENT_METHOD_VALUES.PAYPAL,
|
|
30
|
+
};
|
|
1
31
|
export const cashOnDeliveryPaymentOption = {
|
|
2
32
|
label: 'Cash',
|
|
3
|
-
value:
|
|
33
|
+
value: PAYMENT_METHOD_VALUES.CASH_ON_DELIVERY,
|
|
4
34
|
};
|
|
5
35
|
export const idramPaymentOption = {
|
|
6
36
|
label: 'Idram',
|
|
7
|
-
value:
|
|
37
|
+
value: PAYMENT_METHOD_VALUES.IDRAM,
|
|
8
38
|
};
|
|
9
39
|
export const posTerminalPaymentOption = {
|
|
10
40
|
label: 'POS TERMINAL',
|
|
11
|
-
value:
|
|
41
|
+
value: PAYMENT_METHOD_VALUES.POS_TERMINAL,
|
|
12
42
|
};
|
|
13
43
|
export const telcellPaymentOption = {
|
|
14
44
|
label: 'Telcell',
|
|
15
|
-
value:
|
|
45
|
+
value: PAYMENT_METHOD_VALUES.TELCELL,
|
|
16
46
|
};
|
|
17
47
|
export const inecopayPaymentOption = {
|
|
18
48
|
label: 'Inecopay',
|
|
19
|
-
value:
|
|
49
|
+
value: PAYMENT_METHOD_VALUES.INECOPAY,
|
|
20
50
|
};
|
|
51
|
+
/** Default regional / offline methods */
|
|
21
52
|
export const defaultPaymentOptions = [
|
|
22
53
|
cashOnDeliveryPaymentOption,
|
|
23
54
|
idramPaymentOption,
|
|
@@ -25,4 +56,11 @@ export const defaultPaymentOptions = [
|
|
|
25
56
|
telcellPaymentOption,
|
|
26
57
|
inecopayPaymentOption,
|
|
27
58
|
];
|
|
59
|
+
/** Example set for card + wallet checkout (use in checkout.paymentOptions) */
|
|
60
|
+
export const walletCheckoutPaymentOptions = [
|
|
61
|
+
creditCardPaymentOption,
|
|
62
|
+
applePayPaymentOption,
|
|
63
|
+
googlePayPaymentOption,
|
|
64
|
+
paypalPaymentOption,
|
|
65
|
+
];
|
|
28
66
|
//# sourceMappingURL=payment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/utils/payment.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;IAC1C,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/utils/payment.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,kBAAkB;IACpC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,YAAY;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACtC,KAAK,EAAE,uCAAuC;IAC9C,KAAK,EAAE,qBAAqB,CAAC,WAAW;IACxC,QAAQ,EAAE,IAAI;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,KAAK,EAAE,qCAAqC;IAC5C,KAAK,EAAE,qBAAqB,CAAC,SAAS;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,KAAK,EAAE,sCAAsC;IAC7C,KAAK,EAAE,qBAAqB,CAAC,UAAU;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,KAAK,EAAE,mCAAmC;IAC1C,KAAK,EAAE,qBAAqB,CAAC,MAAM;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IAC1C,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,qBAAqB,CAAC,gBAAgB;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,qBAAqB,CAAC,KAAK;CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,qBAAqB,CAAC,YAAY;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,qBAAqB,CAAC,OAAO;CACpC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,qBAAqB,CAAC,QAAQ;CACrC,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,2BAA2B;IAC3B,kBAAkB;IAClB,wBAAwB;IACxB,oBAAoB;IACpB,qBAAqB;CACrB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C,uBAAuB;IACvB,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;CACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,28 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weareconceptstudio/account",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
4
4
|
"description": "Concept Studio Account",
|
|
5
5
|
"author": "Concept Studio",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
-
"sideEffects":
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/AccountProvider.js",
|
|
10
|
+
"**/user/UserProvider.js"
|
|
11
|
+
],
|
|
12
|
+
"bin": {
|
|
13
|
+
"account-init": "./cli/init-config.js"
|
|
14
|
+
},
|
|
9
15
|
"files": [
|
|
10
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"cli",
|
|
18
|
+
"templates"
|
|
11
19
|
],
|
|
12
20
|
"exports": {
|
|
13
21
|
".": {
|
|
14
22
|
"types": "./dist/index.d.ts",
|
|
15
23
|
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./config": {
|
|
26
|
+
"types": "./dist/config.d.ts",
|
|
27
|
+
"default": "./dist/config.js"
|
|
28
|
+
},
|
|
29
|
+
"./server": {
|
|
30
|
+
"types": "./dist/server.d.ts",
|
|
31
|
+
"default": "./dist/server.js"
|
|
32
|
+
},
|
|
33
|
+
"./user": {
|
|
34
|
+
"types": "./dist/user/index.d.ts",
|
|
35
|
+
"default": "./dist/user/index.js"
|
|
16
36
|
}
|
|
17
37
|
},
|
|
18
38
|
"scripts": {
|
|
19
39
|
"build": "tsc -m es6",
|
|
20
|
-
"watch": "tsc -m es6 --watch"
|
|
40
|
+
"watch": "tsc -m es6 --watch",
|
|
41
|
+
"init-config": "node ./cli/init-config.js",
|
|
42
|
+
"test:user-integration": "npm run build && node ./cli/test-user-integration.mjs",
|
|
43
|
+
"postinstall": "node ./cli/postinstall.js"
|
|
21
44
|
},
|
|
22
45
|
"dependencies": {
|
|
23
|
-
"@weareconceptstudio/cart": "^0.0.
|
|
24
|
-
"@weareconceptstudio/core": "^0.4.
|
|
25
|
-
"@weareconceptstudio/form": "^0.5.
|
|
46
|
+
"@weareconceptstudio/cart": "^0.0.19",
|
|
47
|
+
"@weareconceptstudio/core": "^0.4.14",
|
|
48
|
+
"@weareconceptstudio/form": "^0.5.13",
|
|
26
49
|
"react-helmet": "6.1.0",
|
|
27
50
|
"payment": "2.4.6"
|
|
28
51
|
},
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Account package config examples
|
|
2
|
+
|
|
3
|
+
Generated by `npx account-init` from `@weareconceptstudio/account`.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
| File | Purpose |
|
|
8
|
+
|------|---------|
|
|
9
|
+
| `routes.config.ts` | Auth + private customer routes |
|
|
10
|
+
| `integrations.config.ts` | API endpoints (account, cart, checkout, order) |
|
|
11
|
+
| `user.config.ts` | `UserProvider` props (`userIntegration`, hooks) |
|
|
12
|
+
| `account.config.ts` | `AccountProvider` overrides (`globalSettings`, cart, checkout, …) |
|
|
13
|
+
| `address.config.ts` | Address form field definitions |
|
|
14
|
+
| `index.ts` | Barrel export |
|
|
15
|
+
|
|
16
|
+
## Layout usage (Next.js)
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { AccountProvider, UserProvider, useUser } from '@weareconceptstudio/account';
|
|
20
|
+
import { accountProviderConfig } from '@/config/account/account.config';
|
|
21
|
+
import { userProviderConfig } from '@/config/account/user.config';
|
|
22
|
+
import { integrationsConfig } from '@/config/account/integrations.config';
|
|
23
|
+
|
|
24
|
+
<UserProvider {...userProviderConfig} initialUser={userData.newState}>
|
|
25
|
+
<AccountProvider
|
|
26
|
+
{...accountProviderConfig}
|
|
27
|
+
useUser={useUser}
|
|
28
|
+
orderIntegration={integrationsConfig.order}
|
|
29
|
+
/>
|
|
30
|
+
</UserProvider>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Custom user methods (e.g. `toggleSubscribe`)
|
|
34
|
+
|
|
35
|
+
Define in a client component wrapper or pass `createMethods` when supported — methods that call `setState` cannot live in static config files.
|
|
36
|
+
|
|
37
|
+
## Re-run
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx account-init --out src/config/account --all --force
|
|
41
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccountProvider overrides — merged with package defaults in @weareconceptstudio/account.
|
|
3
|
+
*
|
|
4
|
+
* Import createAccountButtonEntry from '@weareconceptstudio/account/config'
|
|
5
|
+
* and pass your project Button component in layout or here.
|
|
6
|
+
*/
|
|
7
|
+
import type { UserIntegrationConfig } from '@weareconceptstudio/account';
|
|
8
|
+
|
|
9
|
+
export const accountProviderConfig = {
|
|
10
|
+
currency: 'USD',
|
|
11
|
+
fontFamily: 'core_Font',
|
|
12
|
+
shopUrl: '/',
|
|
13
|
+
productUrlPrefix: '/products/',
|
|
14
|
+
|
|
15
|
+
auth: {
|
|
16
|
+
social: {
|
|
17
|
+
google: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
globalSettings: {
|
|
22
|
+
hasShippingCost: true,
|
|
23
|
+
hasAddresses: true,
|
|
24
|
+
hasAddressType: false,
|
|
25
|
+
supportsGuestCart: true,
|
|
26
|
+
allowGuestCheckout: true,
|
|
27
|
+
hasBalanceSystem: false,
|
|
28
|
+
hasVoucherSystem: false,
|
|
29
|
+
hasPromoCodeSystem: false,
|
|
30
|
+
hasGiftSystem: false,
|
|
31
|
+
hasUtensilsSystem: false,
|
|
32
|
+
hasFreeShippingSystem: false,
|
|
33
|
+
hasCommentSystem: false,
|
|
34
|
+
hasSubscriptionSystem: false,
|
|
35
|
+
hasSubtotal: true,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
order: {
|
|
39
|
+
hasReorder: true,
|
|
40
|
+
hasReview: true,
|
|
41
|
+
hasQty: true,
|
|
42
|
+
hasSubtotal: true,
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
cart: {
|
|
46
|
+
showShopLinks: true,
|
|
47
|
+
item: {
|
|
48
|
+
edit: { item: false, list: false, mode: 'url' as const },
|
|
49
|
+
remove: true,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
checkout: {
|
|
54
|
+
abandonPaymentEndpoint: null,
|
|
55
|
+
hideInternalPayment: false,
|
|
56
|
+
paymentPlacement: 'review' as const,
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
/** Same shape as UserProvider userIntegration — optional duplicate for reference */
|
|
60
|
+
userIntegration: null as UserIntegrationConfig | null,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* button: {
|
|
64
|
+
* auth: createAccountButtonEntry(Button, 'auth', { btnType: 'primary' }),
|
|
65
|
+
* form: createAccountButtonEntry(Button, 'form', { btnType: 'primary' }),
|
|
66
|
+
* checkout: createAccountButtonEntry(Button, 'checkout', { btnType: 'primary' }),
|
|
67
|
+
* },
|
|
68
|
+
*/
|
|
69
|
+
button: {},
|
|
70
|
+
|
|
71
|
+
/** import { addressFormFields } from './address.config' */
|
|
72
|
+
addressFormFields: null,
|
|
73
|
+
addressFormFieldsShipping: null,
|
|
74
|
+
addressFormFieldsBilling: null,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type AccountProviderConfig = typeof accountProviderConfig;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FormBuilder field configs for AddressProvider / account address screens.
|
|
3
|
+
* Pass to AccountProvider as addressFormFields (and optionally shipping/billing variants).
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/weareconceptstudio/cs-dev-hub — form package field schema
|
|
6
|
+
*/
|
|
7
|
+
export const addressFormFields = [
|
|
8
|
+
{
|
|
9
|
+
fieldType: 'input',
|
|
10
|
+
labelProps: {
|
|
11
|
+
label: 'account.address_management.firstName',
|
|
12
|
+
name: 'first_name',
|
|
13
|
+
},
|
|
14
|
+
fieldProps: {
|
|
15
|
+
placeholder: 'account.address_management.firstNamePlaceholder',
|
|
16
|
+
},
|
|
17
|
+
rules: [{ required: true }],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
fieldType: 'input',
|
|
21
|
+
labelProps: {
|
|
22
|
+
label: 'account.address_management.lastName',
|
|
23
|
+
name: 'last_name',
|
|
24
|
+
},
|
|
25
|
+
fieldProps: {
|
|
26
|
+
placeholder: 'account.address_management.lastNamePlaceholder',
|
|
27
|
+
},
|
|
28
|
+
rules: [{ required: true }],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
fieldType: 'input',
|
|
32
|
+
labelProps: {
|
|
33
|
+
label: 'account.address_management.phone',
|
|
34
|
+
name: 'phone',
|
|
35
|
+
},
|
|
36
|
+
fieldProps: {
|
|
37
|
+
placeholder: 'account.address_management.phonePlaceholder',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
fieldType: 'input',
|
|
42
|
+
labelProps: {
|
|
43
|
+
label: 'account.address_management.address',
|
|
44
|
+
name: 'address',
|
|
45
|
+
},
|
|
46
|
+
fieldProps: {
|
|
47
|
+
placeholder: 'account.address_management.addressPlaceholder',
|
|
48
|
+
},
|
|
49
|
+
rules: [{ required: true }],
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
/** Use when shipping and billing need different fields */
|
|
54
|
+
export const addressFormFieldsShipping = null;
|
|
55
|
+
export const addressFormFieldsBilling = null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel file — re-export account config modules for your app.
|
|
3
|
+
* Generated by: npx account-init
|
|
4
|
+
*/
|
|
5
|
+
export { routesConfig } from './routes.config';
|
|
6
|
+
export { integrationsConfig } from './integrations.config';
|
|
7
|
+
export { userProviderConfig } from './user.config';
|
|
8
|
+
export { accountProviderConfig } from './account.config';
|
|
9
|
+
export {
|
|
10
|
+
addressFormFields,
|
|
11
|
+
addressFormFieldsShipping,
|
|
12
|
+
addressFormFieldsBilling,
|
|
13
|
+
} from './address.config';
|
|
14
|
+
|
|
15
|
+
import { routesConfig } from './routes.config';
|
|
16
|
+
import { integrationsConfig } from './integrations.config';
|
|
17
|
+
|
|
18
|
+
/** Full app config shape — extend with your site-specific routes */
|
|
19
|
+
const config = {
|
|
20
|
+
routes: routesConfig,
|
|
21
|
+
integrations: integrationsConfig,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default config;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API endpoint map for account, cart, checkout, and orders.
|
|
3
|
+
* Wire the same values into UserProvider userIntegration where applicable.
|
|
4
|
+
*/
|
|
5
|
+
export const integrationsConfig = {
|
|
6
|
+
account: {
|
|
7
|
+
currentUserEndpoint: 'current-user',
|
|
8
|
+
updateAccountEndpoint: 'update-account',
|
|
9
|
+
updatePasswordEndpoint: 'update-password',
|
|
10
|
+
logoutEndpoint: 'logout',
|
|
11
|
+
},
|
|
12
|
+
cart: {
|
|
13
|
+
getCartEndpoint: 'cart',
|
|
14
|
+
addItemEndpoint: 'toggle-cart-item',
|
|
15
|
+
removeItemEndpoint: 'delete-cart-item',
|
|
16
|
+
clearCartEndpoint: 'clear-cart',
|
|
17
|
+
},
|
|
18
|
+
checkout: {
|
|
19
|
+
checkoutEndpoint: 'checkout',
|
|
20
|
+
},
|
|
21
|
+
order: {
|
|
22
|
+
getOrdersEndpoint: 'orders',
|
|
23
|
+
getOrderEndpoint: 'orders',
|
|
24
|
+
reviewOrderEndpoint: 'order-review',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type IntegrationsConfig = typeof integrationsConfig;
|