pb-sxp-ui 1.20.28 → 1.20.30

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.
Files changed (33) hide show
  1. package/dist/index.cjs +204 -50
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +204 -50
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +9 -9
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +9 -9
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +204 -50
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +9 -9
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/StructurePage/index.js +25 -12
  14. package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
  15. package/es/core/utils/materials.js +30 -7
  16. package/es/core/utils/tool.d.ts +1 -0
  17. package/es/core/utils/tool.js +43 -0
  18. package/es/materials/sxp/popup/AddToCart/index.js +27 -8
  19. package/es/materials/sxp/popup/AddToCart/index.new.js +27 -6
  20. package/es/materials/sxp/popup/AddToCart/index.old.js +13 -2
  21. package/es/materials/sxp/popup/CommodityDetail/index.js +21 -16
  22. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +25 -0
  23. package/lib/core/components/StructurePage/index.js +25 -12
  24. package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
  25. package/lib/core/utils/materials.js +29 -6
  26. package/lib/core/utils/tool.d.ts +1 -0
  27. package/lib/core/utils/tool.js +45 -1
  28. package/lib/materials/sxp/popup/AddToCart/index.js +27 -8
  29. package/lib/materials/sxp/popup/AddToCart/index.new.js +27 -6
  30. package/lib/materials/sxp/popup/AddToCart/index.old.js +12 -1
  31. package/lib/materials/sxp/popup/CommodityDetail/index.js +21 -16
  32. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +25 -0
  33. package/package.json +1 -1
@@ -37,7 +37,7 @@ const getBgStyleByImg = (data) => {
37
37
  };
38
38
  exports.getBgStyleByImg = getBgStyleByImg;
39
39
  const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
40
- var _a, _b, _c, _d, _e, _f, _g, _h;
40
+ var _a, _b, _c, _d, _e;
41
41
  let text = '';
42
42
  if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
43
43
  return null;
@@ -45,18 +45,41 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef
45
45
  if (typeof price !== 'number')
46
46
  return text;
47
47
  let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
48
- let currency = (product === null || product === void 0 ? void 0 : product.currency) ? (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : '' : '$';
48
+ let currencyCode = '';
49
+ if (product === null || product === void 0 ? void 0 : product.currency) {
50
+ const parts = product.currency.split('-');
51
+ if (parts.length > 1) {
52
+ const firstPart = parts[0].toUpperCase();
53
+ const secondPart = parts[1].toUpperCase();
54
+ if (/^[A-Z]{3}$/.test(firstPart)) {
55
+ currencyCode = firstPart;
56
+ }
57
+ else if (/^[A-Z]{3}$/.test(secondPart)) {
58
+ currencyCode = secondPart;
59
+ }
60
+ else {
61
+ currencyCode = firstPart;
62
+ }
63
+ }
64
+ else {
65
+ currencyCode = parts[0].toUpperCase();
66
+ }
67
+ }
68
+ else {
69
+ currencyCode = 'USD';
70
+ }
71
+ let currency = (0, tool_1.getCurrencySymbol)(currencyCode);
49
72
  const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
50
73
  let decPic = price === null || price === void 0 ? void 0 : price.toString();
51
74
  if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
52
75
  decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
53
76
  }
54
- let decInd = (_d = decPic === null || decPic === void 0 ? void 0 : decPic.indexOf('.')) !== null && _d !== void 0 ? _d : -1;
77
+ let decInd = (_a = decPic === null || decPic === void 0 ? void 0 : decPic.indexOf('.')) !== null && _a !== void 0 ? _a : -1;
55
78
  if (isToLocStr) {
56
79
  text =
57
- (_e = price === null || price === void 0 ? void 0 : price.toLocaleString('zh', {
80
+ (_b = price === null || price === void 0 ? void 0 : price.toLocaleString('zh', {
58
81
  minimumFractionDigits: (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? 2 : 0
59
- })) !== null && _e !== void 0 ? _e : '';
82
+ })) !== null && _b !== void 0 ? _b : '';
60
83
  let startIndex = 0;
61
84
  let endIndex = decInd !== null && decInd !== void 0 ? decInd : text === null || text === void 0 ? void 0 : text.length;
62
85
  if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === '.') {
@@ -86,7 +109,7 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef
86
109
  }
87
110
  });
88
111
  }
