-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix/renaming api name #5
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes involve a comprehensive renaming of event handler properties and public methods in the Tawk Messenger component and service, as well as updates to the API documentation. The Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (5)
addon/services/tawk-messenger.js (1)
Line range hint
1-113
: Overall assessment: Changes successfully address the PR objective with one minor inconsistency.The changes in this file successfully address the PR objective of adding the "tawk" prefix to all API names to prevent naming collisions. All methods have been renamed consistently, with the exception of
tawkvisitor
which should betawkVisitor
for consistency.These changes introduce breaking changes to the API, as all method names have been modified. Please ensure that:
- The changelog is updated to reflect these breaking changes.
- The documentation is updated to reflect the new method names.
- Any code that uses these methods is updated accordingly.
To minimize the impact of these breaking changes, consider:
- Implementing a deprecation strategy where both old and new method names are supported for a transition period.
- Providing a migration guide for users of the library.
- Bumping the major version number of the package to indicate breaking changes, following semantic versioning principles.
addon/components/tawk-messenger.js (1)
Line range hint
1-183
: Summary: Comprehensive API renaming implemented successfully.The changes in this file successfully implement the PR objective of adding the "tawk" prefix to all event handler properties in the TawkMessengerComponent. This renaming enhances the API's uniqueness and mitigates the risk of naming collisions.
Key points:
- All event handler properties have been consistently renamed.
- The changes align with the PR objectives and are applied uniformly throughout the file.
- These modifications introduce breaking changes that will require updates in the application code.
Recommendations:
- Update the changelog to clearly communicate these breaking changes to users of the library.
- Provide migration guidelines in the documentation to assist users in updating their code.
- Consider bumping the major version number of the package to signal the breaking changes.
- Run the provided verification scripts across the entire codebase to ensure all usages of the old property names are updated.
- Update any relevant documentation, examples, or test cases that may be using the old property names.
By following these recommendations, you can ensure a smooth transition to the new API naming convention while minimizing potential issues for users of the library.
docs/api-reference.md (3)
Line range hint
443-455
: Minor improvement suggestion fortawkVisitor
explanation.The renaming of
visitor
totawkVisitor
is consistent with the overall strategy. However, to improve clarity, consider updating the first sentence of the explanation:-Object used to set the visitor name and email. +Object used to set the visitor name and email for the tawk.to chat widget.This change provides more context about the purpose of the
tawkVisitor
object.🧰 Tools
🪛 LanguageTool
[uncategorized] ~448-~448: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...ail will not be available on load time (eg single page app, ajax login), then use ...(E_G)
🪛 Markdownlint
448-448: null
Link fragments should be valid(MD051, link-fragments)
367-368
: Improve gender-neutral language.To make the documentation more inclusive, consider updating the following sentence:
-Callback function invoked when the visitor manually changes his name. +Callback function invoked when the visitor manually changes their name.This change uses gender-neutral language, which is more appropriate for a general audience.
🧰 Tools
🪛 LanguageTool
[style] ~368-~368: Since a “visitor” is neither male nor female, the better pronoun might be “their”.
Context: ...voked when the visitor manually changes his name. The visitorName is passed to the ...(SOMEBODY_NEUTRAL)
448-448
: Correct abbreviation usage.Please update the following text to use the correct abbreviation format:
-If the name and email will not be available on load time (eg single page app, ajax login), then use the [setAttributes](#setAttributes) function instead. +If the name and email will not be available on load time (e.g., single page app, ajax login), then use the [setAttributes](#setAttributes) function instead.This change ensures proper usage of the abbreviation "e.g." (exempli gratia).
🧰 Tools
🪛 LanguageTool
[uncategorized] ~448-~448: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...ail will not be available on load time (eg single page app, ajax login), then use ...(E_G)
🪛 Markdownlint
448-448: null
Link fragments should be valid(MD051, link-fragments)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- addon/components/tawk-messenger.js (1 hunks)
- addon/services/tawk-messenger.js (1 hunks)
- docs/api-reference.md (32 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/api-reference.md
[style] ~368-~368: Since a “visitor” is neither male nor female, the better pronoun might be “their”.
Context: ...voked when the visitor manually changes his name. The visitorName is passed to the ...(SOMEBODY_NEUTRAL)
[uncategorized] ~448-~448: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...ail will not be available on load time (eg single page app, ajax login), then use ...(E_G)
🪛 Markdownlint
docs/api-reference.md
448-448: null
Link fragments should be valid(MD051, link-fragments)
🔇 Additional comments (28)
addon/services/tawk-messenger.js (22)
16-18
: LGTM: Method renamed correctly.The method has been renamed from
maximize
totawkMaximize
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
20-22
: LGTM: Method renamed correctly.The method has been renamed from
minimize
totawkMinimize
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
24-26
: LGTM: Method renamed correctly.The method has been renamed from
toggle
totawkToggle
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
28-30
: LGTM: Method renamed correctly.The method has been renamed from
popup
totawkPopup
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
32-34
: LGTM: Method renamed correctly.The method has been renamed from
showWidget
totawkShowWidget
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
36-38
: LGTM: Method renamed correctly.The method has been renamed from
hideWidget
totawkHideWidget
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
40-42
: LGTM: Method renamed correctly.The method has been renamed from
toggleVisibility
totawkToggleVisibility
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
44-46
: LGTM: Method renamed correctly.The method has been renamed from
endChat
totawkEndChat
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
51-53
: LGTM: Method renamed correctly.The method has been renamed from
getWindowType
totawkGetWindowType
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
55-57
: LGTM: Method renamed correctly.The method has been renamed from
getStatus
totawkGetStatus
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
59-61
: LGTM: Method renamed correctly.The method has been renamed from
isChatMaximized
totawkIsChatMaximized
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
63-65
: LGTM: Method renamed correctly.The method has been renamed from
isChatMinimized
totawkIsChatMinimized
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
67-69
: LGTM: Method renamed correctly.The method has been renamed from
isChatHidden
totawkIsChatHidden
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
71-73
: LGTM: Method renamed correctly.The method has been renamed from
isChatOngoing
totawkIsChatOngoing
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
75-77
: LGTM: Method renamed correctly.The method has been renamed from
isVisitorEngaged
totawkIsVisitorEngaged
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
79-81
: LGTM: Method renamed correctly.The method has been renamed from
onLoaded
totawkOnLoaded
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
83-85
: LGTM: Method renamed correctly.The method has been renamed from
onBeforeLoaded
totawkOnBeforeLoaded
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
87-89
: LGTM: Method renamed correctly.The method has been renamed from
widgetPosition
totawkWidgetPosition
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
98-100
: LGTM: Method renamed correctly.The method has been renamed from
setAttributes
totawkSetAttributes
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
102-104
: LGTM: Method renamed correctly.The method has been renamed from
addEvent
totawkAddEvent
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
106-108
: LGTM: Method renamed correctly.The method has been renamed from
addTags
totawkAddTags
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.
110-112
: LGTM: Method renamed correctly.The method has been renamed from
removeTags
totawkRemoveTags
, which is consistent with the PR objective of adding the "tawk" prefix to all API names.addon/components/tawk-messenger.js (3)
70-71
: Approved: Consistent renaming of event handler.The renaming of
onStatusChange
totawkOnStatusChange
is consistent with the previous change and aligns with the PR objective.As mentioned in the previous comment, this is a breaking change. Please ensure that all usages of this component in the application are updated accordingly.
76-179
: Approved: Consistent renaming of all event handlers.All event handler properties have been consistently renamed by adding the "tawk" prefix, which aligns with the PR objective. This includes:
onBeforeLoad
totawkOnBeforeLoad
onChatMaximized
totawkOnChatMaximized
onChatMinimized
totawkOnChatMinimized
onChatHidden
totawkOnChatHidden
onChatStarted
totawkOnChatStarted
onChatEnded
totawkOnChatEnded
onPrechatSubmit
totawkOnPrechatSubmit
onOfflineSubmit
totawkOnOfflineSubmit
onChatMessageVisitor
totawkOnChatMessageVisitor
onChatMessageAgent
totawkOnChatMessageAgent
onChatMessageSystem
totawkOnChatMessageSystem
onAgentJoinChat
totawkOnAgentJoinChat
onAgentLeaveChat
totawkOnAgentLeaveChat
onChatSatisfaction
totawkOnChatSatisfaction
onVisitorNameChanged
totawkOnVisitorNameChanged
onFileUpload
totawkOnFileUpload
onTagsUpdated
totawkOnTagsUpdated
onUnreadCountChanged
totawkOnUnreadCountChanged
These changes enhance the uniqueness of the API and help prevent potential naming collisions.
As these are breaking changes, it's crucial to update all usages of this component in the application. Run the following script to check for any remaining usages of the old property names:
#!/bin/bash # Search for any remaining usage of the old property names old_properties=( "onBeforeLoad" "onChatMaximized" "onChatMinimized" "onChatHidden" "onChatStarted" "onChatEnded" "onPrechatSubmit" "onOfflineSubmit" "onChatMessageVisitor" "onChatMessageAgent" "onChatMessageSystem" "onAgentJoinChat" "onAgentLeaveChat" "onChatSatisfaction" "onVisitorNameChanged" "onFileUpload" "onTagsUpdated" "onUnreadCountChanged" ) for prop in "${old_properties[@]}"; do echo "Searching for usage of $prop:" rg --type=handlebars --type=javascript "$prop=[{]" -g '!addon/components/tawk-messenger.js' echo doneThis script will help identify any instances where the old property names are still being used, allowing for a comprehensive update of the application code.
64-65
: Approved: Event handler renamed as per PR objective.The renaming of
onLoad
totawkOnLoad
aligns with the PR objective of adding the "tawk" prefix to API names. This change enhances the uniqueness of the API and helps prevent potential naming collisions.Please note that this is a breaking change. Ensure that all usages of this component in the application are updated accordingly. Run the following script to check for any remaining usages of the old property name:
✅ Verification successful
Verified: All old event handler properties have been successfully renamed.
The search confirmed that there are no remaining usages of the old property names in the codebase. This ensures that the renaming from properties like
onLoad
totawkOnLoad
has been thoroughly applied without leaving any legacy references.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining usage of the old 'onLoad' property rg --type=handlebars --type=javascript 'onLoad=[{]' -g '!addon/components/tawk-messenger.js'Length of output: 5292
Script:
#!/bin/bash # Search for any remaining usage of old properties in JavaScript and Handlebars files old_properties=("onBeforeLoad" "onChatMaximized" "onChatMinimized" "onChatHidden" "onChatStarted" "onChatEnded" "onPrechatSubmit" "onOfflineSubmit" "onChatMessageVisitor" "onChatMessageAgent" "onChatMessageSystem" "onAgentJoinChat" "onAgentLeaveChat" "onChatSatisfaction" "onVisitorNameChanged" "onFileUpload" "onTagsUpdated" "onUnreadCountChanged") for prop in "${old_properties[@]}" do echo "Searching for usage of $prop:" rg "$prop=" -g '*.hbs' -g '*.js' -g '!addon/components/tawk-messenger.js' echo doneLength of output: 4302
Script:
#!/bin/bash # Search for any remaining usage of old properties in JavaScript and Handlebars files without exclusions old_properties=("onBeforeLoad" "onChatMaximized" "onChatMinimized" "onChatHidden" "onChatStarted" "onChatEnded" "onPrechatSubmit" "onOfflineSubmit" "onChatMessageVisitor" "onChatMessageAgent" "onChatMessageSystem" "onAgentJoinChat" "onAgentLeaveChat" "onChatSatisfaction" "onVisitorNameChanged" "onFileUpload" "onTagsUpdated" "onUnreadCountChanged") for prop in "${old_properties[@]}" do echo "Searching for usage of $prop:" rg "$prop=" -g '*.hbs' -g '*.js' echo doneLength of output: 3564
docs/api-reference.md (3)
13-55
: Table of contents updated correctly.The table of contents has been consistently updated with the new "tawk" prefix for all method names. This change aligns well with the PR objective of renaming API methods to prevent collisions.
Line range hint
460-922
: API methods consistently renamed and examples updated.All API methods have been correctly renamed with the "tawk" prefix, and the corresponding code examples have been updated to reflect these changes. This consistent renaming aligns with the PR objective and should help prevent naming collisions in the future.
Line range hint
936-941
: Secure mode example correctly updated.The
tawkVisitor
object is correctly used in the secure mode example, maintaining consistency with the renamed API.
Summary
There are users reported collision of provider keys since we use generic naming on our API. I added prefix tawk in all actions, getters, listeners, and setters.
Summary by CodeRabbit
New Features
Documentation