@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.
- package/CHANGELOG.md +6 -0
- package/dist/cdn/vtex-ads-stories.js +8 -8
- package/dist/cdn/vtex-ads-stories.js.map +1 -1
- package/dist/cjs/index.cjs +25 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/react.cjs.map +1 -1
- package/dist/cjs/react.d.cts +7 -3
- package/dist/cjs/{story-DAiAN9v-.d.cts → story-Ba9J0rbL.d.cts} +18 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +25 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react.d.ts +7 -3
- package/dist/esm/{story-DAiAN9v-.d.ts → story-Ba9J0rbL.d.ts} +18 -2
- package/package.json +1 -1
- package/src/locales/index.ts +6 -0
- package/src/react.ts +6 -2
- package/src/story/story.ts +30 -4
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as StoryHydration, a as StoryProductDetails, T as TAG_NAME, V as VtexAdsStoryCarouselElement, d as defineVtexAdsStoryCarousel } from './story-
|
|
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
|
|
package/dist/cjs/react.cjs.map
CHANGED
|
@@ -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 /**
|
|
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":[]}
|
package/dist/cjs/react.d.cts
CHANGED
|
@@ -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-
|
|
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
|
-
/**
|
|
38
|
+
/** Add to cart button's text. Default in the element's language. */
|
|
39
39
|
"label-add-to-cart"?: string;
|
|
40
|
-
/**
|
|
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
|
|
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
|
|
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
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as StoryHydration, a as StoryProductDetails, T as TAG_NAME, V as VtexAdsStoryCarouselElement, d as defineVtexAdsStoryCarousel } from './story-
|
|
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 {
|
|
3741
|
-
|
|
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" },
|