89
- currency = `<span style="font-family:${(_h = (_g = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol) === null || _f === void 0 ? void 0 : _f.fontFamily) !== null && _g !== void 0 ? _g : style === null || style === void 0 ? void 0 : style['fontFamily-en']) !== null && _h !== void 0 ? _h : 'inherit'}">${currency}</span>`;
112
+ currency = `<span style="font-family:${(_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol) === null || _c === void 0 ? void 0 : _c.fontFamily) !== null && _d !== void 0 ? _d : style === null || style === void 0 ? void 0 : style['fontFamily-en']) !== null && _e !== void 0 ? _e : 'inherit'}">${currency}</span>`;
90
113
  text = (0, tool_1.setFontForText)(text, style);
91
114
  if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
92
115
  text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
@@ -16,4 +16,5 @@ declare function splitUrlParams(urlParams: string): string[] | undefined;
16
16
  declare function deleteCookie(name: string, path?: string, domain?: string): void;
17
17
  declare function setCookie(name: string, value: string, days?: number, path?: string, domain?: string, secure?: boolean, sameSite?: string): void;
18
18
  declare function getUrlParamByKey(key: string): any;
19
+ export declare function getCurrencySymbol(currencyCode: string): string;
19
20
  export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getScreenReader, splitUrlParams, deleteCookie, setCookie, getUrlParamByKey };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUrlParamByKey = exports.setCookie = exports.deleteCookie = exports.splitUrlParams = exports.getScreenReader = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
