@bindu-dashing/dam-solution-v2 5.8.159 → 5.8.161

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.
@@ -43,20 +43,45 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
43
43
  setFetchingClientData(true);
44
44
  try {
45
45
  let fetchedData;
46
- // Prioritize brandId if available, otherwise use subdomain
47
- if (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.brandId) {
46
+ // TEMPORARY: Using static brandId for testing - remove after testing
47
+ let brandId = (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.brandId) || "68a2f214f7e91fbee730b0b9";
48
+ console.log("Edit mode - existingClientData:", existingClientData);
49
+ console.log("Using brandId:", brandId);
50
+ // If brandId is not provided, try to get it from subdomain first
51
+ if (!(existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.brandId) && (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain)) {
52
+ console.log("brandId not found, fetching by subdomain first:", existingClientData.subdomain);
53
+ try {
54
+ const subdomainResponse = yield api.get(`${FETCH_BRAND_USING_SUBDOMAIN}?subdomain=${existingClientData.subdomain}`);
55
+ const subdomainData = get(subdomainResponse, "data.data", {});
56
+ const extractedBrandId = get(subdomainData, "_id");
57
+ if (extractedBrandId) {
58
+ brandId = extractedBrandId;
59
+ console.log("Extracted brandId from subdomain response:", brandId);
60
+ }
61
+ }
62
+ catch (subdomainError) {
63
+ console.warn("Failed to fetch by subdomain, using static brandId:", subdomainError);
64
+ }
65
+ }
66
+ // Always use brands/details endpoint with brandId
67
+ if (brandId) {
68
+ console.log("Fetching brand details using brandId:", brandId);
69
+ console.log("API endpoint:", `/brands/details/${brandId}`);
48
70
  // Use reusable fetchBrandDetails function
49
- fetchedData = yield fetchBrandDetails(api, existingClientData.brandId);
71
+ fetchedData = yield fetchBrandDetails(api, brandId);
72
+ console.log("Fetched client data from brands/details:", fetchedData);
50
73
  }
51
74
  else if (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain) {
75
+ console.log("No brandId available, using subdomain endpoint:", existingClientData.subdomain);
52
76
  const response = yield api.get(`${FETCH_BRAND_USING_SUBDOMAIN}?subdomain=${existingClientData.subdomain}`);
53
77
  fetchedData = get(response, "data.data", {});
78
+ console.log("Fetched client data from subdomain:", fetchedData);
54
79
  }
55
80
  else {
81
+ console.warn("No brandId or subdomain provided");
56
82
  setFetchingClientData(false);
57
83
  return;
58
84
  }
59
- console.log("Fetched client data:", fetchedData);
60
85
  // Store client data in state
61
86
  setClientData(fetchedData);
62
87
  setTeamsFetched(false); // Reset teams fetched flag when new client data is loaded
@@ -92,7 +117,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
92
117
  }
93
118
  });
94
119
  fetchClientData();
95
- }, [isEditMode, existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.brandId, existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain, api]);
120
+ }, [isEditMode, existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.brandId, existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain, api, form]);
96
121
  const onFinish = (data) => __awaiter(void 0, void 0, void 0, function* () {
97
122
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
98
123
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.8.159",
3
+ "version": "5.8.161",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",