@designcrowd/library.brand-page 5.17.2-kp-1 → 5.17.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.
- package/lib/src/{CreatedOnBrandCrowd-de-de-CG7ZzREd.js → CreatedOnBrandCrowd-de-de-DVbX019x.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-DXcXQQhU.js → CreatedOnBrandCrowd-en-us-U7ZUILmi.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-Cg8XQYlG.js → CreatedOnBrandCrowd-es-es-D97zjmv_.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-nuQ_cwI6.js → CreatedOnBrandCrowd-fr-ca-BuOAG7-D.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-nuQ_cwI6.js → CreatedOnBrandCrowd-fr-fr-BuOAG7-D.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-9fam1Z_0.js → CreatedOnBrandCrowd-pt-br-DMTRsNBz.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-9fam1Z_0.js → CreatedOnBrandCrowd-pt-pt-DMTRsNBz.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-DzNnnDyq.js → CreatedOnDcom-de-de-B_jbp2ga.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-F2hOKuog.js → CreatedOnDcom-en-us-DQQQhn-z.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-B5fRGCRL.js → CreatedOnDcom-es-es-q3MzWO6e.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-BDOUholJ.js → CreatedOnDcom-fr-ca-Bep30mu7.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-CrFCcMke.js → CreatedOnDcom-fr-fr-DTF8Zzzc.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DiJIDL9S.js → CreatedOnDcom-pt-br-ByR1GU2L.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-Dkl3NmII.js → CreatedOnDcom-pt-pt-A0L4zTr0.js} +1 -1
- package/lib/src/brand-page/clients/brand-page.client.d.ts +1 -2
- package/lib/src/brand-page/clients/brand-page.client.js +0 -1
- package/lib/src/brand-page/components/payment/RequestPaymentStripe.mixin.d.ts +106 -0
- package/lib/src/brand-page/components/payment/RequestPaymentStripe.mixin.js +253 -0
- package/lib/src/brand-page/models/payment.model.d.ts +0 -42
- package/lib/src/brand-page/models/payment.model.js +0 -9
- package/lib/src/brand-page/utils/view-model.util.js +0 -1
- package/lib/src/brand-page/view-models.d.ts +0 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +0 -1
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +0 -2
- package/lib/src/brand-page-maker/composables/useEventTracker.js +0 -6
- package/lib/src/brand-page-maker/constants/config-settings-constant.d.ts +0 -1
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +0 -7
- package/lib/src/brand-page-maker/models/content-settings.js +0 -1
- package/lib/src/bundled-translations-B6qZE8LU.js +169 -0
- package/lib/src/bundled-translations.de-DE-CsU6YsZb.js +169 -0
- package/lib/src/bundled-translations.es-ES-unPBdcJx.js +169 -0
- package/lib/src/bundled-translations.fr-CA-Dpa2wEtC.js +169 -0
- package/lib/src/bundled-translations.fr-FR-BPloaUjN.js +169 -0
- package/lib/src/bundled-translations.pt-BR-CFRGdaDO.js +169 -0
- package/lib/src/bundled-translations.pt-PT-BHVYCE0K.js +169 -0
- package/lib/src/bundles/bundled-translations.de-DE.json +1 -965
- package/lib/src/bundles/bundled-translations.es-ES.json +1 -965
- package/lib/src/bundles/bundled-translations.fr-CA.json +1 -965
- package/lib/src/bundles/bundled-translations.fr-FR.json +1 -965
- package/lib/src/bundles/bundled-translations.json +1 -965
- package/lib/src/bundles/bundled-translations.pt-BR.json +1 -965
- package/lib/src/bundles/bundled-translations.pt-PT.json +1 -965
- package/lib/src/composables/useTranslate.d.ts +1 -7
- package/lib/src/composables/useTranslate.js +1 -9
- package/lib/src/css/library.brand-page-brandCrowd.min.css +14 -33
- package/lib/src/css/library.brand-page-brandPage.min.css +14 -33
- package/lib/src/css/library.brand-page-designCom.min.css +14 -33
- package/lib/src/css/library.brand-page-preview.min.css +14 -33
- package/lib/src/index.mjs +87 -88
- package/lib/src/{lib-DfRSCxHW.js → lib-CvEpWvWA.js} +19016 -19214
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +0 -1
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +0 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +0 -1
- package/lib/src/shared/content-settings/components/payment-config-field/payment-toggle-field/PaymentToggleField.mixin.d.ts +1 -13
- package/lib/src/shared/content-settings/components/payment-config-field/payment-toggle-field/PaymentToggleField.mixin.js +0 -10
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +1 -2
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +0 -1
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +0 -1
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +0 -1
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +0 -1
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +1 -2
- package/package.json +1 -1
- package/src/brand-page/clients/brand-page.client.ts +0 -3
- package/src/brand-page/components/payment/RequestPaymentStripe.mixin.ts +364 -0
- package/src/brand-page/components/payment/RequestPaymentStripe.vue +44 -381
- package/src/brand-page/components/shop/PaymentModal.vue +1 -7
- package/src/brand-page/components/shop/Shop.vue +0 -1
- package/src/brand-page/models/payment.model.ts +0 -24
- package/src/brand-page/utils/view-model.util.ts +0 -1
- package/src/brand-page/view-models.ts +0 -1
- package/src/brand-page-maker/composables/useEventTracker.ts +0 -6
- package/src/brand-page-maker/constants/config-settings-constant.ts +0 -8
- package/src/brand-page-maker/models/content-settings.ts +0 -1
- package/src/bundles/bundled-translations.de-DE.json +1 -965
- package/src/bundles/bundled-translations.es-ES.json +1 -965
- package/src/bundles/bundled-translations.fr-CA.json +1 -965
- package/src/bundles/bundled-translations.fr-FR.json +1 -965
- package/src/bundles/bundled-translations.json +1 -965
- package/src/bundles/bundled-translations.pt-BR.json +1 -965
- package/src/bundles/bundled-translations.pt-PT.json +1 -965
- package/src/composables/useTranslate.ts +0 -15
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.de-DE.json +1 -3
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.es-ES.json +1 -3
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-CA.json +1 -3
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-FR.json +1 -3
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +1 -3
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-BR.json +1 -3
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-PT.json +1 -3
- package/src/shared/content-settings/components/payment-config-field/payment-toggle-field/PaymentToggleField.mixin.ts +0 -12
- package/src/shared/content-settings/components/payment-config-field/payment-toggle-field/PaymentToggleField.vue +1 -9
- package/lib/src/bundled-translations-D5A4swr0.js +0 -173
- package/lib/src/bundled-translations.de-DE-Bq6H28Hz.js +0 -173
- package/lib/src/bundled-translations.es-ES-Bo-UGy51.js +0 -173
- package/lib/src/bundled-translations.fr-CA-7GXawEcN.js +0 -173
- package/lib/src/bundled-translations.fr-FR-DzVwt2U-.js +0 -173
- package/lib/src/bundled-translations.pt-BR-DSZZ-i-B.js +0 -173
- package/lib/src/bundled-translations.pt-PT-SNbEX0GM.js +0 -173
- package/src/brand-page/components/shop/PaymentShippingAddress.vue +0 -297
- package/src/brand-page/components/shop/i18n/countries.de-DE.json +0 -240
- package/src/brand-page/components/shop/i18n/countries.es-ES.json +0 -240
- package/src/brand-page/components/shop/i18n/countries.fr-CA.json +0 -240
- package/src/brand-page/components/shop/i18n/countries.fr-FR.json +0 -240
- package/src/brand-page/components/shop/i18n/countries.json +0 -240
- package/src/brand-page/components/shop/i18n/countries.pt-BR.json +0 -240
- package/src/brand-page/components/shop/i18n/countries.pt-PT.json +0 -240
- package/src/brand-page/components/shop/i18n/payment-shipping-address.de-DE.json +0 -18
- package/src/brand-page/components/shop/i18n/payment-shipping-address.es-ES.json +0 -18
- package/src/brand-page/components/shop/i18n/payment-shipping-address.fr-CA.json +0 -18
- package/src/brand-page/components/shop/i18n/payment-shipping-address.fr-FR.json +0 -18
- package/src/brand-page/components/shop/i18n/payment-shipping-address.json +0 -18
- package/src/brand-page/components/shop/i18n/payment-shipping-address.pt-BR.json +0 -18
- package/src/brand-page/components/shop/i18n/payment-shipping-address.pt-PT.json +0 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateCartResult, CreateStripePaymentIntentResponse
|
|
1
|
+
import type { CreateCartResult, CreateStripePaymentIntentResponse } from '../models';
|
|
2
2
|
export interface FormResult {
|
|
3
3
|
success: boolean;
|
|
4
4
|
errMessage?: string;
|
|
@@ -31,7 +31,6 @@ declare const _default: {
|
|
|
31
31
|
customerEmail: string;
|
|
32
32
|
customerRequestDetails?: string | undefined;
|
|
33
33
|
customerMessage?: string | undefined;
|
|
34
|
-
shippingDetails?: StripeShippingDetails | undefined;
|
|
35
34
|
}) => Promise<CreateStripePaymentIntentResponse | null>;
|
|
36
35
|
};
|
|
37
36
|
export default _default;
|
|
@@ -99,7 +99,6 @@ const createStripePaymentIntent = async (request) => {
|
|
|
99
99
|
customerEmail: request.customerEmail,
|
|
100
100
|
customerRequestDetails: request.customerRequestDetails,
|
|
101
101
|
customerMessage: request.customerMessage,
|
|
102
|
-
shipping: request.shippingDetails,
|
|
103
102
|
}, {
|
|
104
103
|
headers: {
|
|
105
104
|
'Content-Type': 'application/json',
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { BrandPagePaymentConfig, ButtonStyles, CheckoutInformation, CreateCartResult, StripePaymentIntent } from '@brand-page/models';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
Stripe?: stripe.StripeStatic;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
interface RequestPaymentStripeData {
|
|
9
|
+
cardCvcElement: stripe.elements.Element | undefined;
|
|
10
|
+
cardCvcElementError: stripe.Error | undefined;
|
|
11
|
+
cardExpiryElement: stripe.elements.Element | undefined;
|
|
12
|
+
cardExpiryElementError: stripe.Error | undefined;
|
|
13
|
+
cardNumberElement: stripe.elements.Element | undefined;
|
|
14
|
+
cardNumberElementError: stripe.Error | undefined;
|
|
15
|
+
emailAddress: string | undefined;
|
|
16
|
+
emailAddressError: Error | undefined;
|
|
17
|
+
isBusy: boolean;
|
|
18
|
+
isCardCvcValid: boolean;
|
|
19
|
+
isCardExpiryValid: boolean;
|
|
20
|
+
isCardNumberValid: boolean;
|
|
21
|
+
isInitialised: boolean;
|
|
22
|
+
stripe: stripe.Stripe | undefined;
|
|
23
|
+
submitButtonMessage: string;
|
|
24
|
+
submitError: Error | stripe.Error | undefined;
|
|
25
|
+
}
|
|
26
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
27
|
+
cart: {
|
|
28
|
+
type: PropType<CreateCartResult<StripePaymentIntent>>;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
checkoutInformation: {
|
|
32
|
+
type: PropType<CheckoutInformation>;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
buttonStyles: {
|
|
36
|
+
type: PropType<ButtonStyles>;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
paymentConfig: {
|
|
40
|
+
type: PropType<BrandPagePaymentConfig>;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
stripePublishableKey: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
productName: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
required: false;
|
|
50
|
+
};
|
|
51
|
+
isShop: {
|
|
52
|
+
type: BooleanConstructor;
|
|
53
|
+
required: false;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
}>, {}, RequestPaymentStripeData, {
|
|
57
|
+
amount(): string;
|
|
58
|
+
currencyCode(): string;
|
|
59
|
+
currencySymbol(): string;
|
|
60
|
+
isStripeElementFormComplete(): boolean;
|
|
61
|
+
isSubmitButtonEnabled(): boolean;
|
|
62
|
+
arrowStyle(): BrandPageCssStyle;
|
|
63
|
+
payButtonStyle(): BrandPageCssStyle;
|
|
64
|
+
containerStyle(): BrandPageCssStyle;
|
|
65
|
+
}, {
|
|
66
|
+
initialiseStripeScript(): void;
|
|
67
|
+
initStripeElements(): void;
|
|
68
|
+
onBackClick(): void;
|
|
69
|
+
onEmailAddressEvent(): void;
|
|
70
|
+
onStripeElementChange(response?: stripe.elements.ElementChangeResponse): void;
|
|
71
|
+
onSubmitPaymentClick(): Promise<void>;
|
|
72
|
+
validateEmailAddress(): void;
|
|
73
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
74
|
+
cart: {
|
|
75
|
+
type: PropType<CreateCartResult<StripePaymentIntent>>;
|
|
76
|
+
required: true;
|
|
77
|
+
};
|
|
78
|
+
checkoutInformation: {
|
|
79
|
+
type: PropType<CheckoutInformation>;
|
|
80
|
+
required: true;
|
|
81
|
+
};
|
|
82
|
+
buttonStyles: {
|
|
83
|
+
type: PropType<ButtonStyles>;
|
|
84
|
+
required: true;
|
|
85
|
+
};
|
|
86
|
+
paymentConfig: {
|
|
87
|
+
type: PropType<BrandPagePaymentConfig>;
|
|
88
|
+
required: true;
|
|
89
|
+
};
|
|
90
|
+
stripePublishableKey: {
|
|
91
|
+
type: StringConstructor;
|
|
92
|
+
required: true;
|
|
93
|
+
};
|
|
94
|
+
productName: {
|
|
95
|
+
type: StringConstructor;
|
|
96
|
+
required: false;
|
|
97
|
+
};
|
|
98
|
+
isShop: {
|
|
99
|
+
type: BooleanConstructor;
|
|
100
|
+
required: false;
|
|
101
|
+
default: boolean;
|
|
102
|
+
};
|
|
103
|
+
}>> & Readonly<{}>, {
|
|
104
|
+
isShop: boolean;
|
|
105
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
106
|
+
export default _default;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { defineComponent } from 'vue';
|
|
2
|
+
import validator from 'validator';
|
|
3
|
+
import { debug, debugError } from '../../../utils/debug.util';
|
|
4
|
+
import * as constants from '../../constants';
|
|
5
|
+
import { requestPaymentStripeTr } from '@src/composables/useTranslate';
|
|
6
|
+
import brandPageClient from '../../clients/brand-page.client';
|
|
7
|
+
const INVALID_EMAIL_MESSAGE = () => requestPaymentStripeTr('invalidEmailMessage');
|
|
8
|
+
const STRIPE_SCRIPT_URL = 'https://js.stripe.com/v3/';
|
|
9
|
+
const SCRIPT_TAG_NAME = 'SCRIPT';
|
|
10
|
+
const centsToDollars = (cents) => {
|
|
11
|
+
return cents / 100;
|
|
12
|
+
};
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
props: {
|
|
15
|
+
cart: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
checkoutInformation: {
|
|
20
|
+
type: Object,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
buttonStyles: {
|
|
24
|
+
type: Object,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
paymentConfig: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
stripePublishableKey: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
productName: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
},
|
|
39
|
+
isShop: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
required: false,
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
cardCvcElement: undefined,
|
|
48
|
+
cardCvcElementError: undefined,
|
|
49
|
+
cardExpiryElement: undefined,
|
|
50
|
+
cardExpiryElementError: undefined,
|
|
51
|
+
cardNumberElement: undefined,
|
|
52
|
+
cardNumberElementError: undefined,
|
|
53
|
+
emailAddress: undefined,
|
|
54
|
+
emailAddressError: undefined,
|
|
55
|
+
isBusy: false,
|
|
56
|
+
isCardCvcValid: false,
|
|
57
|
+
isCardExpiryValid: false,
|
|
58
|
+
isCardNumberValid: false,
|
|
59
|
+
isInitialised: false,
|
|
60
|
+
stripe: undefined,
|
|
61
|
+
submitButtonMessage: 'Pay',
|
|
62
|
+
submitError: undefined,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
amount() {
|
|
67
|
+
return centsToDollars(this.cart.totalAmount).toFixed(2) || '';
|
|
68
|
+
},
|
|
69
|
+
currencyCode() {
|
|
70
|
+
return this.paymentConfig?.defaultCurrency || '';
|
|
71
|
+
},
|
|
72
|
+
currencySymbol() {
|
|
73
|
+
return this.paymentConfig?.defaultCurrencySymbol || '$';
|
|
74
|
+
},
|
|
75
|
+
isStripeElementFormComplete() {
|
|
76
|
+
return (this.isCardCvcValid && this.isCardExpiryValid && this.isCardNumberValid);
|
|
77
|
+
},
|
|
78
|
+
isSubmitButtonEnabled() {
|
|
79
|
+
return (this.isInitialised &&
|
|
80
|
+
this.isStripeElementFormComplete &&
|
|
81
|
+
Boolean(this.emailAddress) &&
|
|
82
|
+
!this.emailAddressError &&
|
|
83
|
+
!this.isBusy);
|
|
84
|
+
},
|
|
85
|
+
arrowStyle() {
|
|
86
|
+
return {
|
|
87
|
+
color: this.buttonStyles.style?.color,
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
payButtonStyle() {
|
|
91
|
+
if (!this.buttonStyles || !this.buttonStyles.style) {
|
|
92
|
+
return { ...this.buttonStyles };
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
...this.buttonStyles.style,
|
|
96
|
+
color: this.buttonStyles.style.backgroundColor,
|
|
97
|
+
backgroundColor: this.buttonStyles.style.color,
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
containerStyle() {
|
|
101
|
+
const buttonStyle = { ...this.buttonStyles?.style };
|
|
102
|
+
return {
|
|
103
|
+
color: buttonStyle.color,
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
mounted() {
|
|
108
|
+
this.initialiseStripeScript();
|
|
109
|
+
this.initStripeElements();
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
initialiseStripeScript() {
|
|
113
|
+
debug('initialiseStripeScript: start');
|
|
114
|
+
const stripeScript = Array.from(document.head.children).find((c) => {
|
|
115
|
+
return (c.tagName.toUpperCase() === SCRIPT_TAG_NAME &&
|
|
116
|
+
c.hasAttribute('src') &&
|
|
117
|
+
c.getAttribute('src') === STRIPE_SCRIPT_URL);
|
|
118
|
+
});
|
|
119
|
+
if (stripeScript) {
|
|
120
|
+
debug('initialiseStripeScript: script exists');
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const scriptElement = document.createElement(SCRIPT_TAG_NAME);
|
|
124
|
+
scriptElement.setAttribute('src', STRIPE_SCRIPT_URL);
|
|
125
|
+
scriptElement.setAttribute('async', '');
|
|
126
|
+
scriptElement.setAttribute('defer', '');
|
|
127
|
+
document.head.appendChild(scriptElement);
|
|
128
|
+
debug('initialiseStripeScript: script injected');
|
|
129
|
+
},
|
|
130
|
+
initStripeElements() {
|
|
131
|
+
if (!this.stripePublishableKey) {
|
|
132
|
+
debugError('initStripeElements: stripe publishable key undefined');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (typeof window.Stripe !== 'function') {
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
debug('initStripeElements: waiting for stripe script');
|
|
138
|
+
this.initStripeElements();
|
|
139
|
+
}, 250);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
debug('initStripeElements: start');
|
|
143
|
+
try {
|
|
144
|
+
this.stripe = window.Stripe(this.stripePublishableKey, {
|
|
145
|
+
stripeAccount: this.cart.paymentProviderExternalId,
|
|
146
|
+
});
|
|
147
|
+
const stripeElements = this.stripe.elements();
|
|
148
|
+
// card number
|
|
149
|
+
this.cardNumberElement = stripeElements.create('cardNumber', {
|
|
150
|
+
style: constants.stripeDefaultStyle,
|
|
151
|
+
placeholder: 'Credit Card Number',
|
|
152
|
+
});
|
|
153
|
+
this.cardNumberElement.mount(this.$refs.cardNumber);
|
|
154
|
+
this.cardNumberElement.addEventListener('change', this.onStripeElementChange);
|
|
155
|
+
// cart expiry
|
|
156
|
+
this.cardExpiryElement = stripeElements.create('cardExpiry', {
|
|
157
|
+
style: constants.stripeDefaultStyle,
|
|
158
|
+
placeholder: 'Expiry',
|
|
159
|
+
});
|
|
160
|
+
this.cardExpiryElement.mount(this.$refs.cardExpiry);
|
|
161
|
+
this.cardExpiryElement.addEventListener('change', this.onStripeElementChange);
|
|
162
|
+
// cart cvc
|
|
163
|
+
this.cardCvcElement = stripeElements.create('cardCvc', {
|
|
164
|
+
style: constants.stripeDefaultStyle,
|
|
165
|
+
placeholder: 'CVV',
|
|
166
|
+
});
|
|
167
|
+
this.cardCvcElement.mount(this.$refs.cardCvc);
|
|
168
|
+
this.cardCvcElement.addEventListener('change', this.onStripeElementChange);
|
|
169
|
+
this.isInitialised = true;
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
console.error(err);
|
|
173
|
+
}
|
|
174
|
+
debug('initStripeElements: end');
|
|
175
|
+
},
|
|
176
|
+
onBackClick() {
|
|
177
|
+
this.$emit('go-to-payment-option-selection');
|
|
178
|
+
},
|
|
179
|
+
onEmailAddressEvent() {
|
|
180
|
+
this.validateEmailAddress();
|
|
181
|
+
},
|
|
182
|
+
onStripeElementChange(response) {
|
|
183
|
+
if (!response) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
switch (response.elementType) {
|
|
187
|
+
case 'cardCvc':
|
|
188
|
+
this.isCardCvcValid = response.complete;
|
|
189
|
+
this.cardCvcElementError = response.error;
|
|
190
|
+
break;
|
|
191
|
+
case 'cardExpiry':
|
|
192
|
+
this.isCardExpiryValid = response.complete;
|
|
193
|
+
this.cardExpiryElementError = response.error;
|
|
194
|
+
break;
|
|
195
|
+
case 'cardNumber':
|
|
196
|
+
this.isCardNumberValid = response.complete;
|
|
197
|
+
this.cardNumberElementError = response.error;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
async onSubmitPaymentClick() {
|
|
202
|
+
if (!this.cardNumberElement ||
|
|
203
|
+
!this.isSubmitButtonEnabled ||
|
|
204
|
+
!this.stripe ||
|
|
205
|
+
!this.stripePublishableKey ||
|
|
206
|
+
!this.emailAddress) {
|
|
207
|
+
debugError('onSubmitPaymentClick: invalid operation');
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
this.isBusy = true;
|
|
211
|
+
try {
|
|
212
|
+
const paymentIntentResponse = await brandPageClient.createStripePaymentIntent({
|
|
213
|
+
cartId: this.cart.cartId,
|
|
214
|
+
customerEmail: this.emailAddress,
|
|
215
|
+
customerRequestDetails: this.checkoutInformation.customerRequestDetails,
|
|
216
|
+
customerMessage: this.checkoutInformation.customerMessage,
|
|
217
|
+
});
|
|
218
|
+
if (!paymentIntentResponse) {
|
|
219
|
+
this.submitError =
|
|
220
|
+
'Unable to create payment intent. Please try again.';
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const confirmCardPaymentResult = await this.stripe.confirmCardPayment(paymentIntentResponse.paymentIntent.client_secret, {
|
|
224
|
+
payment_method: {
|
|
225
|
+
card: this.cardNumberElement,
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
if (confirmCardPaymentResult.error) {
|
|
229
|
+
debugError(confirmCardPaymentResult.error);
|
|
230
|
+
this.submitError = confirmCardPaymentResult.error;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
debug('onSubmitPaymentClick: payment intent success');
|
|
234
|
+
this.$emit('success', { result: confirmCardPaymentResult });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
this.isBusy = false;
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
validateEmailAddress() {
|
|
242
|
+
if (!this.emailAddress) {
|
|
243
|
+
this.emailAddressError = new Error(INVALID_EMAIL_MESSAGE());
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (!validator.isEmail(this.emailAddress)) {
|
|
247
|
+
this.emailAddressError = new Error(INVALID_EMAIL_MESSAGE());
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.emailAddressError = undefined;
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
});
|
|
@@ -1,47 +1,6 @@
|
|
|
1
1
|
import type { Content } from './content.model';
|
|
2
2
|
import type { ProductModel } from './shop.model';
|
|
3
3
|
import type { TextStyleDeclaration } from './styles.model';
|
|
4
|
-
export declare const STRIPE_ADDRESS_LIMITS: {
|
|
5
|
-
readonly name: {
|
|
6
|
-
readonly min: 1;
|
|
7
|
-
readonly max: 350;
|
|
8
|
-
};
|
|
9
|
-
readonly line1: {
|
|
10
|
-
readonly min: 1;
|
|
11
|
-
readonly max: 200;
|
|
12
|
-
};
|
|
13
|
-
readonly line2: {
|
|
14
|
-
readonly min: 0;
|
|
15
|
-
readonly max: 200;
|
|
16
|
-
};
|
|
17
|
-
readonly city: {
|
|
18
|
-
readonly min: 0;
|
|
19
|
-
readonly max: 100;
|
|
20
|
-
};
|
|
21
|
-
readonly state: {
|
|
22
|
-
readonly min: 0;
|
|
23
|
-
readonly max: 100;
|
|
24
|
-
};
|
|
25
|
-
readonly postalCode: {
|
|
26
|
-
readonly min: 0;
|
|
27
|
-
readonly max: 20;
|
|
28
|
-
};
|
|
29
|
-
readonly country: {
|
|
30
|
-
readonly min: 2;
|
|
31
|
-
readonly max: 2;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export type StripeAddressField = keyof typeof STRIPE_ADDRESS_LIMITS;
|
|
35
|
-
export interface StripeShippingDetails {
|
|
36
|
-
name: string;
|
|
37
|
-
line1: string;
|
|
38
|
-
line2?: string;
|
|
39
|
-
city?: string;
|
|
40
|
-
state?: string;
|
|
41
|
-
postalCode?: string;
|
|
42
|
-
country: string;
|
|
43
|
-
phone?: string;
|
|
44
|
-
}
|
|
45
4
|
export interface StripePaymentIntent {
|
|
46
5
|
id: string;
|
|
47
6
|
object: 'payment_intent';
|
|
@@ -139,7 +98,6 @@ export interface ShopContentConfig extends PaymentConfig {
|
|
|
139
98
|
paymentOptionDisplayType: PaymentOptionDisplayType;
|
|
140
99
|
paymentOptionImageType: PaymentOptionImageType;
|
|
141
100
|
isCustomerRequestDetailsEnabled: boolean;
|
|
142
|
-
isShippingEnabled: boolean;
|
|
143
101
|
}
|
|
144
102
|
export interface ShopContent extends Content {
|
|
145
103
|
type: 'shop-section';
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export const STRIPE_ADDRESS_LIMITS = {
|
|
2
|
-
name: { min: 1, max: 350 },
|
|
3
|
-
line1: { min: 1, max: 200 },
|
|
4
|
-
line2: { min: 0, max: 200 },
|
|
5
|
-
city: { min: 0, max: 100 },
|
|
6
|
-
state: { min: 0, max: 100 },
|
|
7
|
-
postalCode: { min: 0, max: 20 },
|
|
8
|
-
country: { min: 2, max: 2 },
|
|
9
|
-
};
|
|
10
1
|
export const isStripePaymentIntent = (value) => {
|
|
11
2
|
return (value &&
|
|
12
3
|
typeof value === 'object' &&
|
|
@@ -544,7 +544,6 @@ const mapToShopViewModel = (content, styles) => {
|
|
|
544
544
|
...content.fillColor,
|
|
545
545
|
},
|
|
546
546
|
isFullWidth: true,
|
|
547
|
-
isShippingEnabled: content.shopPaymentConfig?.isShippingEnabled ?? false,
|
|
548
547
|
}, styles);
|
|
549
548
|
};
|
|
550
549
|
const mapToTestimonialSectionViewModel = (content, styles) => {
|
|
@@ -61,7 +61,6 @@ export interface RequestPaymentViewModel extends ContentViewModel, Omit<RequestP
|
|
|
61
61
|
export interface ShopViewModel extends ContentViewModel, Omit<ShopContent, 'type'> {
|
|
62
62
|
buttonStyles: ButtonStyles;
|
|
63
63
|
isFullWidth: boolean;
|
|
64
|
-
isShippingEnabled: boolean;
|
|
65
64
|
}
|
|
66
65
|
export interface ContactFormViewModel extends ContentViewModel, Omit<ContactFormContent, 'type'> {
|
|
67
66
|
buttonStyles: ButtonStyles;
|
|
@@ -1021,7 +1021,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1021
1021
|
searchTerm: string | undefined;
|
|
1022
1022
|
}): void;
|
|
1023
1023
|
_setSelectedTab({ tabName }: {
|
|
1024
|
-
tabName: "
|
|
1024
|
+
tabName: "all" | "AI" | "categories";
|
|
1025
1025
|
}): void;
|
|
1026
1026
|
_setSelectedCategory({ categoryName, }: {
|
|
1027
1027
|
categoryName: string | undefined;
|
package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts
CHANGED
|
@@ -1009,7 +1009,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
1009
1009
|
setPreviousSelectedDisplayStyle(viewport: string, displayStyle: string): void;
|
|
1010
1010
|
}>;
|
|
1011
1011
|
eventTracker: {
|
|
1012
|
-
sendShippingToggleEvent: (isEnabled: boolean) => void;
|
|
1013
1012
|
sendSaveContactEvent: () => void;
|
|
1014
1013
|
sendStartForFreeEvent: () => void;
|
|
1015
1014
|
sendFooterLinkClickEvent: (linkType: "watermark_logo" | "create_your_website") => void;
|
|
@@ -57,7 +57,6 @@ export declare const EVENTS: {
|
|
|
57
57
|
WEBSITE_MAKER_DIGITAL_BUSINESS_CARDS_SAVE_CONTACT_TOGGLE: string;
|
|
58
58
|
WEBSITE_MAKER_DIGITAL_BUSINESS_CARDS_HIDE_POPUP: string;
|
|
59
59
|
WEBSITE_MAKER_GETTY_VIDEO: string;
|
|
60
|
-
WEBSITE_MAKER_SHIPPING_TOGGLE: string;
|
|
61
60
|
};
|
|
62
61
|
export declare const SELECT_LOCATIONS: {
|
|
63
62
|
MAKER_PREVIEW: string;
|
|
@@ -116,7 +115,6 @@ export declare const PUBLISH_OPTION_MODAL_CONTINUATION_EVENTS: {
|
|
|
116
115
|
FREEMIUM: string;
|
|
117
116
|
};
|
|
118
117
|
declare const useEventTracker: () => {
|
|
119
|
-
sendShippingToggleEvent: (isEnabled: boolean) => void;
|
|
120
118
|
sendSaveContactEvent: () => void;
|
|
121
119
|
sendStartForFreeEvent: () => void;
|
|
122
120
|
sendFooterLinkClickEvent: (linkType: 'watermark_logo' | 'create_your_website') => void;
|
|
@@ -38,7 +38,6 @@ export const EVENTS = {
|
|
|
38
38
|
WEBSITE_MAKER_DIGITAL_BUSINESS_CARDS_SAVE_CONTACT_TOGGLE: 'website_maker_digital_business_cards_save_contact_toggle',
|
|
39
39
|
WEBSITE_MAKER_DIGITAL_BUSINESS_CARDS_HIDE_POPUP: 'website_maker_digital_business_cards_hide_popup',
|
|
40
40
|
WEBSITE_MAKER_GETTY_VIDEO: 'website_maker_getty_video',
|
|
41
|
-
WEBSITE_MAKER_SHIPPING_TOGGLE: 'website_maker_shipping_toggle',
|
|
42
41
|
};
|
|
43
42
|
export const SELECT_LOCATIONS = {
|
|
44
43
|
MAKER_PREVIEW: 'maker_preview',
|
|
@@ -316,11 +315,6 @@ const useEventTracker = () => {
|
|
|
316
315
|
},
|
|
317
316
|
...gettyVideoEvents,
|
|
318
317
|
...publishedWebsiteEvents,
|
|
319
|
-
sendShippingToggleEvent: (isEnabled) => {
|
|
320
|
-
_publishEvent(EVENTS.WEBSITE_MAKER_SHIPPING_TOGGLE, {
|
|
321
|
-
is_enabled: isEnabled,
|
|
322
|
-
});
|
|
323
|
-
},
|
|
324
318
|
};
|
|
325
319
|
};
|
|
326
320
|
export { useEventTracker };
|
|
@@ -48,7 +48,6 @@ export declare const DIVIDER_SECTION_SETTINGS_CONFIG: () => ContentSettingsConfi
|
|
|
48
48
|
export declare const SHAPES_SECTION_SETTINGS_CONFIG: () => ContentSettingsConfig<ShapesSectionContent>;
|
|
49
49
|
export declare const SHOP_SECTION_SETTINGS_CONFIG: () => ContentSettingsConfig<ShopContent, {
|
|
50
50
|
paymentConfig: any;
|
|
51
|
-
isShippingEnabled: boolean;
|
|
52
51
|
}>;
|
|
53
52
|
export declare const BOOKING_SECTION_SETTINGS_CONFIG: () => ContentSettingsConfig<BookingSectionContent>;
|
|
54
53
|
export declare const CONTENT_SETTINGS_CONFIGS: () => Record<ContentType, ContentSettingsConfig<any>>;
|
|
@@ -2573,13 +2573,6 @@ export const SHOP_SECTION_SETTINGS_CONFIG = () => ({
|
|
|
2573
2573
|
groupId: REQUEST_PAYMENT_GROUPS.settings,
|
|
2574
2574
|
overrideValueFieldName: 'shopPaymentConfig',
|
|
2575
2575
|
},
|
|
2576
|
-
isShippingEnabled: {
|
|
2577
|
-
type: 'payment-toggle',
|
|
2578
|
-
groupId: REQUEST_PAYMENT_GROUPS.settings,
|
|
2579
|
-
overrideValueFieldName: 'shopPaymentConfig',
|
|
2580
|
-
label: contentSettingsTr(`shippingLabel`),
|
|
2581
|
-
placeholder: contentSettingsTr(`shippingPlaceholder`),
|
|
2582
|
-
},
|
|
2583
2576
|
fillColor: {
|
|
2584
2577
|
type: 'color',
|
|
2585
2578
|
groupId: REQUEST_PAYMENT_GROUPS.style,
|