Example #1
0
  state: { type: String, optional: true },
  zip: { type: String, optional: true },
  country: { type: String }, // maybe iso 2
  phone: { type: String, optional: true },
  email: { type: String, regEx: SimpleSchema.RegEx.Email, optional: true },
  is_residential: { type: Boolean, optional: true },
  validate: { type: Boolean, optional: true },
  metadata: { type: String, optional: true }
}, { check, tracker: Tracker });

registerSchema("addressSchema", addressSchema);

// Overrides the properties required for purchasing labels/shipping.
// we don't override the purpose because for some cases like getRatesForCart we don't want to
// purchase Labels(purpose="QUOTE" but we want all the fields required for purchasing to be present.
export const purchaseAddressSchema = addressSchema.clone().extend({
  name: String,
  street1: String,
  city: String,
  state: String,
  zip: String,
  phone: String,
  email: {
    type: String,
    regEx: SimpleSchema.RegEx.Email,
    optional: true
  }
});

registerSchema("purchaseAddressSchema", purchaseAddressSchema);
Example #2
0
    optional: true
  },
  "items.$": {
    type: PaymentItem
  },
  "shopId": {
    type: String,
    optional: true
  }
}, { check, tracker: Tracker });

registerSchema("PaymentMethod", PaymentMethod);

// When checking paymentMethod passed as a method arg, props like createdAt
// should be optional
export const PaymentMethodArgument = PaymentMethod.clone().extend({
  createdAt: {
    type: Date,
    optional: true,
    autoValue: null
  }
});

/**
 * @name Invoice
 * @type {SimpleSchema}
 * @memberof schemas
 * @property {String} transaction optional
 * @property {Number} shipping optional
 * @property {Number} taxes optional
 * @property {Number} subtotal required
Example #3
0
 * The Registry Schema allows package settings to be defined. For more, read the in-depth {@link https://blog.reactioncommerce.com/an-intro-to-architecture-the-registry/ Intro to Architecture: The Registry}.
 * @extends {PackageConfig}
 * @property {Object} settings.mail optional, Mail settings
 * @property {String} settings.mail.user Mail user
 * @property {String} settings.mail.password Mail password
 * @property {String} settings.mail.host Mail host
 * @property {String} settings.mail.port Mail port
 * @property {String} settings.openexchangerates.appId OpenExchangeRates Id
 * @property {String} settings.openexchangerates.refreshPeriod default value: `"every 1 hour"`
 * @property {String} settings.google.clientId default value: `null`
 * @property {String} settings.google.apiKey default value: `null`
 * @property {Object} settings.public optional Settings in `public` are published to the client.
 * @property {Boolean} settings.public.allowGuestCheckout allows guest checkout
 * @property {String} settings.cart.cleanupDurationDays default value: `"older than 3 days"`
 */
export const CorePackageConfig = PackageConfig.clone().extend({
  // Remove blackbox: true from settings obj
  "settings": {
    type: Object,
    optional: true,
    blackbox: false,
    defaultValue: {}
  },
  "settings.mail": {
    type: Object,
    optional: true,
    label: "Mail Settings"
  },
  "settings.mail.user": {
    type: String,
    label: "Username"
Example #4
0
    type: Number,
    label: "Width",
    min: 0,
    optional: true,
    defaultValue: 0
  }
});

/**
 * @name VariantBaseSchema
 * @memberof Schemas
 * @type {SimpleSchema}
 * @extends VariantBaseSchema
 * @property {VariantBaseSchema[]} options optional
 */
export const CatalogVariantSchema = VariantBaseSchema.clone().extend({
  "options": {
    type: Array,
    label: "Variant Options",
    optional: true
  },
  "options.$": {
    type: VariantBaseSchema
  }
});

/**
 * @name CatalogProduct
 * @memberof Schemas
 * @type {SimpleSchema}
 * @property {String} _id required