@gem-sdk/core 1.48.0-dev.43 → 1.48.0-dev.45

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.
@@ -76,9 +76,9 @@ const composeTypographyV2 = (value, attrs)=>{
76
76
  });
77
77
  };
78
78
  const composeFontFamilyTypographyV2 = (value)=>{
79
- const fontFamily = value?.fontFamily;
79
+ const { fontFamily, isCustom, fallbackFontFamily } = value || {};
80
80
  if (!fontFamily) {
81
- return value?.fallbackFontFamily;
81
+ return isCustom ? fallbackFontFamily : undefined;
82
82
  }
83
83
  if (typeof fontFamily === 'string') {
84
84
  return getFontUsedByTypographyV2({
@@ -121,15 +121,7 @@ const composeTypographyClassName = (typo, typography)=>{
121
121
  return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
122
122
  };
123
123
  const composeFallbackTypographyStyle = (tag)=>{
124
- if ([
125
- 'heading',
126
- 'heading-1',
127
- 'heading-2',
128
- 'heading-3',
129
- 'heading-4',
130
- 'heading-5',
131
- 'heading-6'
132
- ].includes(tag)) {
124
+ if (tag.toLocaleLowerCase().includes('heading')) {
133
125
  return 'var(--g-font-heading, heading)';
134
126
  }
135
127
  return 'var(--g-font-body, body)';
@@ -139,7 +131,8 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
139
131
  const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
140
132
  const customTypo = {
141
133
  ...typo.custom,
142
- fallbackFontFamily: fallbackFontFamily
134
+ fallbackFontFamily: fallbackFontFamily,
135
+ isCustom: !!typo.custom
143
136
  };
144
137
  return {
145
138
  ...composeTypographyV2(customTypo, typo.attrs),
@@ -74,9 +74,9 @@ const composeTypographyV2 = (value, attrs)=>{
74
74
  });
75
75
  };
76
76
  const composeFontFamilyTypographyV2 = (value)=>{
77
- const fontFamily = value?.fontFamily;
77
+ const { fontFamily, isCustom, fallbackFontFamily } = value || {};
78
78
  if (!fontFamily) {
79
- return value?.fallbackFontFamily;
79
+ return isCustom ? fallbackFontFamily : undefined;
80
80
  }
81
81
  if (typeof fontFamily === 'string') {
82
82
  return getFontUsedByTypographyV2({
@@ -119,15 +119,7 @@ const composeTypographyClassName = (typo, typography)=>{
119
119
  return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
120
120
  };
121
121
  const composeFallbackTypographyStyle = (tag)=>{
122
- if ([
123
- 'heading',
124
- 'heading-1',
125
- 'heading-2',
126
- 'heading-3',
127
- 'heading-4',
128
- 'heading-5',
129
- 'heading-6'
130
- ].includes(tag)) {
122
+ if (tag.toLocaleLowerCase().includes('heading')) {
131
123
  return 'var(--g-font-heading, heading)';
132
124
  }
133
125
  return 'var(--g-font-body, body)';
@@ -137,7 +129,8 @@ const composeTypographyStyle = (typo, typography, disableAttr)=>{
137
129
  const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
138
130
  const customTypo = {
139
131
  ...typo.custom,
140
- fallbackFontFamily: fallbackFontFamily
132
+ fallbackFontFamily: fallbackFontFamily,
133
+ isCustom: !!typo.custom
141
134
  };
142
135
  return {
143
136
  ...composeTypographyV2(customTypo, typo.attrs),
@@ -8033,8 +8033,79 @@ type ShapeSelectorControlType<T> = SharedControlType<T> & {
8033
8033
  type: 'shape-selector';
8034
8034
  };
8035
8035
 
8036
+ declare enum CompareType {
8037
+ EXACT = "exact",
8038
+ ABOVE = "above",
8039
+ BELOW = "below",
8040
+ EXACT_OR_ABOVE = "exact_or_above",
8041
+ EXACT_OR_BELOW = "exact_or_below",
8042
+ BETWEEN = "between"
8043
+ }
8044
+ declare enum TriggerType {
8045
+ INVENTORY_STATUS = "inventory_status",
8046
+ DISCOUNT_PRICE = "discount_price",
8047
+ PRICE_RANGE = "price_range",
8048
+ PRODUCT_TAGS = "product_tags",
8049
+ CREATION_DATE = "creation_date"
8050
+ }
8051
+ declare enum InventoryStatus {
8052
+ IN_STOCK = "in_stock",
8053
+ OUT_OF_STOCK = "out_of_stock"
8054
+ }
8055
+ declare enum CreationDateType {
8056
+ DURATION = "duration",
8057
+ EXACT_DATE = "exact_date",
8058
+ BETWEEN_DATES = "between_dates"
8059
+ }
8060
+ declare enum DiscountType {
8061
+ PERCENT = "percent",
8062
+ FIXED = "fixed"
8063
+ }
8064
+ type InventoryStatusTrigger = {
8065
+ triggerEvent: TriggerType.INVENTORY_STATUS;
8066
+ type: InventoryStatus;
8067
+ quantityType: CompareType;
8068
+ from: string;
8069
+ to?: string;
8070
+ priority: number;
8071
+ conditionType?: CompareType;
8072
+ };
8073
+ type DiscountPriceTrigger = {
8074
+ triggerEvent: TriggerType.DISCOUNT_PRICE;
8075
+ type: CompareType;
8076
+ amount?: string;
8077
+ from?: string;
8078
+ to?: string;
8079
+ priority: number;
8080
+ conditionType?: CompareType;
8081
+ discountType?: DiscountType;
8082
+ };
8083
+ type PriceRangeTrigger = {
8084
+ triggerEvent: TriggerType.PRICE_RANGE;
8085
+ from: string;
8086
+ to: string;
8087
+ priority: number;
8088
+ conditionType?: CompareType;
8089
+ };
8090
+ type CreationDateTrigger = {
8091
+ triggerEvent: TriggerType.CREATION_DATE;
8092
+ type: CreationDateType;
8093
+ days: string;
8094
+ from: string;
8095
+ to: string;
8096
+ priority: number;
8097
+ conditionType?: CompareType;
8098
+ };
8099
+ type ProductTagTrigger = {
8100
+ triggerEvent: TriggerType.PRODUCT_TAGS;
8101
+ searchTag: string[];
8102
+ priority: number;
8103
+ conditionType?: CompareType;
8104
+ };
8105
+ type TDisplayTrigger = InventoryStatusTrigger | DiscountPriceTrigger | PriceRangeTrigger | ProductTagTrigger | CreationDateTrigger;
8036
8106
  type DisplayTriggerControlType<T> = SharedControlType<T> & {
8037
8107
  type: 'display-trigger-badge';
8108
+ default: TDisplayTrigger[];
8038
8109
  };
8039
8110
 
8040
8111
  type CustomPositionControlType<T> = SharedControlType<T> & {
@@ -28498,6 +28569,7 @@ type TypographyProps = {
28498
28569
  fallbackFontFamily?: string;
28499
28570
  textShadow?: ShadowProps;
28500
28571
  hasShadowText?: boolean;
28572
+ isCustom?: boolean;
28501
28573
  };
28502
28574
  type TypographyV2Props = Omit<TypographyProps, 'fontSize' | 'lineHeight'> & {
28503
28575
  fontSize?: ObjectDevices<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.48.0-dev.43",
3
+ "version": "1.48.0-dev.45",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",