3
+ exports.getUrlParamByKey = exports.setCookie = exports.deleteCookie = exports.splitUrlParams = exports.getScreenReader = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.getCurrencySymbol = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  function uuid(len, radix) {
6
6
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
@@ -250,3 +250,47 @@ function getUrlParamByKey(key) {
250
250
  return (_b = params[key]) !== null && _b !== void 0 ? _b : '';
251
251
  }
252
252
  exports.getUrlParamByKey = getUrlParamByKey;
253
+ function getCurrencySymbol(currencyCode) {
254
+ const currencySymbolMap = {
255
+ USD: '$',
256
+ EUR: '€',
257
+ GBP: '£',
258
+ JPY: '¥',
259
+ CNY: '¥',
260
+ KRW: '₩',
261
+ INR: '₹',
262
+ RUB: '₽',
263
+ BRL: 'R$',
264
+ CAD: 'CA$',
265
+ AUD: 'A$',
266
+ CHF: 'CHF',
267
+ SEK: 'kr',
268
+ NOK: 'kr',
269
+ DKK: 'kr',
270
+ PLN: 'zł',
271
+ THB: '฿',
272
+ IDR: 'Rp',
273
+ MYR: 'RM',
274
+ PHP: '₱',
275
+ SGD: 'S$',
276
+ HKD: 'HK$',
277
+ TWD: 'NT$',
278
+ NZD: 'NZ$',
279
+ MXN: 'MX$',
280
+ ZAR: 'R',
281
+ TRY: '₺',
282
+ AED: 'AED',
283
+ SAR: 'SAR',
284
+ ILS: '₪',
285
+ ARS: 'AR$',
286
+ CLP: 'CL$',
287
+ COP: 'CO$',
288
+ VND: '₫',
289
+ EGP: 'E£',
290
+ NGN: '₦',
291
+ PKR: '₨',
292
+ BDT: '৳',
293
+ };
294
+ return currencySymbolMap[currencyCode.toUpperCase()] || currencyCode;
295
+ }
296
+ exports.getCurrencySymbol = getCurrencySymbol;
@@ -4,10 +4,11 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const hooks_1 = require("../../../../core/hooks");
6
6
  const Modal_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/Modal"));
7
+ const tool_1 = require("../../../../core/utils/tool");
7
8
  require("./index.less");
8
9
  const AddToCartPopup = ({ isActive = true }) => {
9
10
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
10
- const { popupDetailData, globalConfig } = (0, hooks_1.useSxpDataSource)();
11
+ const { popupDetailData, globalConfig, bffFbReport } = (0, hooks_1.useSxpDataSource)();
11
12
  const [productData, setProductData] = (0, react_1.useState)(null);
12
13
  const [selectedOptions, setSelectedOptions] = (0, react_1.useState)({});
13
14
  const [selectedVariant, setSelectedVariant] = (0, react_1.useState)(null);
@@ -139,6 +140,17 @@ const AddToCartPopup = ({ isActive = true }) => {
139
140
  shopifyDomain,
140
141
  selectedVariant
141
142
  });
143
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
144
+ eventName: 'sessionCompleted',
145
+ product: product ? [product] : undefined,
146
+ contentType: 'product',
147
+ rec: data,
148
+ position: data === null || data === void 0 ? void 0 : data.index,
149
+ cta_text: 'Add To Cart',
150
+ cta_action_type: 'add_to_cart',
151
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
152
+ target_url: `https://${shopifyDomain}/cart/add`
153
+ });
142
154
  const params = new URLSearchParams({
143
155
  id: variantId,
144
156
  quantity: quantity.toString()
@@ -150,6 +162,9 @@ const AddToCartPopup = ({ isActive = true }) => {
150
162
  const totalPrice = selectedVariant
151
163
  ? (parseFloat(selectedVariant.price.amount) * quantity).toFixed(2)
152
164
  : '0.00';
165
+ const displayPrice = selectedVariant
166
+ ? `${(0, tool_1.getCurrencySymbol)(selectedVariant.price.currencyCode)}${totalPrice}`
167
+ : totalPrice;
153
168
  if (loading) {
154
169
  return (react_1.default.createElement("div", { className: 'add-to-cart-popup' },
155
170
  react_1.default.createElement("div", { className: 'loading' }, "Loading...")));
@@ -183,9 +198,7 @@ const AddToCartPopup = ({ isActive = true }) => {
183
198
  "Available: ",
184
199
  selectedVariant.quantityAvailable))),
185
200
  react_1.default.createElement("div", { className: 'variant-price-row' },
186
- react_1.default.createElement("div", { className: 'price' },
187
- "$",
188
- totalPrice),
201
+ react_1.default.createElement("div", { className: 'price' }, displayPrice),
189
202
  react_1.default.createElement("div", { className: 'quantity-selector' },
190
203
  react_1.default.createElement("button", { className: 'qty-btn', onClick: () => setQuantity(Math.max(1, quantity - 1)), disabled: quantity <= 1 }, "\u2212"),
191
204
  react_1.default.createElement("span", { className: 'qty-value' }, quantity),
@@ -195,11 +208,17 @@ const AddToCartPopup = ({ isActive = true }) => {
195
208
  react_1.default.createElement("div", { className: 'option-values' }, option.values.map(value => {
196
209
  const isAvailable = productData.variants.edges.some(({ node: variant }) => {
197
210
  const hasThisOption = variant.selectedOptions.some(opt => opt.name === option.name && opt.value === value);
198
- if (!hasThisOption || !variant.availableForSale)
211
+ if (!hasThisOption)
212
+ return false;
213
+ const matchesOtherSelections = Object.entries(selectedOptions).every(([key, val]) => {
214
+ if (key === option.name)
215
+ return true;
216
+ return variant.selectedOptions.some(opt => opt.name === key && opt.value === val);
217
+ });
218
+ if (!matchesOtherSelections)
219
+ return false;
220
+ if (!variant.availableForSale)
199
221
  return false;
200
- if (variant.quantityAvailable !== undefined) {
201
- return variant.quantityAvailable > 0;
202
- }
203
222
  return true;
204
223
  });
205
224
  const isSelected = selectedOptions[option.name] === value;
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const hooks_1 = require("../../../../core/hooks");
6
+ const tool_1 = require("../../../../core/utils/tool");
6
7
  require("./index.less");
7
8
  const AddToCartPopup = ({ isActive = true, onClose }) => {
8
9
  var _a, _b, _c, _d, _e, _f, _g;
9
- const { popupDetailData, globalConfig } = (0, hooks_1.useSxpDataSource)();
10
+ const { popupDetailData, globalConfig, bffFbReport } = (0, hooks_1.useSxpDataSource)();
10
11
  const [productData, setProductData] = (0, react_1.useState)(null);
11
12
  const [selectedOptions, setSelectedOptions] = (0, react_1.useState)({});
12
13
  const [selectedVariant, setSelectedVariant] = (0, react_1.useState)(null);
@@ -122,6 +123,17 @@ const AddToCartPopup = ({ isActive = true, onClose }) => {
122
123
  alert('Please select all options');
123
124
  return;
124
125
  }
126
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
127
+ eventName: 'sessionCompleted',
128
+ product: product ? [product] : undefined,
129
+ contentType: 'product',
130
+ rec: data,
131
+ position: data === null || data === void 0 ? void 0 : data.index,
132
+ cta_text: 'Add To Cart',
133
+ cta_action_type: 'add_to_cart',
134
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
135
+ target_url: `https://${shopifyDomain}/cart`
136
+ });
125
137
  const variantId = selectedVariant.id.split('/').pop();
126
138
  const checkoutUrl = `https://${shopifyDomain}/cart/${variantId}:${quantity}`;
127
139
  window.location.href = checkoutUrl;
@@ -129,7 +141,9 @@ const AddToCartPopup = ({ isActive = true, onClose }) => {
129
141
  const totalPrice = selectedVariant
130
142
  ? (parseFloat(selectedVariant.price.amount) * quantity).toFixed(2)
131
143
  : '0.00';
132
- const currency = (selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.price.currencyCode) || 'USD';
144
+ const displayPrice = selectedVariant
145
+ ? `${(0, tool_1.getCurrencySymbol)(selectedVariant.price.currencyCode)}${totalPrice}`
146
+ : totalPrice;
133
147
  if (loading) {
134
148
  return (react_1.default.createElement("div", { className: "add-to-cart-popup" },
135
149
  react_1.default.createElement("div", { className: "loading" }, "Loading...")));
@@ -154,9 +168,7 @@ const AddToCartPopup = ({ isActive = true, onClose }) => {
154
168
  react_1.default.createElement("div", { className: "variant-info" },
155
169
  react_1.default.createElement("div", { className: "variant-specs" }, Object.keys(selectedOptions).length > 0 ? (Object.entries(selectedOptions).map(([key, value]) => (react_1.default.createElement("span", { key: key, className: "spec-item" }, value)))) : (react_1.default.createElement("span", { className: "spec-placeholder" }, "Please select options"))),
156
170
  react_1.default.createElement("div", { className: "variant-price-row" },
157
- react_1.default.createElement("div", { className: "price" },
158
- "$",
159
- totalPrice),
171
+ react_1.default.createElement("div", { className: "price" }, displayPrice),
160
172
  react_1.default.createElement("div", { className: "quantity-selector" },
161
173
  react_1.default.createElement("button", { className: "qty-btn", onClick: () => setQuantity(Math.max(1, quantity - 1)), disabled: quantity <= 1 }, "\u2212"),
162
174
  react_1.default.createElement("span", { className: "qty-value" }, quantity),
@@ -166,7 +178,16 @@ const AddToCartPopup = ({ isActive = true, onClose }) => {
166
178
  react_1.default.createElement("div", { className: "option-values" }, option.values.map(value => {
167
179
  const isAvailable = productData.variants.edges.some(({ node: variant }) => {
168
180
  const hasThisOption = variant.selectedOptions.some(opt => opt.name === option.name && opt.value === value);
169
- return hasThisOption && variant.availableForSale;
181
+ if (!hasThisOption)
182
+ return false;
183
+ const matchesOtherSelections = Object.entries(selectedOptions).every(([key, val]) => {
184
+ if (key === option.name)
185
+ return true;
186
+ return variant.selectedOptions.some(opt => opt.name === key && opt.value === val);
187
+ });
188
+ if (!matchesOtherSelections)
189
+ return false;
190
+ return variant.availableForSale;
170
191
  });
171
192
  const isSelected = selectedOptions[option.name] === value;
172
193
  return (react_1.default.createElement("button", { key: value, className: `option-btn ${isSelected ? 'selected' : ''} ${!isAvailable ? 'disabled' : ''}`, onClick: () => isAvailable && handleOptionSelect(option.name, value), disabled: !isAvailable }, value));
@@ -229,6 +229,17 @@ const AddToCartPopup = (_a) => {
229
229
  quantity
230
230
  }]
231
231
  });
232
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
233
+ eventName: 'sessionCompleted',
234
+ product: product ? [product] : undefined,
235
+ contentType: 'product',
236
+ rec: data,
237
+ position,
238
+ cta_text: 'Add To Cart',
239
+ cta_action_type: 'add_to_cart',
240
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
241
+ target_url: cartUrl
242
+ });
232
243
  window.location.href = cartUrl;
233
244
  }, [selectedVariant, quantity, finalShopifyDomain, bffFbReport, product, data, position]);
234
245
  const totalPrice = (0, react_1.useMemo)(() => {
@@ -277,7 +288,7 @@ const AddToCartPopup = (_a) => {
277
288
  option.value)))),
278
289
  react_1.default.createElement("div", { className: "price-display" },
279
290
  react_1.default.createElement("span", { className: "price-value", style: variantStyles.price, dangerouslySetInnerHTML: {
280
- __html: (0, tool_1.setFontForText)(`${selectedVariant.price.currencyCode} $${totalPrice}`, variantStyles.price)
291
+ __html: (0, tool_1.setFontForText)(selectedVariant ? `${(0, tool_1.getCurrencySymbol)(selectedVariant.price.currencyCode)}${totalPrice}` : totalPrice, variantStyles.price)
281
292
  } })),
282
293
  react_1.default.createElement("div", { className: "quantity-selector-wrapper", style: quantityStyle },
283
294
  react_1.default.createElement("button", { className: "quantity-btn quantity-decrease", onClick: () => handleQuantityChange(-1), disabled: quantity <= 1, "aria-label": "Decrease quantity" }, "-"),
@@ -41,25 +41,30 @@ const CommodityDetail = (_a) => {
41
41
  }
42
42
  const handleLink = (e) => {
43
43
  if (enableAddToCart && addToCartPopupId) {
44
- setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, data), { index: position }));
45
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
46
- eventName: 'ClickCTA',
47
- product: product ? [product] : undefined,
48
- contentType: 'product',
49
- data,
50
- position,
51
- cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
52
- cta_action_type: 'open_internal_popup',
53
- target_content_id: product === null || product === void 0 ? void 0 : product.itemId
54
- });
55
- console.log('[CommodityDetail] 打开加购弹窗:', addToCartPopupId);
56
- if (typeof window !== 'undefined' && window.sxpPopup) {
57
- window.sxpPopup(addToCartPopupId);
44
+ if (!(product === null || product === void 0 ? void 0 : product.shopifyId)) {
45
+ console.warn('[CommodityDetail] Shopify 商品,跳过加购弹窗');
58
46
  }
59
47
  else {
60
- console.warn('[CommodityDetail] sxpPopup 方法不存在');
48
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, data), { index: position }));
49
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
50
+ eventName: 'ClickCTA',
51
+ product: product ? [product] : undefined,
52
+ contentType: 'product',
53
+ data,
54
+ position,
55
+ cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
56
+ cta_action_type: 'open_internal_popup',
57
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId
58
+ });
59
+ console.log('[CommodityDetail] 打开加购弹窗:', addToCartPopupId);
60
+ if (typeof window !== 'undefined' && window.sxpPopup) {
61
+ window.sxpPopup(addToCartPopupId);
62
+ }
63
+ else {
64
+ console.warn('[CommodityDetail] sxpPopup 方法不存在');
65
+ }
66
+ return;
61
67
  }
62
- return;
63
68
  }
64
69
  if (product === null || product === void 0 ? void 0 : product.link) {
65
70
  jumpToWeb(e, data, product, cta, position);
@@ -43,6 +43,31 @@ const CommodityDetailDiroNew = (_a) => {
43
43
  }
44
44
  const handleLink = (e) => {
45
45
  e.preventDefault();
46
+ if (!(product === null || product === void 0 ? void 0 : product.shopifyId)) {
47
+ console.warn('[CommodityDetailDiroNew] 非 Shopify 商品,跳转到外链');
48
+ ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
49
+ eventSubject: 'clickCta',
50
+ eventDescription: 'User clicked the CTA'
51
+ }, data, product, position);
52
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
53
+ eventName: 'ClickCTA',
54
+ product: product ? [product] : undefined,
55
+ contentType: 'product',
56
+ data,
57
+ position,
58
+ cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
59
+ cta_action_type: 'open_external_link',
60
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
61
+ target_url: product === null || product === void 0 ? void 0 : product.link
62
+ });
63
+ if (!isPost) {
64
+ productView(data, product, cta, viewTime || curTimeRef.current, position);
65
+ }
66
+ if (product === null || product === void 0 ? void 0 : product.link) {
67
+ window.location.href = window.getJointUtmLink(product.link);
68
+ }
69
+ return;
70
+ }
46
71
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
47
72
  eventSubject: 'clickCta',
48
73
  eventDescription: 'User clicked the CTA'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.20.28",
3
+ "version": "1.20.30",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",