Skip to content
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

Update Embedded requests to not need to pass userId or email #364

Merged
merged 32 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
48eb04b
OOTB Rework: Need to be pure JS/HTML/CSS
Apr 16, 2024
196c8ac
OOTB Rework: Need to be pure JS/HTML/CSS
Apr 16, 2024
a7baaaa
added id of all component
Apr 17, 2024
d2c0167
added custom changes
Apr 17, 2024
aef3186
fixed click issue
Apr 18, 2024
7c3cebe
fixed comments
Apr 18, 2024
f137931
handled click by elements name
Apr 19, 2024
5315f48
updated example
Apr 19, 2024
43176aa
fixed cursor pointer
Apr 19, 2024
bfcc08b
Update EmbeddedMsgs.tsx (sample code) to use EmbeddedMessageUpdateHan…
Apr 19, 2024
8c51ad2
HTTP call in retrieveEmbeddedMessages
Apr 22, 2024
093bb53
updated test file
Apr 22, 2024
7a3af76
fixed client's comments
Apr 22, 2024
6f61d83
Fixed comments
Apr 22, 2024
35fed19
Merge branch 'MOB-8135' of https://github.com/Iterable/iterable-web-s…
Apr 22, 2024
5f77192
updated click events as common
Apr 22, 2024
66bd67d
sdk and platform updated
Apr 23, 2024
2fc8613
updated test file
Apr 23, 2024
8f1fa68
Web SDK is incorrectly parsing custom action objects
Apr 23, 2024
86769df
updated listener name and handle callback
Apr 23, 2024
2123e85
Updated custom action object type
Apr 24, 2024
81070f2
HTTP call in retrieveEmbeddedMessages (#355)
hardikmashru Apr 25, 2024
b7af256
Too many Embedded-related interfaces? (#359)
hardikmashru Apr 25, 2024
a38b12e
updated code in useeffect
Apr 26, 2024
f464797
Merge branch 'MOB-8135' into MOB-8142
hardikmashru Apr 26, 2024
f958875
pass package name and expose trackembeddedclick as standalone function
hardikmashru Apr 26, 2024
b217d19
Merge remote-tracking branch 'origin/MOB-8142' into MOB-8140
hardikmashru Apr 26, 2024
8ec3218
Update Embedded requests to not need to pass userId or email
Apr 29, 2024
acee117
removed unused code from test
Apr 29, 2024
6af3e9b
Updated endpoints in setUserId and setEmail
Apr 29, 2024
fb8ba30
added impression endpoint
hardikmashru Apr 29, 2024
7477a16
Merge remote-tracking branch 'origin/embedded-ga' into MOB-8373
hardikmashru Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/authorization/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export function initialize(
*/
if (
!!(config?.url || '').match(
/(users\/update)|(events\/trackInApp)|(events\/inAppConsume)|(events\/track)|(events\/click)|(events\/session)|(events\/dismiss)|(events\/received)/gim
/(users\/update)|(events\/trackInApp)|(events\/inAppConsume)|(events\/track)|(events\/click)|(events\/session)|(events\/dismiss)|(events\/impression)|(events\/received)/gim
)
) {
return {
Expand Down Expand Up @@ -273,7 +273,7 @@ export function initialize(
*/
if (
!!(config?.url || '').match(
/(users\/update)|(events\/trackInApp)|(events\/inAppConsume)|(events\/track)/gim
/(users\/update)|(events\/trackInApp)|(events\/inAppConsume)|(events\/track)|(events\/received)|(events\/impression)|(events\/click)/gim
)
) {
return {
Expand Down Expand Up @@ -308,7 +308,7 @@ export function initialize(
/*
endpoints that use _userId_ query param in GET requests
*/
if (!!(config?.url || '').match(/getMessages/gim)) {
if (!!(config?.url || '').match(/(getMessages)|(messages)/gim)) {
return {
...config,
params: {
Expand Down Expand Up @@ -666,7 +666,7 @@ export function initialize(
*/
if (
!!(config?.url || '').match(
/(users\/update)|(events\/trackInApp)|(events\/inAppConsume)|(events\/track)/gim
/(users\/update)|(events\/trackInApp)|(events\/inAppConsume)|(events\/track)|(events\/received)|(events\/impression)|(events\/click)/gim
)
) {
return {
Expand Down Expand Up @@ -701,7 +701,7 @@ export function initialize(
/*
endpoints that use _userId_ query param in GET requests
*/
if (!!(config?.url || '').match(/getMessages/gim)) {
if (!!(config?.url || '').match(/(getMessages)|(messages)/gim)) {
return {
...config,
params: {
Expand Down
7 changes: 2 additions & 5 deletions src/embedded/embeddedManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
import { IterableEmbeddedMessage } from './embeddedMessage';
import { EndPoints } from 'src/events/consts';
import { trackEmbeddedMessageClickSchema } from 'src/events/embedded/events.schema';
import { functions } from 'src/utils/functions';

export class EmbeddedManager {
private messages: IEmbeddedMessageData[] = [];
Expand All @@ -41,8 +40,7 @@ export class EmbeddedManager {
) {
try {
let url = `${embedded_msg_endpoint}?`;
let params: any = {};
params = functions.addEmailOrUserIdToJson(params, localStorage);
const params: any = {};
if (placementIds.length > 0) {
params.placementIds = placementIds
.map((id) => `&placementIds=${id}`)
Expand Down Expand Up @@ -116,9 +114,8 @@ export class EmbeddedManager {
this.notifyUpdateDelegates();
}
for (let i = 0; i < msgsList.length; i++) {
let messages = {} as IEmbeddedMessageData;
const messages = {} as IEmbeddedMessageData;
messages.messageId = msgsList[i].metadata.messageId;
messages = functions.addEmailOrUserIdToJson(messages, localStorage);
await trackEmbeddedMessageReceived(messages);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/events/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
embaddedMessagingSessionSchema
} from './events.schema';
import { EndPoints } from './consts';
import { functions } from 'src/utils/functions';

export const track = (payload: InAppTrackRequestParams) => {
/* a customer could potentially send these up if they're not using TypeScript */
Expand Down Expand Up @@ -54,7 +53,7 @@ export const trackEmbeddedMessageReceived = (payload: IEmbeddedMessage) => {
};

export const trackEmbeddedClick = (payload: EmbeddedTrackClick) => {
let data: any = {
const data: any = {
messageId: payload.messageId,
buttonIdentifier: payload.buttonIdentifier,
targetUrl: payload.clickedUrl,
Expand All @@ -65,7 +64,6 @@ export const trackEmbeddedClick = (payload: EmbeddedTrackClick) => {
},
createdAt: Date.now()
};
data = functions.addEmailOrUserIdToJson(data, localStorage);

return baseIterableRequest<IterableResponse>({
method: 'POST',
Expand Down
Loading