@vtex/ads-stories 0.7.0 → 0.8.0

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.
@@ -1,4 +1,4 @@
1
- export { S as StoryHydration, a as StoryProductDetails, T as TAG_NAME, V as VtexAdsStoryCarouselElement, d as defineVtexAdsStoryCarousel } from './story-DAiAN9v-.cjs';
1
+ export { S as StoryHydration, a as StoryProductDetails, T as TAG_NAME, V as VtexAdsStoryCarouselElement, d as defineVtexAdsStoryCarousel } from './story-Ba9J0rbL.cjs';
2
2
  import 'lit';
3
3
  import '@vtex/ads-core';
4
4
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react.ts"],"sourcesContent":["/**\n * React JSX types for <vtex-ads-story-carousel>. Types only: the JS output\n * is empty.\n *\n * Opt in once per project, so non-React projects never need @types/react:\n *\n * import type {} from \"@vtex/ads-stories/react\";\n *\n * or add \"@vtex/ads-stories/react\" to `compilerOptions.types` in tsconfig.\n */\nimport type { DetailedHTMLProps, HTMLAttributes } from \"react\";\nimport type { Channel } from \"@vtex/ads-core\";\nimport type { TAG_NAME, VtexAdsStoryCarouselElement } from \"./story\";\n\n/**\n * The element's own attributes. The required ones match the README: without\n * them, the element requests nothing and renders nothing.\n */\nexport interface VtexAdsStoryCarouselAttributes {\n /** The publisher the ads are requested for. */\n \"publisher-id\": string;\n /** The store's session, also used to deduplicate events. */\n \"session-id\": string;\n /** The Story placement configured for the publisher. */\n placement: string;\n \"user-id\"?: string;\n \"account-name\"?: string;\n /** `site` or `app`. */\n channel?: Channel;\n /** Time limit for the ad request, in milliseconds (default 2000). */\n timeout?: number;\n /** How many Stories to ask for: the carousel positions (default 8). */\n quantity?: number;\n /** Currency of the prices, ISO 4217 (\"BRL\"). Default BRL. */\n currency?: string;\n /** The add to cart button's text. Default in the element's language. */\n \"label-add-to-cart\"?: string;\n /** The view product button's text. Default in the element's language. */\n \"label-view-product\"?: string;\n /**\n * \"none\": no product request. To set a strategy, assign the element's\n * `hydration` property. Missing: Intelligent Search with `account-name`.\n */\n hydration?: \"none\";\n /** Time limit for the product request, in milliseconds (default 5000). */\n \"hydration-timeout\"?: number;\n /**\n * With more than one Story, the cards without the highlight also play\n * their video, muted. Off by default.\n */\n \"inactive-autoplay\"?: boolean;\n /**\n * With more than one Story, how long each one stays highlighted, in\n * milliseconds (default 5000). 0: no automatic advance. Never advances on\n * its own for people who prefer reduced motion.\n */\n \"slide-duration\"?: number;\n}\n\nexport type VtexAdsStoryCarouselProps = DetailedHTMLProps<\n HTMLAttributes<VtexAdsStoryCarouselElement>,\n VtexAdsStoryCarouselElement\n> &\n VtexAdsStoryCarouselAttributes;\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n [TAG_NAME]: VtexAdsStoryCarouselProps;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/react.ts"],"sourcesContent":["/**\n * React JSX types for <vtex-ads-story-carousel>. Types only: the JS output\n * is empty.\n *\n * Opt in once per project, so non-React projects never need @types/react:\n *\n * import type {} from \"@vtex/ads-stories/react\";\n *\n * or add \"@vtex/ads-stories/react\" to `compilerOptions.types` in tsconfig.\n */\nimport type { DetailedHTMLProps, HTMLAttributes } from \"react\";\nimport type { Channel } from \"@vtex/ads-core\";\nimport type { TAG_NAME, VtexAdsStoryCarouselElement } from \"./story\";\n\n/**\n * The element's own attributes. The required ones match the README: without\n * them, the element requests nothing and renders nothing.\n */\nexport interface VtexAdsStoryCarouselAttributes {\n /** The publisher the ads are requested for. */\n \"publisher-id\": string;\n /** The store's session, also used to deduplicate events. */\n \"session-id\": string;\n /** The Story placement configured for the publisher. */\n placement: string;\n \"user-id\"?: string;\n \"account-name\"?: string;\n /** `site` or `app`. */\n channel?: Channel;\n /** Time limit for the ad request, in milliseconds (default 2000). */\n timeout?: number;\n /** How many Stories to ask for: the carousel positions (default 8). */\n quantity?: number;\n /** Currency of the prices, ISO 4217 (\"BRL\"). Default BRL. */\n currency?: string;\n /** Add to cart button's text. Default in the element's language. */\n \"label-add-to-cart\"?: string;\n /** View product button's text. Default in the element's language. */\n \"label-view-product\"?: string;\n /** Unavailable product button's text. Default in the element's language. */\n \"label-unavailable\"?: string;\n /** Sold out text. Default in the element's language. */\n \"label-sold-out\"?: string;\n /**\n * \"none\": no product request. To set a strategy, assign the element's\n * `hydration` property. Missing: Intelligent Search with `account-name`.\n */\n hydration?: \"none\";\n /** Time limit for the product request, in milliseconds (default 5000). */\n \"hydration-timeout\"?: number;\n /**\n * With more than one Story, the cards without the highlight also play\n * their video, muted. Off by default.\n */\n \"inactive-autoplay\"?: boolean;\n /**\n * With more than one Story, how long each one stays highlighted, in\n * milliseconds (default 5000). 0: no automatic advance. Never advances on\n * its own for people who prefer reduced motion.\n */\n \"slide-duration\"?: number;\n}\n\nexport type VtexAdsStoryCarouselProps = DetailedHTMLProps<\n HTMLAttributes<VtexAdsStoryCarouselElement>,\n VtexAdsStoryCarouselElement\n> &\n VtexAdsStoryCarouselAttributes;\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n [TAG_NAME]: VtexAdsStoryCarouselProps;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import { DetailedHTMLProps, HTMLAttributes } from 'react';
2
2
  import { Channel } from '@vtex/ads-core';
3
- import { T as TAG_NAME, V as VtexAdsStoryCarouselElement } from './story-DAiAN9v-.cjs';
3
+ import { T as TAG_NAME, V as VtexAdsStoryCarouselElement } from './story-Ba9J0rbL.cjs';
4
4
  import 'lit';
5
5
 
6
6
  /**
@@ -35,10 +35,14 @@ interface VtexAdsStoryCarouselAttributes {
35
35
  quantity?: number;
36
36
  /** Currency of the prices, ISO 4217 ("BRL"). Default BRL. */
37
37
  currency?: string;
38
- /** The add to cart button's text. Default in the element's language. */
38
+ /** Add to cart button's text. Default in the element's language. */
39
39
  "label-add-to-cart"?: string;
40
- /** The view product button's text. Default in the element's language. */
40
+ /** View product button's text. Default in the element's language. */
41
41
  "label-view-product"?: string;
42
+ /** Unavailable product button's text. Default in the element's language. */
43
+ "label-unavailable"?: string;
44
+ /** Sold out text. Default in the element's language. */
45
+ "label-sold-out"?: string;
42
46
  /**
43
47
  * "none": no product request. To set a strategy, assign the element's
44
48
  * `hydration` property. Missing: Intelligent Search with `account-name`.
@@ -54,6 +54,12 @@ declare class VtexAdsStoryCarouselElement extends LitElement {
54
54
  labelViewProduct: {
55
55
  attribute: string;
56
56
  };
57
+ labelUnavailable: {
58
+ attribute: string;
59
+ };
60
+ labelSoldOut: {
61
+ attribute: string;
62
+ };
57
63
  hydration: {
58
64
  converter: {
59
65
  fromAttribute: (value: string | null) => "none" | undefined;
@@ -115,14 +121,24 @@ declare class VtexAdsStoryCarouselElement extends LitElement {
115
121
  currency?: string;
116
122
  /**
117
123
  * The add to cart button's text. Missing or blank: the default in the
118
- * element's language ("Adicionar ao carrinho").
124
+ * element's language.
119
125
  */
120
126
  labelAddToCart?: string;
121
127
  /**
122
128
  * The view product button's text. Missing or blank: the default in the
123
- * element's language ("Ver produto").
129
+ * element's language.
124
130
  */
125
131
  labelViewProduct?: string;
132
+ /**
133
+ * The text of the disabled button for a product that can't be bought.
134
+ * Missing or blank: the default in the element's language.
135
+ */
136
+ labelUnavailable?: string;
137
+ /**
138
+ * The sold out text, shown with the price and read by screen readers.
139
+ * Missing or blank: the default in the element's language.
140
+ */
141
+ labelSoldOut?: string;
126
142
  /**
127
143
  * Where the products' details (for now, their prices) come from. A
128
144
  * strategy (fetcher, matcher and price reader) is set as a property; the
@@ -1,4 +1,4 @@
1
- export { S as StoryHydration, a as StoryProductDetails, T as TAG_NAME, V as VtexAdsStoryCarouselElement, d as defineVtexAdsStoryCarousel } from './story-DAiAN9v-.js';
1
+ export { S as StoryHydration, a as StoryProductDetails, T as TAG_NAME, V as VtexAdsStoryCarouselElement, d as defineVtexAdsStoryCarousel } from './story-Ba9J0rbL.js';
2
2
  import 'lit';
3
3
  import '@vtex/ads-core';
4
4
 
package/dist/esm/index.js CHANGED
@@ -205,15 +205,19 @@ var BY_LANGUAGE = /* @__PURE__ */ new Map([
205
205
  ["en", en]
206
206
  ]);
207
207
  function labelsFor(locale, overrides = {}) {
208
- var _a, _b, _c;
208
+ var _a, _b, _c, _d, _e;
209
209
  const language = locale.split("-")[0].toLowerCase();
210
210
  const labels = (_a = BY_LANGUAGE.get(language)) != null ? _a : pt;
211
211
  const addToCart = (_b = overrides.addToCart) == null ? void 0 : _b.trim();
212
212
  const viewProduct = (_c = overrides.viewProduct) == null ? void 0 : _c.trim();
213
+ const unavailable = (_d = overrides.unavailable) == null ? void 0 : _d.trim();
214
+ const soldOut = (_e = overrides.soldOut) == null ? void 0 : _e.trim();
213
215
  return {
214
216
  ...labels,
215
217
  ...addToCart && { addToCart },
216
- ...viewProduct && { viewProduct }
218
+ ...viewProduct && { viewProduct },
219
+ ...unavailable && { unavailable },
220
+ ...soldOut && { soldOut }
217
221
  };
218
222
  }
219
223
 
@@ -3737,14 +3741,28 @@ var VtexAdsStoryCarouselElement = class extends LitElement {
3737
3741
  }
3738
3742
  get labels() {
3739
3743
  var _a;
3740
- const { locale, labelAddToCart = "", labelViewProduct = "" } = this;
3741
- const key = JSON.stringify([locale, labelAddToCart, labelViewProduct]);
3744
+ const {
3745
+ locale,
3746
+ labelAddToCart = "",
3747
+ labelViewProduct = "",
3748
+ labelUnavailable = "",
3749
+ labelSoldOut = ""
3750
+ } = this;
3751
+ const key = JSON.stringify([
3752
+ locale,
3753
+ labelAddToCart,
3754
+ labelViewProduct,
3755
+ labelUnavailable,
3756
+ labelSoldOut
3757
+ ]);
3742
3758
  if (((_a = this.labelSet) == null ? void 0 : _a.key) !== key) {
3743
3759
  this.labelSet = {
3744
3760
  key,
3745
3761
  labels: labelsFor(locale, {
3746
3762
  addToCart: labelAddToCart,
3747
- viewProduct: labelViewProduct
3763
+ viewProduct: labelViewProduct,
3764
+ unavailable: labelUnavailable,
3765
+ soldOut: labelSoldOut
3748
3766
  })
3749
3767
  };
3750
3768
  }
@@ -3853,6 +3871,8 @@ VtexAdsStoryCarouselElement.properties = {
3853
3871
  currency: {},
3854
3872
  labelAddToCart: { attribute: "label-add-to-cart" },
3855
3873
  labelViewProduct: { attribute: "label-view-product" },
3874
+ labelUnavailable: { attribute: "label-unavailable" },
3875
+ labelSoldOut: { attribute: "label-sold-out" },
3856
3876
  hydration: { converter: hydrationConverter },
3857
3877
  hydrationTimeout: { type: Number, attribute: "hydration-timeout" },
3858
3878
  slideDuration: { type: Number, attribute: "slide-duration" },