@capillarytech/creatives-library 8.0.33 → 8.0.34-alpha.1

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.
@@ -110,4 +110,4 @@ export const BADGES_ISSUE = 'BADGES_ISSUE';
110
110
 
111
111
  export const CUSTOMER_BARCODE_TAG = "customer_barcode";
112
112
  export const COPY_OF = "Copy of";
113
- export const ENTRY_TRIGGER_TAG_REGEX = /\bentryTrigger_\w+(_\w+)?(\(\w+\))?/g;
113
+ export const ENTRY_TRIGGER_TAG_REGEX = /\bentryTrigger\.\w+(?:\.\w+)?(?:\(\w+\))?/g;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.33",
4
+ "version": "8.0.34-alpha.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -40,7 +40,7 @@ const initializeCreatives = () => {
40
40
  render(
41
41
  <Provider store={store}>
42
42
  <Router history={history}>
43
- <TemplatesV2 />
43
+ <TemplatesV2 authData={{'user': {'accessiblePermissions': ['CREATIVES_UI_VIEW']}}}/>
44
44
  </Router>
45
45
  </Provider>,
46
46
  );
@@ -124,12 +124,11 @@ describe("Creatives testing template creation", () => {
124
124
 
125
125
  //start of rcs template creation
126
126
  fireEvent.click(rcs);
127
- await waitFor(() => {
128
- const createButton = creativesScreen.findByRole('button', {
129
- name: /create new/i,
130
- });
131
- userEvent.click(createButton);
132
- }, { timeout: 50000, interval: 1000 });
127
+ const createButton = await creativesScreen.findByRole('button', {
128
+ name: /create new/i,
129
+ });
130
+ await waitFor(() => expect(createButton).toBeEnabled(),{timeout: 50000, interval: 500});
131
+ userEvent.click(createButton);
133
132
  // expect(await creativesScreen.findByText(/Creative name/i, undefined, {timeout: 10000})).toBeInTheDocument();
134
133
  const templateNameInput = await creativesScreen.findByTestId(
135
134
  /template_name/,
@@ -184,6 +183,7 @@ describe("Creatives testing template creation", () => {
184
183
  const createButton = creativesScreen.getByRole('button', {
185
184
  name: /create new/i,
186
185
  });
186
+ await waitFor(() => expect(createButton).toBeEnabled(),{ timeout: 50000, interval: 500 });
187
187
  await userEvent.click(createButton);
188
188
  const templateNameInput = await creativesScreen.findByTestId(
189
189
  /template_name/,
@@ -257,6 +257,7 @@ describe("Creatives testing template creation", () => {
257
257
  const createButton = creativesScreen.getByRole('button', {
258
258
  name: /create new/i,
259
259
  });
260
+ await waitFor(() => expect(createButton).toBeEnabled(),{ timeout: 50000, interval: 500 });
260
261
  await userEvent.click(createButton);
261
262
  const doneButton = creativesScreen.getByRole('button', {
262
263
  name: globalMessages.done.defaultMessage,
@@ -365,9 +366,11 @@ describe("Creatives testing template creation", () => {
365
366
 
366
367
  // navigating to Viber channel
367
368
  await userEvent.click(LineTab);
368
- const createButton = creativesScreen.getByRole('button', {
369
+ const createButton = await creativesScreen.findByRole('button', {
369
370
  name: /create new/i,
370
371
  });
372
+
373
+ await waitFor(() => expect(createButton).toBeEnabled(),{ timeout: 50000, interval: 500 });
371
374
  fireEvent.click(createButton);
372
375
  const doneButton = creativesScreen.getByRole('button', {
373
376
  name: globalMessages.done.defaultMessage,
@@ -203,7 +203,7 @@ const indexOfEnd = (targetString, string) => {
203
203
  }
204
204
 
205
205
  export const skipTags = (tag) => {
206
- // If the tag contains the word "entryTrigger_", then it's an event context tag and should not be skipped.
206
+ // If the tag contains the word "entryTrigger.", then it's an event context tag and should not be skipped.
207
207
  if (tag?.match(ENTRY_TRIGGER_TAG_REGEX)) {
208
208
  return false;
209
209
  }
@@ -51,7 +51,7 @@ describe("validateTags", () => {
51
51
  },
52
52
  ];
53
53
  it("should return valid response when all tags are present", () => {
54
- const content = "Hello {{tag1}}, {{tag2}}, {{tag3}} {{lifetimePurchases}}";
54
+ const content = "Hello {{tag1}}, {{tag2}}, {{tag3}} {{entryTrigger.lifetimePurchases}}";
55
55
 
56
56
  const injectedTagsParams = [];
57
57
  const location = { query: { module: "DEFAULT" } };
@@ -276,11 +276,11 @@ describe("checkSupport", () => {
276
276
 
277
277
  it("should return event context tags even if tagObject is empty", () => {
278
278
  const response = {
279
- data: [{ name: "tag1" }, { name: "lifetimePurchases" }],
279
+ data: [{ name: "tag1" }, { name: "entryTrigger.lifetimePurchases" }],
280
280
  };
281
281
  const tagObject = {};
282
282
  const result = checkSupport(response, tagObject, eventContextTags);
283
- expect(result).toEqual(['lifetimePurchases']);
283
+ expect(result).toEqual(['entryTrigger.lifetimePurchases']);
284
284
  });
285
285
 
286
286
  it("should return an array of supported tags", () => {
@@ -388,12 +388,12 @@ describe("checkSupport", () => {
388
388
 
389
389
  it("should not add childName to supportedList which does not have dot in eventContextTags", () => {
390
390
  // This case is unlikely to happen as we are not supporting tags without dot in eventContextTags
391
- const response = { data: [{ name: "entryTrigger_lifetimePoints", children: [{name: "userId"}] }]};
391
+ const response = { data: [{ name: "entryTrigger.lifetimePoints", children: [{name: "userId"}] }]};
392
392
  const tagObject = {};
393
- const eventContextTags = [{ tagName: "entryTrigger_lifetimePoints", children: [{name: "userId"}] }];
393
+ const eventContextTags = [{ tagName: "entryTrigger.lifetimePoints", children: [{name: "userId"}] }];
394
394
  const isLiquidFlow = true;
395
395
  const result = checkSupport(response, tagObject, eventContextTags, isLiquidFlow);
396
- expect(result).toEqual( [ "entryTrigger_lifetimePoints" ]);
396
+ expect(result).toEqual( [ "entryTrigger.lifetimePoints" ]);
397
397
  });
398
398
 
399
399
  it("should add only parent tag to supportedList if isLiquidFlow false", () => {
@@ -486,7 +486,7 @@ describe("getTagMapValue", () => {
486
486
 
487
487
  describe("skipTags", () => {
488
488
  it("should return false for event context tags", () => {
489
- const tag = "entryTrigger_uniqueTagPrefix(raindrops_match)";
489
+ const tag = "entryTrigger.uniqueTagPrefix(raindrops_match)";
490
490
  const result = skipTags(tag);
491
491
  expect(result).toEqual(false);
492
492
  });
@@ -1198,7 +1198,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1198
1198
  };
1199
1199
 
1200
1200
  skipTags(tag) {
1201
- // If the tag contains the word "entryTrigger_", then it's an event context tag and it should not be skipped.
1201
+ // If the tag contains the word "entryTrigger.", then it's an event context tag and it should not be skipped.
1202
1202
  if (tag?.match(ENTRY_TRIGGER_TAG_REGEX)) {
1203
1203
  return false;
1204
1204
  }
@@ -117,8 +117,8 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
117
117
  eventContextTags.forEach((tag) => {
118
118
  if (tag?.tagName) {
119
119
  eventContextTagsObj.EventContextTags.subtags[tag?.tagName] = {
120
- name: tag?.tagName,
121
- desc: tag?.tagName,
120
+ name: tag?.label,
121
+ desc: tag?.label,
122
122
  resolved: true
123
123
  }
124
124
  }
@@ -158,7 +158,8 @@ export const eventContextTags = [
158
158
  },
159
159
  "list": false
160
160
  },
161
- "tagName": "lifetimePurchases",
161
+ "tagName": "entryTrigger.lifetimePurchases",
162
+ label: 'lifetimePurchases',
162
163
  "isTaggable": true,
163
164
  "uniqueId": "yW_DH7vjKk__BEHAVIOURAL__monsoon",
164
165
  "isDynamicFact": false