-
Notifications
You must be signed in to change notification settings - Fork 580
feat: message hover and click behavior and modal #2352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
036c47c
7f95638
f7d8c25
2330ed5
a1c3e13
8c7fadc
c6afc99
756b664
b403f93
1d640d7
3035a72
ec093f9
976ede2
41e2284
77500c6
6128e68
b7a2e29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ import { | |
getRenderedButtons, | ||
getButtonSize, | ||
getButtonExperiments, | ||
getModal, | ||
} from "./util"; | ||
|
||
export type ButtonsComponent = ZoidComponent<ButtonProps>; | ||
|
@@ -681,6 +682,101 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { | |
}, | ||
}, | ||
|
||
onMessageClick: { | ||
type: "function", | ||
required: false, | ||
value: ({ props }) => { | ||
return async ({ | ||
offerType, | ||
messageType, | ||
offerCountryCode, | ||
creditProductIdentifier, | ||
}) => { | ||
const { message, clientID, merchantID, currency, buttonSessionID } = | ||
props; | ||
const amount = message?.amount; | ||
|
||
getLogger() | ||
.info("button_message_click") | ||
.track({ | ||
[FPTI_KEY.TRANSITION]: "button_message_click", | ||
[FPTI_KEY.STATE]: "BUTTON_MESSAGE", | ||
[FPTI_KEY.CONTEXT_ID]: buttonSessionID, | ||
[FPTI_KEY.CONTEXT_TYPE]: "button_session_id", | ||
[FPTI_KEY.EVENT_NAME]: "message_click", | ||
// adding temp string here for our sdk constants | ||
button_message_offer_type: offerType, | ||
button_message_credit_product_identifier: | ||
creditProductIdentifier, | ||
button_message_type: messageType, | ||
button_message_position: message?.position, | ||
button_message_align: message?.align, | ||
button_message_color: message?.color, | ||
button_message_offer_country: offerCountryCode, | ||
button_message_amount: amount, | ||
[FPTI_KEY.BUTTON_SESSION_UID]: buttonSessionID, | ||
}); | ||
|
||
const modalInstance = await getModal(clientID, merchantID); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the error scenario inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do we do if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. Something as simple as |
||
return modalInstance?.show({ | ||
amount, | ||
offer: offerType, | ||
currency, | ||
}); | ||
}; | ||
}, | ||
}, | ||
|
||
onMessageHover: { | ||
type: "function", | ||
required: false, | ||
value: ({ props }) => { | ||
return () => { | ||
// offerType, messageType, offerCountryCode, and creditProductIdentifier are passed in and may be used in an upcoming message hover logging feature | ||
|
||
// lazy loads the modal, to be memoized and executed onMessageClick | ||
const { clientID, merchantID } = props; | ||
return getModal(clientID, merchantID); | ||
}; | ||
}, | ||
}, | ||
|
||
onMessageReady: { | ||
type: "function", | ||
required: false, | ||
value: ({ props }) => { | ||
return ({ | ||
offerType, | ||
messageType, | ||
offerCountryCode, | ||
creditProductIdentifier, | ||
}) => { | ||
const { message, buttonSessionID } = props; | ||
|
||
getLogger() | ||
.info("button_message_render") | ||
.track({ | ||
[FPTI_KEY.TRANSITION]: "button_message_render", | ||
[FPTI_KEY.STATE]: "BUTTON_MESSAGE", | ||
[FPTI_KEY.CONTEXT_ID]: buttonSessionID, | ||
[FPTI_KEY.CONTEXT_TYPE]: "button_session_id", | ||
[FPTI_KEY.EVENT_NAME]: "message_render", | ||
// adding temp string here for our sdk constants | ||
button_message_offer_type: offerType, | ||
button_message_credit_product_identifier: | ||
creditProductIdentifier, | ||
button_message_type: messageType, | ||
button_message_posiiton: message?.position, | ||
button_message_align: message?.align, | ||
button_message_color: message?.color, | ||
button_message_offer_country: offerCountryCode, | ||
button_message_amount: message?.amount, | ||
[FPTI_KEY.BUTTON_SESSION_UID]: buttonSessionID, | ||
}); | ||
}; | ||
}, | ||
}, | ||
|
||
onShippingAddressChange: { | ||
type: "function", | ||
required: false, | ||
|
Uh oh!
There was an error while loading. Please reload this page.